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


C# IVwEnv.OpenInnerPile方法代码示例

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


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

示例1: Display

		public override void Display(IVwEnv vwenv, int hvo, int frag)
		{
			switch (frag)
			{
				default:
					break;
				case InterlinearView.kfrText:
					vwenv.OpenParagraph();
					vwenv.AddObjVecItems(InterlinearView.ktagText_Words, this, InterlinearView.kfrWord);
					vwenv.CloseParagraph();
					break;
				case InterlinearView.kfrWord:
					vwenv.set_IntProperty((int)FwKernelLib.FwTextPropType.ktptMarginTrailing,
												(int)FwKernelLib.FwTextPropVar.ktpvMilliPoint, 10000);
					vwenv.OpenInnerPile();
					vwenv.AddStringProp(InterlinearView.ktagWord_Form, this);
					vwenv.AddStringProp(InterlinearView.ktagWord_Type, this);
					vwenv.CloseInnerPile();
					break;
			}
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:21,代码来源:InterlinearVc.cs

示例2: AddTableCell


//.........这里部分代码省略.........

			bool fIsCellActive = false;
			if (icolActive != 0 && m_PreviewArrowPic != null)
			{
				// The display depends on which column is active and whether the current row is selected.
				vwenv.NoteDependency(new int[] { hvoRoot, hvo, hvo }, new int[] { ktagActiveColumn, ktagItemSelected, ktagItemEnabled }, 3);
				// We're doing the active column thing.
				if (icol == icolActive)
				{
					fIsCellActive = vwenv.DataAccess.get_IntProp(hvo, ktagItemSelected) != 0
						&& vwenv.DataAccess.get_IntProp(hvo, ktagItemEnabled) != 0;
				}
			}
			// Make a cell and embed the contents of the column node.
			ProcessProperties(node, vwenv);
			SetCellProperties(index, icol, node, hvo, vwenv, fIsCellActive);
			vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop,
				(int)FwTextPropVar.ktpvMilliPoint, 1607);
			vwenv.OpenTableCell(1, 1);
			vwenv.set_IntProperty((int)FwTextPropType.ktptPadTrailing,
				(int)FwTextPropVar.ktpvMilliPoint, 1607);
			vwenv.set_IntProperty((int)FwTextPropType.ktptPadLeading,
				(int)FwTextPropVar.ktpvMilliPoint, 1607);
			if (node.Name == "column")
			{
				// Paragraph directionality must be set before the paragraph is opened.
				vwenv.set_IntProperty((int)FwTextPropType.ktptRightToLeft,
					(int)FwTextPropVar.ktpvEnum, IsWritingSystemRTL(node) ? -1 : 0);
			}

			// According to LT-8947, in bulk edit preview mode, we want to try to show the
			// original cell contents on the same line with the preview arrow and the new cell contents.
			// to accomplish this, we use 3 InnerPiles in a paragraph
			// to try to keep them on the same line (or wrap otherwise).
			// NOTE: the bottom two inner piles will only be present if fIsCellActive is true.
			//
			// <Paragraph>
			//		<InnerPile>
			//			<paragraph> Original cell contents </paragraph>
			//		</InnerPile>
			//		<InnerPile>
			//			<paragraph> Arrow Picture </paragraph>
			//		</InnerPile>
			//		<InnerPile>
			//			<paragraph> Alternate cell contents </paragraph>
			//		</InnerPile>
			// </Paragraph>
			//

			vwenv.OpenParagraph();			// <Paragraph>
			bool multiPara = XmlUtils.GetOptionalBooleanAttributeValue(node, "multipara", false);
			vwenv.OpenInnerPile();			//		<InnerPile>
			// if the multi-para attribute is not specified, create a paragraph to wrap the cell contents.
			bool fParaOpened = false;
			if (!multiPara)
			{
				vwenv.OpenParagraph();		//			<paragraph>
				fParaOpened = true;
			}

			if (m_sortItemProvider == null)
			{
				try
				{
					if (node.Name == "column")
					{
						SetForcedWs(node);
					}
					XmlNode nodeToProcess = GetColumnNode(node, hvo, m_cache.MainCacheAccessor, m_layouts);
					ProcessChildren(nodeToProcess, vwenv, hvo, null);
				}
				finally
				{
					// reset the ws for next column in the row.
					WsForce = 0;
				}
			}
			else
			{
				int level = vwenv.EmbeddingLevel;
				int hvoDum, tag, ihvo;
				vwenv.GetOuterObject(level - 2, out hvoDum, out tag, out ihvo);
				Debug.Assert(tag == m_fakeFlid);
				ManyOnePathSortItem item = m_sortItemProvider.SortItemAt(ihvo);
				if (item != null)
					DisplayCell(item, node, hvo, vwenv);	// (Original) cell contents
			}

			if (fParaOpened)
			{
				vwenv.CloseParagraph();		//			   (Original) cell contents </paragraph>
				fParaOpened = false;
			}
			vwenv.CloseInnerPile();			//		</InnerPile>
			if (fIsCellActive)
				AddPreviewPiles(vwenv, node);
			vwenv.CloseParagraph();			// </Paragraph>
			vwenv.CloseTableCell();
			m_wsBest = 0;
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:101,代码来源:XmlBrowseViewBaseVc.cs

