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


C# IVwEnv.AddStringAltMember方法代码示例

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


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

示例1: AddEditCell

		private void AddEditCell(IVwEnv vwenv, IVwCacheDa cda, int i)
		{
			string sField = ksEditColumnBaseName + i;
			XmlNode node = m_columns[i - 1] as XmlNode;
			// Make a cell and embed an editable virtual string for the column.
			vwenv.OpenTableCell(1, 1);
			// Initialize the virtual property.
			IVwVirtualHandler vh = cda.GetVirtualHandlerName(EditRowModelClass, sField);
			Debug.Assert(vh != null);
			int flid = (int)m_mdc.GetFieldId(EditRowModelClass, sField, false);
			int ws = LangProject.GetWritingSystem(node, m_cache, null, m_cache.DefaultAnalWs);

			// Paragraph directionality must be set before the paragraph is opened.
			bool fRTL = IsWsRTL(ws);
			vwenv.set_IntProperty((int)FwTextPropType.ktptRightToLeft,
				(int)FwTextPropVar.ktpvEnum, fRTL ? -1 : 0);
			vwenv.set_IntProperty((int)FwTextPropType.ktptAlign,
				(int)FwTextPropVar.ktpvEnum,
				fRTL ? (int)FwTextAlign.ktalRight : (int)FwTextAlign.ktalLeft);

			vh.Load(khvoNewItem, flid, ws, cda);
			// Fill in the cell with the virtual property.
			vwenv.OpenParagraph();
			vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
				(int)FwTextPropVar.ktpvEnum,
				(int)TptEditable.ktptIsEditable);
			vwenv.AddStringAltMember(flid, ws, this);
			vwenv.CloseParagraph();
			vwenv.CloseTableCell();
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:30,代码来源:XmlRDEBrowseViewVc.cs

示例2: Display

		/// ------------------------------------------------------------------------------------
		/// <summary>
		///
		/// </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 kfragRoot: // the root; Display the paragraph
					using (new VwConstructorServices.ParagraphBoxHelper(vwenv,
							() =>
								{
									if (m_displayOptions.ReadOnlyView)
									{
										vwenv.set_IntProperty(
										(int)FwTextPropType.ktptEditable,
										(int)FwTextPropVar.ktpvEnum,
										(int)TptEditable.ktptNotEditable);
									}
								}))
					{
						if (m_displayOptions.LiteralStringLabels)
						{
							using (new VwConstructorServices.InnerPileHelper(vwenv))
							{
								ITsStrFactory factory = TsStrFactoryClass.Create();
								foreach (var ws in WsOrder)
								{
									using (new VwConstructorServices.ParagraphBoxHelper(vwenv))
									{
										if (m_displayOptions.LiteralStringLabels)
											vwenv.AddString(factory.MakeString("Label" + ws, ws));
									}
								}
							}
						}
						using (new VwConstructorServices.InnerPileHelper(vwenv))
						{
							ITsStrFactory factory = TsStrFactoryClass.Create();
							foreach (var ws in WsOrder)
							{
								using (new VwConstructorServices.ParagraphBoxHelper(vwenv))
								{
									//if (m_displayOptions.LiteralStringLabels)
									//    vwenv.AddString(factory.MakeString("Label" + ws, ws));
									vwenv.AddStringAltMember(kflidMultiString, ws, null);
								}
							}
						}
					}

					break;
				default:
					throw new ApplicationException("Unexpected frag in SimpleRootSiteDataProviderVc");
			}
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:60,代码来源:SimpleRootSiteDataProviderView.cs

示例3: Display


