Exemplo n.º 1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Initialize this as an IxCoreColleague
        /// </summary>
        /// <param name="mediator"></param>
        /// <param name="propertyTable"></param>
        /// <param name="configurationParameters"></param>
        /// ------------------------------------------------------------------------------------
        public override void Init(Mediator mediator, PropertyTable propertyTable, XmlNode configurationParameters)
        {
            CheckDisposed();

            InitBase(mediator, propertyTable, configurationParameters);

            m_showDescendantInRoot = XmlUtils.GetOptionalBooleanAttributeValue(configurationParameters, "showDescendantInRoot", false);

            // retrieve persisted clerk index and set it.
            int idx = m_propertyTable.GetIntProperty(Clerk.PersistedIndexProperty, -1, PropertyTable.SettingsGroup.LocalSettings);
            int lim = Clerk.ListSize;

            if (idx >= 0 && idx < lim)
            {
                int idxOld = Clerk.CurrentIndex;
                try
                {
                    Clerk.JumpToIndex(idx);
                }
                catch
                {
                    if (lim > idxOld && lim > 0)
                    {
                        Clerk.JumpToIndex(idxOld >= 0 ? idxOld : 0);
                    }
                }
            }

            // If possible make it use the style sheet appropriate for its main window.
            m_dataEntryForm.StyleSheet = FontHeightAdjuster.StyleSheetFromPropertyTable(m_propertyTable);
            m_fullyInitialized         = true;
        }
Exemplo n.º 2
0
        private void BuildInitialBrowseView()
        {
            var     configurationParameters = m_propertyTable.GetValue <XmlNode>("WindowConfiguration");
            XmlNode toolNode = configurationParameters.SelectSingleNode(
                "controls/parameters/guicontrol[@id='PhonologicalFeaturesFlatList']/parameters");

            m_listPanel.SuspendLayout();
            var sortedFeatureHvos = from s in m_cache.LangProject.PhFeatureSystemOA.FeaturesOC
                                    orderby s.Name.BestAnalysisAlternative.Text
                                    select s.Hvo;

            int[] featureHvos = sortedFeatureHvos.ToArray();
            m_sda.CacheVecProp(m_cache.LangProject.Hvo, featureHvos);
            m_bvList = new BrowseViewer(toolNode, m_cache.LangProject.Hvo, PhonologicalFeaturePublisher.ListFlid, m_cache, m_mediator, m_propertyTable, null, m_sda);
            m_bvList.SelectionChanged       += m_bvList_SelectionChanged;
            m_bvList.ScrollBar.ValueChanged += ScrollBar_ValueChanged;
            m_bvList.Scroller.Scroll        += ScrollBar_Scroll;
            m_bvList.ColumnsChanged         += BrowseViewer_ColumnsChanged;
            m_bvList.Resize    += m_bvList_Resize;
            m_bvList.TabStop    = true;
            m_bvList.StyleSheet = FontHeightAdjuster.StyleSheetFromPropertyTable(m_propertyTable);
            m_bvList.Dock       = DockStyle.Fill;
            m_bvList.BackColor  = SystemColors.Window;
            m_listPanel.Controls.Add(m_bvList);
            m_listPanel.ResumeLayout(false);
        }
Exemplo n.º 3
0
        public void showProperties()
        {
            CheckDisposed();
            var pic = (ICmPicture)Object;
            var app = m_propertyTable.GetValue <IApp>("App");

            using (var dlg = new PicturePropertiesDialog(m_cache, pic, m_propertyTable.GetValue <IHelpTopicProvider>("HelpTopicProvider"), app, true))
            {
                if (dlg.Initialize())
                {
                    var stylesheet = FontHeightAdjuster.StyleSheetFromPropertyTable(m_propertyTable);
                    dlg.UseMultiStringCaption(m_cache, WritingSystemServices.kwsVernAnals, stylesheet);
                    dlg.SetMultilingualCaptionValues(pic.Caption);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        UndoableUnitOfWorkHelper.Do(DetailControlsStrings.ksUndoUpdatePicture, DetailControlsStrings.ksRedoUpdatePicture, m_obj, () =>
                        {
                            string strLocalPictures = CmFolderTags.DefaultPictureFolder;
                            dlg.GetMultilingualCaptionValues(pic.Caption);
                            pic.UpdatePicture(dlg.CurrentFile, null, strLocalPictures, 0);
                        });
                        InstallPicture(m_picBox);
                        m_lastSize = new Size(0, 0);                         // forces OnSizeChanged to do something (we need to adjust to new aspect ratio).
                        OnSizeChanged(new EventArgs());
                    }
                }
            }
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Gets the font height of the specified writing system for the normal style.
        /// </summary>
        protected int GetFontHeight(int ws)
        {
            IVwStylesheet stylesheet = FontHeightAdjuster.StyleSheetFromPropertyTable(m_propertyTable);

            return(FontHeightAdjuster.GetFontHeightForStyle("Normal", stylesheet,
                                                            ws, m_cache.LanguageWritingSystemFactoryAccessor));
        }
