本文整理汇总了C#中IVwEnv.OpenTableCell方法的典型用法代码示例。如果您正苦于以下问题:C# IVwEnv.OpenTableCell方法的具体用法?C# IVwEnv.OpenTableCell怎么用?C# IVwEnv.OpenTableCell使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVwEnv
的用法示例。
在下文中一共展示了IVwEnv.OpenTableCell方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddSelectionCell
private void AddSelectionCell(IVwEnv vwenv, int hvo)
{
vwenv.OpenTableCell(1, 1);
// Put a pixel of light grey pad around the check box itself.
vwenv.set_IntProperty((int)FwTextPropType.ktptBackColor,
(int)FwTextPropVar.ktpvDefault,
(int)RGB(System.Drawing.Color.LightGray));
vwenv.set_IntProperty((int)FwTextPropType.ktptPadLeading,
(int)FwTextPropVar.ktpvMilliPoint,
(m_dxmpCheckBorderWidth));
vwenv.set_IntProperty((int)FwTextPropType.ktptPadTrailing,
(int)FwTextPropVar.ktpvMilliPoint,
(m_dxmpCheckBorderWidth));
vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop,
(int)FwTextPropVar.ktpvMilliPoint,
(m_dxmpCheckBorderWidth));
vwenv.set_IntProperty((int)FwTextPropType.ktptPadBottom,
(int)FwTextPropVar.ktpvMilliPoint,
(m_dxmpCheckBorderWidth));
if (ShowEnabled)
{
int enabled = vwenv.DataAccess.get_IntProp(hvo, ktagItemEnabled);
vwenv.NoteDependency(new int[] { hvo }, new int[] { ktagItemEnabled }, 1);
if (enabled != 0)
{
// Even if the view as a whole does not allow editing, presumably a check box
// does!
vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
(int)FwTextPropVar.ktpvEnum,
(int)TptEditable.ktptIsEditable);
vwenv.AddIntPropPic(ktagItemSelected, this, kfragCheck, 0, 1);
}
else
{
vwenv.AddPicture(m_DisabledCheckPic, 0, 0, 0);
}
}
else
{
// Unconditionally show the selected property.
vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
(int)FwTextPropVar.ktpvEnum,
(int)TptEditable.ktptIsEditable);
vwenv.AddIntPropPic(ktagItemSelected, this, kfragCheck, 0, 1);
}
vwenv.CloseTableCell();
}
示例2: AddEditCell
private void AddEditCell(IVwEnv vwenv, IVwCacheDa cda, int i)
{
XmlNode node = m_columns[i - 1];
// Make a cell and embed an editable virtual string for the column.
var editable = XmlUtils.GetOptionalBooleanAttributeValue(node, "editable", true);
if (!editable)
vwenv.set_IntProperty((int)FwTextPropType.ktptBackColor, (int)FwTextPropVar.ktpvDefault, NoEditBackgroundColor);
vwenv.OpenTableCell(1, 1);
int flid = XMLViewsDataCache.ktagEditColumnBase + i;
int ws = WritingSystemServices.GetWritingSystem(m_cache, node, null,
m_cache.ServiceLocator.WritingSystems.DefaultAnalysisWritingSystem.Handle).Handle;
// Paragraph directionality must be set before the paragraph is opened.
bool fRTL = IsWsRTL(ws);
vwenv.set_IntProperty((int)FwTextPropType.ktptRightToLeft,
(int)FwTextPropVar.ktpvEnum, fRTL ? -1 : 0);
vwenv.set_IntProperty((int)FwTextPropType.ktptAlign,
(int)FwTextPropVar.ktpvEnum,
fRTL ? (int)FwTextAlign.ktalRight : (int)FwTextAlign.ktalLeft);
// Fill in the cell with the virtual property.
vwenv.OpenParagraph();
vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
(int)FwTextPropVar.ktpvEnum,
editable ? (int)TptEditable.ktptIsEditable : (int)TptEditable.ktptNotEditable);
vwenv.AddStringAltMember(flid, ws, this);
vwenv.CloseParagraph();
vwenv.CloseTableCell();
}
示例3: DisplayWithWritingSystemLabel
private void DisplayWithWritingSystemLabel(IVwEnv vwenv, int ws)
{
ITsString tssLabel = NameOfWs(ws);
// 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;
int dxs; // Width of displayed string.
int dys; // Height of displayed string (not used here).
vwenv.get_StringWidth(tssLabel, null, out dxs, out dys);
VwLength vlColWs; // 5-pt space plus max label width.
vlColWs.nVal = dxs + 5000;
vlColWs.unit = VwUnit.kunPoint1000;
// The Main column is relative and uses the rest of the space.
VwLength vlColMain;
vlColMain.nVal = 1;
vlColMain.unit = VwUnit.kunRelative;
// Enhance JohnT: possibly allow for right-to-left UI by reversing columns?
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();
vwenv.OpenTableRow();
// First cell has writing system abbreviation displayed using m_ttpLabel.
//vwenv.Props = m_ttpLabel;
vwenv.OpenTableCell(1, 1);
vwenv.set_IntProperty((int)FwTextPropType.ktptEditable, (int)FwTextPropVar.ktpvEnum,
(int)TptEditable.ktptNotEditable);
vwenv.AddString(tssLabel);
vwenv.CloseTableCell();
// Second cell has the string contents for the alternative.
// DN version has some property setting, including trailing margin and RTL.
if (m_fRtlScript)
{
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);
vwenv.AddStringProp(m_flid, this);
vwenv.CloseTableCell();
vwenv.CloseTableRow();
vwenv.CloseTableBody();
vwenv.CloseTable();
}
示例4: Display
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
// Ignore 0 hvo's. RootObject may have not been set. FWNX-613.
if (hvo == 0)
return;
switch(frag)
{
case kfragRoot:
if (m_dxLabWidth == 0)
{
int dmpx1, dmpy; //, dmpx2;
vwenv.get_StringWidth(m_tssTitle, m_ttpBold, out dmpx1, out dmpy);
//vwenv.get_StringWidth(m_tssComments, m_ttpBold, out dmpx2, out dmpy);
//m_dxLabWidth = Math.Max(dmpx1, dmpx2) + 13000; // add 3 pt spacing to box, 10 to margin.
m_dxLabWidth = dmpx1 + 13000; // add 3 pt spacing to box, 10 to margin.
m_dxWsLabWidth = 0;
foreach (ITsString tssLabel in m_WsLabels)
{
vwenv.get_StringWidth(tssLabel, m_ttpWsLabel, out dmpx1, out dmpy);
m_dxWsLabWidth = Math.Max(m_dxWsLabWidth, dmpx1);
}
m_dxWsLabWidth += 18000; // 3 pts white space each side, 11 margin, 1 border, plus 1 for safety.
}
VwLength vlTable;
vlTable.nVal = 10000;
vlTable.unit = VwUnit.kunPercent100;
VwLength vlColLabels; // 5-pt space plus max label width.
vlColLabels.nVal = m_dxLabWidth;
vlColLabels.unit = VwUnit.kunPoint1000;
VwLength vlColWsLabels; // 5-pt space plus max ws label width.
vlColWsLabels.nVal = m_dxWsLabWidth;
vlColWsLabels.unit = VwUnit.kunPoint1000;
// The Main column is relative and uses the rest of the space.
VwLength vlColMain;
vlColMain.nVal = 1;
vlColMain.unit = VwUnit.kunRelative;
// The Padding column allows for the the trailing margin and border.
VwLength vlColPadding;
vlColPadding.nVal = 10000;
vlColPadding.unit = VwUnit.kunPoint1000;
vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTop,
(int) FwTextPropVar.ktpvMilliPoint, 5000);
vwenv.OpenTable(4, // Four 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);
vwenv.MakeColumns(1, vlColLabels);
vwenv.MakeColumns(1, vlColWsLabels);
vwenv.MakeColumns(1, vlColMain);
vwenv.MakeColumns(1, vlColPadding);
vwenv.OpenTableBody();
for (int i = 0; i < m_writingSystems.Length; i++)
{
vwenv.OpenTableRow();
// First cell has 'Title' label in bold.
vwenv.Props = m_ttpBold;
vwenv.OpenTableCell(1,1);
vwenv.set_IntProperty((int)FwTextPropType.ktptMarginLeading,
(int) FwTextPropVar.ktpvMilliPoint, 10000);
if (i == 0) // only on the first row
{
// We want this fixed at 10 point, since it's considered a UI component, not data.
// See LT-4816
vwenv.set_IntProperty((int)FwTextPropType.ktptFontSize,
(int)FwTextPropVar.ktpvMilliPoint, 10000);
vwenv.AddString(m_tssTitle);
}
vwenv.CloseTableCell();
// Second cell has ws labels.
vwenv.set_IntProperty((int)FwTextPropType.ktptBackColor,
(int) FwTextPropVar.ktpvDefault, m_editBackColor);
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading,
(int)FwTextPropVar.ktpvMilliPoint, 1000);
if (i == 0)
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop,
(int)FwTextPropVar.ktpvMilliPoint, 1000);
if (i == m_writingSystems.Length - 1)
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom,
(int)FwTextPropVar.ktpvMilliPoint, 1000);
vwenv.OpenTableCell(1,1);
vwenv.Props = m_ttpDataCellProps;
vwenv.Props = m_ttpWsLabel;
vwenv.AddString(m_WsLabels[i]);
//.........这里部分代码省略.........
示例5: DisplayExpandableAnnotation
/// ------------------------------------------------------------------------------------
/// <summary>
/// Displays an expandable annotation of the specified type.
/// </summary>
/// ------------------------------------------------------------------------------------
private void DisplayExpandableAnnotation(IVwEnv vwenv, IScrScriptureNote ann,
int tag, int hvo, IStJournalText paras, ITsString label, bool readOnly)
{
vwenv.NoteDependency(new int[] { hvo }, new int[] { m_expansionTag }, 1);
SetBackgroundColorForNote(ann, vwenv);
OpenTableRow(vwenv, ann);
// Display empty first cell
vwenv.OpenTableCell(1, 1);
vwenv.CloseTableCell();
// Display +/- in the second cell, unless this is read-only
vwenv.OpenTableCell(1, 1);
if (!readOnly)
vwenv.AddObjProp(tag, this, (int)NotesFrags.kfrExpansion);
vwenv.CloseTableCell();
// Display text in the remaining cells
vwenv.OpenTableCell(1, 5);
vwenv.OpenConcPara(0, 0, 0, 0);
vwenv.AddString(label);
if (!m_expandTable.ContainsKey(hvo))
vwenv.AddString(paras[0].Contents);
vwenv.CloseParagraph();
vwenv.CloseTableCell();
CloseTableRow(vwenv, ann);
if (!m_expandTable.ContainsKey(hvo))
return;
SetBackgroundColorForNote(ann, vwenv);
OpenTableRow(vwenv, ann);
// Display empty first and second cell
vwenv.OpenTableCell(1, 2);
vwenv.CloseTableCell();
// Display text in cells 3-7
vwenv.OpenTableCell(1, 5);
if (!readOnly)
SetEditBackground(vwenv);
vwenv.AddObjProp(tag, this, (int)StTextFrags.kfrText);
vwenv.CloseTableCell();
CloseTableRow(vwenv, ann);
}
示例6: 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);
//.........这里部分代码省略.........
示例7: DisplayVec
public override void DisplayVec(IVwEnv vwenv, int hvo, int tag, int frag)
{
switch (frag)
{
case kfragInput:
// input context cell
int[] ctxtHvos = m_cache.GetVectorProperty(hvo, tag, false);
foreach (int ctxtHvo in ctxtHvos)
{
vwenv.Props = m_ctxtProps;
vwenv.OpenTableCell(1, 1);
vwenv.OpenParagraph();
vwenv.AddObj(ctxtHvo, this, kfragContext);
vwenv.CloseParagraph();
vwenv.CloseTableCell();
}
break;
default:
base.DisplayVec(vwenv, hvo, tag, frag);
break;
}
}
示例8: CloseTableRow
/// ------------------------------------------------------------------------------------
/// <summary>
/// Closes the table row.
/// </summary>
/// <param name="vwenv">The view environment.</param>
/// <param name="ann">The annotation being displayed.</param>
/// ------------------------------------------------------------------------------------
private void CloseTableRow(IVwEnv vwenv, IScrScriptureNote ann)
{
if (ann.Hvo != SelectedNoteHvo)
{
// Display cell used for padding (to right-indent unselected annotations by
// the width of the frame used to highlight the selected annotation).
vwenv.OpenTableCell(1, 1);
vwenv.AddString(m_tssEmpty);
vwenv.CloseTableCell();
}
vwenv.CloseTableRow();
}
示例9: OpenStandardCell
static internal void OpenStandardCell(IVwEnv vwenv, int ccols, bool fEndOfGroup)
{
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTrailing,
(int)FwTextPropVar.ktpvMilliPoint,
(fEndOfGroup ? 1500 : 500));
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderColor,
(int)FwTextPropVar.ktpvDefault,
(int)ColorUtil.ConvertColorToBGR(fEndOfGroup ? Color.Black : Color.LightGray));
vwenv.OpenTableCell(1, ccols);
}
示例10: AddEditCell
private void AddEditCell(IVwEnv vwenv, IVwCacheDa cda, int i)
{
string sField = ksEditColumnBaseName + i;
XmlNode node = m_columns[i - 1] as XmlNode;
// Make a cell and embed an editable virtual string for the column.
vwenv.OpenTableCell(1, 1);
// Initialize the virtual property.
IVwVirtualHandler vh = cda.GetVirtualHandlerName(EditRowModelClass, sField);
Debug.Assert(vh != null);
int flid = (int)m_mdc.GetFieldId(EditRowModelClass, sField, false);
int ws = LangProject.GetWritingSystem(node, m_cache, null, m_cache.DefaultAnalWs);
// Paragraph directionality must be set before the paragraph is opened.
bool fRTL = IsWsRTL(ws);
vwenv.set_IntProperty((int)FwTextPropType.ktptRightToLeft,
(int)FwTextPropVar.ktpvEnum, fRTL ? -1 : 0);
vwenv.set_IntProperty((int)FwTextPropType.ktptAlign,
(int)FwTextPropVar.ktpvEnum,
fRTL ? (int)FwTextAlign.ktalRight : (int)FwTextAlign.ktalLeft);
vh.Load(khvoNewItem, flid, ws, cda);
// Fill in the cell with the virtual property.
vwenv.OpenParagraph();
vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
(int)FwTextPropVar.ktpvEnum,
(int)TptEditable.ktptIsEditable);
vwenv.AddStringAltMember(flid, ws, this);
vwenv.CloseParagraph();
vwenv.CloseTableCell();
}
示例11: OpenRowNumberCell
static internal void OpenRowNumberCell(IVwEnv vwenv)
{
// Row number cell should not be editable [LT-7744].
vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
(int)FwTextPropVar.ktpvEnum, (int)TptEditable.ktptNotEditable);
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTrailing,
(int)FwTextPropVar.ktpvMilliPoint, 500);
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderColor,
(int)FwTextPropVar.ktpvDefault,
(int)ColorUtil.ConvertColorToBGR(Color.Black));
vwenv.OpenTableCell(1, 1);
}
示例12: Display
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
CheckDisposed();
switch (frag)
{
case kfragRHS:
m_rhs = new PhSegRuleRHS(m_cache, hvo);
IPhRegularRule rule = new PhRegularRule(m_cache, m_rhs.OwnerHVO);
int arrowWidth, slashWidth, underscoreWidth, charHeight;
vwenv.get_StringWidth(m_arrow, m_charProps, out arrowWidth, out charHeight);
int maxCharHeight = charHeight;
vwenv.get_StringWidth(m_slash, m_charProps, out slashWidth, out charHeight);
maxCharHeight = Math.Max(charHeight, maxCharHeight);
vwenv.get_StringWidth(m_underscore, m_charProps, out underscoreWidth, out charHeight);
maxCharHeight = Math.Max(charHeight, maxCharHeight);
int dmpx, spaceHeight;
vwenv.get_StringWidth(m_zwSpace, m_bracketProps, out dmpx, out spaceHeight);
int maxNumLines = MaxNumLines;
int maxCtxtHeight = maxNumLines * spaceHeight;
int maxHeight = Math.Max(maxCharHeight, maxCtxtHeight);
int charOffset = maxHeight;
int ctxtPadding = maxHeight - maxCtxtHeight;
VwLength tableLen;
tableLen.nVal = 10000;
tableLen.unit = VwUnit.kunPercent100;
vwenv.OpenTable(7, tableLen, 0, VwAlignment.kvaCenter, VwFramePosition.kvfpVoid, VwRule.kvrlNone, 0, 0, false);
VwLength ctxtLen;
ctxtLen.nVal = 1;
ctxtLen.unit = VwUnit.kunRelative;
VwLength charLen;
charLen.unit = VwUnit.kunPoint1000;
vwenv.MakeColumns(1, ctxtLen);
charLen.nVal = arrowWidth + 4000;
vwenv.MakeColumns(1, charLen);
vwenv.MakeColumns(1, ctxtLen);
charLen.nVal = slashWidth + 4000;
vwenv.MakeColumns(1, charLen);
vwenv.MakeColumns(1, ctxtLen);
charLen.nVal = underscoreWidth + 4000;
vwenv.MakeColumns(1, charLen);
vwenv.MakeColumns(1, ctxtLen);
vwenv.OpenTableBody();
vwenv.OpenTableRow();
// LHS cell
vwenv.Props = m_ctxtProps;
vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop, (int)FwTextPropVar.ktpvMilliPoint, ctxtPadding);
vwenv.OpenTableCell(1, 1);
vwenv.OpenParagraph();
vwenv.AddObjProp(m_cache.GetFlid(hvo, null, "OwningRule"), this, kfragRule);
vwenv.CloseParagraph();
vwenv.CloseTableCell();
// arrow cell
vwenv.Props = m_charProps;
vwenv.set_IntProperty((int)FwTextPropType.ktptOffset, (int)FwTextPropVar.ktpvMilliPoint, -charOffset);
vwenv.OpenTableCell(1, 1);
vwenv.AddString(m_arrow);
vwenv.CloseTableCell();
// RHS cell
vwenv.Props = m_ctxtProps;
vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop, (int)FwTextPropVar.ktpvMilliPoint, ctxtPadding);
vwenv.OpenTableCell(1, 1);
vwenv.OpenParagraph();
if (m_cache.GetVectorSize(hvo, (int)PhSegRuleRHS.PhSegRuleRHSTags.kflidStrucChange) > 0)
{
vwenv.AddObjVecItems((int)PhSegRuleRHS.PhSegRuleRHSTags.kflidStrucChange, this, kfragContext);
}
else
{
OpenContextPile(vwenv, false);
vwenv.Props = m_bracketProps;
vwenv.AddProp((int)PhSegRuleRHS.PhSegRuleRHSTags.kflidStrucChange, this, kfragEmpty);
CloseContextPile(vwenv, false);
}
vwenv.CloseParagraph();
vwenv.CloseTableCell();
// slash cell
vwenv.Props = m_charProps;
vwenv.set_IntProperty((int)FwTextPropType.ktptOffset, (int)FwTextPropVar.ktpvMilliPoint, -charOffset);
vwenv.OpenTableCell(1, 1);
vwenv.AddString(m_slash);
vwenv.CloseTableCell();
// left context cell
//.........这里部分代码省略.........
示例13: AddTableCell
private void AddTableCell(IVwEnv vwenv, int hvo, int index, int hvoRoot, int icolActive, int cAdjCol, int icol)
{
XmlNode node = m_columns[icol - 1];
// Figure out the underlying Right-To-Left value.
bool fRightToLeft = false;
// look for a writing system ID.
XmlAttribute xa = node.Attributes["ws"];
XmlNode xn = node;
if (xa == null)
xn = XmlUtils.FindNode(node, "string");
m_wsBest = 0;
if (xn != null)
{
int hvoBest = 0;
int flidBest = 0;
if (LangProject.GetWsRequiresObject(xn))
{
// The 'best' ws series needs the hvo and flid in order to work.
// Some others (e.g., 'reversal' which require the hvo don't need a flid.
hvoBest = hvo; // Wonder it isn't really the hvoRoot that is to be used.
string flidname = XmlUtils.GetOptionalAttributeValue(xn, "field");
if (flidname != null)
{
string classname;
xa = xn.Attributes["class"];
if (xa == null)
{
// Get it from the meta data cache.
classname = m_cache.GetClassName((uint)m_cache.GetClassOfObject(hvo));
}
else
{
classname = xa.Value;
}
flidBest = (int)m_mdc.GetFieldId(classname, flidname, true);
}
}
m_wsBest = LangProject.GetWritingSystem(xn, m_cache, null, hvoBest, flidBest, m_cache.DefaultAnalWs);
IWritingSystem lgWs = m_cache.LanguageWritingSystemFactoryAccessor.get_EngineOrNull(m_wsBest);
if (lgWs != null)
fRightToLeft = lgWs.RightToLeft;
}
bool fSortedFromEnd = m_xbv.ColumnSortedFromEnd(icol - cAdjCol);
int tal;
if (fRightToLeft)
{
if (fSortedFromEnd)
tal = (int)FwTextAlign.ktalLeft;
else
tal = (int)FwTextAlign.ktalRight;
}
else
{
if (fSortedFromEnd)
tal = (int)FwTextAlign.ktalRight;
else
tal = (int)FwTextAlign.ktalLeft;
}
vwenv.set_IntProperty((int)FwTextPropType.ktptAlign,
(int)FwTextPropVar.ktpvEnum, tal);
bool fIsCellActive = false;
if (icolActive != 0 && m_PreviewArrowPic != null)
{
// The display depends on which column is active and whether the current row is selected.
vwenv.NoteDependency(new int[] { hvoRoot, hvo, hvo }, new int[] { ktagActiveColumn, ktagItemSelected, ktagItemEnabled }, 3);
// We're doing the active column thing.
if (icol == icolActive)
{
fIsCellActive = vwenv.DataAccess.get_IntProp(hvo, ktagItemSelected) != 0
&& vwenv.DataAccess.get_IntProp(hvo, ktagItemEnabled) != 0;
}
}
// Make a cell and embed the contents of the column node.
ProcessProperties(node, vwenv);
SetCellProperties(index, icol, node, hvo, vwenv, fIsCellActive);
vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop,
(int)FwTextPropVar.ktpvMilliPoint, 1607);
vwenv.OpenTableCell(1, 1);
vwenv.set_IntProperty((int)FwTextPropType.ktptPadTrailing,
(int)FwTextPropVar.ktpvMilliPoint, 1607);
vwenv.set_IntProperty((int)FwTextPropType.ktptPadLeading,
(int)FwTextPropVar.ktpvMilliPoint, 1607);
if (node.Name == "column")
{
// Paragraph directionality must be set before the paragraph is opened.
vwenv.set_IntProperty((int)FwTextPropType.ktptRightToLeft,
(int)FwTextPropVar.ktpvEnum, IsWritingSystemRTL(node) ? -1 : 0);
}
// According to LT-8947, in bulk edit preview mode, we want to try to show the
// original cell contents on the same line with the preview arrow and the new cell contents.
// to accomplish this, we use 3 InnerPiles in a paragraph
// to try to keep them on the same line (or wrap otherwise).
// NOTE: the bottom two inner piles will only be present if fIsCellActive is true.
//
// <Paragraph>
// <InnerPile>
// <paragraph> Original cell contents </paragraph>
// </InnerPile>
//.........这里部分代码省略.........
示例14: 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();
}
示例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);
//.........这里部分代码省略.........