Browse Source

Simplify CurrentLineHighlightRenderer.

pull/331/head
Daniel Grunwald 12 years ago
parent
commit
6441d7432a
  1. 19
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/CurrentLineHighlightRenderer.cs
  2. 2
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/TextView.cs
  3. 2
      src/Main/Base/Project/Editor/ContextActions/ContextActionViewModel.cs

19
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/CurrentLineHighlightRenderer.cs

@ -2,12 +2,9 @@ @@ -2,12 +2,9 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Windows;
using System.Windows.Media;
using ICSharpCode.AvalonEdit.Document;
using ICSharpCode.AvalonEdit.Rendering;
namespace ICSharpCode.AvalonEdit.Rendering
@ -75,24 +72,12 @@ namespace ICSharpCode.AvalonEdit.Rendering @@ -75,24 +72,12 @@ namespace ICSharpCode.AvalonEdit.Rendering
BackgroundGeometryBuilder builder = new BackgroundGeometryBuilder();
builder.CornerRadius = 1;
builder.AlignToMiddleOfPixels = true;
var visualLine = this.textView.GetVisualLine(line);
if (visualLine == null) return;
var textViewPos = visualLine.GetTextViewPosition(0);
if(textViewPos == null) return;
var position = this.textView.GetVisualPosition(textViewPos, VisualYPosition.LineTop);
if(position == null) return;
var lineWidth = this.textView.ActualWidth;
var lineHeigth = visualLine.Height;
var linePosX = position.X;
var linePosY = position.Y - this.textView.ScrollOffset.Y;
var linePosY = visualLine.VisualTop - this.textView.ScrollOffset.Y;
builder.AddRectangle(textView, new Rect(linePosX, linePosY, lineWidth, lineHeigth));
builder.AddRectangle(textView, new Rect(0, linePosY, textView.ActualWidth, visualLine.Height));
Geometry geometry = builder.CreateGeometry();
if (geometry != null) {

2
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/TextView.cs

@ -2074,7 +2074,7 @@ namespace ICSharpCode.AvalonEdit.Rendering @@ -2074,7 +2074,7 @@ namespace ICSharpCode.AvalonEdit.Rendering
/// <summary>
/// Gets/Sets highlighted line number.
/// </summary>
internal int HighlightedLine { // TODO: move this logic out of the TextView
public int HighlightedLine {
get { return this.currentLineHighlighRenderer.Line; }
set { this.currentLineHighlighRenderer.Line = value; }
}

2
src/Main/Base/Project/Editor/ContextActions/ContextActionViewModel.cs

@ -77,7 +77,7 @@ namespace ICSharpCode.SharpDevelop.Editor.ContextActions @@ -77,7 +77,7 @@ namespace ICSharpCode.SharpDevelop.Editor.ContextActions
}
/// <summary>
/// Just wraps <see cref="IContextAction"></see> inside a WPF Command to be used in XAML.
/// Just wraps <see cref="IContextAction"/> inside a WPF Command to be used in XAML.
/// </summary>
public class ContextActionCommand : ICommand
{

Loading…
Cancel
Save