//.........这里部分代码省略.........
							vwenv.set_IntProperty((int)FwTextPropType.ktptFontSize,
								(int)FwTextPropVar.ktpvMilliPoint, 10000);
							vwenv.AddString(m_tssTitle);
						}
						vwenv.CloseTableCell();

						// Second cell has ws labels.
						vwenv.set_IntProperty((int)FwTextPropType.ktptBackColor,
							(int) FwTextPropVar.ktpvDefault, m_editBackColor);
						vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading,
							(int)FwTextPropVar.ktpvMilliPoint, 1000);
						if (i == 0)
							vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop,
								(int)FwTextPropVar.ktpvMilliPoint, 1000);
						if (i == m_writingSystems.Length - 1)
							vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom,
								(int)FwTextPropVar.ktpvMilliPoint, 1000);
						vwenv.OpenTableCell(1,1);
						vwenv.Props = m_ttpDataCellProps;

						vwenv.Props = m_ttpWsLabel;
						vwenv.AddString(m_WsLabels[i]);
						vwenv.CloseTableCell();

						// Third cell has the Title property, in a box.

						vwenv.set_IntProperty((int)FwTextPropType.ktptBackColor,
							(int) FwTextPropVar.ktpvDefault, m_editBackColor);
						// Set the underlying directionality so that arrow keys work properly.
						bool fRTL = m_writingSystems[i].RightToLeftScript;
						vwenv.set_IntProperty((int)FwTextPropType.ktptRightToLeft,
							(int)FwTextPropVar.ktpvEnum, fRTL ? -1 : 0);
						vwenv.set_IntProperty((int)FwTextPropType.ktptAlign,
							(int)FwTextPropVar.ktpvEnum,
							fRTL ? (int)FwTextAlign.ktalRight : (int)FwTextAlign.ktalLeft);
						if (i == 0)
							vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop,
								(int)FwTextPropVar.ktpvMilliPoint, 1000);
						if (i == m_writingSystems.Length - 1)
							vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom,
								(int)FwTextPropVar.ktpvMilliPoint, 1000);
						vwenv.OpenTableCell(1,1);
						vwenv.OpenParagraph();
						vwenv.Props = m_ttpDataCellProps;
						vwenv.set_IntProperty((int)FwTextPropType.ktptEditable, (int)FwTextPropVar.ktpvEnum,
								this.Editable ? (int)TptEditable.ktptIsEditable : (int)TptEditable.ktptNotEditable);
						if (IsScripture)
						{
							vwenv.AddStringAltMember(m_vtagStTextTitle, m_writingSystems[i].Handle, this);
						}
						else
						{
							vwenv.AddStringAltMember(CmMajorObjectTags.kflidName, m_writingSystems[i].Handle, this);
						}
						vwenv.CloseParagraph();
						vwenv.CloseTableCell();

						vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTrailing,
							(int)FwTextPropVar.ktpvMilliPoint, 10000);
						vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTrailing,
							(int)FwTextPropVar.ktpvMilliPoint, 1000);
						vwenv.OpenTableCell(1, 1);
						vwenv.CloseTableCell();

						vwenv.CloseTableRow();
					}

					//// Second row.
					//vwenv.OpenTableRow();
					//
					//// First cell has 'Comments' label in bold.
					//vwenv.Props = m_ttpBold;
					//vwenv.OpenTableCell(1,1);
					//vwenv.set_IntProperty((int)FwTextPropType.ktptMarginLeading,
					//	(int)FwTextPropVar.ktpvMilliPoint, 10000);
					//vwenv.AddString(m_tssComments);
					//vwenv.CloseTableCell();
					//
					//// Second cell has the Description property, in a box.
					//vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTrailing,
					//	(int)FwTextPropVar.ktpvMilliPoint, 10000);
					//vwenv.OpenTableCell(1,1);
					//vwenv.Props = m_ttpDataCellProps;
					//vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom,
					//	(int)FwTextPropVar.ktpvMilliPoint, 1000);
					//vwenv.AddStringAltMember(
					//	(int)CmMajorObject.CmMajorObjectTags.kflidDescription, m_wsAnalysis, this);
					//vwenv.CloseTableCell();
					//
					//vwenv.CloseTableRow();

					vwenv.CloseTableBody();

					vwenv.CloseTable();

					break;
				default:
					throw new Exception("Bad frag id in TitleContentsVc");
			}
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:101,代码来源:TitleContentsPane.cs

