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


C# IVwEnv.AddObjVec方法代码示例

本文整理汇总了C#中IVwEnv.AddObjVec方法的典型用法代码示例。如果您正苦于以下问题:C# IVwEnv.AddObjVec方法的具体用法?C# IVwEnv.AddObjVec怎么用?C# IVwEnv.AddObjVec使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IVwEnv的用法示例。


在下文中一共展示了IVwEnv.AddObjVec方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Display

		/// -----------------------------------------------------------------------------------
		/// <summary>
		/// This is the main interesting method of displaying objects and fragments of them.
		/// </summary>
		/// <param name="vwenv"></param>
		/// <param name="hvo"></param>
		/// <param name="frag"></param>
		/// -----------------------------------------------------------------------------------
		public override void Display(IVwEnv vwenv, int hvo, int frag)
		{
			CheckDisposed();

			switch(frag)
			{
				case kfragRoot:
					ITsString tssWord = vwenv.DataAccess.get_StringProp(hvo, ktagCf);
					ITsStrBldr tsbSdRelation = m_tssSdRelation.GetBldr();
					ITsStrBldr tsbLexRel = m_tssLexRelation.GetBldr();
					if (tssWord != null && tssWord.Length > 0)
					{
						int ich = tsbSdRelation.Text.IndexOf("{0}");
						if (ich >= 0)
							tsbSdRelation.ReplaceTsString(ich, ich + 3, tssWord);
						ich = tsbLexRel.Text.IndexOf("{0}");
						if (ich >= 0)
							tsbLexRel.ReplaceTsString(ich, ich + 3, tssWord);
					}
					int cDomains = vwenv.DataAccess.get_VecSize(hvo, ktagDomains);
					int cLexRels = vwenv.DataAccess.get_VecSize(hvo, ktagLexRels);
					Debug.Assert(cDomains > 0 || cLexRels > 0);
					if (cDomains > 0)
					{
						vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
							(int)FwTextPropVar.ktpvEnum,
							(int)TptEditable.ktptNotEditable);
						vwenv.set_IntProperty((int)FwTextPropType.ktptMarginBottom,
							(int)FwTextPropVar.ktpvMilliPoint,
							6000);
						vwenv.OpenParagraph();
						vwenv.AddString(tsbSdRelation.GetString());
						vwenv.CloseParagraph();
						vwenv.AddLazyVecItems(ktagDomains, this, kfragEntryList);
					}
					if (cLexRels > 0)
					{
						vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
							(int)FwTextPropVar.ktpvEnum,
							(int)TptEditable.ktptNotEditable);
						vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTop,
							(int)FwTextPropVar.ktpvMilliPoint, 6000);
						vwenv.set_IntProperty((int)FwTextPropType.ktptMarginBottom,
							(int)FwTextPropVar.ktpvMilliPoint, 6000);
						vwenv.OpenParagraph();
						vwenv.AddString(tsbLexRel.GetString());
						vwenv.CloseParagraph();
						vwenv.AddLazyVecItems(ktagLexRels, this, kfragEntryList);
					}
					break;
				case kfragEntryList:
					vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
						(int)FwTextPropVar.ktpvEnum,
						(int)TptEditable.ktptNotEditable);
					vwenv.OpenParagraph();
					vwenv.set_IntProperty((int)FwTextPropType.ktptBold,
						(int)FwTextPropVar.ktpvEnum,
						(int)FwTextToggleVal.kttvForceOn);
					vwenv.AddStringProp(ktagName, this);
					vwenv.AddString (m_tssColon);
					vwenv.AddObjVec(ktagWords, this, kfragWords);
					vwenv.CloseParagraph();
					break;
				case kfragName:
					vwenv.AddStringProp(ktagName, this);
					break;
				default:
					throw new Exception("bad case in RelatedWordsVc.Display");
			}
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:78,代码来源:RelatedWords.cs

