/// ------------------------------------------------------------------------------------ /// <summary> /// Makes the root /// </summary> /// ------------------------------------------------------------------------------------ public override void MakeRoot() { CheckDisposed(); if (m_fdoCache == null || DesignMode) return; // Check for non-existing rootbox before creating a new one. By doing that we // can mock the rootbox in our tests. However, this might cause problems in our // real code - altough I think MakeRoot() should be called only once. if (m_rootb == null) m_rootb = VwRootBoxClass.Create(); m_rootb.SetSite(this); m_rootb.DataAccess = new FilteredDomainDataByFlidDecorator(m_fdoCache, null, ScrBookAnnotationsTags.kflidNotes); // Set up a new view constructor. HorizMargin = 10; Debug.Assert(IsHandleCreated); m_vc = new TeNotesVc(m_fdoCache, Zoom); OnChangeFilter(null); // m_vc.HotLinkClick += new DraftViewVc.HotLinkClickHandler(DoHotLinkAction); //EditingHelper.RootObjects = new int[]{ScriptureObj.Hvo}; m_rootb.SetRootObject(m_scr.Hvo, m_vc, (int)ScrFrags.kfrScripture, m_styleSheet); base.MakeRoot(); m_dxdLayoutWidth = kForceLayout; // Don't try to draw until we get OnSize and do layout. Synchronize(m_rootb); }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// <param name="disposing"></param> /// ------------------------------------------------------------------------------------ protected override void Dispose(bool disposing) { if (IsDisposed) return; base.Dispose (disposing); if (disposing) { if (m_vc != null) m_vc.Dispose(); } m_vc = null; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Ensures the annotation is mostly visible by making an uninstalled selection /// toward the end of the modified date. /// </summary> /// ------------------------------------------------------------------------------------ internal void EnsureNoteIsVisible(TeNotesVc vc, int bookIndex, int iAnnotation, IVwRootSite notesDataEntryView) { SelectionHelper selHelper = new SelectionHelper(); selHelper.NumberOfLevels = 2; selHelper.LevelInfo[0].cpropPrevious = 0; selHelper.LevelInfo[0].ich = -1; selHelper.LevelInfo[0].ihvo = iAnnotation; selHelper.LevelInfo[0].tag = vc.NotesSequenceHandler.Tag; selHelper.LevelInfo[0].ws = 0; selHelper.LevelInfo[1].cpropPrevious = 0; selHelper.LevelInfo[1].ich = -1; selHelper.LevelInfo[1].ihvo = bookIndex; selHelper.LevelInfo[1].tag = (int)Scripture.ScriptureTags.kflidBookAnnotations; selHelper.LevelInfo[1].ws = 0; selHelper.AssocPrev = false; // Put the selection at the end of the shortest possible date value. It doesn't // have to be right at the end, but the closer it is, the more reliable it will // be that it is fully scrolled into view. selHelper.IchAnchor = 8; selHelper.SetTextPropId(SelectionHelper.SelLimitType.Anchor, (int)CmAnnotation.CmAnnotationTags.kflidDateModified); selHelper.SetSelection(notesDataEntryView, false, true, VwScrollSelOpts.kssoDefault); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Makes the selection in in the Scripture reference of the specified annotation. /// </summary> /// <param name="vc">The vc.</param> /// <param name="bookIndex">Index of the book.</param> /// <param name="iAnnotation">Index of the annotation.</param> /// <param name="notesDataEntryView">The notes data entry view.</param> /// ------------------------------------------------------------------------------------ internal void MakeSelectionInNoteRef(TeNotesVc vc, int bookIndex, int iAnnotation, NotesDataEntryView notesDataEntryView) { EnsureNoteIsVisible(vc, bookIndex, iAnnotation, notesDataEntryView); SelectionHelper selHelper = new SelectionHelper(); selHelper.NumberOfLevels = 2; selHelper.LevelInfo[0].cpropPrevious = 0; selHelper.LevelInfo[0].ich = -1; selHelper.LevelInfo[0].ihvo = iAnnotation; selHelper.LevelInfo[0].tag = vc.NotesSequenceHandler.Tag; selHelper.LevelInfo[0].ws = 0; selHelper.LevelInfo[1].cpropPrevious = 0; selHelper.LevelInfo[1].ich = -1; selHelper.LevelInfo[1].ihvo = bookIndex; selHelper.LevelInfo[1].tag = (int)Scripture.ScriptureTags.kflidBookAnnotations; selHelper.LevelInfo[1].ws = 0; selHelper.IchAnchor = 0; selHelper.AssocPrev = false; selHelper.SetTextPropId(SelectionHelper.SelLimitType.Anchor, (int)CmBaseAnnotation.CmBaseAnnotationTags.kflidBeginRef); selHelper.SetSelection(notesDataEntryView, true, true, VwScrollSelOpts.kssoDefault); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Makes a selection in the specified annotation (without scrolling the annotation in /// the view). /// </summary> /// <param name="vc">The notes view constructor</param> /// <param name="fScrollNearTop">if set to <c>true</c> scrolls the specified note to a /// position near the top of the view.</param> /// <param name="bookIndex">Index of the book.</param> /// <param name="iAnnotation">Index of the annotation.</param> /// <param name="iResponse">Index of the response (0 if setting the selection in one of /// the StJournalText fields rather than in a response.</param> /// <param name="noteTag">The tag indicating the field of the annotation where the /// selection is to be made.</param> /// <param name="rootSite">The root site.</param> /// <param name="fNoteIsExpanded">if <c>true</c> make a selection at the start and end so /// that the whole annotation can be scrolled into view. if set to <c>false</c> only /// make a selection at the start of the annotation.</param> /// ------------------------------------------------------------------------------------ internal void MakeSelectionInNote(TeNotesVc vc, bool fScrollNearTop, int bookIndex, int iAnnotation, int iResponse, ScrScriptureNote.ScrScriptureNoteTags noteTag, IVwRootSite rootSite, bool fNoteIsExpanded) { if (vc == null || vc.NotesSequenceHandler == null) return; SelectionHelper selHelper; if (fScrollNearTop) { // Make an un-installed selection at the top of the annotation in order to scroll the // annotation to the top of the view. selHelper = new SelectionHelper(); selHelper.NumberOfLevels = 2; selHelper.LevelInfo[0].cpropPrevious = 0; selHelper.LevelInfo[0].ich = -1; selHelper.LevelInfo[0].ihvo = iAnnotation; selHelper.LevelInfo[0].tag = vc.NotesSequenceHandler.Tag; selHelper.LevelInfo[0].ws = 0; selHelper.LevelInfo[1].cpropPrevious = 0; selHelper.LevelInfo[1].ich = -1; selHelper.LevelInfo[1].ihvo = bookIndex; selHelper.LevelInfo[1].tag = (int)Scripture.ScriptureTags.kflidBookAnnotations; selHelper.LevelInfo[1].ws = 0; selHelper.SetTextPropId(SelectionHelper.SelLimitType.Anchor, -2); selHelper.IchAnchor = 0; selHelper.AssocPrev = false; selHelper.NumberOfPreviousProps = 2; if (fNoteIsExpanded) { selHelper.SetSelection(rootSite, true, true, VwScrollSelOpts.kssoNearTop); } else { // Annotation is collapsed. Only attempt a selection at the start of it. selHelper.SetSelection(rootSite, true, true); return; } } else EnsureNoteIsVisible(vc, bookIndex, iAnnotation, rootSite); // Now make the real (installed) selection in the desired field of the annotation. bool fIsResponse = (noteTag == ScrScriptureNote.ScrScriptureNoteTags.kflidResponses); selHelper = new SelectionHelper(); selHelper.NumberOfLevels = 4; selHelper.LevelInfo[0].tag = (int)StText.StTextTags.kflidParagraphs; selHelper.LevelInfo[0].ihvo = 0; selHelper.LevelInfo[1].tag = (int)noteTag; selHelper.LevelInfo[1].ihvo = iResponse; selHelper.LevelInfo[1].cpropPrevious = (fIsResponse ? 0 : 1); selHelper.LevelInfo[2].tag = vc.NotesSequenceHandler.Tag; selHelper.LevelInfo[2].ihvo = iAnnotation; selHelper.LevelInfo[3].tag = (int)Scripture.ScriptureTags.kflidBookAnnotations; selHelper.LevelInfo[3].ihvo = bookIndex; selHelper.IchAnchor = 0; selHelper.AssocPrev = false; selHelper.SetSelection(rootSite, true, true); }
/// -------------------------------------------------------------------------------- /// <summary> /// Makes a selection in the discussion of an annotation after first scrolling the /// annotation to near the top of the view. /// </summary> /// <param name="vc">The notes view constructor</param> /// <param name="bookIndex">Index of the book.</param> /// <param name="iAnnotation">Index of the annotation.</param> /// <param name="rootSite">The root site.</param> /// <param name="fNoteIsExpanded">if <c>true</c> make a selection at the start and end so /// that the whole annotation can be scrolled into view. if set to <c>false</c> only /// make a selection at the start of the annotation.</param> /// -------------------------------------------------------------------------------- internal void MakeSelectionInNote(TeNotesVc vc, int bookIndex, int iAnnotation, IVwRootSite rootSite, bool fNoteIsExpanded) { MakeSelectionInNote(vc, true, bookIndex, iAnnotation, 0, ScrScriptureNote.ScrScriptureNoteTags.kflidDiscussion, rootSite, fNoteIsExpanded); }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// <param name="disposing"></param> /// ------------------------------------------------------------------------------------ protected override void Dispose(bool disposing) { if (IsDisposed) return; base.Dispose (disposing); if (disposing) { if (m_vc != null) m_vc.Dispose(); } m_vc = null; m_baseInfoBarCaption = null; m_scr = null; m_UserView = null; }