示例4: Display

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

			ITsStrFactory tsf = null;
			switch (frag)
			{
				case kfragStText: // The whole text, root object for the InterlinDocChild.
					if (hvo == 0)
						return;		// What if the user deleted all the texts?  See LT-6727.
					vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
						(int)FwTextPropVar.ktpvDefault,
						(int)TptEditable.ktptNotEditable);
					vwenv.OpenDiv();
					StText stText = new StText(m_cache, hvo);
					vwenv.set_IntProperty((int)FwTextPropType.ktptMarginBottom,
						(int)FwTextPropVar.ktpvMilliPoint, 6000);
					vwenv.set_IntProperty((int)FwTextPropType.ktptFontSize,
						(int)FwTextPropVar.ktpvMilliPoint, 24000);
					// Add both vernacular and analysis if we have them (LT-5561).
					bool fAddedVernacular = false;
					int wsVernTitle = 0;
					//
					if (stText.Title.TryWs(LangProject.kwsFirstVern, out wsVernTitle))
					{
						vwenv.OpenParagraph();
						vwenv.AddStringAltMember(vtagStTextTitle, wsVernTitle, this);
						vwenv.CloseParagraph();
						fAddedVernacular = true;
					}
					int wsAnalysisTitle = 0;
					vwenv.set_IntProperty((int)FwTextPropType.ktptMarginBottom,
						(int)FwTextPropVar.ktpvMilliPoint, 10000);
					vwenv.OpenParagraph();
					ITsString tssAnal;
					if (stText.Title.TryWs(LangProject.kwsFirstAnal, out wsAnalysisTitle, out tssAnal) &&
						!tssAnal.Equals(stText.Title.BestVernacularAlternative))
					{
						if (fAddedVernacular)
						{
							// display analysis title at smaller font size.
							vwenv.set_IntProperty((int)FwTextPropType.ktptFontSize,
								(int)FwTextPropVar.ktpvMilliPoint, 12000);
						}
						vwenv.AddStringAltMember(vtagStTextTitle, wsAnalysisTitle, this);
					}
					else
					{
						// just add a blank title.
						tsf = TsStrFactoryClass.Create();
						ITsString blankTitle = tsf.MakeString("", m_wsAnalysis);
						vwenv.AddString(blankTitle);
					}
					vwenv.CloseParagraph();
					int wsSource = 0;
					ITsString tssSource = stText.SourceOfTextForWs(m_wsVernForDisplay);
					if (tssSource == null || tssSource.Length == 0)
					{
						tssSource = stText.SourceOfTextForWs(m_wsAnalysis);
						if (tssSource != null && tssSource.Length > 0)
							wsSource = m_wsAnalysis;
					}
					else
					{
						wsSource = m_wsVernForDisplay;
					}
					vwenv.set_IntProperty((int)FwTextPropType.ktptMarginBottom,
						(int)FwTextPropVar.ktpvMilliPoint, 10000);
					if (tssSource != null && tssSource.Length > 0)
					{
						vwenv.OpenParagraph();
						vwenv.set_IntProperty((int)FwTextPropType.ktptFontSize,
							(int)FwTextPropVar.ktpvMilliPoint, 12000);
						vwenv.AddStringAltMember(vtagStTextSource, wsSource, this);
						vwenv.CloseParagraph();
					}
					else
					{
						// just add a blank source.
						tsf = TsStrFactoryClass.Create();
						ITsString tssBlank = tsf.MakeString("", m_wsAnalysis);
						vwenv.AddString(tssBlank);
					}
					vwenv.set_IntProperty((int)FwTextPropType.ktptMarginBottom,
						(int)FwTextPropVar.ktpvMilliPoint, 10000);
					vwenv.OpenParagraph();
					if (stText.OwningFlid == (int)Text.TextTags.kflidContents)
					{
						vwenv.AddObjProp((int)CmObjectFields.kflidCmObject_Owner, this, kfragTextDescription);
					}
					vwenv.CloseParagraph();
					base.Display(vwenv, hvo, frag);
					vwenv.CloseDiv();
					break;
				case kfragTextDescription:
					vwenv.AddStringAltMember((int)CmMajorObject.CmMajorObjectTags.kflidDescription, m_wsAnalysis, this);
					break;
				case kfragSegFf: // One freeform annotation.
					int[] wssAnalysis = m_WsList.AnalysisWsIds;
					if (wssAnalysis.Length == 0)
//.........这里部分代码省略.........
开发者ID:sillsdev,项目名称:WorldPad,代码行数:101,代码来源:InterlinPrintView.cs