示例2: Display

			public override void Display(IVwEnv vwenv, int hvo, int frag)
			{
				CheckDisposed();

				ISilDataAccess da = vwenv.DataAccess;
				switch (frag)
				{
					default:
					{
						Debug.Assert(false, "Unrecognized fragment.");
						break;
					}
					case ReversalIndexEntrySliceView.kFragMainObject:
					{
						// The hvo here is for the sense.

						// We use a table to display
						// encodings in column one and the strings in column two.
						// The table uses 100% of the available width.
						VwLength vlTable;
						vlTable.nVal = 10000;
						vlTable.unit = VwUnit.kunPercent100;
						// The width of the writing system column is determined from the width of the
						// longest one which will be displayed.
						int dxs;	// Width of displayed string.
						int dys;	// Height of displayed string (not used here).
						int dxsMax = 0;	// Max width required.
						ISilDataAccess silDaCache = vwenv.DataAccess;
						IVwCacheDa vwCache = silDaCache as IVwCacheDa;
						foreach (IReversalIndex idx in m_usedIndices)
						{
							vwenv.get_StringWidth(silDaCache.get_StringProp(idx.WritingSystemRAHvo, (int)LgWritingSystem.LgWritingSystemTags.kflidAbbr),
								m_ttpLabel,
								out dxs,
								out dys);
							dxsMax = Math.Max(dxsMax, dxs);
						}
						VwLength vlColWs; // 5-pt space plus max label width.
						vlColWs.nVal = dxsMax + 5000;
						vlColWs.unit = VwUnit.kunPoint1000;
						// Enhance JohnT: possibly allow for right-to-left UI by reversing columns?
						// The Main column is relative and uses the rest of the space.
						VwLength vlColMain;
						vlColMain.nVal = 1;
						vlColMain.unit = VwUnit.kunRelative;

						vwenv.OpenTable(2, // Two columns.
							vlTable, // Table uses 100% of available width.
							0, // Border thickness.
							VwAlignment.kvaLeft, // Default alignment.
							VwFramePosition.kvfpVoid, // No border.
							VwRule.kvrlNone, // No rules between cells.
							0, // No forced space between cells.
							0, // No padding inside cells.
							false);
						// Specify column widths. The first argument is the number of columns,
						// not a column index. The writing system column only occurs at all if its
						// width is non-zero.
						vwenv.MakeColumns(1, vlColWs);
						vwenv.MakeColumns(1, vlColMain);

						vwenv.OpenTableBody();
						// Do vector of rows. Each row essentially is a reversal index, but shows other information.
						vwenv.AddObjVec(ReversalIndexEntrySliceView.kFlidIndices, this, ReversalIndexEntrySliceView.kFragIndices);
						vwenv.CloseTableBody();
						vwenv.CloseTable();
						break;
					}
					case ReversalIndexEntrySliceView.kFragIndexMain:
					{
						// First cell has writing system abbreviation displayed using m_ttpLabel.
						int wsHvo = 0;
						foreach (ReversalIndex idx in m_usedIndices)
						{
							if (idx.Hvo == hvo)
							{
								wsHvo = idx.WritingSystemRAHvo;
								break;
							}
						}
						Debug.Assert(wsHvo > 0, "Could not find writing system.");

						int wsOldDefault = this.DefaultWs;
						this.DefaultWs = wsHvo;

						// Cell 1 shows the ws abbreviation.
						vwenv.OpenTableCell(1,1);
						vwenv.Props = m_ttpLabel;
						vwenv.AddObj(wsHvo, this, ReversalIndexEntrySliceView.kFragWsAbbr);
						vwenv.CloseTableCell();

						// Second cell has the contents for the reversal entries.
						vwenv.OpenTableCell(1,1);
						// This displays the field flush right for RTL data, but gets arrow keys to
						// behave reasonably.  See comments on LT-5287.
						IWritingSystem lgws = m_cache.LanguageWritingSystemFactoryAccessor.get_EngineOrNull(this.DefaultWs);
						if (lgws != null && lgws.RightToLeft)
						{
							vwenv.set_IntProperty((int)FwTextPropType.ktptRightToLeft,
								(int)FwTextPropVar.ktpvEnum, (int)FwTextToggleVal.kttvForceOn);
//.........这里部分代码省略.........
开发者ID:sillsdev,项目名称:WorldPad,代码行数:101,代码来源:ReversalIndexEntrySlice.cs

示例3: Display

			public override void Display(IVwEnv vwenv, int hvo, int frag)
			{
				CheckDisposed();
				switch (frag)
				{
				case PhoneEnvReferenceView.kFragEnvironmentObj:
					vwenv.AddStringProp(PhoneEnvReferenceView.kEnvStringRep, this);
					break;
				case PhoneEnvReferenceView.kFragEnvironments:
					vwenv.OpenParagraph();
					vwenv.AddObjVec(PhoneEnvReferenceView.kMainObjEnvironments, this, frag);
					vwenv.CloseParagraph();
					break;
					//case PhoneEnvReferenceView.kFragAnnotation:
					//	break;
				default:
					throw new ArgumentException(
						"Don't know what to do with the given frag.", "frag");
				}
			}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:20,代码来源:PhoneEnvReferenceView.cs

示例4: Display

		public override void Display(IVwEnv vwenv, int hvo, int frag)
		{
#if __MonoCS__
		// TODO-Linux: Randomly m_tsf seem to have been Release.
		// eg Marshal.ReleaseComObject(m_tsf);
		// However the Dispose method isn't called (which calls the Release)
		// Currently unsure what is doing this need to find out - very concerning
		// Hack - just recreate a new TsStrFactory each time... for now
		// seems to stop the problem.
		m_tsf = TsStrFactoryClass.Create();
#endif
			CheckDisposed();
			if (hvo == 0)
				return;		// Can't do anything without an hvo (except crash -- see LT-9348).

#if DEBUG
			//TimeRecorder.Begin("Display");
#endif
			switch (frag)
			{
			case kfragStText:	// new root object for InterlinDocChild.
				SetupRealVernWsForDisplay(WritingSystemServices.ActualWs(m_cache, WritingSystemServices.kwsVernInParagraph,
					hvo, StTextTags.kflidParagraphs));
				vwenv.AddLazyVecItems(StTextTags.kflidParagraphs, this, kfragInterlinPara);
				break;
			case kfragInterlinPara: // Whole StTxtPara. This can be the root fragment in DE view.
				if (vwenv.DataAccess.get_VecSize(hvo, StTxtParaTags.kflidSegments) == 0)
				{
					vwenv.NoteDependency(new int[] { hvo }, new int[] { StTxtParaTags.kflidSegments }, 1);
					vwenv.AddString(m_tssEmptyPara);
				}
				else
				{
					PreferredVernWs = WritingSystemServices.ActualWs(m_cache, WritingSystemServices.kwsVernInParagraph, hvo, StTxtParaTags.kflidSegments);
					// Include the plain text version of the paragraph?
					vwenv.AddLazyVecItems(StTxtParaTags.kflidSegments, this, kfragParaSegment);
				}
				break;
			case kfragParaSegment:
				// Don't put anything in this segment if it is a 'label' segment (typically containing a verse
				// number for TE).
				var seg = m_segRepository.GetObject(hvo);
				if (seg.IsLabel)
					break;
				// This puts ten points between segments. There's always 5 points below each line of interlinear;
				// if there are no freeform annotations another 5 points makes 10 between segments.
				// If there are freeforms, we need the full 10 points after the last of them.
				var haveFreeform = seg.FreeTranslation != null || seg.LiteralTranslation != null || seg.NotesOS.Count > 0;
				vwenv.set_IntProperty((int)FwTextPropType.ktptMarginBottom,
					(int)FwTextPropVar.ktpvMilliPoint, !haveFreeform ? 5000 : 10000);
				vwenv.OpenDiv();
				// Enhance JohnT: determine what the overall direction of the paragraph should
				// be and set it.
				if (m_mpBundleHeight == 0)
				{
					// First time...figure it out.
					int dmpx, dmpyAnal, dmpyVern;
					vwenv.get_StringWidth(m_tssEmptyAnalysis, null, out dmpx, out dmpyAnal);
					vwenv.get_StringWidth(m_tssEmptyVern, null, out dmpx, out dmpyVern);
					m_mpBundleHeight = dmpyAnal * 4 + dmpyVern * 3;
				}
				// The interlinear bundles are not editable.
				vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
					(int)FwTextPropVar.ktpvEnum, (int)TptEditable.ktptNotEditable);
				if (m_fRtl)
				{
					vwenv.set_IntProperty((int)FwTextPropType.ktptRightToLeft,
						(int)FwTextPropVar.ktpvEnum, (int)FwTextToggleVal.kttvForceOn);
					vwenv.set_IntProperty((int)FwTextPropType.ktptAlign,
						(int)FwTextPropVar.ktpvEnum, (int) FwTextAlign.ktalRight);
				}
				vwenv.set_IntProperty((int)FwTextPropType.ktptSpellCheck, (int)FwTextPropVar.ktpvEnum,
					(int)SpellingModes.ksmDoNotCheck);
				vwenv.OpenParagraph();
				AddSegmentReference(vwenv, hvo);	// Calculate and display the segment reference.
				AddLabelPile(vwenv, m_tsf, m_cache, true, m_fShowMorphBundles);
				vwenv.AddObjVecItems(SegmentTags.kflidAnalyses, this, kfragBundle);
				// JohnT, 1 Feb 2008. Took this out as I can see no reason for it; AddObjVecItems handles
				// the dependency already. Adding it just means that any change to the forms list
				// regenerates a higher level than needed, which contributes to a great deal of scrolling
				// and flashing (LT-7470).
				// Originally added by Eric in revision 72 on the trunk as part of handling phrases.
				// Eric can't see any reason we need it now, either. If you find a need to re-insert it,
				// please document carefully the reasons it is needed and what bad consequences follow
				// from removing it.
				//vwenv.NoteDependency(new int[] { hvo }, new int[] { ktagSegmentForms }, 1);
				vwenv.CloseParagraph();
				// We'd get the same visual effect from just calling AddFreeformAnnotations here. But then a regenerate
				// such as happens when hiding or showing a prompt has to redisplay the whole segment. This initially
				// makes it lazy, then the lazy stuff gets expanded. In the process we may get undesired scrolling (LT-12248).
				// So we insert another layer of object, allowing just the freeforms to be regenerated.
				var flidSelf = Cache.MetaDataCacheAccessor.GetFieldId2(CmObjectTags.kClassId, "Self", false);
				vwenv.AddObjProp(flidSelf, this, kfragFreeformBundle);
				vwenv.CloseDiv();
				break;
			case kfragFreeformBundle:
				AddFreeformAnnotations(vwenv, hvo);
				break;
			case kfragBundle: // One annotated word bundle; hvo is the IAnalysis object.
				// checking AllowLayout (especially in context of Undo/Redo make/break phrase)
//.........这里部分代码省略.........
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:101,代码来源:InterlinVc.cs

示例5: Display

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// This is the main interesting method of displaying objects and fragments of them.
		/// Scripture Footnotes are displayed by displaying each footnote's reference and text.
		/// The text is displayed using the standard view constructor for StText.
		/// </summary>
		/// <param name="vwenv"></param>
		/// <param name="hvo"></param>
		/// <param name="frag"></param>
		/// ------------------------------------------------------------------------------------
		public override void Display(IVwEnv vwenv, int hvo, int frag)
		{
			CheckDisposed();

			switch (frag)
			{
				case (int)FootnoteFrags.kfrScripture:
				{
					vwenv.NoteDependency(new int[] { m_cache.LangProject.TranslatedScriptureOAHvo },
						new int[] { (int)Scripture.ScriptureTags.kflidScriptureBooks }, 1);
					vwenv.AddLazyVecItems(BooksTag, this, (int)FootnoteFrags.kfrBook);
					break;
				}
				case (int)FootnoteFrags.kfrRootInPageSeq:
				{
					int tag = DummyVirtualHandler.InstallDummyHandler(m_cache.VwCacheDaAccessor,
						"Scripture", "FootnotesOnPage",
						(int)CellarModuleDefns.kcptReferenceSequence).Tag;
					// Get the list of footnotes to display
					int[] hvos = m_cache.GetVectorProperty(hvo, tag, true);
					if (hvos.Length > 0)
					{
						int ownerHvo = m_cache.GetOwnerOfObject(hvos[0]);
						// The ownerHvo should be the HVO of the book
						vwenv.NoteDependency(new int[] { ownerHvo },
							new int[] { (int)ScrBook.ScrBookTags.kflidFootnotes }, 1);
					}
					vwenv.AddObjVec(tag, this, (int)FootnoteFrags.kfrAllFootnotesWithinPagePara);
					break;
				}
				case (int)FootnoteFrags.kfrFootnoteWithinPagePara:
				{
					// Note a dependency on the footnote options so that the footnote will
					// be refreshed when these are changed.
					int[] depHvos = { hvo };
					int[] depTags = { StFootnote.ktagFootnoteOptions };
					vwenv.NoteDependency(depHvos, depTags, 1);

					// Insert the marker and reference
					vwenv.AddObj(hvo, this, (int)StTextFrags.kfrFootnoteMarker);
					vwenv.AddObj(hvo,  this,(int)StTextFrags.kfrFootnoteReference);

					// Insert (we hope only one) paragraph contents.
					vwenv.AddObjVecItems((int)StText.StTextTags.kflidParagraphs, this,
						(int)FootnoteFrags.kfrFootnoteParaWithinPagePara);
					break;
				}
				case (int) FootnoteFrags.kfrFootnoteParaWithinPagePara:
				{
					if (!InsertParaContentsUserPrompt(vwenv, hvo))
					{
						// Display the text paragraph contents, or its user prompt.
						vwenv.AddStringProp((int)StTxtPara.StTxtParaTags.kflidContents, null);
					}
					break;
				}
				case (int)FootnoteFrags.kfrBook:
				{
					vwenv.OpenDiv();
					vwenv.AddObjVecItems((int)ScrBook.ScrBookTags.kflidFootnotes, this,
						(int)StTextFrags.kfrFootnote);
					vwenv.CloseDiv();
					break;
				}
				case (int)StTextFrags.kfrFootnoteMarker:
				{
					ScrFootnote footnote = new ScrFootnote(Cache, hvo);
					if (footnote.DisplayFootnoteMarker)
						DisplayFootnoteMarker(vwenv, footnote);
					break;
				}
				case (int)StTextFrags.kfrFootnoteReference:
				{
					ITsStrFactory tsStrFactory = TsStrFactoryClass.Create();
					ITsPropsFactory tpf = TsPropsFactoryClass.Create();
					ITsTextProps ttp = tpf.MakeProps(ScrStyleNames.FootnoteTargetRef, m_wsDefault, 0);

					ScrFootnote footnote = new ScrFootnote(m_cache, hvo);
					string footnoteRef = footnote.GetReference(m_wsDefault);
					ITsString tssRef = tsStrFactory.MakeStringWithPropsRgch(footnoteRef,
						footnoteRef.Length, ttp);
					vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
						(int)FwTextPropVar.ktpvEnum,
						(int)TptEditable.ktptNotEditable);
					vwenv.AddString(tssRef);
					break;
				}
				default:
					base.Display(vwenv, hvo, frag);
					break;
//.........这里部分代码省略.........
开发者ID:sillsdev,项目名称:WorldPad,代码行数:101,代码来源:FootnoteVc.cs

示例6: DisplayAnnotation

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Displays an annotation expanded or contracted
		/// </summary>
		/// <param name="vwenv"></param>
		/// <param name="ann"></param>
		/// <param name="expanded"></param>
		/// ------------------------------------------------------------------------------------
		private void DisplayAnnotation(IVwEnv vwenv, IScrScriptureNote ann, bool expanded)
		{
			#region First row has status, ref, category, & quote
			SetBackgroundColorForNote(ann, vwenv);

			OpenTableRow(vwenv, ann);

			// Display expand box (+/-) in the first cell
			//InsertNoteSeparator(vwenv);
			vwenv.OpenTableCell(1, 1);
			vwenv.AddObj(ann.Hvo, this, (int)NotesFrags.kfrExpansion);
			vwenv.CloseTableCell();

			// Display status in the second cell
			vwenv.OpenTableCell(1, 1);
			vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop,
				(int)FwTextPropVar.ktpvMilliPoint, 1000);

			if (ann.AnnotationType == NoteType.CheckingError)
			{
				// When the annotation is a checking error, we don't want clicking on the status
				// to change the status. Therefore, make the min and max the same.
				vwenv.AddIntPropPic((int)ScrScriptureNoteTags.kflidResolutionStatus,
					this, (int)NotesFrags.kfrStatus, 0, 0);
			}
			else
			{
				vwenv.AddIntPropPic((int)ScrScriptureNoteTags.kflidResolutionStatus,
					this, (int)NotesFrags.kfrStatus, (int)NoteStatus.Open, (int)NoteStatus.Closed);
			}
			vwenv.CloseTableCell();

			// Display reference in the third cell and make it readonly.
			vwenv.OpenTableCell(1, 1);
			vwenv.set_IntProperty((int)FwTextPropType.ktptEditable, (int)FwTextPropVar.ktpvDefault, 0);
			vwenv.OpenParagraph();
			vwenv.AddProp((int)CmBaseAnnotationTags.kflidBeginRef, this, (int)NotesFrags.kfrScrRef);
			vwenv.CloseParagraph();
			vwenv.CloseTableCell();

			// Display CONNOT category in the fourth (and possibly fifth and sixth) cell(s)
			vwenv.OpenTableCell(1, expanded ? 3 : 1);
			IStTxtPara quotePara = ann.QuoteOA[0];
			bool fQuoteParaRtoL = IsParaRightToLeft(quotePara);

			// Conc paragraphs don't work well for R-to-L: If the text doesn't fit, it will
			// show the trailing text rather than the leading text.
			if (fQuoteParaRtoL || expanded)
				vwenv.OpenParagraph();
			else
				vwenv.OpenConcPara(0, 0, 0, 0);
			vwenv.AddObjVec((int)ScrScriptureNoteTags.kflidCategories, this,
				(int)NotesFrags.kfrConnotCategory);
			vwenv.CloseParagraph();
			vwenv.CloseTableCell();

			// Display CONNOT category chooser button in the penultimate or last cell
			vwenv.OpenTableCell(1, 1);
			vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop,
				(int)FwTextPropVar.ktpvMilliPoint, 1000);
			vwenv.set_IntProperty((int)FwTextPropType.ktptPadLeading,
				(int)FwTextPropVar.ktpvMilliPoint, 2000);

			vwenv.AddPicture(m_picChooser, -(int)NotesFrags.kfrConnotCategory, 0, 0);
			vwenv.CloseTableCell();

			// If not expanded, display the quote in the last cell
			if (!expanded)
			{
				vwenv.OpenTableCell(1, 1);
				SetupWsAndDirectionForPara(vwenv, quotePara.Hvo);
				if (fQuoteParaRtoL)
					vwenv.OpenParagraph(); // Conc paragraphs don't work well for R-to-L
				else
					vwenv.OpenConcPara(0, 0, 0, 0);
				vwenv.AddString(quotePara.Contents);
				vwenv.CloseParagraph();
				vwenv.CloseTableCell();
			}

			CloseTableRow(vwenv, ann);
			#endregion

			if (!expanded)
				return;

			#region Second through fifth rows
			bool fRegularAnnotation = ann.AnnotationType != NoteType.CheckingError;
			//Second row has quote
			DisplayExpandableAnnotation(vwenv, ann,
				(int)ScrScriptureNoteTags.kflidQuote,
				ann.QuoteOA.Hvo, ann.QuoteOA,
//.........这里部分代码省略.........
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:101,代码来源:TeNotesVc.cs

示例7: Display


//.........这里部分代码省略.........
					{
						// We are displaying a back translation or Scripture in draftview in a table
						// Open a table to display the BT para in column 1, and the icon in column 2.
						VwLength vlTable; // we use this to specify that the table takes 100% of the width.
						vlTable.nVal = 10000;
						vlTable.unit = VwUnit.kunPercent100;

						VwLength vlColumn; // and this one to specify 90% for the text
						vlColumn.nVal = DisplayTranslation ? 9000 : 10000;
						vlColumn.unit = VwUnit.kunPercent100;

						int nColumns = DisplayTranslation ? 2 : 1;

						vwenv.OpenTable(nColumns, // One or two columns.
							vlTable, // Table uses 100% of available width.
							0, // Border thickness.
							VwAlignment.kvaLeft, // Default alignment.
							VwFramePosition.kvfpVoid, // No border.
							//VwFramePosition.kvfpBox,
							//VwRule.kvrlAll, // rule lines between cells
							VwRule.kvrlNone,
							0, //No space between cells.
							0, //No padding inside cells.
							false);

						// Specify column widths. The first argument is the number of columns,
						// not a column index.
						vwenv.MakeColumns(nColumns, vlColumn);
						vwenv.OpenTableBody();
						vwenv.OpenTableRow();

						// Display paragraph in the first cell
						vwenv.OpenTableCell(1, 1);
						InsertParagraphBody(vwenv, hvo, frag, true, ContentType, this);
						vwenv.CloseTableCell();

						if (DisplayTranslation)
						{
							// Stylesheet should never be null for a VC that displays BTs, but to be safe...
							Debug.Assert (m_stylesheet != null);
							if (m_stylesheet != null)
							{
								IStPara para = m_cache.ServiceLocator.GetInstance<IStParaRepository>().GetObject(hvo);
								ITsTextProps styleRules = para.StyleRules;
								if (styleRules == null)
								{
									Debug.Fail("Style Rules should not be null");
									styleRules = NormalStyle;
								}
								string paraStyleName = styleRules.GetStrPropValue((int)FwTextPropType.ktptNamedStyle);
								ITsTextProps ttp = m_stylesheet.GetStyleRgch(0, paraStyleName);
								Debug.Assert(ttp != null);
								if (ttp != null)
								{
									int var;
									int spaceBefore = ttp.GetIntPropValues((int)FwTextPropType.ktptSpaceBefore, out var);
									if (spaceBefore > 0)
										vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop, var, spaceBefore);
								}
							}
							// BT status icon in the next cell, not editable
							vwenv.set_IntProperty((int)FwTextPropType.ktptEditable, (int)FwTextPropVar.ktpvEnum,
								(int)TptEditable.ktptNotEditable);
							vwenv.OpenTableCell(1, 1);
							vwenv.AddObjVec(StTxtParaTags.kflidTranslations, this, (int)ScrFrags.kfrBtTranslationStatus);
							vwenv.CloseTableCell();
						}

						// Close table
						vwenv.CloseTableRow();
						vwenv.CloseTableBody();
						vwenv.CloseTable();
					}
					break;
				case (int)ScrFrags.kfrBtTranslationStatus:
					{
						ICmTranslation trans = m_cache.ServiceLocator.GetInstance<ICmTranslationRepository>().GetObject(hvo);
						if (trans != null)
						{
							string status = trans.Status.get_String(m_wsDefault).Text;
							IPicture picture;
							if (status == BackTranslationStatus.Checked.ToString())
								picture = m_CheckedPic;
							else if (status == BackTranslationStatus.Finished.ToString())
								picture = m_FinishedPic;
							else
								picture = m_UnfinishedPic;

							vwenv.OpenDiv();
							vwenv.AddPicture(picture, -1, 0, 0);
							vwenv.NoteDependency(new [] {hvo}, new [] {CmTranslationTags.kflidStatus}, 1);
							vwenv.CloseDiv();
						}
					}
					break;
				default:
					base.Display(vwenv, hvo, frag);
					break;
			}
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:101,代码来源:DraftViewVc.cs

示例8: DisplayMorphBundles

			private void DisplayMorphBundles(IVwEnv vwenv, int hvo)
			{
				if (m_fShowMorphBundles)
				{
					// Don't allow direct editing of the morph bundle lines.
					MakeNextFlowObjectReadOnly(vwenv);
					if (vwenv.DataAccess.get_VecSize(hvo, ktagSbWordMorphs) == 0)
					{
						SetColor(vwenv, m_choices.LabelRGBFor(m_choices.IndexOf(InterlinLineChoices.kflidMorphemes)));
						vwenv.AddProp(ktagMissingMorphs, this, kfragMissingMorphs);
						// Blank lines to fill up the gap; LexEntry line
						vwenv.AddString(m_tssEmptyVern);
						vwenv.AddString(m_tssEmptyAnalysis); // LexGloss line
						vwenv.AddString(m_tssEmptyAnalysis); // LexPos line
					}
					else
					{
						vwenv.OpenParagraph();
						vwenv.AddObjVec(ktagSbWordMorphs, this, kfragMorph);
						vwenv.CloseParagraph();
					}
				}
			}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:23,代码来源:SandboxBase.SandboxVc.cs

示例9: Display

		/// <summary>
		/// This is the basic method needed for the view constructor.
		/// </summary>
		public override void Display(IVwEnv vwenv, int hvo, int frag)
		{
			switch (frag)
			{
				case VectorReferenceView.kfragTargetVector:
					// Check for an empty vector.
					if (hvo == 0 || m_cache.DomainDataByFlid.get_VecSize(hvo, m_flid) == 0)
					{
						vwenv.set_IntProperty((int)FwTextPropType.ktptForeColor,
							(int)FwTextPropVar.ktpvDefault,
							(int)ColorUtil.ConvertColorToBGR(Color.Gray));
						vwenv.set_IntProperty((int)FwTextPropType.ktptLeadingIndent,
							(int)FwTextPropVar.ktpvMilliPoint, 18000);
						vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
							(int)FwTextPropVar.ktpvDefault,
							(int)TptEditable.ktptNotEditable);
						vwenv.set_IntProperty((int)FwTextPropType.ktptAlign,
							(int)FwTextPropVar.ktpvEnum, (int)FwTextAlign.ktalRight);
						//vwenv.AddString(m_cache.MakeUserTss("Click to select -->"));
						if (hvo != 0)
							vwenv.NoteDependency(new[] { hvo }, new[] { m_flid }, 1);
					}
					else
					{
						if (!string.IsNullOrEmpty(TextStyle))
						{
							vwenv.set_StringProperty((int)FwTextPropType.ktptNamedStyle, TextStyle);
						}
						vwenv.OpenParagraph();
						vwenv.AddObjVec(m_flid, this, frag);
						vwenv.CloseParagraph();
					}
					break;
				case VectorReferenceView.kfragTargetObj:
					// Display one object from the vector.
					{
						ILgWritingSystemFactory wsf =
							m_cache.WritingSystemFactory;

						vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
							(int)FwTextPropVar.ktpvDefault,
							(int)TptEditable.ktptNotEditable);
						ITsString tss;
						ITsStrFactory tsf = m_cache.TsStrFactory;
						Debug.Assert(hvo != 0);
#if USEBESTWS
					if (m_displayWs != null && m_displayWs.StartsWith("best"))
					{
						// The flid can be a variety of types, so deal with those.
						Debug.WriteLine("Using 'best ws': " + m_displayWs);
						int magicWsId = LgWritingSystem.GetMagicWsIdFromName(m_displayWs);
						int actualWS = m_cache.LanguageProject.ActualWs(magicWsId, hvo, m_flid);
						Debug.WriteLine("Actual ws: " + actualWS.ToString());
					}
					else
					{
#endif
						// Use reflection to get a prebuilt name if we can.  Otherwise
						// settle for piecing together a string.
						Debug.Assert(m_cache != null);
						var obj = m_cache.ServiceLocator.GetInstance<ICmObjectRepository>().GetObject(hvo);
						Debug.Assert(obj != null);
						Type type = obj.GetType();
						System.Reflection.PropertyInfo pi = type.GetProperty("TsName",
							System.Reflection.BindingFlags.Instance |
							System.Reflection.BindingFlags.Public |
							System.Reflection.BindingFlags.FlattenHierarchy);
						if (pi != null)
						{
							tss = (ITsString)pi.GetValue(obj, null);
						}
						else
						{
							if (!string.IsNullOrEmpty(m_displayNameProperty))
							{
								pi = type.GetProperty(m_displayNameProperty,
									System.Reflection.BindingFlags.Instance |
									System.Reflection.BindingFlags.Public |
									System.Reflection.BindingFlags.FlattenHierarchy);
							}
							int ws = wsf.GetWsFromStr(obj.SortKeyWs);
							if (ws == 0)
								ws = m_cache.ServiceLocator.WritingSystems.DefaultAnalysisWritingSystem.Handle;
							if (pi != null)
							{
								object s = pi.GetValue(obj, null);
								if (s is ITsString)
									tss = (ITsString)s;
								else
									tss = tsf.MakeString((string)s, ws);
							}
							else
							{
								// ShortNameTss sometimes gets PropChanged, so worth letting the view know that's
								// what we're inserting.
								var flid = Cache.MetaDataCacheAccessor.GetFieldId2(obj.ClassID, "ShortNameTSS", true);
								vwenv.AddStringProp(flid, this);
//.........这里部分代码省略.........
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:101,代码来源:VectorReferenceView.cs

示例10: Display

		public override void Display(IVwEnv vwenv, int hvo, int frag)
		{
			var tsf = m_cache.TsStrFactory;
			var userWs = m_cache.DefaultUserWs;
			switch (frag)
			{
				case kfragRule:
					m_rule = m_cache.ServiceLocator.GetInstance<IMoAffixProcessRepository>().GetObject(hvo);

					VwLength tableLen;
					tableLen.nVal = 10000;
					tableLen.unit = VwUnit.kunPercent100;
					vwenv.OpenTable(3, tableLen, 0, VwAlignment.kvaLeft, VwFramePosition.kvfpVoid, VwRule.kvrlNone, 0, 0, false);

					VwLength inputLen;
					inputLen.nVal = 0;
					inputLen.unit = VwUnit.kunPoint1000;

					int indexWidth = GetStrWidth(m_indexStr, m_headerProps, vwenv);
					int inputWidth = GetStrWidth(m_inputStr, m_headerProps, vwenv);
					VwLength headerLen;
					headerLen.nVal = Math.Max(indexWidth, inputWidth) + 8000;
					headerLen.unit = VwUnit.kunPoint1000;
					inputLen.nVal += headerLen.nVal;

					VwLength leftEmptyLen;
					leftEmptyLen.nVal = 8000 + (PILE_MARGIN * 2) + 2000;
					leftEmptyLen.unit = VwUnit.kunPoint1000;
					inputLen.nVal += leftEmptyLen.nVal;

					var ctxtLens = new VwLength[m_rule.InputOS.Count];
					vwenv.NoteDependency(new[] {m_rule.Hvo}, new[] {MoAffixProcessTags.kflidInput}, 1 );
					for (int i = 0; i < m_rule.InputOS.Count; i++)
					{
						int idxWidth = GetStrWidth(tsf.MakeString(Convert.ToString(i + 1), userWs), m_indexProps, vwenv);
						int ctxtWidth = GetWidth(m_rule.InputOS[i], vwenv);
						ctxtLens[i].nVal = Math.Max(idxWidth, ctxtWidth) + 8000 + 1000;
						ctxtLens[i].unit = VwUnit.kunPoint1000;
						inputLen.nVal += ctxtLens[i].nVal;
					}

					VwLength rightEmptyLen;
					rightEmptyLen.nVal = 8000 + (PILE_MARGIN * 2) + 1000;
					rightEmptyLen.unit = VwUnit.kunPoint1000;
					inputLen.nVal += rightEmptyLen.nVal;

					vwenv.MakeColumns(1, inputLen);

					VwLength arrowLen;
					arrowLen.nVal = GetStrWidth(m_doubleArrow, m_arrowProps, vwenv) + 8000;
					arrowLen.unit = VwUnit.kunPoint1000;
					vwenv.MakeColumns(1, arrowLen);

					VwLength outputLen;
					outputLen.nVal = 1;
					outputLen.unit = VwUnit.kunRelative;
					vwenv.MakeColumns(1, outputLen);

					vwenv.OpenTableBody();
					vwenv.OpenTableRow();

					// input table cell
					vwenv.OpenTableCell(1, 1);
					vwenv.OpenTable(m_rule.InputOS.Count + 3, tableLen, 0, VwAlignment.kvaCenter, VwFramePosition.kvfpVoid, VwRule.kvrlNone, 0, 4000, false);
					vwenv.MakeColumns(1, headerLen);
					vwenv.MakeColumns(1, leftEmptyLen);
					foreach (VwLength ctxtLen in ctxtLens)
						vwenv.MakeColumns(1, ctxtLen);
					vwenv.MakeColumns(1, rightEmptyLen);

					vwenv.OpenTableBody();
					vwenv.OpenTableRow();

					// input header cell
					vwenv.Props = m_headerProps;
					vwenv.OpenTableCell(1, 1);
					vwenv.AddString(m_inputStr);
					vwenv.CloseTableCell();

					// input left empty cell
					vwenv.Props = m_ctxtProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, 1000);
					vwenv.OpenTableCell(1, 1);
					vwenv.OpenParagraph();
					OpenContextPile(vwenv, false);
					vwenv.Props = m_bracketProps;
					vwenv.AddProp(ktagLeftEmpty, this, kfragEmpty);
					CloseContextPile(vwenv, false);
					vwenv.CloseParagraph();
					vwenv.CloseTableCell();

					// input context cells
					vwenv.AddObjVec(MoAffixProcessTags.kflidInput, this, kfragInput);

					// input right empty cell
					vwenv.Props = m_ctxtProps;
					vwenv.OpenTableCell(1, 1);
					vwenv.OpenParagraph();
					OpenContextPile(vwenv, false);
					vwenv.Props = m_bracketProps;
//.........这里部分代码省略.........
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:101,代码来源:AffixRuleFormulaControl.cs

示例11: Display

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// This is the main interesting method of displaying objects and fragments of them.
		/// Scripture Footnotes are displayed by displaying each footnote's reference and text.
		/// The text is displayed using the standard view constructor for StText.
		/// </summary>
		/// <param name="vwenv"></param>
		/// <param name="hvo"></param>
		/// <param name="frag"></param>
		/// ------------------------------------------------------------------------------------
		public override void Display(IVwEnv vwenv, int hvo, int frag)
		{
			switch (frag)
			{
				case (int)StTextFrags.kfrFootnote:
					{
						// FWR-1640: Make the sequence of footnote paragraphs non-editable
						// since we only allow one para per footnote. This will cause
						// pasting multiple paragraphs to work correctly.
						vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
							(int)FwTextPropVar.ktpvEnum,
							(int)TptEditable.ktptNotEditable);
						base.Display(vwenv, hvo, frag);
						break;
					}
				case (int)FootnoteFrags.kfrScripture:
				{
					vwenv.NoteDependency(new int[] { m_cache.LanguageProject.TranslatedScriptureOA.Hvo },
						new int[] { (int)ScriptureTags.kflidScriptureBooks }, 1);
					vwenv.AddLazyVecItems(BooksTag, this, (int)FootnoteFrags.kfrBook);
					break;
				}
				case (int)FootnoteFrags.kfrRootInPageSeq:
				{
					vwenv.AddObjVec(ScrBookTags.kflidFootnotes, this, (int)FootnoteFrags.kfrAllFootnotesWithinPagePara);
					break;
				}
				case (int)FootnoteFrags.kfrFootnoteWithinPagePara:
				{
					// Insert the marker and reference
					vwenv.AddObj(hvo, this, (int)StTextFrags.kfrFootnoteMarker);
					vwenv.AddObj(hvo,  this,(int)StTextFrags.kfrFootnoteReference);

					// Insert (we hope only one) paragraph contents.
					vwenv.AddObjVecItems(StTextTags.kflidParagraphs, this, (int)FootnoteFrags.kfrFootnoteParaWithinPagePara);
					break;
				}
				case (int) FootnoteFrags.kfrFootnoteParaWithinPagePara:
				{
					if (!InsertParaContentsUserPrompt(vwenv, hvo))
					{
						// Display the text paragraph contents, or its user prompt.
						vwenv.AddStringProp(StTxtParaTags.kflidContents, null);
					}
					break;
				}
				case (int)FootnoteFrags.kfrBook:
				{
					vwenv.OpenDiv();
					vwenv.AddObjVecItems(ScrBookTags.kflidFootnotes, this,
						(int)StTextFrags.kfrFootnote);
					vwenv.CloseDiv();
					break;
				}
				case (int)StTextFrags.kfrFootnoteReference:
				{
					DisplayFootnoteReference(vwenv, hvo);
					break;
				}
				default:
					base.Display(vwenv, hvo, frag);
					break;
			}
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:74,代码来源:FootnoteVc.cs

示例12: Display

		/// <summary>
		/// This is the basic method needed for the view constructor.
		/// </summary>
		public override void Display(IVwEnv vwenv, int hvo, int frag)
		{
			switch (frag)
			{
				case VectorReferenceView.kfragTargetVector:
					if (!string.IsNullOrEmpty(TextStyle))
					{
						vwenv.set_StringProperty((int)FwTextPropType.ktptNamedStyle, TextStyle);
					}
					vwenv.OpenParagraph();
					vwenv.AddObjVec(m_flid, this, frag);
					vwenv.CloseParagraph();
					break;
				case VectorReferenceView.kfragTargetObj:
					// Display one object by displaying the fake string property of that object which our special
					// private decorator stores for it.
					vwenv.AddStringProp(PossibilityVectorReferenceView.kflidFake, this);
					break;
				default:
					throw new ArgumentException(
						"Don't know what to do with the given frag.", "frag");
			}
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:26,代码来源:PossibilityVectorReferenceView.cs

示例13: DisplayClausePlaceholder

		private void DisplayClausePlaceholder(IVwEnv vwenv, int hvoClause)
		{
			string clauseType = GetRowStyleName(vwenv, hvoClause) + "Mkr";
			ApplyFormatting(vwenv, clauseType);
			vwenv.OpenSpan();
			InsertOpenBracket(vwenv, clauseType);
			vwenv.AddObjVec(kflidAppliesTo, this, kfragClauseLabels);
			InsertCloseBracket(vwenv, clauseType);
			vwenv.CloseSpan();
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:10,代码来源:ConstChartBody.cs

示例14: Display

		public override void Display(IVwEnv vwenv, int hvo, int frag)
		{
			switch (frag)
			{
				case kfragPrintChart: // the whole chart with headings for printing.
					if (hvo == 0)
						return;
					PrintColumnGroupHeaders(hvo, vwenv);
					PrintIndividualColumnHeaders(hvo, vwenv);
					// Rest is same as kfragChart
					DisplayChartBody(vwenv);
					break;
				case kfragTemplateHeader: // Display the template as group headers.
					vwenv.AddObjVecItems((int)CmPossibility.CmPossibilityTags.kflidSubPossibilities, this, kfragColumnGroupHeader);
					break;

					// This is only used for printing, the headers in the screen version are a separate control.
				case kfragColumnGroupHeader:
					int ccols = vwenv.DataAccess.get_VecSize(hvo, (int)CmPossibility.CmPossibilityTags.kflidSubPossibilities);
					// If there are no subitems, we still want a blank cell as a placeholder.
					MakeCellsMethod.OpenStandardCell(vwenv, Math.Max(ccols, 1), true);
					if (ccols > 0)
					{
						// It's a group, include its name
						vwenv.set_IntProperty((int)FwTextPropType.ktptAlign, (int)FwTextPropVar.ktpvEnum,
							(int)FwTextAlign.ktalCenter);
						vwenv.OpenParagraph();
						vwenv.AddString(CmPossibility.BestAnalysisName(m_cache, hvo));
						vwenv.CloseParagraph();
					}
					vwenv.CloseTableCell();
					break;
				case kfragChart: // the whole chart, a DsConstChart.
					if (hvo == 0)
						return;
					DisplayChartBody(vwenv);
					break;
				case kfragChartRow: // one row, a CmIndirectAnnotation
					{
						MakeTableAndRowWithStdWidths(vwenv, hvo, false);

						MakeCells(vwenv, hvo);
						vwenv.CloseTableRow();
						vwenv.CloseTable();
					}
					break;
				case kfragCca: // a single group of words, the contents of one cell.
					if (ConstituentChartLogic.IsWficGroup(m_cache, hvo))
						vwenv.AddObjVec(kflidAppliesTo, this, kfragBundleVec);
					else
					{
						// it's a moved text or missing-item placeholder.
						int hvoClause;
						if (m_chart.Logic.IsClausePlaceholder(hvo, out hvoClause))
							DisplayClausePlaceholder(vwenv, hvoClause);
						else if (vwenv.DataAccess.get_VecSize(hvo, kflidAppliesTo) == 0)
							DisplayMissingMarker(vwenv);
						else
							DisplayMovedTextTag(hvo, vwenv);
					}
					break;
				case kfragCcaMoved: // a single group of words, the contents of one cell, which is considered moved-within-line.
					// can't be a placeholder.
					string formatTag = m_chart.Logic.MovedTextTag(hvo);
					ApplyFormatting(vwenv, formatTag);
					vwenv.OpenSpan();
					InsertOpenBracket(vwenv, formatTag);
					vwenv.AddObjVec(kflidAppliesTo, this, kfragBundleVec);
					InsertCloseBracket(vwenv, formatTag);
					vwenv.CloseSpan();
					break;
				case kfragCcaListItem: // a single CCA, referring to a list item.
					// can't be a placeholder.
					ApplyFormatting(vwenv, "marker");
					vwenv.OpenSpan();
					InsertOpenBracket(vwenv, "marker");
					vwenv.AddObjProp((int)CmBaseAnnotation.CmBaseAnnotationTags.kflidBeginObject,
						this, kfragPossibility);
					InsertCloseBracket(vwenv, "marker");
					vwenv.CloseSpan();
					break;
				case kfragPossibility: // A CmPossibility, show it's abbreviation
					int flid = (int)CmPossibility.CmPossibilityTags.kflidAbbreviation;
					int retWs;
					m_cache.LangProject.GetMagicStringAlt(LangProject.kwsFirstAnal, hvo, flid, false, out retWs);
					// If we didn't find an abbreviation try for the name
					ITsString tss = null;
					if (retWs != 0)
						tss = m_cache.GetMultiStringAlt(hvo, flid, retWs);
					if (tss == null || string.IsNullOrEmpty(tss.Text))
					{
						flid = (int)CmPossibility.CmPossibilityTags.kflidName;
						m_cache.LangProject.GetMagicStringAlt(LangProject.kwsFirstAnal, hvo, flid, false, out retWs);
					}
					// Unless we didn't get anything, go ahead and insert the best option we found.
					if (retWs != 0)
						vwenv.AddStringAltMember(flid, retWs, this);
					// retWS was m_cache.DefaultAnalWs, this fixes LT-7838
					break;
				case kfragBundle: // One annotated word bundle; hvo is CmBaseAnnotation. Overrides behavior of InterlinVc
//.........这里部分代码省略.........
开发者ID:sillsdev,项目名称:WorldPad,代码行数:101,代码来源:ConstChartBody.cs

示例15: Display

		public override void Display(IVwEnv vwenv, int hvo, int frag)
		{
			CheckDisposed();
			if (hvo == 0)
				return;		// Can't do anything without an hvo (except crash -- see LT-9348).

#if DEBUG
			//TimeRecorder.Begin("Display");
#endif
			switch (frag)
			{
			case kfragText: // The whole text, root object for the InterlinDocChild.
				vwenv.AddObjProp((int)Text.TextTags.kflidContents, this, kfragStText);
				break;
				//			case kfragTxtSection: // obsolete
				//				// Enhance JohnT: possibly some extra space, bold the heading, or whatever?
				//				vwenv.AddObjProp((int)TxtSection.TxtSectionTags.kflidHeading, this, kfragStText);
				//				vwenv.AddObjProp((int)TxtSection.TxtSectionTags.kflidContents, this, kfragStText);
				//				vwenv.AddLazyVecItems((int)TxtSection.TxtSectionTags.kflidSubsections, this, kfragTxtSection);
				//				break;
			case kfragStText:	// new root object for InterlinDocChild.
				SetupRealVernWsForDisplay(m_cache.LangProject.ActualWs(LangProject.kwsVernInParagraph,
					hvo, (int)StText.StTextTags.kflidParagraphs));
				vwenv.AddLazyVecItems((int)StText.StTextTags.kflidParagraphs, this, kfragInterlinPara);
				break;
			case kfragInterlinPara: // Whole StTxtPara. This can be the root fragment in DE view.
				if (vwenv.DataAccess.get_VecSize(hvo, ktagParaSegments) == 0)
				{
					vwenv.NoteDependency(new int[] {hvo}, new int[] {ktagParaSegments}, 1);
					vwenv.AddString(m_tssEmptyPara);
				}
				else
				{
					PreferredVernWs = m_cache.LangProject.ActualWs(LangProject.kwsVernInParagraph, hvo, ktagParaSegments);
					// Include the plain text version of the paragraph?
					vwenv.AddLazyVecItems(ktagParaSegments, this, kfragParaSegment);
				}
				break;
			case kfragParaSegment:
				// Don't put anything in this segment if it is a 'label' segment (typically containing a verse
				// number for TE).
				CmBaseAnnotation seg = CmObject.CreateFromDBObject(m_cache, hvo, false) as CmBaseAnnotation;
				StTxtPara para = seg.BeginObjectRA as StTxtPara;
				if (SegmentBreaker.HasLabelText(para.Contents.UnderlyingTsString, seg.BeginOffset, seg.EndOffset))
					break;
				// This puts ten points between segments. There's always 5 points below each line of interlinear;
				// if there are no freeform annotations another 5 points makes 10 between segments.
				// If there are freeforms, we need the full 10 points after the last of them.
				int cfreeform = vwenv.DataAccess.get_VecSize(hvo, ktagSegFF);
				vwenv.set_IntProperty((int)FwTextPropType.ktptMarginBottom,
					(int)FwTextPropVar.ktpvMilliPoint, cfreeform == 0 ? 5000 : 10000);
				vwenv.OpenDiv();
				// Enhance JohnT: determine what the overall direction of the paragraph should
				// be and set it.
				if (m_mpBundleHeight == 0)
				{
					// First time...figure it out.
					int dmpx, dmpyAnal, dmpyVern;
					vwenv.get_StringWidth(m_tssEmptyAnalysis, null, out dmpx, out dmpyAnal);
					vwenv.get_StringWidth(m_tssEmptyVern, null, out dmpx, out dmpyVern);
					m_mpBundleHeight = dmpyAnal * 4 + dmpyVern * 3;
				}
				// The interlinear bundles are not editable.
				vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
					(int)FwTextPropVar.ktpvEnum, (int)TptEditable.ktptNotEditable);
				if (m_fRtl)
				{
					vwenv.set_IntProperty((int)FwTextPropType.ktptRightToLeft,
						(int)FwTextPropVar.ktpvEnum, (int)FwTextToggleVal.kttvForceOn);
					vwenv.set_IntProperty((int)FwTextPropType.ktptAlign,
						(int)FwTextPropVar.ktpvEnum, (int) FwTextAlign.ktalRight);
				}
				vwenv.set_IntProperty((int)FwTextPropType.ktptSpellCheck, (int)FwTextPropVar.ktpvEnum,
					(int)SpellingModes.ksmDoNotCheck);
				vwenv.OpenParagraph();
				AddSegmentReference(vwenv, hvo);	// Calculate and display the segment reference.
				AddLabelPile(vwenv, m_tsf, m_cache, true, m_fShowMorphBundles);
				vwenv.AddObjVecItems(ktagSegmentForms, this, kfragBundle);
				// JohnT, 1 Feb 2008. Took this out as I can see no reason for it; AddObjVecItems handles
				// the dependency already. Adding it just means that any change to the forms list
				// regenerates a higher level than needed, which contributes to a great deal of scrolling
				// and flashing (LT-7470).
				// Originally added by Eric in revision 72 on the trunk as part of handling phrases.
				// Eric can't see any reason we need it now, either. If you find a need to re-insert it,
				// please document carefully the reasons it is needed and what bad consequences follow
				// from removing it.
				//vwenv.NoteDependency(new int[] { hvo }, new int[] { ktagSegmentForms }, 1);
				vwenv.CloseParagraph();
				// This puts 3 points of margin on the first FF annotation, if any.
				vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTop,
					(int)FwTextPropVar.ktpvMilliPoint, 0); // 3000
				vwenv.AddObjVec(ktagSegFF, this, kfragSegFf);
				vwenv.CloseDiv();
				break;
			case kfragBundle: // One annotated word bundle; hvo is CmBaseAnnotation.
				// checking AllowLayout (especially in context of Undo/Redo make/break phrase)
				// helps prevent us from rebuilding the display until we've finished
				// reconstructing the data and cache. Otherwise we can crash.
				if (m_rootsite != null && !m_rootsite.AllowLayout)
					return;
//.........这里部分代码省略.........
开发者ID:sillsdev,项目名称:WorldPad,代码行数:101,代码来源:InterlinVc.cs


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