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); }
public void SetDlgInfo(FdoCache cache, Mediator mediator, ComplexConcMorphNode node) { m_cache = cache; m_mediator = mediator; m_node = node; m_formTextBox.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor; m_formTextBox.AdjustForStyleSheet(FontHeightAdjuster.StyleSheetFromMediator(mediator)); m_glossTextBox.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor; m_glossTextBox.AdjustForStyleSheet(FontHeightAdjuster.StyleSheetFromMediator(mediator)); m_entryTextBox.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor; m_entryTextBox.AdjustForStyleSheet(FontHeightAdjuster.StyleSheetFromMediator(mediator)); m_categoryComboBox.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor; foreach (IWritingSystem ws in m_cache.ServiceLocator.WritingSystems.CurrentVernacularWritingSystems) { m_formWsComboBox.Items.Add(ws); m_entryWsComboBox.Items.Add(ws); } foreach (IWritingSystem 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, m_mediator, (Form) m_mediator.PropertyTable.GetValue("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 = m_mediator.HelpTopicProvider; m_helpProvider.HelpNamespace = m_helpTopicProvider.HelpFile; m_helpProvider.SetHelpKeyword(this, m_helpTopicProvider.GetHelpString(s_helpTopic)); m_helpProvider.SetHelpNavigator(this, HelpNavigator.Topic); }
public bool OnPatternNodeSetCriteria(object args) { CheckDisposed(); ComplexConcPatternNode[] nodes = CurrentNodes; ComplexConcWordNode wordNode = nodes[0] as ComplexConcWordNode; var xwindow = m_propertyTable.GetValue <XWindow>("window"); if (wordNode != null) { using (ComplexConcWordDlg dlg = new ComplexConcWordDlg()) { dlg.SetDlgInfo(m_cache, m_mediator, m_propertyTable, wordNode); if (dlg.ShowDialog(xwindow) == DialogResult.Cancel) { return(true); } } } else { ComplexConcMorphNode morphNode = nodes[0] as ComplexConcMorphNode; if (morphNode != null) { using (ComplexConcMorphDlg dlg = new ComplexConcMorphDlg()) { dlg.SetDlgInfo(m_cache, m_mediator, m_propertyTable, morphNode); if (dlg.ShowDialog(xwindow) == DialogResult.Cancel) { return(true); } } } else { ComplexConcTagNode tagNode = nodes[0] as ComplexConcTagNode; if (tagNode != null) { using (ComplexConcTagDlg dlg = new ComplexConcTagDlg()) { dlg.SetDlgInfo(m_cache, m_mediator, m_propertyTable, tagNode); if (dlg.ShowDialog(xwindow) == DialogResult.Cancel) { return(true); } } } } } ReconstructView(nodes[0], false); return(true); }
private void m_insertControl_Insert(object sender, InsertEventArgs e) { ComplexConcPatternNode node = null; switch (((InsertOption) e.Option).Type) { case ComplexConcordanceInsertType.Morph: using (ComplexConcMorphDlg dlg = new ComplexConcMorphDlg()) { ComplexConcMorphNode morphNode = new ComplexConcMorphNode(); dlg.SetDlgInfo(m_cache, m_mediator, morphNode); if (dlg.ShowDialog((XWindow) m_mediator.PropertyTable.GetValue("window")) == DialogResult.OK) node = morphNode; } break; case ComplexConcordanceInsertType.Word: using (ComplexConcWordDlg dlg = new ComplexConcWordDlg()) { ComplexConcWordNode wordNode = new ComplexConcWordNode(); dlg.SetDlgInfo(m_cache, m_mediator, wordNode); if (dlg.ShowDialog((XWindow) m_mediator.PropertyTable.GetValue("window")) == DialogResult.OK) node = wordNode; } break; case ComplexConcordanceInsertType.TextTag: using (ComplexConcTagDlg dlg = new ComplexConcTagDlg()) { ComplexConcTagNode tagNode = new ComplexConcTagNode(); dlg.SetDlgInfo(m_cache, m_mediator, tagNode); if (dlg.ShowDialog((XWindow) m_mediator.PropertyTable.GetValue("window")) == DialogResult.OK) node = tagNode; } break; case ComplexConcordanceInsertType.Or: node = new ComplexConcOrNode(); break; case ComplexConcordanceInsertType.WordBoundary: node = new ComplexConcWordBdryNode(); break; } m_view.Select(); if (node == null) return; SelectionHelper sel = SelectionHelper.Create(m_view); ComplexConcPatternNode parent; int index; GetInsertionIndex(sel, out parent, out index); // if the current selection is a range remove the items we are overwriting if (sel.IsRange) { foreach (ComplexConcPatternNode n in CurrentNodes) n.Parent.Children.Remove(n); } parent.Children.Insert(index, node); ReconstructView(parent, index, false); }
private void m_insertControl_Insert(object sender, InsertEventArgs e) { ComplexConcPatternNode node = null; switch (((InsertOption)e.Option).Type) { case ComplexConcordanceInsertType.Morph: using (ComplexConcMorphDlg dlg = new ComplexConcMorphDlg()) { ComplexConcMorphNode morphNode = new ComplexConcMorphNode(); dlg.SetDlgInfo(m_cache, m_mediator, morphNode); if (dlg.ShowDialog((XWindow)m_mediator.PropertyTable.GetValue("window")) == DialogResult.OK) { node = morphNode; } } break; case ComplexConcordanceInsertType.Word: using (ComplexConcWordDlg dlg = new ComplexConcWordDlg()) { ComplexConcWordNode wordNode = new ComplexConcWordNode(); dlg.SetDlgInfo(m_cache, m_mediator, wordNode); if (dlg.ShowDialog((XWindow)m_mediator.PropertyTable.GetValue("window")) == DialogResult.OK) { node = wordNode; } } break; case ComplexConcordanceInsertType.TextTag: using (ComplexConcTagDlg dlg = new ComplexConcTagDlg()) { ComplexConcTagNode tagNode = new ComplexConcTagNode(); dlg.SetDlgInfo(m_cache, m_mediator, tagNode); if (dlg.ShowDialog((XWindow)m_mediator.PropertyTable.GetValue("window")) == DialogResult.OK) { node = tagNode; } } break; case ComplexConcordanceInsertType.Or: node = new ComplexConcOrNode(); break; case ComplexConcordanceInsertType.WordBoundary: node = new ComplexConcWordBdryNode(); break; } m_view.Select(); if (node == null) { return; } SelectionHelper sel = SelectionHelper.Create(m_view); ComplexConcPatternNode parent; int index; GetInsertionIndex(sel, out parent, out index); // if the current selection is a range remove the items we are overwriting if (sel.IsRange) { foreach (ComplexConcPatternNode n in CurrentNodes) { n.Parent.Children.Remove(n); } } parent.Children.Insert(index, node); ReconstructView(parent, index, false); }