internal UndoRedoApproveAnalysis(InterlinDocChild interlinDoc, int hvoOldAnnotation, int hvoNewAnnotation) { m_interlinDoc = interlinDoc; m_cache = interlinDoc.Cache; if (hvoOldAnnotation != 0) { m_oldTwficInfo = new StTxtPara.TwficInfo(m_cache, hvoOldAnnotation); m_oldTwficInfo.CaptureObjectInfo(); } if (hvoNewAnnotation != 0) this.NewAnnotation = hvoNewAnnotation; }
public void MakeAndBreakPhraseAndKeepFocusBoxInPlace() { JumpToWord("wonderfulXXXzzzcounselor"); int indexWordBeforeEdit = m_wordList.CurrentIndex; int hvoWordBeforeEdit = m_wordList.CurrentObject.Hvo; using (InterlinMasterHelper imh = new InterlinMasterHelper(this)) { imh.SwitchTab(InterlinMaster.TabPageSelection.Interlinearizer); InterlinDocChild idc = imh.CurrentInterlinDoc; // paragraph1: XXXlocoZZZ, XXXsegmentZZZ?? ZZZamazingXXX wonderfulXXXzzzcounselor!! StTxtPara para1 = m_text1.ContentsOA.ParagraphsOS[1] as StTxtPara; int hvoAnnBeforeEdit = para1.SegmentForm(1, 0); StTxtPara.TwficInfo twficBeforeEdit1_0 = new StTxtPara.TwficInfo(Cache, hvoAnnBeforeEdit); twficBeforeEdit1_0.CaptureObjectInfo(); // select a "ZZZamazingXXX" so we can make a phrase with "wonderfulXXXzzzcounselor" IStText stTextBeforeEdit = idc.RawStText; idc.SelectAnnotation(hvoAnnBeforeEdit); // XXXlocoZZZ, XXXsegmentZZZ?? [ZZZamazingXXX wonderfulXXXzzzcounselor] m_window.InvokeCommand("CmdMakePhrase"); ValidateFocusBoxState(indexWordBeforeEdit, idc, twficBeforeEdit1_0, stTextBeforeEdit); StTxtPara.TwficInfo twficAfterMakePhrase1_0 = new StTxtPara.TwficInfo(Cache, idc.HvoAnnotation); twficAfterMakePhrase1_0.CaptureObjectInfo(); m_window.InvokeCommand("CmdBreakPhrase"); // worderfulXXXzzzcounselor will have been inserted back before the current index, so advance one ValidateFocusBoxState(indexWordBeforeEdit + 1, idc, twficAfterMakePhrase1_0, stTextBeforeEdit); StTxtPara.TwficInfo twficAfterBreakPhrase1_0 = new StTxtPara.TwficInfo(Cache, idc.HvoAnnotation); twficAfterBreakPhrase1_0.CaptureObjectInfo(); idc.OnUndo(null); ValidateFocusBoxState(indexWordBeforeEdit, idc, twficAfterBreakPhrase1_0, stTextBeforeEdit); } }