Exemple #1
0
        protected void MakeTextSelectionAndScrollToView(int ichMin, int ichLim, int ws, int ipara, int ihvoEnd)
        {
            var rgsli = new SelLevInfo[1];

            // entry 0 says which StTextPara
            rgsli[0].ihvo = ipara;
            rgsli[0].tag  = StTextTags.kflidParagraphs;
            // entry 1 says to use the Contents of the Text.
            //rgsli[1].tag = (int)FDO.Ling.Text.TextTags.kflidContents;
            try
            {
                RootBox.MakeTextSelection(0, rgsli.Length, rgsli,
                                          StTxtParaTags.kflidContents, 0, ichMin,
                                          ichLim, ws,
                                          false, // Range, arbitrary assoc prev.
                                          ihvoEnd,
                                          null,  // don't set any special text props for typing
                                          true); // install it
                // Don't steal the focus from another window.  See FWR-1795.
                if (ParentForm == Form.ActiveForm)
                {
                    Focus();
                }
                // Scroll this selection into View.
                var sel = RootBox.Selection;
                ScrollSelectionIntoView(sel, VwScrollSelOpts.kssoDefault);
                Update();
            }
            catch (Exception)
            {
            }
        }
Exemple #2
0
        /// <summary>
        /// Make a selection in the specified writing system at the specified character offset.
        /// </summary>
        public void SelectAt(int ws, int ich)
        {
            CheckDisposed();

            var cpropPrevious = 0;

            if (ws != m_rgws[0].Handle)
            {
                // According to the documentation on RootBox.MakeTextSelection, cpropPrevious
                // needs to be the index into the ws array that matches the ws to be selected.
                cpropPrevious = GetRightPositionInWsArray(ws);
                if (cpropPrevious < 0)
                {
                    Debug.Fail("InnerLabeledMultiStringView could not select correct ws");
                    cpropPrevious = 0;                     // safety net to keep from crashing outright.
                }
            }
            try
            {
                RootBox.MakeTextSelection(0, 0, null, m_flid, cpropPrevious, ich, ich, ws, true, -1, null, true);
            }
            catch (Exception)
            {
                Debug.Assert(false, "Unexpected failure to make selection in LabeledMultiStringView");
            }
        }
Exemple #3
0
 protected void MakeTextSelectionAndScrollToView(int ichMin, int ichLim, int ws, int ihvoPara, int ihvoEnd)
 {
     SelLevInfo[] rgsli = new SelLevInfo[1];
     // entry 0 says which StTextPara
     rgsli[0].ihvo = ihvoPara;
     rgsli[0].tag  = (int)StText.StTextTags.kflidParagraphs;
     // entry 1 says to use the Contents of the Text.
     //rgsli[1].tag = (int)FDO.Ling.Text.TextTags.kflidContents;
     try
     {
         RootBox.MakeTextSelection(0, rgsli.Length, rgsli,
                                   (int)StTxtPara.StTxtParaTags.kflidContents, 0, ichMin,
                                   ichLim, ws,
                                   false, // Range, arbitrary assoc prev.
                                   ihvoEnd,
                                   null,  // don't set any special text props for typing
                                   true); // install it
         Focus();
         // Scroll this selection into View.
         IVwSelection sel = this.RootBox.Selection;
         this.ScrollSelectionIntoView(sel, VwScrollSelOpts.kssoDefault);
         Update();
     }
     catch (Exception)
     {
     }
 }
Exemple #4
0
 /// <summary>
 /// Make a selection at the specified character offset.
 /// </summary>
 /// <param name="ich"></param>
 public void SelectAt(int ich)
 {
     CheckDisposed();
     try
     {
         RootBox.MakeTextSelection(0, 0, null, m_flid, 0, ich, ich, 0, true, -1, null, true);
     }
     catch
     {
     }
 }
Exemple #5
0
 private void SelectRightBoundary(object ctxt, int index, bool install)
 {
     SelLevInfo[] levels = m_patternControl.GetLevelInfo(ctxt, index);
     try
     {
         RootBox.MakeTextSelection(0, levels.Length, levels, PatternVcBase.ktagRightBoundary, 0, 1, 1,
                                   0, false, -1, null, install);
     }
     catch (Exception)
     {
     }
 }
Exemple #6
0
        private void SelectLeftBoundary(object ctxt, int index, bool install)
        {
            var levels = new List <SelLevInfo>(m_patternControl.GetLevelInfo(ctxt, index));

            try
            {
                RootBox.MakeTextSelection(0, levels.Count, levels.ToArray(), PatternVcBase.ktagLeftBoundary, 0, 0, 0,
                                          0, false, -1, null, install);
            }
            catch (Exception)
            {
            }
        }
Exemple #7
0
 /// <summary>
 /// Select at the specified position in the first paragraph.
 /// </summary>
 internal void SelectAt(int ich)
 {
     try
     {
         var vsli = new SelLevInfo[1];
         vsli[0].tag  = StTextTags.kflidParagraphs;
         vsli[0].ihvo = 0;
         RootBox.MakeTextSelection(0, 1, vsli, StTxtParaTags.kflidContents, 0, ich, ich, 0, true, -1, null, true);
     }
     catch (Exception)
     {
         Debug.Assert(false, "Unexpected failure to make selection in StTextView");
     }
 }
        /// <summary>
        /// Make a selection in the specified writing system at the specified character offset.
        /// Note: selecting other than the first writing system is not yet implemented.
        /// </summary>
        public void SelectAt(int ws, int ich)
        {
            CheckDisposed();

            Debug.Assert(ws == m_rgws[0].Handle);
            try
            {
                RootBox.MakeTextSelection(0, 0, null, m_flid, 0, ich, ich, ws, true, -1, null, true);
            }
            catch (Exception)
            {
                Debug.Assert(false, "Unexpected failure to make selection in LabeledMultiStringView");
            }
        }