Esempio n. 1
0
        /// <summary>
        /// Handles the xWorks message for Edit Parser Parameters
        /// </summary>
        /// <param name="argument">The xCore Command object.</param>
        /// <returns>false</returns>
        public bool OnEditParserParameters(object argument)
        {
            CheckDisposed();

            var cache = m_propertyTable.GetValue <LcmCache>("cache");

            if (cache == null)
            {
                throw new ArgumentException("no cache!");
            }

            using (var dlg = new ParserParametersDlg(m_propertyTable.GetValue <IHelpTopicProvider>("HelpTopicProvider")))
            {
                IMoMorphData md = cache.LangProject.MorphologicalDataOA;
                dlg.SetDlgInfo(ParserUIStrings.ksParserParameters, md.ParserParameters);
                if (dlg.ShowDialog(m_propertyTable.GetValue <XWindow>("window")) == DialogResult.OK)
                {
                    using (var helper = new UndoableUnitOfWorkHelper(
                               cache.ActionHandlerAccessor,
                               ParserUIStrings.ksUndoEditingParserParameters,
                               ParserUIStrings.ksRedoEditingParserParameters))
                    {
                        md.ParserParameters = dlg.XmlRep;
                        helper.RollBack     = false;
                    }
                }
            }
            return(true);
        }
Esempio n. 2
0
        public void SetDlgInfo(LcmCache cache, Mediator mediator, PropertyTable propertyTable, ComplexConcMorphNode node)
        {
            m_cache = cache;
            m_node  = node;

            m_formTextBox.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor;
            m_formTextBox.AdjustForStyleSheet(FontHeightAdjuster.StyleSheetFromPropertyTable(propertyTable));

            m_glossTextBox.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor;
            m_glossTextBox.AdjustForStyleSheet(FontHeightAdjuster.StyleSheetFromPropertyTable(propertyTable));

            m_entryTextBox.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor;
            m_entryTextBox.AdjustForStyleSheet(FontHeightAdjuster.StyleSheetFromPropertyTable(propertyTable));

            m_categoryComboBox.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor;

            foreach (CoreWritingSystemDefinition ws in m_cache.ServiceLocator.WritingSystems.CurrentVernacularWritingSystems)
            {
                m_formWsComboBox.Items.Add(ws);
                m_entryWsComboBox.Items.Add(ws);
            }

            foreach (CoreWritingSystemDefinition ws in m_cache.ServiceLocator.WritingSystems.CurrentAnalysisWritingSystems)
            {
                m_glossWsComboBox.Items.Add(ws);
            }

            m_inflModel = new InflFeatureTreeModel(m_cache.LangProject.MsFeatureSystemOA, m_node.InflFeatures, m_imageList.Images[0], m_imageList.Images[1]);
            m_inflFeatsTreeView.Model = m_inflModel;
            m_inflFeatsTreeView.ExpandAll();

            SetTextBoxValue(m_node.Form, m_formTextBox, m_formWsComboBox, true);
            SetTextBoxValue(m_node.Entry, m_entryTextBox, m_entryWsComboBox, true);
            SetTextBoxValue(m_node.Gloss, m_glossTextBox, m_glossWsComboBox, false);

            m_catPopupTreeManager = new PossibilityComboController(m_categoryComboBox,
                                                                   m_cache,
                                                                   m_cache.LanguageProject.PartsOfSpeechOA,
                                                                   m_cache.ServiceLocator.WritingSystems.DefaultAnalysisWritingSystem.Handle,
                                                                   false,
                                                                   mediator,
                                                                   propertyTable,
                                                                   propertyTable.GetValue <Form>("window"));

            if (m_node.Category != null)
            {
                m_categoryNotCheckBox.Checked = m_node.NegateCategory;
                m_catPopupTreeManager.LoadPopupTree(m_node.Category.Hvo);
            }
            else
            {
                m_catPopupTreeManager.LoadPopupTree(0);
            }

            m_helpTopicProvider = propertyTable.GetValue <IHelpTopicProvider>("HelpTopicProvider");

            m_helpProvider.HelpNamespace = m_helpTopicProvider.HelpFile;
            m_helpProvider.SetHelpKeyword(this, m_helpTopicProvider.GetHelpString(s_helpTopic));
            m_helpProvider.SetHelpNavigator(this, HelpNavigator.Topic);
        }
