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


C# COMInterfaces.SelLevInfo类代码示例

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


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

示例1: SetupSelectionForParas

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Creates a simulated range selection
		/// </summary>
		/// <param name="hvoPara1"></param>
		/// <param name="hvoPara2"></param>
		/// <param name="ichAnchor"></param>
		/// <param name="ichEnd"></param>
		/// ------------------------------------------------------------------------------------
		public void SetupSelectionForParas(int hvoPara1, int hvoPara2, int ichAnchor, int ichEnd)
		{
			CheckDisposed();

			DynamicMock fakeSelHelper = new DynamicMock(typeof(SelectionHelper));
			fakeSelHelper.SetupResult("NumberOfLevels", 1);
			SelLevInfo[] topInfo = new SelLevInfo[1];
			topInfo[0].tag = StTextTags.kflidParagraphs;
			topInfo[0].hvo = hvoPara1;
			SelLevInfo[] bottomInfo = new SelLevInfo[1];
			bottomInfo[0].tag = StTextTags.kflidParagraphs;
			bottomInfo[0].hvo = hvoPara2;
			fakeSelHelper.SetupResult("LevelInfo", topInfo);
			fakeSelHelper.SetupResult("IchAnchor", ichAnchor);
			fakeSelHelper.SetupResult("IchEnd", ichEnd);
			fakeSelHelper.SetupResultForParams("GetLevelInfo", topInfo,
				SelectionHelper.SelLimitType.Top);
			fakeSelHelper.SetupResultForParams("GetLevelInfo", topInfo,
				SelectionHelper.SelLimitType.Anchor);
			fakeSelHelper.SetupResultForParams("GetLevelInfo", bottomInfo,
				SelectionHelper.SelLimitType.Bottom);
			fakeSelHelper.SetupResultForParams("GetLevelInfo", bottomInfo,
				SelectionHelper.SelLimitType.End);
			fakeSelHelper.SetupResultForParams("GetIch", ichAnchor,
				SelectionHelper.SelLimitType.Top);
			fakeSelHelper.SetupResultForParams("GetIch", ichEnd,
				SelectionHelper.SelLimitType.Bottom);
			m_currentSelection = (SelectionHelper)fakeSelHelper.MockInstance;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:38,代码来源:NotesEditingHelperTests.cs

示例2: RequestSelectionHelper

		/// -----------------------------------------------------------------------------------
		/// <summary>
		/// Make one and hook it up to be called at the appropriate time.
		/// </summary>
		/// -----------------------------------------------------------------------------------
		public RequestSelectionHelper(IActionHandlerExtensions hookup, IVwRootBox rootb, int ihvoRoot,
			SelLevInfo[] rgvsli, int tagTextProp, int cpropPrevious, int ich, int wsAlt, bool fAssocPrev,
			ITsTextProps selProps)
		{
			m_hookup = hookup;
			m_rootb = rootb;
			m_ihvoRoot = ihvoRoot;
			m_rgvsli = rgvsli;
			m_tagTextProp = tagTextProp;
			m_cpropPrevious = cpropPrevious;
			m_ich = ich;
			m_wsAlt = wsAlt;
			m_fAssocPrev = fAssocPrev;
			m_selProps = selProps;
			m_hookup.DoAtEndOfPropChanged(m_hookup_PropChangedCompleted);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:21,代码来源:RequestSelectionHelper.cs

示例3: SetupSelectionInFootnote

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Setup the selection in footnote.
		/// </summary>
		/// <param name="footnote">The footnote.</param>
		/// <param name="book">The book.</param>
		/// <param name="iBook">The 0-based index of the book.</param>
		/// <param name="ichStart">The 0-based starting character index.</param>
		/// <param name="ichEnd">The 0-based ending character index.</param>
		/// ------------------------------------------------------------------------------------
		public void SetupSelectionInFootnote(IStFootnote footnote, IScrBook book,
			int iBook, int ichStart, int ichEnd)
		{
			CheckDisposed();

			DynamicMock fakeSelHelper = new DynamicMock(typeof(SelectionHelper));
			fakeSelHelper.SetupResult("GetTextPropId", StTxtParaTags.kflidContents, typeof(SelectionHelper.SelLimitType));
			fakeSelHelper.SetupResult("NumberOfLevels", 3);
			// Setup the anchor
			SelLevInfo[] topInfo = new SelLevInfo[3];
			IStTxtPara para = footnote[0];
			topInfo[0].tag = StTextTags.kflidParagraphs;
			topInfo[0].ihvo = 0;	// only one para per footnote allowed
			topInfo[0].hvo = para.Hvo;

			topInfo[1].tag = ScrBookTags.kflidFootnotes;
			topInfo[1].ihvo = footnote.IndexInOwner;
			topInfo[1].hvo = footnote.Hvo;

			topInfo[2].tag = BookFilter.Tag;
			topInfo[2].ihvo = iBook;
			topInfo[2].hvo = book.Hvo;

			// Setup the end
			SelLevInfo[] bottomInfo = new SelLevInfo[3];
			for(int i = 0; i < 3; i++)
				bottomInfo[i] = topInfo[i];

			fakeSelHelper.SetupResult("LevelInfo", topInfo);
			fakeSelHelper.SetupResult("IchAnchor", ichStart);
			fakeSelHelper.SetupResult("IchEnd", ichEnd);
			fakeSelHelper.SetupResultForParams("GetLevelInfo", topInfo,
				SelectionHelper.SelLimitType.Top);
			fakeSelHelper.SetupResultForParams("GetLevelInfo", topInfo,
				SelectionHelper.SelLimitType.Anchor);
			fakeSelHelper.SetupResultForParams("GetLevelInfo", bottomInfo,
				SelectionHelper.SelLimitType.Bottom);
			fakeSelHelper.SetupResultForParams("GetLevelInfo", bottomInfo,
				SelectionHelper.SelLimitType.End);
			fakeSelHelper.SetupResultForParams("GetIch", ichStart,
				SelectionHelper.SelLimitType.Top);
			fakeSelHelper.SetupResultForParams("GetIch", ichEnd,
				SelectionHelper.SelLimitType.Bottom);
			m_currentSelection = (SelectionHelper)fakeSelHelper.MockInstance;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:55,代码来源:FootnoteEditingHelperTests.cs

示例4: MakeInnerLevelForFreeformSelection

		/// <summary>
		/// Sets up the tags for the 0 level of a selection of a free translation or note.
		/// This will be the level "inside" the ones that select the paragraph and segment.
		/// For a note, we need to select the first note.
		/// For a free translation, we need to insert the level for the 'self' property
		/// which the VC inserts to isolate the free translations and make it easier to update them.
		/// </summary>
		/// <param name="tagTextProp">The segment or note tag of an annotation to be selected.</param>
		private SelLevInfo MakeInnerLevelForFreeformSelection(int tagTextProp)
		{
			var noteLevel = new SelLevInfo();
			noteLevel.ihvo = 0;
			if (tagTextProp == NoteTags.kflidContent)
			{
				noteLevel.tag = SegmentTags.kflidNotes;
			}
			else
			{
				noteLevel.tag = Cache.MetaDataCacheAccessor.GetFieldId2(CmObjectTags.kClassId, "Self", false);
			}
			return noteLevel;
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:22,代码来源:InterlinDocForAnalysis.cs

示例5: SelectFirstTranslationOrNote

		/// <summary>
		/// Select the first non-null translation or note in the current segment
		/// of the current analysis occurance.
		/// </summary>
		/// <returns>true if successful, false if there is no real translation or note</returns>
		internal bool SelectFirstTranslationOrNote()
		{
			int ws;
			int annotationFlid = GetFirstVisibleTranslationOrNoteFlid(SelectedOccurrence.Segment, out ws);
			if (annotationFlid == 0) return false;
			var sel = MakeSandboxSel();
			int clev = sel.CLevels(true);
			clev--; // result it returns is one more than what the AllTextSelInfo routine wants.
			SelLevInfo[] rgvsli;
			using (ArrayPtr rgvsliTemp = MarshalEx.ArrayToNative<SelLevInfo>(clev))
			{
				int ihvoRoot;
				int cpropPrevious;
				int ichAnchor;
				int ichEnd;
				int ihvoEnd1;
				int tag, ws1;
				bool fAssocPrev;
				ITsTextProps ttp;
				sel.AllTextSelInfo(out ihvoRoot, clev, rgvsliTemp, out tag, out cpropPrevious,
								   out ichAnchor, out ichEnd, out ws1, out fAssocPrev, out ihvoEnd1, out ttp);
				rgvsli = MarshalEx.NativeToArray<SelLevInfo>(rgvsliTemp, clev);
			}
			// What non-word "choice" ie., translation text or note is on this line?
			int tagTextProp = ConvertTranslationOrNoteFlidToSegmentFlid(annotationFlid, SelectedOccurrence.Segment, ws);
			int levels;
			SelLevInfo noteLevel = MakeInnerLevelForFreeformSelection(tagTextProp);
			var vsli = new SelLevInfo[3];
			vsli[0] = noteLevel; // note or translation line
			vsli[1] = rgvsli[0]; // segment
			vsli[2] = rgvsli[1]; // para
			int cPropPrevious = 0; // todo: other if not the first WS for tagTextProp
			TryHideFocusBoxAndUninstall();
			RootBox.MakeTextSelection(0, vsli.Length, vsli, tagTextProp, cPropPrevious,
									  0, 0, 0, false, -1, null, true);
			Focus();
			return true;
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:43,代码来源:InterlinDocForAnalysis.cs

示例6: GetCurrentSelection

		/// <summary>
		/// Gets the current selection and returns enough data to move the IP.
		/// </summary>
		/// <param name="clev">The number of levels of selection range results.</param>
		/// <param name="rgvsli">The selection range with clev levels of structure.</param>
		/// <param name="tag">The property of the bottom-level [0] object that is of interest.</param>
		/// <param name="ichAnchor">The start index of the text selection.</param>
		/// <param name="ichEnd">The end index of the text selection.</param>
		/// <param name="ws">Index of the writing system of the selection.</param>
		/// <returns>true if a selection was made, false if something prevented it.</returns>
		private bool GetCurrentSelection(out int clev, out SelLevInfo[] rgvsli, out int tag, out int ichAnchor, out int ichEnd, out int ws)
		{
			clev = -1;
			rgvsli = null;
			tag = -1;
			ichAnchor = -1;
			ichEnd = -1;
			ws = -1;
			var sel = EditingHelper.RootBoxSelection;
			if (sel == null)
				return false;
			// which "line choice" is active in this segment?
			if (sel.SelType != VwSelType.kstText || !sel.IsValid || !sel.IsEditable)
				return false;
			clev = sel.CLevels(true);
			ITsTextProps ttp;
			using (ArrayPtr rgvsliTemp = MarshalEx.ArrayToNative<SelLevInfo>(clev))
			{
				int ihvoRoot;
				int ihvoEnd1;
				int cpropPrevious;
				bool fAssocPrev;
				sel.AllTextSelInfo(out ihvoRoot, clev, rgvsliTemp, out tag, out cpropPrevious,
								   out ichAnchor, out ichEnd, out ws, out fAssocPrev, out ihvoEnd1, out ttp);
				rgvsli = MarshalEx.NativeToArray<SelLevInfo>(rgvsliTemp, clev);
			}
			return true;
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:38,代码来源:InterlinDocForAnalysis.cs

示例7: SelectionChanged

		public override void SelectionChanged(IVwRootBox rootb, IVwSelection vwselNew)
		{
			CheckDisposed();
			if (vwselNew == null)
				return;
			bool hasFoc = Focused;

			base.SelectionChanged(rootb, vwselNew);

			ITsString tss;
			int ichAnchor;
			bool fAssocPrev;
			int hvoObj;
			int tag;
			int ws; // NB: This will be 0 after each call, since the string does
			// not have alternatives. Ws would be the WS of an alternative,
			// if there were any.
			vwselNew.TextSelInfo(false, out tss, out ichAnchor, out fAssocPrev, out hvoObj,
				out tag, out ws);

			int ichEnd;
			int hvoObjEnd;
			vwselNew.TextSelInfo(true, out tss, out ichEnd, out fAssocPrev, out hvoObjEnd,
				out tag, out ws);

			if (hvoObjEnd != hvoObj)
			{
				CheckHeight();
				return;
			}
			if (m_hvoOldSelection > 0 && hvoObj != m_hvoOldSelection)
			{
				// Try to validate previously selected string rep.
				if (m_silCache.get_StringProp(m_hvoOldSelection, kEnvStringRep).Length==0)
				{
					// Remove it from the dummy cache, since its length is 0.
					int limit = m_silCache.get_VecSize(m_rootObj.Hvo, kMainObjEnvironments);
					for (int i = 0; i < limit; ++i)
					{
						if (m_hvoOldSelection ==
							m_silCache.get_VecItem(m_rootObj.Hvo, kMainObjEnvironments, i))
						{
							RemoveFromDummyCache(i);
							break;
						}
					}
				}
				else // Validate previously selected string rep.
				{
					ValidateStringRep(m_hvoOldSelection);
				}
			}
			if (hvoObj != kDummyPhoneEnvID)
			{
				m_hvoOldSelection = hvoObj;
				CheckHeight();
				return;
			}
			if (tss.Length == 0)
			{
				CheckHeight();
				return;
			}
			// Create a new object, and recreate a new empty object. Make this part of the Undo
			// Task with the character we typed.
			m_silCache.GetActionHandler().ContinueUndoTask();
			int count = m_silCache.get_VecSize(m_rootObj.Hvo, kMainObjEnvironments);
			int hvoNew = InsertNewEnv(count - 1);
			m_silCache.SetString(hvoNew, kEnvStringRep, tss);
			m_silCache.SetString(kDummyPhoneEnvID, kEnvStringRep, DummyString);
			m_silCache.EndUndoTask();
			// Refresh
			m_silCache.PropChanged(null, (int)PropChangeType.kpctNotifyAll,
				m_rootObj.Hvo, kMainObjEnvironments, count - 1, 2, 1);

			// Reset selection.
			SelLevInfo[] rgvsli = new SelLevInfo[1];
			rgvsli[0].cpropPrevious = 0;
			rgvsli[0].tag = kMainObjEnvironments;
			rgvsli[0].ihvo = count - 1;
			m_rootb.MakeTextSelection(0, rgvsli.Length, rgvsli, tag, 0, ichAnchor, ichEnd, ws,
				fAssocPrev, -1, null, true);

			m_hvoOldSelection = hvoNew;
			CheckHeight();
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:86,代码来源:PhoneEnvReferenceView.cs

示例8: MakeSelInObj

		public IVwSelection MakeSelInObj(int ihvoRoot, int cvsli, SelLevInfo[] _rgvsli, int tag,
			bool fInstall)
		{
			throw new NotImplementedException();
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:5,代码来源:IbusRootSiteEventHandlerTests.cs

示例9: MakeTextSelection

		public IVwSelection MakeTextSelection(int ihvoRoot, int cvlsi, SelLevInfo[] _rgvsli,
			int tagTextProp, int cpropPrevious, int ichAnchor, int ichEnd, int ws, bool fAssocPrev,
			int ihvoEnd, ITsTextProps _ttpIns, bool fInstall)
		{
			return new DummyVwSelection(this, ichAnchor, ichEnd);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:6,代码来源:IbusRootSiteEventHandlerTests.cs

示例10: GetLevelInfo

		protected override SelLevInfo[] GetLevelInfo(int cellId, int cellIndex)
		{
			SelLevInfo[] levels = null;
			switch (cellId)
			{
				case AffixRuleFormulaVc.ktagLeftEmpty:
				case AffixRuleFormulaVc.ktagRightEmpty:
					break;

				case MoAffixProcessTags.kflidOutput:
					if (cellIndex >= 0)
					{
						levels = new SelLevInfo[1];
						levels[0].tag = cellId;
						levels[0].ihvo = cellIndex;
					}
					break;

				default:
					var ctxtOrVar = m_cache.ServiceLocator.GetInstance<IPhContextOrVarRepository>().GetObject(cellId);
					if (cellIndex < 0 || ctxtOrVar.ClassID != PhSequenceContextTags.kClassId)
					{
						levels = new SelLevInfo[1];
						levels[0].tag = MoAffixProcessTags.kflidInput;
						levels[0].ihvo = ctxtOrVar.IndexInOwner;
					}
					else
					{
						levels = new SelLevInfo[2];
						levels[0].tag = PhSequenceContextTags.kflidMembers;
						levels[0].ihvo = cellIndex;
						levels[1].tag = MoAffixProcessTags.kflidInput;
						levels[1].ihvo = ctxtOrVar.IndexInOwner;
					}
					break;

			}
			return levels;
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:39,代码来源:AffixRuleFormulaControl.cs

示例11: MakeSel

			/// <summary>
			/// Reestablish a selection, if possible.
			/// </summary>
			public void MakeSel()
			{
				if (m_tagSel == -1)
					return;
				int clev = 2; // typically two level
				if (m_tagSel != ktagSbNamedObjName)
					clev--; // prefix and postfix are one level less embedded
				SelLevInfo[] rgsli = new SelLevInfo[clev];
				// The selection is in the morphemes of the root object
				rgsli[clev - 1].ihvo = m_ihvoSelMorph;
				rgsli[clev - 1].tag = ktagSbWordMorphs;
				if (clev > 1)
					rgsli[0].tag = ktagSbMorphForm; // leave other slots zero
				try
				{
					m_sandbox.RootBox.MakeTextSelection(
						m_sandbox.IndexOfCurrentItem, // which root,
						clev, rgsli,
						m_tagSel,
						0, // no previous occurrence
						m_ichSelOutput, m_ichSelOutput, m_wsVern,
						false, // needs to be false here to associate with trailing character
						// esp. for when the cursor is at the beginning of the morpheme (LT-7773)
						-1, // end not in different object
						null, // no special props to use for typing
						true); // install it.
				}
				catch (Exception)
				{
					// Ignore anything that goes wrong making a selection. At worst we just don't have one.
				}
			}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:35,代码来源:SandboxBase.MorphemeBreaker.cs

示例12: GetParagraphProps

		public void GetParagraphProps()
		{
			CheckDisposed();

			// we want more paragraphs with different Hvos
			MakeEnglishParagraphs();

			ShowForm(Lng.English, DummyBasicViewVc.DisplayType.kNormal);
			IVwRootBox rootBox = m_basicView.RootBox;
			IVwSelection vwsel;
			int hvoText, tagText, ihvoFirst, ihvoLast;
			IVwPropertyStore[] vqvps;
			ITsTextProps[] vqttp;

			// Test 1: selection in one paragraph
			rootBox.MakeSimpleSel(false, true, false, true);
			IVwSelection sel = rootBox.Selection;
			ITsString tss;
			int ich, hvoObj, tag, ws;
			bool fAssocPrev;
			sel.TextSelInfo(true, out tss, out ich, out fAssocPrev, out hvoObj, out tag, out ws);
			int clev = sel.CLevels(true);
			clev--; // result it returns is one more than what the AllTextSelInfo routine wants.
			int ihvoRoot;
			int cpropPrevious;
			int ichAnchor;
			int ichEnd;
			int ihvoEnd1;
			ITsTextProps ttp;
			using (ArrayPtr rgvsliTemp = MarshalEx.ArrayToNative(clev, typeof(SelLevInfo)))
			{
				sel.AllTextSelInfo(out ihvoRoot, clev, rgvsliTemp, out tag, out cpropPrevious,
					out ichAnchor, out ichEnd, out ws, out fAssocPrev, out ihvoEnd1, out ttp);
				SelLevInfo[] rgvsli = (SelLevInfo[])MarshalEx.NativeToArray(rgvsliTemp, clev,
					typeof(SelLevInfo));
				int ichInsert = 0;
				rootBox.MakeTextSelection(ihvoRoot, clev, rgvsli, tag, cpropPrevious, ichInsert,
					ichInsert + 5, ws, fAssocPrev, ihvoEnd1, ttp, true);

				bool fRet = m_basicView.GetParagraphProps(out vwsel, out hvoText, out tagText,
					out vqvps, out ihvoFirst, out ihvoLast, out vqttp);

				Assert.IsTrue(fRet, "Test 1 ");
				Assert.AreEqual(ihvoFirst, ihvoLast, "Test 1 ");
				Assert.AreEqual(1, vqttp.Length, "Test 1 ");

				// Test 2: selection across two sections
				SelLevInfo[] rgvsliEnd = new SelLevInfo[clev];
				rgvsli.CopyTo(rgvsliEnd, 0);
				rgvsli[0].ihvo = 0; // first paragraph
				rgvsli[clev-1].ihvo = 2; // third section
				rootBox.MakeTextSelInObj(ihvoRoot, clev, rgvsli, clev, rgvsliEnd, false, true, true, true,
					true);

				fRet = m_basicView.GetParagraphProps(out vwsel, out hvoText, out tagText,
					out vqvps, out ihvoFirst, out ihvoLast, out vqttp);

				Assert.IsFalse(fRet, "Test 2 ");
			}
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:60,代码来源:MoreRootSiteTests.cs

示例13: LoseFocusToView_RangeSel_FlagSet

		public void LoseFocusToView_RangeSel_FlagSet()
		{
			CheckDisposed();

			ShowForm(Lng.English, DummyBasicViewVc.DisplayType.kNormal);

			IVwRootBox rootBox = m_basicView.RootBox;
			rootBox.Activate(VwSelectionState.vssEnabled);
			m_basicView.ShowRangeSelAfterLostFocus = true;

			// Select the first four characters in the first paragraph
			SelLevInfo[] levelInfo = new SelLevInfo[2];
			levelInfo[1].tag = m_flidContainingTexts;
			levelInfo[1].cpropPrevious = 0;
			levelInfo[1].ihvo = 0;
			levelInfo[0].tag = (int)StText.StTextTags.kflidParagraphs;
			levelInfo[0].cpropPrevious = 0;
			levelInfo[0].ihvo = 0;
			rootBox.MakeTextSelection(0, 2, levelInfo,
				(int)StTxtPara.StTxtParaTags.kflidContents, 0, 0, 3, 0, true, 0, null, true);

			// Lets pretend we a different view gets the focus (although it's the same)
			m_basicView.KillFocus(m_basicView);

			Assert.IsTrue(rootBox.Selection.IsEnabled,
				"Selection should still be enabled if the ShowRangeSelAfterLostFocus flag is set");
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:27,代码来源:MoreRootSiteTests.cs

示例14: LoseFocusToNonView_RangeSel

		public void LoseFocusToNonView_RangeSel()
		{
			CheckDisposed();

			ShowForm(Lng.English, DummyBasicViewVc.DisplayType.kNormal);

			IVwRootBox rootBox = m_basicView.RootBox;
			rootBox.Activate(VwSelectionState.vssEnabled);

			// Select the first four characters in the first paragraph
			SelLevInfo[] levelInfo = new SelLevInfo[2];
			levelInfo[1].tag = m_flidContainingTexts;
			levelInfo[1].cpropPrevious = 0;
			levelInfo[1].ihvo = 0;
			levelInfo[0].tag = (int)StText.StTextTags.kflidParagraphs;
			levelInfo[0].cpropPrevious = 0;
			levelInfo[0].ihvo = 0;
			rootBox.MakeTextSelection(0, 2, levelInfo,
				(int)StTxtPara.StTxtParaTags.kflidContents, 0, 0, 3, 0, true, 0, null, true);

			// We have to set up a form that contains the view and the control that we pretend
			// gets focus.
			using (Form parentForm = new Form())
			using (Control control = new Control())
			{
				m_basicView.Parent = parentForm;
				control.Parent = parentForm;
				// Lets pretend we a non-view gets the focus (although it's the same)
				m_basicView.KillFocus(control);

				Assert.IsTrue(rootBox.Selection.IsEnabled,
					"Selection should still be enabled if non-view window got focus");
			}
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:34,代码来源:MoreRootSiteTests.cs

示例15: MergeBTsWhenParasMerge_FromMiddleOfPara1ToMiddleOfPara2_aKey

		public void MergeBTsWhenParasMerge_FromMiddleOfPara1ToMiddleOfPara2_aKey()
		{
			CheckDisposed();

			ShowForm(Lng.English, DummyBasicViewVc.DisplayType.kNormal);

			IVwRootBox rootBox = m_basicView.RootBox;

			// Add a second paragraph to the first text and create some Back Translations on
			// both paragraphs
			ScrBook book = new ScrBook(Cache, m_hvoRoot);
			StText text1 = (StText)book.FootnotesOS[0];
			StTxtPara para1 = (StTxtPara)text1.ParagraphsOS[0];
			StTxtPara para2 = m_scrInMemoryCache.AddParaToMockedText(text1.Hvo, string.Empty);
			m_scrInMemoryCache.AddRunToMockedPara(para2, DummyBasicView.kSecondParaEng, m_wsEng);
			// We'll just re-use our "vernacular" WS for the back translation, for testing purposes.
			ICmTranslation trans1 = m_inMemoryCache.AddBtToMockedParagraph(para1, m_wsEng);
			m_inMemoryCache.AddRunToMockedTrans(trans1, m_wsEng, "BT1", null);
			ICmTranslation trans2 = m_inMemoryCache.AddBtToMockedParagraph(para2, m_wsEng);
			m_inMemoryCache.AddRunToMockedTrans(trans2, m_wsEng, "BT2", null);

			Cache.PropChanged(null, PropChangeType.kpctNotifyAll, text1.Hvo,
				(int)StText.StTextTags.kflidParagraphs, 1, 1, 0);

			// Make a selection from the end of first paragraph to the beginning of the second.
			SelLevInfo[] levelInfo = new SelLevInfo[2];
			levelInfo[1].tag = m_flidContainingTexts;
			levelInfo[1].cpropPrevious = 0;
			levelInfo[1].ihvo = 0;
			levelInfo[0].tag = (int)StText.StTextTags.kflidParagraphs;
			levelInfo[0].cpropPrevious = 0;
			levelInfo[0].ihvo = 0;
			int ichAnchor = DummyBasicView.kFirstParaEng.Length - 2;
			int ichEnd = 2;
			rootBox.MakeTextSelection(0, 2, levelInfo,
				(int)StTxtPara.StTxtParaTags.kflidContents, 0, ichAnchor, ichEnd, 0, true, 1, null,
				true);
			TypeChar('a');

			Assert.AreEqual(DummyBasicView.kFirstParaEng.Substring(0, ichAnchor) + "a" +
				DummyBasicView.kSecondParaEng.Substring(ichEnd), para1.Contents.Text);
			Assert.AreEqual("BT1 BT2", trans1.Translation.GetAlternative(m_wsEng).Text);
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:43,代码来源:MoreRootSiteTests.cs


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