コード例 #1
0
ファイル: InsertEntryDlg.cs プロジェクト: sillsdev/WorldPad
		/// <summary>
		/// Initialize an InsertEntryDlg from something like an "Insert Major Entry menu".
		/// </summary>
		/// <param name="cache">The FDO cache to use.</param>
		/// <param name="tssForm">The initial form to use.</param>
		/// <param name="mediator">The XCore.Mediator to use.</param>
		public void SetDlgInfo(FdoCache cache, ITsString tssForm, Mediator mediator)
		{
			CheckDisposed();

			m_mediator = mediator;
			if (m_types == null)
				m_types = new MoMorphTypeCollection(cache);
			string form = tssForm.Text;
			int clsidForm;
			IMoMorphType mmt;

			// Check whether the incoming form is vernacular or analysis.
			// (See LT-4074 and LT-7240.)
			int wsForm;
			bool fVern = IsFormWsInCurrentVernWs(cache, tssForm, out wsForm);
			// If form is empty (cf. LT-1621), use stem
			if (tssForm.Length == 0 || !fVern)
				mmt = m_types.Item(MoMorphType.kmtStem);
			else
				mmt = MoMorphType.FindMorphType(cache, m_types, ref form, out clsidForm);
			int wsVern = fVern ? wsForm : cache.DefaultVernWs;
			SetDlgInfo(cache, mmt, wsVern, MorphTypeFilterType.any);
			if (fVern)
			{
				TssForm = tssForm;
				TssGloss = cache.MakeAnalysisTss("");
				// The lexical form is already set, so shift focus to the gloss when
				// the form is activated.
				m_fLexicalFormInitialFocus = false;
			}
			else
			{
				TssForm = cache.MakeVernTss("");
				TssGloss = tssForm;
				// The gloss is already set, so shift the focus to the lexical form
				// when the form is activated.
				m_fLexicalFormInitialFocus = m_fLexicalFormChanged = true;
			}

			UpdateMatches();
		}