Esempio n. 3
0
        private void InitializeInfoView(RecordClerk clerk)
        {
            if (m_mediator == null)
            {
                return;
            }
            if (m_propertyTable == null)
            {
                return;
            }
            var xnWindow = m_propertyTable.GetValue <XmlNode>("WindowConfiguration");

            if (xnWindow == null)
            {
                return;
            }
            XmlNode xnControl = xnWindow.SelectSingleNode(
                "controls/parameters/guicontrol[@id=\"TextInformationPane\"]/control/parameters");

            if (xnControl == null)
            {
                return;
            }
            var activeClerk = m_propertyTable.GetValue <RecordClerk>("ActiveClerk");
            var toolChoice  = m_propertyTable.GetStringProperty("currentContentControl", null);

            if (m_xrev != null)
            {
                //when re-using the infoview we want to remove and dispose of the old recordeditview and
                //associated datatree. (LT-13216)
                Controls.Remove(m_xrev);
                m_xrev.Dispose();
            }
            m_xrev = new InterlinearTextsRecordEditView(this);
            if (clerk.GetType().Name == "InterlinearTextsRecordClerk")
            {
                m_xrev.Clerk = clerk;
            }
            else
            {
                //We want to make sure that the following initialization line will initialize this
                //clerk if we haven't already set it. Without this assignment to null, the InfoPane
                //misbehaves in the Concordance view (it uses the filter from the InterlinearTexts view)
                m_xrev.Clerk = null;
            }
            m_xrev.Init(m_mediator, m_propertyTable, xnControl);             // <-- This call will change the ActiveClerk
            DisplayCurrentRoot();
            m_xrev.Dock = DockStyle.Fill;
            Controls.Add(m_xrev);
            // There are times when moving to the InfoPane causes the wrong ActiveClerk to be set.
            // See FWR-3390 (and InterlinearTextsRecordClerk.OnDisplayInsertInterlinText).
            var activeClerkNew = m_propertyTable.GetValue <RecordClerk>("ActiveClerk");

            if (toolChoice != "interlinearEdit" && activeClerk != null && activeClerk != activeClerkNew)
            {
                m_propertyTable.SetProperty("ActiveClerk", activeClerk, true);
                activeClerk.ActivateUI(true);
            }
        }
Esempio n. 4
0
 private void GetCache()
 {
     if (m_propertyTable == null)
     {
         return;
     }
     Cache = (FdoCache)m_propertyTable.GetValue("cache");
 }
Esempio n. 5
0
        private void RestartSpellChecking()
        {
            IApp app = m_propertyTable.GetValue <IApp>("App");

            if (app != null)
            {
                app.RestartSpellChecking();
            }
        }
Esempio n. 6
0
 private void CustomListDlg_Load(object sender, EventArgs e)
 {
     if (m_propertyTable.GetValue <IHelpTopicProvider>("HelpTopicProvider") != null)
     {
         InitializeHelpProvider();
     }
     m_stylesheet = FontHeightAdjuster.StyleSheetFromPropertyTable(m_propertyTable);
     InitializeMultiStringControls();
     InitializeDialogFields();
     m_finSetup = false;
 }
Esempio n. 7
0
        public ImportWordSetDlg(Mediator mediator, PropertyTable propertyTable)
            : this()
        {
            //InitializeComponent();
            m_mediator = mediator;
            m_cache    = propertyTable.GetValue <LcmCache>("cache");

            m_helpTopicProvider        = propertyTable.GetValue <IHelpTopicProvider>("HelpTopicProvider");
            helpProvider               = new HelpProvider();
            helpProvider.HelpNamespace = m_helpTopicProvider.HelpFile;
            helpProvider.SetHelpKeyword(this, m_helpTopicProvider.GetHelpString(s_helpTopic));
            helpProvider.SetHelpNavigator(this, HelpNavigator.Topic);
        }
Esempio n. 8
0
        public virtual void Init(Mediator mediator, PropertyTable propertyTable, XmlNode configurationParameters)
        {
            CheckDisposed();
            m_mediator                = mediator;
            m_propertyTable           = propertyTable;
            m_helpTopicProvider       = m_propertyTable.GetValue <IHelpTopicProvider>("HelpTopicProvider");
            m_configurationParameters = configurationParameters;
            m_cache = m_propertyTable.GetValue <LcmCache>("cache");
            string name = RecordClerk.GetCorrespondingPropertyName(XmlUtils.GetAttributeValue(configurationParameters, "clerk"));

            m_clerk = m_propertyTable.GetValue <OccurrencesOfSelectedUnit>(name) ?? (OccurrencesOfSelectedUnit)RecordClerkFactory.CreateClerk(m_mediator, m_propertyTable, m_configurationParameters, true);
            m_clerk.ConcordanceControl = this;
        }
