本文整理汇总了C#中IVwEnv.AddObj方法的典型用法代码示例。如果您正苦于以下问题:C# IVwEnv.AddObj方法的具体用法?C# IVwEnv.AddObj怎么用?C# IVwEnv.AddObj使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVwEnv
的用法示例。
在下文中一共展示了IVwEnv.AddObj方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DisplayVec
/// <summary>
/// Calling vwenv.AddObjVec() in Display() and implementing DisplayVec() seems to
/// work better than calling vwenv.AddObjVecItems() in Display(). Theoretically
/// this should not be case, but experience trumps theory every time. :-) :-(
/// </summary>
public override void DisplayVec(IVwEnv vwenv, int hvo, int tag, int frag)
{
CheckDisposed();
ISilDataAccess da = vwenv.DataAccess;
int count = da.get_VecSize(hvo, tag);
// Tree Branches consist of everything FOLLOWING the first element which is the Tree root.
for (int i = 1; i < count; ++i)
{
vwenv.AddObj(da.get_VecItem(hvo, tag, i), this,
VectorReferenceView.kfragTargetObj);
vwenv.AddSeparatorBar();
}
}
示例2: DisplayVec
public override void DisplayVec(IVwEnv vwenv, int hvo, int tag, int frag)
{
switch (frag)
{
case kfragBundleVec:
int[] ccas = m_cache.GetVectorProperty(hvo, tag, false);
for (int i = 0; i < ccas.Length; i++)
{
if (i < ccas.Length - 1)
{
// Give whatever box we make 5 points of separation from whatever follows.
vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTrailing,
(int)FwTextPropVar.ktpvMilliPoint, 5000);
}
vwenv.AddObj(ccas[i], this, kfragBundle);
}
break;
case kfragClauseLabels: // hvo is cmIndirectAnnotation pointing at a group of rows (at least one).
// Enhance JohnT: this assumes it is always a contiguous list.
ISilDataAccess sda = vwenv.DataAccess;
int chvo = sda.get_VecSize(hvo, kflidAppliesTo);
int hvoFirst = sda.get_VecItem(hvo, kflidAppliesTo, 0);
vwenv.AddObj(hvoFirst, this, kfragComment);
if (chvo == 1)
break;
vwenv.AddString(m_cache.MakeAnalysisTss("-"));
int hvoLast = sda.get_VecItem(hvo, kflidAppliesTo, chvo - 1);
vwenv.AddObj(hvoLast, this, kfragComment);
break;
default:
base.DisplayVec(vwenv, hvo, tag, frag);
break;
}
}
示例3: DisplayVec
public override void DisplayVec(IVwEnv vwenv, int hvo, int tag, int frag)
{
CheckDisposed();
ISilDataAccess da = vwenv.DataAccess;
int count = da.get_VecSize(hvo, tag);
for (int i = 0; i < count; ++i)
{
if (i != 0)
vwenv.AddSeparatorBar();
vwenv.AddObj(da.get_VecItem(hvo, tag, i), this,
PhoneEnvReferenceView.kFragEnvironmentObj);
}
}
示例4: Display
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
CheckDisposed();
ISilDataAccess da = vwenv.DataAccess;
switch (frag)
{
default:
{
Debug.Assert(false, "Unrecognized fragment.");
break;
}
case ReversalIndexEntrySliceView.kFragMainObject:
{
// The hvo here is for the sense.
// We use a table to display
// encodings in column one and the strings in column two.
// The table uses 100% of the available width.
VwLength vlTable;
vlTable.nVal = 10000;
vlTable.unit = VwUnit.kunPercent100;
// The width of the writing system column is determined from the width of the
// longest one which will be displayed.
int dxs; // Width of displayed string.
int dys; // Height of displayed string (not used here).
int dxsMax = 0; // Max width required.
ISilDataAccess silDaCache = vwenv.DataAccess;
IVwCacheDa vwCache = silDaCache as IVwCacheDa;
foreach (IReversalIndex idx in m_usedIndices)
{
vwenv.get_StringWidth(silDaCache.get_StringProp(idx.WritingSystemRAHvo, (int)LgWritingSystem.LgWritingSystemTags.kflidAbbr),
m_ttpLabel,
out dxs,
out dys);
dxsMax = Math.Max(dxsMax, dxs);
}
VwLength vlColWs; // 5-pt space plus max label width.
vlColWs.nVal = dxsMax + 5000;
vlColWs.unit = VwUnit.kunPoint1000;
// Enhance JohnT: possibly allow for right-to-left UI by reversing columns?
// The Main column is relative and uses the rest of the space.
VwLength vlColMain;
vlColMain.nVal = 1;
vlColMain.unit = VwUnit.kunRelative;
vwenv.OpenTable(2, // Two columns.
vlTable, // Table uses 100% of available width.
0, // Border thickness.
VwAlignment.kvaLeft, // Default alignment.
VwFramePosition.kvfpVoid, // No border.
VwRule.kvrlNone, // No rules between cells.
0, // No forced space between cells.
0, // No padding inside cells.
false);
// Specify column widths. The first argument is the number of columns,
// not a column index. The writing system column only occurs at all if its
// width is non-zero.
vwenv.MakeColumns(1, vlColWs);
vwenv.MakeColumns(1, vlColMain);
vwenv.OpenTableBody();
// Do vector of rows. Each row essentially is a reversal index, but shows other information.
vwenv.AddObjVec(ReversalIndexEntrySliceView.kFlidIndices, this, ReversalIndexEntrySliceView.kFragIndices);
vwenv.CloseTableBody();
vwenv.CloseTable();
break;
}
case ReversalIndexEntrySliceView.kFragIndexMain:
{
// First cell has writing system abbreviation displayed using m_ttpLabel.
int wsHvo = 0;
foreach (ReversalIndex idx in m_usedIndices)
{
if (idx.Hvo == hvo)
{
wsHvo = idx.WritingSystemRAHvo;
break;
}
}
Debug.Assert(wsHvo > 0, "Could not find writing system.");
int wsOldDefault = this.DefaultWs;
this.DefaultWs = wsHvo;
// Cell 1 shows the ws abbreviation.
vwenv.OpenTableCell(1,1);
vwenv.Props = m_ttpLabel;
vwenv.AddObj(wsHvo, this, ReversalIndexEntrySliceView.kFragWsAbbr);
vwenv.CloseTableCell();
// Second cell has the contents for the reversal entries.
vwenv.OpenTableCell(1,1);
// This displays the field flush right for RTL data, but gets arrow keys to
// behave reasonably. See comments on LT-5287.
IWritingSystem lgws = m_cache.LanguageWritingSystemFactoryAccessor.get_EngineOrNull(this.DefaultWs);
if (lgws != null && lgws.RightToLeft)
{
vwenv.set_IntProperty((int)FwTextPropType.ktptRightToLeft,
(int)FwTextPropVar.ktpvEnum, (int)FwTextToggleVal.kttvForceOn);
//.........这里部分代码省略.........
示例5: DisplayVec
/// <summary>
/// Calling vwenv.AddObjVec() in Display() and implementing DisplayVec() seems to
/// work better than calling vwenv.AddObjVecItems() in Display(). Theoretically
/// this should not be case, but experience trumps theory every time. :-) :-(
/// </summary>
public override void DisplayVec(IVwEnv vwenv, int hvo, int tag, int frag)
{
ISilDataAccess da = vwenv.DataAccess;
int count = da.get_VecSize(hvo, tag);
// Show everything in the collection except the current element from the main display.
for (int i = 0; i < count; ++i)
{
int hvoItem = da.get_VecItem(hvo, tag, i);
if (m_displayParent != null && hvoItem == m_displayParent.Hvo)
continue;
vwenv.AddObj(hvoItem, this, VectorReferenceView.kfragTargetObj);
vwenv.AddSeparatorBar();
}
}
示例6: CreateNotesParagraph
private void CreateNotesParagraph(IVwEnv vwenv, List<int> notes, ITsTextProps styleProps)
{
// Don't create a completely empty paragraph. The way the Views system handles such paragraphs
// doesn't work for a MappedTaggedPara. Also, we want the footnote to take up no height at all
// if there are none.
if (notes.Count == 0)
return;
vwenv.set_IntProperty((int)FwTextPropType.ktptBaseWs,
(int)FwTextPropVar.ktpvDefault, DefaultWs);
vwenv.set_IntProperty((int)FwTextPropType.ktptRightToLeft,
(int)FwTextPropVar.ktpvEnum, (RightToLeft ? -1 : 0));
vwenv.set_IntProperty((int)FwTextPropType.ktptAlign,
(int)FwTextPropVar.ktpvEnum,
RightToLeft ? (int)FwTextAlign.ktalRight : (int)FwTextAlign.ktalLeft);
vwenv.Props = styleProps;
// The body of the paragraph is either editable or not.
vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
(int)FwTextPropVar.ktpvEnum,
Editable ? (int)TptEditable.ktptIsEditable
: (int)TptEditable.ktptNotEditable);
vwenv.OpenMappedTaggedPara();
for (int ihvo = 0; ihvo < notes.Count; ihvo++)
{
// Optimize JohnT: could make this string once and save it in a member variable.
if (ihvo != 0)
vwenv.AddString(m_cache.MakeVernTss(" "));
vwenv.AddObj(notes[ihvo], this, (int)FootnoteFrags.kfrFootnoteWithinPagePara);
}
vwenv.CloseParagraph();
}
示例7: AddAnalysisPos
/// <summary>
/// Add a display of the category of hvoAnalysis.
/// If choiceOffset is -1, display the current analysis writing systems, otherwise,
/// display the one indicated (choiceIndex is an index into line choices).
/// When choice index is not -1, hvoAnalysis may not be the current object.
/// In that case, we invoke AddObj with a special flid which results in a recursive
/// call to this, but with the correct current object.
/// </summary>
/// <param name="vwenv"></param>
/// <param name="hvoAnalysis"></param>
protected void AddAnalysisPos(IVwEnv vwenv, int hvoAnalysis, int hvoCurrent, int choiceIndex)
{
IWfiAnalysis wa = m_coRepository.GetObject(hvoAnalysis) as IWfiAnalysis;
int hvoPos = wa.CategoryRA != null ? wa.CategoryRA.Hvo : 0;
SetColor(vwenv, LabelRGBFor(choiceIndex));
if (hvoPos == 0)
{
vwenv.OpenParagraph();
vwenv.NoteDependency(new int[] {hvoAnalysis},
new int[] {WfiAnalysisTags.kflidCategory}, 1);
vwenv.AddString(m_tssMissingAnalysisPos);
vwenv.CloseParagraph();
}
else if (choiceIndex < 0)
{
vwenv.AddObjProp(WfiAnalysisTags.kflidCategory, this, kfragCategory);
}
else
{
if (hvoCurrent == hvoAnalysis)
vwenv.AddObjProp(WfiAnalysisTags.kflidCategory, this, kfragLineChoices + choiceIndex);
else
vwenv.AddObj(hvoAnalysis, this, kfragAnalysisCategoryChoices + choiceIndex); // causes recursive call with right hvoCurrent
}
}
示例8: DisplayLexGlossWithInflType
/// <summary>
/// NOTE: this routine is ignorant of calling context, so caller must provide NoteDependency to the possibleVariant and the sense
/// (e.g. vwenv.NoteDependency(new[] { wfiMorphBundle.Hvo }, new[] { WfiMorphBundleTags.kflidSense }, 1);
/// vwenv.NoteDependency(new[] { wfiMorphBundle.Hvo }, new[] { WfiMorphBundleTags.kflidInflType }, 1);
/// </summary>
/// <param name="vwenv"></param>
/// <param name="possibleVariant"></param>
/// <param name="sense"></param>
/// <param name="spec"></param>
/// <param name="inflType"></param>
/// <returns>true if there was anything to display </returns>
internal bool DisplayLexGlossWithInflType(IVwEnv vwenv, ILexEntry possibleVariant, ILexSense sense, InterlinLineSpec spec,
ILexEntryInflType inflType)
{
int iLineChoice = m_lineChoices.IndexOf(spec);
ILexEntryRef ler;
if (possibleVariant.IsVariantOfSenseOrOwnerEntry(sense, out ler))
{
var wsPreferred = GetRealWsOrBestWsForContext(sense.Hvo, spec);
var wsGloss = Cache.ServiceLocator.WritingSystemManager.Get(wsPreferred);
var wsUser = Cache.ServiceLocator.WritingSystemManager.UserWritingSystem;
var testGloss = sense.Gloss.get_String(wsPreferred);
// don't bother adding anything for an empty gloss.
if (testGloss.Text != null && testGloss.Text.Length >= 0)
{
vwenv.OpenParagraph();
// see if we have an irregularly inflected form type reference
var leitFirst =
ler.VariantEntryTypesRS.Where(
let => let.ClassID == LexEntryInflTypeTags.kClassId).FirstOrDefault();
// add any GlossPrepend info
if (leitFirst != null)
{
vwenv.OpenInnerPile();
// TODO: add dependency to VariantType GlossPrepend/Append names
vwenv.NoteDependency(new[] { ler.Hvo },
new[] { LexEntryRefTags.kflidVariantEntryTypes }, 1);
vwenv.OpenParagraph();
ITsString tssPrepend = null;
if (inflType != null)
{
tssPrepend = MorphServices.AddTssGlossAffix(null, inflType.GlossPrepend, wsGloss, wsUser);
}
else
{
ITsIncStrBldr sbPrepend;
ITsIncStrBldr sbAppend;
JoinGlossAffixesOfInflVariantTypes(ler, wsPreferred, out sbPrepend,
out sbAppend);
if (sbPrepend.Text != null)
tssPrepend = sbPrepend.GetString();
}
if (tssPrepend != null)
vwenv.AddString(tssPrepend);
vwenv.CloseParagraph();
vwenv.CloseInnerPile();
}
// add gloss of main entry or sense
{
vwenv.OpenInnerPile();
// NOTE: remember to NoteDependency from OuterObject
vwenv.AddObj(sense.Hvo, this, kfragLineChoices + iLineChoice);
vwenv.CloseInnerPile();
}
// now add variant type info
if (leitFirst != null)
{
vwenv.OpenInnerPile();
// TODO: add dependency to VariantType GlossPrepend/Append names
vwenv.NoteDependency(new[] { ler.Hvo },
new[] { LexEntryRefTags.kflidVariantEntryTypes }, 1);
vwenv.OpenParagraph();
ITsString tssAppend = null;
if (inflType != null)
{
tssAppend = MorphServices.AddTssGlossAffix(null, inflType.GlossAppend, wsGloss, wsUser);
}
else
{
ITsIncStrBldr sbPrepend;
ITsIncStrBldr sbAppend;
JoinGlossAffixesOfInflVariantTypes(ler, wsPreferred, out sbPrepend,
out sbAppend);
if (sbAppend.Text != null)
tssAppend = sbAppend.GetString();
}
{
// Use AddProp/DisplayVariant to store GlossAppend with m_tssPendingGlossAffix
// this allows InterlinearExporter to know to export a glsAppend item
try
{
if (tssAppend != null)
m_tssPendingGlossAffix = tssAppend;
else
m_tssPendingGlossAffix = m_tssMissingGlossAppend;
vwenv.AddProp(ktagGlossAppend, this, 0);
}
finally
//.........这里部分代码省略.........
示例9: DisplayVec
public override void DisplayVec(IVwEnv vwenv, int hvo, int tag, int frag)
{
CheckDisposed();
switch (frag)
{
case kfragMorph: // The bundle of 4 lines representing a morpheme.
ISilDataAccess sda = vwenv.DataAccess;
int cmorph = sda.get_VecSize(hvo, tag);
for (int i = 0; i < cmorph; ++i)
{
int hvoMorph = sda.get_VecItem(hvo, tag, i);
vwenv.AddObj(hvoMorph, this, i == 0 ? kfragFirstMorph : kfragMorph);
}
break;
}
}
示例10: Display
/// ------------------------------------------------------------------------------------
/// <summary>
/// This is the main interesting method of displaying objects and fragments of them.
/// Scripture Footnotes are displayed by displaying each footnote's reference and text.
/// The text is displayed using the standard view constructor for StText.
/// </summary>
/// <param name="vwenv"></param>
/// <param name="hvo"></param>
/// <param name="frag"></param>
/// ------------------------------------------------------------------------------------
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
switch (frag)
{
case (int)StTextFrags.kfrFootnote:
{
// FWR-1640: Make the sequence of footnote paragraphs non-editable
// since we only allow one para per footnote. This will cause
// pasting multiple paragraphs to work correctly.
vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
(int)FwTextPropVar.ktpvEnum,
(int)TptEditable.ktptNotEditable);
base.Display(vwenv, hvo, frag);
break;
}
case (int)FootnoteFrags.kfrScripture:
{
vwenv.NoteDependency(new int[] { m_cache.LanguageProject.TranslatedScriptureOA.Hvo },
new int[] { (int)ScriptureTags.kflidScriptureBooks }, 1);
vwenv.AddLazyVecItems(BooksTag, this, (int)FootnoteFrags.kfrBook);
break;
}
case (int)FootnoteFrags.kfrRootInPageSeq:
{
vwenv.AddObjVec(ScrBookTags.kflidFootnotes, this, (int)FootnoteFrags.kfrAllFootnotesWithinPagePara);
break;
}
case (int)FootnoteFrags.kfrFootnoteWithinPagePara:
{
// Insert the marker and reference
vwenv.AddObj(hvo, this, (int)StTextFrags.kfrFootnoteMarker);
vwenv.AddObj(hvo, this,(int)StTextFrags.kfrFootnoteReference);
// Insert (we hope only one) paragraph contents.
vwenv.AddObjVecItems(StTextTags.kflidParagraphs, this, (int)FootnoteFrags.kfrFootnoteParaWithinPagePara);
break;
}
case (int) FootnoteFrags.kfrFootnoteParaWithinPagePara:
{
if (!InsertParaContentsUserPrompt(vwenv, hvo))
{
// Display the text paragraph contents, or its user prompt.
vwenv.AddStringProp(StTxtParaTags.kflidContents, null);
}
break;
}
case (int)FootnoteFrags.kfrBook:
{
vwenv.OpenDiv();
vwenv.AddObjVecItems(ScrBookTags.kflidFootnotes, this,
(int)StTextFrags.kfrFootnote);
vwenv.CloseDiv();
break;
}
case (int)StTextFrags.kfrFootnoteReference:
{
DisplayFootnoteReference(vwenv, hvo);
break;
}
default:
base.Display(vwenv, hvo, frag);
break;
}
}
示例11: DisplayVec
public override void DisplayVec(IVwEnv vwenv, int hvo, int tag, int frag)
{
switch (frag)
{
case kfragInput:
// input context cell
foreach (var ctxt in m_rule.InputOS)
{
vwenv.Props = m_ctxtProps;
vwenv.OpenTableCell(1, 1);
vwenv.OpenParagraph();
vwenv.AddObj(ctxt.Hvo, this, kfragContext);
vwenv.CloseParagraph();
vwenv.CloseTableCell();
}
break;
default:
base.DisplayVec(vwenv, hvo, tag, frag);
break;
}
}
示例12: DisplayVec
/// ------------------------------------------------------------------------------------
/// <summary>
/// Override of DisplayVec
/// </summary>
/// ------------------------------------------------------------------------------------
public override void DisplayVec(IVwEnv vwenv, int hvo, int tag, int frag)
{
CheckDisposed();
if (tag == (int)StTxtPara.StTxtParaTags.kflidTranslations &&
frag == (int)ScrFrags.kfrBtTranslationStatus)
{
vwenv.AddObj(GetTranslationForPara(hvo), this, frag);
}
else
base.DisplayVec(vwenv, hvo, tag, frag);
}
示例13: DisplayVec
/// <summary>
/// Calling vwenv.AddObjVec() in Display() and implementing DisplayVec() seems to
/// work better than calling vwenv.AddObjVecItems() in Display(). Theoretically
/// this should not be case, but experience trumps theory every time. :-) :-(
/// </summary>
public override void DisplayVec(IVwEnv vwenv, int hvo, int tag, int frag)
{
ISilDataAccess da = vwenv.DataAccess;
int count = da.get_VecSize(hvo, tag);
// Show everything in the sequence including current element from the main display.
for (int i = 0; i < count; ++i)
{
int hvoItem = da.get_VecItem(hvo, tag, i);
vwenv.AddObj(hvoItem, this, VectorReferenceView.kfragTargetObj);
vwenv.AddSeparatorBar();
}
}
示例14: DisplayVec
public override void DisplayVec(IVwEnv vwenv, int hvo, int tag, int frag)
{
switch (frag)
{
case kfragInput:
// input context cell
int[] ctxtHvos = m_cache.GetVectorProperty(hvo, tag, false);
foreach (int ctxtHvo in ctxtHvos)
{
vwenv.Props = m_ctxtProps;
vwenv.OpenTableCell(1, 1);
vwenv.OpenParagraph();
vwenv.AddObj(ctxtHvo, this, kfragContext);
vwenv.CloseParagraph();
vwenv.CloseTableCell();
}
break;
default:
base.DisplayVec(vwenv, hvo, tag, frag);
break;
}
}
示例15: DisplayVec
/// ------------------------------------------------------------------------------------
/// <summary>
/// Override of DisplayVec
/// </summary>
/// ------------------------------------------------------------------------------------
public override void DisplayVec(IVwEnv vwenv, int paraHvo, int tag, int frag)
{
CheckDisposed();
if (tag == StTxtParaTags.kflidTranslations && frag == (int)ScrFrags.kfrBtTranslationStatus)
{
IStTxtPara para = Cache.ServiceLocator.GetInstance<IStTxtParaRepository>().GetObject(paraHvo);
vwenv.AddObj(GetTranslationForPara(paraHvo), this, frag);
}
else
base.DisplayVec(vwenv, paraHvo, tag, frag);
}