Exemplo n.º 6
0
        public PossibilityAutoComplete(LcmCache cache, Mediator mediator, PropertyTable propertyTable, ICmPossibilityList list, Control control,
                                       string displayNameProperty, string displayWs)
        {
            m_cache               = cache;
            m_mediator            = mediator;
            m_control             = control;
            m_displayNameProperty = displayNameProperty;
            m_displayWs           = displayWs;

            m_listBox = new ComboListBox {
                DropDownStyle = ComboBoxStyle.DropDownList, ActivateOnShow = false
            };
            m_listBox.SelectedIndexChanged += HandleSelectedIndexChanged;
            m_listBox.SameItemSelected     += HandleSameItemSelected;
            m_listBox.StyleSheet            = FontHeightAdjuster.StyleSheetFromPropertyTable(propertyTable);
            m_listBox.WritingSystemFactory  = cache.WritingSystemFactory;
            m_searcher      = new StringSearcher <ICmPossibility>(SearchType.Prefix, cache.ServiceLocator.WritingSystemManager);
            m_possibilities = new List <ICmPossibility>();
            var stack = new Stack <ICmPossibility>(list.PossibilitiesOS);

            while (stack.Count > 0)
            {
                ICmPossibility poss = stack.Pop();
                m_possibilities.Add(poss);
                foreach (ICmPossibility child in poss.SubPossibilitiesOS)
                {
                    stack.Push(child);
                }
            }

            m_control.KeyDown  += HandleKeyDown;
            m_control.KeyPress += HandleKeyPress;
        }
Exemplo n.º 7
0
        /// <summary>
        /// Launch the configure dialog.
        /// </summary>
        /// <param name="commandObject"></param>
        /// <returns></returns>
        public bool OnConfigureXmlDocView(object commandObject)
        {
            CheckDisposed();
            string sProp = XmlUtils.GetOptionalAttributeValue(m_configurationParameters, "layoutProperty");

            if (String.IsNullOrEmpty(sProp))
            {
                sProp = "DictionaryPublicationLayout";
            }
            using (var dlg = new XmlDocConfigureDlg())
            {
                dlg.SetConfigDlgInfo(m_configurationParameters, Cache, FontHeightAdjuster.StyleSheetFromPropertyTable(m_propertyTable),
                                     FindForm() as IMainWindowDelegateCallbacks, m_mediator, m_propertyTable, sProp);
                if (dlg.ShowDialog(this) == DialogResult.OK)
                {
                    // LT-8767 When this dialog is launched from the Configure Dictionary View dialog
                    // m_mediator != null && m_rootSite == null so we need to handle this to prevent a crash.
                    if (m_mediator != null && m_rootSite != null)
                    {
                        (m_rootSite as XmlDocItemView).ResetTables(GetLayoutName(m_configurationParameters, m_mediator, m_propertyTable));
                    }
                }
                if (dlg.MasterRefreshRequired)
                {
                    m_mediator.SendMessage("MasterRefresh", null);
                }
                return(true);                // we handled it
            }
        }
Exemplo n.º 8
0
        private void LaunchFwContextMenu(Point ptLoc)
        {
            if (m_rgfmi == null || m_rgfmi.Count == 0)
            {
                return;
            }
            m_fConstructingMenu = true;
            if (m_clb == null)
            {
                m_clb = new ComboListBox();
                m_clb.SelectedIndexChanged += new EventHandler(HandleFwMenuSelection);
                m_clb.SameItemSelected     += new EventHandler(HandleFwMenuSelection);
                // Since we may initialize with TsStrings, need to set WSF.
                m_clb.WritingSystemFactory = Cache.LanguageWritingSystemFactoryAccessor;
                m_clb.DropDownStyle        = ComboBoxStyle.DropDownList;          // Prevents direct editing.
                m_clb.StyleSheet           = FontHeightAdjuster.StyleSheetFromPropertyTable(m_propertyTable);
            }
            m_clb.Items.Clear();
            for (int i = 0; i < m_rgfmi.Count; ++i)
            {
                if (m_rgfmi[i].Enabled)
                {
                    m_clb.Items.Add(m_rgfmi[i].Label);
                }
            }
            AdjustListBoxSize();
            m_clb.AdjustSize(500, 400);             // these are maximums!
            m_clb.SelectedIndex = 0;
            Rectangle boundsLauncher = new Rectangle(ptLoc, new Size(10, 10));
            Rectangle boundsScreen   = Screen.GetWorkingArea(m_inflAffixTemplateCtrl);

            m_fConstructingMenu = false;
            m_clb.Launch(boundsLauncher, boundsScreen);
        }
Exemplo n.º 9
0
        public override void MakeRoot()
        {
            CheckDisposed();

            if (m_cache == null || DesignMode)
            {
                return;
            }

            base.MakeRoot();
            // the default value of 4 for MaxParasToScan isn't high enough when using the arrow keys to move
            // the cursor between items in a rule when the number of lines in the rule is high, since there might
            // be a large number of non-editable empty lines in a pile
            m_rootb.MaxParasToScan = 10;
            m_rootb.DataAccess     = m_sda;
            // JohnT: this notification removal was introduced by Damien in change list 25875, along with removing
            // several IgnorePropChanged wrappers in RuleFormulaControl. I don't know why we ever wanted to not see
            // (some) PropChanged messages, but ignoring them all prevents us from removing inserted items from the
            // view in Undo. (see FWR-3501)
            //m_cache.MainCacheAccessor.RemoveNotification(m_rootb);
            if (m_hvo != 0)
            {
                m_rootb.SetRootObject(m_hvo, m_vc, m_rootFrag, FontHeightAdjuster.StyleSheetFromPropertyTable(m_propertyTable));
            }
        }
Exemplo n.º 10
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);
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// Save the configuration parameters in case we want to use them locally.
        /// </summary>
        /// <param name="mediator"></param>
        /// <param name="propertyTable"></param>
        /// <param name="configurationParameters"></param>
        public override void Init(Mediator mediator, PropertyTable propertyTable, XmlNode configurationParameters)
        {
            CheckDisposed();

            base.Init(mediator, propertyTable, configurationParameters);
            m_configurationParameters = configurationParameters;
            m_clerk      = ToolConfiguration.FindClerk(m_propertyTable, m_configurationParameters);
            m_styleSheet = FontHeightAdjuster.StyleSheetFromPropertyTable(m_propertyTable);
        }