Esempio n. 9
0
        /// <summary>
        /// Send the newly selected wordform on to the parser.
        /// </summary>
        public void OnPropertyChanged(string propertyName)
        {
            CheckDisposed();

            if (m_parserConnection != null && propertyName == "ActiveClerkSelectedObject")
            {
                var wordform = m_propertyTable.GetValue <ICmObject>(propertyName) as IWfiWordform;
                if (wordform != null)
                {
                    m_parserConnection.UpdateWordform(wordform, ParserPriority.High);
                }
            }
        }
Esempio n. 10
0
        private void OnDeleteConfiguration(object sender, EventArgs eventArgs)         // REVIEW (Hasso) 2017.01: this should be two methods, since there are two buttons.
        {
            var configurationToDelete = SelectedConfiguration;

            if (configurationToDelete == null)
            {
                return;
            }

            using (var dlg = new ConfirmDeleteObjectDlg(_propertyTable.GetValue <FwXApp>("App")))
            {
                dlg.WindowTitle = xWorksStrings.Confirm + " " + xWorksStrings.Delete;
                var kindOfConfiguration = DictionaryConfigurationListener.GetDictionaryConfigurationType(_propertyTable);
                dlg.TopBodyText = String.Format("{0} {1}: {2}", kindOfConfiguration, xWorksStrings.View, configurationToDelete.Label);

                if (IsConfigurationACustomizedOriginal(configurationToDelete))
                {
                    if (IsConfigurationAnOriginalReversal(configurationToDelete, _cache) && !IsAllReversalIndexConfig(configurationToDelete))
                    {
                        dlg.TopMessage = xWorksStrings.YouAreResettingReversal;
                    }
                    else
                    {
                        dlg.TopMessage = xWorksStrings.YouAreResetting;
                    }
                    dlg.BottomQuestion   = xWorksStrings.WantContinue;
                    dlg.DeleteButtonText = xWorksStrings.Reset;
                    dlg.WindowTitle      = xWorksStrings.Confirm + " " + xWorksStrings.Reset;
                }

                if (dlg.ShowDialog() != DialogResult.Yes)
                {
                    return;
                }
            }

            DeleteConfiguration(configurationToDelete);
            ReLoadConfigurations();

            // Re-select configuration that was reset, or select first configuration if we just deleted a
            // configuration.
            if (IsConfigurationACustomizedOriginal(configurationToDelete))
            {
                _view.configurationsListView.Items.Cast <ListViewItem>().First(item => item.Text == configurationToDelete.Label).Selected = true;
            }
            else
            {
                _view.configurationsListView.Items[0].Selected = true;
            }
        }
