当前位置: 首页>>代码示例>>C#>>正文


C# RootSites.SelectionHelper类代码示例

本文整理汇总了C#中SIL.FieldWorks.Common.RootSites.SelectionHelper的典型用法代码示例。如果您正苦于以下问题:C# SelectionHelper类的具体用法?C# SelectionHelper怎么用?C# SelectionHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SelectionHelper类属于SIL.FieldWorks.Common.RootSites命名空间,在下文中一共展示了SelectionHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HandleUpDownArrows

		internal static void HandleUpDownArrows(KeyEventArgs e, IVwRootBox rootBox, SelectionHelper curSel, List<IWritingSystem> wsList, int flid)
		{
			if (curSel == null || !curSel.IsValid) // LT-13805: sometimes selection was null
				return;
			var index = GetCurrentSelectionIndex(curSel, wsList);
			if (index < 0)
				return;
			var maxWsIndex = wsList.Count - 1;
			if (e.KeyCode == Keys.Up)
			{
				// Handle Up arrow
				if ((index - 1) < 0)
					return;
				index--;
			}
			else
			{
				// Handle Down arrow
				if ((index + 1) > maxWsIndex)
					return;
				index++;
			}
			// make new selection at index
			var newSelection = GetSelAtStartOfWs(rootBox, flid, index, wsList[index]);
			newSelection.Install();
			e.Handled = true;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:27,代码来源:MultiStringSelectionUtils.cs

示例2: SelectionWrapper

			public SelectionWrapper(SimpleRootSite rootSite)
			{
				SelectionHelper = new SelectionHelper(rootSite.EditingHelper.CurrentSelection);

				ITsTextProps[] textProps;
				IVwPropertyStore[] propertyStores;
				int numberOfProps;
				SelectionHelper.GetSelectionProps(SelectionHelper.Selection,
					out textProps, out propertyStores, out numberOfProps);
				if (numberOfProps > 0)
					m_TextProps = textProps;
			}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:12,代码来源:IbusRootSiteEventHandler.cs

示例3: GetCurrentSelectionIndex

		internal static int GetCurrentSelectionIndex(SelectionHelper curSel, List<IWritingSystem> writingSystems)
		{
			var ws = curSel.SelProps.GetWs();
			int index = -1;
			for (var i = 0; i < writingSystems.Count; i++)
			{
				if (writingSystems[i].Handle == ws)
				{
					index = i;
					break;
				}
			}
			return index;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:14,代码来源:MultiStringSelectionUtils.cs

示例4: SelectionRestorer

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="SelectionRestorer"/> class.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public SelectionRestorer(SimpleRootSite rootSite)
		{
			// we can't use EditingHelper.CurrentSelection here because the scroll position
			// of the selection may have changed.
			m_savedSelection = SelectionHelper.Create(rootSite);
			m_rootSite = rootSite;

			Rectangle rcSrc, rcDst;
			rootSite.GetCoordRects(out rcSrc, out rcDst);
			try
			{
				IVwSelection sel = rootSite.RootBox.MakeSelAt(5, 5, rcSrc, rcDst, false);
				m_topOfViewSelection = SelectionHelper.Create(sel, rootSite);
			}
			catch (COMException)
			{
				// Just ignore any errors
			}
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:24,代码来源:SelectionRestorer.cs

示例5: GetDisplayedTextForFootnote

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Gets the displayed text for a footnote.
		/// </summary>
		/// <param name="iBook">Index of the book the footnote is in</param>
		/// <param name="iFootnote">Index of the footnote</param>
		/// <param name="footnote">The footnote object</param>
		/// <returns>The TsString representing the text of the footnote, including any displayed
		/// marker, reference, etc.</returns>
		/// ------------------------------------------------------------------------------------
		public ITsString GetDisplayedTextForFootnote(int iBook, int iFootnote,
			IStFootnote footnote)
		{
			SelectionHelper helper = new SelectionHelper();

			// Create selection in footnote marker
			SelLevInfo[] anchorLevInfo = new SelLevInfo[4];
			anchorLevInfo[3].tag = BookFilter.Tag;
			anchorLevInfo[3].ihvo = iBook;
			anchorLevInfo[2].tag = ScrBookTags.kflidFootnotes;
			anchorLevInfo[2].ihvo = iFootnote;
			anchorLevInfo[1].tag = StTextTags.kflidParagraphs;
			anchorLevInfo[1].ihvo = 0;
			anchorLevInfo[0].tag = -1;
			anchorLevInfo[0].ihvo = 0;
			helper.SetLevelInfo(SelectionHelper.SelLimitType.Anchor, anchorLevInfo);
			helper.SetTextPropId(SelectionHelper.SelLimitType.Anchor,
				(int)VwSpecialAttrTags.ktagGapInAttrs);
			helper.IchAnchor = 0;

			SelLevInfo[] endLevInfo = new SelLevInfo[3];
			endLevInfo[2].tag = BookFilter.Tag;
			endLevInfo[2].ihvo = iBook;
			endLevInfo[1].tag = ScrBookTags.kflidFootnotes;
			endLevInfo[1].ihvo = iFootnote;
			endLevInfo[0].tag = StTextTags.kflidParagraphs;
			endLevInfo[0].ihvo = 0;
			helper.SetLevelInfo(SelectionHelper.SelLimitType.End, endLevInfo);
			helper.SetTextPropId(SelectionHelper.SelLimitType.End,
				StTxtParaTags.kflidContents);
			string footnoteText = ((IStTxtPara)footnote.ParagraphsOS[0]).Contents.Text;
			helper.IchEnd = footnoteText.Length;
			helper.SetTextPropId(SelectionHelper.SelLimitType.End, StTxtParaTags.kflidContents);

			helper.SetSelection(this, true, true);

			IVwSelection sel = RootBox.Selection;
			ITsString tss;
			sel.GetSelectionString(out tss, string.Empty);
			return tss;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:51,代码来源:DummyFootnoteViewForm.cs

示例6: RefreshAllHighlighting

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Refreshes all highlighting (revision and current draft diff views, and revision and
		/// current footnote diff views.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		private void RefreshAllHighlighting()
		{
			if (m_diffViewWrapper == null)
				return;

			// if there is a footnote selection, refresh highlighting and scroll to it.
			// Before we refresh the highlighting, we must save the selection helper because
			// it is cleared when we refresh the highlighting and the selection is not in the view.
			if (m_diffViewWrapper.CurrentDiffFootnoteView != null &&
				m_diffViewWrapper.CurrentDiffFootnoteView.Visible &&
				m_diffViewWrapper.CurrentDiffFootnoteView.EditingHelper.CurrentSelection != null)
			{
				m_diffViewWrapper.CurrentDiffFootnoteView.ScrollSelectionIntoView(m_diffViewWrapper.CurrentDiffFootnoteView.RootBox.Selection,
					VwScrollSelOpts.kssoDefault);
				SelectionHelper selHelper = null;
				if (m_diffViewWrapper.CurrentDiffFootnoteView.EditingHelper.CurrentSelection != null)
					selHelper = new SelectionHelper(m_diffViewWrapper.CurrentDiffFootnoteView.EditingHelper.CurrentSelection);
				RefreshDiffViewHighlighting(m_diffViewWrapper.CurrentDiffFootnoteView.EditingHelper.CurrentSelection);
				if (selHelper != null)
					selHelper.SetSelection(m_diffViewWrapper.CurrentDiffFootnoteView, true, true);
			}
			if (m_diffViewWrapper.RevisionDiffFootnoteView != null &&
				m_diffViewWrapper.RevisionDiffFootnoteView.Visible &&
				m_diffViewWrapper.RevisionDiffFootnoteView.EditingHelper.CurrentSelection != null)
			{
				m_diffViewWrapper.RevisionDiffFootnoteView.ScrollSelectionIntoView(
					m_diffViewWrapper.RevisionDiffFootnoteView.RootBox.Selection,
					VwScrollSelOpts.kssoDefault);
				SelectionHelper selHelper = null;
				if (m_diffViewWrapper.RevisionDiffFootnoteView.EditingHelper.CurrentSelection != null)
					selHelper = new SelectionHelper(m_diffViewWrapper.RevisionDiffFootnoteView.EditingHelper.CurrentSelection);
				RefreshDiffViewHighlighting(m_diffViewWrapper.RevisionDiffFootnoteView.EditingHelper.CurrentSelection);
				if (selHelper != null)
					selHelper.SetSelection(m_diffViewWrapper.RevisionDiffFootnoteView, true, true);
			}

			// Refresh highlighted text when window is resized.
			if (m_diffViewWrapper.CurrentDiffView != null &&
				m_diffViewWrapper.CurrentDiffView.EditingHelper.CurrentSelection != null)
			{
				RefreshDiffViewHighlighting(m_diffViewWrapper.CurrentDiffView.EditingHelper.CurrentSelection);
			}

			if (m_diffViewWrapper.RevisionDiffView != null &&
				m_diffViewWrapper.RevisionDiffView.EditingHelper.CurrentSelection != null)
			{
				RefreshDiffViewHighlighting(m_diffViewWrapper.RevisionDiffView.EditingHelper.CurrentSelection);
			}

			// Scroll selections from draft and revision into view.
			ScrollToDiff(m_differences.CurrentDifference);
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:58,代码来源:DiffDialog.cs

示例7: CallMouseDown

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Remember if a picture is selected so that it can be deselected on mouse up,
		/// if necessary.
		/// </summary>
		/// <param name="pt"></param>
		/// <param name="rcSrcRoot"></param>
		/// <param name="rcDstRoot"></param>
		/// ------------------------------------------------------------------------------------
		protected override void CallMouseDown(Point pt, Rectangle rcSrcRoot, Rectangle rcDstRoot)
		{
			IVwSelection sel = m_rootb.MakeSelAt(pt.X, pt.Y, rcSrcRoot, rcDstRoot, false);
			if (sel != null && sel.SelType == VwSelType.kstPicture)
			{
				// If the picture selected is a translation status box, remember which picture is
				// selected (so that the status only changes if the same status box is selected
				// on mouse up and mouse down).
				SelectionHelper selHelper = SelectionHelper.Create(sel, this);
				SelLevInfo[] info = selHelper.LevelInfo;
				if (info[0].tag == StTxtParaTags.kflidTranslations)
				{
					m_selectedTransHvo = info[0].hvo;
					m_pictureSelected = true;
					m_selectionHelper = EditingHelper.CurrentSelection;
				}
			}
			else
			{
				m_pictureSelected = false;
				m_selectedTransHvo = 0;
			}
			base.CallMouseDown (pt, rcSrcRoot, rcDstRoot);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:33,代码来源:DraftView.cs

示例8: MoveToNextTranslation

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Find and select the next translation meeting a given condition
		/// </summary>
		/// <param name="selection">The selection where to start the search.
		/// NOTE: The selection must have all of the info set in the LevelInfo (hvo, ihvo)</param>
		/// <param name="condition">Condition the cack translation must meet</param>
		/// ------------------------------------------------------------------------------------
		private void MoveToNextTranslation(SelectionHelper selection,
			Func<ICmTranslation, bool> condition)
		{
			SelLevInfo bookInfo;
			SelLevInfo paraInfo;
			SelLevInfo sectionInfo;
			bool fFoundBookLevel = selection.GetLevelInfoForTag(BookFilter.Tag, out bookInfo);
			bool fFoundSectionLevel = selection.GetLevelInfoForTag(
				ScrBookTags.kflidSections, out sectionInfo);
			int secLev = selection.GetLevelForTag(ScrBookTags.kflidSections);
			bool fFoundParaLevel = selection.GetLevelInfoForTag(
				StTextTags.kflidParagraphs, out paraInfo);

			if (!fFoundBookLevel || !fFoundParaLevel)
				return;

			// Look through all the books in the book filter
			int bookStartIndex = bookInfo.ihvo;
			int sectionStartIndex = 0;
			int sectionTag;
			int paraStartIndex = paraInfo.ihvo + 1;
			int paraIndex;

			if (fFoundSectionLevel)
			{
				// start with current section
				sectionStartIndex = sectionInfo.ihvo;
				sectionTag = selection.LevelInfo[secLev - 1].tag;
			}
			else
			{
				// no section, so this must be the title - Look through the title paragraphs
				IScrBook checkBook = BookFilter.GetBook(bookStartIndex);
				paraIndex = FindNextTranslationInText(checkBook.TitleOA, paraStartIndex, condition);
				if (paraIndex >= 0)
				{
					// select the title paragraph
					SetInsertionPoint(ScrBookTags.kflidTitle, bookStartIndex, 0, paraIndex);
					return;
				}
				// continue the search with the current book
				sectionTag = ScrSectionTags.kflidHeading;
				paraStartIndex = 0;
			}

			for (int bookIndex = bookStartIndex; bookIndex < BookFilter.BookCount; bookIndex++)
			{
				IScrBook checkBook = BookFilter.GetBook(bookIndex);
				if (bookIndex > bookStartIndex)
				{
					// Look through the title paragraphs
					paraIndex = FindNextTranslationInText(checkBook.TitleOA, 0, condition);
					if (paraIndex >= 0)
					{
						// select the title paragraph
						SetInsertionPoint(ScrBookTags.kflidTitle, bookIndex, 0, paraIndex);
						return;
					}
				}

				// Look through the sections in order.
				for (int sectionIndex = sectionStartIndex;
					sectionIndex < checkBook.SectionsOS.Count; sectionIndex++)
				{
					IScrSection checkSection = checkBook.SectionsOS[sectionIndex];

					// Look in the paragraphs (could be either content or heading)
					IStText text = (sectionTag == ScrSectionTags.kflidHeading) ?
						checkSection.HeadingOA : checkSection.ContentOA;
					paraIndex = FindNextTranslationInText(text, paraStartIndex, condition);
					if (paraIndex >= 0)
					{
						// select the paragraph
						SetInsertionPoint(sectionTag, bookIndex, sectionIndex, paraIndex);
						return;
					}

					// Look in the content paragraphs, if we haven't already
					if (sectionTag == ScrSectionTags.kflidHeading)
					{
						sectionTag = ScrSectionTags.kflidContent;
						paraIndex = FindNextTranslationInText(checkSection.ContentOA, 0, condition);
						if (paraIndex >= 0)
						{
							// select the content paragraph
							SetInsertionPoint(sectionTag, bookIndex, sectionIndex, paraIndex);
							return;
						}
					}

					sectionTag = ScrSectionTags.kflidHeading;
					paraStartIndex = 0;
//.........这里部分代码省略.........
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:101,代码来源:DraftView.cs

示例9: ConvertBookTagAndIndex

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Convert the scripture book tag to a filter tag.  Also, convert book indices to
		/// filtered book indices.  This is done when loading a selection to make it work
		/// in the context of the book filter.
		/// </summary>
		/// <param name="helper"></param>
		/// <param name="selType"></param>
		/// ------------------------------------------------------------------------------------
		private void ConvertBookTagAndIndex(SelectionHelper helper,
			SelectionHelper.SelLimitType selType)
		{
			SelLevInfo[] info = helper.GetLevelInfo(selType);
			int bookPos = info.Length - 1;
			if (info[bookPos].tag == ScriptureTags.kflidScriptureBooks)
			{
				info[bookPos].tag = BookFilter.Tag;
				info[bookPos].ihvo = BookFilter.GetBookIndex(
					m_fdoCache.ServiceLocator.GetInstance<IScrBookRepository>().GetObject(info[bookPos].hvo));
				helper.SetLevelInfo(selType, info);
			}
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:22,代码来源:DraftView.cs

示例10: SelIsInEmptyTranslation

		private bool SelIsInEmptyTranslation(SelectionHelper helper, int flid, int hvo)
		{
			if (helper.IsRange)
				return false; // range can't be in empty comment.
			if (flid != SegmentTags.kflidFreeTranslation && flid != SegmentTags.kflidLiteralTranslation)
				return false; // translation is always a comment.
			if (helper.GetTss(SelectionHelper.SelLimitType.Anchor).Length != 0)
				return false; // translation is non-empty.
			return true;
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:10,代码来源:InterlinDocForAnalysis.cs

示例11: RemoveFromOutput

		protected bool RemoveFromOutput(bool forward, SelectionHelper sel, out int index)
		{
			index = -1;
			bool reconstruct = false;
			ICmObject[] mappings = Rule.OutputOS.Cast<ICmObject>().ToArray();
			if (sel.IsRange)
			{
				int[] indices = GetIndicesToRemove(mappings, sel);
				if (indices.Length > 0)
					index = indices[0] - 1;


				foreach (int idx in indices)
				{
					var mapping = (IMoRuleMapping) mappings[idx];
					if (!IsFinalLastVariableMapping(mapping))
					{
						Rule.OutputOS.Remove(mapping);
						reconstruct = true;
					}
				}
			}
			else
			{
				int idx = GetIndexToRemove(mappings, sel, forward);
				if (idx > -1)
				{
					var mapping = (IMoRuleMapping) mappings[idx];
					index = idx - 1;
					if (!IsFinalLastVariableMapping(mapping))
					{
						Rule.OutputOS.Remove(mapping);
						reconstruct = true;
					}
				}
			}
			return reconstruct;
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:38,代码来源:AffixRuleFormulaControl.cs

示例12: RemoveItems

		protected override int RemoveItems(SelectionHelper sel, bool forward, out int cellIndex)
		{
			cellIndex = -1;

			int cellId = GetCell(sel);
			if (cellId == -1 || cellId == -2)
				return -1;

			switch (cellId)
			{
				case AffixRuleFormulaVc.ktagLeftEmpty:
				case AffixRuleFormulaVc.ktagRightEmpty:
					return -1;

				case MoAffixProcessTags.kflidOutput:
					return RemoveFromOutput(forward, sel, out cellIndex) ? cellId : -1;

				default:
					var ctxtOrVar = m_cache.ServiceLocator.GetInstance<IPhContextOrVarRepository>().GetObject(cellId);
					if (ctxtOrVar.ClassID == PhSequenceContextTags.kClassId)
					{
						var seqCtxt = (IPhSequenceContext) ctxtOrVar;
						if (seqCtxt.MembersRS.Count == 0 && forward)
						{
							// remove an empty column
							int prevCellId = GetPrevCell(seqCtxt.Hvo);
							cellIndex = GetCellCount(prevCellId) - 1;
							Rule.InputOS.Remove(seqCtxt);
							return prevCellId;
						}
						bool reconstruct = RemoveContextsFrom(forward, sel, seqCtxt, false, out cellIndex);
						// if the column is empty, schedule it to be removed when the selection has changed
						if (seqCtxt.MembersRS.Count == 0)
							m_removeCol = seqCtxt;
						return reconstruct ? seqCtxt.Hvo : -1;
					}
					int idx = GetIndexToRemove(new ICmObject[] { ctxtOrVar }, sel, forward);
					if (idx > -1 && !IsLastVariable(ctxtOrVar))
					{
						var seqCtxt = m_cache.ServiceLocator.GetInstance<IPhSequenceContextFactory>().Create();
						Rule.InputOS.Insert(ctxtOrVar.IndexInOwner, seqCtxt);
						// if the column is empty, schedule it to be removed when the selection has changed
						m_removeCol = seqCtxt;
						UpdateMappings(ctxtOrVar, seqCtxt);

						ctxtOrVar.PreRemovalSideEffects();
						Rule.InputOS.Remove(ctxtOrVar);
						return seqCtxt.Hvo;
					}
					return -1;
			}
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:52,代码来源:AffixRuleFormulaControl.cs

示例13: InsertVariable

		protected override int InsertVariable(SelectionHelper sel, out int cellIndex)
		{
			return InsertContext(m_cache.ServiceLocator.GetInstance<IPhVariableFactory>().Create(), sel, out cellIndex);
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:4,代码来源:AffixRuleFormulaControl.cs

示例14: InsertIndex

		protected override int InsertIndex(int index, SelectionHelper sel, out int cellIndex)
		{
			var copy = m_cache.ServiceLocator.GetInstance<IMoCopyFromInputFactory>().Create();
			cellIndex = InsertIntoOutput(copy, sel);
			copy.ContentRA = Rule.InputOS[index - 1];
			return MoAffixProcessTags.kflidOutput;
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:7,代码来源:AffixRuleFormulaControl.cs

示例15: HandleSelectionChange

		/// -----------------------------------------------------------------------------------
		/// <summary>
		/// Notifies the site that something about the selection has changed.
		/// </summary>
		/// <param name="prootb"></param>
		/// <param name="vwselNew">Selection</param>
		/// <remarks>When overriding you should call the base class first.</remarks>
		/// -----------------------------------------------------------------------------------
		protected override void HandleSelectionChange(IVwRootBox prootb, IVwSelection vwselNew)
		{
			if (m_fInSelectionChanged)
				return; // don't need to reprocess our own changes.
			m_fInSelectionChanged = true;
			try
			{
				base.HandleSelectionChange(prootb, vwselNew);
				IVwSelection sel = vwselNew;
				if (!sel.IsValid)
					sel = prootb.Selection;
				if (sel == null)
					return;
				SelectionHelper helper = SelectionHelper.Create(sel, prootb.Site);
				// Check whether the selection is on the proper line of a multilingual
				// annotation and, if not, fix it.  See LT-9421.
				if (m_cpropPrevForInsert > 0 && !sel.IsRange &&
					(helper.GetNumberOfPreviousProps(SelectionHelper.SelLimitType.Anchor) == 0 ||
					 helper.GetNumberOfPreviousProps(SelectionHelper.SelLimitType.End) == 0))
				{
					try
					{
						helper.SetNumberOfPreviousProps(SelectionHelper.SelLimitType.Anchor, m_cpropPrevForInsert);
						helper.SetNumberOfPreviousProps(SelectionHelper.SelLimitType.End, m_cpropPrevForInsert);
						helper.MakeBest(true);
						m_cpropPrevForInsert = -1;	// we've used this the one time it was needed.
					}
					catch (Exception exc)
					{
						if (exc != null)
							Debug.WriteLine(String.Format(
								"InterlinDocChild.SelectionChanged() trying to display prompt in proper line of annotation: {0}", exc.Message));
					}
				}
				int flid = helper.GetTextPropId(SelectionHelper.SelLimitType.Anchor);
				//If the flid is -2 and it is an insertion point then we may have encountered a case where the selection has landed at the boundary between our (possibly empty)
				//translation field and a literal string containing our magic Bidi marker character that helps keep things in the right order.
				//Sometimes AssocPrev gets set so that we read the (non-existent) flid of the literal string and miss the fact that on the other side
				//of the insertion point is the field we're looking for. The following code will attempt to make a selection that associates in
				//the other direction to see if the flid we want is on the other side. [LT-10568]
				if (flid == -2 && !sel.IsRange && sel.SelType == VwSelType.kstText)
				{
					helper.AssocPrev = !helper.AssocPrev;
					try
					{
						var newSel = helper.MakeRangeSelection(this.RootBox, false);
						helper = SelectionHelper.Create(newSel, this);
						flid = helper.GetTextPropId(SelectionHelper.SelLimitType.Anchor);
					}
					catch (COMException)
					{
						// Ignore HResult E_Fail caused by Extended Keys (PgUp/PgDown) in non-editable text (LT-13500)
					}
				}
				//Fixes LT-9884 Crash when clicking on the blank space in Text & Words--->Print view area!
				if (helper.LevelInfo.Length == 0)
					return;
				int hvo = helper.LevelInfo[0].hvo;

				// If the selection is in a freeform or literal translation that is empty, display the prompt.
				if (SelIsInEmptyTranslation(helper, flid, hvo) && !m_rootb.IsCompositionInProgress)
				{
					var handlerExtensions = Cache.ActionHandlerAccessor as IActionHandlerExtensions;
					if (handlerExtensions != null && handlerExtensions.IsUndoTaskActive)
					{
						// Wait to make the changes until the task (typically typing backspace) completes.
						m_setupPromptHelper = helper;
						m_setupPromptFlid = flid;
						handlerExtensions.DoAtEndOfPropChanged(handlerExtensions_PropChangedCompleted);
					}
					else
					{
						// No undo task to tag on the end of, so do it now.
						SetupTranslationPrompt(helper, flid);
					}
				}
				else if (flid != kTagUserPrompt)
				{
					m_vc.SetActiveFreeform(0, 0, 0, 0); // clear any current prompt.
				}
				// do not extend the selection for a user prompt if the user is currently entering an IME composition,
				// since we are about to switch the prompt to a real comment field
				else if (helper.GetTextPropId(SelectionHelper.SelLimitType.End) == SimpleRootSite.kTagUserPrompt
					&& !m_rootb.IsCompositionInProgress)
				{
					// If the selection is entirely in a user prompt then extend the selection to cover the
					// entire prompt. This covers changes within the prompt, like clicking within it or continuing
					// a drag while making it.
					sel.ExtendToStringBoundaries();
					EditingHelper.SetKeyboardForSelection(sel);
				}
			}
//.........这里部分代码省略.........
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:101,代码来源:InterlinDocForAnalysis.cs


注:本文中的SIL.FieldWorks.Common.RootSites.SelectionHelper类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。