本文整理汇总了C#中IVwEnv.set_StringProperty方法的典型用法代码示例。如果您正苦于以下问题:C# IVwEnv.set_StringProperty方法的具体用法?C# IVwEnv.set_StringProperty怎么用?C# IVwEnv.set_StringProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVwEnv
的用法示例。
在下文中一共展示了IVwEnv.set_StringProperty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Display
/// <summary></summary>
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
switch(frag)
{
case (int)SampleFrags.kfrText:
if (m_fontName != null && m_fontName.Length > 0)
vwenv.set_StringProperty((int)FwTextPropType.ktptFontFamily, m_fontName);
// Force to 12 point.
vwenv.set_IntProperty((int)FwTextPropType.ktptFontSize,
(int)FwTextPropVar.ktpvMilliPoint, 12000);
vwenv.OpenDiv();
vwenv.AddLazyVecItems((int)SampleTags.ktagTextParas, this, (int)SampleFrags.kfrPara);
vwenv.CloseDiv();
break;
case (int)SampleFrags.kfrPara:
vwenv.AddStringProp((int)SampleTags.ktagParaContents, this);
break;
}
}
示例2: Display
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
switch (frag)
{
case kfragRule:
m_rule = m_cache.ServiceLocator.GetInstance<IPhMetathesisRuleRepository>().GetObject(hvo);
if (m_rule.Disabled)
{
vwenv.set_StringProperty((int)FwTextPropType.ktptNamedStyle, "Disabled Text");
}
int maxNumLines = GetMaxNumLines();
VwLength tableLen;
tableLen.nVal = 10000;
tableLen.unit = VwUnit.kunPercent100;
vwenv.OpenTable(5, tableLen, 0, VwAlignment.kvaCenter, VwFramePosition.kvfpVoid, VwRule.kvrlNone, 0, 4000, false);
VwLength ctxtLen;
ctxtLen.nVal = 1;
ctxtLen.unit = VwUnit.kunRelative;
int resultx, inputx, dmpy;
vwenv.get_StringWidth(m_resultStr, m_colHeaderProps, out resultx, out dmpy);
vwenv.get_StringWidth(m_inputStr, m_colHeaderProps, out inputx, out dmpy);
VwLength headerLen;
headerLen.nVal = Math.Max(resultx, inputx) + 8000;
headerLen.unit = VwUnit.kunPoint1000;
vwenv.MakeColumns(1, headerLen);
vwenv.MakeColumns(4, ctxtLen);
vwenv.OpenTableBody();
vwenv.OpenTableRow();
vwenv.OpenTableCell(1, 1);
vwenv.CloseTableCell();
// left context header cell
vwenv.Props = m_colHeaderProps;
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, 1000);
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, 1000);
vwenv.OpenTableCell(1, 1);
vwenv.AddString(m_leftEnvStr);
vwenv.CloseTableCell();
// switch header cell
vwenv.Props = m_colHeaderProps;
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, 2000);
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, 2000);
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTrailing, (int)FwTextPropVar.ktpvMilliPoint, 2000);
vwenv.OpenTableCell(1, 2);
vwenv.AddString(m_switchStr);
vwenv.CloseTableCell();
// right context header cell
vwenv.Props = m_colHeaderProps;
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, 1000);
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTrailing, (int)FwTextPropVar.ktpvMilliPoint, 1000);
vwenv.OpenTableCell(1, 1);
vwenv.AddString(m_rightEnvStr);
vwenv.CloseTableCell();
vwenv.CloseTableRow();
vwenv.OpenTableRow();
// input header cell
vwenv.Props = m_rowHeaderProps;
vwenv.OpenTableCell(1, 1);
vwenv.AddString(m_inputStr);
vwenv.CloseTableCell();
// input left context cell
vwenv.Props = m_inputCtxtProps;
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, 1000);
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, 1000);
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint, 1000);
vwenv.OpenTableCell(1, 1);
vwenv.OpenParagraph();
if (m_rule.LeftEnvIndex == -1)
{
OpenSingleLinePile(vwenv, maxNumLines, false);
vwenv.Props = m_bracketProps;
vwenv.AddProp(ktagLeftEnv, this, kfragEmpty);
CloseSingleLinePile(vwenv, false);
}
else
{
for (int i = 0; i < m_rule.LeftEnvLimit; i++)
vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
}
vwenv.CloseParagraph();
vwenv.CloseTableCell();
// input left switch cell
vwenv.Props = m_inputCtxtProps;
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, 1000);
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, 2000);
//.........这里部分代码省略.........
示例3: Display
/// <summary>
/// This is the basic method needed for the view constructor.
/// </summary>
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
switch (frag)
{
case VectorReferenceView.kfragTargetVector:
// Check for an empty vector.
if (hvo == 0 || m_cache.DomainDataByFlid.get_VecSize(hvo, m_flid) == 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.ktptEditable,
(int)FwTextPropVar.ktpvDefault,
(int)TptEditable.ktptNotEditable);
vwenv.set_IntProperty((int)FwTextPropType.ktptAlign,
(int)FwTextPropVar.ktpvEnum, (int)FwTextAlign.ktalRight);
//vwenv.AddString(m_cache.MakeUserTss("Click to select -->"));
if (hvo != 0)
vwenv.NoteDependency(new[] { hvo }, new[] { m_flid }, 1);
}
else
{
if (!string.IsNullOrEmpty(TextStyle))
{
vwenv.set_StringProperty((int)FwTextPropType.ktptNamedStyle, TextStyle);
}
vwenv.OpenParagraph();
vwenv.AddObjVec(m_flid, this, frag);
vwenv.CloseParagraph();
}
break;
case VectorReferenceView.kfragTargetObj:
// Display one object from the vector.
{
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);
#if USEBESTWS
if (m_displayWs != null && m_displayWs.StartsWith("best"))
{
// The flid can be a variety of types, so deal with those.
Debug.WriteLine("Using 'best ws': " + m_displayWs);
int magicWsId = LgWritingSystem.GetMagicWsIdFromName(m_displayWs);
int actualWS = m_cache.LanguageProject.ActualWs(magicWsId, hvo, m_flid);
Debug.WriteLine("Actual ws: " + actualWS.ToString());
}
else
{
#endif
// 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);
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 s = pi.GetValue(obj, null);
if (s is ITsString)
tss = (ITsString)s;
else
tss = tsf.MakeString((string)s, ws);
}
else
{
// ShortNameTss sometimes gets PropChanged, so worth letting the view know that's
// what we're inserting.
var flid = Cache.MetaDataCacheAccessor.GetFieldId2(obj.ClassID, "ShortNameTSS", true);
vwenv.AddStringProp(flid, this);
//.........这里部分代码省略.........
示例4: AddColumn
/// ------------------------------------------------------------------------------------
/// <summary>
/// Add a column to the header/footer
/// </summary>
/// <param name="vwenv"></param>
/// <param name="align"></param>
/// <param name="flid"></param>
/// ------------------------------------------------------------------------------------
private void AddColumn(IVwEnv vwenv, FwTextAlign align, PubHeader.PubHeaderTags flid)
{
vwenv.OpenTableCell(1, 1);
if (HeaderFooterParaStyle != null && HeaderFooterParaStyle != string.Empty)
{
vwenv.set_StringProperty((int)FwTextPropType.ktptNamedStyle,
HeaderFooterParaStyle);
}
vwenv.set_IntProperty((int)FwTextPropType.ktptAlign,
(int)FwTextPropVar.ktpvEnum, (int)align);
vwenv.OpenMappedPara();
vwenv.AddStringProp((int)flid, this);
vwenv.CloseParagraph();
vwenv.CloseTableCell();
}
示例5: Display
//.........这里部分代码省略.........
// Set qtss to a string representing the writing system.
vwenv.get_StringWidth(NameOfWs(i), m_ttpLabel, out dxs, out dys);
m_mDxmpLabelWidth = Math.Max(m_mDxmpLabelWidth, dxs);
}
VwLength vlColWs; // 5-pt space plus max label width.
vlColWs.nVal = m_mDxmpLabelWidth + 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();
var 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.Count; ++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(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].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);
}
if (!m_editable)
{
vwenv.set_IntProperty((int)FwTextPropType.ktptEditable, (int)FwTextPropVar.ktpvEnum,
(int)TptEditable.ktptNotEditable);
}
vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop, (int)FwTextPropVar.ktpvMilliPoint, 2000);
vwenv.OpenTableCell(1,1);
var wsdef = m_rgws[i] as WritingSystemDefinition;
if (wsdef != null && wsdef.IsVoice)
{
// We embed it in a conc paragraph to ensure it never takes more than a line.
// It will typically be covered up by a sound control.
// Also set foreground color to match the window, so nothing shows even if the sound doesn't overlap it perfectly.
// (transparent does not seem to work as a foreground color)
vwenv.set_IntProperty((int)FwTextPropType.ktptForeColor, (int)FwTextPropVar.ktpvDefault,
(int)ColorUtil.ConvertColorToBGR(Color.FromKnownColor(KnownColor.Window)));
// Must not spell-check a conc para, leads to layout failures when the paragraph tries to cast the source to
// a conc text source, if it is overridden by a spelling text source.
vwenv.set_IntProperty((int)FwTextPropType.ktptSpellCheck, (int)FwTextPropVar.ktpvEnum, (int)SpellingModes.ksmDoNotCheck);
vwenv.OpenConcPara(0, 1, VwConcParaOpts.kcpoDefault, 0);
vwenv.AddStringAltMember(m_flid, m_rgws[i].Handle, this);
vwenv.CloseParagraph();
}
else
{
if (!string.IsNullOrEmpty(TextStyle))
{
vwenv.set_StringProperty((int) FwTextPropType.ktptNamedStyle, TextStyle);
}
vwenv.AddStringAltMember(m_flid, m_rgws[i].Handle, this);
}
vwenv.CloseTableCell();
vwenv.CloseTableRow();
}
vwenv.CloseTableBody();
vwenv.CloseTable();
}
示例6: 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;
//.........这里部分代码省略.........
示例7: 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);
//.........这里部分代码省略.........
示例8: Display
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
CheckDisposed();
int wsAnal = m_ws;
ITsStrFactory tsf = TsStrFactoryClass.Create();
IMoMorphSynAnalysis msa = MoMorphSynAnalysis.CreateFromDBObject(m_cache, hvo);
switch (frag)
{
case (int)VcFrags.kfragFullMSAInterlinearname:
// not editable
vwenv.OpenParagraph();
vwenv.set_StringProperty((int)FwTextPropType.ktptFontFamily,
StStyle.DefaultHeadingFont);
vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
(int)FwTextPropVar.ktpvEnum, (int)TptEditable.ktptNotEditable);
vwenv.AddString(msa.LongNameTs);
vwenv.CloseParagraph();
break;
case (int)VcFrags.kfragInterlinearName:
// not editable
//vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
// (int)FwTextPropVar.ktpvEnum, (int)TptEditable.ktptNotEditable);
// InterlinNameTss would need to be implemented, so we can get tss
// string based upon the specified wsAnal
//vwenv.AddString(msa.InterlinNameTSS(wsAnal));
break;
case (int)VcFrags.kfragInterlinearAbbr:
// not editable
vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
(int)FwTextPropVar.ktpvEnum, (int)TptEditable.ktptNotEditable);
vwenv.AddString(msa.InterlinAbbrTSS(wsAnal));
break;
default:
base.Display(vwenv, hvo, frag);
break;
}
}
示例9: ApplyParagraphStyleProps
/// ------------------------------------------------------------------------------------
/// <summary>
/// Invoke the paragraph's style rule if any. The properties will apply to the next
/// flow object--typically a paragraph, but in one TE case a picture--opened or added
/// next.
/// </summary>
/// <param name="vwenv"></param>
/// <param name="hvo"></param>
/// <param name="vc">The view constructor</param>
/// ------------------------------------------------------------------------------------
protected static void ApplyParagraphStyleProps(IVwEnv vwenv, int hvo, StVc vc)
{
ITsTextProps tsTextProps = (ITsTextProps)vwenv.DataAccess.get_UnknownProp(hvo,
(int)StPara.StParaTags.kflidStyleRules);
// Decide what style to apply to the paragraph.
// Rules:
// 1. Apply the paragraph's own style, or "Normal" if it has none.
// 2. If the creator of the view constructor specified a default style
// and background color, invoke those as overrides.
if (tsTextProps == null)
{
// Client didn't spec, and nothing on the para, default to normal.
tsTextProps = vc.NormalStyle;
}
vwenv.Props = tsTextProps;
if (vc.DefaultParaStyle.Length > 0)
{
vwenv.set_StringProperty((int)FwTextPropType.ktptNamedStyle,
vc.DefaultParaStyle);
vwenv.set_IntProperty((int)FwTextPropType.ktptParaColor,
(int)FwTextPropVar.ktpvDefault, vc.BackColor.ToArgb());
}
}
示例10: Display
/// <summary>
/// This is the basic method needed for the view constructor.
/// </summary>
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
switch (frag)
{
case VectorReferenceView.kfragTargetVector:
if (!string.IsNullOrEmpty(TextStyle))
{
vwenv.set_StringProperty((int)FwTextPropType.ktptNamedStyle, TextStyle);
}
vwenv.OpenParagraph();
vwenv.AddObjVec(m_flid, this, frag);
vwenv.CloseParagraph();
break;
case VectorReferenceView.kfragTargetObj:
// Display one object by displaying the fake string property of that object which our special
// private decorator stores for it.
vwenv.AddStringProp(PossibilityVectorReferenceView.kflidFake, this);
break;
default:
throw new ArgumentException(
"Don't know what to do with the given frag.", "frag");
}
}
示例11: HandleEmptyText
/// -----------------------------------------------------------------------------------
/// <summary>
/// We need to show something, since the current view code can't handle a property
/// containing no boxes. Check to see if the StText is missing or if there are
/// no paragraphs. If so, then put in an empty string placeholder.
/// REVIEW: Should we prevent the occurrence of texts with no paragraphs?
/// </summary>
/// <param name="vwenv">view environment</param>
/// <param name="hvo">id of object to be displayed</param>
/// <returns>true if an empty string was substituted for missing/empty StText</returns>
/// -----------------------------------------------------------------------------------
protected bool HandleEmptyText(IVwEnv vwenv, int hvo)
{
int paraCount = 0;
if (hvo != 0)
paraCount = vwenv.DataAccess.get_VecSize(
hvo, (int)StText.StTextTags.kflidParagraphs);
if (paraCount == 0)
{
// Either we have no ST object at all, or it is empty of paragraphs. The
// current view code can't handle either, so stick something in.
// ENHANCE JohnT: come up with a real solution. This makes it look right,
// but we should (a) be able to edit and have the first paragraph and
// if necessary the text itself be created; and (b) if someone adds a real
// paragraph and/or text in some other view, have them show up.
ITsStrFactory tsStrFactory =
TsStrFactoryClass.Create();
int ws = vwenv.DataAccess.WritingSystemFactory.UserWs;
ITsString tssMissing = tsStrFactory.MakeStringRgch("", 0, ws);
vwenv.set_IntProperty((int)FwTextPropType.ktptParaColor,
(int)FwTextPropVar.ktpvDefault, m_BackColor.ToArgb());
vwenv.set_StringProperty((int)FwTextPropType.ktptNamedStyle,
m_sDefaultParaStyle);
vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
(int)FwTextPropVar.ktpvEnum,
(int)TptEditable.ktptNotEditable);
// This sets the current default writing system from the relevant field spec.
vwenv.set_IntProperty((int)FwTextPropType.ktptBaseWs,
(int)FwTextPropVar.ktpvDefault, m_wsDefault);
vwenv.AddString(tssMissing);
return true;
}
return false;
}
示例12: Display
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
switch (frag)
{
case AtomicReferenceView.kFragAtomicRef:
// Display a paragraph with a single item.
vwenv.OpenParagraph(); // vwenv.OpenMappedPara();
if (!string.IsNullOrEmpty(TextStyle))
vwenv.set_StringProperty((int)FwTextPropType.ktptNamedStyle, TextStyle);
vwenv.AddStringProp(PossibilityAtomicReferenceView.kflidFake, this);
vwenv.CloseParagraph();
break;
default:
throw new ArgumentException(
"Don't know what to do with the given frag.", "frag");
}
}
示例13: Display
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
CheckDisposed();
vwenv.set_StringProperty((int)FwTextPropType.ktptFontFamily,
StStyle.DefaultHeadingFont);
vwenv.set_IntProperty((int)FwTextPropType.ktptForeColor,
(int)FwTextPropVar.ktpvDefault,
(int)ColorUtil.ConvertColorToBGR(Color.FromKnownColor(KnownColor.ControlDarkDark)));
vwenv.set_IntProperty((int)FwTextPropType.ktptBold,
(int)FwTextPropVar.ktpvEnum, (int)FwTextToggleVal.kttvForceOn);
vwenv.AddString(m_text);
}
示例14: ApplyParagraphStyleProps
/// ------------------------------------------------------------------------------------
/// <summary>
/// Invoke the paragraph's style rule if any. The properties will apply to the next
/// flow object--typically a paragraph, but in one TE case a picture--opened or added
/// next.
/// </summary>
/// <param name="vwenv"></param>
/// <param name="paraHvo">The HVO of the paragraph</param>
/// <param name="vc">The view constructor</param>
/// ------------------------------------------------------------------------------------
protected static void ApplyParagraphStyleProps(IVwEnv vwenv, int paraHvo, StVc vc)
{
// Decide what style to apply to the paragraph.
// Rules:
// 1. Apply the paragraph's own style, or "Normal" if it has none.
// 2. If the creator of the view constructor specified a default style
// and background color, invoke those as overrides.
ITsTextProps tsTextProps = (ITsTextProps)vwenv.DataAccess.get_UnknownProp(paraHvo,
StParaTags.kflidStyleRules);
if (vc.DefaultParaStyle.Length > 0)
{
vwenv.set_StringProperty((int)FwTextPropType.ktptNamedStyle,
vc.DefaultParaStyle);
vwenv.set_IntProperty((int)FwTextPropType.ktptParaColor,
(int)FwTextPropVar.ktpvDefault, vc.BackColor.ToArgb());
}
// The style the user has explicitly set on the paragraph should override the VC's default style.
vwenv.Props = tsTextProps ?? vc.NormalStyle;
}
示例15: InsertMissingContentPara
/// ------------------------------------------------------------------------------------
/// <summary>
/// Inserts the missing content paragraph.
/// </summary>
/// <param name="vwenv">The view environment.</param>
/// ------------------------------------------------------------------------------------
private void InsertMissingContentPara(IVwEnv vwenv)
{
vwenv.OpenParagraph();
vwenv.set_IntProperty((int)FwTextPropType.ktptBackColor,
(int)FwTextPropVar.ktpvDefault, (int)kHighlightColor);
vwenv.set_StringProperty((int)FwTextPropType.ktptFontFamily,
StStyle.DefaultHeadingFont);
vwenv.set_IntProperty((int)FwTextPropType.ktptBold,
(int)FwTextPropVar.ktpvEnum, (int)FwTextToggleVal.kttvForceOn);
vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTop,
(int)FwTextPropVar.ktpvMilliPoint, 10000);
vwenv.set_IntProperty((int)FwTextPropType.ktptMarginBottom,
(int)FwTextPropVar.ktpvMilliPoint, 10000);
vwenv.AddString(SIL.FieldWorks.Common.FwUtils.StringUtils.MakeTss(
TeDiffViewResources.kstidContentMissing, Cache.DefaultUserWs));
vwenv.CloseParagraph();
}