コード例 #1
0
			private static IComboHandler MakeCombo(IHelpTopicProvider helpTopicProvider,
				int tagComboIcon, SandboxBase sandbox, int hvoMorph, SelLevInfo[] rgvsli, int hvoSelObject)
			{
				IVwRootBox rootb = sandbox.RootBox;
				int hvoSbWord = sandbox.RootWordHvo;
				InterlinComboHandler handler = null;
				CachePair caches = sandbox.Caches;
				switch (tagComboIcon)
				{
					case ktagMorphFormIcon:
						handler = new IhMorphForm();
						break;
					case ktagMorphEntryIcon:
						handler = new IhMorphEntry(helpTopicProvider);
						break;
					case ktagWordPosIcon:
						handler = new IhWordPos();
						break;
					case ktagAnalysisIcon:
						ComboListBox clb2 = new ComboListBox();
						clb2.StyleSheet = sandbox.StyleSheet;
						ChooseAnalysisHandler caHandler = new ChooseAnalysisHandler(
							caches.MainCache, hvoSbWord, sandbox.Analysis, clb2);
						caHandler.Owner = sandbox;
						caHandler.AnalysisChosen += new EventHandler(
							sandbox.Handle_AnalysisChosen);
						caHandler.SetupCombo();
						return caHandler;
					case ktagWordGlossIcon: // line 6, word gloss.
						if (sandbox.ShouldAddWordGlossToLexicon)
						{
							if (hvoMorph == 0)
							{
								// setup the first hvoMorph
								hvoMorph = caches.DataAccess.get_VecItem(kSbWord, ktagSbWordMorphs, 0);
							}
							handler = new IhLexWordGloss(helpTopicProvider);
						}
						else
						{
							handler = new IhWordGloss();
						}
						break;
					default:
						return null;
				}
				// Use the base class handler for most handlers. Override where needed.
				if (!(handler is IhWordPos))
				{
					ComboListBox clb = new ComboListBox();
					handler.m_comboList = clb;
					clb.SelectedIndexChanged += new EventHandler(
						handler.HandleComboSelChange);
					clb.SameItemSelected += new EventHandler(
						handler.HandleComboSelSame);
					// Since we may initialize with TsStrings, need to set WSF.
					handler.m_comboList.WritingSystemFactory =
						caches.MainCache.LanguageWritingSystemFactoryAccessor;
				}
				else
				{
					// REVIEW: Do we need to handle wsf for word POS combo?
				}
				handler.m_caches = caches;
				handler.m_hvoSelObject = hvoSelObject;
				handler.m_hvoSbWord = hvoSbWord;
				handler.m_hvoMorph = hvoMorph;
				handler.m_rgvsli = rgvsli;
				handler.m_rootb = rootb;
				handler.m_wsVern = sandbox.RawWordformWs;
				handler.m_wsAnal = caches.MainCache.DefaultAnalWs;
				handler.m_wsUser = caches.MainCache.DefaultUserWs;
				handler.m_sandbox = sandbox;
				handler.m_fUnderConstruction = true;
				handler.SetupCombo();
				if (handler.m_comboList != null)
					handler.m_comboList.StyleSheet = sandbox.StyleSheet;
				handler.m_fUnderConstruction = false;
				return handler;
			}
コード例 #2
0
			private void OnSelectEditMorphBreaks(object sender, EventArgs args)
			{
				using (IhMorphForm handler = new IhMorphForm(m_sandbox))
				{
					handler.UpdateMorphBreaks(handler.EditMorphBreaks()); // this should launch the dialog.
				}
			}