Esempio n. 11
0
        /// <summary>
        /// this is called when XCore wants to display something that relies on the list with the id "WritingSystemList"
        /// </summary>
        /// <param name="parameter">The parameter.</param>
        /// <param name="display">The display.</param>
        /// <returns></returns>
        public bool OnDisplayWritingSystemList(object parameter, ref UIListDisplayProperties display)
        {
            CheckDisposed();

            display.List.Clear();
            LcmCache         cache    = m_propertyTable.GetValue <LcmCache>("cache");
            string           wsSet    = parameter as string;
            WritingSystemSet setToUse = m_currentSet;

            if (wsSet != null)
            {
                // JohnT: This is a patch to fix LT-5059. The problem is that the WritingSystemList set
                // (with the pronunciation subset) is used in the Pronuciation field pull-down menu.
                // All other code that I can find currently does not specify it. Therefore, after this
                // menu is displayed once, m_currentSet is set to pronunciation and stays there.
                // It seems that we actually have no current use for any other subset, nor for remembering
                // the most recent one specified. However, in the interests of making the change minimal,
                // and in case there is some anticipated application of tracking the current set which
                // I am not aware of, I made a way for that one menu item to get the list it needs
                // without making a persistent change.
                string tempPrefix = "temp:";
                bool   fTemp      = wsSet.StartsWith(tempPrefix);
                if (fTemp)
                {
                    setToUse = DecodeSetName(wsSet.Substring(tempPrefix.Length));
                }
                else
                {
                    m_currentSet = setToUse = DecodeSetName(wsSet);
                }
            }
            switch (setToUse)
            {
            default:
                throw new NotImplementedException("That writing system set needs to be implemented");

            case WritingSystemSet.All:
                AddWritingSystemList(display, cache.ServiceLocator.WritingSystemManager.WritingSystems);
                break;

            case WritingSystemSet.AllCurrent:
                AddWritingSystemList(display, cache.ServiceLocator.WritingSystems.AllWritingSystems);
                break;

            case WritingSystemSet.CurrentAnalysis:
                AddWritingSystemList(display, cache.ServiceLocator.WritingSystems.CurrentAnalysisWritingSystems);
                break;

            case WritingSystemSet.CurrentVernacular:
                AddWritingSystemList(display, cache.ServiceLocator.WritingSystems.CurrentVernacularWritingSystems);
                break;

            case WritingSystemSet.CurrentPronounciation:
                AddWritingSystemList(display, cache.ServiceLocator.WritingSystems.CurrentPronunciationWritingSystems);
                string sValue = DomainObjectServices.JoinIds(cache.ServiceLocator.WritingSystems.CurrentPronunciationWritingSystems.Select(ws => ws.Handle).ToArray(), ",");
                m_propertyTable.SetProperty("PronunciationWritingSystemHvos", sValue, true);
                break;
            }
            return(true);           //we handled this, no need to ask anyone else.
        }
Esempio n. 12
0
        /// <summary>
        /// Get the active selection in the mediator's main window. This determines what we will apply the command to.
        /// </summary>
        /// <returns></returns>
        private IVwSelection GetSelection()
        {
            var window = m_propertyTable.GetValue <FwXWindow>("window");

            if (window == null || !(window.ActiveView is IVwRootSite))
            {
                return(null);
            }
            var rootBox = ((IVwRootSite)window.ActiveView).RootBox;

            if (rootBox == null)
            {
                return(null);                // paranoia
            }
            return(rootBox.Selection);
        }
Esempio n. 13
0
        private IEnumerable <IMoInflAffixSlot> GetSlots()
        {
            if (m_morphType == null)
            {
                // Not called by InsertEntryDlg; need to figure out the morphtype(s)
                var lex = m_propertyTable.GetValue <ILexEntry>("ActiveClerkSelectedObject");
                if (lex != null)
                {
                    return(DomainObjectServices.GetSlots(m_cache, lex, m_selectedMainPOS));
                }

                return(m_selectedMainPOS.AllAffixSlots);
            }

            // Called by InsertEntryDlg so we know the morphtype
            bool fIsPrefixal = MorphServices.IsPrefixishType(m_cache, m_morphType.Hvo);
            bool fIsSuffixal = MorphServices.IsSuffixishType(m_cache, m_morphType.Hvo);

            if (fIsPrefixal && fIsSuffixal)
            {
                return(m_selectedMainPOS.AllAffixSlots);
            }

            return(DomainObjectServices.GetSomeSlots(m_cache, m_selectedMainPOS.AllAffixSlots, fIsPrefixal));
        }
Esempio n. 14
0
            public static ClerkActivator ActivateClerkMatchingExportType(string exportType, PropertyTable propertyTable, Mediator mediator)
            {
                var          isDictionary = exportType == DictionaryType;
                const string area         = "lexicon";
                var          tool         = isDictionary ? "lexiconDictionary" : "reversalToolEditComplete";
                var          collector    = new XmlNode[1];
                var          parameter    = new Tuple <string, string, XmlNode[]>(area, tool, collector);

                mediator.SendMessage("GetContentControlParameters", parameter);
                var parameters   = collector[0].SelectSingleNode(".//parameters[@clerk]");
                var currentClerk = propertyTable.GetValue <RecordClerk>("ActiveClerk", null);

                if (DoesClerkMatchParams(currentClerk, parameters))
                {
                    return(null);                    // No need to juggle clerks if the one we want is already active
                }
                var tempClerk = isDictionary ? s_dictionaryClerk : s_reversalIndexClerk;

                if (tempClerk == null || tempClerk.IsDisposed)
                {
                    tempClerk = RecordClerk.FindClerk(propertyTable, isDictionary ? "entries" : "AllReversalEntries");
                    if (tempClerk == null || tempClerk.IsDisposed)
                    {
                        tempClerk = RecordClerkFactory.CreateClerk(mediator, propertyTable, parameters, true);
                    }
                    CacheClerk(exportType, tempClerk);
                }
                tempClerk.ActivateUI(true, false);
                tempClerk.UpdateList(true, true);
                return(new ClerkActivator(currentClerk));                // ensure the current active clerk is reactivated after we use the temporary clerk.
            }