示例5: Display

		public override void Display(IVwEnv vwenv, int hvo, int frag)
		{
			ITsStrFactory tsf = null;
			switch (frag)
			{
				case kfragStText: // The whole text, root object for the InterlinDocChild.
					if (hvo == 0)
						return;		// What if the user deleted all the texts?  See LT-6727.
					IStText stText = m_coRepository.GetObject(hvo) as IStText;
					vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
						(int)FwTextPropVar.ktpvDefault,
						(int)TptEditable.ktptNotEditable);
					vwenv.OpenDiv();
					vwenv.set_IntProperty((int)FwTextPropType.ktptMarginBottom,
						(int)FwTextPropVar.ktpvMilliPoint, 6000);
					vwenv.set_IntProperty((int)FwTextPropType.ktptFontSize,
						(int)FwTextPropVar.ktpvMilliPoint, 24000);
					// Add both vernacular and analysis if we have them (LT-5561).
					bool fAddedVernacular = false;
					int wsVernTitle = 0;
					//
					if (stText.Title.TryWs(WritingSystemServices.kwsFirstVern, out wsVernTitle))
					{
						vwenv.OpenParagraph();
						vwenv.AddStringAltMember(vtagStTextTitle, wsVernTitle, this);
						vwenv.CloseParagraph();
						fAddedVernacular = true;
					}
					int wsAnalysisTitle = 0;
					vwenv.set_IntProperty((int)FwTextPropType.ktptMarginBottom,
						(int)FwTextPropVar.ktpvMilliPoint, 10000);
					vwenv.OpenParagraph();
					ITsString tssAnal;
					if (stText.Title.TryWs(WritingSystemServices.kwsFirstAnal, out wsAnalysisTitle, out tssAnal) &&
						!tssAnal.Equals(stText.Title.BestVernacularAlternative))
					{
						if (fAddedVernacular)
						{
							// display analysis title at smaller font size.
							vwenv.set_IntProperty((int)FwTextPropType.ktptFontSize,
								(int)FwTextPropVar.ktpvMilliPoint, 12000);
						}
						vwenv.AddStringAltMember(vtagStTextTitle, wsAnalysisTitle, this);
					}
					else
					{
						// just add a blank title.
						tsf = TsStrFactoryClass.Create();
						ITsString blankTitle = tsf.MakeString("", m_wsAnalysis);
						vwenv.AddString(blankTitle);
					}
					vwenv.CloseParagraph();
					vwenv.set_IntProperty((int)FwTextPropType.ktptMarginBottom,
						(int)FwTextPropVar.ktpvMilliPoint, 10000);
					int wsSource = 0;
					if (stText.Source.TryWs(WritingSystemServices.kwsFirstVernOrAnal, out wsSource))
					{
						vwenv.OpenParagraph();
						vwenv.set_IntProperty((int)FwTextPropType.ktptFontSize,
							(int)FwTextPropVar.ktpvMilliPoint, 12000);
						vwenv.AddStringAltMember(vtagStTextSource, wsSource, this);
						vwenv.CloseParagraph();
					}
					else
					{
						// just add a blank source.
						tsf = TsStrFactoryClass.Create();
						ITsString tssBlank = tsf.MakeString("", m_wsAnalysis);
						vwenv.AddString(tssBlank);
					}
					vwenv.set_IntProperty((int)FwTextPropType.ktptMarginBottom,
						(int)FwTextPropVar.ktpvMilliPoint, 10000);
					vwenv.OpenParagraph();
					if (stText.OwningFlid == TextTags.kflidContents)
					{
						vwenv.AddObjProp((int)CmObjectFields.kflidCmObject_Owner, this, kfragTextDescription);
					}
					vwenv.CloseParagraph();
					base.Display(vwenv, hvo, frag);
					vwenv.CloseDiv();
					break;
				case kfragTextDescription:
					vwenv.AddStringAltMember(CmMajorObjectTags.kflidDescription, m_wsAnalysis, this);
					break;
				default:
					base.Display(vwenv, hvo, frag);
					break;
			}
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:89,代码来源:InterlinPrintView.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


