public BulkPosEditorBase() { m_pOSPopupTreeManager = null; m_tree = new TreeCombo(); m_tree.TreeLoad += new EventHandler(m_tree_TreeLoad); // Handle AfterSelect event in m_tree_TreeLoad() through m_pOSPopupTreeManager }
/// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose(bool disposing) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (IsDisposed) { return; } if (disposing) { if (m_mainPOSPopupTreeManager != null) { m_mainPOSPopupTreeManager.AfterSelect -= new TreeViewEventHandler(m_mainPOSPopupTreeManager_AfterSelect); m_mainPOSPopupTreeManager.Dispose(); } m_mainPOSPopupTreeManager = null; if (m_secPOSPopupTreeManager != null) { m_secPOSPopupTreeManager.AfterSelect -= new TreeViewEventHandler(m_secPOSPopupTreeManager_AfterSelect); m_secPOSPopupTreeManager.Dispose(); } if (components != null) { components.Dispose(); } } m_parentForm = null; m_mediator = null; m_secPOSPopupTreeManager = null; m_lAfxType = null; m_fwcbAffixTypes = null; m_lSLots = null; m_fwcbSlots = null; m_tcSecondaryPOS = null; m_ctrlAssistant = null; base.Dispose(disposing); }
private void m_tree_TreeLoad(object sender, EventArgs e) { if (m_pOSPopupTreeManager == null) { m_pOSPopupTreeManager = new POSPopupTreeManager(m_tree, m_cache, List, m_cache.LangProject.DefaultAnalysisWritingSystem, false, m_mediator, (Form)m_mediator.PropertyTable.GetValue("window")); m_pOSPopupTreeManager.AfterSelect += new TreeViewEventHandler(m_pOSPopupTreeManager_AfterSelect); } m_pOSPopupTreeManager.LoadPopupTree(0); }
/// <summary> /// Executes in two distinct scenarios. /// /// 1. If disposing is true, the method has been called directly /// or indirectly by a user's code via the Dispose method. /// Both managed and unmanaged resources can be disposed. /// /// 2. If disposing is false, the method has been called by the /// runtime from inside the finalizer and you should not reference (access) /// other managed objects, as they already have been garbage collected. /// Only unmanaged resources can be disposed. /// </summary> /// <param name="disposing"></param> /// <remarks> /// If any exceptions are thrown, that is fine. /// If the method is being done in a finalizer, it will be ignored. /// If it is thrown by client code calling Dispose, /// it needs to be handled by fixing the bug. /// /// If subclasses override this method, they should call the base implementation. /// </remarks> protected virtual void Dispose(bool disposing) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (m_isDisposed) return; if (disposing) { // Dispose managed resources here. if (m_tree != null) { m_tree.Load -= new EventHandler(m_tree_TreeLoad); m_tree.Dispose(); } if (m_pOSPopupTreeManager != null) { m_pOSPopupTreeManager.AfterSelect -= new TreeViewEventHandler(m_pOSPopupTreeManager_AfterSelect); m_pOSPopupTreeManager.Dispose(); } } // Dispose unmanaged resources here, whether disposing is true or false. m_selectedLabel = null; m_tree = null; m_pOSPopupTreeManager = null; m_mediator = null; m_cache = null; m_isDisposed = true; }
/// <summary> /// Initialize the control. /// </summary> /// <param name="cache"></param> /// <param name="mediator"></param> /// <param name="parentForm"></param> public void Initialize(FdoCache cache, Mediator mediator, Form parentForm, SandboxGenericMSA sandboxMSA) { CheckDisposed(); m_parentForm = parentForm; m_mediator = mediator; m_tsf = cache.TsStrFactory; m_cache = cache; IVwStylesheet stylesheet = FontHeightAdjuster.StyleSheetFromMediator(mediator); int defUserWs = m_cache.ServiceLocator.WritingSystemManager.UserWs; IWritingSystem defAnalWs = m_cache.ServiceLocator.WritingSystems.DefaultAnalysisWritingSystem; string defAnalWsFont = defAnalWs.DefaultFontName; m_fwcbAffixTypes.WritingSystemFactory = m_cache.WritingSystemFactory; m_fwcbAffixTypes.WritingSystemCode = defAnalWs.Handle; m_fwcbAffixTypes.Items.Add(m_tsf.MakeString(LexTextControls.ksNotSure, defUserWs)); m_fwcbAffixTypes.Items.Add(m_tsf.MakeString(LexTextControls.ksInflectional, defUserWs)); m_fwcbAffixTypes.Items.Add(m_tsf.MakeString(LexTextControls.ksDerivational, defUserWs)); m_fwcbAffixTypes.StyleSheet = stylesheet; m_fwcbAffixTypes.AdjustStringHeight = false; m_fwcbSlots.Font = new Font(defAnalWsFont, 10); m_fwcbSlots.WritingSystemFactory = m_cache.WritingSystemFactory; m_fwcbSlots.WritingSystemCode = defAnalWs.Handle; m_fwcbSlots.StyleSheet = stylesheet; m_fwcbSlots.AdjustStringHeight = false; m_tcMainPOS.Font = new Font(defAnalWsFont, 10); m_tcMainPOS.WritingSystemFactory = m_cache.WritingSystemFactory; m_tcMainPOS.WritingSystemCode = defAnalWs.Handle; m_tcMainPOS.StyleSheet = stylesheet; m_tcMainPOS.AdjustStringHeight = false; m_tcSecondaryPOS.Font = new Font(defAnalWsFont, 10); m_tcSecondaryPOS.WritingSystemFactory = m_cache.WritingSystemFactory; m_tcSecondaryPOS.WritingSystemCode = defAnalWs.Handle; m_tcSecondaryPOS.StyleSheet = stylesheet; m_tcSecondaryPOS.AdjustStringHeight = false; m_selectedMainPOS = sandboxMSA.MainPOS; m_fwcbAffixTypes.SelectedIndex = 0; m_fwcbAffixTypes.SelectedIndexChanged += HandleComboMSATypesChange; m_mainPOSPopupTreeManager = new POSPopupTreeManager(m_tcMainPOS, m_cache, m_cache.LanguageProject.PartsOfSpeechOA, defAnalWs.Handle, false, m_mediator, m_parentForm); m_mainPOSPopupTreeManager.NotSureIsAny = true; m_mainPOSPopupTreeManager.LoadPopupTree(m_selectedMainPOS != null ? m_selectedMainPOS.Hvo : 0); m_mainPOSPopupTreeManager.AfterSelect += m_mainPOSPopupTreeManager_AfterSelect; m_fwcbSlots.SelectedIndexChanged += HandleComboSlotChange; m_secPOSPopupTreeManager = new POSPopupTreeManager(m_tcSecondaryPOS, m_cache, m_cache.LanguageProject.PartsOfSpeechOA, defAnalWs.Handle, false, m_mediator, m_parentForm); m_secPOSPopupTreeManager.NotSureIsAny = true; // only used for affixes. m_selectedSecondaryPOS = sandboxMSA.SecondaryPOS; m_secPOSPopupTreeManager.LoadPopupTree(m_selectedSecondaryPOS != null ? m_selectedSecondaryPOS.Hvo : 0); m_secPOSPopupTreeManager.AfterSelect += m_secPOSPopupTreeManager_AfterSelect; // Relocate the m_tcSecondaryPOS control to overlay the m_fwcbSlots. // In the designer, they are offset to see them, and edit them. // In running code they are in the same spot, but only one is visible at a time. m_tcSecondaryPOS.Location = m_fwcbSlots.Location; if (m_selectedMainPOS != null && sandboxMSA.MsaType == MsaType.kInfl) { // This fixes LT-4677, LT-6048, and LT-6201. ResetSlotCombo(); } MSAType = sandboxMSA.MsaType; }
/// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) { System.Diagnostics.Debug.WriteLineIf(!disposing, "****** Missing Dispose() call for " + GetType().Name + ". ****** "); // Must not be run more than once. if (IsDisposed) return; if (disposing) { if (m_mainPOSPopupTreeManager != null) { m_mainPOSPopupTreeManager.AfterSelect -= new TreeViewEventHandler(m_mainPOSPopupTreeManager_AfterSelect); m_mainPOSPopupTreeManager.Dispose(); } m_mainPOSPopupTreeManager = null; if (m_secPOSPopupTreeManager != null) { m_secPOSPopupTreeManager.AfterSelect -= new TreeViewEventHandler(m_secPOSPopupTreeManager_AfterSelect); m_secPOSPopupTreeManager.Dispose(); } if(components != null) { components.Dispose(); } } m_parentForm = null; m_mediator = null; m_secPOSPopupTreeManager = null; m_lAfxType = null; m_fwcbAffixTypes = null; m_lSLots = null; m_fwcbSlots = null; m_tcSecondaryPOS = null; m_ctrlAssistant = null; base.Dispose( disposing ); }
/// <summary> /// Constructor. /// </summary> /// <param name="obj">CmObject that is being displayed.</param> /// <param name="flid">The field identifier for the attribute we are displaying.</param> /// // cache, obj, flid, node, persistenceProvider, stringTbl public AtomicReferencePOSSlice(FdoCache cache, ICmObject obj, int flid, IPersistenceProvider persistenceProvider, Mediator mediator) : base(new UserControl(), cache, obj, flid) { IVwStylesheet stylesheet = FontHeightAdjuster.StyleSheetFromMediator(mediator); m_persistProvider = persistenceProvider; m_tree = new TreeCombo(); m_tree.WritingSystemFactory = cache.LanguageWritingSystemFactoryAccessor; m_tree.WritingSystemCode = m_cache.LangProject.DefaultAnalysisWritingSystem; m_tree.Font = new System.Drawing.Font(cache.LangProject.DefaultAnalysisWritingSystemFont, 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 ReversalIndexEntry) { IReversalIndexEntry rie = obj as IReversalIndexEntry; list = rie.ReversalIndex.PartsOfSpeechOA; ws = rie.ReversalIndex.WritingSystemRAHvo; } else { list = m_cache.LangProject.PartsOfSpeechOA; ws = m_cache.LangProject.DefaultAnalysisWritingSystem; } m_tree.WritingSystemCode = ws; m_pOSPopupTreeManager = new POSPopupTreeManager(m_tree, m_cache, list, ws, false, mediator, (Form)mediator.PropertyTable.GetValue("window")); m_pOSPopupTreeManager.AfterSelect += new TreeViewEventHandler(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. }
/// <summary> /// Executes in two distinct scenarios. /// /// 1. If disposing is true, the method has been called directly /// or indirectly by a user's code via the Dispose method. /// Both managed and unmanaged resources can be disposed. /// /// 2. If disposing is false, the method has been called by the /// runtime from inside the finalizer and you should not reference (access) /// other managed objects, as they already have been garbage collected. /// Only unmanaged resources can be disposed. /// </summary> /// <param name="disposing"></param> /// <remarks> /// If any exceptions are thrown, that is fine. /// If the method is being done in a finalizer, it will be ignored. /// If it is thrown by client code calling Dispose, /// it needs to be handled by fixing the bug. /// /// If subclasses override this method, they should call the base implementation. /// </remarks> protected override void Dispose(bool disposing) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (IsDisposed) return; // m_sda COM object block removed due to crash in Finializer thread LT-6124 if (disposing) { // Dispose managed resources here. if (m_sda != null) m_sda.RemoveNotification(this); if (m_tree != null && m_tree.Parent == null) m_tree.Dispose(); if (m_pOSPopupTreeManager != null) { m_pOSPopupTreeManager.AfterSelect -= new TreeViewEventHandler(m_pOSPopupTreeManager_AfterSelect); m_pOSPopupTreeManager.Dispose(); } } // Dispose unmanaged resources here, whether disposing is true or false. m_sda = null; m_cache = null; m_tree = null; m_pOSPopupTreeManager = null; m_persistProvider = null; m_pos = null; base.Dispose(disposing); }
private void FillSearchComboList(ConcordanceLines line) { if(m_pOSPopupTreeManager != null) m_pOSPopupTreeManager.Dispose(); switch(line) { case ConcordanceLines.kTags: m_pOSPopupTreeManager = new POSComboController(m_cbSearchText, m_cache, InterlinTaggingChild.GetTaggingLists(m_cache.LangProject), m_cache.ServiceLocator.WritingSystems.DefaultAnalysisWritingSystem.Handle, false, m_mediator, (Form)m_mediator.PropertyTable.GetValue("window")) {Sorted = false}; break; default: //Lex. Gram. Info and Word Cat. both work the same, and are handled here in the default option m_pOSPopupTreeManager = new POSComboController(m_cbSearchText, m_cache, m_cache.LanguageProject.PartsOfSpeechOA, m_cache.ServiceLocator.WritingSystems.DefaultAnalysisWritingSystem.Handle, false, m_mediator, (Form)m_mediator.PropertyTable.GetValue("window")); break; } m_pOSPopupTreeManager.AfterSelect += POSAfterSelect; m_pOSPopupTreeManager.LoadPopupTree(0); }
/// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { Debug.WriteLineIf(!disposing, "****************** Missing Dispose() call for " + GetType().Name + ". ******************"); if (disposing) { if (components != null) components.Dispose(); if (m_clerk != null) m_clerk.ConcordanceControl = null; if (m_pOSPopupTreeManager != null) m_pOSPopupTreeManager.Dispose(); // Don't dispose of the clerk, since it can monitor relevant PropChanges // that affect the NeedToReloadVirtualProperty. } m_clerk = null; m_mediator = null; m_pOSPopupTreeManager = null; base.Dispose(disposing); }
// We can't add the items until the form loads, or we get a spurious horizontal scroll bar. private void m_tree_Load(object sender, EventArgs e) { if (m_pOSPopupTreeManager == null) { FdoCache cache = m_caches.MainCache; m_pOSPopupTreeManager = new POSPopupTreeManager(m_tree, cache, cache.LangProject.PartsOfSpeechOA, cache.DefaultAnalWs, false, m_sandbox.Mediator, m_sandbox.FindForm()); m_pOSPopupTreeManager.AfterSelect += new TreeViewEventHandler(m_pOSPopupTreeManager_AfterSelect); } m_pOSPopupTreeManager.LoadPopupTree(m_caches.RealHvo(m_caches.DataAccess.get_ObjectProp(m_hvoSbWord, ktagSbWordPos))); }
/// <summary> /// Initialize the control. /// </summary> /// <param name="cache"></param> /// <param name="mediator"></param> /// <param name="parentForm"></param> public void Initialize(FdoCache cache, Mediator mediator, Form parentForm, DummyGenericMSA dummyMSA) { CheckDisposed(); m_parentForm = parentForm; m_mediator = mediator; m_tsf = TsStrFactoryClass.Create(); m_cache = cache; IVwStylesheet stylesheet = FontHeightAdjuster.StyleSheetFromMediator(mediator); m_fwcbAffixTypes.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor; m_fwcbAffixTypes.WritingSystemCode = m_cache.LangProject.DefaultAnalysisWritingSystem; m_fwcbAffixTypes.Items.Add(m_tsf.MakeString(LexTextControls.ksNotSure, m_cache.LangProject.DefaultUserWritingSystem)); m_fwcbAffixTypes.Items.Add(m_tsf.MakeString(LexTextControls.ksInflectional, m_cache.LangProject.DefaultUserWritingSystem)); m_fwcbAffixTypes.Items.Add(m_tsf.MakeString(LexTextControls.ksDerivational, m_cache.LangProject.DefaultUserWritingSystem)); m_fwcbAffixTypes.StyleSheet = stylesheet; m_fwcbAffixTypes.AdjustStringHeight = false; m_fwcbSlots.Font = new System.Drawing.Font(cache.LangProject.DefaultAnalysisWritingSystemFont, 10); m_fwcbSlots.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor; m_fwcbSlots.WritingSystemCode = m_cache.LangProject.DefaultAnalysisWritingSystem; m_fwcbSlots.StyleSheet = stylesheet; m_fwcbSlots.AdjustStringHeight = false; m_tcMainPOS.Font = new System.Drawing.Font(cache.LangProject.DefaultAnalysisWritingSystemFont, 10); m_tcMainPOS.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor; m_tcMainPOS.WritingSystemCode = m_cache.LangProject.DefaultAnalysisWritingSystem; m_tcMainPOS.StyleSheet = stylesheet; m_tcMainPOS.AdjustStringHeight = false; m_tcSecondaryPOS.Font = new System.Drawing.Font(cache.LangProject.DefaultAnalysisWritingSystemFont, 10); m_tcSecondaryPOS.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor; m_tcSecondaryPOS.WritingSystemCode = m_cache.LangProject.DefaultAnalysisWritingSystem; m_tcSecondaryPOS.StyleSheet = stylesheet; m_tcSecondaryPOS.AdjustStringHeight = false; m_selectedMainPOSHvo = dummyMSA.MainPOS; m_fwcbAffixTypes.SelectedIndex = 0; m_fwcbAffixTypes.SelectedIndexChanged += new EventHandler( HandleComboMSATypesChange); m_mainPOSPopupTreeManager = new POSPopupTreeManager(m_tcMainPOS, m_cache, m_cache.LangProject.PartsOfSpeechOA, m_cache.LangProject.DefaultAnalysisWritingSystem, false, m_mediator, m_parentForm); m_mainPOSPopupTreeManager.NotSureIsAny = true; m_mainPOSPopupTreeManager.LoadPopupTree(m_selectedMainPOSHvo); m_mainPOSPopupTreeManager.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(m_mainPOSPopupTreeManager_AfterSelect); m_fwcbSlots.SelectedIndexChanged += new EventHandler( HandleComboSlotChange); m_secPOSPopupTreeManager = new POSPopupTreeManager(m_tcSecondaryPOS, m_cache, m_cache.LangProject.PartsOfSpeechOA, m_cache.LangProject.DefaultAnalysisWritingSystem, false, m_mediator, m_parentForm); m_secPOSPopupTreeManager.NotSureIsAny = true; // only used for affixes. m_selectedSecondaryPOSHvo = dummyMSA.SecondaryPOS; m_secPOSPopupTreeManager.LoadPopupTree(m_selectedSecondaryPOSHvo); m_secPOSPopupTreeManager.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(m_secPOSPopupTreeManager_AfterSelect); // Relocate the m_tcSecondaryPOS control to overlay the m_fwcbSlots. // In the designer, they are offset to see them, and edit them. // In running code they are in the same spot, but only one is visible at a time. m_tcSecondaryPOS.Location = m_fwcbSlots.Location; if (m_selectedMainPOSHvo > 0 && dummyMSA.MsaType == MsaType.kInfl) { // This fixes LT-4677, LT-6048, and LT-6201. ResetSlotCombo(); } MSAType = dummyMSA.MsaType; }