Esempio n. 15
0
        /// <summary>
        /// From IFwExtension
        /// </summary>
        /// <param name="cache"></param>
        /// <param name="mediator"></param>
        /// <param name="propertyTable"></param>
        public void Init(LcmCache cache, XCore.Mediator mediator, PropertyTable propertyTable)
        {
            CheckDisposed();

            m_cache         = cache;
            m_mediator      = mediator;
            m_propertyTable = propertyTable;
            m_sRootDir      = FwDirectoryFinder.CodeDirectory;
            if (!m_sRootDir.EndsWith("\\"))
            {
                m_sRootDir += "\\";
            }
            m_sRootDir += "Language Explorer\\Import\\";

            m_sTempDir = Path.Combine(Path.GetTempPath(), "LanguageExplorer\\");
            if (!Directory.Exists(m_sTempDir))
            {
                Directory.CreateDirectory(m_sTempDir);
            }
            m_sLastXmlFileName = "";

            var helpTopicProvider = m_propertyTable.GetValue <IHelpTopicProvider>("HelpTopicProvider");

            if (helpTopicProvider != null)             // FwApp.App could be null during tests
            {
                helpProvider = new HelpProvider();
                helpProvider.HelpNamespace = helpTopicProvider.HelpFile;
                helpProvider.SetHelpKeyword(this, helpTopicProvider.GetHelpString(s_helpTopic));
                helpProvider.SetHelpNavigator(this, HelpNavigator.Topic);
            }
        }
Esempio n. 16
0
        public void Init(Mediator mediator, PropertyTable propertyTable, XmlNode configurationParameters)
        {
            CheckDisposed();
            _mediator      = mediator;        //allows the Cache property to function
            _propertyTable = propertyTable;
            _cache         = _propertyTable.GetValue <LcmCache>("cache");

            string name  = XmlUtils.GetAttributeValue(configurationParameters, "clerk");
            var    clerk = RecordClerk.FindClerk(_propertyTable, name);

            m_clerk = (clerk == null || clerk is TemporaryRecordClerk) ?
                      (InterlinearTextsRecordClerk)RecordClerkFactory.CreateClerk(mediator, _propertyTable, configurationParameters, true) :
                      (InterlinearTextsRecordClerk)clerk;
            // There's no record bar for it to control, but it should control the staus bar (e.g., it should update if we change
            // the set of selected texts).
            m_clerk.ActivateUI(true);
            _areaName = XmlUtils.GetOptionalAttributeValue(configurationParameters, "area", "unknown");
            RebuildStatisticsTable();
            //add ourselves so that we can receive messages (related to the text selection currently misnamed AddTexts)
            mediator.AddColleague(this);
            //add our current state to the history system
            string toolName = _propertyTable.GetStringProperty("currentContentControl", "");

            mediator.SendMessage("AddContextToHistory", new FwLinkArgs(toolName, Guid.Empty), false);
        }
Esempio n. 17
0
        /// <summary>
        /// Fetches the GUID value of the given property, having checked it is a valid object.
        /// If it is not a valid object, the property is removed.
        /// </summary>
        /// <param name="propertyTable"></param>
        /// <param name="key">Property name</param>
        /// <returns>The ReversalIndexGuid, or empty GUID if there is a problem</returns>
        public static Guid GetObjectGuidIfValid(PropertyTable propertyTable, string key)
        {
            var sGuid = propertyTable.GetStringProperty(key, "");

            if (string.IsNullOrEmpty(sGuid))
            {
                return(Guid.Empty);
            }

            Guid guid;

            try
            {
                guid = new Guid(sGuid);
            }
            catch
            {
                return(Guid.Empty);
            }

            var cache = propertyTable.GetValue <LcmCache>("cache");

            if (!cache.ServiceLocator.ObjectRepository.IsValidObjectId(guid))
            {
                propertyTable.RemoveProperty(key);
                return(Guid.Empty);
            }
            return(guid);
        }