Exemplo n.º 12
0
        private void SetStyleSheet()
        {
            if (m_browseViewer == null || m_browseViewer.StyleSheet != null)
            {
                return;
            }

            m_browseViewer.StyleSheet = FontHeightAdjuster.StyleSheetFromPropertyTable(m_propertyTable);
        }
Exemplo n.º 13
0
        /// <summary>
        /// This sets the original citation form into the dialog.
        /// </summary>
        /// <param name="tssCitationForm"></param>
        /// <param name="le"></param>
        /// <param name="mediator"></param>
        /// <param name="propertyTable"></param>
        public void SetDlgInfo(ITsString tssCitationForm, ILexEntry le, Mediator mediator, XCore.PropertyTable propertyTable)
        {
            CheckDisposed();

            Debug.Assert(tssCitationForm != null);
            Debug.Assert(le != null);

            m_le    = le;
            m_cache = le.Cache;

            IWritingSystemContainer     wsContainer = m_cache.ServiceLocator.WritingSystems;
            CoreWritingSystemDefinition defVernWs   = wsContainer.DefaultVernacularWritingSystem;
            CoreWritingSystemDefinition defAnalWs   = wsContainer.DefaultAnalysisWritingSystem;

            m_fwtbCitationForm.Font = new Font(defVernWs.DefaultFontName, 10);
            m_fwtbGloss.Font        = new Font(defAnalWs.DefaultFontName, 10);
            var stylesheet = FontHeightAdjuster.StyleSheetFromPropertyTable(propertyTable);

            // Set writing system factory and code for the two edit boxes.
            m_fwtbCitationForm.WritingSystemFactory = m_cache.WritingSystemFactory;
            m_fwtbCitationForm.WritingSystemCode    = defVernWs.Handle;
            m_fwtbCitationForm.StyleSheet           = stylesheet;
            m_fwtbCitationForm.AdjustStringHeight   = false;
            m_fwtbGloss.WritingSystemFactory        = m_cache.WritingSystemFactory;
            m_fwtbGloss.WritingSystemCode           = defAnalWs.Handle;
            m_fwtbGloss.StyleSheet         = stylesheet;
            m_fwtbGloss.AdjustStringHeight = false;
            m_fwtbCitationForm.Tss         = tssCitationForm;
            m_fwtbGloss.Text             = String.Empty;
            m_fwtbCitationForm.HasBorder = false;

            m_msaGroupBox.Initialize(m_cache, mediator, propertyTable, this, new SandboxGenericMSA());

            // get the current morph type from the lexical entry.
            IMoMorphType mmt;

            foreach (var mf in le.AlternateFormsOS)
            {
                mmt = mf.MorphTypeRA;
                if (mmt != null)
                {
                    m_msaGroupBox.MorphTypePreference = mmt;
                    break;                     // Assume the first allomorph's type is good enough.
                }
            }

            m_skipCheck = true;
            m_skipCheck = false;

            // Adjust sizes of the two FwTextBoxes if needed, and adjust the locations for the
            // controls below them.  Do the same for the MSAGroupBox.
            AdjustHeightAndPositions(m_fwtbCitationForm);
            AdjustHeightAndPositions(m_fwtbGloss);
            AdjustHeightAndPositions(m_msaGroupBox);
        }
Exemplo n.º 14
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;
 }
Exemplo n.º 15
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="cache"></param>
        /// <param name="mediator"></param>
        /// <param name="propertyTable"></param>
        public AtomicReferencePOSSlice(LcmCache cache, ICmObject obj, int flid, Mediator mediator, PropertyTable propertyTable)
            : base(new UserControl(), cache, obj, flid)
        {
            IVwStylesheet stylesheet = FontHeightAdjuster.StyleSheetFromPropertyTable(propertyTable);
            CoreWritingSystemDefinition defAnalWs = m_cache.ServiceLocator.WritingSystems.DefaultAnalysisWritingSystem;

            m_tree = new TreeCombo();
            m_tree.WritingSystemFactory = cache.WritingSystemFactory;
            m_tree.WritingSystemCode    = defAnalWs.Handle;
            m_tree.Font       = new Font(defAnalWs.DefaultFontName, 10);
            m_tree.StyleSheet = stylesheet;
            if (!Application.RenderWithVisualStyles)
            {
                m_tree.HasBorder = false;
            }
            // We embed the tree combo in a layer of UserControl, so it can have a fixed width
            // while the parent window control is, as usual, docked 'fill' to work with the splitter.
            m_tree.Dock  = DockStyle.Left;
            m_tree.Width = 200;
            Control.Controls.Add(m_tree);
            if (m_pOSPopupTreeManager == null)
            {
                ICmPossibilityList list;
                int ws;
                if (obj is IReversalIndexEntry)
                {
                    var rie = obj as IReversalIndexEntry;
                    list = rie.ReversalIndex.PartsOfSpeechOA;
                    ws   = m_cache.ServiceLocator.WritingSystemManager.GetWsFromStr(rie.ReversalIndex.WritingSystem);
                }
                else
                {
                    list = m_cache.LanguageProject.PartsOfSpeechOA;
                    ws   = m_cache.ServiceLocator.WritingSystems.DefaultAnalysisWritingSystem.Handle;
                }
                m_tree.WritingSystemCode           = ws;
                m_pOSPopupTreeManager              = new POSPopupTreeManager(m_tree, m_cache, list, ws, false, mediator, propertyTable, propertyTable.GetValue <Form>("window"));
                m_pOSPopupTreeManager.AfterSelect += m_pOSPopupTreeManager_AfterSelect;
            }
            try
            {
                m_handlingMessage = true;
                m_pOSPopupTreeManager.LoadPopupTree(POS == null ? 0 : POS.Hvo);
            }
            finally
            {
                m_handlingMessage = false;
            }
            Control.Height = m_tree.PreferredHeight;
            // m_tree has sensible PreferredHeight once the text is set, UserControl does not.
            // we need to set the Height after m_tree.Text has a value set to it.
        }
