Browse Source
Add TextEditor.ShowLineNumbers property to show/hide the line numbers (they now are hidden by default). Add TextEditor.Options.ShowEndOfLine property to allow easily enabling end-of-line markers. Changed AbstractMargin so that it automatically detects the TextView it is attached to. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@4906 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
18 changed files with 246 additions and 83 deletions
@ -0,0 +1,49 @@ |
|||||||
|
// <file>
|
||||||
|
// <copyright see="prj:///doc/copyright.txt"/>
|
||||||
|
// <license see="prj:///doc/license.txt"/>
|
||||||
|
// <owner name="Daniel Grunwald"/>
|
||||||
|
// <version>$Revision$</version>
|
||||||
|
// </file>
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Windows; |
||||||
|
using System.Windows.Media; |
||||||
|
using System.Windows.Shapes; |
||||||
|
|
||||||
|
namespace ICSharpCode.AvalonEdit.Editing |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Margin for use with the text area.
|
||||||
|
/// A vertical dotted line to separate the line numbers from the text view.
|
||||||
|
/// </summary>
|
||||||
|
public static class DottedLineMargin |
||||||
|
{ |
||||||
|
static readonly object tag = new object(); |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a vertical dotted line to separate the line numbers from the text view.
|
||||||
|
/// </summary>
|
||||||
|
public static UIElement Create() |
||||||
|
{ |
||||||
|
return new Line { |
||||||
|
X1 = 0, Y1 = 0, X2 = 0, Y2 = 1, |
||||||
|
StrokeDashArray = { 0, 2 }, |
||||||
|
Stretch = Stretch.Fill, |
||||||
|
Stroke = Brushes.Gray, |
||||||
|
StrokeThickness = 1, |
||||||
|
StrokeDashCap = PenLineCap.Round, |
||||||
|
Margin = new Thickness(2, 0, 2, 0), |
||||||
|
Tag = tag |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets whether the specified UIElement is the result of a DottedLineMargin.Create call.
|
||||||
|
/// </summary>
|
||||||
|
public static bool IsDottedLineMargin(UIElement element) |
||||||
|
{ |
||||||
|
Line l = element as Line; |
||||||
|
return l != null && l.Tag == tag; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
Loading…
Reference in new issue