Esempio n. 18
0
        public void MigrateIfNeeded(SimpleLogger logger, PropertyTable propertyTable, string appVersion)
        {
            m_logger = logger;
            Cache    = propertyTable.GetValue <LcmCache>("cache");
            var foundOne = string.Format("{0}: Configuration was found in need of migration. - {1}",
                                         appVersion, DateTime.Now.ToString("yyyy MMM d h:mm:ss"));
            var configSettingsDir   = LcmFileHelper.GetConfigSettingsDir(Cache.ProjectId.ProjectFolder);
            var dictionaryConfigLoc = Path.Combine(configSettingsDir, DictionaryConfigurationListener.DictionaryConfigurationDirectoryName);
            var stemPath            = Path.Combine(dictionaryConfigLoc, "Stem" + DictionaryConfigurationModel.FileExtension);
            var lexemePath          = Path.Combine(dictionaryConfigLoc, "Lexeme" + DictionaryConfigurationModel.FileExtension);

            if (File.Exists(stemPath) && !File.Exists(lexemePath))
            {
                File.Move(stemPath, lexemePath);
            }
            RenameReversalConfigFiles(configSettingsDir);
            foreach (var config in DCM.GetConfigsNeedingMigration(Cache, DCM.VersionCurrent))
            {
                m_logger.WriteLine(foundOne);
                if (config.Label.StartsWith("Stem-"))
                {
                    config.Label = config.Label.Replace("Stem-", "Lexeme-");
                }
                m_logger.WriteLine(string.Format("Migrating {0} configuration '{1}' from version {2} to {3}.",
                                                 config.Type, config.Label, config.Version, DCM.VersionCurrent));
                m_logger.IncreaseIndent();
                MigrateFrom83Alpha(logger, config, LoadBetaDefaultForAlphaConfig(config));
                config.Save();
                m_logger.DecreaseIndent();
            }
        }
Esempio n. 19
0
 /// <summary>
 /// Handles the xCore message to go to a reversal entry.
 /// </summary>
 /// <param name="argument">The xCore Command object.</param>
 /// <returns>true</returns>
 public bool OnGotoReversalEntry(object argument)
 {
     CheckDisposed();
     using (var dlg = new ReversalEntryGoDlg())
     {
         dlg.ReversalIndex = Entry.ReversalIndex;
         var cache = m_propertyTable.GetValue <LcmCache>("cache");
         dlg.SetDlgInfo(cache, null, m_mediator, m_propertyTable);
         if (dlg.ShowDialog() == DialogResult.OK)
         {
             // Can't Go to a subentry, so we have to go to its main entry.
             var selEntry = (IReversalIndexEntry)dlg.SelectedObject;
             m_mediator.BroadcastMessageUntilHandled("JumpToRecord", selEntry.MainEntry.Hvo);
         }
     }
     return(true);
 }
Esempio n. 20
0
        /// <summary>
        /// Set up the dlg in preparation to showing it.
        /// </summary>
        public void SetDlgInfo(LcmCache cache, PropertyTable propertyTable, ILexEntry entry)
        {
            CheckDisposed();

            Debug.Assert(cache != null);

            m_propertyTable = propertyTable;
            m_cache         = cache;
            m_entry         = entry;
            m_fwTextBoxBottomMsg.WritingSystemFactory = m_cache.WritingSystemFactory;
            //m_fwTextBoxBottomMsg.WritingSystemCode = 1; // What!? Why? No longer makes ANY sense!
            IVwStylesheet stylesheet = FontHeightAdjuster.StyleSheetFromPropertyTable(m_propertyTable);

            // We want to do this BEFORE the text gets set, to avoid overriding its height properties.
            // However, because of putting multiple lines in the box, we also need to do it AFTER we set the text
            // (in SetBottomMessage) so it adjusts to the resulting even greater height.
            m_fwTextBoxBottomMsg.AdjustForStyleSheet(this, null, stylesheet);
            Font f = FontHeightAdjuster.GetFontForNormalStyle(
                m_cache.ServiceLocator.WritingSystems.DefaultVernacularWritingSystem.Handle, stylesheet, m_cache.LanguageWritingSystemFactoryAccessor);

            foreach (IMoForm allo in entry.AlternateFormsOS)
            {
                ListViewItem lvi = m_lvAlloOptions.Items.Add(allo.Form.VernacularDefaultWritingSystem.Text);
                lvi.Tag = allo;
                lvi.UseItemStyleForSubItems = true;
                lvi.Font = f;
            }
            m_lvAlloOptions.Font = f;
            // Get location to the stored values, if any.
            //object locWnd = m_mediator.PropertyTable.GetValue("swapDlgLocation");
            // And when I do this, it works the first time, but later times the window is
            // too small and doesn't show all the controls. Give up on smart location for now.
            //object szWnd = this.Size;
            //object szWnd = null; // suppresses the smart location stuff.
            //if (locWnd != null && szWnd != null)
            //{
            //    Rectangle rect = new Rectangle((Point)locWnd, (Size)szWnd);
            //    ScreenUtils.EnsureVisibleRect(ref rect);
            //    DesktopBounds = rect;
            //    StartPosition = FormStartPosition.Manual;
            //}
            m_lvAlloOptions.Items[0].Selected = true;
            Text        = LexEdStrings.ksSwapLexWithAllo;
            label2.Text = LexEdStrings.ksAlternateForms;

            // Determine the help file to use, if any
            m_helpTopic = "khtpSwapLexemeWithAllomorph";

            var helpTopicProvider = m_propertyTable.GetValue <IHelpTopicProvider>("HelpTopicProvider");

            if (helpTopicProvider != null)
            {
                helpProvider = new HelpProvider();
                helpProvider.HelpNamespace = helpTopicProvider.HelpFile;
                helpProvider.SetHelpKeyword(this, helpTopicProvider.GetHelpString(m_helpTopic));
                helpProvider.SetHelpNavigator(this, HelpNavigator.Topic);
            }
        }
