本文整理汇总了C#中IVwEnv.NoteDependency方法的典型用法代码示例。如果您正苦于以下问题:C# IVwEnv.NoteDependency方法的具体用法?C# IVwEnv.NoteDependency怎么用?C# IVwEnv.NoteDependency使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVwEnv
的用法示例。
在下文中一共展示了IVwEnv.NoteDependency方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
}
示例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.NoteDependency(new int[] { m_cache.LanguageProject.TranslatedScriptureOA.Hvo },
new int[] { ScriptureTags.kflidScriptureBooks }, 1);
vwenv.NoteDependency(new int[] { hvo },
new int[] { ScrBookTags.kflidSections }, 1);
vwenv.AddLazyVecItems(ScrBookTags.kflidSections, this, (int)ScrFrags.kfrSection);
vwenv.CloseDiv();
break;
default:
base.Display(vwenv, hvo, frag);
break;
}
}
示例3: 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);
//.........这里部分代码省略.........
示例4: Display
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
switch (frag)
{
case AudioVisualView.kfragPathname:
// Display the filename.
ILgWritingSystemFactory wsf =
m_cache.WritingSystemFactory;
vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
(int)FwTextPropVar.ktpvDefault,
(int)TptEditable.ktptNotEditable);
ITsString tss;
ITsStrFactory tsf = m_cache.TsStrFactory;
Debug.Assert(hvo != 0);
Debug.Assert(m_cache != null);
var file = m_cache.ServiceLocator.GetInstance<ICmFileRepository>().GetObject(hvo);
Debug.Assert(file != null);
string path = file.AbsoluteInternalPath;
tss = tsf.MakeString(path, m_cache.WritingSystemFactory.UserWs);
vwenv.OpenParagraph();
vwenv.NoteDependency( new [] { m_cache.LangProject.Hvo, file.Hvo},
new [] {LangProjectTags.kflidLinkedFilesRootDir, CmFileTags.kflidInternalPath}, 2);
vwenv.AddString(tss);
vwenv.CloseParagraph();
break;
default:
throw new ArgumentException(
"Don't know what to do with the given frag.", "frag");
}
}
示例5: InsertParaContentsUserPrompt
/// -----------------------------------------------------------------------------------
/// <summary>
/// In certain contexts, check the given paragraph to see if it is empty. If so,
/// insert a user prompt.
/// </summary>
/// <param name="vwenv">view environment</param>
/// <param name="paraHvo">HVO of the paragraph to be displayed</param>
/// <returns>true if an empty string was substituted for missing/empty StText</returns>
/// -----------------------------------------------------------------------------------
protected override bool InsertParaContentsUserPrompt(IVwEnv vwenv, int paraHvo)
{
Debug.Assert(!DisplayTranslation);
// No user prompt in any of these conditions
IStTxtPara para = m_cache.ServiceLocator.GetInstance<IStTxtParaRepository>().GetObject(paraHvo);
if (!(para is IScrTxtPara)
|| !Options.ShowEmptyParagraphPromptsSetting // tools options setting
|| m_target == LayoutViewTarget.targetPrint // any print layout view
|| m_updatedPrompts.Contains(para.Hvo)) // user interaction has updated prompt
{
return false;
}
// User prompt is only for title & heading paras
IStText text = (IStText)para.Owner; // para owner
if (text.OwningFlid != ScrBookTags.kflidTitle &&
text.OwningFlid != ScrSectionTags.kflidHeading)
return false;
int paraCount = text.ParagraphsOS.Count;
Debug.Assert(paraCount != 0,
"We shouldn't come here if StText doesn't contain any paragraphs");
// By design, if there is more than one para, don't display the user prompt.
if (paraCount != 1)
return false;
// If first para is empty, insert user prompt for paragraph content
if (text[0].Contents.Text == null)
{
vwenv.NoteDependency(new int[] { para.Hvo },
new int[] { StTxtParaTags.kflidContents}, 1);
vwenv.AddProp(SimpleRootSite.kTagUserPrompt, this, text.OwningFlid);
return true;
}
return false;
}
示例6: DisplayFootnoteMarker
/// ------------------------------------------------------------------------------------
/// <summary>
/// Display the footnote marker.
/// </summary>
/// <param name="vwenv">View environment</param>
/// <param name="footnote">The footnote.</param>
/// ------------------------------------------------------------------------------------
private void DisplayFootnoteMarker(IVwEnv vwenv, ScrFootnote footnote)
{
vwenv.NoteDependency(new int[] { footnote.Hvo },
new int[] { (int)StFootnote.StFootnoteTags.kflidFootnoteMarker }, 1);
// The footnote marker is not editable.
vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
(int)FwTextPropVar.ktpvEnum,
(int)TptEditable.ktptNotEditable);
ITsStrBldr strBldr = footnote.MakeFootnoteMarker(DefaultWs);
strBldr.Replace(strBldr.Length, strBldr.Length, " ", null);
vwenv.AddString(strBldr.GetString());
}
示例7: 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)
//.........这里部分代码省略.........
示例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: AddOptionalNamedObj
/// <summary>
/// Add to the vwenv a display of property tag of object hvo, which stores an
/// SbNamedObj. If the property is non-null, display the name of the SbNamedObj.
/// If not, display the dummyTag 'property' using the dummyFrag.
/// </summary>
/// <param name="vwenv"></param>
/// <param name="hvo"></param>
/// <param name="tag"></param>
/// <param name="dummyTag"></param>
/// <param name="dummyFrag"></param>
/// <param name="tagIcon">If non-zero, display a pull-down icon before the item, marked with this tag.</param>
/// <param name="ws">which alternative of the name to display</param>
/// <param name="choiceIndex">which item in m_choices this comes from. The icon is displayed
/// only if it is the first one for its flid.</param>
protected void AddOptionalNamedObj(IVwEnv vwenv, int hvo, int tag, int dummyTag,
int dummyFrag, int tagIcon, int ws, int choiceIndex)
{
int hvoNo = vwenv.DataAccess.get_ObjectProp(hvo, tag);
SetColor(vwenv, m_choices.LabelRGBFor(choiceIndex));
bool fWantIcon = false;
fWantIcon = tagIcon != 0 && m_choices.IsFirstOccurrenceOfFlid(choiceIndex);
if (m_fIconsForAnalysisChoices && !fWantIcon)
{
// 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);
}
vwenv.OpenParagraph();
if (fWantIcon)
AddPullDownIcon(vwenv, tagIcon);
// The NoteDependency is needed whether or not hvoNo is set, in case we update
// to a sense which has a null MSA. See LT-4246.
vwenv.NoteDependency(new int[] { hvo }, new int[] { tag }, 1);
if (hvoNo == 0)
vwenv.AddProp(dummyTag, this, dummyFrag);
else
vwenv.AddObjProp(tag, this, kfragNamedObjectNameChoices + choiceIndex);
vwenv.CloseParagraph();
}
示例10: 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);
}
}
示例11: Display
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
switch (frag)
{
case AtomicReferenceView.kFragAtomicRef:
// Display a paragraph with a single item.
int hvoProp = HvoOfObjectToDisplay(vwenv, hvo);
if (hvoProp == 0)
{
vwenv.set_IntProperty((int)FwTextPropType.ktptForeColor,
(int)FwTextPropVar.ktpvDefault,
(int)ColorUtil.ConvertColorToBGR(Color.Gray));
vwenv.set_IntProperty((int)FwTextPropType.ktptLeadingIndent,
(int)FwTextPropVar.ktpvMilliPoint, 18000);
vwenv.set_IntProperty((int)FwTextPropType.ktptAlign,
(int)FwTextPropVar.ktpvEnum, (int)FwTextAlign.ktalRight);
//vwenv.AddString(m_cache.MakeUserTss("Click to select -->"));
vwenv.NoteDependency(new int[] {hvo}, new int[] {m_flid}, 1);
}
else
{
vwenv.OpenParagraph(); // vwenv.OpenMappedPara();
DisplayObjectProperty(vwenv, hvoProp);
vwenv.CloseParagraph();
}
break;
case AtomicReferenceView.kFragObjName:
// Display one reference.
{
ILgWritingSystemFactory wsf =
m_cache.WritingSystemFactory;
vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
(int)FwTextPropVar.ktpvDefault,
(int)TptEditable.ktptNotEditable);
ITsString tss;
ITsStrFactory tsf = m_cache.TsStrFactory;
Debug.Assert(hvo != 0);
// Use reflection to get a prebuilt name if we can. Otherwise
// settle for piecing together a string.
Debug.Assert(m_cache != null);
var obj = m_cache.ServiceLocator.GetInstance<ICmObjectRepository>().GetObject(hvo);
Debug.Assert(obj != null);
System.Type type = obj.GetType();
System.Reflection.PropertyInfo pi = type.GetProperty("TsName",
System.Reflection.BindingFlags.Instance |
System.Reflection.BindingFlags.Public |
System.Reflection.BindingFlags.FlattenHierarchy);
if (pi != null)
{
tss = (ITsString)pi.GetValue(obj, null);
}
else
{
if (!string.IsNullOrEmpty(m_displayNameProperty))
{
pi = type.GetProperty(m_displayNameProperty,
System.Reflection.BindingFlags.Instance |
System.Reflection.BindingFlags.Public |
System.Reflection.BindingFlags.FlattenHierarchy);
}
int ws = wsf.GetWsFromStr(obj.SortKeyWs);
if (ws == 0)
ws = m_cache.ServiceLocator.WritingSystems.DefaultAnalysisWritingSystem.Handle;
if (pi != null)
{
object info = pi.GetValue(obj, null);
// handle the object type
if (info is String)
tss = tsf.MakeString((string)info, ws);
else if (info is IMultiUnicode)
{
var accessor = info as IMultiUnicode;
tss = accessor.get_String(ws); // try the requested one (or default analysis)
if (tss == null || tss.Length == 0)
tss = accessor.BestAnalysisVernacularAlternative; // get something
}
else if (info is ITsString)
tss = (ITsString)info;
else
tss = null;
}
else
{
tss = obj.ShortNameTSS; // prefer this, which is hopefully smart about wss.
if (tss == null || tss.Length == 0)
{
tss = tsf.MakeString(obj.ShortName, ws);
}
}
}
if (!string.IsNullOrEmpty(TextStyle))
{
vwenv.set_StringProperty((int)FwTextPropType.ktptNamedStyle, TextStyle);
}
vwenv.AddString(tss);
}
break;
//.........这里部分代码省略.........
示例12: 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;
}
}
示例13: Display
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
var tsf = m_cache.TsStrFactory;
var userWs = m_cache.DefaultUserWs;
switch (frag)
{
case kfragRule:
m_rule = m_cache.ServiceLocator.GetInstance<IMoAffixProcessRepository>().GetObject(hvo);
VwLength tableLen;
tableLen.nVal = 10000;
tableLen.unit = VwUnit.kunPercent100;
vwenv.OpenTable(3, tableLen, 0, VwAlignment.kvaLeft, VwFramePosition.kvfpVoid, VwRule.kvrlNone, 0, 0, false);
VwLength inputLen;
inputLen.nVal = 0;
inputLen.unit = VwUnit.kunPoint1000;
int indexWidth = GetStrWidth(m_indexStr, m_headerProps, vwenv);
int inputWidth = GetStrWidth(m_inputStr, m_headerProps, vwenv);
VwLength headerLen;
headerLen.nVal = Math.Max(indexWidth, inputWidth) + 8000;
headerLen.unit = VwUnit.kunPoint1000;
inputLen.nVal += headerLen.nVal;
VwLength leftEmptyLen;
leftEmptyLen.nVal = 8000 + (PILE_MARGIN * 2) + 2000;
leftEmptyLen.unit = VwUnit.kunPoint1000;
inputLen.nVal += leftEmptyLen.nVal;
var ctxtLens = new VwLength[m_rule.InputOS.Count];
vwenv.NoteDependency(new[] {m_rule.Hvo}, new[] {MoAffixProcessTags.kflidInput}, 1 );
for (int i = 0; i < m_rule.InputOS.Count; i++)
{
int idxWidth = GetStrWidth(tsf.MakeString(Convert.ToString(i + 1), userWs), m_indexProps, vwenv);
int ctxtWidth = GetWidth(m_rule.InputOS[i], vwenv);
ctxtLens[i].nVal = Math.Max(idxWidth, ctxtWidth) + 8000 + 1000;
ctxtLens[i].unit = VwUnit.kunPoint1000;
inputLen.nVal += ctxtLens[i].nVal;
}
VwLength rightEmptyLen;
rightEmptyLen.nVal = 8000 + (PILE_MARGIN * 2) + 1000;
rightEmptyLen.unit = VwUnit.kunPoint1000;
inputLen.nVal += rightEmptyLen.nVal;
vwenv.MakeColumns(1, inputLen);
VwLength arrowLen;
arrowLen.nVal = GetStrWidth(m_doubleArrow, m_arrowProps, vwenv) + 8000;
arrowLen.unit = VwUnit.kunPoint1000;
vwenv.MakeColumns(1, arrowLen);
VwLength outputLen;
outputLen.nVal = 1;
outputLen.unit = VwUnit.kunRelative;
vwenv.MakeColumns(1, outputLen);
vwenv.OpenTableBody();
vwenv.OpenTableRow();
// input table cell
vwenv.OpenTableCell(1, 1);
vwenv.OpenTable(m_rule.InputOS.Count + 3, tableLen, 0, VwAlignment.kvaCenter, VwFramePosition.kvfpVoid, VwRule.kvrlNone, 0, 4000, false);
vwenv.MakeColumns(1, headerLen);
vwenv.MakeColumns(1, leftEmptyLen);
foreach (VwLength ctxtLen in ctxtLens)
vwenv.MakeColumns(1, ctxtLen);
vwenv.MakeColumns(1, rightEmptyLen);
vwenv.OpenTableBody();
vwenv.OpenTableRow();
// input header cell
vwenv.Props = m_headerProps;
vwenv.OpenTableCell(1, 1);
vwenv.AddString(m_inputStr);
vwenv.CloseTableCell();
// input left empty cell
vwenv.Props = m_ctxtProps;
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, 1000);
vwenv.OpenTableCell(1, 1);
vwenv.OpenParagraph();
OpenContextPile(vwenv, false);
vwenv.Props = m_bracketProps;
vwenv.AddProp(ktagLeftEmpty, this, kfragEmpty);
CloseContextPile(vwenv, false);
vwenv.CloseParagraph();
vwenv.CloseTableCell();
// input context cells
vwenv.AddObjVec(MoAffixProcessTags.kflidInput, this, kfragInput);
// input right empty cell
vwenv.Props = m_ctxtProps;
vwenv.OpenTableCell(1, 1);
vwenv.OpenParagraph();
OpenContextPile(vwenv, false);
vwenv.Props = m_bracketProps;
//.........这里部分代码省略.........
示例14: AddExtraBundleRows
/// <summary>
/// This is for an IAnalysis object at a particular index of a Segment.
/// </summary>
internal override void AddExtraBundleRows(IVwEnv vwenv, AnalysisOccurrence analysis)
{
ITsString tss;
var key = GetDictKey(analysis);
if (m_tagStrings.TryGetValue(key, out tss))
{
var stText = analysis.Segment.Owner.Owner;
// If either the Segment's analyses sequence or the tags on the text change, we want to redraw this
vwenv.NoteDependency(new [] { analysis.Segment.Hvo, stText.Hvo },
new [] { SegmentTags.kflidAnalyses, StTextTags.kflidTags }, 2);
SetTrailingAlignmentIfNeeded(vwenv, tss);
vwenv.AddString(tss);
}
}
示例15: HandleObjMissing
// If the expected reference property is null, insert "??" and return false;
// otherwise return true.
private bool HandleObjMissing(IVwEnv vwenv, int hvo)
{
if (m_cache.GetObjProperty(hvo, m_flidRef) == 0)
{
int wsUi = vwenv.DataAccess.WritingSystemFactory.UserWs;
ITsStrFactory tsf = TsStrFactoryClass.Create();
vwenv.AddString(tsf.MakeString(FdoUiStrings.ksQuestions, wsUi)); // was "??", not "???"
vwenv.NoteDependency(new int[] {hvo}, new int[] {m_flidRef}, 1);
return false;
}
return true;
}