/// <summary>
		/// Override method to handle launching of a chooser for selecting lexical entries.
		/// </summary>
		protected override void HandleChooser()
		{
			ILexRefType lrt = LexRefType.CreateFromDBObject(m_cache, m_obj.OwnerHVO);
			int type = lrt.MappingType;
			BaseGoDlg dlg = null;
			switch ((LexRefType.MappingTypes)type)
			{
				case LexRefType.MappingTypes.kmtSenseTree:
					dlg = new LinkEntryOrSenseDlg();
					(dlg as LinkEntryOrSenseDlg).SelectSensesOnly = true;
					break;
				case LexRefType.MappingTypes.kmtEntryTree:
					dlg = new GoDlg();
					break;
				case LexRefType.MappingTypes.kmtEntryOrSenseTree:
					dlg = new LinkEntryOrSenseDlg();
					break;
			}
			Debug.Assert(dlg != null);
			WindowParams wp = new WindowParams();

			//This method is only called when we are Replacing the
			//tree root of a Whole/Part lexical relation
			wp.m_title = String.Format(LexEdStrings.ksReplaceXEntry);
			wp.m_btnText = LexEdStrings.ks_Replace;
			wp.m_label = LexEdStrings.ksFind_;
			dlg.SetDlgInfo(m_cache, wp, m_mediator);
			dlg.SetHelpTopic("khtpChooseLexicalRelationAdd");
			if (dlg.ShowDialog(FindForm()) == DialogResult.OK)
				TargetHvo = dlg.SelectedID;
			dlg.Dispose();
		}
		/// <summary>
		/// Override method to handle launching of a chooser for selecting lexical entries.
		/// </summary>
		protected override void HandleChooser()
		{
			ILexRefType lrt = LexRefType.CreateFromDBObject(m_cache, m_obj.OwnerHVO);
			int type = lrt.MappingType;
			BaseGoDlg dlg = null;
			switch ((LexRefType.MappingTypes)type)
			{
				case LexRefType.MappingTypes.kmtSenseSequence:
					dlg = new LinkEntryOrSenseDlg();
					(dlg as LinkEntryOrSenseDlg).SelectSensesOnly = true;
					break;
				case LexRefType.MappingTypes.kmtEntrySequence:
					dlg = new GoDlg();
					break;
				case LexRefType.MappingTypes.kmtEntryOrSenseSequence:
					dlg = new LinkEntryOrSenseDlg();
					break;
			}
			Debug.Assert(dlg != null);
			WindowParams wp = new WindowParams();
			wp.m_title = String.Format(LexEdStrings.ksIdentifyXEntry,
				lrt.Name.AnalysisDefaultWritingSystem);
			wp.m_label = LexEdStrings.ksFind_;
			wp.m_btnText = LexEdStrings.ks_Add; //for collection relation of items always have an Add button
			dlg.SetDlgInfo(m_cache, wp, m_mediator);
			dlg.SetHelpTopic("khtpChooseLexicalRelationAdd");
			if (dlg.ShowDialog(FindForm()) == DialogResult.OK)
				AddItem(dlg.SelectedID);
			dlg.Dispose();

		}
Ejemplo n.º 3
0
        /// <summary>
        /// Handles the xCore message to go to or link to a lexical entry.
        /// </summary>
        /// <param name="argument">The xCore Command object.</param>
        /// <returns>true</returns>
        public bool OnGotoLexEntry(object argument)
        {
            CheckDisposed();

            using (GoDlg dlg = new GoDlg())
            {
                FdoCache cache = (FdoCache)m_mediator.PropertyTable.GetValue("cache");
                Debug.Assert(cache != null);
                dlg.SetDlgInfo(cache, null, m_mediator);
                dlg.SetHelpTopic("khtpFindLexicalEntry");
                if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    m_mediator.BroadcastMessageUntilHandled("JumpToRecord", dlg.SelectedID);
                }
            }
            return(true);
        }