//.........这里部分代码省略.........
					{
						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
				vwenv.AddObjProp(MoFormTags.kflidMorphType, this, kfragPossibiltyAnalysisName);
				break;
			case kfragPossibiltyAnalysisName:
				vwenv.AddStringAltMember(CmPossibilityTags.kflidName, m_cache.DefaultAnalWs, this);
				break;

			case kfragMorphBundle: // the lines of morpheme information (hvo is a WfiMorphBundle)
				// Make an 'inner pile' to contain the bundle of morph information.
				// Give it 10 points of separation from whatever follows.
				DisplayMorphBundle(vwenv, hvo);
				break;
			case kfragSingleInterlinearAnalysisWithLabels:
				/*
				// 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.get_DataAccess().get_VecSize(hvo, ktagSegFF);
				vwenv.set_IntProperty((int)FwTextPropType.ktptMarginBottom,
					(int)FwTextPropVar.ktpvMilliPoint, cfreeform == 0 ? 5000 : 10000);
				*/
				vwenv.OpenDiv();
				DisplaySingleInterlinearAnalysisWithLabels(vwenv, hvo);
				vwenv.CloseDiv();
				break;
			// This frag is used to display a single interlin analysis that is always left-aligned, even for RTL languages
			case kfragSingleInterlinearAnalysisWithLabelsLeftAlign:
				vwenv.OpenDiv();
				vwenv.set_IntProperty((int)FwTextPropType.ktptPadLeading, (int)FwTextPropVar.ktpvMilliPoint, m_leftPadding);
				vwenv.OpenParagraph();
				vwenv.OpenInnerPile();
				DisplaySingleInterlinearAnalysisWithLabels(vwenv, hvo);
				vwenv.CloseInnerPile();
				vwenv.CloseParagraph();
				vwenv.CloseDiv();
				break;
			//case kfragDefaultSense: // Some default sense
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:67,代码来源:InterlinVc.cs

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

示例9: Display

			public override void Display(IVwEnv vwenv, int hvo, int frag)
			{
				if (hvo == 0)
					return;

				int wsAnal = DefaultWs;
				ITsStrFactory tsf = m_cache.TsStrFactory;
				ICmObject co;
				switch (frag)
				{
					case (int)VcFrags.kfragHeadWord:
						co = m_cache.ServiceLocator.GetInstance<ICmObjectRepository>().GetObject(hvo);
						var le = co as ILexEntry;
						vwenv.AddString(le != null ? le.HeadWord : tsf.MakeString(co.ShortName, wsAnal));
						break;
					case (int)VcFrags.kfragShortName:
						co = m_cache.ServiceLocator.GetInstance<ICmObjectRepository>().GetObject(hvo);
						vwenv.AddString(tsf.MakeString(co.ShortName, wsAnal));
						break;
					case (int)VcFrags.kfragPosAbbrAnalysis:
						vwenv.AddStringAltMember(CmPossibilityTags.kflidAbbreviation, wsAnal, this);
						break;
					default:
						co = m_cache.ServiceLocator.GetInstance<ICmObjectRepository>().GetObject(hvo);
						vwenv.AddString(tsf.MakeString(co.ToString(), wsAnal));
						break;
				}
			}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:28,代码来源:FdoUiCore.cs

示例10: Display


//.........这里部分代码省略.........
							vwenv.OpenParagraph();

							// This makes a little separation between left border and arrows.
							vwenv.set_IntProperty((int)FwTextPropType.ktptPadLeading,
								(int)FwTextPropVar.ktpvMilliPoint, 1000);
							if (m_fRtl)
							{
								// This must not be on the outer paragraph or we get infinite width behavior.
								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.OpenInnerPile();
							for (int ispec = 0; ispec < m_choices.Count; )
							{
								InterlinLineSpec spec = m_choices[ispec];
								if (!spec.WordLevel)
									break;
								if (spec.MorphemeLevel)
								{
									DisplayMorphBundles(vwenv, hvo);
									ispec = m_choices.LastMorphemeIndex + 1;
									continue;
								}
								switch (spec.Flid)
								{
									case InterlinLineChoices.kflidWord:
										int ws = GetActualWs(hvo, spec.StringFlid, spec.WritingSystem);
										DisplayWordform(vwenv, ws, ispec);
										break;
									case InterlinLineChoices.kflidWordGloss:
										DisplayWordGloss(vwenv, hvo, spec.WritingSystem, ispec);
										break;
									case InterlinLineChoices.kflidWordPos:
										DisplayWordPOS(vwenv, hvo, spec.WritingSystem, ispec);
										break;
								}
								ispec++;
							}
							vwenv.CloseInnerPile();

							vwenv.CloseParagraph();
							vwenv.CloseInnerPile();

							vwenv.CloseParagraph();
							vwenv.CloseDiv();
							break;
						case kfragFirstMorph: // first morpheme in word
						case kfragMorph: // The bundle of 4 lines representing a morpheme.
							vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTrailing,
								(int)FwTextPropVar.ktpvMilliPoint, 10000);
							vwenv.OpenInnerPile();
							for (int ispec = m_choices.FirstMorphemeIndex; ispec <= m_choices.LastMorphemeIndex; ispec++)
							{
								int tagLexEntryIcon = 0;
								if (m_choices.FirstLexEntryIndex == ispec)
									tagLexEntryIcon = ktagMorphEntryIcon;
								InterlinLineSpec spec = m_choices[ispec];
								switch (spec.Flid)
								{
									case InterlinLineChoices.kflidMorphemes:
										DisplayMorphForm(vwenv, hvo, frag, spec.WritingSystem, ispec);
										break;
									case InterlinLineChoices.kflidLexEntries:
										AddOptionalNamedObj(vwenv, hvo, ktagSbMorphEntry, ktagMissingEntry,
											kfragMissingEntry, tagLexEntryIcon, spec.WritingSystem, ispec);
										break;
									case InterlinLineChoices.kflidLexGloss:
										AddOptionalNamedObj(vwenv, hvo, ktagSbMorphGloss, ktagMissingMorphGloss,
											kfragMissingMorphGloss, tagLexEntryIcon, spec.WritingSystem, ispec);
										break;
									case InterlinLineChoices.kflidLexPos:
										AddOptionalNamedObj(vwenv, hvo, ktagSbMorphPos, ktagMissingMorphPos,
											kfragMissingMorphPos, tagLexEntryIcon, spec.WritingSystem, ispec);
										break;
								}
							}
							vwenv.CloseInnerPile();

							break;
						default:
							if (frag >= kfragNamedObjectNameChoices && frag < kfragNamedObjectNameChoices + m_choices.Count)
							{
								InterlinLineSpec spec = m_choices[frag - kfragNamedObjectNameChoices];
								int wsActual = GetActualWs(hvo, ktagSbNamedObjName, spec.WritingSystem);
								vwenv.AddStringAltMember(ktagSbNamedObjName, wsActual, this);
							}
							else
							{
								throw new Exception("Bad fragment ID in SandboxVc.Display");
							}
							break;
					}
				}
				catch
				{
					Debug.Assert(false, "Exception thrown in the display of the SandboxVc (About to be eaten)");
				}
			}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:101,代码来源:SandboxBase.SandboxVc.cs

