本文整理汇总了C#中IVwEnv.AddObjProp方法的典型用法代码示例。如果您正苦于以下问题:C# IVwEnv.AddObjProp方法的具体用法?C# IVwEnv.AddObjProp怎么用?C# IVwEnv.AddObjProp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVwEnv
的用法示例。
在下文中一共展示了IVwEnv.AddObjProp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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)
{
int frWs = vwenv.DataAccess.WritingSystemFactory.GetWsFromStr("fr");
int hvoOuter, tag, ihvo;
ITsString tss;
switch (frag)
{
case 1: // A ScrBook; display the title.
vwenv.AddObjProp(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,
frWs);
vwenv.AddString(tss);
vwenv.AddObjVecItems(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,
frWs);
vwenv.AddString(tss);
break;
default:
throw new ApplicationException("Unexpected frag in DummyCollectorEnvVc");
}
}
示例2: Display
/// ------------------------------------------------------------------------------------
/// <summary>
/// This is the main interesting method of displaying objects and fragments of them.
/// A Scripture is displayed by displaying its Books;
/// and a Book is displayed by displaying its Title and Sections;
/// and a Section is diplayed by displaying its Heading and Content;
/// which are displayed by 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)
{
CheckDisposed();
if (hvo == 0)
return; // not much we can display without a valid object
switch (frag)
{
case (int)ScrFrags.kfrBook:
vwenv.OpenDiv();
vwenv.AddObjProp((int)ScrBook.ScrBookTags.kflidTitle, this,
(int)StTextFrags.kfrText);
vwenv.NoteDependency(new int[] { m_cache.LangProject.TranslatedScriptureOAHvo },
new int[] { (int)Scripture.ScriptureTags.kflidScriptureBooks }, 1);
vwenv.NoteDependency(new int[] { hvo },
new int[] { (int)ScrBook.ScrBookTags.kflidSections }, 1);
vwenv.AddLazyVecItems(m_sectionTag, this, (int)ScrFrags.kfrSection);
// TODO (EberhardB): The gap between the intro division and the text
// division probably needs to be configurable somewhere...
// Add a 24 point gap at the bottom of the intro section
vwenv.AddSimpleRect(ColorUtil.ConvertColorToBGR(BackColor), -1, 24000, 0);
vwenv.CloseDiv();
break;
default:
base.Display(vwenv, hvo, frag);
break;
}
}
示例3: Insert
/// <summary>
/// Insert a display of the relevant property for the indicated object, which is atomic.
/// </summary>
/// <param name="vwenv"></param>
/// <param name="hvo"></param>
public void Insert(IVwEnv vwenv, int hvo)
{
vwenv.AddObjProp(FakePropTag, this, kfragName);
}
示例4: 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");
}
}
示例5: 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)
//.........这里部分代码省略.........
示例6: Display
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
#if __MonoCS__
// TODO-Linux: Randomly m_tsf seem to have been Release.
// eg Marshal.ReleaseComObject(m_tsf);
// However the Dispose method isn't called (which calls the Release)
// Currently unsure what is doing this need to find out - very concerning
// Hack - just recreate a new TsStrFactory each time... for now
// seems to stop the problem.
m_tsf = TsStrFactoryClass.Create();
#endif
CheckDisposed();
if (hvo == 0)
return; // Can't do anything without an hvo (except crash -- see LT-9348).
#if DEBUG
//TimeRecorder.Begin("Display");
#endif
switch (frag)
{
case kfragStText: // new root object for InterlinDocChild.
SetupRealVernWsForDisplay(WritingSystemServices.ActualWs(m_cache, WritingSystemServices.kwsVernInParagraph,
hvo, StTextTags.kflidParagraphs));
vwenv.AddLazyVecItems(StTextTags.kflidParagraphs, this, kfragInterlinPara);
break;
case kfragInterlinPara: // Whole StTxtPara. This can be the root fragment in DE view.
if (vwenv.DataAccess.get_VecSize(hvo, StTxtParaTags.kflidSegments) == 0)
{
vwenv.NoteDependency(new int[] { hvo }, new int[] { StTxtParaTags.kflidSegments }, 1);
vwenv.AddString(m_tssEmptyPara);
}
else
{
PreferredVernWs = WritingSystemServices.ActualWs(m_cache, WritingSystemServices.kwsVernInParagraph, hvo, StTxtParaTags.kflidSegments);
// Include the plain text version of the paragraph?
vwenv.AddLazyVecItems(StTxtParaTags.kflidSegments, this, kfragParaSegment);
}
break;
case kfragParaSegment:
// Don't put anything in this segment if it is a 'label' segment (typically containing a verse
// number for TE).
var seg = m_segRepository.GetObject(hvo);
if (seg.IsLabel)
break;
// 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.
var haveFreeform = seg.FreeTranslation != null || seg.LiteralTranslation != null || seg.NotesOS.Count > 0;
vwenv.set_IntProperty((int)FwTextPropType.ktptMarginBottom,
(int)FwTextPropVar.ktpvMilliPoint, !haveFreeform ? 5000 : 10000);
vwenv.OpenDiv();
// Enhance JohnT: determine what the overall direction of the paragraph should
// be and set it.
if (m_mpBundleHeight == 0)
{
// First time...figure it out.
int dmpx, dmpyAnal, dmpyVern;
vwenv.get_StringWidth(m_tssEmptyAnalysis, null, out dmpx, out dmpyAnal);
vwenv.get_StringWidth(m_tssEmptyVern, null, out dmpx, out dmpyVern);
m_mpBundleHeight = dmpyAnal * 4 + dmpyVern * 3;
}
// The interlinear bundles are not editable.
vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
(int)FwTextPropVar.ktpvEnum, (int)TptEditable.ktptNotEditable);
if (m_fRtl)
{
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.set_IntProperty((int)FwTextPropType.ktptSpellCheck, (int)FwTextPropVar.ktpvEnum,
(int)SpellingModes.ksmDoNotCheck);
vwenv.OpenParagraph();
AddSegmentReference(vwenv, hvo); // Calculate and display the segment reference.
AddLabelPile(vwenv, m_tsf, m_cache, true, m_fShowMorphBundles);
vwenv.AddObjVecItems(SegmentTags.kflidAnalyses, this, kfragBundle);
// JohnT, 1 Feb 2008. Took this out as I can see no reason for it; AddObjVecItems handles
// the dependency already. Adding it just means that any change to the forms list
// regenerates a higher level than needed, which contributes to a great deal of scrolling
// and flashing (LT-7470).
// Originally added by Eric in revision 72 on the trunk as part of handling phrases.
// Eric can't see any reason we need it now, either. If you find a need to re-insert it,
// please document carefully the reasons it is needed and what bad consequences follow
// from removing it.
//vwenv.NoteDependency(new int[] { hvo }, new int[] { ktagSegmentForms }, 1);
vwenv.CloseParagraph();
// We'd get the same visual effect from just calling AddFreeformAnnotations here. But then a regenerate
// such as happens when hiding or showing a prompt has to redisplay the whole segment. This initially
// makes it lazy, then the lazy stuff gets expanded. In the process we may get undesired scrolling (LT-12248).
// So we insert another layer of object, allowing just the freeforms to be regenerated.
var flidSelf = Cache.MetaDataCacheAccessor.GetFieldId2(CmObjectTags.kClassId, "Self", false);
vwenv.AddObjProp(flidSelf, this, kfragFreeformBundle);
vwenv.CloseDiv();
break;
case kfragFreeformBundle:
AddFreeformAnnotations(vwenv, hvo);
break;
case kfragBundle: // One annotated word bundle; hvo is the IAnalysis object.
// checking AllowLayout (especially in context of Undo/Redo make/break phrase)
//.........这里部分代码省略.........
示例7: DisplayMorphForm
private void DisplayMorphForm(IVwEnv vwenv, int hvo, int ws)
{
var mf = (IMoForm)m_coRepository.GetObject(hvo);
// The form of an MoForm. Hvo is some sort of MoMorph. Display includes its prefix
// and suffix.
// Todo: make prefix and suffix read-only.
vwenv.OpenParagraph(); // group prefix, form, suffix on one line.
// It may not have a morph type at all.
// RBR says: "So why take the chance of a null ref exception (which I ran into, in my ZPI data, of course)? :-)
// int typeID = mf.MorphTypeRA.Hvo;
var morphType = mf.MorphTypeRA;
if (morphType != null)
vwenv.AddObjProp(MoFormTags.kflidMorphType, this, kfragPrefix);
vwenv.AddStringAltMember(MoFormTags.kflidForm,
ws, this);
if (morphType != null)
vwenv.AddObjProp(MoFormTags.kflidMorphType, this, kfragPostfix);
vwenv.CloseParagraph();
}
示例8: DisplaySingleInterlinearAnalysisWithLabels
private void DisplaySingleInterlinearAnalysisWithLabels(IVwEnv vwenv, int hvo)
{
/*
// Enhance JohnT: determine what the overall direction of the paragraph should
// be and set it.
if (m_mpBundleHeight == 0)
{
// First time...figure it out.
int dmpx, dmpyAnal, dmpyVern;
vwenv.get_StringWidth(m_tssEmptyAnalysis, null, out dmpx, out dmpyAnal);
vwenv.get_StringWidth(m_tssEmptyVern, null, out dmpx, out dmpyVern);
m_mpBundleHeight = dmpyAnal * 4 + dmpyVern * 3;
}
*/
// The interlinear bundle is not editable.
vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
(int)FwTextPropVar.ktpvEnum, (int)TptEditable.ktptNotEditable);
if (m_fRtl)
{
// This must not be on the outer paragraph or we get infinite width.
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.OpenParagraph();
m_fHaveOpenedParagraph = true;
AddLabelPile(vwenv, m_tsf, m_cache, true, m_fShowMorphBundles);
try
{
// We use this rather than AddObj(hvo) so we can easily identify this object and select
// it using MakeObjSel.
vwenv.AddObjProp(m_selfFlid, this, kfragAnalysisMorphs);
vwenv.CloseParagraph();
}
finally
{
m_fHaveOpenedParagraph = false;
}
/*
// This puts 3 points of margin on the first FF annotation, if any.
vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTop,
(int)FwTextPropVar.ktpvMilliPoint, 0); // 3000
vwenv.AddObjVec(ktagSegFF, this, kfragSegFf);
*/
}
示例9: DisplayLexGloss
private void DisplayLexGloss(IVwEnv vwenv, int hvo, int ws, int choiceIndex)
{
int hvoNo = vwenv.DataAccess.get_ObjectProp(hvo, ktagSbMorphGloss);
SetColor(vwenv, m_choices.LabelRGBFor(choiceIndex));
if (m_fIconsForAnalysisChoices)
{
// This line does not have one, but add some white space to line things up.
vwenv.set_IntProperty((int)FwTextPropType.ktptLeadingIndent,
(int)FwTextPropVar.ktpvMilliPoint,
m_dxmpArrowPicWidth + kmpIconMargin);
}
if (hvoNo == 0)
{
// One of these is enough, the regeneration will redo an outer object and get
// all the alternatives.
vwenv.NoteDependency(new int[] { hvo }, new int[] { ktagSbMorphGloss }, 1);
vwenv.AddProp(ktagMissingMorphGloss, this, kfragMissingMorphGloss);
}
else
{
vwenv.AddObjProp(ktagSbMorphGloss, this, kfragNamedObjectNameChoices + choiceIndex);
}
}
示例10: DisplayObjectProperty
protected virtual void DisplayObjectProperty(IVwEnv vwenv, int hvo)
{
vwenv.AddObjProp(m_flid, this, AtomicReferenceView.kFragObjName);
}
示例11: Insert
/// <summary>
/// Insert a display of the relevant property for the indicated object, which is atomic.
/// </summary>
/// <param name="vwenv"></param>
/// <param name="hvo"></param>
public void Insert(IVwEnv vwenv, int hvo)
{
CheckDisposed();
vwenv.AddObjProp(FakePropTag, this, kfragName);
}
示例12: Display
//.........这里部分代码省略.........
case kfragRuleMapping:
var mapping = m_cache.ServiceLocator.GetInstance<IMoRuleMappingRepository>().GetObject(hvo);
switch (mapping.ClassID)
{
case MoCopyFromInputTags.kClassId:
var copy = (IMoCopyFromInput) mapping;
OpenIndexPile(vwenv);
if (copy.ContentRA == null)
vwenv.AddProp(ktagIndex, this, 0);
else
vwenv.AddProp(ktagIndex, this, copy.ContentRA.IndexInOwner + 1);
CloseIndexPile(vwenv);
break;
case MoInsertPhonesTags.kClassId:
OpenIndexPile(vwenv);
vwenv.AddObjVecItems(MoInsertPhonesTags.kflidContent, this, kfragTerminalUnit);
CloseIndexPile(vwenv);
break;
case MoModifyFromInputTags.kClassId:
var modify = (IMoModifyFromInput) mapping;
var numLines = modify.ModificationRA.FeaturesOA.FeatureSpecsOC.Count;
// left bracket pile
vwenv.set_IntProperty((int)FwTextPropType.ktptMarginLeading, (int)FwTextPropVar.ktpvMilliPoint, PILE_MARGIN);
vwenv.OpenInnerPile();
vwenv.Props = m_bracketProps;
vwenv.AddProp(ktagLeftBoundary, this, kfragZeroWidthSpace);
// put index in the left bracket pile
if (modify.ContentRA == null)
vwenv.AddProp(ktagIndex, this, 0);
else
vwenv.AddProp(ktagIndex, this, modify.ContentRA.IndexInOwner + 1);
// right align brackets in left bracket pile, since the index could have a greater width, then the bracket
if (numLines > 1)
{
vwenv.Props = m_bracketProps;
vwenv.set_IntProperty((int)FwTextPropType.ktptAlign, (int)FwTextPropVar.ktpvEnum, (int)FwTextAlign.ktalRight);
vwenv.AddProp(ktagLeftNonBoundary, this, kfragLeftBracketUpHook);
for (int i = 1; i < numLines - 1; i++)
{
vwenv.Props = m_bracketProps;
vwenv.set_IntProperty((int)FwTextPropType.ktptAlign, (int)FwTextPropVar.ktpvEnum, (int)FwTextAlign.ktalRight);
vwenv.AddProp(ktagLeftNonBoundary, this, kfragLeftBracketExt);
}
vwenv.Props = m_bracketProps;
vwenv.set_IntProperty((int)FwTextPropType.ktptAlign, (int)FwTextPropVar.ktpvEnum, (int)FwTextAlign.ktalRight);
vwenv.AddProp(ktagLeftNonBoundary, this, kfragLeftBracketLowHook);
}
else
{
vwenv.set_IntProperty((int)FwTextPropType.ktptAlign, (int)FwTextPropVar.ktpvEnum, (int)FwTextAlign.ktalRight);
vwenv.AddProp(ktagLeftNonBoundary, this, kfragLeftBracket);
}
vwenv.CloseInnerPile();
// feature pile
vwenv.set_IntProperty((int)FwTextPropType.ktptAlign, (int)FwTextPropVar.ktpvEnum, (int)FwTextAlign.ktalLeft);
vwenv.OpenInnerPile();
AddExtraLines(1, vwenv);
if (numLines == 0)
vwenv.AddProp(MoModifyFromInputTags.kflidModification, this, kfragQuestions);
else
vwenv.AddObjProp(MoModifyFromInputTags.kflidModification, this, kfragFeatNC);
vwenv.CloseInnerPile();
// right bracket pile
vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTrailing, (int)FwTextPropVar.ktpvMilliPoint, PILE_MARGIN);
vwenv.OpenInnerPile();
vwenv.Props = m_bracketProps;
vwenv.AddProp(ktagRightBoundary, this, kfragSpace);
if (numLines > 1)
{
vwenv.Props = m_bracketProps;
vwenv.AddProp(ktagRightNonBoundary, this, kfragRightBracketUpHook);
for (int i = 1; i < numLines - 1; i++)
{
vwenv.Props = m_bracketProps;
vwenv.AddProp(ktagRightNonBoundary, this, kfragRightBracketExt);
}
vwenv.Props = m_bracketProps;
vwenv.AddProp(ktagRightNonBoundary, this, kfragRightBracketLowHook);
}
else
{
vwenv.AddProp(ktagRightNonBoundary, this, kfragRightBracket);
}
vwenv.CloseInnerPile();
break;
}
break;
default:
base.Display(vwenv, hvo, frag);
break;
}
}
示例13: 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)
{
if ((m_displayType & DisplayType.kLiteralStringLabels) != 0)
{
ITsStrFactory factory = TsStrFactoryClass.Create();
vwenv.AddString(factory.MakeString("Label" + m_counter++, m_wsDefault));
}
switch(frag)
{
case 1: // the root; display the subitems, first using non-lazy view, then lazy one.
if ((m_displayType & DisplayType.kFootnoteDetailsSeparateParas) == DisplayType.kFootnoteDetailsSeparateParas)
vwenv.AddObjVecItems(m_flid, this, 10);
if ((m_displayType & DisplayType.kFootnoteDetailsSinglePara) == DisplayType.kFootnoteDetailsSinglePara)
vwenv.AddObjVecItems(m_flid, this, 11);
else
{
if ((m_displayType & DisplayType.kNormal) == DisplayType.kNormal)
{
vwenv.AddObjVecItems(m_flid, this, 3);
}
if ((m_displayType & DisplayType.kLazy) == DisplayType.kLazy)
{
vwenv.AddObjVecItems(m_flid, this, 2);
}
}
if ((m_displayType & DisplayType.kTitle) == DisplayType.kTitle)
vwenv.AddObjProp(SimpleRootsiteTestsConstants.kflidDocTitle, this, 3);
if (m_displayType == DisplayType.kOuterObjDetails)
vwenv.AddObjVecItems(m_flid, this, 6);
break;
case 2: // An StText, display paragraphs lazily
if ((m_displayType & DisplayType.kWithTopMargin) == DisplayType.kWithTopMargin)
vwenv.AddLazyVecItems(SimpleRootsiteTestsConstants.kflidTextParas, this, 4);
vwenv.AddLazyVecItems(SimpleRootsiteTestsConstants.kflidTextParas, this, 5);
break;
case 3: // An StText, display paragraphs not lazily.
if ((m_displayType & DisplayType.kWithTopMargin) == DisplayType.kWithTopMargin)
vwenv.AddObjVecItems(SimpleRootsiteTestsConstants.kflidTextParas, this, 4);
vwenv.AddObjVecItems(SimpleRootsiteTestsConstants.kflidTextParas, this, 5);
if ((m_displayType & DisplayType.kDuplicateParagraphs) != 0)
vwenv.AddObjVecItems(SimpleRootsiteTestsConstants.kflidTextParas, this, 5);
break;
case 4: // StTxtPara, display contents with top margin
OpenParaIfNeeded(vwenv, hvo);
vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTop,
(int)FwTextPropVar.ktpvMilliPoint, kMarginTop);
AddParagraphContents(vwenv);
break;
case 5: // StTxtPara, display contents without top margin
OpenParaIfNeeded(vwenv, hvo);
AddParagraphContents(vwenv);
break;
case 6: // StTxtPara, display details of our outer object
int hvoOuter, tag, ihvo;
vwenv.GetOuterObject(vwenv.EmbeddingLevel - 1, out hvoOuter, out tag, out ihvo);
ITsString tss = TsStringHelper.MakeTSS("Hvo = " + hvoOuter + "; Tag = " + tag + "; Ihvo = " + ihvo,
m_wsDefault);
vwenv.AddString(tss);
break;
case SimpleRootsiteTestsConstants.kflidDocDivisions:
vwenv.AddObjVecItems(SimpleRootsiteTestsConstants.kflidDocDivisions, this,
SimpleRootsiteTestsConstants.kflidSectionStuff);
break;
case SimpleRootsiteTestsConstants.kflidSectionStuff:
if ((m_displayType & DisplayType.kNormal) == DisplayType.kNormal)
vwenv.AddObjProp(frag, this, 3);
if ((m_displayType & DisplayType.kLazy) == DisplayType.kLazy)
vwenv.AddObjProp(frag, this, 2);
break;
case 7: // ScrBook
vwenv.OpenDiv();
vwenv.AddObjVecItems(SimpleRootsiteTestsConstants.kflidDocFootnotes, this, 8);
vwenv.CloseDiv();
break;
case 8: // StFootnote
vwenv.AddObjVecItems(SimpleRootsiteTestsConstants.kflidTextParas, this,
9);
break;
case 9: // StTxtPara
vwenv.AddStringProp(SimpleRootsiteTestsConstants.kflidParaContents, null);
break;
case 10:
// Display a Footnote by displaying its "FootnoteMarker" in a paragraph
// by itself, followed by the sequence of paragraphs.
vwenv.AddStringProp(SimpleRootsiteTestsConstants.kflidFootnoteMarker, null);
vwenv.AddObjVecItems(SimpleRootsiteTestsConstants.kflidTextParas, this,
9);
break;
case 11:
// Display a Footnote by displaying its "FootnoteMarker" followed by the
// contents of its first paragraph (similar to the way footnotes are displayed in
// real life.
//.........这里部分代码省略.........
示例14: Display
/// ------------------------------------------------------------------------------------
/// <summary>
/// This is the main interesting method of displaying objects and fragments of them.
/// A Scripture is displayed by displaying its Books;
/// and a Book is displayed by displaying its Title and Sections;
/// and a Section is displayed by displaying its Heading and Content;
/// which are displayed by 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)
{
CheckDisposed();
switch (frag)
{
case (int)ScrFrags.kfrScripture:
vwenv.AddLazyVecItems((int)Scripture.ScriptureTags.kflidScriptureBooks,
this, (int)ScrFrags.kfrBook);
break;
case (int)ScrFrags.kfrBook:
vwenv.OpenDiv();
vwenv.AddObjProp((int)ScrBook.ScrBookTags.kflidTitle, this,
(int)StTextFrags.kfrText);
vwenv.AddLazyVecItems((int)ScrBook.ScrBookTags.kflidSections, this,
(int)ScrFrags.kfrSection);
vwenv.CloseDiv();
break;
case (int)ScrFrags.kfrSection:
vwenv.OpenDiv();
vwenv.AddObjProp((int)ScrSection.ScrSectionTags.kflidHeading, this,
(int)StTextFrags.kfrText);
vwenv.AddObjProp((int)ScrSection.ScrSectionTags.kflidContent, this,
(int)StTextFrags.kfrText);
vwenv.CloseDiv();
break;
case (int)StTextFrags.kfrPara:
if (m_hvosReadOnly.Contains(hvo))
{
vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
(int)FwTextPropVar.ktpvEnum,
(int)TptEditable.ktptNotEditable);
}
base.Display(vwenv, hvo, frag);
break;
default:
base.Display(vwenv, hvo, frag);
break;
}
}
示例15: Display
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
switch (frag)
{
case kfragRHS:
m_rhs = m_cache.ServiceLocator.GetInstance<IPhSegRuleRHSRepository>().GetObject(hvo);
var rule = m_rhs.OwningRule;
if (rule.Disabled)
{
vwenv.set_StringProperty((int)FwTextPropType.ktptNamedStyle, "Disabled Text");
}
int arrowWidth, slashWidth, underscoreWidth, charHeight;
vwenv.get_StringWidth(m_arrow, m_charProps, out arrowWidth, out charHeight);
int maxCharHeight = charHeight;
vwenv.get_StringWidth(m_slash, m_charProps, out slashWidth, out charHeight);
maxCharHeight = Math.Max(charHeight, maxCharHeight);
vwenv.get_StringWidth(m_underscore, m_charProps, out underscoreWidth, out charHeight);
maxCharHeight = Math.Max(charHeight, maxCharHeight);
int dmpx, spaceHeight;
vwenv.get_StringWidth(m_zwSpace, m_bracketProps, out dmpx, out spaceHeight);
int maxNumLines = GetMaxNumLines();
int maxCtxtHeight = maxNumLines * spaceHeight;
int maxHeight = Math.Max(maxCharHeight, maxCtxtHeight);
int charOffset = maxHeight;
int ctxtPadding = maxHeight - maxCtxtHeight;
VwLength tableLen;
tableLen.nVal = 10000;
tableLen.unit = VwUnit.kunPercent100;
vwenv.OpenTable(7, tableLen, 0, VwAlignment.kvaCenter, VwFramePosition.kvfpVoid, VwRule.kvrlNone, 0, 0, false);
VwLength ctxtLen;
ctxtLen.nVal = 1;
ctxtLen.unit = VwUnit.kunRelative;
VwLength charLen;
charLen.unit = VwUnit.kunPoint1000;
vwenv.MakeColumns(1, ctxtLen);
charLen.nVal = arrowWidth + 4000;
vwenv.MakeColumns(1, charLen);
vwenv.MakeColumns(1, ctxtLen);
charLen.nVal = slashWidth + 4000;
vwenv.MakeColumns(1, charLen);
vwenv.MakeColumns(1, ctxtLen);
charLen.nVal = underscoreWidth + 4000;
vwenv.MakeColumns(1, charLen);
vwenv.MakeColumns(1, ctxtLen);
vwenv.OpenTableBody();
vwenv.OpenTableRow();
// LHS cell
vwenv.Props = m_ctxtProps;
vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop, (int)FwTextPropVar.ktpvMilliPoint, ctxtPadding);
vwenv.OpenTableCell(1, 1);
vwenv.OpenParagraph();
vwenv.AddObjProp(m_cache.MetaDataCacheAccessor.GetFieldId2(PhSegRuleRHSTags.kClassId, "OwningRule", false), this, kfragRule);
vwenv.CloseParagraph();
vwenv.CloseTableCell();
// arrow cell
vwenv.Props = m_charProps;
vwenv.set_IntProperty((int)FwTextPropType.ktptOffset, (int)FwTextPropVar.ktpvMilliPoint, -charOffset);
vwenv.OpenTableCell(1, 1);
vwenv.AddString(m_arrow);
vwenv.CloseTableCell();
// RHS cell
vwenv.Props = m_ctxtProps;
vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop, (int)FwTextPropVar.ktpvMilliPoint, ctxtPadding);
vwenv.OpenTableCell(1, 1);
vwenv.OpenParagraph();
if (m_rhs.StrucChangeOS.Count > 0)
{
vwenv.AddObjVecItems(PhSegRuleRHSTags.kflidStrucChange, this, kfragContext);
}
else
{
vwenv.NoteDependency(new[] {hvo}, new[] {PhSegRuleRHSTags.kflidStrucChange}, 1);
OpenSingleLinePile(vwenv, maxNumLines, false);
vwenv.Props = m_bracketProps;
vwenv.AddProp(PhSegRuleRHSTags.kflidStrucChange, this, kfragEmpty);
CloseSingleLinePile(vwenv, false);
}
vwenv.CloseParagraph();
vwenv.CloseTableCell();
// slash cell
vwenv.Props = m_charProps;
vwenv.set_IntProperty((int)FwTextPropType.ktptOffset, (int)FwTextPropVar.ktpvMilliPoint, -charOffset);
vwenv.OpenTableCell(1, 1);
//.........这里部分代码省略.........