Esempio n. 21
0
        public void SetDlgInfo(Mediator mediator, PropertyTable propertyTable, IWfiWordform wordform, ParserListener parserListener)
        {
            Mediator          = mediator;
            PropTable         = propertyTable;
            m_persistProvider = new PersistenceProvider(Mediator, propertyTable, PersistProviderID);
            m_cache           = PropTable.GetValue <LcmCache>("cache");
            m_parserListener  = parserListener;

            Text = m_cache.ProjectId.UiName + " - " + Text;
            SetRootSite();
            SetFontInfo();
            // restore window location and size after setting up the form textbox, because it might adjust size of
            // window causing the window to grow every time it is opened
            m_persistProvider.RestoreWindowSettings(PersistProviderID, this);
            if (wordform == null)
            {
                GetLastWordUsed();
            }
            else
            {
                SetWordToUse(wordform.Form.VernacularDefaultWritingSystem.Text);
            }

            m_webPageInteractor = new WebPageInteractor(m_htmlControl, Mediator, m_cache, m_wordformTextBox);

            // No such thing as FwApp.App now: if(FwApp.App != null) // Could be null during testing
            var helpTopicProvider = PropTable.GetValue <IHelpTopicProvider>("HelpTopicProvider");

            if (helpTopicProvider != null)             // trying this
            {
                m_helpProvider.HelpNamespace = helpTopicProvider.HelpFile;
                m_helpProvider.SetHelpKeyword(this, helpTopicProvider.GetHelpString(HelpTopicID));
                m_helpProvider.SetHelpNavigator(this, HelpNavigator.Topic);
            }

            if (m_parserListener.Connection != null)
            {
                m_parserListener.Connection.TryAWordDialogIsRunning = true;
                m_statusLabel.Text = GetString("ParserStatusPrefix") + ParserUIStrings.ksIdle_ + GetString("ParserStatusSuffix");
            }
            else
            {
                m_statusLabel.Text = ParserStoppedMessage();
            }
        }
Esempio n. 22
0
 public XAmpleWordGrammarDebugger(PropertyTable propertyTable, XDocument parseResult)
 {
     m_propertyTable         = propertyTable;
     m_parseResult           = parseResult;
     m_cache                 = m_propertyTable.GetValue <LcmCache>("cache");
     m_xmlHtmlStack          = new Stack <Tuple <XDocument, string> >();
     m_intermediateTransform = new XslCompiledTransform();
     m_intermediateTransform.Load(Path.Combine(Path.GetTempPath(), m_cache.ProjectId.Name + "XAmpleWordGrammarDebugger.xsl"), new XsltSettings(true, false), new XmlUrlResolver());
 }