示例11: DisplayWordGloss

			private void DisplayWordGloss(IVwEnv vwenv, int hvo, int ws, int choiceIndex)
			{
				// Count how many glosses there are for the current analysis:
				int cGlosses = 0;
				// Find a wfi analysis (existing or guess) to determine whether to provide an icon for selecting
				// multiple word glosses for IhWordGloss.SetupCombo (cf. LT-1428)
				IWfiAnalysis wa = m_sandbox.GetWfiAnalysisInUse();
				if (wa != null)
					cGlosses = wa.MeaningsOC.Count;

				SetColor(vwenv, m_choices.LabelRGBFor(choiceIndex));

				// Icon only if we want icons at all (currently always true) and there is at least one WfiGloss to choose
				// and this is the first word gloss line.
				bool fWantIcon = m_fIconsForAnalysisChoices &&
					(cGlosses > 0 || m_sandbox.ShouldAddWordGlossToLexicon) &&
					m_choices.IsFirstOccurrenceOfFlid(choiceIndex);
				// If there isn't going to be an icon, add an indent.
				if (!fWantIcon)
				{
					SetIndentForMissingIcon(vwenv);
				}
				vwenv.OpenParagraph();
				if (fWantIcon)
				{
					AddPullDownIcon(vwenv, ktagWordGlossIcon);
					m_fIconForWordGloss = true;
				}
				else if (m_fIconForWordGloss == true && cGlosses == 0)
				{
					// reset
					m_fIconForWordGloss = false;
				}
				//if there is more than one gloss set the background color to give visual indication
				if (cGlosses > 1)
				{
					//set directly to the MultipleApproved color rather than the stored one
					//the state of the two could be different.
					SetBGColor(vwenv, InterlinVc.MultipleApprovedGuessColor);
					ITsStrFactory fact = TsStrFactoryClass.Create();
					ITsString count = TsStringUtils.MakeTss(fact, Cache.DefaultUserWs, "" + cGlosses);
					//make the number black.
					SetColor(vwenv, 0);
					vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTrailing,
										  (int)FwTextPropVar.ktpvMilliPoint, kmpIconMargin);
					vwenv.AddString(count);
				}

				//Set the margin and padding values
				vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTrailing,
					(int)FwTextPropVar.ktpvMilliPoint,
					kmpIconMargin);
				vwenv.set_IntProperty((int)FwTextPropType.ktptPadTrailing,
					(int)FwTextPropVar.ktpvMilliPoint,
					2000);
				vwenv.set_IntProperty((int)FwTextPropType.ktptPadLeading,
					(int)FwTextPropVar.ktpvMilliPoint,
					2000);
				SetBGColor(vwenv, krgbEditable);
				vwenv.set_IntProperty((int)FwTextPropType.ktptSpellCheck, (int)FwTextPropVar.ktpvEnum,
					(int)SpellingModes.ksmNormalCheck);
				vwenv.OpenInnerPile();

				// Set the appropriate paragraph direction for the writing system.
				bool fWsRtl = m_caches.MainCache.ServiceLocator.WritingSystemManager.Get(ws).RightToLeftScript;
				if (fWsRtl != RightToLeft)
					vwenv.set_IntProperty((int)FwTextPropType.ktptRightToLeft,
						(int)FwTextPropVar.ktpvEnum,
						fWsRtl ? (int)FwTextToggleVal.kttvForceOn : (int)FwTextToggleVal.kttvOff);

				vwenv.AddStringAltMember(ktagSbWordGloss, ws, this);
				vwenv.CloseInnerPile();
				vwenv.CloseParagraph();
			}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:74,代码来源:SandboxBase.SandboxVc.cs

