Browse Source

make colors of current statement marker customizable

pull/25/merge
Siegfried Pammer 13 years ago
parent
commit
74e0f42f76
  1. 14
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/HighlightingOptions.xaml.cs
  2. 22
      src/Main/Base/Project/Src/Services/Debugger/CurrentLineBookmark.cs

14
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/HighlightingOptions.xaml.cs

@ -415,6 +415,20 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
breakpointMarker = new CustomizedHighlightingItem(customizationList, breakpointMarker, language, canSetFont: false); breakpointMarker = new CustomizedHighlightingItem(customizationList, breakpointMarker, language, canSetFont: false);
breakpointMarker.PropertyChanged += item_PropertyChanged; breakpointMarker.PropertyChanged += item_PropertyChanged;
items.Add(breakpointMarker); items.Add(breakpointMarker);
IHighlightingItem currentStatementMarker = new SimpleHighlightingItem(
CurrentLineBookmark.Name,
ta => {
ta.Document.Text = "current statement line";
marker = textMarkerService.Create(0, ta.Document.TextLength);
})
{
Background = CurrentLineBookmark.DefaultBackground,
Foreground = CurrentLineBookmark.DefaultForeground
};
currentStatementMarker = new CustomizedHighlightingItem(customizationList, currentStatementMarker, language, canSetFont: false);
currentStatementMarker.PropertyChanged += item_PropertyChanged;
items.Add(currentStatementMarker);
} }
void item_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) void item_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)

22
src/Main/Base/Project/Src/Services/Debugger/CurrentLineBookmark.cs

@ -65,11 +65,14 @@ namespace ICSharpCode.SharpDevelop.Debugging
} }
public override bool CanToggle { public override bool CanToggle {
get { get { return false; }
return false;
}
} }
public const string Name = "Current statement";
public static readonly Color DefaultBackground = Colors.Yellow;
public static readonly Color DefaultForeground = Colors.Blue;
public override int ZOrder { public override int ZOrder {
get { return 100; } get { return 100; }
} }
@ -90,8 +93,17 @@ namespace ICSharpCode.SharpDevelop.Debugging
{ {
IDocumentLine line = this.Document.GetLine(startLine); IDocumentLine line = this.Document.GetLine(startLine);
ITextMarker marker = markerService.Create(line.Offset + startColumn - 1, Math.Max(endColumn - startColumn, 1)); ITextMarker marker = markerService.Create(line.Offset + startColumn - 1, Math.Max(endColumn - startColumn, 1));
marker.BackgroundColor = Colors.Yellow; ISyntaxHighlighter highlighter = this.Document.GetService(typeof(ISyntaxHighlighter)) as ISyntaxHighlighter;
marker.ForegroundColor = Colors.Blue; marker.BackgroundColor = DefaultBackground;
marker.ForegroundColor = DefaultForeground;
if (highlighter != null) {
var color = highlighter.GetNamedColor(Name);
if (color != null) {
marker.BackgroundColor = color.Background.GetColor(null);
marker.ForegroundColor = color.Foreground.GetColor(null);
}
}
return marker; return marker;
} }

Loading…
Cancel
Save