示例#1
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Expands the annotation if it isn't already.
 /// </summary>
 /// <param name="annHvo">The id of the annotation.</param>
 /// ------------------------------------------------------------------------------------
 internal void ExpandAnnotationIfNeeded(int annHvo)
 {
     if (!m_vc.IsExpanded(annHvo))
     {
         m_vc.ExpandItem(annHvo);
     }
 }
        /// -----------------------------------------------------------------------------------
        /// <summary>
        /// Call MouseUp on the rootbox
        /// </summary>
        /// -----------------------------------------------------------------------------------
        protected override void CallMouseUp(Point pt, Rectangle rcSrcRoot, Rectangle rcDstRoot)
        {
            IVwSelection      sel = m_rootb.MakeSelAt(pt.X, pt.Y, rcSrcRoot, rcDstRoot, false);
            IScrScriptureNote ann = CurrentAnnotation;

            int  noteTagToSelect         = ScrScriptureNoteTags.kflidDiscussion;
            bool fMakeSelInFirstResponse = false;

            if (sel != null && sel.SelType == VwSelType.kstPicture)
            {
                SelectionHelper selHelper = SelectionHelper.Create(sel, this);
                SelLevInfo[]    info      = selHelper.LevelInfo;

                if (info.Length >= 1 &&
                    info[0].tag == ScrScriptureNoteTags.kflidDiscussion ||
                    info[0].tag == ScrScriptureNoteTags.kflidRecommendation ||
                    m_fdoCache.ServiceLocator.ObjectRepository.GetClsid(info[0].hvo) == StJournalTextTags.kClassId)
                {
                    if (m_vc.ToggleItemExpansion(info[0].hvo, m_rootb))
                    {
                        // If the tag is not a valid tag, the assumption
                        // is we're expanding the responses.
                        fMakeSelInFirstResponse = (info[0].tag < 0);
                        noteTagToSelect         = info[0].tag;
                    }
                }
                else if (selHelper.GetTextPropId(SelectionHelper.SelLimitType.Anchor) ==
                         -(int)NotesFrags.kfrConnotCategory)                // This is not a real flid, just a unique number to match on.
                {
                    SetAnnotationCategory(ann);
                }
                else if (info.Length >= 2 && info[1].tag == kCurrentNotesTag)
                {
                    m_vc.ToggleItemExpansion(info[1].hvo, m_rootb);
                    m_ignoreSelChanged = true;
                }
            }

            m_suspendHighlightChange = true;
            try
            {
                base.CallMouseUp(pt, rcSrcRoot, rcDstRoot);
            }
            finally
            {
                m_ignoreSelChanged       = false;
                m_suspendHighlightChange = false;
            }

            UpdateNoteHighlight(ann);

            if (!m_pictureSelected)
            {
                return;
            }

            m_pictureSelected = false;

            if (ann == null)
            {
                return;
            }

            // Make a selection in the proper place in the annotation.
            int book = BCVRef.GetBookFromBcv(ann.BeginRef) - 1;
            IScrBookAnnotations annotations = m_scr.BookAnnotationsOS[book];
            int index = m_rootb.DataAccess.GetObjIndex(annotations.Hvo, ScrBookAnnotationsTags.kflidNotes, ann.Hvo);

            if (fMakeSelInFirstResponse)
            {
                NotesEditingHelper.MakeSelectionInNote(book, index, 0, ScrScriptureNoteTags.kflidResponses);
            }
            else if (m_vc.IsExpanded(ann.Hvo) &&
                     m_vc.IsExpanded(m_rootb.DataAccess.get_ObjectProp(ann.Hvo, noteTagToSelect)))
            {
                NotesEditingHelper.MakeSelectionInNote(m_vc, false, book,
                                                       index, 0, noteTagToSelect, this, true);
            }
            else
            {
                NotesEditingHelper.MakeSelectionInNoteRef(m_vc, book, index, this);
            }
        }