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


C# IVwEnv.AddProp方法代码示例

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


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

示例1: DisplayMorphBundle


//.........这里部分代码省略.........
						}
						else if (hvoMf == 0)
						{
							// If no morph, use the form of the morph bundle (and the entry is of
							// course missing)
							if (ws == 0)
							{
								ws = m_cache.LangProject.ActualWs(spec.WritingSystem, hvo,
									(int)WfiMorphBundle.WfiMorphBundleTags.kflidForm);
							}
							vwenv.AddStringAltMember(
								(int)WfiMorphBundle.WfiMorphBundleTags.kflidForm, ws, this);
						}
						else
						{
							// Got a morph, show it.
							vwenv.AddObjProp((int)WfiMorphBundle.WfiMorphBundleTags.kflidMorph,
								this, kfragMorphFormChoices + i);
							// And the LexEntry line.
						}
						break;
					case InterlinLineChoices.kflidLexEntries:
						if (hvoMf == 0)
						{
							if (hvo != 0)
								vwenv.NoteDependency(new int[] { hvo }, new int[] { (int)WfiMorphBundle.WfiMorphBundleTags.kflidMorph }, 1);
							vwenv.AddString(m_tssMissingEntry);
						}
						else
						{
							if (ws == 0)
								ws = spec.WritingSystem;
							LexEntryVc vcEntry = new LexEntryVc(m_cache);
							vcEntry.WritingSystemCode = ws;
							vwenv.AddObj(hvo, vcEntry, LexEntryVc.kfragEntryAndVariant);
						}
						break;
					case InterlinLineChoices.kflidLexGloss:
						int hvoSense = 0;
						if (hvo != 0)
						{
							hvoSense = m_cache.GetObjProperty(hvo,
								(int)WfiMorphBundle.WfiMorphBundleTags.kflidSense);
						}
						if (hvoSense == 0)
						{
							int virtFlid = 0;
							if (hvo != 0)
							{
								vwenv.NoteDependency(new int[] { hvo }, new int[] { (int)WfiMorphBundle.WfiMorphBundleTags.kflidSense }, 1);
								virtFlid = BaseVirtualHandler.GetInstalledHandlerTag(m_cache, "WfiMorphBundle", "DefaultSense");
							}
							if (hvo != 0 && ShowDefaultSense && m_cache.GetObjProperty(hvo, virtFlid) > 0)
							{
								// Switch values when using the default sense, rather than the missing row '***'.
								SetGuessing(vwenv, false);
								vwenv.AddObjProp(virtFlid, this, kfragLineChoices + i);
							}
							else
							{
								vwenv.AddProp(ktagBundleMissingSense, this, kfragBundleMissingSense);
							}
						}
						else
						{
							vwenv.AddObjProp((int)WfiMorphBundle.WfiMorphBundleTags.kflidSense,
								this, kfragLineChoices + i);
						}
						break;

					case InterlinLineChoices.kflidLexPos:
						// LexPOS line:
						int hvoMsa = 0;
						if (hvo != 0)
							hvoMsa = m_cache.GetObjProperty(hvo, (int)WfiMorphBundle.WfiMorphBundleTags.kflidMsa);
						if (hvoMsa == 0)
						{
							if (hvo != 0)
								vwenv.NoteDependency(new int[] { hvo }, new int[] { (int)WfiMorphBundle.WfiMorphBundleTags.kflidMsa }, 1);
							vwenv.AddString(m_tssMissingMsa);
						}
						else
						{
							// Use a special view constructor that knows how to display the
							// interlinear view of whatever kind of MSA it is.
							// Enhance JohnT: ideally we would have one of these VCs for each writing system,
							// perhaps stored in the InterlinLineSpec. Currently displaying multiple Wss of LexPos
							// is not useful, though it is possible.
							// Enhancement RickM: we set the m_msaVc.WritingSystemCode to the selected writing system
							//		of each LexPos line in interlinear. This is used extract the LexPos abbreviation
							//		for the specific writing system.
							m_msaVc.WritingSystemCode = spec.WritingSystem;
							vwenv.AddObjProp((int)WfiMorphBundle.WfiMorphBundleTags.kflidMsa,
								m_msaVc, (int)VcFrags.kfragInterlinearAbbr);
						}
						break;
				}
			}
			vwenv.CloseInnerPile();
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:101,代码来源:InterlinVc.cs