Ejemplo n.º 4
0
		/// <summary>
		/// This method is called when we are creating a new lexical relation slice.
		/// If the user selects an item it's hvo is returned.
		/// Otherwise 0 is returned and the lexical relation should not be created.
		/// </summary>
		/// <param name="lrt"></param>
		/// <returns></returns>
		private int GetChildObjectHvo(ILexRefType lrt)
		{
			int hvoFirst = 0;
			BaseEntryGoDlg dlg = null;
			string sTitle = "";
			switch ((LexRefType.MappingTypes)lrt.MappingType)
			{
				case LexRefType.MappingTypes.kmtEntryOrSensePair:
				case LexRefType.MappingTypes.kmtEntryOrSenseAsymmetricPair: // Entry or sense pair with different Forward/Reverse
					dlg = new LinkEntryOrSenseDlg();
					(dlg as LinkEntryOrSenseDlg).SelectSensesOnly = false;
					sTitle = String.Format(LexEdStrings.ksIdentifyXLexEntryOrSense,
						 lrt.Name.BestAnalysisAlternative.Text);
					break;

				case LexRefType.MappingTypes.kmtSenseCollection:
				case LexRefType.MappingTypes.kmtSensePair:
				case LexRefType.MappingTypes.kmtSenseAsymmetricPair: // Sense pair with different Forward/Reverse names
				case LexRefType.MappingTypes.kmtSenseSequence:
				case LexRefType.MappingTypes.kmtSenseTree:
					dlg = new LinkEntryOrSenseDlg();
					(dlg as LinkEntryOrSenseDlg).SelectSensesOnly = true;
					sTitle = String.Format(LexEdStrings.ksIdentifyXSense,
						lrt.Name.BestAnalysisAlternative.Text);
					break;

				case LexRefType.MappingTypes.kmtEntryCollection:
				case LexRefType.MappingTypes.kmtEntryPair:
				case LexRefType.MappingTypes.kmtEntryAsymmetricPair: // Entry pair with different Forward/Reverse names
				case LexRefType.MappingTypes.kmtEntrySequence:
				case LexRefType.MappingTypes.kmtEntryTree:
					dlg = new GoDlg();
					sTitle = String.Format(LexEdStrings.ksIdentifyXLexEntry,
						lrt.Name.BestAnalysisAlternative.Text);
					break;

				case LexRefType.MappingTypes.kmtEntryOrSenseCollection:
				case LexRefType.MappingTypes.kmtEntryOrSenseSequence:
				case LexRefType.MappingTypes.kmtEntryOrSenseTree:
					dlg = new LinkEntryOrSenseDlg();
					sTitle = String.Format(LexEdStrings.ksIdentifyXLexEntryOrSense,
						lrt.Name.BestAnalysisAlternative.Text);
					break;
				default:
					Debug.Assert(lrt.MappingType == (int)LexRefType.MappingTypes.kmtSenseAsymmetricPair ||
						lrt.MappingType == (int)LexRefType.MappingTypes.kmtSenseTree);
					return 0;
			}
			Debug.Assert(dlg != null);
			WindowParams wp = new WindowParams();
			wp.m_title = sTitle;
			wp.m_label = LexEdStrings.ksFind_;
			wp.m_btnText = LexEdStrings.ks_Add;

			// Don't display the current entry in the list of matching entries.  See LT-2611.
			ICmObject objEntry = this.Object;
			while (objEntry.ClassID == LexSense.kclsidLexSense)
				objEntry = CmObject.CreateFromDBObject(m_cache, objEntry.OwnerHVO);
			Debug.Assert(objEntry.ClassID == LexEntry.kclsidLexEntry);
			dlg.StartingEntry = objEntry as ILexEntry;

			dlg.SetDlgInfo(m_cache, wp, Mediator);
			dlg.SetHelpTopic("khtpChooseLexicalRelationAdd");
			if (dlg.ShowDialog(FindForm()) == DialogResult.OK)
				hvoFirst = dlg.SelectedID;
			dlg.Dispose();
			return hvoFirst;
		}
Ejemplo n.º 5
0
		/// <summary>
		/// This method is called when we are creating a new lexical relation slice.
		/// If the user selects an item it's hvo is returned.
		/// Otherwise 0 is returned and the lexical relation should not be created.
		/// </summary>
		/// <param name="lrt"></param>
		/// <returns></returns>
		private int GetRootObjectHvo(ILexRefType lrt)
		{
			int hvoFirst = 0;
			BaseEntryGoDlg dlg = null;
			switch ((LexRefType.MappingTypes)lrt.MappingType)
			{
				case LexRefType.MappingTypes.kmtSenseAsymmetricPair:
				case LexRefType.MappingTypes.kmtSenseTree:
					dlg = new LinkEntryOrSenseDlg();
					(dlg as LinkEntryOrSenseDlg).SelectSensesOnly = true;
					break;
				case LexRefType.MappingTypes.kmtEntryAsymmetricPair:
				case LexRefType.MappingTypes.kmtEntryTree:
					dlg = new GoDlg();
					break;
				case LexRefType.MappingTypes.kmtEntryOrSenseAsymmetricPair:
				case LexRefType.MappingTypes.kmtEntryOrSenseTree:
					dlg = new LinkEntryOrSenseDlg();
					break;
				default:
					Debug.Assert(lrt.MappingType == (int)LexRefType.MappingTypes.kmtSenseAsymmetricPair ||
						lrt.MappingType == (int)LexRefType.MappingTypes.kmtSenseTree);
					return 0;
			}
			Debug.Assert(dlg != null);
			WindowParams wp = new WindowParams();
			//wp.m_title = String.Format(LexEdStrings.ksIdentifyXEntry,
			//   lrt.Name.AnalysisDefaultWritingSystem);
			wp.m_title = String.Format(LexEdStrings.ksIdentifyXEntry,
				lrt.ReverseName.BestAnalysisAlternative.Text);
			wp.m_label = LexEdStrings.ksFind_;
			//wp.m_btnText = LexEdStrings.ks_Link;
			wp.m_btnText = LexEdStrings.ks_Add;
			dlg.SetDlgInfo(m_cache, wp, Mediator);
			dlg.SetHelpTopic("khtpChooseLexicalRelationAdd");
			if (dlg.ShowDialog(FindForm()) == DialogResult.OK)
				hvoFirst = dlg.SelectedID;
			dlg.Dispose();
			return hvoFirst;
		}
