예제 #1
0
 bool TrySelectNode(TreeCombo treeCombo, int hvoTarget)
 {
     if (treeCombo.Tree.Nodes.Count == 0)
     {
         m_mainPOSPopupTreeManager.LoadPopupTree(hvoTarget);
         return(true);
     }
     else
     {
         foreach (HvoTreeNode node in treeCombo.Tree.Nodes)
         {
             HvoTreeNode htn = node.NodeWithHvo(hvoTarget);
             if (htn != null)
             {
                 // Selecting the POS here should then fire
                 // the event which wil reset the slot combo.
                 treeCombo.SelectedNode = htn;
                 return(true);
             }
         }
     }
     return(false);
 }
예제 #2
0
		/// <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;
		}
예제 #3
0
		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);
		}
예제 #4
0
        /// <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;
        }
예제 #5
0
		/// <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;
		}
예제 #6
0
        /// <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;
        }