示例2: OpenSingleLinePile

		protected void OpenSingleLinePile(IVwEnv vwenv, int maxNumLines, bool addBoundary)
		{
			vwenv.Props = m_pileProps;
			vwenv.OpenInnerPile();
			AddExtraLines(maxNumLines - 1, vwenv);
			vwenv.OpenParagraph();
			if (addBoundary)
			{
				vwenv.Props = m_bracketProps;
				vwenv.AddProp(ktagLeftBoundary, this, kfragZeroWidthSpace);
			}
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:12,代码来源:PatternVcBase.cs

示例3: InsertParaContentsUserPrompt

		/// -----------------------------------------------------------------------------------
		/// <summary>
		/// In certain contexts, check the given paragraph to see if it is empty. If so,
		/// insert a user prompt.
		/// </summary>
		/// <param name="vwenv">view environment</param>
		/// <param name="paraHvo">HVO of the paragraph to be displayed</param>
		/// <returns>true if an empty string was substituted for missing/empty StText</returns>
		/// -----------------------------------------------------------------------------------
		protected override bool InsertParaContentsUserPrompt(IVwEnv vwenv, int paraHvo)
		{
			Debug.Assert(!DisplayTranslation);

			// No user prompt in any of these conditions
			IStTxtPara para = m_cache.ServiceLocator.GetInstance<IStTxtParaRepository>().GetObject(paraHvo);
			if (!(para is IScrTxtPara)
				|| !Options.ShowEmptyParagraphPromptsSetting // tools options setting
				|| m_target == LayoutViewTarget.targetPrint // any print layout view
				|| m_updatedPrompts.Contains(para.Hvo)) // user interaction has updated prompt
			{
				return false;
			}

			// User prompt is only for title & heading paras
			IStText text = (IStText)para.Owner; // para owner
			if (text.OwningFlid != ScrBookTags.kflidTitle &&
				text.OwningFlid != ScrSectionTags.kflidHeading)
				return false;

			int paraCount = text.ParagraphsOS.Count;
			Debug.Assert(paraCount != 0,
				"We shouldn't come here if StText doesn't contain any paragraphs");
			// By design, if there is more than one para, don't display the user prompt.
			if (paraCount != 1)
				return false;

			// If first para is empty, insert user prompt for paragraph content
			if (text[0].Contents.Text == null)
			{
				vwenv.NoteDependency(new int[] { para.Hvo },
					new int[] { StTxtParaTags.kflidContents}, 1);
				vwenv.AddProp(SimpleRootSite.kTagUserPrompt, this, text.OwningFlid);
				return true;
			}

			return false;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:47,代码来源:TeStVc.cs

示例4: Display


//.........这里部分代码省略.........
				// 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)
				// 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;
				AddWordBundleInternal(hvo, vwenv);
				break;
			case kfragIsolatedAnalysis: // This one is used for an isolated HVO that is surely an analysis.
			{
				var wa = m_analRepository.GetObject(hvo);
				vwenv.AddObj(wa.Owner.Hvo, this, kfragWordformForm);
				if (m_fShowMorphBundles)
					vwenv.AddObj(hvo, this, kfragAnalysisMorphs);

				int chvoGlosses = wa.MeaningsOC.Count;
				for (int i = 0; i < m_WsList.AnalysisWsIds.Length; ++i)
				{
					SetColor(vwenv, LabelRGBFor(m_lineChoices.IndexOf(InterlinLineChoices.kflidWordGloss,
						m_WsList.AnalysisWsIds[i])));
					if (chvoGlosses == 0)
					{
						// There are no glosses, display something indicating it is missing.
						vwenv.AddProp(ktagAnalysisMissingGloss, this, kfragAnalysisMissingGloss);
					}
					else
					{
						vwenv.AddObjVec(WfiAnalysisTags.kflidMeanings, this, kfragWordGlossWs + i);
					}
				}
				AddAnalysisPos(vwenv, hvo, hvo, -1);
			}
				break;
			case kfragAnalysisMorphs:
				int cmorphs = 0;
				ICmObject co = m_coRepository.GetObject(hvo);
				if (co is IWfiAnalysis)
					cmorphs = (co as IWfiAnalysis).MorphBundlesOS.Count;
				// We really want a variable for this...there have been pathological cases where
				// m_fHaveOpenedParagraph changed during the construction of the paragraph, and we want to be
				// sure to close the paragraph if we opened it.
				var openedParagraph = !m_fHaveOpenedParagraph;
				if (openedParagraph)
					vwenv.OpenParagraph();
				if (cmorphs == 0)
				{
					DisplayMorphBundle(vwenv, 0);
				}
				else
				{
					vwenv.AddObjVecItems(WfiAnalysisTags.kflidMorphBundles, this, kfragMorphBundle);
				}
				if (openedParagraph)
					vwenv.CloseParagraph();
				break;
			case kfragMorphType: // for export only at present, display the
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:67,代码来源:InterlinVc.cs

示例5: DisplayIterCtxt

		void DisplayIterCtxt(IPhIterationContext iterCtxt, int numLines, IVwEnv vwenv)
		{
			int superOffset = 0;
			if (numLines == 1)
			{
				// if the inner context is a single line, then make the min value a subscript and the max value a superscript.
				// I tried to use the Views subscript and superscript properties, but they added extra space so that it would
				// have the same line height of a normal character, which is not what I wanted, so I compute the size myself
				int fontHeight = GetFontHeight(m_cache.DefaultUserWs);
				int superSubHeight = (fontHeight * 2) / 3;
				vwenv.set_IntProperty((int)FwTextPropType.ktptFontSize, (int)FwTextPropVar.ktpvMilliPoint, superSubHeight);
				vwenv.set_IntProperty((int)FwTextPropType.ktptLineHeight, (int)FwTextPropVar.ktpvMilliPoint, -superSubHeight);
				superOffset = superSubHeight / 2;
			}
			else
			{
				vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTrailing, (int)FwTextPropVar.ktpvMilliPoint, PILE_MARGIN);
			}
			vwenv.OpenInnerPile();
			if (numLines == 1)
				vwenv.set_IntProperty((int)FwTextPropType.ktptOffset, (int)FwTextPropVar.ktpvMilliPoint, superOffset);
			vwenv.OpenParagraph();
			vwenv.AddProp(PhIterationContextTags.kflidMaximum, this, kfragIterCtxtMax);
			vwenv.CloseParagraph();
			AddExtraLines(numLines - 2, vwenv);
			vwenv.set_IntProperty((int)FwTextPropType.ktptOffset, (int)FwTextPropVar.ktpvMilliPoint, 0);
			vwenv.OpenParagraph();
			vwenv.AddIntProp(PhIterationContextTags.kflidMinimum);
			vwenv.CloseParagraph();
			vwenv.CloseInnerPile();
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:31,代码来源:RuleFormulaView.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: AddFreeformComment

		private void AddFreeformComment(IVwEnv vwenv, int hvo, int ws, int flidTarget)
		{
			if (flidTarget != ActiveFreeformFlid || hvo != m_hvoActiveFreeform || ws != ActiveFreeformWs)
			{
				vwenv.AddStringAltMember(flidTarget, ws, this); // display normally, not the current prop
				return;
			}
			ITsString tssVal = vwenv.DataAccess.get_MultiStringAlt(hvo, flidTarget, ws);
			if (tssVal.Length != 0)
			{
				// Display normally, length is not zero. This is probably redundant, we don't set m_hvoActiveFreeform etc
				// if the length is zero. For that reason, putting in the following note dependency doesn't help.
				// Even if we did set them for a non-empty string, we'd have to
				// do a lot of other work to get the selection restored appropriately when the length goes to zero.
				// vwenv.NoteStringValDependency(hvo, CmAnnotationTags.kflidComment, ws, tsf.MakeString("", ws));
				vwenv.AddStringAltMember(flidTarget, ws, this);
				return;
			}
			// If anything causes the comment to change, get rid of the prompt.
			vwenv.NoteDependency(new [] { hvo }, new [] { flidTarget }, 1);
			// Passing the ws where we normally pass a tag, but DisplayVariant doesn't need the tag and does need to
			// know which writing system.
			vwenv.AddProp(SimpleRootSite.kTagUserPrompt, this, ws);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:24,代码来源:InterlinVc.cs

示例8: Display

		public override void Display(IVwEnv vwenv, int hvo, int frag)
		{
			switch (frag)
			{
				case kfragRHS:
					m_rhs = m_cache.ServiceLocator.GetInstance<IPhSegRuleRHSRepository>().GetObject(hvo);
					var rule = m_rhs.OwningRule;
					if (rule.Disabled)
					{
						vwenv.set_StringProperty((int)FwTextPropType.ktptNamedStyle, "Disabled Text");
					}

					int arrowWidth, slashWidth, underscoreWidth, charHeight;
					vwenv.get_StringWidth(m_arrow, m_charProps, out arrowWidth, out charHeight);
					int maxCharHeight = charHeight;
					vwenv.get_StringWidth(m_slash, m_charProps, out slashWidth, out charHeight);
					maxCharHeight = Math.Max(charHeight, maxCharHeight);
					vwenv.get_StringWidth(m_underscore, m_charProps, out underscoreWidth, out charHeight);
					maxCharHeight = Math.Max(charHeight, maxCharHeight);

					int dmpx, spaceHeight;
					vwenv.get_StringWidth(m_zwSpace, m_bracketProps, out dmpx, out spaceHeight);

					int maxNumLines = GetMaxNumLines();
					int maxCtxtHeight = maxNumLines * spaceHeight;

					int maxHeight = Math.Max(maxCharHeight, maxCtxtHeight);
					int charOffset = maxHeight;
					int ctxtPadding = maxHeight - maxCtxtHeight;

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

					VwLength ctxtLen;
					ctxtLen.nVal = 1;
					ctxtLen.unit = VwUnit.kunRelative;
					VwLength charLen;
					charLen.unit = VwUnit.kunPoint1000;
					vwenv.MakeColumns(1, ctxtLen);

					charLen.nVal = arrowWidth + 4000;
					vwenv.MakeColumns(1, charLen);

					vwenv.MakeColumns(1, ctxtLen);

					charLen.nVal = slashWidth + 4000;
					vwenv.MakeColumns(1, charLen);

					vwenv.MakeColumns(1, ctxtLen);

					charLen.nVal = underscoreWidth + 4000;
					vwenv.MakeColumns(1, charLen);

					vwenv.MakeColumns(1, ctxtLen);

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

					// LHS cell
					vwenv.Props = m_ctxtProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop, (int)FwTextPropVar.ktpvMilliPoint, ctxtPadding);
					vwenv.OpenTableCell(1, 1);
					vwenv.OpenParagraph();
					vwenv.AddObjProp(m_cache.MetaDataCacheAccessor.GetFieldId2(PhSegRuleRHSTags.kClassId, "OwningRule", false), this, kfragRule);
					vwenv.CloseParagraph();
					vwenv.CloseTableCell();

					// arrow cell
					vwenv.Props = m_charProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptOffset, (int)FwTextPropVar.ktpvMilliPoint, -charOffset);
					vwenv.OpenTableCell(1, 1);
					vwenv.AddString(m_arrow);
					vwenv.CloseTableCell();

					// RHS cell
					vwenv.Props = m_ctxtProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop, (int)FwTextPropVar.ktpvMilliPoint, ctxtPadding);
					vwenv.OpenTableCell(1, 1);
					vwenv.OpenParagraph();
					if (m_rhs.StrucChangeOS.Count > 0)
					{
						vwenv.AddObjVecItems(PhSegRuleRHSTags.kflidStrucChange, this, kfragContext);
					}
					else
					{
						vwenv.NoteDependency(new[] {hvo}, new[] {PhSegRuleRHSTags.kflidStrucChange}, 1);
						OpenSingleLinePile(vwenv, maxNumLines, false);
						vwenv.Props = m_bracketProps;
						vwenv.AddProp(PhSegRuleRHSTags.kflidStrucChange, this, kfragEmpty);
						CloseSingleLinePile(vwenv, false);
					}
					vwenv.CloseParagraph();
					vwenv.CloseTableCell();

					// slash cell
					vwenv.Props = m_charProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptOffset, (int)FwTextPropVar.ktpvMilliPoint, -charOffset);
					vwenv.OpenTableCell(1, 1);
//.........这里部分代码省略.........
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:101,代码来源:RegRuleFormulaVc.cs

示例9: OpenIndexPile

		void OpenIndexPile(IVwEnv vwenv)
		{
			vwenv.Props = m_pileProps;
			vwenv.OpenInnerPile();
			vwenv.OpenParagraph();
			vwenv.Props = m_bracketProps;
			vwenv.AddProp(ktagLeftBoundary, this, kfragZeroWidthSpace);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:8,代码来源:AffixRuleFormulaControl.cs

示例10: InsertParaContentsUserPrompt

		/// -----------------------------------------------------------------------------------
		/// <summary>
		/// In certain contexts, check the given paragraph to see if it is empty. If so,
		/// insert a user prompt.
		/// </summary>
		/// <param name="vwenv">view environment</param>
		/// <param name="hvo">id of paragraph to be displayed</param>
		/// <returns>true if an empty string was substituted for missing/empty StText</returns>
		/// -----------------------------------------------------------------------------------
		protected override bool InsertParaContentsUserPrompt(IVwEnv vwenv, int hvo)
		{
			Debug.Assert((Cache == null && vwenv.DataAccess != null) ||
				Cache.MainCacheAccessor == vwenv.DataAccess,
				"Oops! We don't expect to get a different data access object from IVwEnv");
			Debug.Assert(!DisplayTranslation);

			// No user prompt in any of these conditions
			if (hvo == 0
				|| Cache.GetClassOfObject(hvo) != (int)StTxtPara.kClassId
				|| !Options.ShowEmptyParagraphPromptsSetting // tools options setting
				|| m_target == LayoutViewTarget.targetPrint // any print layout view
				|| m_updatedPrompts.Contains(hvo)) // user interaction has updated prompt
			{
				return false;
			}

			// User prompt is only for title & heading paras
			StText text = new StText(Cache, Cache.GetOwnerOfObject(hvo)); // para owner
			if (text.OwningFlid != (int)ScrBook.ScrBookTags.kflidTitle &&
				text.OwningFlid != (int)ScrSection.ScrSectionTags.kflidHeading)
				return false;

			int paraCount = text.ParagraphsOS.Count;
			Debug.Assert(paraCount != 0,
				"We shouldn't come here if StText doesn't contain any paragraphs");
			// By design, if there is more than one para, don't display the user prompt.
			if (paraCount != 1)
				return false;

			// If first para is empty, insert user prompt for paragraph content
			if (((StTxtPara)text.ParagraphsOS.FirstItem).Contents.Text == null)
			{
				vwenv.NoteDependency(new int[] { hvo },
					new int[] { (int)StTxtPara.StTxtParaTags.kflidContents}, 1);
				vwenv.AddProp(SimpleRootSite.kTagUserPrompt, this, text.OwningFlid);
				return true;
			}

			return false;
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:50,代码来源:TeStVc.cs

示例11: InsertTranslationUserPrompt

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Check the given translation to see if the text is empty. If so, then insert a
		/// user prompt.
		/// </summary>
		/// <param name="vwenv">view environment</param>
		/// <param name="hvo">id of translation to be displayed</param>
		/// <returns>true if an empty string was substituted for missing/empty StText</returns>
		/// ------------------------------------------------------------------------------------
		protected override bool InsertTranslationUserPrompt(IVwEnv vwenv, int hvo)
		{
			// No user prompt in any of these conditions
			if (hvo == 0
				|| Cache.GetClassOfObject(hvo) != (int)CmTranslation.kClassId
				|| m_updatedPrompts.Contains(hvo)) // user interaction has updated prompt
			{
				return false;
			}

			// If there is text in the translation then do not add a prompt.
			CmTranslation trans = new CmTranslation(Cache, hvo);
			if (trans.Translation.GetAlternative(m_wsDefault).Text != null)
				return false;

			// If there is no text in the parent paragraph then do not place a prompt in the
			// back translation.
			StTxtPara parentPara = new StTxtPara(Cache, trans.OwnerHVO);
			if (parentPara.Contents.Text == null)
				return false;

			// Insert the prompt.
			vwenv.NoteDependency(new int[] { hvo },
				new int[] { (int)CmTranslation.CmTranslationTags.kflidTranslation}, 1);
			vwenv.AddProp(SimpleRootSite.kTagUserPrompt, this,
				(int)CmTranslation.CmTranslationTags.kflidTranslation);
			return true;
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:37,代码来源:TeStVc.cs

示例12: Display


//.........这里部分代码省略.........
						(int)StTextFrags.kfrFootnotePara);
					break;
				}

				case (int)StTextFrags.kfrText:
				{
					if (HandleEmptyText(vwenv, hvo))
						break;
					if (m_fLazy)
					{
						vwenv.AddLazyVecItems((int)StText.StTextTags.kflidParagraphs, this,
							(int)StTextFrags.kfrPara);
					}
					else
					{
						vwenv.AddObjVecItems((int)StText.StTextTags.kflidParagraphs, this,
							(int)StTextFrags.kfrPara);
					}
					break;
				}
				case (int)StTextFrags.kfrFootnoteMarker:
				{
					StFootnote footnote = new StFootnote(Cache, hvo);
					if (footnote.DisplayFootnoteMarker)
						DisplayFootnoteMarker(vwenv);
					break;
				}
				case (int)StTextFrags.kfrLabel:
				{
					// The label is not editable.
					vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
						(int)FwTextPropVar.ktpvEnum,
						(int)TptEditable.ktptNotEditable);
					vwenv.AddString(m_tssLabel);
					break;
				}

				case (int)StTextFrags.kfrPara:
				case (int)StTextFrags.kfrFootnotePara:
				{
					InsertParagraphBody(vwenv, hvo, frag, true, ContentType, this);
					break;
				}

				case (int)StTextFrags.kfrTranslation:
				{
					vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
						(int)FwTextPropVar.ktpvEnum,
						Editable ? (int)TptEditable.ktptIsEditable
						: (int)TptEditable.ktptNotEditable);
					// Display the translation, or its user prompt
					if (!InsertTranslationUserPrompt(vwenv, hvo))
					{
						vwenv.AddStringAltMember((int)CmTranslation.CmTranslationTags.kflidTranslation,
							m_wsDefault, this);
					}
					break;
				}
				case (int)StTextFrags.kfrSegmentFreeTranslations:
					// Hvo is a CmBaseAnnotation of one segment of an StTxtPara.
					if (IsLabelSegment(hvo))
					{
						CmBaseAnnotation segment = (CmBaseAnnotation)CmBaseAnnotation.CreateFromDBObject(Cache, hvo, false);
						vwenv.AddString(GetBackTransLabelText(segment));
						vwenv.AddSimpleRect(ColorUtil.ConvertColorToBGR(this.BackColor), 1200, 0, 0); // a narrow space, font-neutral
					}
					else
					{
						vwenv.AddObjProp(StTxtPara.SegmentFreeTranslationFlid(Cache), this, (int)StTextFrags.kfrFreeTrans);
						vwenv.AddString(OneSpaceString);
					}
					break;
				case (int)StTextFrags.kfrFreeTrans:
					// Hvo is a CmIndirectAnnotation whose Contents are the free/back translation.
					vwenv.set_IntProperty((int)FwTextPropType.ktptBackColor, (int)FwTextPropVar.ktpvDefault,
						(int)ColorUtil.ConvertColorToBGR(SystemColors.Window));
					ITsString tssVal = vwenv.DataAccess.get_MultiStringAlt(hvo,
						(int) CmAnnotation.CmAnnotationTags.kflidComment, BackTranslationWS);
					if (tssVal.Length == 0 && !SuppressPrompt(hvo, (int)CmAnnotation.CmAnnotationTags.kflidComment))
					{
						vwenv.NoteDependency(new int[] {hvo}, new int[] {(int)CmAnnotation.CmAnnotationTags.kflidComment}, 1);
						vwenv.AddProp(SimpleRootSite.kTagUserPrompt, this, (int)CmAnnotation.CmAnnotationTags.kflidComment);
						// Almost invisibly narrow, but the Views code doesn't know it is invisible so it should prevent the prompts collapsing
						// into the margin.
						vwenv.AddSimpleRect(ColorUtil.ConvertColorToBGR(this.BackColor), 100, 0, 0);
					}
					else
					{
						ITsStrBldr bldr = tssVal.GetBldr();
						bldr.Replace(0, bldr.Length, "", null); // reduce to empty string in ws.
						// We want it to change back to the prompt if all is deleted.
						vwenv.NoteStringValDependency(hvo, (int) CmAnnotation.CmAnnotationTags.kflidComment, BackTranslationWS, bldr.GetString());
						vwenv.AddStringAltMember((int)CmAnnotation.CmAnnotationTags.kflidComment, BackTranslationWS, this);
						// This little separator is useful here, too. Temporarily the comment may be displayed this way even when empty,
						// and if there is ordinary text following, it is difficult to get an IP displayed in an empty run.
						vwenv.AddSimpleRect(ColorUtil.ConvertColorToBGR(this.BackColor), 100, 0, 0);
					}
					break;
			}
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:101,代码来源:StVc.cs

