本文整理汇总了C#中SIL.FieldWorks.Common.COMInterfaces.SelLevInfo类的典型用法代码示例。如果您正苦于以下问题:C# SelLevInfo类的具体用法?C# SelLevInfo怎么用?C# SelLevInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SelLevInfo类属于SIL.FieldWorks.Common.COMInterfaces命名空间,在下文中一共展示了SelLevInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: SetupSelectionForParas
/// ------------------------------------------------------------------------------------
/// <summary>
/// Creates a simulated range selection
/// </summary>
/// <param name="hvoPara1"></param>
/// <param name="hvoPara2"></param>
/// <param name="ichAnchor"></param>
/// <param name="ichEnd"></param>
/// ------------------------------------------------------------------------------------
public void SetupSelectionForParas(int hvoPara1, int hvoPara2, int ichAnchor, int ichEnd)
{
CheckDisposed();
DynamicMock fakeSelHelper = new DynamicMock(typeof(SelectionHelper));
fakeSelHelper.SetupResult("NumberOfLevels", 1);
SelLevInfo[] topInfo = new SelLevInfo[1];
topInfo[0].tag = StTextTags.kflidParagraphs;
topInfo[0].hvo = hvoPara1;
SelLevInfo[] bottomInfo = new SelLevInfo[1];
bottomInfo[0].tag = StTextTags.kflidParagraphs;
bottomInfo[0].hvo = hvoPara2;
fakeSelHelper.SetupResult("LevelInfo", topInfo);
fakeSelHelper.SetupResult("IchAnchor", ichAnchor);
fakeSelHelper.SetupResult("IchEnd", ichEnd);
fakeSelHelper.SetupResultForParams("GetLevelInfo", topInfo,
SelectionHelper.SelLimitType.Top);
fakeSelHelper.SetupResultForParams("GetLevelInfo", topInfo,
SelectionHelper.SelLimitType.Anchor);
fakeSelHelper.SetupResultForParams("GetLevelInfo", bottomInfo,
SelectionHelper.SelLimitType.Bottom);
fakeSelHelper.SetupResultForParams("GetLevelInfo", bottomInfo,
SelectionHelper.SelLimitType.End);
fakeSelHelper.SetupResultForParams("GetIch", ichAnchor,
SelectionHelper.SelLimitType.Top);
fakeSelHelper.SetupResultForParams("GetIch", ichEnd,
SelectionHelper.SelLimitType.Bottom);
m_currentSelection = (SelectionHelper)fakeSelHelper.MockInstance;
}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:38,代码来源:NotesEditingHelperTests.cs
示例2: RequestSelectionHelper
/// -----------------------------------------------------------------------------------
/// <summary>
/// Make one and hook it up to be called at the appropriate time.
/// </summary>
/// -----------------------------------------------------------------------------------
public RequestSelectionHelper(IActionHandlerExtensions hookup, IVwRootBox rootb, int ihvoRoot,
SelLevInfo[] rgvsli, int tagTextProp, int cpropPrevious, int ich, int wsAlt, bool fAssocPrev,
ITsTextProps selProps)
{
m_hookup = hookup;
m_rootb = rootb;
m_ihvoRoot = ihvoRoot;
m_rgvsli = rgvsli;
m_tagTextProp = tagTextProp;
m_cpropPrevious = cpropPrevious;
m_ich = ich;
m_wsAlt = wsAlt;
m_fAssocPrev = fAssocPrev;
m_selProps = selProps;
m_hookup.DoAtEndOfPropChanged(m_hookup_PropChangedCompleted);
}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:21,代码来源:RequestSelectionHelper.cs
示例3: SetupSelectionInFootnote
/// ------------------------------------------------------------------------------------
/// <summary>
/// Setup the selection in footnote.
/// </summary>
/// <param name="footnote">The footnote.</param>
/// <param name="book">The book.</param>
/// <param name="iBook">The 0-based index of the book.</param>
/// <param name="ichStart">The 0-based starting character index.</param>
/// <param name="ichEnd">The 0-based ending character index.</param>
/// ------------------------------------------------------------------------------------
public void SetupSelectionInFootnote(IStFootnote footnote, IScrBook book,
int iBook, int ichStart, int ichEnd)
{
CheckDisposed();
DynamicMock fakeSelHelper = new DynamicMock(typeof(SelectionHelper));
fakeSelHelper.SetupResult("GetTextPropId", StTxtParaTags.kflidContents, typeof(SelectionHelper.SelLimitType));
fakeSelHelper.SetupResult("NumberOfLevels", 3);
// Setup the anchor
SelLevInfo[] topInfo = new SelLevInfo[3];
IStTxtPara para = footnote[0];
topInfo[0].tag = StTextTags.kflidParagraphs;
topInfo[0].ihvo = 0; // only one para per footnote allowed
topInfo[0].hvo = para.Hvo;
topInfo[1].tag = ScrBookTags.kflidFootnotes;
topInfo[1].ihvo = footnote.IndexInOwner;
topInfo[1].hvo = footnote.Hvo;
topInfo[2].tag = BookFilter.Tag;
topInfo[2].ihvo = iBook;
topInfo[2].hvo = book.Hvo;
// Setup the end
SelLevInfo[] bottomInfo = new SelLevInfo[3];
for(int i = 0; i < 3; i++)
bottomInfo[i] = topInfo[i];
fakeSelHelper.SetupResult("LevelInfo", topInfo);
fakeSelHelper.SetupResult("IchAnchor", ichStart);
fakeSelHelper.SetupResult("IchEnd", ichEnd);
fakeSelHelper.SetupResultForParams("GetLevelInfo", topInfo,
SelectionHelper.SelLimitType.Top);
fakeSelHelper.SetupResultForParams("GetLevelInfo", topInfo,
SelectionHelper.SelLimitType.Anchor);
fakeSelHelper.SetupResultForParams("GetLevelInfo", bottomInfo,
SelectionHelper.SelLimitType.Bottom);
fakeSelHelper.SetupResultForParams("GetLevelInfo", bottomInfo,
SelectionHelper.SelLimitType.End);
fakeSelHelper.SetupResultForParams("GetIch", ichStart,
SelectionHelper.SelLimitType.Top);
fakeSelHelper.SetupResultForParams("GetIch", ichEnd,
SelectionHelper.SelLimitType.Bottom);
m_currentSelection = (SelectionHelper)fakeSelHelper.MockInstance;
}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:55,代码来源:FootnoteEditingHelperTests.cs
示例4: MakeInnerLevelForFreeformSelection
/// <summary>
/// Sets up the tags for the 0 level of a selection of a free translation or note.
/// This will be the level "inside" the ones that select the paragraph and segment.
/// For a note, we need to select the first note.
/// For a free translation, we need to insert the level for the 'self' property
/// which the VC inserts to isolate the free translations and make it easier to update them.
/// </summary>
/// <param name="tagTextProp">The segment or note tag of an annotation to be selected.</param>
private SelLevInfo MakeInnerLevelForFreeformSelection(int tagTextProp)
{
var noteLevel = new SelLevInfo();
noteLevel.ihvo = 0;
if (tagTextProp == NoteTags.kflidContent)
{
noteLevel.tag = SegmentTags.kflidNotes;
}
else
{
noteLevel.tag = Cache.MetaDataCacheAccessor.GetFieldId2(CmObjectTags.kClassId, "Self", false);
}
return noteLevel;
}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:22,代码来源:InterlinDocForAnalysis.cs
示例5: SelectFirstTranslationOrNote
/// <summary>
/// Select the first non-null translation or note in the current segment
/// of the current analysis occurance.
/// </summary>
/// <returns>true if successful, false if there is no real translation or note</returns>
internal bool SelectFirstTranslationOrNote()
{
int ws;
int annotationFlid = GetFirstVisibleTranslationOrNoteFlid(SelectedOccurrence.Segment, out ws);
if (annotationFlid == 0) return false;
var sel = MakeSandboxSel();
int clev = sel.CLevels(true);
clev--; // result it returns is one more than what the AllTextSelInfo routine wants.
SelLevInfo[] rgvsli;
using (ArrayPtr rgvsliTemp = MarshalEx.ArrayToNative<SelLevInfo>(clev))
{
int ihvoRoot;
int cpropPrevious;
int ichAnchor;
int ichEnd;
int ihvoEnd1;
int tag, ws1;
bool fAssocPrev;
ITsTextProps ttp;
sel.AllTextSelInfo(out ihvoRoot, clev, rgvsliTemp, out tag, out cpropPrevious,
out ichAnchor, out ichEnd, out ws1, out fAssocPrev, out ihvoEnd1, out ttp);
rgvsli = MarshalEx.NativeToArray<SelLevInfo>(rgvsliTemp, clev);
}
// What non-word "choice" ie., translation text or note is on this line?
int tagTextProp = ConvertTranslationOrNoteFlidToSegmentFlid(annotationFlid, SelectedOccurrence.Segment, ws);
int levels;
SelLevInfo noteLevel = MakeInnerLevelForFreeformSelection(tagTextProp);
var vsli = new SelLevInfo[3];
vsli[0] = noteLevel; // note or translation line
vsli[1] = rgvsli[0]; // segment
vsli[2] = rgvsli[1]; // para
int cPropPrevious = 0; // todo: other if not the first WS for tagTextProp
TryHideFocusBoxAndUninstall();
RootBox.MakeTextSelection(0, vsli.Length, vsli, tagTextProp, cPropPrevious,
0, 0, 0, false, -1, null, true);
Focus();
return true;
}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:43,代码来源:InterlinDocForAnalysis.cs
示例6: GetCurrentSelection
/// <summary>
/// Gets the current selection and returns enough data to move the IP.
/// </summary>
/// <param name="clev">The number of levels of selection range results.</param>
/// <param name="rgvsli">The selection range with clev levels of structure.</param>
/// <param name="tag">The property of the bottom-level [0] object that is of interest.</param>
/// <param name="ichAnchor">The start index of the text selection.</param>
/// <param name="ichEnd">The end index of the text selection.</param>
/// <param name="ws">Index of the writing system of the selection.</param>
/// <returns>true if a selection was made, false if something prevented it.</returns>
private bool GetCurrentSelection(out int clev, out SelLevInfo[] rgvsli, out int tag, out int ichAnchor, out int ichEnd, out int ws)
{
clev = -1;
rgvsli = null;
tag = -1;
ichAnchor = -1;
ichEnd = -1;
ws = -1;
var sel = EditingHelper.RootBoxSelection;
if (sel == null)
return false;
// which "line choice" is active in this segment?
if (sel.SelType != VwSelType.kstText || !sel.IsValid || !sel.IsEditable)
return false;
clev = sel.CLevels(true);
ITsTextProps ttp;
using (ArrayPtr rgvsliTemp = MarshalEx.ArrayToNative<SelLevInfo>(clev))
{
int ihvoRoot;
int ihvoEnd1;
int cpropPrevious;
bool fAssocPrev;
sel.AllTextSelInfo(out ihvoRoot, clev, rgvsliTemp, out tag, out cpropPrevious,
out ichAnchor, out ichEnd, out ws, out fAssocPrev, out ihvoEnd1, out ttp);
rgvsli = MarshalEx.NativeToArray<SelLevInfo>(rgvsliTemp, clev);
}
return true;
}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:38,代码来源:InterlinDocForAnalysis.cs
示例7: SelectionChanged
public override void SelectionChanged(IVwRootBox rootb, IVwSelection vwselNew)
{
CheckDisposed();
if (vwselNew == null)
return;
bool hasFoc = Focused;
base.SelectionChanged(rootb, vwselNew);
ITsString tss;
int ichAnchor;
bool fAssocPrev;
int hvoObj;
int tag;
int ws; // NB: This will be 0 after each call, since the string does
// not have alternatives. Ws would be the WS of an alternative,
// if there were any.
vwselNew.TextSelInfo(false, out tss, out ichAnchor, out fAssocPrev, out hvoObj,
out tag, out ws);
int ichEnd;
int hvoObjEnd;
vwselNew.TextSelInfo(true, out tss, out ichEnd, out fAssocPrev, out hvoObjEnd,
out tag, out ws);
if (hvoObjEnd != hvoObj)
{
CheckHeight();
return;
}
if (m_hvoOldSelection > 0 && hvoObj != m_hvoOldSelection)
{
// Try to validate previously selected string rep.
if (m_silCache.get_StringProp(m_hvoOldSelection, kEnvStringRep).Length==0)
{
// Remove it from the dummy cache, since its length is 0.
int limit = m_silCache.get_VecSize(m_rootObj.Hvo, kMainObjEnvironments);
for (int i = 0; i < limit; ++i)
{
if (m_hvoOldSelection ==
m_silCache.get_VecItem(m_rootObj.Hvo, kMainObjEnvironments, i))
{
RemoveFromDummyCache(i);
break;
}
}
}
else // Validate previously selected string rep.
{
ValidateStringRep(m_hvoOldSelection);
}
}
if (hvoObj != kDummyPhoneEnvID)
{
m_hvoOldSelection = hvoObj;
CheckHeight();
return;
}
if (tss.Length == 0)
{
CheckHeight();
return;
}
// Create a new object, and recreate a new empty object. Make this part of the Undo
// Task with the character we typed.
m_silCache.GetActionHandler().ContinueUndoTask();
int count = m_silCache.get_VecSize(m_rootObj.Hvo, kMainObjEnvironments);
int hvoNew = InsertNewEnv(count - 1);
m_silCache.SetString(hvoNew, kEnvStringRep, tss);
m_silCache.SetString(kDummyPhoneEnvID, kEnvStringRep, DummyString);
m_silCache.EndUndoTask();
// Refresh
m_silCache.PropChanged(null, (int)PropChangeType.kpctNotifyAll,
m_rootObj.Hvo, kMainObjEnvironments, count - 1, 2, 1);
// Reset selection.
SelLevInfo[] rgvsli = new SelLevInfo[1];
rgvsli[0].cpropPrevious = 0;
rgvsli[0].tag = kMainObjEnvironments;
rgvsli[0].ihvo = count - 1;
m_rootb.MakeTextSelection(0, rgvsli.Length, rgvsli, tag, 0, ichAnchor, ichEnd, ws,
fAssocPrev, -1, null, true);
m_hvoOldSelection = hvoNew;
CheckHeight();
}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:86,代码来源:PhoneEnvReferenceView.cs
示例8: MakeSelInObj
public IVwSelection MakeSelInObj(int ihvoRoot, int cvsli, SelLevInfo[] _rgvsli, int tag,
bool fInstall)
{
throw new NotImplementedException();
}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:5,代码来源:IbusRootSiteEventHandlerTests.cs
示例9: MakeTextSelection
public IVwSelection MakeTextSelection(int ihvoRoot, int cvlsi, SelLevInfo[] _rgvsli,
int tagTextProp, int cpropPrevious, int ichAnchor, int ichEnd, int ws, bool fAssocPrev,
int ihvoEnd, ITsTextProps _ttpIns, bool fInstall)
{
return new DummyVwSelection(this, ichAnchor, ichEnd);
}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:6,代码来源:IbusRootSiteEventHandlerTests.cs
示例10: GetLevelInfo
protected override SelLevInfo[] GetLevelInfo(int cellId, int cellIndex)
{
SelLevInfo[] levels = null;
switch (cellId)
{
case AffixRuleFormulaVc.ktagLeftEmpty:
case AffixRuleFormulaVc.ktagRightEmpty:
break;
case MoAffixProcessTags.kflidOutput:
if (cellIndex >= 0)
{
levels = new SelLevInfo[1];
levels[0].tag = cellId;
levels[0].ihvo = cellIndex;
}
break;
default:
var ctxtOrVar = m_cache.ServiceLocator.GetInstance<IPhContextOrVarRepository>().GetObject(cellId);
if (cellIndex < 0 || ctxtOrVar.ClassID != PhSequenceContextTags.kClassId)
{
levels = new SelLevInfo[1];
levels[0].tag = MoAffixProcessTags.kflidInput;
levels[0].ihvo = ctxtOrVar.IndexInOwner;
}
else
{
levels = new SelLevInfo[2];
levels[0].tag = PhSequenceContextTags.kflidMembers;
levels[0].ihvo = cellIndex;
levels[1].tag = MoAffixProcessTags.kflidInput;
levels[1].ihvo = ctxtOrVar.IndexInOwner;
}
break;
}
return levels;
}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:39,代码来源:AffixRuleFormulaControl.cs
示例11: MakeSel
/// <summary>
/// Reestablish a selection, if possible.
/// </summary>
public void MakeSel()
{
if (m_tagSel == -1)
return;
int clev = 2; // typically two level
if (m_tagSel != ktagSbNamedObjName)
clev--; // prefix and postfix are one level less embedded
SelLevInfo[] rgsli = new SelLevInfo[clev];
// The selection is in the morphemes of the root object
rgsli[clev - 1].ihvo = m_ihvoSelMorph;
rgsli[clev - 1].tag = ktagSbWordMorphs;
if (clev > 1)
rgsli[0].tag = ktagSbMorphForm; // leave other slots zero
try
{
m_sandbox.RootBox.MakeTextSelection(
m_sandbox.IndexOfCurrentItem, // which root,
clev, rgsli,
m_tagSel,
0, // no previous occurrence
m_ichSelOutput, m_ichSelOutput, m_wsVern,
false, // needs to be false here to associate with trailing character
// esp. for when the cursor is at the beginning of the morpheme (LT-7773)
-1, // end not in different object
null, // no special props to use for typing
true); // install it.
}
catch (Exception)
{
// Ignore anything that goes wrong making a selection. At worst we just don't have one.
}
}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:35,代码来源:SandboxBase.MorphemeBreaker.cs
示例12: GetParagraphProps
public void GetParagraphProps()
{
CheckDisposed();
// we want more paragraphs with different Hvos
MakeEnglishParagraphs();
ShowForm(Lng.English, DummyBasicViewVc.DisplayType.kNormal);
IVwRootBox rootBox = m_basicView.RootBox;
IVwSelection vwsel;
int hvoText, tagText, ihvoFirst, ihvoLast;
IVwPropertyStore[] vqvps;
ITsTextProps[] vqttp;
// Test 1: selection in one paragraph
rootBox.MakeSimpleSel(false, true, false, true);
IVwSelection sel = rootBox.Selection;
ITsString tss;
int ich, hvoObj, tag, ws;
bool fAssocPrev;
sel.TextSelInfo(true, out tss, out ich, out fAssocPrev, out hvoObj, out tag, out ws);
int clev = sel.CLevels(true);
clev--; // result it returns is one more than what the AllTextSelInfo routine wants.
int ihvoRoot;
int cpropPrevious;
int ichAnchor;
int ichEnd;
int ihvoEnd1;
ITsTextProps ttp;
using (ArrayPtr rgvsliTemp = MarshalEx.ArrayToNative(clev, typeof(SelLevInfo)))
{
sel.AllTextSelInfo(out ihvoRoot, clev, rgvsliTemp, out tag, out cpropPrevious,
out ichAnchor, out ichEnd, out ws, out fAssocPrev, out ihvoEnd1, out ttp);
SelLevInfo[] rgvsli = (SelLevInfo[])MarshalEx.NativeToArray(rgvsliTemp, clev,
typeof(SelLevInfo));
int ichInsert = 0;
rootBox.MakeTextSelection(ihvoRoot, clev, rgvsli, tag, cpropPrevious, ichInsert,
ichInsert + 5, ws, fAssocPrev, ihvoEnd1, ttp, true);
bool fRet = m_basicView.GetParagraphProps(out vwsel, out hvoText, out tagText,
out vqvps, out ihvoFirst, out ihvoLast, out vqttp);
Assert.IsTrue(fRet, "Test 1 ");
Assert.AreEqual(ihvoFirst, ihvoLast, "Test 1 ");
Assert.AreEqual(1, vqttp.Length, "Test 1 ");
// Test 2: selection across two sections
SelLevInfo[] rgvsliEnd = new SelLevInfo[clev];
rgvsli.CopyTo(rgvsliEnd, 0);
rgvsli[0].ihvo = 0; // first paragraph
rgvsli[clev-1].ihvo = 2; // third section
rootBox.MakeTextSelInObj(ihvoRoot, clev, rgvsli, clev, rgvsliEnd, false, true, true, true,
true);
fRet = m_basicView.GetParagraphProps(out vwsel, out hvoText, out tagText,
out vqvps, out ihvoFirst, out ihvoLast, out vqttp);
Assert.IsFalse(fRet, "Test 2 ");
}
}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:60,代码来源:MoreRootSiteTests.cs
示例13: LoseFocusToView_RangeSel_FlagSet
public void LoseFocusToView_RangeSel_FlagSet()
{
CheckDisposed();
ShowForm(Lng.English, DummyBasicViewVc.DisplayType.kNormal);
IVwRootBox rootBox = m_basicView.RootBox;
rootBox.Activate(VwSelectionState.vssEnabled);
m_basicView.ShowRangeSelAfterLostFocus = true;
// Select the first four characters in the first paragraph
SelLevInfo[] levelInfo = new SelLevInfo[2];
levelInfo[1].tag = m_flidContainingTexts;
levelInfo[1].cpropPrevious = 0;
levelInfo[1].ihvo = 0;
levelInfo[0].tag = (int)StText.StTextTags.kflidParagraphs;
levelInfo[0].cpropPrevious = 0;
levelInfo[0].ihvo = 0;
rootBox.MakeTextSelection(0, 2, levelInfo,
(int)StTxtPara.StTxtParaTags.kflidContents, 0, 0, 3, 0, true, 0, null, true);
// Lets pretend we a different view gets the focus (although it's the same)
m_basicView.KillFocus(m_basicView);
Assert.IsTrue(rootBox.Selection.IsEnabled,
"Selection should still be enabled if the ShowRangeSelAfterLostFocus flag is set");
}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:27,代码来源:MoreRootSiteTests.cs
示例14: LoseFocusToNonView_RangeSel
public void LoseFocusToNonView_RangeSel()
{
CheckDisposed();
ShowForm(Lng.English, DummyBasicViewVc.DisplayType.kNormal);
IVwRootBox rootBox = m_basicView.RootBox;
rootBox.Activate(VwSelectionState.vssEnabled);
// Select the first four characters in the first paragraph
SelLevInfo[] levelInfo = new SelLevInfo[2];
levelInfo[1].tag = m_flidContainingTexts;
levelInfo[1].cpropPrevious = 0;
levelInfo[1].ihvo = 0;
levelInfo[0].tag = (int)StText.StTextTags.kflidParagraphs;
levelInfo[0].cpropPrevious = 0;
levelInfo[0].ihvo = 0;
rootBox.MakeTextSelection(0, 2, levelInfo,
(int)StTxtPara.StTxtParaTags.kflidContents, 0, 0, 3, 0, true, 0, null, true);
// We have to set up a form that contains the view and the control that we pretend
// gets focus.
using (Form parentForm = new Form())
using (Control control = new Control())
{
m_basicView.Parent = parentForm;
control.Parent = parentForm;
// Lets pretend we a non-view gets the focus (although it's the same)
m_basicView.KillFocus(control);
Assert.IsTrue(rootBox.Selection.IsEnabled,
"Selection should still be enabled if non-view window got focus");
}
}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:34,代码来源:MoreRootSiteTests.cs
示例15: MergeBTsWhenParasMerge_FromMiddleOfPara1ToMiddleOfPara2_aKey
public void MergeBTsWhenParasMerge_FromMiddleOfPara1ToMiddleOfPara2_aKey()
{
CheckDisposed();
ShowForm(Lng.English, DummyBasicViewVc.DisplayType.kNormal);
IVwRootBox rootBox = m_basicView.RootBox;
// Add a second paragraph to the first text and create some Back Translations on
// both paragraphs
ScrBook book = new ScrBook(Cache, m_hvoRoot);
StText text1 = (StText)book.FootnotesOS[0];
StTxtPara para1 = (StTxtPara)text1.ParagraphsOS[0];
StTxtPara para2 = m_scrInMemoryCache.AddParaToMockedText(text1.Hvo, string.Empty);
m_scrInMemoryCache.AddRunToMockedPara(para2, DummyBasicView.kSecondParaEng, m_wsEng);
// We'll just re-use our "vernacular" WS for the back translation, for testing purposes.
ICmTranslation trans1 = m_inMemoryCache.AddBtToMockedParagraph(para1, m_wsEng);
m_inMemoryCache.AddRunToMockedTrans(trans1, m_wsEng, "BT1", null);
ICmTranslation trans2 = m_inMemoryCache.AddBtToMockedParagraph(para2, m_wsEng);
m_inMemoryCache.AddRunToMockedTrans(trans2, m_wsEng, "BT2", null);
Cache.PropChanged(null, PropChangeType.kpctNotifyAll, text1.Hvo,
(int)StText.StTextTags.kflidParagraphs, 1, 1, 0);
// Make a selection from the end of first paragraph to the beginning of the second.
SelLevInfo[] levelInfo = new SelLevInfo[2];
levelInfo[1].tag = m_flidContainingTexts;
levelInfo[1].cpropPrevious = 0;
levelInfo[1].ihvo = 0;
levelInfo[0].tag = (int)StText.StTextTags.kflidParagraphs;
levelInfo[0].cpropPrevious = 0;
levelInfo[0].ihvo = 0;
int ichAnchor = DummyBasicView.kFirstParaEng.Length - 2;
int ichEnd = 2;
rootBox.MakeTextSelection(0, 2, levelInfo,
(int)StTxtPara.StTxtParaTags.kflidContents, 0, ichAnchor, ichEnd, 0, true, 1, null,
true);
TypeChar('a');
Assert.AreEqual(DummyBasicView.kFirstParaEng.Substring(0, ichAnchor) + "a" +
DummyBasicView.kSecondParaEng.Substring(ichEnd), para1.Contents.Text);
Assert.AreEqual("BT1 BT2", trans1.Translation.GetAlternative(m_wsEng).Text);
}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:43,代码来源:MoreRootSiteTests.cs
示例16: FindBaseAnnInSelLevInfo
/// <summary>
/// COPIED from INTERLINPRINTVIEW temporarily to (temporarily) preserve Print View functionality.
/// </summary>
/// <param name="rgvsli"></param>
/// <returns></returns>
private int FindBaseAnnInSelLevInfo(SelLevInfo[] rgvsli)
{
for (int i = 0; i < rgvsli.Length; i++)
{
int hvoAnn = rgvsli[i].hvo;
if (hvoAnn > 0 && HvoIsRealBaseAnnotation(hvoAnn))
return hvoAnn;
}
return 0;
}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:15,代码来源:InterlinTaggingChild.cs
示例17: AddDependentObjectsToPageRoot
//.........这里部分代码省略.........
if (depObjVc.StartingObjIndex == -1)
{
// Most likely all the shown objects were removed from the view constructor.
// We need to make sure we have a valid starting index.
depObjVc.StartingObjIndex = startIndex;
}
depObjVc.EndingObjIndex = endIndex;
}
}
if (startIndex < 0 || endIndex < 0)
{
fFailed = fAllowFail;
return;
}
// update the rootbox with the new items.
try
{
// propChanged generates a PageBroken notification we need to ignore.
m_hPageBeingBuilt = hPage;
int count = endIndex - startIndex + 1;
dependentRootbox.PropChanged(hvoRoot, dependentObjTag, startIndex, count, count);
}
finally
{
m_hPageBeingBuilt = 0;
}
PublicationControl.SetAccessibleStreamName(dependentStream,
"Dependent stream for page " + page.PageNumber);
// The actual laying out is probably redundant, but this lets the dependent stream
// know what page it's on, which is useful for notifications. With an interface
// change we could do this more efficiently, I think.
for (int ihvo = startIndex; ihvo <= endIndex; ihvo++)
{
SelLevInfo[] rgSelLevInfo = new SelLevInfo[1];
rgSelLevInfo[0].tag = dependentObjTag;
rgSelLevInfo[0].ihvo = ihvo - depObjVc.StartingObjIndex;
dependentStream.LayoutObj(vg, AvailablePageWidthInPrinterPixels, 0,
rgSelLevInfo.Length, rgSelLevInfo, hPage);
}
int newHeight = dependentRootbox.Height;
int dysHeightUsed = newHeight - oldHeight;
// If this stream is just now being added to the page, need to allow for gap between elements.
if (oldHeight == 0)
dysHeightUsed += VerticalGapBetweenElements * vg.YUnitsPerInch / MiscUtils.kdzmpInch;
if ((dysHeightUsed * m_numberMainStreamColumns) > dysAvailHeight)
{
// We can't add everything needed for the current chunk (in the main stream),
// so we need to fail (if that's permitted), and roll everything back
if (fAllowFail)
{
fFailed = true;
// roll back: remove the extra objects.
try
{
int newStartObjIndex = depObjVc.StartingObjIndex;
int newEndObjIndex = depObjVc.EndingObjIndex;
depObjVc.StartingObjIndex = prevStartIndex;
depObjVc.EndingObjIndex = prevEndIndex;
int count = endIndex - newStartObjIndex + 1;
dependentRootbox.PropChanged(hvoRoot, dependentObjTag, newStartObjIndex, count, count);
}
finally
{
m_hPageBeingBuilt = 0;
}
return;
}
else
dysAvailableHeight = 0;
}
else
{
// When we layout with multiple columns, we pretend to have one large
// page. But the substreams are still only one column which means
// they affect all columns, so we have to multiply the height used
// with the number of columns.
dysAvailableHeight -= (dysHeightUsed * m_numberMainStreamColumns);
}
// Now we know all the objects fit (or else we weren't allowed to fail), so
// adjust the rectangle occupied by the element.
// First time thru, the previous "element" is the bottom page margin.
// So far we only have one, but the code here shows vestiges of the loop in the
// main AddDependentObjects.
int ysTopOfPrevElement = Publication.PageHeightInPrinterPixels - BottomMarginInPrinterPixels;
if (newHeight > 0)
AddOrAdjustPageElement(page, ysTopOfPrevElement, newHeight, dependentStream, 0);
dysAvailHeight = dysAvailableHeight;
}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:101,代码来源:DivisionLayoutMgr.cs
示例18: RequestSelectionAtEndOfUow
/// ------------------------------------------------------------------------------------
/// <summary>
/// If we need to make a selection, but we can't because edits haven't been updated in the
/// view, this method requests creation of a selection after the unit of work is complete.
/// Specifically, when all PropChanged calls have been made for the UOW.
/// The arguments are as for MakeTextSelection, except that we only include the ones
/// necessary to specify an insertion point, and of course don't return the selection,
/// which typically won't be made until later. The selection made is always installed.
/// </summary>
/// ------------------------------------------------------------------------------------
public void RequestSelectionAtEndOfUow(IVwRootBox rootb, int ihvoRoot, int cvlsi,
SelLevInfo[] rgvsli, int tagTextProp, int cpropPrevious, int ich, int wsAlt,
bool fAssocPrev, ITsTextProps selProps)
{
// Creating one hooks it up; it will free itself when invoked.
new RequestSelectionHelper((IActionHandlerExtensions)m_cache.ActionHandlerAccessor,
rootb, ihvoRoot, rgvsli, tagTextProp, cpropPrevious, ich, wsAlt, fAssocPrev, selProps);
// We don't want to continue using the old, out-of-date selection.
rootb.DestroySelection();
}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:21,代码来源:PublicationControl.cs
示例19: MakeTextSelInObj
public IVwSelection MakeTextSelInObj(int ihvoRoot, int cvsli, SelLevInfo[] _rgvsli,
int cvsliEnd, SelLevInfo[] _rgvsliEnd, bool fInitial, bool fEdit, bool fRange,
bool fWholeObj, bool fInstall)
{
throw new NotImplementedException();
}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:6,代码来源:IbusRootSiteEventHandlerTests.cs
示例20: UpdateGoToSubItems_EnabledWhenRequiredSelectionIsPresent
public void UpdateGoToSubItems_EnabledWhenRequiredSelectionIsPresent()
{
CheckDisposed();
m_mainWnd.m_mockedBookFilter.SetupResult("BookCount", 1);
DynamicMock sel = new DynamicMock(typeof(IVwSelection));
DynamicMock selHelper = new DynamicMock(typeof(SelectionHelper));
SelLevInfo[] levInfo = new SelLevInfo[1];
selHelper.SetupResult("LevelInfo", levInfo);
selHelper.SetupResult("Selection", sel.MockInstance);
m_mainWnd.m_mockedEditingHelper.SetupResult("CurrentSelection", selHelper.MockInstance);
Assert.IsTrue(m_mainWnd.UpdateGoToSubItems(m_dummyItemProps, true));
Assert.IsTrue(m_dummyItemProps.Enabled,
"Go to Prev/Next subitem should be enabled when there is a selection.");
}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:18,代码来源:TeMainWndTestsNoWindow.cs
注:本文中的SIL.FieldWorks.Common.COMInterfaces.SelLevInfo类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论