Exemplo n.º 16
0
 public void Initialize(IEnumerable <ObjectLabel> labels, IEnumerable <ICmObject> selectedItems, PropertyTable propertyTable)
 {
     m_semdomRepo             = Cache.ServiceLocator.GetInstance <ICmSemanticDomainRepository>();
     m_stylesheet             = FontHeightAdjuster.StyleSheetFromPropertyTable(propertyTable);
     selectedDomainsList.Font = FontHeightAdjuster.GetFontForNormalStyle(
         Cache.DefaultAnalWs, m_stylesheet, Cache);
     m_selectedItems.UnionWith(selectedItems);
     UpdateDomainTreeAndListLabels(labels);
     searchTextBox.WritingSystemFactory = Cache.LanguageWritingSystemFactoryAccessor;
     searchTextBox.AdjustForStyleSheet(m_stylesheet);
     m_SearchTimer = new SearchTimer(this, 500, SearchSemanticDomains, new List <Control> {
         domainTree, domainList
     });
     searchTextBox.TextChanged += OnSearchTextChanged;
 }
Exemplo n.º 17
0
        /// <summary>
        /// Override method to add suitable control.
        /// </summary>
        public override void FinishInit()
        {
            CheckDisposed();
            Debug.Assert(m_cache != null);

            base.FinishInit();

            //We need to set the Font so the height of this slice will be
            //set appropriately to fit the text.
            IVwStylesheet stylesheet = FontHeightAdjuster.StyleSheetFromPropertyTable(m_propertyTable);
            int           fontHeight = FontHeightAdjuster.GetFontHeightForStyle(
                "Normal", stylesheet,
                m_cache.DefaultVernWs, m_cache.LanguageWritingSystemFactoryAccessor);

            Font = new Font(m_cache.ServiceLocator.WritingSystems.DefaultVernacularWritingSystem.DefaultFontName,
                            fontHeight / 1000f);
        }
Exemplo n.º 18
0
        internal override void Init(Mediator mediator, PropertyTable propertyTable, XmlNode node)
        {
            base.Init(mediator, propertyTable, node);

            m_semDomRepo = m_cache.ServiceLocator.GetInstance <ICmSemanticDomainRepository>();
            m_stylesheet = FontHeightAdjuster.StyleSheetFromPropertyTable(m_propertyTable);
            var treeBarControl = GetTreeBarControl();

            SetupAndShowHeaderPanel(node, treeBarControl);
            m_searchTimer = new SearchTimer(treeBarControl, 500, HandleChangeInSearchText,
                                            new List <Control> {
                treeBarControl.TreeView, treeBarControl.ListView
            });
            m_textSearch.TextChanged += m_searchTimer.OnSearchTextChanged;
            m_treeView             = treeBarControl.TreeView;
            m_listView             = treeBarControl.ListView;
            m_listView.HeaderStyle = ColumnHeaderStyle.None;             // We don't want a secondary "Records" title bar
        }
Exemplo n.º 19
0
        protected override void InitializeMatchingObjects(LcmCache cache)
        {
            var     xnWindow   = m_propertyTable.GetValue <XmlNode>("WindowConfiguration");
            XmlNode configNode = xnWindow.SelectSingleNode("controls/parameters/guicontrol[@id=\"matchingEntries\"]/parameters");

            var searchEngine = (MergeEntrySearchEngine)SearchEngine.Get(m_mediator, m_propertyTable, "MergeEntrySearchEngine", () => new MergeEntrySearchEngine(cache));

            searchEngine.CurrentEntryHvo = m_startingEntry.Hvo;

            m_matchingObjectsBrowser.Initialize(cache, FontHeightAdjuster.StyleSheetFromPropertyTable(m_propertyTable), m_mediator, m_propertyTable, configNode,
                                                searchEngine);

            // start building index
            var selectedWs = (CoreWritingSystemDefinition)m_cbWritingSystems.SelectedItem;

            if (selectedWs != null)
            {
                m_matchingObjectsBrowser.SearchAsync(GetFields(string.Empty, selectedWs.Handle));
            }
        }
Exemplo n.º 20
0
        protected override void InitializeMatchingObjects(LcmCache cache)
        {
            var     xnWindow   = m_propertyTable.GetValue <XmlNode>("WindowConfiguration");
            XmlNode configNode = xnWindow.SelectSingleNode("controls/parameters/guicontrol[@id=\"matchingRecords\"]/parameters");

            SearchEngine searchEngine = SearchEngine.Get(m_mediator, m_propertyTable, "RecordGoSearchEngine", () => new RecordGoSearchEngine(cache));

            m_matchingObjectsBrowser.Initialize(cache, FontHeightAdjuster.StyleSheetFromPropertyTable(m_propertyTable), m_mediator, m_propertyTable, configNode,
                                                searchEngine);

            // start building index
            var ws = (CoreWritingSystemDefinition)m_cbWritingSystems.SelectedItem;

            if (ws != null)
            {
                ITsString tss   = TsStringUtils.EmptyString(ws.Handle);
                var       field = new SearchField(RnGenericRecTags.kflidTitle, tss);
                m_matchingObjectsBrowser.SearchAsync(new[] { field });
            }
        }
