本文整理汇总了C#中IVwEnv.set_IntProperty方法的典型用法代码示例。如果您正苦于以下问题:C# IVwEnv.set_IntProperty方法的具体用法?C# IVwEnv.set_IntProperty怎么用?C# IVwEnv.set_IntProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVwEnv
的用法示例。
在下文中一共展示了IVwEnv.set_IntProperty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Display
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
switch (frag)
{
default:
break;
case kfrBook:
vwenv.set_IntProperty((int)FwKernelLib.FwTextPropType.ktptFontSize, (int)FwKernelLib.FwTextPropVar.ktpvMilliPoint, 24000);
vwenv.set_IntProperty((int)FwKernelLib.FwTextPropType.ktptBold, (int)FwKernelLib.FwTextPropVar.ktpvEnum,
(int)FwKernelLib.FwTextToggleVal.kttvOn);
vwenv.set_IntProperty((int)FwKernelLib.FwTextPropType.ktptAlign, (int)FwKernelLib.FwTextPropVar.ktpvEnum,
(int)FwKernelLib.FwTextAlign.ktalCenter);
vwenv.AddStringProp(ktagBookName, this);
vwenv.AddLazyVecItems(ktagBookSections, this, kfrSection);
break;
case kfrSection:
vwenv.set_IntProperty((int)FwKernelLib.FwTextPropType.ktptItalic, (int)FwKernelLib.FwTextPropVar.ktpvEnum,
(int)FwKernelLib.FwTextToggleVal.kttvOn);
vwenv.OpenParagraph();
vwenv.AddStringProp(ktagSectionTitle, this);
vwenv.AddString(m_tssLeftParen);
vwenv.AddStringProp(ktagSectionRefs, this);
vwenv.AddString(m_tssRightParen);
vwenv.CloseParagraph();
vwenv.AddLazyVecItems(ktagSectionParas, this, kfrDoublePara);
break;
case kfrDoublePara:
AddDoublePara(vwenv, hvo);
// Now insert an interlinear version of the paragraph. This is basically editable.
vwenv.set_IntProperty((int)FwKernelLib.FwTextPropType.ktptBackColor,
(int)FwKernelLib.FwTextPropVar.ktpvDefault, m_colorEditable);
vwenv.OpenParagraph();
vwenv.AddObjVecItems(ktagParaBundles, this, kfrBundle);
vwenv.CloseParagraph();
break;
case kfrBundle:
// Put a little space after each bundle to separate them.
vwenv.set_IntProperty((int)FwKernelLib.FwTextPropType.ktptMarginTrailing,
(int)FwKernelLib.FwTextPropVar.ktpvMilliPoint, 5000);
vwenv.OpenInnerPile();
vwenv.AddStringProp(ktagBundleBase, this);
vwenv.set_IntProperty((int)FwKernelLib.FwTextPropType.ktptBold,
(int)FwKernelLib.FwTextPropVar.ktpvEnum,
(int)FwKernelLib.FwTextToggleVal.kttvOn);
vwenv.set_IntProperty((int)FwKernelLib.FwTextPropType.ktptFontSize,
(int)FwKernelLib.FwTextPropVar.ktpvMilliPoint, 13000);
vwenv.AddStringProp(ktagBundleIdiom, this);
vwenv.set_IntProperty((int)FwKernelLib.FwTextPropType.ktptFontSize,
(int)FwKernelLib.FwTextPropVar.ktpvMilliPoint, 8000);
vwenv.AddStringProp(ktagBundleLing, this);
vwenv.CloseInnerPile();
break;
}
}
示例2: 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)
{
switch (frag)
{
case kfragScrFootnotes:
{
vwenv.AddObjVecItems(ScriptureTags.kflidScriptureBooks, this,
kfragBookFootnotes);
break;
}
case kfragBookFootnotes:
{
vwenv.AddObjVecItems(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(StFootnoteTags.kflidFootnoteMarker, this);
vwenv.AddSimpleRect(0, MiscUtils.kdzmpInch / 2, MiscUtils.kdzmpInch / 2, 0);
vwenv.CloseParagraph();
break;
}
}
}
示例3: 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;
}
}
示例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: 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);
//.........这里部分代码省略.........
示例6: Display
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
CheckDisposed();
TriggerDisplay(vwenv);
//if (m_rgws.Length == 1)
//{
// // Single option...don't bother with labels.
// if (m_rgws[0].RightToLeft)
// {
// vwenv.set_IntProperty((int)FwTextPropType.ktptRightToLeft,
// (int)FwTextPropVar.ktpvEnum,
// (int)FwTextToggleVal.kttvForceOn);
// vwenv.set_IntProperty((int)FwTextPropType.ktptAlign,
// (int)FwTextPropVar.ktpvEnum,
// (int)FwTextAlign.ktalTrailing);
// }
// vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop, (int)FwTextPropVar.ktpvMilliPoint, 2000);
// vwenv.AddStringAltMember(m_flid, m_rgws[0].Hvo, this);
// return;
//}
ITsStrFactory tsf = TsStrFactoryClass.Create();
// 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.
for (int i = 0; i < m_rgws.Length; ++i)
{
// Set qtss to a string representing the writing system.
vwenv.get_StringWidth(NameOfWs(tsf, i),
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();
Set<ILgWritingSystem> visibleWss = new Set<ILgWritingSystem>();
// if we passed in a view and have WritingSystemsToDisplay
// then we'll load that list in order to filter our larger m_rgws list.
AddViewWritingSystems(visibleWss);
for (int i = 0; i < m_rgws.Length; ++i)
{
if (SkipEmptyWritingSystem(visibleWss, i, hvo))
continue;
vwenv.OpenTableRow();
// First cell has writing system abbreviation displayed using m_ttpLabel.
vwenv.Props = m_ttpLabel;
vwenv.OpenTableCell(1,1);
vwenv.AddString(NameOfWs(tsf, i));
vwenv.CloseTableCell();
// Second cell has the string contents for the alternative.
// DN version has some property setting, including trailing margin and
// RTL.
if (m_rgws[i].RightToLeft)
{
vwenv.set_IntProperty((int)FwTextPropType.ktptRightToLeft,
(int)FwTextPropVar.ktpvEnum,
(int)FwTextToggleVal.kttvForceOn);
vwenv.set_IntProperty((int)FwTextPropType.ktptAlign,
(int)FwTextPropVar.ktpvEnum,
(int)FwTextAlign.ktalTrailing);
}
if (!m_editable)
{
vwenv.set_IntProperty((int)FwTextPropType.ktptEditable, (int)FwTextPropVar.ktpvEnum,
(int)TptEditable.ktptNotEditable);
//.........这里部分代码省略.........
示例7: Display
/// ------------------------------------------------------------------------------------
/// <summary>
/// overrides the display method to make everything read-only
/// </summary>
/// <param name="vwenv"></param>
/// <param name="hvo">id of a PubHeader object</param>
/// <param name="frag">Constant (ignored)</param>
/// ------------------------------------------------------------------------------------
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
// make everything read-only
vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
(int)FwTextPropVar.ktpvEnum,
(int)TptEditable.ktptNotEditable);
base.Display(vwenv, hvo, frag);
}
示例8: 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_displayOptions.LiteralStringLabels)
{
ITsStrFactory factory = TsStrFactoryClass.Create();
vwenv.AddString(factory.MakeString("Label" + m_counter++, m_wsDefault));
}
switch (frag)
{
case kfragRoot: // the root; Display the paragraph
AddParagraphBoxContents(vwenv, () =>
{
if (m_displayOptions.ReadOnlyView)
{
vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
(int)FwTextPropVar.ktpvEnum,
(int)TptEditable.ktptNotEditable);
}
});
break;
default:
throw new ApplicationException("Unexpected frag in SimpleRootSiteDataProviderVc");
}
}
示例9: SetParaRtlIfNeeded
private void SetParaRtlIfNeeded(IVwEnv vwenv, int ws)
{
if (m_cache == null)
return;
IWritingSystem wsObj = m_cache.ServiceLocator.WritingSystemManager.Get(ws);
if (wsObj != null && wsObj.RightToLeftScript)
{
vwenv.set_IntProperty((int)FwTextPropType.ktptRightToLeft,
(int)FwTextPropVar.ktpvEnum,
(int)FwTextToggleVal.kttvForceOn);
vwenv.set_IntProperty((int)FwTextPropType.ktptAlign,
(int)FwTextPropVar.ktpvEnum,
(int)FwTextAlign.ktalTrailing);
m_fRtlScript = true;
}
else
{
m_fRtlScript = false;
}
}
示例10: 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();
}
示例11: DisplayIterCtxt
void DisplayIterCtxt(IPhIterationContext iterCtxt, int numLines, IVwEnv vwenv)
{
int superOffset = 0;
if (numLines == 1)
{
// if the inner context is a single line, then make the min value a subscript and the max value a superscript.
// I tried to use the Views subscript and superscript properties, but they added extra space so that it would
// have the same line height of a normal character, which is not what I wanted, so I compute the size myself
int fontHeight = GetFontHeight(m_cache.DefaultUserWs);
int superSubHeight = (fontHeight * 2) / 3;
vwenv.set_IntProperty((int)FwTextPropType.ktptFontSize, (int)FwTextPropVar.ktpvMilliPoint, superSubHeight);
vwenv.set_IntProperty((int)FwTextPropType.ktptLineHeight, (int)FwTextPropVar.ktpvMilliPoint, -superSubHeight);
superOffset = superSubHeight / 2;
}
else
{
vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTrailing, (int)FwTextPropVar.ktpvMilliPoint, PILE_MARGIN);
}
vwenv.OpenInnerPile();
if (numLines == 1)
vwenv.set_IntProperty((int)FwTextPropType.ktptOffset, (int)FwTextPropVar.ktpvMilliPoint, superOffset);
vwenv.OpenParagraph();
vwenv.AddProp(PhIterationContextTags.kflidMaximum, this, kfragIterCtxtMax);
vwenv.CloseParagraph();
AddExtraLines(numLines - 2, vwenv);
vwenv.set_IntProperty((int)FwTextPropType.ktptOffset, (int)FwTextPropVar.ktpvMilliPoint, 0);
vwenv.OpenParagraph();
vwenv.AddIntProp(PhIterationContextTags.kflidMinimum);
vwenv.CloseParagraph();
vwenv.CloseInnerPile();
}
示例12: 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);
//.........这里部分代码省略.........
示例13: AddFreeformComment
//.........这里部分代码省略.........
if (wssAnalysis.Length > 1)
vwenv.get_StringWidth(tssLabel, null, out labelWidth, out labelHeight);
if (IsWsRtl(wssAnalysis[0]) != m_fRtl)
{
ITsStrBldr bldr = tssLabel.GetBldr();
bldr.Replace(bldr.Length - 1, bldr.Length, null, null);
ITsString tssLabelNoSpace = bldr.GetString();
// (First) analysis language is upstream; insert label at end.
vwenv.AddString(GetTssDirForWs(wssAnalysis[0]));
AddFreeformComment(vwenv, hvoSeg, wssAnalysis[0], flid);
vwenv.AddString(GetTssDirForWs(wssAnalysis[0]));
if (wssAnalysis.Length != 1)
{
// Insert WS label for first line
vwenv.AddString(m_tssDir);
vwenv.AddString(m_tssSpace);
vwenv.AddString(m_tssDir);
SetNoteLabelProps(vwenv);
vwenv.AddString(WsListManager.WsLabel(m_cache, wssAnalysis[0]));
}
vwenv.AddString(m_tssDir);
vwenv.AddString(m_tssSpace);
vwenv.AddString(m_tssDir);
vwenv.AddString(tssLabelNoSpace);
vwenv.AddString(m_tssDir);
}
else
{
vwenv.AddString(m_tssDir);
vwenv.AddString(tssLabel);
vwenv.AddString(m_tssDir);
if (wssAnalysis.Length == 1)
{
vwenv.AddString(GetTssDirForWs(wssAnalysis[0]));
AddFreeformComment(vwenv, hvoSeg, wssAnalysis[0], flid);
}
else
{
SetNoteLabelProps(vwenv);
vwenv.AddString(WsListManager.WsLabel(m_cache, wssAnalysis[0]));
vwenv.AddString(m_tssDir);
vwenv.AddString(m_tssSpace);
// label width unfortunately does not include trailing space.
vwenv.AddString(m_tssDir);
vwenv.AddString(GetTssDirForWs(wssAnalysis[0]));
AddFreeformComment(vwenv, hvoSeg, wssAnalysis[0], flid);
}
}
// Add any other lines, each in its appropriate direction.
for (int i = 1; i < wssAnalysis.Length; i++)
{
vwenv.CloseParagraph();
// Indent subsequent paragraphs by the width of the main label.
if (IsWsRtl(wssAnalysis[i]) != m_fRtl)
{
vwenv.set_IntProperty((int)FwTextPropType.ktptTrailingIndent,
(int)FwTextPropVar.ktpvMilliPoint, labelWidth);
}
else
{
vwenv.set_IntProperty((int) FwTextPropType.ktptLeadingIndent,
(int) FwTextPropVar.ktpvMilliPoint, labelWidth);
}
SetParaDirectionAndAlignment(vwenv, wssAnalysis[i]);
vwenv.OpenParagraph();
if (IsWsRtl(wssAnalysis[i]) != m_fRtl)
{
// upstream...reverse everything.
vwenv.AddString(GetTssDirForWs(wssAnalysis[i]));
AddFreeformComment(vwenv, hvoSeg, wssAnalysis[i], flid);
vwenv.AddString(GetTssDirForWs(wssAnalysis[i]));
vwenv.AddString(m_tssDir);
vwenv.AddString(m_tssSpace);
vwenv.AddString(m_tssDir);
vwenv.AddString(m_tssDir);
SetNoteLabelProps(vwenv);
vwenv.AddString(WsListManager.WsLabel(m_cache, wssAnalysis[i]));
vwenv.AddString(m_tssDir);
vwenv.AddString(m_tssSpace);
vwenv.AddString(m_tssDir);
}
else
{
vwenv.AddString(m_tssDir);
vwenv.AddString(m_tssSpace);
vwenv.AddString(m_tssDir);
SetNoteLabelProps(vwenv);
vwenv.AddString(WsListManager.WsLabel(m_cache, wssAnalysis[i]));
vwenv.AddString(m_tssDir);
vwenv.AddString(m_tssSpace);
vwenv.AddString(m_tssDir);
vwenv.AddString(GetTssDirForWs(wssAnalysis[i]));
AddFreeformComment(vwenv, hvoSeg, wssAnalysis[i], flid);
}
}
vwenv.CloseParagraph();
vwenv.CloseDiv();
}
示例14: SetupAndOpenInnerPile
/// <summary>
/// Setup a box with 10 points behind and 5 under and open the inner pile
/// </summary>
/// <param name="vwenv"></param>
protected virtual void SetupAndOpenInnerPile(IVwEnv vwenv)
{
// Make an 'inner pile' to contain the wordform and annotations.
// Give whatever box we make 10 points of separation from whatever follows.
vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTrailing,
(int)FwTextPropVar.ktpvMilliPoint, 10000);
// 5 points below also helps space out the paragraph.
vwenv.set_IntProperty((int)FwTextPropType.ktptMarginBottom,
(int)FwTextPropVar.ktpvMilliPoint, 5000);
vwenv.OpenInnerPile();
}
示例15: 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)
//.........这里部分代码省略.........