示例13: Display

		public override void Display(IVwEnv vwenv, int hvo, int frag)
		{
			CheckDisposed();
			switch (frag)
			{
				case kfragRHS:
					m_rhs = new PhSegRuleRHS(m_cache, hvo);
					IPhRegularRule rule = new PhRegularRule(m_cache, m_rhs.OwnerHVO);

					int arrowWidth, slashWidth, underscoreWidth, charHeight;
					vwenv.get_StringWidth(m_arrow, m_charProps, out arrowWidth, out charHeight);
					int maxCharHeight = charHeight;
					vwenv.get_StringWidth(m_slash, m_charProps, out slashWidth, out charHeight);
					maxCharHeight = Math.Max(charHeight, maxCharHeight);
					vwenv.get_StringWidth(m_underscore, m_charProps, out underscoreWidth, out charHeight);
					maxCharHeight = Math.Max(charHeight, maxCharHeight);

					int dmpx, spaceHeight;
					vwenv.get_StringWidth(m_zwSpace, m_bracketProps, out dmpx, out spaceHeight);

					int maxNumLines = MaxNumLines;
					int maxCtxtHeight = maxNumLines * spaceHeight;

					int maxHeight = Math.Max(maxCharHeight, maxCtxtHeight);
					int charOffset = maxHeight;
					int ctxtPadding = maxHeight - maxCtxtHeight;

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

					VwLength ctxtLen;
					ctxtLen.nVal = 1;
					ctxtLen.unit = VwUnit.kunRelative;
					VwLength charLen;
					charLen.unit = VwUnit.kunPoint1000;
					vwenv.MakeColumns(1, ctxtLen);

					charLen.nVal = arrowWidth + 4000;
					vwenv.MakeColumns(1, charLen);

					vwenv.MakeColumns(1, ctxtLen);

					charLen.nVal = slashWidth + 4000;
					vwenv.MakeColumns(1, charLen);

					vwenv.MakeColumns(1, ctxtLen);

					charLen.nVal = underscoreWidth + 4000;
					vwenv.MakeColumns(1, charLen);

					vwenv.MakeColumns(1, ctxtLen);

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

					// LHS cell
					vwenv.Props = m_ctxtProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop, (int)FwTextPropVar.ktpvMilliPoint, ctxtPadding);
					vwenv.OpenTableCell(1, 1);
					vwenv.OpenParagraph();
					vwenv.AddObjProp(m_cache.GetFlid(hvo, null, "OwningRule"), this, kfragRule);
					vwenv.CloseParagraph();
					vwenv.CloseTableCell();

					// arrow cell
					vwenv.Props = m_charProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptOffset, (int)FwTextPropVar.ktpvMilliPoint, -charOffset);
					vwenv.OpenTableCell(1, 1);
					vwenv.AddString(m_arrow);
					vwenv.CloseTableCell();

					// RHS cell
					vwenv.Props = m_ctxtProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop, (int)FwTextPropVar.ktpvMilliPoint, ctxtPadding);
					vwenv.OpenTableCell(1, 1);
					vwenv.OpenParagraph();
					if (m_cache.GetVectorSize(hvo, (int)PhSegRuleRHS.PhSegRuleRHSTags.kflidStrucChange) > 0)
					{
						vwenv.AddObjVecItems((int)PhSegRuleRHS.PhSegRuleRHSTags.kflidStrucChange, this, kfragContext);
					}
					else
					{
						OpenContextPile(vwenv, false);
						vwenv.Props = m_bracketProps;
						vwenv.AddProp((int)PhSegRuleRHS.PhSegRuleRHSTags.kflidStrucChange, this, kfragEmpty);
						CloseContextPile(vwenv, false);
					}
					vwenv.CloseParagraph();
					vwenv.CloseTableCell();

					// slash cell
					vwenv.Props = m_charProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptOffset, (int)FwTextPropVar.ktpvMilliPoint, -charOffset);
					vwenv.OpenTableCell(1, 1);
					vwenv.AddString(m_slash);
					vwenv.CloseTableCell();

					// left context cell