Exemplo n.º 21
0
        private void AddConfigurableControls()
        {
            // Load the controls.

            // 1. Initialize the preview pane (lower pane)
            m_previewPane            = new XmlView(0, "publicationNew", false);
            m_previewPane.Cache      = m_cache;
            m_previewPane.StyleSheet = FontHeightAdjuster.StyleSheetFromPropertyTable(m_propertyTable);

            BasicPaneBarContainer pbc = new BasicPaneBarContainer();

            pbc.Init(m_mediator, m_propertyTable, m_previewPane);
            pbc.Dock         = DockStyle.Fill;
            pbc.PaneBar.Text = LexEdStrings.ksFindExampleSentenceDlgPreviewPaneTitle;
            panel2.Controls.Add(pbc);
            if (m_previewPane.RootBox == null)
            {
                m_previewPane.MakeRoot();
            }

            // 2. load the browse view. (upper pane)
            XmlNode xnBrowseViewControlParameters = this.BrowseViewControlParameters;

            // First create our Clerk, since we can't set it's OwningObject via the configuration/mediator/PropertyTable info.
            m_clerk = RecordClerkFactory.CreateClerk(m_mediator, m_propertyTable, xnBrowseViewControlParameters, true);
            m_clerk.OwningObject = m_owningSense;

            m_rbv = DynamicLoader.CreateObject(xnBrowseViewControlParameters.ParentNode.SelectSingleNode("dynamicloaderinfo")) as ConcOccurrenceBrowseView;
            m_rbv.Init(m_mediator, m_propertyTable, xnBrowseViewControlParameters, m_previewPane, m_clerk.VirtualListPublisher);
            m_rbv.CheckBoxChanged += m_rbv_CheckBoxChanged;
            // add it to our controls.
            BasicPaneBarContainer pbc1 = new BasicPaneBarContainer();

            pbc1.Init(m_mediator, m_propertyTable, m_rbv);
            pbc1.BorderStyle  = BorderStyle.FixedSingle;
            pbc1.Dock         = DockStyle.Fill;
            pbc1.PaneBar.Text = LexEdStrings.ksFindExampleSentenceDlgBrowseViewPaneTitle;
            panel1.Controls.Add(pbc1);

            CheckAddBtnEnabling();
        }
Exemplo n.º 22
0
 public void Init(Mediator mediator, PropertyTable propertyTable, int hvo, IPatternControl patternControl, PatternVcBase vc, int rootFrag, ISilDataAccess sda)
 {
     CheckDisposed();
     m_patternControl = patternControl;
     Mediator         = mediator;
     m_propertyTable  = propertyTable;
     Cache            = m_propertyTable.GetValue <LcmCache>("cache");
     m_hvo            = hvo;
     m_vc             = vc;
     m_sda            = sda;
     m_rootFrag       = rootFrag;
     if (m_rootb == null)
     {
         MakeRoot();
     }
     else if (m_hvo != 0)
     {
         m_rootb.SetRootObject(m_hvo, m_vc, m_rootFrag, FontHeightAdjuster.StyleSheetFromPropertyTable(m_propertyTable));
         m_rootb.Reconstruct();
     }
 }
Exemplo n.º 23
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="parent"></param>
        public override void Install(DataTree parent)
        {
            CheckDisposed();

            base.Install(parent);

            MSADlgLauncher ctrl = (MSADlgLauncher)Control;

            this.Size = new System.Drawing.Size(208, 32);
            ctrl.Initialize(m_propertyTable.GetValue <LcmCache>("cache"),
                            Object,
                            1,     // Maybe need a real flid?
                            "InterlinearName",
                            ContainingDataTree.PersistenceProvder,
                            Mediator,
                            m_propertyTable,
                            "InterlinearName",
                            XmlUtils.GetOptionalAttributeValue(m_configurationNode, "ws", "analysis"));     // TODO: Get better default 'best ws'.
            MSADlglauncherView view = ctrl.MainControl as MSADlglauncherView;

            view.StyleSheet = FontHeightAdjuster.StyleSheetFromPropertyTable(m_propertyTable);
        }
Exemplo n.º 24
0
 public void Init(Mediator mediator, IStText text, int ws)
 {
     CheckDisposed();
     Mediator   = mediator;
     Cache      = m_propertyTable.GetValue <LcmCache>("cache");
     StyleSheet = FontHeightAdjuster.StyleSheetFromPropertyTable(m_propertyTable);
     m_text     = text;
     m_vc       = new StVc("Normal", ws)
     {
         Cache = m_cache, Editable = true
     };
     DoSpellCheck = true;
     if (m_rootb == null)
     {
         MakeRoot();
     }
     else if (m_text != null)
     {
         m_rootb.SetRootObject(m_text.Hvo, m_vc, (int)StTextFrags.kfrText, m_styleSheet);
         m_rootb.Reconstruct();
     }
 }
Exemplo n.º 25
0
        private void SetDlgInfo(LcmCache cache, Mediator mediator, XCore.PropertyTable propertyTable, int hvoOwner, int owningFlid, IFsFeatStruc fs, IPhRegularRule rule, IPhSimpleContextNC ctxt)
        {
            m_fs            = fs;
            m_owningFlid    = owningFlid;
            m_hvoOwner      = hvoOwner;
            m_rule          = rule;
            m_ctxt          = ctxt;
            m_mediator      = mediator;
            m_propertyTable = propertyTable;
            if (m_propertyTable != null)
            {
                // Reset window location.
                // Get location to the stored values, if any.
                if (m_propertyTable.PropertyExists("phonFeatListDlgLocation") &&
                    m_propertyTable.PropertyExists("phonFeatListDlgSize"))
                {
                    var locWnd = m_propertyTable.GetValue <Point>("phonFeatListDlgLocation");
                    var szWnd  = m_propertyTable.GetValue <Size>("phonFeatListDlgSize");
                    var rect   = new Rectangle(locWnd, szWnd);
                    ScreenHelper.EnsureVisibleRect(ref rect);
                    DesktopBounds = rect;
                    StartPosition = FormStartPosition.Manual;
                }

                var helpTopicProvider = (m_propertyTable.GetValue <IHelpTopicProvider>("HelpTopicProvider"));
                if (helpTopicProvider != null)                 // Will be null when running tests
                {
                    m_helpProvider.HelpNamespace = helpTopicProvider.HelpFile;
                    m_helpProvider.SetHelpKeyword(this, helpTopicProvider.GetHelpString(m_helpTopic));
                    m_helpProvider.SetHelpNavigator(this, HelpNavigator.Topic);
                }
            }
            m_cache = cache;
            m_valuesCombo.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor;
            m_valuesCombo.StyleSheet           = FontHeightAdjuster.StyleSheetFromPropertyTable(m_propertyTable);

            LoadPhonFeats(m_fs);
            BuildInitialBrowseView();
        }
