本文整理汇总了C#中IVwEnv.OpenConcPara方法的典型用法代码示例。如果您正苦于以下问题:C# IVwEnv.OpenConcPara方法的具体用法?C# IVwEnv.OpenConcPara怎么用?C# IVwEnv.OpenConcPara使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVwEnv
的用法示例。
在下文中一共展示了IVwEnv.OpenConcPara方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Display
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
switch(frag)
{
case 1:
{
// The top-level.
// Enhance JohnT: add a property setting to make the key bold
// Roughly, vwenv.set_IntProperty(ktptBold, ktpvEnum, kttvForceOn);
// If we can get an hvo and flid, display that property of that object.
int flid = 0;
if (hvo != 0)
{
flid = m_cp.FlidFor(m_index, hvo);
}
if (flid != 0)
{
// Warning (JohnT): this option not yet tested...
vwenv.AddStringProp(flid, this);
return;
}
else
{
// Otherwise display a literal string straight from the policy object.
vwenv.AddString(m_cp.KeyFor(m_index, hvo));
}
if (m_fExpanded)
{
vwenv.AddLazyVecItems(m_ni.ListFlid, this, 2);
}
break;
}
case 2:
{
// One line of context.
// Figure the index of this object in the next object out (the root).
int hvoOuter, tagOuter, ihvo;
vwenv.GetOuterObject(vwenv.EmbeddingLevel - 1,
out hvoOuter, out tagOuter, out ihvo);
int ichKey = m_ni.ContextStringStartOffset(ihvo, hvo);
int cchKey = m_ni.ContextStringLength(ihvo, hvo);
// Enhance JohnT: make the alignment position a function of window width.
// Enhance JohnT: change background if this is the selected context line.
vwenv.OpenConcPara(ichKey, ichKey + cchKey,
VwConcParaOpts.kcpoDefault,
72 * 2 * 1000); // 72 pts per inch * 2 inches * 1000 -> 2" in millipoints.
int flidKey = m_ni.ContextStringFlid(ihvo, hvo);
if (flidKey == 0)
{
// Not tested yet.
vwenv.AddString(m_ni.ContextString(ihvo, hvo));
}
else
{
vwenv.AddStringProp(flidKey, this);
}
vwenv.CloseParagraph();
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 showing the style for each paragraph in the 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();
ISilDataAccess silDataAccess = vwenv.DataAccess;
int wsUser = Cache.WritingSystemFactory.UserWs;
switch(frag)
{
case (int)FootnoteFrags.kfrBook:
case (int)ScrFrags.kfrBook:
{
vwenv.OpenDiv();
if (m_displayForFootnotes)
{
vwenv.AddObjVecItems(ScrBookTags.kflidFootnotes,
this, (int)FootnoteFrags.kfrFootnoteStyles);
}
else
{
vwenv.AddObjProp(ScrBookTags.kflidTitle, this,
(int)ScrFrags.kfrTextStyles);
vwenv.AddLazyVecItems(ScrBookTags.kflidSections, this,
(int)ScrFrags.kfrSection);
InsertBookSeparator(hvo, vwenv);
}
vwenv.CloseDiv();
break;
}
case (int)ScrFrags.kfrSection:
{
vwenv.OpenDiv();
vwenv.AddObjProp(ScrSectionTags.kflidHeading, this,
(int)ScrFrags.kfrTextStyles);
vwenv.AddObjProp(ScrSectionTags.kflidContent, this,
(int)ScrFrags.kfrTextStyles);
vwenv.CloseDiv();
break;
}
case (int)ScrFrags.kfrTextStyles:
{
// We need to show something, since the current view code can't handle a property
// containing no boxes.
if (HandleEmptyText(vwenv, hvo))
break;
if (m_fLazy)
{
vwenv.AddLazyVecItems(StTextTags.kflidParagraphs, this,
(int)ScrFrags.kfrParaStyles);
}
else
{
vwenv.AddObjVecItems(StTextTags.kflidParagraphs, this,
(int)ScrFrags.kfrParaStyles);
}
break;
}
case (int)FootnoteFrags.kfrFootnoteStyles:
{
if (HandleEmptyText(vwenv, hvo))
break;
vwenv.AddObjVecItems(StTextTags.kflidParagraphs, this,
(int)ScrFrags.kfrParaStyles);
break;
}
case (int)ScrFrags.kfrParaStyles:
{
var tsTextProps = silDataAccess.get_UnknownProp(hvo, StParaTags.kflidStyleRules)
as ITsTextProps;
string styleName = ScrStyleNames.Normal;
if (tsTextProps != null)
styleName = tsTextProps.GetStrPropValue((int)FwTextPropType.ktptNamedStyle);
// To insert it into the view it has to be an ITsString
ITsStrFactory tsStrFactory =
TsStrFactoryClass.Create();
// Last arg is writing system. Should we use English? UI writing system?
// Note that when we support localization of style names this code will need
// to be enhanced as the stylename from the TsTextProps will be a raw name or
// GUID that the user shouldn't see.
ITsString tssStyle = tsStrFactory.MakeStringRgch(styleName,
styleName.Length, wsUser);
// To make the pile align things properly, top and bottom margins for the
// matching boxes must be the same as the original.
// A 'concordance' paragraph is a way of preventing wrapping.
vwenv.OpenConcPara(0, 0, 0, 0);
vwenv.AddString(tssStyle);
//.........这里部分代码省略.........
示例3: Display
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
CheckDisposed();
// Enhance JohnT: make the alignment position a function of window width.
// Enhance JohnT: change background if this is the selected context line.
vwenv.OpenConcPara(m_info.ContextStringStartOffset,
m_info.ContextStringStartOffset + m_info.ContextStringLength,
VwConcParaOpts.kcpoDefault,
72 * 2 * 1000); // 72 pts per inch * 2 inches * 1000 -> 2" in millipoints.
if (m_info.Hvo == 0 || m_info.ContentStringFlid == 0)
{
vwenv.AddString(m_info.ContentString);
}
else
{
Debug.Assert(hvo == m_info.Hvo);
vwenv.AddStringProp(m_info.ContentStringFlid, this);
}
vwenv.CloseParagraph();
}
示例4: DisplayResponse
/// ------------------------------------------------------------------------------------
/// <summary>
/// Display a response to an annotation.
/// </summary>
/// <param name="vwenv"></param>
/// <param name="text">StJournalText containing the response</param>
/// <param name="expanded">whether response should be expanded</param>
/// ------------------------------------------------------------------------------------
private void DisplayResponse(IVwEnv vwenv, IStJournalText text, bool expanded)
{
#region Response text
// Display response text
vwenv.OpenTableRow();
// Display empty first, second, and third cells
vwenv.OpenTableCell(1, 3);
vwenv.CloseTableCell();
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop,
(int)FwTextPropVar.ktpvMilliPoint, 500);
vwenv.OpenTableCell(1, 2);
vwenv.AddObjVecItems((int)StTextTags.kflidParagraphs, this, (int)StTextFrags.kfrPara);
vwenv.CloseTableCell();
vwenv.CloseTableRow();
#endregion
#region Author and creation date
// Author and creation date
vwenv.OpenTableRow();
// Display empty first, second, and third cells
vwenv.OpenTableCell(1, 3);
vwenv.CloseTableCell();
// Display author in the third cell
vwenv.OpenTableCell(1, 1);
SetDisabledColorForNote(vwenv);
vwenv.OpenConcPara(0, 0, 0, 0);
vwenv.AddString(m_authorLabel);
vwenv.CloseParagraph();
vwenv.CloseTableCell();
// Display creation date in the fourth cell
vwenv.OpenTableCell(1, 1);
vwenv.OpenConcPara(0, 0, 0, 0);
vwenv.AddString(m_createdLabel);
vwenv.AddString(m_tsStrFactory.MakeString(text.DateCreated.ToShortDateString(),
m_cache.DefaultUserWs));
vwenv.CloseParagraph();
vwenv.CloseTableCell();
vwenv.CloseTableRow();
#endregion
}
示例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: DisplayAnnotation
/// ------------------------------------------------------------------------------------
/// <summary>
/// Displays an annotation expanded or contracted
/// </summary>
/// <param name="vwenv"></param>
/// <param name="ann"></param>
/// <param name="expanded"></param>
/// ------------------------------------------------------------------------------------
private void DisplayAnnotation(IVwEnv vwenv, IScrScriptureNote ann, bool expanded)
{
#region First row has status, ref, category, & quote
SetBackgroundColorForNote(ann, vwenv);
OpenTableRow(vwenv, ann);
// Display expand box (+/-) in the first cell
//InsertNoteSeparator(vwenv);
vwenv.OpenTableCell(1, 1);
vwenv.AddObj(ann.Hvo, this, (int)NotesFrags.kfrExpansion);
vwenv.CloseTableCell();
// Display status in the second cell
vwenv.OpenTableCell(1, 1);
vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop,
(int)FwTextPropVar.ktpvMilliPoint, 1000);
if (ann.AnnotationType == NoteType.CheckingError)
{
// When the annotation is a checking error, we don't want clicking on the status
// to change the status. Therefore, make the min and max the same.
vwenv.AddIntPropPic((int)ScrScriptureNoteTags.kflidResolutionStatus,
this, (int)NotesFrags.kfrStatus, 0, 0);
}
else
{
vwenv.AddIntPropPic((int)ScrScriptureNoteTags.kflidResolutionStatus,
this, (int)NotesFrags.kfrStatus, (int)NoteStatus.Open, (int)NoteStatus.Closed);
}
vwenv.CloseTableCell();
// Display reference in the third cell and make it readonly.
vwenv.OpenTableCell(1, 1);
vwenv.set_IntProperty((int)FwTextPropType.ktptEditable, (int)FwTextPropVar.ktpvDefault, 0);
vwenv.OpenParagraph();
vwenv.AddProp((int)CmBaseAnnotationTags.kflidBeginRef, this, (int)NotesFrags.kfrScrRef);
vwenv.CloseParagraph();
vwenv.CloseTableCell();
// Display CONNOT category in the fourth (and possibly fifth and sixth) cell(s)
vwenv.OpenTableCell(1, expanded ? 3 : 1);
IStTxtPara quotePara = ann.QuoteOA[0];
bool fQuoteParaRtoL = IsParaRightToLeft(quotePara);
// Conc paragraphs don't work well for R-to-L: If the text doesn't fit, it will
// show the trailing text rather than the leading text.
if (fQuoteParaRtoL || expanded)
vwenv.OpenParagraph();
else
vwenv.OpenConcPara(0, 0, 0, 0);
vwenv.AddObjVec((int)ScrScriptureNoteTags.kflidCategories, this,
(int)NotesFrags.kfrConnotCategory);
vwenv.CloseParagraph();
vwenv.CloseTableCell();
// Display CONNOT category chooser button in the penultimate or last cell
vwenv.OpenTableCell(1, 1);
vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop,
(int)FwTextPropVar.ktpvMilliPoint, 1000);
vwenv.set_IntProperty((int)FwTextPropType.ktptPadLeading,
(int)FwTextPropVar.ktpvMilliPoint, 2000);
vwenv.AddPicture(m_picChooser, -(int)NotesFrags.kfrConnotCategory, 0, 0);
vwenv.CloseTableCell();
// If not expanded, display the quote in the last cell
if (!expanded)
{
vwenv.OpenTableCell(1, 1);
SetupWsAndDirectionForPara(vwenv, quotePara.Hvo);
if (fQuoteParaRtoL)
vwenv.OpenParagraph(); // Conc paragraphs don't work well for R-to-L
else
vwenv.OpenConcPara(0, 0, 0, 0);
vwenv.AddString(quotePara.Contents);
vwenv.CloseParagraph();
vwenv.CloseTableCell();
}
CloseTableRow(vwenv, ann);
#endregion
if (!expanded)
return;
#region Second through fifth rows
bool fRegularAnnotation = ann.AnnotationType != NoteType.CheckingError;
//Second row has quote
DisplayExpandableAnnotation(vwenv, ann,
(int)ScrScriptureNoteTags.kflidQuote,
ann.QuoteOA.Hvo, ann.QuoteOA,
//.........这里部分代码省略.........
示例7: DisplayAnnotationFragment
//.........这里部分代码省略.........
VwFramePosition framePos = VwFramePosition.kvfpVoid;
if (ann.Hvo == SelectedNoteHvo)
{
columnCount = 7;
framePos = (ann.ResponsesOS.Count == 0 || !isExpanded || !responseExpanded) ?
VwFramePosition.kvfpBox : (VwFramePosition.kvfpAbove | VwFramePosition.kvfpVsides);
}
vwenv.OpenTable(columnCount,
vlTable, // Table uses 100% of available width.
borderThickness,
VwAlignment.kvaLeft, // Default alignment.
framePos,
//VwFramePosition.kvfpBox,
//VwRule.kvrlAll, // rule lines between cells
VwRule.kvrlNone,
0, //No space between cells.
0, //No padding inside cells.
false);
vwenv.NoteDependency(new int[] { hvo, hvo }, new int[]{m_expansionTag,
ScrScriptureNoteTags.kflidResponses}, 2);
// Specify column widths. The first argument is the number of columns,
// not a column index.
VwLength vlColumn;
if (ann.Hvo != SelectedNoteHvo)
{
vlColumn.nVal = borderThickness;
vlColumn.unit = VwUnit.kunPoint1000;
vwenv.MakeColumns(1, vlColumn);
}
vlColumn.nVal = 13000;
vlColumn.unit = VwUnit.kunPoint1000;
vwenv.MakeColumns(2, vlColumn);
vlColumn.nVal = 60000;
vlColumn.unit = VwUnit.kunPoint1000;
vwenv.MakeColumns(1, vlColumn);
vlColumn.nVal = 2;
vlColumn.unit = VwUnit.kunRelative;
vwenv.MakeColumns(1, vlColumn); // Column for the CONNOT categories
vlColumn.nVal = 12000;
vlColumn.unit = VwUnit.kunPoint1000;
vwenv.MakeColumns(1, vlColumn); // Column for the chooser button when showing quote
vlColumn.nVal = 3;
vlColumn.unit = VwUnit.kunRelative;
vwenv.MakeColumns(1, vlColumn); // Column for the quote when collapsed
vlColumn.nVal = 12000;
vlColumn.unit = VwUnit.kunPoint1000;
vwenv.MakeColumns(1, vlColumn); // Column for the chooser button when not showing quote
if (ann.Hvo != SelectedNoteHvo)
{
vlColumn.nVal = borderThickness;
vlColumn.unit = VwUnit.kunPoint1000;
vwenv.MakeColumns(1, vlColumn);
}
vwenv.OpenTableBody();
DisplayAnnotation(vwenv, ann, isExpanded);
// Only display the responses if this note is expanded and has responses.
if (!isExpanded || ann.ResponsesOS.Count == 0)
{
// Close table
vwenv.CloseTableBody();
vwenv.CloseTable();
return;
}
vwenv.NoteDependency(new int[] { ann.ResponsesOS.ToHvoArray()[0] },
new int[] { m_expansionTag }, 1);
OpenTableRow(vwenv, ann);
// Display empty first cell
vwenv.OpenTableCell(1, 1);
vwenv.CloseTableCell();
// Display expand box (+/-) in the second cell
vwenv.OpenTableCell(1, 1);
vwenv.AddObj(ann.ResponsesOS.ToHvoArray()[0], this, (int)NotesFrags.kfrExpansion);
vwenv.CloseTableCell();
// Display response label in the remaining cells
vwenv.OpenTableCell(1, 5);
vwenv.OpenConcPara(0, 0, 0, 0);
vwenv.AddString(m_responseLabel);
vwenv.CloseParagraph();
vwenv.CloseTableCell();
CloseTableRow(vwenv, ann);
// Close table
vwenv.CloseTableBody();
vwenv.CloseTable();
if (responseExpanded)
{
vwenv.AddObjVecItems((int)ScrScriptureNoteTags.kflidResponses,
this, (int)NotesFrags.kfrResponse);
}
}
示例8: Display
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
TriggerDisplay(vwenv);
// 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.
m_mDxmpLabelWidth = 0;
for (int i = 0; i < m_rgws.Count; ++i)
{
int dxs; // Width of displayed string.
int dys; // Height of displayed string (not used here).
// 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();
//.........这里部分代码省略.........