Beispiel #1
0
        /// <summary>
        /// Any selection that involves an IAnalysis should be expanded to complete IAnalysis objects.
        /// This method also updates a list of selected AnalysisOccurrences.
        /// </summary>
        /// <param name="prootb"></param>
        /// <param name="vwselNew"></param>
        protected override void HandleSelectionChange(IVwRootBox prootb, IVwSelection vwselNew)
        {
            if (m_fInSelChanged)
            {
                return;
            }
            m_fInSelChanged = true;
            try
            {
                m_selectedWordforms = null;
                base.HandleSelectionChange(prootb, vwselNew);
                if (vwselNew == null)
                {
                    return;
                }

                SelLevInfo[] analysisLevels;
                SelLevInfo[] endLevels;
                if (TryGetAnalysisLevelsAndEndLevels(vwselNew, out analysisLevels, out endLevels))
                {
                    m_selectedWordforms = GetSelectedOccurrences(analysisLevels, endLevels[0].ihvo);
                    RootBox.MakeTextSelInObj(0, analysisLevels.Length, analysisLevels, endLevels.Length, endLevels, false, false,
                                             false, true, true);
                }
                else
                {
                    RootBox.DestroySelection();
                }
            }
            finally
            {
                m_fInSelChanged = false;
            }
        }
Beispiel #2
0
        /// ------------------------------------------------------------------------------------
        /// <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. It will also scroll the selection into view.
        /// Derived classes should implement this if they have any hope of supporting multi-
        /// paragraph editing.
        /// </summary>
        /// <param name="helper">The selection to restore</param>
        /// ------------------------------------------------------------------------------------
        public override void RequestVisibleSelectionAtEndOfUow(SelectionHelper helper)
        {
            Assert.IsNull(RequestedSelectionAtEndOfUow);

            RequestedSelectionAtEndOfUow = helper;

            RootBox.DestroySelection();             // Need to act like real program in this regard
        }
Beispiel #3
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Called when the focus leaves the control. We want to hide the selection.
        /// </summary>
        /// <param name="e">An <see cref="T:System.EventArgs"/> that contains the event data.</param>
        /// ------------------------------------------------------------------------------------
        protected override void OnLeave(EventArgs e)
        {
            base.OnLeave(e);

            if (RootBox != null)
            {
                RootBox.DestroySelection();
            }
        }
Beispiel #4
0
        /// --------------------------------------------------------------------------------
        /// <summary>
        /// In this simple implementation, we just record the information about the requested
        /// selection.
        /// </summary>
        /// <param name="rootb">The rootbox</param>
        /// <param name="ihvoRoot">Index of root element</param>
        /// <param name="cvlsi">count of levels</param>
        /// <param name="rgvsli">levels</param>
        /// <param name="tagTextProp">tag or flid of property containing the text (TsString)</param>
        /// <param name="cpropPrevious">number of previous occurrences of the text property</param>
        /// <param name="ich">character offset into the text</param>
        /// <param name="wsAlt">The id of the writing system for the selection.</param>
        /// <param name="fAssocPrev">Flag indicating whether to associate the insertion point
        /// with the preceding character or the following character</param>
        /// <param name="selProps">The selection properties.</param>
        /// --------------------------------------------------------------------------------
        public override void RequestSelectionAtEndOfUow(IVwRootBox rootb, int ihvoRoot,
                                                        int cvlsi, SelLevInfo[] rgvsli, int tagTextProp, int cpropPrevious, int ich, int wsAlt,
                                                        bool fAssocPrev, ITsTextProps selProps)
        {
            Assert.AreEqual(RootBox, rootb);
            Assert.IsNull(RequestedSelectionAtEndOfUow);

            RequestedSelectionAtEndOfUow                = new SelectionHelper();
            RequestedSelectionAtEndOfUow.RootSite       = this;
            RequestedSelectionAtEndOfUow.IhvoRoot       = ihvoRoot;
            RequestedSelectionAtEndOfUow.NumberOfLevels = cvlsi;
            RequestedSelectionAtEndOfUow.SetLevelInfo(SelectionHelper.SelLimitType.Anchor, rgvsli);
            RequestedSelectionAtEndOfUow.TextPropId            = tagTextProp;
            RequestedSelectionAtEndOfUow.NumberOfPreviousProps = cpropPrevious;
            RequestedSelectionAtEndOfUow.IchAnchor             = ich;
            RequestedSelectionAtEndOfUow.Ws        = wsAlt;
            RequestedSelectionAtEndOfUow.AssocPrev = fAssocPrev;

            RootBox.DestroySelection();             // Need to act like real program in this regard
        }