Exemplo n.º 26
0
        private void InitBrowseView(string guiControl, List <DummyCmObject> mergeCandidates)
        {
            XmlNode configurationParameters = m_propertyTable.GetValue <XmlNode>("WindowConfiguration");
            XmlNode toolNode = configurationParameters.SelectSingleNode("controls/parameters/guicontrol[@id='" + guiControl + "']/parameters");

            const int           kfakeFlid = 8999958;
            ObjectListPublisher sda       = new ObjectListPublisher((ISilDataAccessManaged)m_cache.DomainDataByFlid, kfakeFlid);

            int[] hvos = (from obj in mergeCandidates select obj.Hvo).ToArray();
            for (int i = 0; i < mergeCandidates.Count; i++)
            {
                m_candidates[mergeCandidates[i].Hvo] = mergeCandidates[i];
            }
            sda.SetOwningPropInfo(WfiWordformTags.kClassId, "LangProject", "Options");
            sda.SetOwningPropValue(hvos);

            m_bvMergeOptions                       = new BrowseViewer(toolNode, m_cache.LangProject.Hvo, ObjectListPublisher.OwningFlid, m_cache, m_mediator, m_propertyTable, null, sda);
            m_bvMergeOptions.StyleSheet            = FontHeightAdjuster.StyleSheetFromPropertyTable(m_propertyTable);
            m_bvMergeOptions.SelectedIndexChanged += m_bvMergeOptions_SelectedIndexChanged;
            m_bvMergeOptions.Dock                  = DockStyle.Fill;
            m_bvPanel.Controls.Add(m_bvMergeOptions);
        }
Exemplo n.º 27
0
        protected override void InitializeMatchingObjects(LcmCache cache)
        {
            var     xnWindow   = m_propertyTable.GetValue <XmlNode>("WindowConfiguration");
            XmlNode configNode = xnWindow.SelectSingleNode("controls/parameters/guicontrol[@id=\"matchingReversalEntries\"]/parameters");

            var searchEngine = (ReversalEntrySearchEngine)SearchEngine.Get(m_mediator, m_propertyTable, "ReversalEntryGoSearchEngine-" + m_reveralIndex.Hvo,
                                                                           () => new ReversalEntrySearchEngine(cache, m_reveralIndex));

            searchEngine.FilteredEntryHvos = m_FilteredReversalEntryHvos;

            m_matchingObjectsBrowser.Initialize(cache, FontHeightAdjuster.StyleSheetFromPropertyTable(m_propertyTable), m_mediator, m_propertyTable, configNode,
                                                searchEngine, m_cache.ServiceLocator.WritingSystemManager.Get(m_reveralIndex.WritingSystem));

            // start building index
            var wsObj = (CoreWritingSystemDefinition)m_cbWritingSystems.SelectedItem;

            if (wsObj != null)
            {
                ITsString tss   = TsStringUtils.EmptyString(wsObj.Handle);
                var       field = new SearchField(ReversalIndexEntryTags.kflidReversalForm, tss);
                m_matchingObjectsBrowser.SearchAsync(new[] { field });
            }
        }
Exemplo n.º 28
0
        public void SetDlgInfo(LcmCache cache, Mediator mediator, XCore.PropertyTable propertyTable, ICmObject owner)
        {
            CheckDisposed();

            m_cache = cache;
            m_owner = owner;

            m_helpTopic = "khtpDataNotebook-InsertRecordDlg";

            m_helpTopicProvider = propertyTable.GetValue <IHelpTopicProvider>("HelpTopicProvider");
            if (m_helpTopicProvider != null)             // Will be null when running tests
            {
                m_helpProvider.HelpNamespace = m_helpTopicProvider.HelpFile;
                m_helpProvider.SetHelpKeyword(this, m_helpTopicProvider.GetHelpString(m_helpTopic));
                m_helpProvider.SetHelpNavigator(this, HelpNavigator.Topic);
            }

            IVwStylesheet stylesheet = FontHeightAdjuster.StyleSheetFromPropertyTable(propertyTable);

            m_titleTextBox.StyleSheet           = stylesheet;
            m_titleTextBox.WritingSystemFactory = m_cache.WritingSystemFactory;
            m_titleTextBox.WritingSystemCode    = m_cache.DefaultAnalWs;
            AdjustControlAndDialogHeight(m_titleTextBox, m_titleTextBox.PreferredHeight);

            m_typeCombo.StyleSheet           = stylesheet;
            m_typeCombo.WritingSystemFactory = m_cache.WritingSystemFactory;
            m_typeCombo.WritingSystemCode    = m_cache.DefaultAnalWs;
            AdjustControlAndDialogHeight(m_typeCombo, m_typeCombo.PreferredHeight);

            ICmPossibilityList recTypes = m_cache.LanguageProject.ResearchNotebookOA.RecTypesOA;

            m_typePopupTreeManager = new PossibilityListPopupTreeManager(m_typeCombo, m_cache, mediator, propertyTable,
                                                                         recTypes, cache.DefaultAnalWs, false, this);
            m_typePopupTreeManager.LoadPopupTree(m_cache.ServiceLocator.GetObject(RnResearchNbkTags.kguidRecObservation).Hvo);
            // Ensure that we start out focused in the Title text box.  See FWR-2731.
            m_titleTextBox.Select();
        }
