Beispiel #1
0
        private void EmitPropChanged()
        {
            if (RootBox == null)
            {
                return;
            }
            var canns = Decorator.get_VecSize(HvoRoot, OccurenceListId);

            RootBox.PropChanged(HvoRoot, OccurenceListId, 0, canns, canns);             // Pretend all are replaced
        }
Beispiel #2
0
        /// <summary>
        /// Replaces cached ribbon words with input wordforms.
        /// Handles PropChanged, as UOW won't emit PropChanged to private Ribbon Decorator items.
        /// </summary>
        /// <param name="wordForms"></param>
        public void CacheRibbonItems(List <AnalysisOccurrence> wordForms)
        {
            var cwords   = wordForms.Count;
            var fragList = new LocatedAnalysisOccurrence[cwords];

            for (var i = 0; i < cwords; i++)
            {
                var word      = wordForms[i];
                var begOffset = word.GetMyBeginOffsetInPara();
                fragList[i] = new LocatedAnalysisOccurrence(word.Segment, word.Index, begOffset);
            }
            var oldLim = Decorator.get_VecSize(HvoRoot, OccurenceListId);

            Debug.Assert((Decorator as InterlinRibbonDecorator) != null, "No ribbon decorator!");
            ((InterlinRibbonDecorator)Decorator).CacheRibbonItems(fragList);
            if (RootBox != null)
            {
                RootBox.PropChanged(HvoRoot, OccurenceListId, 0, cwords, oldLim);
            }
        }
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Updates the highlighted note to be the specified note.
        /// </summary>
        /// <param name="ann">The note to highlight.</param>
        /// ------------------------------------------------------------------------------------
        private void UpdateNoteHighlight(IScrScriptureNote ann)
        {
            if (ann == null || m_prevHightlightedNote == ann || m_suspendHighlightChange)
            {
                return;
            }

            SelectionHelper sel = EditingHelper.CurrentSelection;

            // Only selection that can get updated is a re-install of a previous selection so
            // don't bother with any selection update handling.
            m_ignoreSelChanged = true;
            try
            {
                // Need to user real object index when doing a prop change - the GetDisplayIndex method on the filter will change
                // this to the filtered index.
                m_vc.SelectedNoteHvo = ann.Hvo;
                if (m_prevHightlightedNote != null && m_prevHightlightedNote.IsValidObject)
                {
                    int ownerHvo = m_prevHightlightedNote.Owner.Hvo;
                    RootBox.PropChanged(ownerHvo, ScrBookAnnotationsTags.kflidNotes, m_prevHightlightedNote.IndexInOwner, 1, 1);
                }

                RootBox.PropChanged(ann.Owner.Hvo, ScrBookAnnotationsTags.kflidNotes, ann.IndexInOwner, 1, 1);

                m_prevHightlightedNote = ann;

                if (sel != null)
                {
                    sel.SetSelection(false);                     // restore selection taken from PropChange
                }
            }
            finally
            {
                m_ignoreSelChanged = false;
            }
        }