//.........这里部分代码省略.........
开发者ID:sillsdev,项目名称:WorldPad,代码行数:101,代码来源:RegRuleFormulaControl.cs

示例14: AddAnalysisPos

		/// <summary>
		/// Assuming the current object is hvoAnalysis, add a display of its Category property,
		/// the WordPOS line of the interlinear display.
		/// If choiceOffset is -1, display the current analysis writing systems, otherwise,
		/// display the one indicated.
		/// </summary>
		/// <param name="vwenv"></param>
		/// <param name="hvoAnalysis"></param>
		protected void AddAnalysisPos(IVwEnv vwenv, int hvoAnalysis, int choiceIndex)
		{
			int hvoPos = m_cache.GetObjProperty(hvoAnalysis, (int)WfiAnalysis.WfiAnalysisTags.kflidCategory);
			SetColor(vwenv, LabelRGBFor(choiceIndex));
			if (hvoPos == 0)
			{
				vwenv.OpenParagraph();
				vwenv.NoteDependency(new int[] {hvoAnalysis},
					new int[] {(int)WfiAnalysis.WfiAnalysisTags.kflidCategory}, 1);
				vwenv.AddProp(ktagAnalysisMissingPos, this, kfragAnalysisMissingPos);
				vwenv.CloseParagraph();
			}
			else if (choiceIndex < 0)
			{
				vwenv.AddObjProp((int)WfiAnalysis.WfiAnalysisTags.kflidCategory, this, kfragCategory);
			}
			else
			{
				vwenv.AddObjProp((int)WfiAnalysis.WfiAnalysisTags.kflidCategory, this, kfragLineChoices + choiceIndex);
			}
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:29,代码来源:InterlinVc.cs

示例15: DisplayInflFeatures

		private void DisplayInflFeatures(IVwEnv vwenv, IDictionary<IFsFeatDefn, object> inflFeatures)
		{
			int numLines = GetNumLines(inflFeatures);
			if (numLines == 1)
			{
				// use normal brackets for a single line constraint
				vwenv.AddProp(ktagInnerNonBoundary, this, kfragLeftBracket);

				DisplayInflFeatureLines(vwenv, inflFeatures, false);

				vwenv.AddProp(ktagInnerNonBoundary, this, kfragRightBracket);
			}
			else
			{
				// left bracket pile
				vwenv.Props = m_bracketProps;
				vwenv.set_IntProperty((int) FwTextPropType.ktptMarginLeading, (int) FwTextPropVar.ktpvMilliPoint, PileMargin);
				vwenv.OpenInnerPile();
				vwenv.AddProp(ktagLeftNonBoundary, this, kfragLeftBracketUpHook);
				for (int i = 1; i < numLines - 1; i++)
					vwenv.AddProp(ktagLeftNonBoundary, this, kfragLeftBracketExt);
				vwenv.AddProp(ktagLeftBoundary, this, kfragLeftBracketLowHook);
				vwenv.CloseInnerPile();

				// feature pile
				vwenv.set_IntProperty((int) FwTextPropType.ktptAlign, (int) FwTextPropVar.ktpvEnum, (int) FwTextAlign.ktalLeft);
				vwenv.OpenInnerPile();
				DisplayInflFeatureLines(vwenv, inflFeatures, true);
				vwenv.CloseInnerPile();

				// right bracket pile
				vwenv.Props = m_bracketProps;
				vwenv.set_IntProperty((int) FwTextPropType.ktptMarginTrailing, (int) FwTextPropVar.ktpvMilliPoint, PileMargin);
				vwenv.OpenInnerPile();
				vwenv.AddProp(ktagInnerNonBoundary, this, kfragRightBracketUpHook);
				for (int i = 1; i < numLines - 1; i++)
					vwenv.AddProp(ktagInnerNonBoundary, this, kfragRightBracketExt);
				vwenv.AddProp(ktagInnerNonBoundary, this, kfragRightBracketLowHook);
				vwenv.CloseInnerPile();
			}
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:41,代码来源:ComplexConcPatternVc.cs


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