示例3: 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

示例4: SetupAndOpenInnerPile

		/// <summary>
		/// Setup a box with 10 points behind and 5 under and open the inner pile
		/// </summary>
		/// <param name="vwenv"></param>
		protected virtual void SetupAndOpenInnerPile(IVwEnv vwenv)
		{
			// Make an 'inner pile' to contain the wordform and annotations.
			// Give whatever box we make 10 points of separation from whatever follows.
			vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTrailing,
								  (int)FwTextPropVar.ktpvMilliPoint, 10000);
			// 5 points below also helps space out the paragraph.
			vwenv.set_IntProperty((int)FwTextPropType.ktptMarginBottom,
								  (int)FwTextPropVar.ktpvMilliPoint, 5000);
			vwenv.OpenInnerPile();
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:15,代码来源:InterlinVc.cs

示例5: AddLabelPile

		/// <summary>
		/// Add the pile of labels used to identify the lines in interlinear text.
		/// </summary>
		/// <param name="vwenv"></param>
		/// <param name="tsf"></param>
		/// <param name="cache"></param>
		/// <param name="wsList">Null if don't want multiple writing systems.</param>
		/// <param name="fShowMutlilingGlosses"></param>
		public void AddLabelPile(IVwEnv vwenv, ITsStrFactory tsf, FdoCache cache,
			bool fWantMultipleSenseGloss, bool fShowMorphemes)
		{
			CheckDisposed();

			int wsUI = cache.DefaultUserWs;
			var spaceStr = TsStringUtils.MakeTss(" ", wsUI);
			vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTrailing,
				(int)FwTextPropVar.ktpvMilliPoint, 10000);
			vwenv.set_IntProperty((int)FwTextPropType.ktptBold,
				(int)FwTextPropVar.ktpvEnum,
				(int)FwTextToggleVal.kttvForceOn);
			vwenv.set_IntProperty((int)FwTextPropType.ktptMarginBottom,
				(int)FwTextPropVar.ktpvMilliPoint,
				5000); // default spacing is fine for all embedded paragraphs.
			vwenv.OpenInnerPile();
			for (var i = 0; i < m_lineChoices.Count; i++)
			{
				InterlinLineSpec spec = m_lineChoices[i];
				if (!spec.WordLevel)
					break;
				SetColor(vwenv, LabelRGBFor(spec));
				ITsString tss = MakeUiElementString(m_lineChoices.LabelFor(spec.Flid), wsUI, null);
				var bldr = tss.GetBldr();
				if (m_lineChoices.RepetitionsOfFlid(spec.Flid) > 1)
				{
					bldr.Append(spaceStr);
					bldr.Append(spec.WsLabel(cache));
					AddLineIndexProperty(bldr, i);
					// Enhance GJM: Might be able to do without paragraph now?
					vwenv.OpenParagraph();
					vwenv.AddString(bldr.GetString());
					vwenv.CloseParagraph();
				}
				else
				{
					AddLineIndexProperty(bldr, i);
					vwenv.AddString(bldr.GetString());
				}

			}
			vwenv.CloseInnerPile();
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:51,代码来源:InterlinVc.cs