示例12: Display

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

			// 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.
			m_mDxmpLabelWidth = 0;
			for (int i = 0; i < m_rgws.Count; ++i)
			{
				int dxs;	// Width of displayed string.
				int dys;	// Height of displayed string (not used here).

				// Set qtss to a string representing the writing system.
				vwenv.get_StringWidth(NameOfWs(i), m_ttpLabel, out dxs, out dys);
				m_mDxmpLabelWidth = Math.Max(m_mDxmpLabelWidth, dxs);
			}
			VwLength vlColWs; // 5-pt space plus max label width.
			vlColWs.nVal = m_mDxmpLabelWidth + 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();
			var visibleWss = new Set<ILgWritingSystem>();
			// if we passed in a view and have WritingSystemsToDisplay
			// then we'll load that list in order to filter our larger m_rgws list.
			AddViewWritingSystems(visibleWss);
			for (int i = 0; i < m_rgws.Count; ++i)
			{
				if (SkipEmptyWritingSystem(visibleWss, i, hvo))
					continue;
				vwenv.OpenTableRow();

				// First cell has writing system abbreviation displayed using m_ttpLabel.
				vwenv.Props = m_ttpLabel;
				vwenv.OpenTableCell(1,1);
				vwenv.AddString(NameOfWs(i));
				vwenv.CloseTableCell();

				// Second cell has the string contents for the alternative.
				// DN version has some property setting, including trailing margin and
				// RTL.
				if (m_rgws[i].RightToLeftScript)
				{
					vwenv.set_IntProperty((int)FwTextPropType.ktptRightToLeft,
						(int)FwTextPropVar.ktpvEnum,
						(int)FwTextToggleVal.kttvForceOn);
					vwenv.set_IntProperty((int)FwTextPropType.ktptAlign,
						(int)FwTextPropVar.ktpvEnum,
						(int)FwTextAlign.ktalTrailing);
				}
				if (!m_editable)
				{
					vwenv.set_IntProperty((int)FwTextPropType.ktptEditable, (int)FwTextPropVar.ktpvEnum,
						(int)TptEditable.ktptNotEditable);
				}
				vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop, (int)FwTextPropVar.ktpvMilliPoint, 2000);
				vwenv.OpenTableCell(1,1);
				var wsdef = m_rgws[i] as WritingSystemDefinition;
				if (wsdef != null && wsdef.IsVoice)
				{
					// We embed it in a conc paragraph to ensure it never takes more than a line.
					// It will typically be covered up by a sound control.
					// Also set foreground color to match the window, so nothing shows even if the sound doesn't overlap it perfectly.
					// (transparent does not seem to work as a foreground color)
					vwenv.set_IntProperty((int)FwTextPropType.ktptForeColor, (int)FwTextPropVar.ktpvDefault,
						(int)ColorUtil.ConvertColorToBGR(Color.FromKnownColor(KnownColor.Window)));
					// Must not spell-check a conc para, leads to layout failures when the paragraph tries to cast the source to
					// a conc text source, if it is overridden by a spelling text source.
					vwenv.set_IntProperty((int)FwTextPropType.ktptSpellCheck, (int)FwTextPropVar.ktpvEnum, (int)SpellingModes.ksmDoNotCheck);
					vwenv.OpenConcPara(0, 1, VwConcParaOpts.kcpoDefault, 0);
					vwenv.AddStringAltMember(m_flid, m_rgws[i].Handle, this);
					vwenv.CloseParagraph();
//.........这里部分代码省略.........
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:101,代码来源:InnerLabeledMultiStringView.cs

示例13: Display

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

				switch(frag)
				{
					case (int)VcFrags.kfragName: // Use the name for both name and short name.
					case (int)VcFrags.kfragShortName:
					default:
						int wsUi = vwenv.DataAccess.WritingSystemFactory.UserWs;
						vwenv.AddStringAltMember(m_flidName, wsUi, this);
						break;
				}
			}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:14,代码来源:FdoUiCore.cs

