diff --git a/data/resources/StringResources.resx b/data/resources/StringResources.resx
index ea69c9c074..5d33f95b8a 100644
--- a/data/resources/StringResources.resx
+++ b/data/resources/StringResources.resx
@@ -2397,6 +2397,12 @@ system. I don't think that it needs translation.
M&ouse wheel zooming
+
+ Hide cursor while typing
+
+
+ Allow overstrike mode
+
Show &Quick ClassBrowser Panel
@@ -2425,9 +2431,12 @@ system. I don't think that it needs translation.
Highlight symbols
-
+
Highlight &matching bracket
+
+ Highlight current line
+
Show &horizontal ruler
@@ -6434,6 +6443,15 @@ Removed the end part of the original message ", reason '${Message}'" since this
Classes deriving from ${Name}
Title for search results for derived classes
+
+ Clipboard ring
+
+
+ Clipboard ring is empty
+
+
+ From clipboard ring
+
Convert to automatic property
@@ -6929,6 +6947,12 @@ The resources files have been renamed/moved accordingly.
ln ${Line} col ${Column} ch ${Character}
+
+ len ${Lenght}
+
+
+ len ${Rows} * ${Cols} (${Total})
+
Misc
diff --git a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/AvalonEdit.AddIn.addin b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/AvalonEdit.AddIn.addin
index 948128e530..6b5ad0be4a 100755
--- a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/AvalonEdit.AddIn.addin
+++ b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/AvalonEdit.AddIn.addin
@@ -42,6 +42,14 @@
class = "ICSharpCode.AvalonEdit.AddIn.TextMarkerToolTipProvider"/>
+
+
+
+
+
+
-
+
diff --git a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ContextActions/ContextActionsControl.xaml.cs b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ContextActions/ContextActionsControl.xaml.cs
index 082f2fa017..7539923201 100644
--- a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ContextActions/ContextActionsControl.xaml.cs
+++ b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ContextActions/ContextActionsControl.xaml.cs
@@ -35,6 +35,8 @@ namespace ICSharpCode.AvalonEdit.AddIn.ContextActions
}
public event EventHandler ActionExecuted;
+ public event RoutedEventHandler ActionSelected;
+ public event RoutedEventHandler ActionUnselected;
public new void Focus()
{
@@ -58,6 +60,18 @@ namespace ICSharpCode.AvalonEdit.AddIn.ContextActions
ActionExecuted(this, EventArgs.Empty);
}
+ void ActionGotFocus(object sender, RoutedEventArgs e)
+ {
+ if (ActionSelected != null)
+ ActionSelected(this, e);
+ }
+
+ void ActionLostFocus(object sender, RoutedEventArgs e)
+ {
+ if (ActionUnselected != null)
+ ActionUnselected(this, e);
+ }
+
public static readonly DependencyProperty ItemTemplateProperty =
DependencyProperty.Register("ItemTemplate", typeof(DataTemplate), typeof(ContextActionsControl),
new FrameworkPropertyMetadata());
diff --git a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ContextActions/ContextActionsHeaderedControl.xaml.cs b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ContextActions/ContextActionsHeaderedControl.xaml.cs
index 9116763d24..46b8ffafb1 100644
--- a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ContextActions/ContextActionsHeaderedControl.xaml.cs
+++ b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ContextActions/ContextActionsHeaderedControl.xaml.cs
@@ -17,6 +17,7 @@
// DEALINGS IN THE SOFTWARE.
using System;
+using System.Windows;
using System.Windows.Controls;
namespace ICSharpCode.AvalonEdit.AddIn.ContextActions
@@ -25,7 +26,7 @@ namespace ICSharpCode.AvalonEdit.AddIn.ContextActions
/// Interaction logic for ContextActionsHeaderedControl.xaml
///
public partial class ContextActionsHeaderedControl : UserControl
- {
+ {
public ContextActionsHeaderedControl()
{
InitializeComponent();
@@ -37,6 +38,18 @@ namespace ICSharpCode.AvalonEdit.AddIn.ContextActions
remove { this.ActionsTreeView.ActionExecuted -= value; }
}
+ public event RoutedEventHandler ActionSelected
+ {
+ add { this.ActionsTreeView.ActionSelected += value; }
+ remove { this.ActionsTreeView.ActionSelected -= value; }
+ }
+
+ public event RoutedEventHandler ActionUnselected
+ {
+ add { this.ActionsTreeView.ActionUnselected += value; }
+ remove { this.ActionsTreeView.ActionUnselected -= value; }
+ }
+
public new void Focus()
{
if (this.ActionsTreeView != null)
diff --git a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/BehaviorOptions.xaml b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/BehaviorOptions.xaml
index 44fb075db0..1fe606588a 100644
--- a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/BehaviorOptions.xaml
+++ b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/BehaviorOptions.xaml
@@ -33,6 +33,9 @@
+
diff --git a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/GeneralEditorOptions.xaml b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/GeneralEditorOptions.xaml
index 576ec15bef..6e78d32c41 100644
--- a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/GeneralEditorOptions.xaml
+++ b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/GeneralEditorOptions.xaml
@@ -27,6 +27,9 @@
+
diff --git a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/HighlightingOptions.xaml.cs b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/HighlightingOptions.xaml.cs
index 95f1ce2273..4ae1ee3efc 100644
--- a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/HighlightingOptions.xaml.cs
+++ b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/HighlightingOptions.xaml.cs
@@ -366,6 +366,21 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
bracketHighlight.PropertyChanged += item_PropertyChanged;
items.Add(bracketHighlight);
+ // Create entry for "Current Line highlight"
+ IHighlightingItem currentLineHighlight = new SimpleHighlightingItem(
+ CustomizingHighlighter.CurrentLineHighlighter,
+ ta => {
+ ta.Document.Text = "example text line";
+ ta.TextView.Options.HighlightCurrentLine = true;
+ })
+ {
+ Foreground = Color.FromArgb(52, 0, 255, 110),
+ Background = Color.FromArgb(22, 20, 220, 224)
+ };
+ currentLineHighlight = new CustomizedHighlightingItem(customizationList, currentLineHighlight, language, canSetFont: false);
+ currentLineHighlight.PropertyChanged += item_PropertyChanged;
+ items.Add(currentLineHighlight);
+
// Create entry for "Folding controls"
IHighlightingItem foldingControls = new SimpleHighlightingItem(
FoldingControls,
diff --git a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/TextViewOptions.xaml b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/TextViewOptions.xaml
index 1239bbcfd4..b7eb434149 100644
--- a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/TextViewOptions.xaml
+++ b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/TextViewOptions.xaml
@@ -20,7 +20,10 @@
Content="{core:Localize Dialog.Options.IDEOptions.TextEditor.Markers.UnderLineErrorsCheckBox}" />
+ Content="{core:Localize Dialog.Options.IDEOptions.TextEditor.Markers.HighlightBracketCheckBox}" />
+
diff --git a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/SyntaxHighlighting/CustomizingHighlighter.cs b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/SyntaxHighlighting/CustomizingHighlighter.cs
index 072ce4e3ca..0ababb9de6 100644
--- a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/SyntaxHighlighting/CustomizingHighlighter.cs
+++ b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/SyntaxHighlighting/CustomizingHighlighter.cs
@@ -44,6 +44,7 @@ namespace ICSharpCode.AvalonEdit.AddIn
public const string BreakpointMarker = "Breakpoint";
public const string InstructionPointerMarker = "Current statement";
public const string ColumnRuler = "Column ruler";
+ public const string CurrentLineHighlighter = "Current line highlighting";
public static void ApplyCustomizationsToDefaultElements(TextEditor textEditor, IEnumerable customizations)
{
@@ -57,6 +58,8 @@ namespace ICSharpCode.AvalonEdit.AddIn
textEditor.TextArea.TextView.ClearValue(TextView.LinkTextForegroundBrushProperty);
textEditor.TextArea.TextView.ClearValue(TextView.LinkTextBackgroundBrushProperty);
textEditor.TextArea.TextView.ClearValue(TextView.ColumnRulerPenProperty);
+ textEditor.TextArea.TextView.ClearValue(TextView.CurrentLineBorderProperty);
+ textEditor.TextArea.TextView.ClearValue(TextView.CurrentLineBackgroundProperty);
// 'assigned' flags are used so that the first matching customization wins.
// This is necessary because more specific customizations come first in the list
@@ -67,6 +70,7 @@ namespace ICSharpCode.AvalonEdit.AddIn
bool assignedLineNumbers = false;
bool assignedLinkText = false;
bool assignedColumnRulerColor = false;
+ bool assignedCurrentLineHighlighter = false;
foreach (CustomizedHighlightingColor color in customizations) {
switch (color.Name) {
@@ -130,6 +134,15 @@ namespace ICSharpCode.AvalonEdit.AddIn
if (color.Foreground != null)
textEditor.TextArea.TextView.ColumnRulerPen = CreateFrozenPen(color.Foreground.Value);
break;
+ case CurrentLineHighlighter:
+ if (assignedCurrentLineHighlighter)
+ continue;
+ assignedCurrentLineHighlighter = true;
+ if (color.Background != null)
+ textEditor.TextArea.TextView.CurrentLineBackground = CreateFrozenBrush(color.Background.Value);
+ if (color.Foreground != null)
+ textEditor.TextArea.TextView.CurrentLineBorder = CreateFrozenPen(color.Foreground.Value);
+ break;
}
}
}
diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/Caret.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/Caret.cs
index ed0747c82c..193750a7cd 100644
--- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/Caret.cs
+++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/Caret.cs
@@ -47,7 +47,7 @@ namespace ICSharpCode.AvalonEdit.Editing
this.textView = textArea.TextView;
position = new TextViewPosition(1, 1, 0);
- caretAdorner = new CaretLayer(textView);
+ caretAdorner = new CaretLayer(textArea);
textView.InsertLayer(caretAdorner, KnownLayer.Caret, LayerInsertionPosition.Replace);
textView.VisualLinesChanged += TextView_VisualLinesChanged;
textView.ScrollOffsetChanged += TextView_ScrollOffsetChanged;
@@ -382,6 +382,29 @@ namespace ICSharpCode.AvalonEdit.Editing
lineBottom - lineTop);
}
+ Rect CalcCaretOverstrikeRectangle(VisualLine visualLine)
+ {
+ if (!visualColumnValid) {
+ RevalidateVisualColumn(visualLine);
+ }
+
+ TextLine textLine = visualLine.GetTextLine(position.VisualColumn, position.IsAtEndOfLine);
+ double xPos = visualLine.GetTextLineVisualXPosition(textLine, position.VisualColumn);
+ double lineTop = visualLine.GetTextLineVisualYPosition(textLine, VisualYPosition.TextTop);
+ double lineBottom = visualLine.GetTextLineVisualYPosition(textLine, VisualYPosition.TextBottom);
+
+ int currentPos = position.VisualColumn;
+ int nextPos = visualLine.GetNextCaretPosition(currentPos, LogicalDirection.Forward, CaretPositioningMode.Normal, true);
+ double charSize = Math.Abs(
+ visualLine.GetTextLineVisualXPosition(textLine, currentPos) -
+ visualLine.GetTextLineVisualXPosition(textLine, nextPos) );
+
+ return new Rect(xPos,
+ lineTop,
+ charSize,
+ lineBottom - lineTop);
+ }
+
///
/// Returns the caret rectangle. The coordinate system is in device-independent pixels from the top of the document.
///
@@ -389,7 +412,8 @@ namespace ICSharpCode.AvalonEdit.Editing
{
if (textView != null && textView.Document != null) {
VisualLine visualLine = textView.GetOrConstructVisualLine(textView.Document.GetLineByNumber(position.Line));
- return CalcCaretRectangle(visualLine);
+ return (this.textView.Options.AllowOverstrikeMode && this.textArea.OverstrikeMode)
+ ? CalcCaretOverstrikeRectangle(visualLine) : CalcCaretRectangle(visualLine);
} else {
return Rect.Empty;
}
@@ -444,7 +468,12 @@ namespace ICSharpCode.AvalonEdit.Editing
if (caretAdorner != null && textView != null) {
VisualLine visualLine = textView.GetVisualLine(position.Line);
if (visualLine != null) {
- Rect caretRect = CalcCaretRectangle(visualLine);
+ Rect caretRect;
+ if (this.textView.Options.AllowOverstrikeMode && this.textArea.OverstrikeMode) {
+ caretRect = CalcCaretOverstrikeRectangle(visualLine);
+ } else {
+ caretRect = CalcCaretRectangle(visualLine);
+ }
// Create Win32 caret so that Windows knows where our managed caret is. This is necessary for
// features like 'Follow text editing' in the Windows Magnifier.
if (!hasWin32Caret) {
diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/CaretLayer.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/CaretLayer.cs
index 5d662dbf60..709f8bead1 100644
--- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/CaretLayer.cs
+++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/CaretLayer.cs
@@ -30,14 +30,17 @@ namespace ICSharpCode.AvalonEdit.Editing
{
sealed class CaretLayer : Layer
{
+ TextArea textArea;
+
bool isVisible;
Rect caretRectangle;
DispatcherTimer caretBlinkTimer = new DispatcherTimer();
bool blink;
- public CaretLayer(TextView textView) : base(textView, KnownLayer.Caret)
+ public CaretLayer(TextArea textArea) : base(textArea.TextView, KnownLayer.Caret)
{
+ this.textArea = textArea;
this.IsHitTestVisible = false;
caretBlinkTimer.Tick += new EventHandler(caretBlinkTimer_Tick);
}
@@ -90,6 +93,16 @@ namespace ICSharpCode.AvalonEdit.Editing
Brush caretBrush = this.CaretBrush;
if (caretBrush == null)
caretBrush = (Brush)textView.GetValue(TextBlock.ForegroundProperty);
+
+ if (this.textArea.Options.AllowOverstrikeMode && this.textArea.OverstrikeMode) {
+ SolidColorBrush scBrush = caretBrush as SolidColorBrush;
+ if (scBrush != null) {
+ Color brushColor = scBrush.Color;
+ Color newColor = Color.FromArgb(100, brushColor.R, brushColor.G, brushColor.B);
+ caretBrush = new SolidColorBrush(newColor);
+ }
+ }
+
Rect r = new Rect(caretRectangle.X - textView.HorizontalOffset,
caretRectangle.Y - textView.VerticalOffset,
caretRectangle.Width,
diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/TextArea.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/TextArea.cs
index 386f2268ef..de820862df 100644
--- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/TextArea.cs
+++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/TextArea.cs
@@ -84,6 +84,8 @@ namespace ICSharpCode.AvalonEdit.Editing
caret = new Caret(this);
caret.PositionChanged += (sender, e) => RequestSelectionValidation();
+ caret.PositionChanged += CaretPositionChanged;
+ AttachTypingEvents();
ime = new ImeSupport(this);
leftMargins.CollectionChanged += leftMargins_CollectionChanged;
@@ -574,6 +576,14 @@ namespace ICSharpCode.AvalonEdit.Editing
get { return caret; }
}
+ void CaretPositionChanged(object sender, EventArgs e)
+ {
+ if (textView == null)
+ return;
+
+ this.textView.HighlightedLine = this.Caret.Line;
+ }
+
ObservableCollection leftMargins = new ObservableCollection();
///
@@ -871,8 +881,11 @@ namespace ICSharpCode.AvalonEdit.Editing
if (!e.Handled) {
if (e.Text == "\n" || e.Text == "\r" || e.Text == "\r\n")
ReplaceSelectionWithNewLine();
- else
+ else {
+ if (overstrikeMode && Selection.IsEmpty && Document.GetLineByNumber(Caret.Line).EndOffset > Caret.Offset)
+ Selection = Selection.Create(this, Caret.Offset, Caret.Offset+e.Text.Length);
ReplaceSelectionWithText(e.Text);
+ }
OnTextEntered(e);
caret.BringCaretToView();
}
@@ -957,6 +970,17 @@ namespace ICSharpCode.AvalonEdit.Editing
protected override void OnPreviewKeyDown(KeyEventArgs e)
{
base.OnPreviewKeyDown(e);
+
+ if (!this.Options.AllowOverstrikeMode) {
+ this.overstrikeMode = false;
+ } else if (!e.Handled && e.Key == Key.Insert) {
+ this.overstrikeMode = !this.overstrikeMode;
+ this.caret.Show();
+ e.Handled = true;
+ return;
+ }
+
+ HideMouseCursor();
foreach (TextAreaStackedInputHandler h in stackedInputHandlers) {
if (e.Handled)
break;
@@ -980,6 +1004,7 @@ namespace ICSharpCode.AvalonEdit.Editing
protected override void OnKeyDown(KeyEventArgs e)
{
base.OnKeyDown(e);
+ HideMouseCursor();
TextView.InvalidateCursorIfMouseWithinTextView();
}
@@ -991,6 +1016,46 @@ namespace ICSharpCode.AvalonEdit.Editing
}
#endregion
+ #region Hide Mouse Cursor While Typing
+
+ bool isMouseCursorHidden;
+
+ void AttachTypingEvents() {
+ this.MouseEnter += delegate { ShowMouseCursor(); };
+ this.MouseLeave += delegate { ShowMouseCursor(); };
+ this.MouseMove += delegate { ShowMouseCursor(); };
+ this.TouchEnter += delegate { ShowMouseCursor(); };
+ this.TouchLeave += delegate { ShowMouseCursor(); };
+ this.TouchMove += delegate { ShowMouseCursor(); };
+ }
+
+ void ShowMouseCursor() {
+ if (this.isMouseCursorHidden) {
+ System.Windows.Forms.Cursor.Show();
+ this.isMouseCursorHidden = false;
+ }
+ }
+
+ void HideMouseCursor() {
+ if (Options.HideCursorWhileTyping && !this.isMouseCursorHidden && this.IsMouseOver) {
+ this.isMouseCursorHidden = true;
+ System.Windows.Forms.Cursor.Hide();
+ }
+ }
+
+ #endregion
+
+ #region Overstrike mode
+
+ bool overstrikeMode = false;
+
+ public bool OverstrikeMode
+ {
+ get { return this.overstrikeMode; }
+ }
+
+ #endregion
+
///
protected override HitTestResult HitTestCore(PointHitTestParameters hitTestParameters)
{
diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj
index bd58cf2a60..ff6cf09d56 100644
--- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj
+++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj
@@ -245,6 +245,7 @@
IVisualLineTransformer.cs
+
IVisualLineTransformer.cs
diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/CurrentLineHighlightRenderer.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/CurrentLineHighlightRenderer.cs
new file mode 100644
index 0000000000..c87fbbb845
--- /dev/null
+++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/CurrentLineHighlightRenderer.cs
@@ -0,0 +1,103 @@
+// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
+// 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
+{
+ sealed class CurrentLineHighlightRenderer : IBackgroundRenderer
+ {
+ #region Fields
+
+ int line;
+ TextView textView;
+
+ public static readonly Color DefaultBackground = Color.FromArgb(22, 20, 220, 224);
+ public static readonly Color DefaultBorder = Color.FromArgb(52, 0, 255, 110);
+
+ #endregion
+
+ #region Properties
+
+ public int Line {
+ get { return this.Line; }
+ set {
+ if (this.line != value) {
+ this.line = value;
+ this.textView.InvalidateLayer(this.Layer);
+ }
+ }
+ }
+
+ public KnownLayer Layer
+ {
+ get { return KnownLayer.Selection; }
+ }
+
+ public Brush BackgroundBrush {
+ get; set;
+ }
+
+ public Pen BorderPen {
+ get; set;
+ }
+
+ #endregion
+
+ public CurrentLineHighlightRenderer(TextView textView)
+ {
+ if (textView == null)
+ throw new ArgumentNullException("textView");
+
+ this.BorderPen = new Pen(new SolidColorBrush(DefaultBorder), 1);
+ this.BorderPen.Freeze();
+
+ this.BackgroundBrush = new SolidColorBrush(DefaultBackground);
+ this.BackgroundBrush.Freeze();
+
+ this.textView = textView;
+ this.textView.BackgroundRenderers.Add(this);
+
+ this.line = 0;
+ }
+
+ public void Draw(TextView textView, DrawingContext drawingContext)
+ {
+ if(!this.textView.Options.HighlightCurrentLine)
+ return;
+
+ 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;
+
+ builder.AddRectangle(textView, new Rect(linePosX, linePosY, lineWidth, lineHeigth));
+
+ Geometry geometry = builder.CreateGeometry();
+ if (geometry != null) {
+ drawingContext.DrawGeometry(this.BackgroundBrush, this.BorderPen, geometry);
+ }
+ }
+ }
+}
diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/TextView.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/TextView.cs
index 58e98fe3df..2871c38fe4 100644
--- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/TextView.cs
+++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/TextView.cs
@@ -57,6 +57,7 @@ namespace ICSharpCode.AvalonEdit.Rendering
}
ColumnRulerRenderer columnRulerRenderer;
+ CurrentLineHighlightRenderer currentLineHighlighRenderer;
///
/// Creates a new TextView instance.
@@ -69,6 +70,7 @@ namespace ICSharpCode.AvalonEdit.Rendering
lineTransformers = new ObserveAddRemoveCollection(LineTransformer_Added, LineTransformer_Removed);
backgroundRenderers = new ObserveAddRemoveCollection(BackgroundRenderer_Added, BackgroundRenderer_Removed);
columnRulerRenderer = new ColumnRulerRenderer(this);
+ currentLineHighlighRenderer = new CurrentLineHighlightRenderer(this);
this.Options = new TextEditorOptions();
Debug.Assert(singleCharacterElementGenerator != null); // assert that the option change created the builtin element generators
@@ -2009,6 +2011,12 @@ namespace ICSharpCode.AvalonEdit.Rendering
if (e.Property == ColumnRulerPenProperty) {
columnRulerRenderer.SetRuler(this.Options.ColumnRulerPosition, this.ColumnRulerPen);
}
+ if (e.Property == CurrentLineBorderProperty) {
+ currentLineHighlighRenderer.BorderPen = this.CurrentLineBorder;
+ }
+ if (e.Property == CurrentLineBackgroundProperty) {
+ currentLineHighlighRenderer.BackgroundBrush = this.CurrentLineBackground;
+ }
}
///
@@ -2034,5 +2042,41 @@ namespace ICSharpCode.AvalonEdit.Rendering
get { return (Pen)GetValue(ColumnRulerPenProperty); }
set { SetValue(ColumnRulerPenProperty, value); }
}
+
+ ///
+ /// The property.
+ ///
+ public static readonly DependencyProperty CurrentLineBackgroundProperty =
+ DependencyProperty.Register("CurrentLineBackground", typeof(Brush), typeof(TextView));
+
+ ///
+ /// Gets/Sets the background brush used by current line highlighter.
+ ///
+ public Brush CurrentLineBackground {
+ get { return (Brush)GetValue(CurrentLineBackgroundProperty); }
+ set { SetValue(CurrentLineBackgroundProperty, value); }
+ }
+
+ ///
+ /// The property.
+ ///
+ public static readonly DependencyProperty CurrentLineBorderProperty =
+ DependencyProperty.Register("CurrentLineBorder", typeof(Pen), typeof(TextView));
+
+ ///
+ /// Gets/Sets the background brush used for the current line.
+ ///
+ public Pen CurrentLineBorder {
+ get { return (Pen)GetValue(CurrentLineBorderProperty); }
+ set { SetValue(CurrentLineBorderProperty, value); }
+ }
+
+ ///
+ /// Gets/Sets highlighted line number.
+ ///
+ public int HighlightedLine {
+ get { return this.currentLineHighlighRenderer.Line; }
+ set { this.currentLineHighlighRenderer.Line = value; }
+ }
}
}
diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/TextEditorOptions.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/TextEditorOptions.cs
index 777852728e..23b550d663 100644
--- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/TextEditorOptions.cs
+++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/TextEditorOptions.cs
@@ -445,5 +445,53 @@ namespace ICSharpCode.AvalonEdit
}
}
}
+
+ bool highlightCurrentLine = false;
+
+ ///
+ /// Gets/Sets if current line should be shown.
+ ///
+ [DefaultValue(false)]
+ public virtual bool HighlightCurrentLine {
+ get { return highlightCurrentLine; }
+ set {
+ if (highlightCurrentLine != value) {
+ highlightCurrentLine = value;
+ OnPropertyChanged("HighlightCurrentLine");
+ }
+ }
+ }
+
+ bool hideCursorWhileTyping = true;
+
+ [DefaultValue(true)]
+ ///
+ /// Gets/Sets if mouse cursor should be shown when user is typing
+ ///
+ public bool HideCursorWhileTyping {
+ get { return hideCursorWhileTyping; }
+ set {
+ if (hideCursorWhileTyping != value) {
+ hideCursorWhileTyping = value;
+ OnPropertyChanged("HideCursorWhileTyping");
+ }
+ }
+ }
+
+ bool allowOverstrikeMode = false;
+
+ [DefaultValue(false)]
+ ///
+ /// Gets/Sets if overstrike mode is enabled to use
+ ///
+ public bool AllowOverstrikeMode {
+ get { return allowOverstrikeMode; }
+ set {
+ if (allowOverstrikeMode != value) {
+ allowOverstrikeMode = value;
+ OnPropertyChanged("AllowOverstrikeMode");
+ }
+ }
+ }
}
}
diff --git a/src/Main/Base/Project/Editor/ContextActions/ContextActionViewModel.cs b/src/Main/Base/Project/Editor/ContextActions/ContextActionViewModel.cs
index 4a7a6fa561..abc9857822 100644
--- a/src/Main/Base/Project/Editor/ContextActions/ContextActionViewModel.cs
+++ b/src/Main/Base/Project/Editor/ContextActions/ContextActionViewModel.cs
@@ -99,6 +99,11 @@ namespace ICSharpCode.SharpDevelop.Editor.ContextActions
remove { }
}
+ public IContextAction ContextAction
+ {
+ get { return action; }
+ }
+
public void Execute(object parameter)
{
if (action.Provider != null)
diff --git a/src/Main/Base/Project/Src/Gui/Components/SideBar/TextEditorSideBar.cs b/src/Main/Base/Project/Src/Gui/Components/SideBar/TextEditorSideBar.cs
index 9820dd3319..9e97fae0c5 100644
--- a/src/Main/Base/Project/Src/Gui/Components/SideBar/TextEditorSideBar.cs
+++ b/src/Main/Base/Project/Src/Gui/Components/SideBar/TextEditorSideBar.cs
@@ -17,6 +17,8 @@
// DEALINGS IN THE SOFTWARE.
using System;
+using System.Collections;
+using System.Collections.Generic;
using System.IO;
using System.Xml;
@@ -97,20 +99,55 @@ namespace ICSharpCode.SharpDevelop.Gui
this.ActiveTab = clipboardRing;
}
+ public List GetClipboardRingItems()
+ {
+ var list = new List();
+ if (clipboardRing == null || clipboardRing.Items == null)
+ return list;
+
+ foreach (var item in clipboardRing.Items) {
+ string itemData = item.Tag as string;
+ if (itemData != null)
+ list.Add(itemData);
+ }
+
+ return list;
+ }
+
public void PutInClipboardRing(string text)
{
if (clipboardRing != null) {
string shortenedText = text.Trim();
+ if (shortenedText == String.Empty)
+ return;
+
if (shortenedText.Length > 50)
shortenedText = shortenedText.Substring(0, 47) + "...";
- clipboardRing.Items.Add("Text:" + shortenedText, text);
+
+ RemoveFromClipboardRing(text);
+ clipboardRing.Items.Insert(0, shortenedText, text);
if (clipboardRing.Items.Count > 20) {
- clipboardRing.Items.RemoveAt(0);
+ clipboardRing.Items.RemoveAt(clipboardRing.Items.Count - 1);
}
}
Refresh();
}
+ void RemoveFromClipboardRing(string text)
+ {
+ int pos = 0;
+ foreach (var item in clipboardRing.Items) {
+ string itemData = item.Tag as string;
+ if(itemData != null && itemData.Equals(text))
+ break;
+ pos++;
+ }
+
+ if (pos < clipboardRing.Items.Count) {
+ clipboardRing.Items.RemoveAt(pos);
+ }
+ }
+
public void SaveSideBarViewConfig()
{
XmlDocument doc = new XmlDocument();
diff --git a/src/Main/Base/Project/Src/Services/StatusBar/StatusBarService.cs b/src/Main/Base/Project/Src/Services/StatusBar/StatusBarService.cs
index 6174b10d97..aafbd82332 100644
--- a/src/Main/Base/Project/Src/Services/StatusBar/StatusBarService.cs
+++ b/src/Main/Base/Project/Src/Services/StatusBar/StatusBarService.cs
@@ -40,6 +40,19 @@ namespace ICSharpCode.SharpDevelop.Gui
void SetCaretPosition(int x, int y, int charOffset);
//void SetInsertMode(bool insertMode);
+ ///
+ /// Sets the selection lenght in the status bar.
+ ///
+ /// selection lenght
+ void SetSelectionSingle(int lenght);
+
+ ///
+ /// Sets rect selection size in the status bar.
+ ///
+ /// vertical size of selecion
+ /// horizontal size of selection
+ void SetSelectionMulti(int rows, int cols);
+
///
/// Sets the message shown in the left-most pane in the status bar.
///
diff --git a/src/Main/SharpDevelop/Workbench/SDStatusBar.cs b/src/Main/SharpDevelop/Workbench/SDStatusBar.cs
index 32f0a299c7..d06a108ee1 100644
--- a/src/Main/SharpDevelop/Workbench/SDStatusBar.cs
+++ b/src/Main/SharpDevelop/Workbench/SDStatusBar.cs
@@ -38,6 +38,7 @@ namespace ICSharpCode.SharpDevelop.Workbench
StatusBarItem txtStatusBarPanel = new StatusBarItem();
StatusBarItem cursorStatusBarPanel = new StatusBarItem();
+ StatusBarItem selectionStatusBarPanel = new StatusBarItem();
StatusBarItem modeStatusBarPanel = new StatusBarItem();
public StatusBarItem CursorStatusBarPanel {
@@ -46,6 +47,12 @@ namespace ICSharpCode.SharpDevelop.Workbench
}
}
+ public StatusBarItem SelectionStatusBarPanel {
+ get {
+ return selectionStatusBarPanel;
+ }
+ }
+
public StatusBarItem ModeStatusBarPanel {
get {
return modeStatusBarPanel;
@@ -55,6 +62,7 @@ namespace ICSharpCode.SharpDevelop.Workbench
public SDStatusBar()
{
cursorStatusBarPanel.Width = 150;
+ selectionStatusBarPanel.Content = 50;
modeStatusBarPanel.Width = 25;
statusProgressBar.Minimum = 0;
@@ -67,11 +75,13 @@ namespace ICSharpCode.SharpDevelop.Workbench
statusProgressBarItem.HorizontalContentAlignment = HorizontalAlignment.Stretch;
DockPanel.SetDock(modeStatusBarPanel, Dock.Right);
+ DockPanel.SetDock(selectionStatusBarPanel, Dock.Right);
DockPanel.SetDock(cursorStatusBarPanel, Dock.Right);
DockPanel.SetDock(statusProgressBarItem, Dock.Right);
DockPanel.SetDock(jobNamePanel, Dock.Right);
Items.Add(modeStatusBarPanel);
+ Items.Add(selectionStatusBarPanel);
Items.Add(cursorStatusBarPanel);
Items.Add(statusProgressBarItem);
Items.Add(jobNamePanel);
diff --git a/src/Main/SharpDevelop/Workbench/StatusBarService.cs b/src/Main/SharpDevelop/Workbench/StatusBarService.cs
index 3f97cd8b7b..2bee45cda4 100644
--- a/src/Main/SharpDevelop/Workbench/StatusBarService.cs
+++ b/src/Main/SharpDevelop/Workbench/StatusBarService.cs
@@ -57,6 +57,30 @@ namespace ICSharpCode.SharpDevelop.Workbench
);
}
+ public void SetSelectionSingle(int lenght)
+ {
+ if (lenght > 0) {
+ statusBar.SelectionStatusBarPanel.Content = StringParser.Parse(
+ "${res:StatusBarService.SelectionStatusBarPanelTextSingle}",
+ new StringTagPair("Lenght", String.Format("{0,-10}", lenght)));
+ } else {
+ statusBar.SelectionStatusBarPanel.Content = null;
+ }
+ }
+
+ public void SetSelectionMulti(int rows, int cols)
+ {
+ if (rows > 0 && cols > 0) {
+ statusBar.SelectionStatusBarPanel.Content = StringParser.Parse(
+ "${res:StatusBarService.SelectionStatusBarPanelTextMulti}",
+ new StringTagPair("Rows", String.Format("{0}", rows)),
+ new StringTagPair("Cols", String.Format("{0}", cols)),
+ new StringTagPair("Total", String.Format("{0}", rows * cols)));
+ } else {
+ statusBar.SelectionStatusBarPanel.Content = null;
+ }
+ }
+
public void SetInsertMode(bool insertMode)
{
statusBar.ModeStatusBarPanel.Content = insertMode ? StringParser.Parse("${res:StatusBarService.CaretModes.Insert}") : StringParser.Parse("${res:StatusBarService.CaretModes.Overwrite}");