Inheritance: ISegment
		public void TransformLine(TextView textView, DrawingContext drawingContext, VisualLine line)
		{
			if (!string.IsNullOrEmpty(SelectedWord) && line.RenderedText.Text.Contains(SelectedWord))
			{
				var startIndex = 0;

				while (startIndex != -1)
				{
					startIndex = line.RenderedText.Text.IndexOf(SelectedWord, startIndex);

					if (startIndex != -1)
					{
						var rect =
							VisualLineGeometryBuilder.GetRectsForSegment(textView,
								new TextSegment
								{
									StartOffset = startIndex + line.Offset,
									EndOffset = startIndex + line.Offset + SelectedWord.Length
								}).First();

						drawingContext.FillRectangle(highlightBrush, rect);

						startIndex += SelectedWord.Length;
					}
				}
			}
		}
        public void TransformLine(TextView textView, VisualLine line)
		{
            if (line.RenderedText.Text.Contains("#include") && !line.RenderedText.Text.Trim().StartsWith("//"))
            {
                var startIndex = line.RenderedText.Text.IndexOf("#include");

                line.RenderedText.SetForegroundBrush(pragmaBrush, startIndex, 8);
                line.RenderedText.SetForegroundBrush(brush, startIndex + 9, line.RenderedText.Text.Length - startIndex);
            }
        }
		public void TransformLine(TextView textView, VisualLine line)
		{
			var transformsInLine = TextTransformations.FindOverlappingSegments(line);

			foreach (var transform in transformsInLine)
			{
				var formattedOffset = 0;

				if (transform.StartOffset > line.Offset)
				{
					formattedOffset = transform.StartOffset - line.Offset;
				}

				line.RenderedText.SetForegroundBrush(transform.Foreground, formattedOffset, transform.Length);
			}
		}
		public void TransformLine(TextView textView, DrawingContext drawingContext, VisualLine line)
		{
			if (markers == null)
			{
				return;
			}

			var markersInLine = markers.FindOverlappingSegments(line);

			foreach (var marker in markersInLine)
			{
				if (marker.EndOffset < textView.TextDocument.TextLength)
				{
					foreach (var r in VisualLineGeometryBuilder.GetRectsForSegment(textView, marker))
					{
						var startPoint = r.BottomLeft;
						var endPoint = r.BottomRight;

						var usedPen = new Pen(new SolidColorBrush(marker.MarkerColor), 1);

						const double offset = 2.5;

						var count = Math.Max((int) ((endPoint.X - startPoint.X)/offset) + 1, 4);

						var geometry = new StreamGeometry();

						using (var ctx = geometry.Open())
						{
							ctx.BeginFigure(startPoint, false);

							foreach (var point in CreatePoints(startPoint, endPoint, offset, count))
							{
								ctx.LineTo(point);
							}

							ctx.EndFigure(false);
						}

						drawingContext.DrawGeometry(Brushes.Transparent, usedPen, geometry);
						break;
					}
				}
			}
		}
        public void TransformLine(TextView textView, VisualLine line)
		{
            if (!line.RenderedText.Text.Trim().StartsWith("//"))
            {
                if (line.RenderedText.Text.Contains("#pragma mark"))
                {
                    var startIndex = line.RenderedText.Text.IndexOf("#pragma mark");

                    line.RenderedText.SetForegroundBrush(pragmaBrush, startIndex, 12);
                    line.RenderedText.SetForegroundBrush(brush, startIndex + 12, line.RenderedText.Text.Length - 12);
                }
                else if (line.RenderedText.Text.Contains("#pragma"))
                {
                    var startIndex = line.RenderedText.Text.IndexOf("#pragma");

                    line.RenderedText.SetForegroundBrush(pragmaBrush, startIndex, 7);
                }
            }
		}
        public void TransformLine(TextView textView, VisualLine line)
        {
            var trimmed = line.RenderedText.Text.Trim();

            if (trimmed.StartsWith("#") && !trimmed.StartsWith("#include"))
            {
                var startIndex = line.RenderedText.Text.IndexOf("#");

                var firstEndOffset = line.RenderedText.Text.IndexOf(" ", startIndex);

                line.RenderedText.SetForegroundBrush(pragmaBrush, startIndex, firstEndOffset - startIndex);

                //var lastWordOffset = firstEndOffset != -1 ? line.RenderedText.Text.LastIndexOf(" ", firstEndOffset) + 1 : -1;

                //if (lastWordOffset != -1)
                //{
                //    line.RenderedText.SetForegroundBrush(brush, lastWordOffset, line.RenderedText.Text.Length - lastWordOffset);
                //}
            }
        }
		public void TransformLine(TextView textView, DrawingContext drawingContext, VisualLine line)
		{
		}
示例#8
0
 private void RenderText(DrawingContext context, VisualLine line)
 {
     context.DrawText(Foreground, new Point(TextSurfaceBounds.X, line.VisualLineNumber * CharSize.Height), line.RenderedText);
 }
示例#9
0
 private void RenderTextDecoration(DrawingContext context, VisualLine line)
 {
 }