示例#1
0
        private void btnHighlightAll_Click(object sender, EventArgs e)
        {
            if (!_highlightGroups.ContainsKey(_editor))
                _highlightGroups[_editor] = new HighlightGroup(_editor);
            HighlightGroup group = _highlightGroups[_editor];

            if (string.IsNullOrEmpty(LookFor))
                // Clear highlights
                group.ClearMarkers();
            else
            {
                Editor.SearchEngine.SearchRequest.SearchPattern = txtLookFor.Text;
                Editor.SearchEngine.SearchRequest.CaseSensitive = chkMatchCase.Active;
                Editor.SearchEngine.SearchRequest.WholeWordOnly = chkMatchWholeWord.Active;

                int offset = 0, count = 0;
                for (;;)
                {
                    SearchResult range = Editor.SearchEngine.SearchForward(offset);
                    if (range == null || range.SearchWrapped)
                        break;
                    offset = range.Offset + range.Length;
                    count++;

                    HighlightSegmentMarker m = new HighlightSegmentMarker(range.Offset, range.Length);
                    group.AddMarker(m);
                }
                if (count == 0)
                    ShowMsg("Search text not found.");
                else
                    window1.Hide();
            }
        }
示例#2
0
 public void AddMarker(HighlightSegmentMarker marker)
 {
     _markers.Add(marker);
     _document.AddMarker(marker);
 }
示例#3
0
 public void AddMarker(HighlightSegmentMarker marker)
 {
     _markers.Add(marker);
     _document.AddMarker(marker);
 }