Esempio n. 1
0
        /// <summary>
        /// Clears all displayed hints
        /// </summary>
        public void Clear()
        {
            items.Clear();
            if (tb.Controls.Count != 0)
            {
                var toDelete = new List <Control>();
                foreach (Control item in tb.Controls)
                {
                    if (item is UnfocusablePanel)
                    {
                        toDelete.Add(item);
                    }
                }

                foreach (var item in toDelete)
                {
                    tb.Controls.Remove(item);
                }

                for (int i = 0; i < tb.LineInfos.Count; i++)
                {
                    var li = tb.LineInfos[i];
                    li.bottomPadding = 0;
                    tb.LineInfos[i]  = li;
                }
                tb.NeedRecalc();
                tb.Invalidate();
                tb.Select();
                tb.ActiveControl = null;
            }
        }
Esempio n. 2
0
        public override void Add(Bookmark bookmark)
        {
            foreach (var bm in items)
            {
                if (bm.LineIndex == bookmark.LineIndex)
                {
                    return;
                }
            }

            items.Add(bookmark);
            counter++;
            tb.Invalidate();
        }
Esempio n. 3
0
 public virtual void FindNext(string pattern)
 {
     try
     {
         RegexOptions opt = kcbMatchCase.Checked ? RegexOptions.None : RegexOptions.IgnoreCase;
         if (!kcbRegex.Checked)
         {
             pattern = Regex.Escape(pattern);
         }
         if (kcbMatchWholeWord.Checked)
         {
             pattern = "\\b" + pattern + "\\b";
         }
         //
         Range range = _textBox.Selection.Clone();
         range.Normalize();
         //
         if (_firstSearch)
         {
             _startPlace  = range.Start;
             _firstSearch = false;
         }
         //
         range.Start = range.End;
         if (range.Start >= _startPlace)
         {
             range.End = new Place(_textBox.GetLineLength(_textBox.LinesCount - 1), _textBox.LinesCount - 1);
         }
         else
         {
             range.End = _startPlace;
         }
         //
         foreach (var r in range.GetRangesByLines(pattern, opt))
         {
             _textBox.Selection = r;
             _textBox.DoSelectionVisible();
             _textBox.Invalidate();
             return;
         }
         //
         if (range.Start >= _startPlace && _startPlace > Place.Empty)
         {
             _textBox.Selection.Start = new Place(0, 0);
             FindNext(pattern);
             return;
         }
         KryptonMessageBoxExtended.Show("Not found");
     }
     catch (Exception ex)
     {
     }
 }