示例14: AddHeadwordWithHomograph

		private void AddHeadwordWithHomograph(IVwEnv vwenv, int hvo)
		{
					ISilDataAccess sda = vwenv.DataAccess;
					int hvoLf = sda.get_ObjectProp(hvo,
						LexEntryTags.kflidLexemeForm);
					int hvoType = 0;
					if (hvoLf != 0)
					{
						hvoType = sda.get_ObjectProp(hvoLf,
							MoFormTags.kflidMorphType);
					}

					// If we have a type of morpheme, show the appropriate prefix that indicates it.
					// We want vernacular so it will match the point size of any aligned vernacular text.
					// (The danger is that the vernacular font doesn't have these characters...not sure what
					// we can do about that, but most do, and it looks awful in analysis if that is a
					// much different size from vernacular.)
					string sPrefix = null;
					if (hvoType != 0)
					{
						sPrefix = sda.get_UnicodeProp(hvoType, MoMorphTypeTags.kflidPrefix);
					}

					// LexEntry.ShortName1; basically tries for form of the lexeme form, then the citation form.
					bool fGotLabel = false;
					int wsActual = 0;
					if (hvoLf != 0)
					{
						// if we have a lexeme form and its label is non-empty, use it.
						if (TryMultiStringAlt(sda, hvoLf, MoFormTags.kflidForm, out wsActual))
						{
							m_wsActual = wsActual;
							fGotLabel = true;
							if (sPrefix != null)
								vwenv.AddString(TsStringUtils.MakeTss(sPrefix, wsActual));
							vwenv.AddObjProp(LexEntryTags.kflidLexemeForm, this, kfragFormForm);
						}
					}
					if (!fGotLabel)
					{
						// If we didn't get a useful form from the lexeme form try the citation form.
						if (TryMultiStringAlt(sda, hvo, LexEntryTags.kflidCitationForm, out wsActual))
						{
							m_wsActual = wsActual;
							if (sPrefix != null)
								vwenv.AddString(TsStringUtils.MakeTss(sPrefix, wsActual));
							vwenv.AddStringAltMember(LexEntryTags.kflidCitationForm, wsActual, this);
							fGotLabel = true;
						}
					}
					int defUserWs = m_cache.WritingSystemFactory.UserWs;
					if (!fGotLabel)
					{
						// If that fails just show two questions marks.
						if (sPrefix != null)
							vwenv.AddString(TsStringUtils.MakeTss(sPrefix, wsActual));
						vwenv.AddString(m_cache.TsStrFactory.MakeString(FdoUiStrings.ksQuestions, defUserWs));	// was "??", not "???"
					}

					// If we have a lexeme form type show the appropriate postfix.
					if (hvoType != 0)
					{
						vwenv.AddString(TsStringUtils.MakeTss(
							sda.get_UnicodeProp(hvoType, MoMorphTypeTags.kflidPostfix), wsActual));
					}

					// Show homograph number if non-zero.
					int nHomograph = sda.get_IntProp(hvo,
						LexEntryTags.kflidHomographNumber);
					vwenv.NoteDependency(new[] { hvo }, new[] { LexEntryTags.kflidHomographNumber }, 1);
					if (nHomograph > 0)
					{
						// Use a string builder to embed the properties in with the TsString.
						// this allows our TsStringCollectorEnv to properly encode the superscript.
						// ideally, TsStringCollectorEnv could be made smarter to handle SetIntPropValues
						// since AppendTss treats the given Tss as atomic.
						ITsIncStrBldr tsBldr = TsIncStrBldrClass.Create();
						tsBldr.SetIntPropValues((int)FwTextPropType.ktptSuperscript,
							(int)FwTextPropVar.ktpvEnum,
							(int)FwSuperscriptVal.kssvSub);
						tsBldr.SetIntPropValues((int)FwTextPropType.ktptBold,
							(int)FwTextPropVar.ktpvEnum,
							(int)FwTextToggleVal.kttvForceOn);
						tsBldr.SetIntPropValues((int)FwTextPropType.ktptWs,
							(int)FwTextPropVar.ktpvDefault, defUserWs);
						tsBldr.Append(nHomograph.ToString());
						vwenv.AddString(tsBldr.GetString());
					}
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:89,代码来源:LexEntryUi.cs

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


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