Ejemplo n.º 6
0
		/// <summary>
		/// Override method to handle launching of a chooser for selecting lexical entries.
		/// </summary>
		protected override void HandleChooser()
		{
			ILexRefType lrt = LexRefType.CreateFromDBObject(m_cache, m_obj.OwnerHVO);
			LexRefType.MappingTypes type = (LexRefType.MappingTypes)lrt.MappingType;
			BaseGoDlg dlg = null;
			switch (type)
			{
				case LexRefType.MappingTypes.kmtSensePair:
				case LexRefType.MappingTypes.kmtSenseAsymmetricPair: // Sense pair with different Forward/Reverse names
					dlg = new LinkEntryOrSenseDlg();
					(dlg as LinkEntryOrSenseDlg).SelectSensesOnly = true;
					break;
				case LexRefType.MappingTypes.kmtEntryPair:
				case LexRefType.MappingTypes.kmtEntryAsymmetricPair: // Entry pair with different Forward/Reverse names
					dlg = new GoDlg();
					break;
				case LexRefType.MappingTypes.kmtEntryOrSensePair:
				case LexRefType.MappingTypes.kmtEntryOrSenseAsymmetricPair: // Entry or sense pair with different Forward/Reverse
					dlg = new LinkEntryOrSenseDlg();
					(dlg as LinkEntryOrSenseDlg).SelectSensesOnly = false;
					break;
			}
			Debug.Assert(dlg != null);
			WindowParams wp = new WindowParams();
			//on creating Pair Lexical Relation have an Add button and Add in the title bar
			if ( TargetHvo == 0 )
			{
				wp.m_title = String.Format(LexEdStrings.ksIdentifyXEntry,
				lrt.Name.AnalysisDefaultWritingSystem);
				wp.m_btnText = LexEdStrings.ks_Add;
			}
			else //Otherwise we are Replacing the item
			{
				wp.m_title = String.Format(LexEdStrings.ksReplaceXEntry);
				wp.m_btnText = LexEdStrings.ks_Replace;
			}

			wp.m_label = LexEdStrings.ksFind_;

			dlg.SetDlgInfo(m_cache, wp, m_mediator);
			dlg.SetHelpTopic("khtpChooseLexicalRelationAdd");
			if (dlg.ShowDialog(FindForm()) == DialogResult.OK)
				TargetHvo = dlg.SelectedID;
			dlg.Dispose();
		}
Ejemplo n.º 7
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Launch the Find Entry dialog, and if one is created or selected return it.
		/// </summary>
		/// <param name="cache">The cache.</param>
		/// <param name="mediator">The mediator.</param>
		/// <param name="tssForm">The TSS form.</param>
		/// <param name="owner">The owner.</param>
		/// <returns>The HVO of the selected or created entry</returns>
		/// ------------------------------------------------------------------------------------
		internal static int ShowFindEntryDialog(FdoCache cache, Mediator mediator,
			ITsString tssForm, IWin32Window owner)
		{
			// Ensure that we have a valid mediator with the proper string table.
			bool fRestore = false;
			StringTable stOrig = null;
			mediator = EnsureValidMediator(mediator, out fRestore, out stOrig);
			EnsureFlexVirtuals(cache, mediator);
			using (GoDlg dlg = new GoDlg())
			{
				WindowParams wp = new WindowParams();
				wp.m_btnText = FdoUiStrings.ksShow;
				wp.m_title = FdoUiStrings.ksFindInDictionary;
				wp.m_label = FdoUiStrings.ksFind_;
				dlg.Owner = owner as Form;
				dlg.SetDlgInfo(cache, wp, mediator, tssForm);
				dlg.SetHelpTopic("khtpFindInDictionary");
				if (dlg.ShowDialog() == DialogResult.OK)
				{
					int entryId = dlg.SelectedID;
					Debug.Assert(entryId != 0);
					// Restore the original string table in the mediator if needed.
					if (fRestore)
						mediator.StringTbl = stOrig;
					return entryId;
				}
			}
			// Restore the original string table in the mediator if needed.
			if (fRestore)
				mediator.StringTbl = stOrig;
			return 0;
		}
Ejemplo n.º 8
0
		/// <summary>
		/// Handles the xCore message to go to or link to a lexical entry.
		/// </summary>
		/// <param name="argument">The xCore Command object.</param>
		/// <returns>true</returns>
		public bool OnGotoLexEntry(object argument)
		{
			CheckDisposed();

			using (GoDlg dlg = new GoDlg())
			{
				FdoCache cache = (FdoCache)m_mediator.PropertyTable.GetValue("cache");
				Debug.Assert(cache != null);
				dlg.SetDlgInfo(cache, null, m_mediator);
				dlg.SetHelpTopic("khtpFindLexicalEntry");
				if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
					m_mediator.BroadcastMessageUntilHandled("JumpToRecord", dlg.SelectedID);
			}
			return true;
		}