示例6: DisplayMorphBundle

		/// <summary>
		/// Displays a MorphBundle, setting the colors of its parts.
		/// </summary>
		/// <param name="vwenv"></param>
		/// <param name="hvo">WfiMorphBundle</param>
		private void DisplayMorphBundle(IVwEnv vwenv, int hvo)
		{
			IWfiMorphBundle wmb = null;
			if (hvo != 0)
				wmb = m_wmbRepository.GetObject(hvo);
			vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTrailing,
				(int)FwTextPropVar.ktpvMilliPoint, 10000);
			vwenv.OpenInnerPile();
			int first = m_lineChoices.FirstMorphemeIndex;
			int last = m_lineChoices.LastMorphemeIndex;
			IMoForm mf = null;
			if (wmb != null)
				mf = wmb.MorphRA;
			if (vwenv is CollectorEnv && mf != null)
			{
				// Collectors are given an extra initial chance to 'collect' the morph type, if any.
				vwenv.AddObjProp(WfiMorphBundleTags.kflidMorph,
					this, kfragMorphType);

			}
			for (int i = first; i <= last; i++)
			{
				InterlinLineSpec spec = m_lineChoices[i];
				SetColor(vwenv, LabelRGBFor(spec));
				switch (spec.Flid)
				{
					case InterlinLineChoices.kflidMorphemes:
						if (wmb == null)
						{
							vwenv.AddString(m_tssMissingMorph);
						}
						else if (mf == null)
						{
							// displaying morphemes should be
							int ws = 0;
							if (wmb.MorphRA != null)
							{
								Debug.Assert(spec.StringFlid == MoFormTags.kflidForm);
								ws = GetRealWsOrBestWsForContext(wmb.MorphRA.Hvo, spec);
							}
							// If no morph, use the form of the morph bundle (and the entry is of
							// course missing)
							if (ws == 0)
							{
								ws = WritingSystemServices.ActualWs(m_cache, spec.WritingSystem, wmb.Hvo,
									WfiMorphBundleTags.kflidForm);
							}
							vwenv.AddStringAltMember(
								WfiMorphBundleTags.kflidForm, ws, this);
						}
						else
						{
							// Got a morph, show it.
							vwenv.AddObjProp(WfiMorphBundleTags.kflidMorph,
								this, kfragMorphFormChoices + i);
							// And the LexEntry line.
						}
						break;
					case InterlinLineChoices.kflidLexEntries:
						if (mf == null)
						{
							if (hvo != 0)
								vwenv.NoteDependency(new int[] { hvo }, new int[] { WfiMorphBundleTags.kflidMorph }, 1);
							vwenv.AddString(m_tssMissingEntry);
						}
						else
						{
							int ws = GetRealWsOrBestWsForContext(mf.Hvo, spec);
							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 flid = 0;
						if (wmb != null)
						{
							vwenv.NoteDependency(new[] { wmb.Hvo }, new[] { WfiMorphBundleTags.kflidMorph }, 1);
							vwenv.NoteDependency(new[] { wmb.Hvo }, new[] { WfiMorphBundleTags.kflidInflType }, 1);
							vwenv.NoteDependency(new[] { hvo }, new[] { WfiMorphBundleTags.kflidSense }, 1);
							if (wmb.SenseRA == null)
							{
								if (ShowDefaultSense && wmb.DefaultSense != null && UsingGuess)
								{
									flid = wmb.Cache.MetaDataCacheAccessor.GetFieldId2(WfiMorphBundleTags.kClassId,
										"DefaultSense", false);
								}
							}
							else
							{
								flid = WfiMorphBundleTags.kflidSense;
								if (wmb.MorphRA != null &&
									DisplayLexGlossWithInflType(vwenv, wmb.MorphRA.Owner as ILexEntry, wmb.SenseRA, spec, wmb.InflTypeRA))
//.........这里部分代码省略.........
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:101,代码来源:InterlinVc.cs

示例7: Display

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Display a view of the LexEntry (or fragment thereof).
		/// </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)VcFrags.kfragHeadWord:
					// This case should stay in sync with
					// LexEntry.LexemeFormMorphTypeAndHomographStatic
					vwenv.OpenParagraph();
					AddHeadwordWithHomograph(vwenv, hvo);
					vwenv.CloseParagraph();
					break;
				case kfragEntryAndVariant:
					var wfb = m_cache.ServiceLocator.GetInstance<IWfiMorphBundleRepository>().GetObject(hvo);
					//int hvoMf = wfb.MorphRA.Hvo;
					//int hvoLexEntry = m_cache.GetOwnerOfObject(hvoMf);
					// if morphbundle morph (entry) is in a variant relationship to the morph bundle sense
					// display its entry headword and variant type information (LT-4053)
					ILexEntryRef ler;
					var variant = wfb.MorphRA.Owner as ILexEntry;
					if (variant.IsVariantOfSenseOrOwnerEntry(wfb.SenseRA, out ler))
					{
						// build Headword from sense's entry
						vwenv.OpenParagraph();
						vwenv.OpenInnerPile();
						vwenv.AddObj(wfb.SenseRA.EntryID, this, (int)VcFrags.kfragHeadWord);
						vwenv.CloseInnerPile();
						vwenv.OpenInnerPile();
						// now add variant type info
						vwenv.AddObj(ler.Hvo, this, kfragVariantTypes);
						vwenv.CloseInnerPile();
						vwenv.CloseParagraph();
						break;
					}

					// build Headword even though we aren't in a variant relationship.
					vwenv.AddObj(variant.Hvo, this, (int)VcFrags.kfragHeadWord);
					break;
				case kfragVariantTypes:
					ler = m_cache.ServiceLocator.GetInstance<ILexEntryRefRepository>().GetObject(hvo);
					bool fNeedInitialPlus = true;
					vwenv.OpenParagraph();
					foreach (var let in ler.VariantEntryTypesRS.Where(let => let.ClassID == LexEntryTypeTags.kClassId))
					{
						// just concatenate them together separated by comma.
						ITsString tssVariantTypeRevAbbr = let.ReverseAbbr.BestAnalysisAlternative;
						if (tssVariantTypeRevAbbr != null && tssVariantTypeRevAbbr.Length > 0)
						{
							if (fNeedInitialPlus)
								vwenv.AddString(TsStringUtils.MakeTss("+", m_cache.DefaultUserWs));
							else
								vwenv.AddString(TsStringUtils.MakeTss(",", m_cache.DefaultUserWs));
							vwenv.AddString(tssVariantTypeRevAbbr);
							fNeedInitialPlus = false;
						}
					}
					vwenv.CloseParagraph();
					break;
				case kfragFormForm: // form of MoForm
					vwenv.AddStringAltMember(MoFormTags.kflidForm, m_wsActual, this);
					break;
				default:
					base.Display(vwenv, hvo, frag);
					break;
			}
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:73,代码来源:LexEntryUi.cs

示例8: Display

		public override void Display(IVwEnv vwenv, int hvo, int frag)
		{
			switch (frag)
			{
				case kfragPattern:
					VwLength tableLen;
					tableLen.nVal = 10000;
					tableLen.unit = VwUnit.kunPercent100;
					vwenv.OpenTable(1, tableLen, 0, VwAlignment.kvaCenter, VwFramePosition.kvfpVoid, VwRule.kvrlNone, 0, 0, false);
					VwLength patternLen;
					patternLen.nVal = 1;
					patternLen.unit = VwUnit.kunRelative;
					vwenv.MakeColumns(1, patternLen);
					vwenv.OpenTableBody();
					vwenv.OpenTableRow();

					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint, 1000);
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderColor, (int)FwTextPropVar.ktpvDefault, (int)ColorUtil.ConvertColorToBGR(Color.Gray));
					vwenv.set_IntProperty((int)FwTextPropType.ktptAlign, (int)FwTextPropVar.ktpvEnum, (int)FwTextAlign.ktalCenter);
					vwenv.set_IntProperty((int)FwTextPropType.ktptPadBottom, (int)FwTextPropVar.ktpvMilliPoint, 2000);
					vwenv.OpenTableCell(1, 1);
					vwenv.OpenParagraph();
					if (((ComplexConcPatternSda) vwenv.DataAccess).Root.IsLeaf)
					{
						OpenSingleLinePile(vwenv, GetMaxNumLines(vwenv), false);
						vwenv.Props = m_bracketProps;
						vwenv.AddProp(ComplexConcPatternSda.ktagChildren, this, kfragEmpty);
						CloseSingleLinePile(vwenv, false);
					}
					else
					{
						vwenv.AddObjVecItems(ComplexConcPatternSda.ktagChildren, this, kfragNode);
					}
					vwenv.CloseParagraph();
					vwenv.CloseTableCell();

					vwenv.CloseTableRow();
					vwenv.CloseTableBody();
					vwenv.CloseTable();
					break;

				case kfragNode:
					ComplexConcPatternNode node = ((ComplexConcPatternSda) vwenv.DataAccess).Nodes[hvo];
					int maxNumLines = GetMaxNumLines(vwenv);
					if (node is ComplexConcOrNode)
					{
						OpenSingleLinePile(vwenv, maxNumLines);
						vwenv.AddProp(ktagInnerNonBoundary, this, kfragOR);
						CloseSingleLinePile(vwenv, false);
					}
					else if (node is ComplexConcWordBdryNode)
					{
						OpenSingleLinePile(vwenv, maxNumLines);
						vwenv.AddProp(ktagInnerNonBoundary, this, kfragHash);
						CloseSingleLinePile(vwenv);
					}
					else if (node is ComplexConcGroupNode)
					{
						int numLines = GetNumLines(node);
						bool hasMinMax = node.Maximum != 1 || node.Minimum != 1;
						if (numLines == 1)
						{
							OpenSingleLinePile(vwenv, maxNumLines, false);
							// use normal parentheses for a single line group
							vwenv.AddProp(ktagLeftBoundary, this, kfragLeftParen);

							vwenv.AddObjVecItems(ComplexConcPatternSda.ktagChildren, this, kfragNode);

							vwenv.AddProp(hasMinMax ? ktagInnerNonBoundary : ktagRightBoundary, this, kfragRightParen);
							if (hasMinMax)
								DisplayMinMax(numLines, vwenv);
							CloseSingleLinePile(vwenv, false);
						}
						else
						{
							vwenv.Props = m_bracketProps;
							vwenv.set_IntProperty((int) FwTextPropType.ktptMarginLeading, (int) FwTextPropVar.ktpvMilliPoint, PileMargin);
							vwenv.OpenInnerPile();
							AddExtraLines(maxNumLines - numLines, ktagLeftNonBoundary, vwenv);
							vwenv.AddProp(ktagLeftNonBoundary, this, kfragLeftParenUpHook);
							for (int i = 1; i < numLines - 1; i++)
								vwenv.AddProp(ktagLeftNonBoundary, this, kfragLeftParenExt);
							vwenv.AddProp(ktagLeftBoundary, this, kfragLeftParenLowHook);
							vwenv.CloseInnerPile();

							vwenv.AddObjVecItems(ComplexConcPatternSda.ktagChildren, this, kfragNode);

							vwenv.Props = m_bracketProps;
							vwenv.set_IntProperty((int) FwTextPropType.ktptMarginTrailing, (int) FwTextPropVar.ktpvMilliPoint, PileMargin);
							vwenv.OpenInnerPile();
							AddExtraLines(maxNumLines - numLines, hasMinMax ? ktagInnerNonBoundary : ktagRightNonBoundary, vwenv);
							vwenv.AddProp(hasMinMax ? ktagInnerNonBoundary : ktagRightNonBoundary, this, kfragRightParenUpHook);
							for (int i = 1; i < numLines - 1; i++)
								vwenv.AddProp(hasMinMax ? ktagInnerNonBoundary : ktagRightNonBoundary, this, kfragRightParenExt);
							vwenv.AddProp(hasMinMax ? ktagInnerNonBoundary : ktagRightBoundary, this, kfragRightParenLowHook);
							vwenv.CloseInnerPile();
							if (hasMinMax)
								DisplayMinMax(numLines, vwenv);
						}
					}
//.........这里部分代码省略.........
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:101,代码来源:ComplexConcPatternVc.cs

示例9: OpenSingleLinePile

		private void OpenSingleLinePile(IVwEnv vwenv)
		{
			vwenv.Props = m_pileProps;
			vwenv.OpenInnerPile();
			AddExtraLines(GetMaxNumLines(vwenv) - 1, ktagLeftNonBoundary, vwenv);
			vwenv.OpenParagraph();
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:7,代码来源:ComplexConcPatternVc.cs

示例10: AddLabelPile

		/// <summary>
		/// Add the pile of labels used to identify the lines in interlinear text.
		/// </summary>
		/// <param name="vwenv"></param>
		/// <param name="tsf"></param>
		/// <param name="cache"></param>
		/// <param name="wsList">Null if don't want multiple writing systems.</param>
		/// <param name="fShowMutlilingGlosses"></param>
		public void AddLabelPile(IVwEnv vwenv, ITsStrFactory tsf, FdoCache cache,
			bool fWantMultipleSenseGloss, bool fShowMorphemes)
		{
			CheckDisposed();

			int wsUI = cache.DefaultUserWs;
			int wsAnalysis = cache.DefaultAnalWs;
			vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTrailing,
				(int)FwTextPropVar.ktpvMilliPoint, 10000);
			vwenv.set_IntProperty((int)FwTextPropType.ktptBold,
				(int)FwTextPropVar.ktpvEnum,
				(int)FwTextToggleVal.kttvForceOn);
			vwenv.set_IntProperty((int)FwTextPropType.ktptMarginBottom,
				(int)FwTextPropVar.ktpvMilliPoint,
				5000); // default spacing is fine for all embedded paragraphs.
			vwenv.OpenInnerPile();
			foreach (InterlinLineSpec spec in m_lineChoices)
			{
				if (!spec.WordLevel)
					break;
				SetColor(vwenv, LabelRGBFor(spec));
				ITsString tss = tsf.MakeString(m_lineChoices.LabelFor(spec.Flid), wsUI);
				if (m_lineChoices.RepetitionsOfFlid(spec.Flid) > 1)
				{
					vwenv.OpenParagraph();
					vwenv.AddString(tss);
					vwenv.AddString(m_cache.MakeUserTss(" "));
					vwenv.AddString(spec.WsLabel(m_cache));
					vwenv.CloseParagraph();
				}
				else
				{
					vwenv.AddString(tss);
				}

			}
			vwenv.CloseInnerPile();
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:46,代码来源:InterlinVc.cs

示例11: SetupAndOpenInnerPile

		/// <summary>
		/// Setup a box with 5 under and trailing, plus leading alignment, and open the inner pile
		/// </summary>
		/// <param name="vwenv"></param>
		protected override void SetupAndOpenInnerPile(IVwEnv vwenv)
		{
			// Make an 'inner pile' to contain the wordform and its interlinear.
			// Give whatever box we make 5 points of separation from whatever follows.
			vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTrailing,
				(int)FwTextPropVar.ktpvMilliPoint, 5000);
			// 5 points below also helps space out the paragraph.
			vwenv.set_IntProperty((int)FwTextPropType.ktptMarginBottom,
				(int)FwTextPropVar.ktpvMilliPoint, 5000);
			vwenv.set_IntProperty((int)FwTextPropType.ktptAlign, (int)FwTextPropVar.ktpvEnum,
				(int)FwTextAlign.ktalLeading);
			vwenv.OpenInnerPile();
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:17,代码来源:ConstChartBody.cs

示例12: DisplayMorphBundle

		/// <summary>
		///
		/// </summary>
		/// <param name="vwenv"></param>
		/// <param name="hvo">WfiMorphBundle</param>
		private void DisplayMorphBundle(IVwEnv vwenv, int hvo)
		{
			vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTrailing,
				(int)FwTextPropVar.ktpvMilliPoint, 10000);
			vwenv.OpenInnerPile();
			int first = m_lineChoices.FirstMorphemeIndex;
			int last = m_lineChoices.LastMorphemeIndex;
			int hvoMf = 0;
			if (hvo != 0)
			{
				hvoMf = m_cache.GetObjProperty(hvo,
					(int)WfiMorphBundle.WfiMorphBundleTags.kflidMorph);
			}
			if (vwenv is CollectorEnv && hvoMf != 0)
			{
				// Collectors are given an extra initial chance to 'collect' the morph type, if any.
				vwenv.AddObjProp((int)WfiMorphBundle.WfiMorphBundleTags.kflidMorph,
					this, kfragMorphType);

			}
			for (int i = first; i <= last; i++)
			{
				InterlinLineSpec spec = m_lineChoices[i];
				int ws = 0;
				if (hvo != 0)
				{
					ws = GetRealWs(hvo, spec);
				}
				SetColor(vwenv, LabelRGBFor(spec));
				switch (spec.Flid)
				{
					case InterlinLineChoices.kflidMorphemes:
						if (hvo == 0)
						{
							vwenv.AddString(m_tssMissingMorph);
						}
						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
							{
//.........这里部分代码省略.........
开发者ID:sillsdev,项目名称:WorldPad,代码行数:101,代码来源:InterlinVc.cs

示例13: AddSegmentReference

		/// <summary>
		/// Add a segment number appropriate to the current segment being displayed.
		/// (See LT-1236.)
		/// </summary>
		/// <param name="vwenv"></param>
		/// <param name="hvo"></param>
		private void AddSegmentReference(IVwEnv vwenv, int hvo)
		{
			ITsString tssSegNum;
			StringBuilder sbSegNum = new StringBuilder();
			int flid = 0;
			int hvoStPara = m_cache.GetObjProperty(hvo,
				(int)CmBaseAnnotation.CmBaseAnnotationTags.kflidBeginObject);
			if (hvoStPara != 0)
			{
				ISilDataAccess sda = vwenv.DataAccess;
				int cseg = sda.get_VecSize(hvoStPara, ktagParaSegments);
				int idxSeg = sda.GetObjIndex(hvoStPara, ktagParaSegments, hvo);
				int hvoStText = m_cache.GetOwnerOfObject(hvoStPara);
				if (hvoStText != 0)
					flid = m_cache.GetOwningFlidOfObject(hvoStText);
				if (flid == (int)ScrSection.ScrSectionTags.kflidContent)
				{
					if (m_scrPara == null || m_scrPara.Hvo != hvoStPara)
						m_scrPara = new ScrTxtPara(m_cache, hvoStPara);
					// With null book name and trimmed it should have just chapter:v{a,b}.
					// The {a,b} above would not be the segment identifiers we add for multiple segments in
					// a verse, but the letters indicating that the verse label is for only part of the verse.
					// There is therefore a pathological case where, say, verse 4a as labeled in the main text
					// gets another letter because 4a has multiple segments 4aa, 4ab, etc.
					string chapRef = AnnotationRefHandler.FullScrRef(m_scrPara, hvo, "").Trim();
					sbSegNum.Append(chapRef + AnnotationRefHandler.VerseSegLabel(m_scrPara, idxSeg, ktagParaSegments));
				}
				else
				{
					int idxPara = m_cache.GetObjIndex(hvoStText, (int)StText.StTextTags.kflidParagraphs, hvoStPara);
					if (idxPara >= 0)
					{
						sbSegNum.AppendFormat("{0}", idxPara + 1);
						if (idxSeg >= 0 && cseg > 1)
							sbSegNum.AppendFormat(".{0}", idxSeg + 1);
					}
				}
			}
			ITsStrBldr tsbSegNum = m_tsf.GetBldr();
			tsbSegNum.ReplaceTsString(0, tsbSegNum.Length, m_cache.MakeUserTss(sbSegNum.ToString()));
			tsbSegNum.SetIntPropValues(0, tsbSegNum.Length, (int)FwTextPropType.ktptBold,
				(int)FwTextPropVar.ktpvEnum, (int)FwTextToggleVal.kttvForceOn);
			tssSegNum = tsbSegNum.GetString();
			vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTrailing,
				(int)FwTextPropVar.ktpvMilliPoint, 10000);
			vwenv.set_IntProperty((int)FwTextPropType.ktptForeColor,
				(int)FwTextPropVar.ktpvDefault, (int)CmObjectUi.RGB(SystemColors.ControlText));
			try
			{
				m_fIsAddingSegmentReference = true;
				vwenv.OpenInnerPile();
				vwenv.AddString(tssSegNum);
				vwenv.CloseInnerPile();
			}
			finally
			{
				m_fIsAddingSegmentReference = false;
			}
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:65,代码来源:InterlinVc.cs

示例14: Display


//.........这里部分代码省略.........
				// reconstructing the data and cache. Otherwise we can crash.
				if (m_rootsite != null && !m_rootsite.AllowLayout)
					return;
				// set the display WS here even though it is set in the paragraph frag, since this frag might
				// get called on its own during a prop update
				int paraHvo = m_cache.GetObjProperty(hvo, (int)CmBaseAnnotation.CmBaseAnnotationTags.kflidBeginObject);
				if (paraHvo != 0)
					PreferredVernWs = m_cache.LangProject.ActualWs(LangProject.kwsVernInParagraph, paraHvo, ktagParaSegments);
				SetupForTwfic(hvo);
				// Give whatever box we make 10 points of separation from whatever follows.
				vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTrailing,
					(int)FwTextPropVar.ktpvMilliPoint, 10000);
				if (hvo == m_hvoSandboxAnnotation)
				{
					// Leave room for the Sandbox instead of displaying the internlinear data.
					// The first argument makes it invisible in case a little bit of it shows around
					// the sandbox.
					// The last argument puts the 'Baseline' of the sandbox (which aligns with the base of the
					// first line of text) an appropriate distance from the top of the Sandbox. This aligns it's
					// top line of text properly.
					// Enhance JohnT: 90% of font height is not always exactly right, but it's the closest
					// I can get wihtout a new API to get the exact ascent of the font.
					int dympBaseline = SIL.FieldWorks.Common.Widgets.FontHeightAdjuster.GetFontHeightForStyle("Normal", m_stylesheet,
						m_wsCurrentTwfic, m_cache.LanguageWritingSystemFactoryAccessor) * 9 / 10;
					vwenv.AddSimpleRect(0xC0000000, // FwTextColor.kclrTransparent won't convert to uint
						SandboxSize.Width, SandboxSize.Height, -(SandboxSize.Height - dympBaseline));
					SetupForTwfic(0);
					break;
				}
				// Make an 'inner pile' to contain the wordform and annotations.
				// 10 points below also helps space out the paragraph.
				vwenv.set_IntProperty((int)FwTextPropType.ktptMarginBottom,
					(int)FwTextPropVar.ktpvMilliPoint, 5000);
				vwenv.OpenInnerPile();
				// Get the instanceOf property of the annotation and see whether it exists. If not it is
				// just a punctuation annotation, and we just insert the form.
				vwenv.NoteDependency(new int[] { hvo }, new int[] { InterlinDocChild.TagAnalysis }, 1);
				int hvoInstanceOf = vwenv.DataAccess.get_ObjectProp(hvo, InterlinDocChild.TagAnalysis);
				// Treat a non-vernacular word as unconnected to any kind of analysis.
				if (m_wsCurrentTwfic != m_wsVernForDisplay || !m_vernWss.Contains(m_wsCurrentTwfic))
				{
					// Cf CanBeAnalyzed method.
					hvoInstanceOf = 0;
				}
				if (hvoInstanceOf == 0)
				{
					vwenv.AddStringProp(m_flidStringValue, this);
				}
				else
				{
					// It's a full Twfic annotation, display the full bundle.
					vwenv.AddObjProp(InterlinDocChild.TagAnalysis,	this, kfragTwficAnalysis);
				}
				AddExtraTwficRows(vwenv, hvo);
				//vwenv.AddObjProp(ktagTwficDefault, this, kfragTwficAnalysis);
				vwenv.CloseInnerPile();
				// revert back to the paragraph vernWs.
				SetupForTwfic(0);
				break;
			case kfragTwficAnalysis:
				new DisplayWordBundleMethod(vwenv, hvo, this, tagRealForm).Run();
				break;
			case kfragIsolatedAnalysis: // This one is used for an isolated HVO that is surely an analyis.
			{
				// In some ways this is a simplified kfragTwficAnalysis.
				vwenv.AddObj(m_cache.GetOwnerOfObject(hvo), this, kfragWordformForm);
开发者ID:sillsdev,项目名称:WorldPad,代码行数:67,代码来源:InterlinVc.cs

示例15: DisplayWordform

			private void DisplayWordform(IVwEnv vwenv, int ws, int choiceIndex)
			{
				// For the wordform line we only want an icon on the first line (which is always wordform).
				bool fWantIcon = m_sandbox.ShowAnalysisCombo && choiceIndex == 0;
				// This has to be BEFORE we open the paragraph, so the indent applies to the whole
				// paragraph, and not some string box inside it.
				if (!fWantIcon)
					SetIndentForMissingIcon(vwenv);
				vwenv.OpenParagraph();
				// The actual icon, if present, has to be INSIDE the paragraph.
				if (fWantIcon)
					AddPullDownIcon(vwenv, ktagAnalysisIcon);
				//Set the background of the wordform to the 'WordFormBGColor' which is set when ChangeOrCreateSandbox
				//is called
				SetBGColor(vwenv, MultipleOptionBGColor);
				if (ws != m_sandbox.RawWordformWs)
				{
					// Any other Ws we can edit.
					MakeNextFlowObjectEditable(vwenv);
					vwenv.OpenInnerPile(); // So white background occupies full width
					vwenv.AddStringAltMember(ktagSbWordForm, ws, this);
					vwenv.CloseInnerPile();
				}
				else
				{
					MakeNextFlowObjectReadOnly(vwenv);
					//vwenv.AddString(m_sandbox.RawWordform);
					vwenv.AddStringAltMember(ktagSbWordForm, ws, this);
				}
				vwenv.CloseParagraph();
			}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:31,代码来源:SandboxBase.SandboxVc.cs


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