Exemplo n.º 29
0
        private void RebuildStatisticsTable()
        {
            statisticsBox.Clear();
            // TODO-Linux: SelectionTabs isn't implemented on Mono
            statisticsBox.SelectionTabs = new int[] { 10, 300 };
            //retrieve the default UI font.
            var font = FontHeightAdjuster.GetFontForStyle(StyleServices.NormalStyleName,
                                                          FontHeightAdjuster.StyleSheetFromPropertyTable(_propertyTable),
                                                          Cache.DefaultUserWs, Cache.WritingSystemFactory);
            //increase the size of the default UI font and make it bold for the header.
            Font headerFont = new Font(font.FontFamily, font.SizeInPoints + 1.0f, FontStyle.Bold, font.Unit, font.GdiCharSet);

            //refresh the statisticsDescription (in case of font changes)
            statisticsBox.Text = ITextStrings.ksStatisticsView_HeaderText;

            int row              = 0;
            var textList         = InterestingTextsDecorator.GetInterestingTextList(_mediator, _propertyTable, Cache.ServiceLocator);
            int numberOfSegments = 0;
            int wordCount        = 0;
            int uniqueWords      = 0;

            Dictionary <int, int> languageCount = new Dictionary <int, int>();
            Dictionary <int, HashSet <string> > languageTypeCount = new Dictionary <int, HashSet <string> >();

            //for each interesting text
            foreach (var text in textList.InterestingTexts)
            {
                //if a text is deleted in Interlinear there could be a text in this list which has invalid data.
                if (text.Hvo < 0)
                {
                    continue;
                }
                //for every paragraph in the interesting text
                for (int index = 0; index < text.ParagraphsOS.Count; ++index)
                {
                    //count the segments in this paragraph
                    numberOfSegments += text[index].SegmentsOS.Count;
                    //count all the things analyzed as words
                    var words     = new List <IAnalysis>(text[index].Analyses);
                    var wordForms = new List <IWfiWordform>(words.Where(x => x.Wordform != null && x.Wordform.ShortName != "???").Select(y => y.Wordform));
                    foreach (var wordForm in wordForms)
                    {
                        var valdWSs = wordForm.Form.AvailableWritingSystemIds;
                        foreach (var ws in valdWSs)
                        {
                            // increase the count of words(tokens) for this language
                            int count = 0;
                            if (languageCount.TryGetValue(ws, out count))
                            {
                                languageCount[ws] = count + 1;
                            }
                            else
                            {
                                languageCount.Add(ws, 1);
                            }
                            //increase the count of unique words(types) for this language
                            HashSet <string> pair;
                            if (languageTypeCount.TryGetValue(ws, out pair))
                            {
                                //add the string for this writing system in all lower case to the set, unique count is case insensitive
                                pair.Add(wordForm.Form.get_String(ws).Text.ToLower());
                            }
                            else
                            {
                                //add the string for this writing system in all lower case to the set, unique count is case insensitive
                                languageTypeCount.Add(ws, new HashSet <string> {
                                    wordForm.Form.get_String(ws).Text.ToLower()
                                });
                            }
                        }
                    }
                    words.RemoveAll(item => !item.HasWordform);
                    wordCount += words.Count;
                }
            }
            // insert total word type count
            statisticsBox.Text += Environment.NewLine + Environment.NewLine + Environment.NewLine + "\t" + ITextStrings.ksStatisticsViewTotalWordTypesText + "\t";             // Todo: find the right System.?.NewLine constant

            ++row;
            //add one row for the unique words in each language.
            foreach (KeyValuePair <int, HashSet <string> > keyValuePair in languageTypeCount)
            {
                var ws = Cache.WritingSystemFactory.get_EngineOrNull(keyValuePair.Key);

                string labText = (ws != null ? ws.ToString() : "#unknown#") + @":";
                statisticsBox.Text += Environment.NewLine + Environment.NewLine + "\t" + labText + "\t";                 // Todo: find the right System.?.NewLine constant
                statisticsBox.Text += "" + keyValuePair.Value.Count;
                ++row;
                uniqueWords += keyValuePair.Value.Count;                 //increase the total of unique words
            }

            // next insert the word count.
            statisticsBox.Text += Environment.NewLine + Environment.NewLine + Environment.NewLine + "\t" + ITextStrings.ksStatisticsViewTotalWordTokensText + "\t";             // Todo: find the right System.?.NewLine constant
            statisticsBox.Text += wordCount;
            ++row;
            //add one row for the token count for each language.
            foreach (KeyValuePair <int, int> keyValuePair in languageCount)
            {
                var ws = Cache.WritingSystemFactory.get_EngineOrNull(keyValuePair.Key);

                string labText = (ws != null ? ws.ToString() : "#unknown#") + @":";
                statisticsBox.Text += Environment.NewLine + Environment.NewLine + "\t" + labText + "\t";                 // Todo: find the right System.?.NewLine constant
                statisticsBox.Text += "" + keyValuePair.Value;
                ++row;
            }
            statisticsBox.Text += Environment.NewLine + Environment.NewLine + Environment.NewLine + "\t" + ITextStrings.ksStatisticsViewTotalSentencesText + "\t";             // Todo: find the right System.?.NewLine constant

            // next insert the sentence count.
            statisticsBox.Text += numberOfSegments;

            // insert the total word type count into the richTextBox (it wasn't available earlier)
            statisticsBox.SelectionStart = statisticsBox.Find(ITextStrings.ksStatisticsViewTotalWordTypesText) +
                                           ITextStrings.ksStatisticsViewTotalWordTypesText.Length;
            statisticsBox.SelectionLength = 1;
            statisticsBox.SelectedText    = "\t" + uniqueWords;

            // Set the font for the header. Do this after we add the other stuff to make sure
            // it doesn't apply to extra text added adjacent to it.
            statisticsBox.Select(0, ITextStrings.ksStatisticsView_HeaderText.Length);
            statisticsBox.SelectionFont = headerFont;
            statisticsBox.Select(0, 0);
        }