Esempio n. 23
0
        private void btnMenu_Click(object sender, EventArgs e)
        {
            XWindow window = m_propertyTable.GetValue <XWindow>("window");

            window.ShowContextMenu("mnuFocusBox",
                                   btnMenu.PointToScreen(new Point(btnMenu.Width / 2, btnMenu.Height / 2)),
                                   null,
                                   null);
        }
Esempio n. 24
0
 public void Init(LcmCache cache, Mediator mediator, PropertyTable propertyTable)
 {
     m_cache    = cache;
     m_mediator = mediator;
     if (m_mediator != null)
     {
         m_helpTopicProvider = propertyTable.GetValue <IHelpTopicProvider>("HelpTopicProvider");
     }
 }
Esempio n. 25
0
            public static ReversalIndexActivator ActivateReversalIndex(Guid reversalGuid, PropertyTable propertyTable)
            {
                var    clerk = propertyTable.GetValue <RecordClerk>("ActiveClerk", null);
                string originalReversalIndexGuid;

                return(ActivateReversalIndexIfNeeded(reversalGuid.ToString(), propertyTable, clerk, out originalReversalIndexGuid)
                                        ? new ReversalIndexActivator(originalReversalIndexGuid, propertyTable, clerk)
                                        : null);
            }
Esempio n. 26
0
        public bool IsSortingOnAlphaHeaders()
        {
            var clerk = m_propertyTable.GetValue <RecordClerk>("ActiveClerk", null);

            int[] entriesToSave;
            var   publicationDecorator =
                ConfiguredXHTMLGenerator.GetPublicationDecoratorAndEntries(m_propertyTable, out entriesToSave, "Dictionary");

            return(RecordClerk.IsClerkSortingByHeadword(clerk));
        }
Esempio n. 27
0
        /// <summary>
        /// Launch the configure dialog.
        /// </summary>
        /// <param name="commandObject"></param>
        /// <returns></returns>
        public bool OnConfigureDictionary(object commandObject)
        {
            bool refreshNeeded;

            using (var dlg = new DictionaryConfigurationDlg(m_propertyTable))
            {
                var clerk      = m_propertyTable.GetValue <RecordClerk>("ActiveClerk", null);
                var controller = new DictionaryConfigurationController(dlg, m_propertyTable, m_mediator, clerk != null ? clerk.CurrentObject : null);
                dlg.Text      = String.Format(xWorksStrings.ConfigureTitle, GetDictionaryConfigurationType(m_propertyTable));
                dlg.HelpTopic = GetConfigDialogHelpTopic(m_propertyTable);
                dlg.ShowDialog(m_propertyTable.GetValue <IWin32Window>("window"));
                refreshNeeded = controller.MasterRefreshRequired;
            }
            if (refreshNeeded)
            {
                m_mediator.SendMessage("MasterRefresh", null);
            }
            return(true);            // message handled
        }
Esempio n. 28
0
        public string CreateResultPage(PropertyTable propertyTable, XDocument result, bool isTrace)
        {
            var args         = new XsltArgumentList();
            var loadErrorUri = new Uri(Path.Combine(Path.GetTempPath(),
                                                    propertyTable.GetValue <LcmCache>("cache").ProjectId.Name + "HCLoadErrors.xml"));

            args.AddParam("prmHCTraceLoadErrorFile", "", loadErrorUri.AbsoluteUri);
            args.AddParam("prmShowTrace", "", isTrace.ToString().ToLowerInvariant());
            return(TraceTransform.Transform(propertyTable, result, isTrace ? "HCTrace" : "HCParse", args));
        }
Esempio n. 29
0
        /// <summary>
        /// Handles the xWorks message for Edit Parser Parameters
        /// </summary>
        /// <param name="argument">The xCore Command object.</param>
        /// <returns>false</returns>
        public bool OnImportWordSet(object argument)
        {
            CheckDisposed();

            using (ImportWordSetDlg dlg = new ImportWordSetDlg(m_mediator, m_propertyTable))
            {
                dlg.ShowDialog(m_propertyTable.GetValue <XWindow>("window"));
            }
            return(true);
        }
Esempio n. 30
0
 public void Init(LcmCache cache, Mediator mediator, PropertyTable propertyTable)
 {
     m_cache         = cache;
     m_mediator      = mediator;
     m_propertyTable = propertyTable;
     if (m_propertyTable != null)
     {
         m_helpTopicProvider = m_propertyTable.GetValue <IHelpTopicProvider>("HelpTopicProvider");
     }
     SetDialogTitle();
 }