Beispiel #1
0
			public MarkerToDraw(TextMarker marker, RectangleF drawingRect) {
				this.marker = marker;
				this.drawingRect = drawingRect;
			}
Beispiel #2
0
		void DrawMarker(Graphics g, TextMarker marker, RectangleF drawingRect) {
			// draw markers later so they can overdraw the following text
			markersToDraw.Add(new MarkerToDraw(marker, drawingRect));
		}
Beispiel #3
0
		public void ClearScanRegion() {
			if (_region != null) {
				_document.MarkerStrategy.RemoveMarker(_region);
				_region = null;
			}
		}
Beispiel #4
0
		public void AddMarker(TextMarker marker) {
			_markers.Add(marker);
			_document.MarkerStrategy.AddMarker(marker);
		}
Beispiel #5
0
		/// <summary>Sets the region to search. The region is updated 
		/// automatically as the document changes.</summary>
		public void SetScanRegion(int offset, int length) {
			var bkgColor = _document.HighlightingStrategy.GetColorFor("Default").BackgroundColor;
			_region = new TextMarker(offset, length, TextMarkerType.SolidBlock,
				bkgColor.HalfMix(Color.FromArgb(160, 160, 160)));
			_document.MarkerStrategy.AddMarker(_region);
		}
Beispiel #6
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 {
				_search.LookFor = txtLookFor.Text;
				_search.MatchCase = chkMatchCase.Checked;
				_search.MatchWholeWordOnly = chkMatchWholeWord.Checked;

				bool looped = false;
				int offset = 0, count = 0;
				for (; ; ) {
					TextRange range = _search.FindNext(offset, false, out looped);
					if (range == null || looped)
						break;
					offset = range.Offset + range.Length;
					count++;

					var m = new TextMarker(range.Offset, range.Length,
							TextMarkerType.SolidBlock, Color.Yellow, Color.Black);
					group.AddMarker(m);
				}
				if (count == 0)
					MessageBox.Show("Search text not found.");
				else
					Close();
			}
		}
Beispiel #7
0
		public void RemoveMarker(TextMarker item)
		{
			markersTable.Clear();
			textMarker.Remove(item);
		}
Beispiel #8
0
		public void InsertMarker(int index, TextMarker item)
		{
			markersTable.Clear();
			textMarker.Insert(index, item);
		}
Beispiel #9
0
		public void AddMarker(TextMarker item)
		{
			markersTable.Clear();
			textMarker.Add(item);
		}