Exemplo n.º 30
0
        protected virtual void SetDlgInfo(LcmCache cache, WindowParams wp, Mediator mediator, XCore.PropertyTable propertyTable, int ws)
        {
            CheckDisposed();

            Debug.Assert(cache != null);
            m_cache = cache;

            m_mediator      = mediator;
            m_propertyTable = propertyTable;

            if (m_propertyTable != null)
            {
                // Reset window location.
                // Get location to the stored values, if any.
                if (m_propertyTable.PropertyExists(PersistenceLabel + "DlgLocation") &&
                    m_propertyTable.PropertyExists(PersistenceLabel + "DlgSize"))
                {
                    var locWnd = m_propertyTable.GetValue <Point>(PersistenceLabel + "DlgLocation");
                    var szWnd  = m_propertyTable.GetValue <Size>(PersistenceLabel + "DlgSize");
                    var rect   = new Rectangle(locWnd, szWnd);

                    //grow it if it's too small.  This will happen when we add new controls to the dialog box.
                    if (rect.Width < m_btnHelp.Left + m_btnHelp.Width + 30)
                    {
                        rect.Width = m_btnHelp.Left + m_btnHelp.Width + 30;
                    }

                    if (rect.Height < m_btnHelp.Top + m_btnHelp.Height + 50)
                    {
                        rect.Height = m_btnHelp.Top + m_btnHelp.Height + 50;
                    }

                    ScreenHelper.EnsureVisibleRect(ref rect);
                    DesktopBounds = rect;
                    StartPosition = FormStartPosition.Manual;
                }

                m_helpTopicProvider = m_propertyTable.GetValue <IHelpTopicProvider>("HelpTopicProvider");
                if (m_helpTopicProvider != null)
                {
                    m_helpProvider.HelpNamespace = m_helpTopicProvider.HelpFile;
                    SetHelpButtonEnabled();
                }
            }

            SetupBasicTextProperties(wp);

            IVwStylesheet stylesheet = FontHeightAdjuster.StyleSheetFromPropertyTable(m_propertyTable);

            // Set font, writing system factory, and writing system code for the Lexical Form
            // edit box.  Also set an empty string with the proper writing system.
            m_tbForm.Font = new Font(cache.ServiceLocator.WritingSystemManager.Get(ws).DefaultFontName, 10);
            m_tbForm.WritingSystemFactory = cache.WritingSystemFactory;
            m_tbForm.WritingSystemCode    = ws;
            m_tbForm.AdjustStringHeight   = false;
            m_tbForm.Tss        = TsStringUtils.EmptyString(ws);
            m_tbForm.StyleSheet = stylesheet;

            // Setup the fancy message text box.
            // Note: at 120DPI (only), it seems to be essential to set at least the WSF of the
            // bottom message even if not using it.
            SetupBottomMsg();
            SetBottomMessage();
            m_fwTextBoxBottomMsg.BorderStyle = BorderStyle.None;

            m_analHvos.UnionWith(cache.ServiceLocator.WritingSystems.CurrentAnalysisWritingSystems.Select(wsObj => wsObj.Handle));
            List <int> vernList = cache.ServiceLocator.WritingSystems.CurrentVernacularWritingSystems.Select(wsObj => wsObj.Handle).ToList();

            m_vernHvos.UnionWith(vernList);
            LoadWritingSystemCombo();
            int iWs = vernList.IndexOf(ws);
            CoreWritingSystemDefinition currentWs;

            if (iWs < 0)
            {
                List <int> analList = cache.ServiceLocator.WritingSystems.CurrentAnalysisWritingSystems.Select(wsObj => wsObj.Handle).ToList();
                iWs = analList.IndexOf(ws);
                if (iWs < 0)
                {
                    currentWs = cache.ServiceLocator.WritingSystemManager.Get(ws);
                    m_cbWritingSystems.Items.Add(currentWs);
                    SetCbWritingSystemsSize();
                }
                else
                {
                    currentWs = cache.ServiceLocator.WritingSystems.CurrentAnalysisWritingSystems[iWs];
                }
            }
            else
            {
                currentWs = cache.ServiceLocator.WritingSystems.CurrentVernacularWritingSystems[iWs];
            }
            Debug.Assert(currentWs != null && currentWs.Handle == ws);

            m_skipCheck = true;
            m_cbWritingSystems.SelectedItem = currentWs;
            m_skipCheck = false;
            // Don't hook this up until AFTER we've initialized it; otherwise, it can
            // modify the contents of the form as a side effect of initialization.
            // Also, doing that triggers laying out the dialog prematurely, before
            // we've set WSF on all the controls.
            m_cbWritingSystems.SelectedIndexChanged += m_cbWritingSystems_SelectedIndexChanged;

            InitializeMatchingObjects(cache);

            // Adjust things if the form box needs to grow to accommodate its style.
            int oldHeight = m_tbForm.Height;
            int newHeight = Math.Max(oldHeight, m_tbForm.PreferredHeight);
            int delta     = newHeight - oldHeight;

            if (delta != 0)
            {
                m_tbForm.Height  = newHeight;
                m_panel1.Height += delta;
                GrowDialogAndAdjustControls(delta, m_panel1);
            }
        }