本文整理汇总了C#中IVwEnv.AddObjVecItems方法的典型用法代码示例。如果您正苦于以下问题:C# IVwEnv.AddObjVecItems方法的具体用法?C# IVwEnv.AddObjVecItems怎么用?C# IVwEnv.AddObjVecItems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVwEnv
的用法示例。
在下文中一共展示了IVwEnv.AddObjVecItems方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Display
/// ------------------------------------------------------------------------------------
/// <summary>
/// Displays the specified vwenv.
/// </summary>
/// <param name="vwenv">The vwenv.</param>
/// <param name="hvo">The hvo.</param>
/// <param name="frag">The frag.</param>
/// ------------------------------------------------------------------------------------
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
CheckDisposed();
switch (frag)
{
case kfragScrFootnotes:
{
vwenv.AddObjVecItems((int)Scripture.ScriptureTags.kflidScriptureBooks, this,
kfragBookFootnotes);
break;
}
case kfragBookFootnotes:
{
vwenv.AddObjVecItems((int)ScrBook.ScrBookTags.kflidFootnotes, this,
kfragFootnote);
break;
}
case kfragFootnote:
{
// Display each dummy footnote as a rectangle a half inch high, which allows us
// to accurately predict the height of a known number of them. Also put in a very
// short editable string, which we use for some other tests, but should not
// affect the paragraph height.
vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTop,
(int)FwTextPropVar.ktpvMilliPoint, MiscUtils.kdzmpInch / 10);
vwenv.set_IntProperty((int)FwTextPropType.ktptMarginBottom,
(int)FwTextPropVar.ktpvMilliPoint, MiscUtils.kdzmpInch / 5);
vwenv.OpenParagraph();
if (m_fWantStrings)
vwenv.AddStringProp((int)StFootnote.StFootnoteTags.kflidFootnoteMarker, this);
vwenv.AddSimpleRect(0, MiscUtils.kdzmpInch / 2, MiscUtils.kdzmpInch / 2, 0);
vwenv.CloseParagraph();
break;
}
}
}
示例2: 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;
}
}
示例3: 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
//.........这里部分代码省略.........
示例4: InsertSeq
/// <summary>
/// Insert a display of the relevant property for the indicated object, which is a sequence or collection.
/// </summary>
/// <param name="vwenv"></param>
/// <param name="hvo"></param>
public void InsertSeq(IVwEnv vwenv, int hvo)
{
vwenv.AddObjVecItems(FakePropTag, this, kfragName);
}
示例5: 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)
{
CheckDisposed();
int hvoOuter, tag, ihvo;
ITsString tss;
switch (frag)
{
case 1: // A ScrBook; display the title.
vwenv.AddObjProp((int)ScrBook.ScrBookTags.kflidTitle, this, 2);
break;
case 2: // An StText; display the paragraphs.
vwenv.GetOuterObject(vwenv.EmbeddingLevel - 1, out hvoOuter, out tag, out ihvo);
tss = TsStringHelper.MakeTSS(
"Hvo = " + hvoOuter + "; Tag = " + tag + "; Ihvo = " + ihvo,
InMemoryFdoCache.s_wsHvos.Fr);
vwenv.AddString(tss);
vwenv.AddObjVecItems((int)StText.StTextTags.kflidParagraphs, this, 3);
break;
case 3: // StTxtPara, display details of our outer object
vwenv.GetOuterObject(vwenv.EmbeddingLevel - 1, out hvoOuter, out tag, out ihvo);
tss = TsStringHelper.MakeTSS(
"Hvo = " + hvoOuter + "; Tag = " + tag + "; Ihvo = " + ihvo,
InMemoryFdoCache.s_wsHvos.Fr);
vwenv.AddString(tss);
break;
default:
throw new ApplicationException("Unexpected frag in DummyCollectorEnvVc");
}
}
示例6: Display
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
switch (frag)
{
case kfragContext:
var ctxtOrVar = m_cache.ServiceLocator.GetInstance<IPhContextOrVarRepository>().GetObject(hvo);
bool isOuterIterCtxt = false;
// are we inside an iteration context? this is important since we only open a context pile if we are not
// in an iteration context, since an iteration context does it for us
if (vwenv.EmbeddingLevel > 0)
{
int outerHvo, outerTag, outerIndex;
vwenv.GetOuterObject(vwenv.EmbeddingLevel - 1, out outerHvo, out outerTag, out outerIndex);
var outerObj = m_cache.ServiceLocator.GetObject(outerHvo);
isOuterIterCtxt = outerObj.ClassID == PhIterationContextTags.kClassId;
}
switch (ctxtOrVar.ClassID)
{
case PhSequenceContextTags.kClassId:
var seqCtxt = ctxtOrVar as IPhSequenceContext;
if (seqCtxt.MembersRS.Count > 0)
{
vwenv.AddObjVecItems(PhSequenceContextTags.kflidMembers, this, kfragContext);
}
else
{
OpenContextPile(vwenv, false);
vwenv.Props = m_bracketProps;
vwenv.AddProp(PhSequenceContextTags.kflidMembers, this, kfragEmpty);
CloseContextPile(vwenv, false);
}
break;
case PhSimpleContextNCTags.kClassId:
var ncCtxt = ctxtOrVar as IPhSimpleContextNC;
if (ncCtxt.FeatureStructureRA != null && ncCtxt.FeatureStructureRA.ClassID == PhNCFeaturesTags.kClassId)
{
// Natural class simple context with a feature-based natural class
var natClass = ncCtxt.FeatureStructureRA as IPhNCFeatures;
int numLines = GetNumLines(ncCtxt);
if (numLines == 0)
{
if (!isOuterIterCtxt)
OpenContextPile(vwenv);
vwenv.AddProp(ktagInnerNonBoundary, this, kfragLeftBracket);
vwenv.AddProp(PhSimpleContextNCTags.kflidFeatureStructure, this, kfragQuestions);
vwenv.AddProp(ktagInnerNonBoundary, this, kfragRightBracket);
if (!isOuterIterCtxt)
CloseContextPile(vwenv);
}
else if (numLines == 1)
{
if (!isOuterIterCtxt)
OpenContextPile(vwenv);
// use normal brackets for a single line context
vwenv.AddProp(ktagInnerNonBoundary, this, kfragLeftBracket);
// special consonant and vowel natural classes only display the abbreviation
if (natClass.Abbreviation.AnalysisDefaultWritingSystem.Text == "C"
|| natClass.Abbreviation.AnalysisDefaultWritingSystem.Text == "V")
{
vwenv.AddObjProp(PhSimpleContextNCTags.kflidFeatureStructure, this, kfragNC);
}
else
{
if (natClass.FeaturesOA != null && natClass.FeaturesOA.FeatureSpecsOC.Count > 0)
vwenv.AddObjProp(PhSimpleContextNCTags.kflidFeatureStructure, this, kfragFeatNC);
else if (ncCtxt.PlusConstrRS.Count > 0)
vwenv.AddObjVecItems(PhSimpleContextNCTags.kflidPlusConstr, this, kfragPlusVariable);
else
vwenv.AddObjVecItems(PhSimpleContextNCTags.kflidMinusConstr, this, kfragMinusVariable);
}
vwenv.AddProp(ktagInnerNonBoundary, this, kfragRightBracket);
if (!isOuterIterCtxt)
CloseContextPile(vwenv);
}
else
{
// multiline context
// left bracket pile
int maxNumLines = MaxNumLines;
vwenv.Props = m_bracketProps;
vwenv.set_IntProperty((int)FwTextPropType.ktptMarginLeading, (int)FwTextPropVar.ktpvMilliPoint, PILE_MARGIN);
vwenv.OpenInnerPile();
AddExtraLines(maxNumLines - numLines, ktagLeftNonBoundary, vwenv);
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 and variable pile
vwenv.set_IntProperty((int)FwTextPropType.ktptAlign, (int)FwTextPropVar.ktpvEnum, (int)FwTextAlign.ktalLeft);
//.........这里部分代码省略.........
示例7: AddFreeformAnnotations
protected virtual void AddFreeformAnnotations(IVwEnv vwenv, int hvoSeg)
{
// Add them in the order specified. Each iteration adds a group with the same flid but (typically)
// different writing systems.
for (int ispec = m_lineChoices.FirstFreeformIndex;
ispec < m_lineChoices.Count;
ispec += m_lineChoices.AdjacentWssAtIndex(ispec).Length)
{
int flid = m_lineChoices[ispec].Flid;
switch(flid)
{
case InterlinLineChoices.kflidFreeTrans:
case InterlinLineChoices.kflidLitTrans:
// These are properties of the current object.
AddFreeformComment(vwenv, hvoSeg, ispec);
break;
case InterlinLineChoices.kflidNote:
// There's a sequence of these, we use a trick with the frag to indicate which
// index into line choices we want to use to display each of them.
vwenv.AddObjVecItems(SegmentTags.kflidNotes, this, kfragSegFfChoices + ispec);
break;
default:
break; // unknown type, ignore it.
}
}
}
示例8: 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)FootnoteFrags.kfrScripture:
{
vwenv.AddLazyVecItems(ScriptureTags.kflidScriptureBooks,
this, (int)FootnoteFrags.kfrBook);
break;
}
case (int)FootnoteFrags.kfrBook:
{
vwenv.AddObjVecItems(ScrBookTags.kflidFootnotes, m_stvc,
(int)StTextFrags.kfrFootnote);
break;
}
default:
Debug.Assert(false);
break;
}
}
示例9: DisplayAnnotationFragment
//.........这里部分代码省略.........
VwFramePosition framePos = VwFramePosition.kvfpVoid;
if (ann.Hvo == SelectedNoteHvo)
{
columnCount = 7;
framePos = (ann.ResponsesOS.Count == 0 || !isExpanded || !responseExpanded) ?
VwFramePosition.kvfpBox : (VwFramePosition.kvfpAbove | VwFramePosition.kvfpVsides);
}
vwenv.OpenTable(columnCount,
vlTable, // Table uses 100% of available width.
borderThickness,
VwAlignment.kvaLeft, // Default alignment.
framePos,
//VwFramePosition.kvfpBox,
//VwRule.kvrlAll, // rule lines between cells
VwRule.kvrlNone,
0, //No space between cells.
0, //No padding inside cells.
false);
vwenv.NoteDependency(new int[] { hvo, hvo }, new int[]{m_expansionTag,
ScrScriptureNoteTags.kflidResponses}, 2);
// Specify column widths. The first argument is the number of columns,
// not a column index.
VwLength vlColumn;
if (ann.Hvo != SelectedNoteHvo)
{
vlColumn.nVal = borderThickness;
vlColumn.unit = VwUnit.kunPoint1000;
vwenv.MakeColumns(1, vlColumn);
}
vlColumn.nVal = 13000;
vlColumn.unit = VwUnit.kunPoint1000;
vwenv.MakeColumns(2, vlColumn);
vlColumn.nVal = 60000;
vlColumn.unit = VwUnit.kunPoint1000;
vwenv.MakeColumns(1, vlColumn);
vlColumn.nVal = 2;
vlColumn.unit = VwUnit.kunRelative;
vwenv.MakeColumns(1, vlColumn); // Column for the CONNOT categories
vlColumn.nVal = 12000;
vlColumn.unit = VwUnit.kunPoint1000;
vwenv.MakeColumns(1, vlColumn); // Column for the chooser button when showing quote
vlColumn.nVal = 3;
vlColumn.unit = VwUnit.kunRelative;
vwenv.MakeColumns(1, vlColumn); // Column for the quote when collapsed
vlColumn.nVal = 12000;
vlColumn.unit = VwUnit.kunPoint1000;
vwenv.MakeColumns(1, vlColumn); // Column for the chooser button when not showing quote
if (ann.Hvo != SelectedNoteHvo)
{
vlColumn.nVal = borderThickness;
vlColumn.unit = VwUnit.kunPoint1000;
vwenv.MakeColumns(1, vlColumn);
}
vwenv.OpenTableBody();
DisplayAnnotation(vwenv, ann, isExpanded);
// Only display the responses if this note is expanded and has responses.
if (!isExpanded || ann.ResponsesOS.Count == 0)
{
// Close table
vwenv.CloseTableBody();
vwenv.CloseTable();
return;
}
vwenv.NoteDependency(new int[] { ann.ResponsesOS.ToHvoArray()[0] },
new int[] { m_expansionTag }, 1);
OpenTableRow(vwenv, ann);
// Display empty first cell
vwenv.OpenTableCell(1, 1);
vwenv.CloseTableCell();
// Display expand box (+/-) in the second cell
vwenv.OpenTableCell(1, 1);
vwenv.AddObj(ann.ResponsesOS.ToHvoArray()[0], this, (int)NotesFrags.kfrExpansion);
vwenv.CloseTableCell();
// Display response label in the remaining cells
vwenv.OpenTableCell(1, 5);
vwenv.OpenConcPara(0, 0, 0, 0);
vwenv.AddString(m_responseLabel);
vwenv.CloseParagraph();
vwenv.CloseTableCell();
CloseTableRow(vwenv, ann);
// Close table
vwenv.CloseTableBody();
vwenv.CloseTable();
if (responseExpanded)
{
vwenv.AddObjVecItems((int)ScrScriptureNoteTags.kflidResponses,
this, (int)NotesFrags.kfrResponse);
}
}
示例10: Display
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
switch (frag)
{
case InterlinRibbon.kfragRibbonWordforms:
if (hvo == 0)
return;
if (m_ribbon.IsRightToLeft)
{
vwenv.set_IntProperty((int)FwTextPropType.ktptRightToLeft,
(int)FwTextPropVar.ktpvEnum, (int)FwTextToggleVal.kttvForceOn);
vwenv.set_IntProperty((int)FwTextPropType.ktptAlign,
(int)FwTextPropVar.ktpvEnum, (int)FwTextAlign.ktalLeft);
}
vwenv.OpenParagraph();
vwenv.AddObjVecItems(m_ribbon.OccurenceListId, this, InterlinVc.kfragBundle);
vwenv.CloseParagraph();
break;
case kfragBundle:
// Review: will this lead to multiple spurious blue lines?
var realHvo = (m_ribbon.Decorator as InterlinRibbonDecorator).OccurrenceFromHvo(hvo).Analysis.Hvo;
if (m_ribbon.SelLimOccurrence != null && m_ribbon.SelLimOccurrence.Analysis.Hvo == realHvo)
{
vwenv.set_IntProperty((int)FwTextPropType.ktptPadTrailing,
(int)FwTextPropVar.ktpvMilliPoint, 5000);
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTrailing,
(int)FwTextPropVar.ktpvMilliPoint, 2000);
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderColor,
(int)FwTextPropVar.ktpvDefault,
(int)ColorUtil.ConvertColorToBGR(Color.Blue));
}
base.Display(vwenv, hvo, frag);
break;
default:
base.Display(vwenv, hvo, frag);
break;
}
}
示例11: Display
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
switch (frag)
{
case InterlinRibbon.kfragRibbonAnnotations:
if (hvo == 0)
return;
vwenv.OpenParagraph();
vwenv.AddObjVecItems(m_ribbon.AnnotationListId, this, InterlinVc.kfragBundle);
vwenv.CloseParagraph();
break;
case kfragBundle:
if (m_ribbon.SelLimAnn == hvo)
{
vwenv.set_IntProperty((int)FwTextPropType.ktptPadTrailing,
(int)FwTextPropVar.ktpvMilliPoint, 5000);
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTrailing,
(int)FwTextPropVar.ktpvMilliPoint, 2000);
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderColor,
(int)FwTextPropVar.ktpvDefault,
(int)ColorUtil.ConvertColorToBGR(Color.Blue));
}
base.Display(vwenv, hvo, frag);
break;
default:
base.Display(vwenv, hvo, frag);
break;
}
}
示例12: Display
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
switch (frag)
{
case kfragPrintChart: // the whole chart with headings for printing.
if (hvo == 0)
return;
PrintColumnGroupHeaders(hvo, vwenv);
PrintIndividualColumnHeaders(hvo, vwenv);
// Rest is same as kfragChart
DisplayChartBody(vwenv);
break;
case kfragTemplateHeader: // Display the template as group headers.
vwenv.AddObjVecItems((int)CmPossibility.CmPossibilityTags.kflidSubPossibilities, this, kfragColumnGroupHeader);
break;
// This is only used for printing, the headers in the screen version are a separate control.
case kfragColumnGroupHeader:
int ccols = vwenv.DataAccess.get_VecSize(hvo, (int)CmPossibility.CmPossibilityTags.kflidSubPossibilities);
// If there are no subitems, we still want a blank cell as a placeholder.
MakeCellsMethod.OpenStandardCell(vwenv, Math.Max(ccols, 1), true);
if (ccols > 0)
{
// It's a group, include its name
vwenv.set_IntProperty((int)FwTextPropType.ktptAlign, (int)FwTextPropVar.ktpvEnum,
(int)FwTextAlign.ktalCenter);
vwenv.OpenParagraph();
vwenv.AddString(CmPossibility.BestAnalysisName(m_cache, hvo));
vwenv.CloseParagraph();
}
vwenv.CloseTableCell();
break;
case kfragChart: // the whole chart, a DsConstChart.
if (hvo == 0)
return;
DisplayChartBody(vwenv);
break;
case kfragChartRow: // one row, a CmIndirectAnnotation
{
MakeTableAndRowWithStdWidths(vwenv, hvo, false);
MakeCells(vwenv, hvo);
vwenv.CloseTableRow();
vwenv.CloseTable();
}
break;
case kfragCca: // a single group of words, the contents of one cell.
if (ConstituentChartLogic.IsWficGroup(m_cache, hvo))
vwenv.AddObjVec(kflidAppliesTo, this, kfragBundleVec);
else
{
// it's a moved text or missing-item placeholder.
int hvoClause;
if (m_chart.Logic.IsClausePlaceholder(hvo, out hvoClause))
DisplayClausePlaceholder(vwenv, hvoClause);
else if (vwenv.DataAccess.get_VecSize(hvo, kflidAppliesTo) == 0)
DisplayMissingMarker(vwenv);
else
DisplayMovedTextTag(hvo, vwenv);
}
break;
case kfragCcaMoved: // a single group of words, the contents of one cell, which is considered moved-within-line.
// can't be a placeholder.
string formatTag = m_chart.Logic.MovedTextTag(hvo);
ApplyFormatting(vwenv, formatTag);
vwenv.OpenSpan();
InsertOpenBracket(vwenv, formatTag);
vwenv.AddObjVec(kflidAppliesTo, this, kfragBundleVec);
InsertCloseBracket(vwenv, formatTag);
vwenv.CloseSpan();
break;
case kfragCcaListItem: // a single CCA, referring to a list item.
// can't be a placeholder.
ApplyFormatting(vwenv, "marker");
vwenv.OpenSpan();
InsertOpenBracket(vwenv, "marker");
vwenv.AddObjProp((int)CmBaseAnnotation.CmBaseAnnotationTags.kflidBeginObject,
this, kfragPossibility);
InsertCloseBracket(vwenv, "marker");
vwenv.CloseSpan();
break;
case kfragPossibility: // A CmPossibility, show it's abbreviation
int flid = (int)CmPossibility.CmPossibilityTags.kflidAbbreviation;
int retWs;
m_cache.LangProject.GetMagicStringAlt(LangProject.kwsFirstAnal, hvo, flid, false, out retWs);
// If we didn't find an abbreviation try for the name
ITsString tss = null;
if (retWs != 0)
tss = m_cache.GetMultiStringAlt(hvo, flid, retWs);
if (tss == null || string.IsNullOrEmpty(tss.Text))
{
flid = (int)CmPossibility.CmPossibilityTags.kflidName;
m_cache.LangProject.GetMagicStringAlt(LangProject.kwsFirstAnal, hvo, flid, false, out retWs);
}
// Unless we didn't get anything, go ahead and insert the best option we found.
if (retWs != 0)
vwenv.AddStringAltMember(flid, retWs, this);
// retWS was m_cache.DefaultAnalWs, this fixes LT-7838
break;
case kfragBundle: // One annotated word bundle; hvo is CmBaseAnnotation. Overrides behavior of InterlinVc
//.........这里部分代码省略.........
示例13: Display
/// -----------------------------------------------------------------------------------
/// <summary>
/// This is the main interesting method of displaying objects and fragments of them.
/// Here a text is displayed by displaying its paragraphs;
/// and a paragraph is displayed by invoking its style rule, making a paragraph,
/// and displaying its contents.
/// </summary>
/// <param name="vwenv">view environment</param>
/// <param name="hvo">id of object to be displayed</param>
/// <param name="frag">fragment of data</param>
/// -----------------------------------------------------------------------------------
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
CheckDisposed();
switch(frag)
{
case (int)StTextFrags.kfrFootnote:
{
if (HandleEmptyText(vwenv, hvo))
break;
vwenv.AddObjVecItems((int)StText.StTextTags.kflidParagraphs, this,
(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);
//.........这里部分代码省略.........
示例14: InsertBtSegments
/// <summary>
/// Insert the back translation segments. TeStVc overrides to make sure they are loaded properly.
/// </summary>
protected virtual void InsertBtSegments(StVc vc, IVwEnv vwenv, int hvo)
{
vwenv.AddObjVecItems(StTxtPara.SegmentsFlid(Cache), vc, (int)StTextFrags.kfrSegmentFreeTranslations);
}
示例15: Display
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
switch (frag)
{
case kfragPrintChart: // the whole chart with headings for printing.
if (hvo == 0)
return;
PrintColumnGroupHeaders(hvo, vwenv);
PrintIndividualColumnHeaders(hvo, vwenv);
// Rest is same as kfragChart
DisplayChartBody(vwenv);
break;
case kfragTemplateHeader: // Display the template as group headers.
vwenv.AddObjVecItems(CmPossibilityTags.kflidSubPossibilities, this, kfragColumnGroupHeader);
break;
// This is only used for printing, the headers in the screen version are a separate control.
case kfragColumnGroupHeader:
var ccols = vwenv.DataAccess.get_VecSize(hvo, CmPossibilityTags.kflidSubPossibilities);
// If there are no subitems, we still want a blank cell as a placeholder.
MakeCellsMethod.OpenStandardCell(vwenv, Math.Max(ccols, 1), true);
if (ccols > 0)
{
// It's a group, include its name
var possGroup = m_cache.ServiceLocator.GetInstance<ICmPossibilityRepository>().GetObject(hvo);
vwenv.set_IntProperty((int) FwTextPropType.ktptAlign, (int) FwTextPropVar.ktpvEnum,
(int) FwTextAlign.ktalCenter);
vwenv.OpenParagraph();
vwenv.AddString(possGroup.Name.BestAnalysisAlternative);
vwenv.CloseParagraph();
}
vwenv.CloseTableCell();
break;
case kfragChart: // the whole chart, a DsConstChart.
if (hvo == 0)
return;
DisplayChartBody(vwenv);
break;
case kfragChartRow: // one row, a ConstChartRow
{
MakeTableAndRowWithStdWidths(vwenv, hvo, false);
MakeCells(vwenv, hvo);
vwenv.CloseTableRow();
vwenv.CloseTable();
}
break;
case kfragCellPart: // a single group of words, the contents of one cell.
if (m_chart.Logic.IsWordGroup(hvo))
DisplayWordforms(vwenv, hvo);
else
{
// it's a moved text or clause reference placeholder.
int hvoClause;
if (m_chart.Logic.IsClausePlaceholder(hvo, out hvoClause))
DisplayClausePlaceholder(vwenv, hvoClause);
else
DisplayMovedTextTag(hvo, vwenv);
}
break;
case kfragMovedTextCellPart: // a single group of words (ConstChartWordGroup),
// the contents of one cell, which is considered moved-within-line.
// Can't be a placeholder.
var formatTag = m_chart.Logic.MovedTextTag(hvo);
ApplyFormatting(vwenv, formatTag);
vwenv.OpenSpan();
InsertOpenBracket(vwenv, formatTag);
DisplayWordforms(vwenv, hvo);
InsertCloseBracket(vwenv, formatTag);
vwenv.CloseSpan();
break;
case kfragChartListItem: // a single ConstChartTag, referring to a list item.
// can't be a placeholder.
ApplyFormatting(vwenv, "marker");
vwenv.OpenSpan();
InsertOpenBracket(vwenv, "marker");
vwenv.AddObjProp(ConstChartTagTags.kflidTag, this, kfragPossibility);
InsertCloseBracket(vwenv, "marker");
vwenv.CloseSpan();
break;
case kfragPossibility: // A CmPossibility, show it's abbreviation
var flid = CmPossibilityTags.kflidAbbreviation;
var retWs = WritingSystemServices.ActualWs(m_cache, WritingSystemServices.kwsFirstAnal, hvo, flid);
if (retWs == 0)
{
// No Abbreviation! Switch to Name
flid = CmPossibilityTags.kflidName;
retWs = WritingSystemServices.ActualWs(m_cache, WritingSystemServices.kwsFirstAnal, hvo, flid);
}
// Unless we didn't get anything, go ahead and insert the best option we found.
if (retWs != 0)
vwenv.AddStringAltMember(flid, retWs, this);
break;
case kfragBundle: // One annotated word bundle; hvo is IAnalysis object. Overrides behavior of InterlinVc
AddWordBundleInternal(hvo, vwenv);
break;
case kfragNotesString: // notes text
vwenv.AddStringProp(ConstChartRowTags.kflidNotes, this);
break;
case kfragComment: // hvo is a ConstChartRow
//.........这里部分代码省略.........