Browse Source

Added setting to highlight the current line

pull/2224/head
Dick van den Brink 5 years ago
parent
commit
1c68cdc207
  1. 14
      ILSpy/Options/DisplaySettings.cs
  2. 1
      ILSpy/Options/DisplaySettingsPanel.xaml
  3. 2
      ILSpy/Options/DisplaySettingsPanel.xaml.cs
  4. 9
      ILSpy/Properties/Resources.Designer.cs
  5. 3
      ILSpy/Properties/Resources.resx
  6. 12
      ILSpy/TextView/DecompilerTextView.cs

14
ILSpy/Options/DisplaySettings.cs

@ -247,6 +247,19 @@ namespace ICSharpCode.ILSpy.Options @@ -247,6 +247,19 @@ namespace ICSharpCode.ILSpy.Options
}
}
bool highlightCurrentLine = false;
public bool HighlightCurrentLine {
get { return highlightCurrentLine; }
set {
if (highlightCurrentLine != value)
{
highlightCurrentLine = value;
OnPropertyChanged();
}
}
}
bool hideEmptyMetadataTables = true;
public bool HideEmptyMetadataTables {
@ -277,6 +290,7 @@ namespace ICSharpCode.ILSpy.Options @@ -277,6 +290,7 @@ namespace ICSharpCode.ILSpy.Options
this.IndentationTabSize = s.indentationTabSize;
this.IndentationSize = s.indentationSize;
this.HighlightMatchingBraces = s.highlightMatchingBraces;
this.HighlightCurrentLine = s.highlightCurrentLine;
this.HideEmptyMetadataTables = s.HideEmptyMetadataTables;
}
}

1
ILSpy/Options/DisplaySettingsPanel.xaml

@ -83,6 +83,7 @@ @@ -83,6 +83,7 @@
<CheckBox IsChecked="{Binding EnableWordWrap}" Content="{x:Static properties:Resources.EnableWordWrap}"></CheckBox>
<CheckBox IsChecked="{Binding FoldBraces}" Content="{x:Static properties:Resources.EnableFoldingBlocksBraces}"></CheckBox>
<CheckBox IsChecked="{Binding HighlightMatchingBraces}" Content="{x:Static properties:Resources.HighlightMatchingBraces}"></CheckBox>
<CheckBox IsChecked="{Binding HighlightCurrentLine}" Content="{x:Static properties:Resources.HighlightCurrentLine}"></CheckBox>
<CheckBox IsChecked="{Binding SortResults}" Content="{x:Static properties:Resources.SortResultsFitness}"></CheckBox>
<CheckBox IsChecked="{Binding ExpandMemberDefinitions}" Content="{x:Static properties:Resources.ExpandMemberDefinitionsAfterDecompilation}"></CheckBox>
<CheckBox IsChecked="{Binding ExpandUsingDeclarations}" Content="{x:Static properties:Resources.ExpandUsingDeclarationsAfterDecompilation}"></CheckBox>

2
ILSpy/Options/DisplaySettingsPanel.xaml.cs

@ -121,6 +121,7 @@ namespace ICSharpCode.ILSpy.Options @@ -121,6 +121,7 @@ namespace ICSharpCode.ILSpy.Options
s.IndentationSize = (int?)e.Attribute("IndentationSize") ?? 4;
s.IndentationTabSize = (int?)e.Attribute("IndentationTabSize") ?? 4;
s.HighlightMatchingBraces = (bool?)e.Attribute("HighlightMatchingBraces") ?? true;
s.HighlightCurrentLine = (bool?)e.Attribute("HighlightCurrentLine") ?? false;
s.HideEmptyMetadataTables = (bool?)e.Attribute("HideEmptyMetadataTables") ?? true;
return s;
@ -146,6 +147,7 @@ namespace ICSharpCode.ILSpy.Options @@ -146,6 +147,7 @@ namespace ICSharpCode.ILSpy.Options
section.SetAttributeValue("IndentationSize", s.IndentationSize);
section.SetAttributeValue("IndentationTabSize", s.IndentationTabSize);
section.SetAttributeValue("HighlightMatchingBraces", s.HighlightMatchingBraces);
section.SetAttributeValue("HighlightCurrentLine", s.HighlightCurrentLine);
section.SetAttributeValue("HideEmptyMetadataTables", s.HideEmptyMetadataTables);
XElement existingElement = root.Element("DisplaySettings");

9
ILSpy/Properties/Resources.Designer.cs generated

@ -1550,6 +1550,15 @@ namespace ICSharpCode.ILSpy.Properties { @@ -1550,6 +1550,15 @@ namespace ICSharpCode.ILSpy.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Hightlight current line.
/// </summary>
public static string HighlightCurrentLine {
get {
return ResourceManager.GetString("HighlightCurrentLine", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Highlight matching braces.
/// </summary>

3
ILSpy/Properties/Resources.resx

@ -543,6 +543,9 @@ Are you sure you want to continue?</value> @@ -543,6 +543,9 @@ Are you sure you want to continue?</value>
<data name="HideEmptyMetadataTables" xml:space="preserve">
<value>Hide empty metadata tables from tree view</value>
</data>
<data name="HighlightCurrentLine" xml:space="preserve">
<value>Hightlight current line</value>
</data>
<data name="HighlightMatchingBraces" xml:space="preserve">
<value>Highlight matching braces</value>
</data>

12
ILSpy/TextView/DecompilerTextView.cs

@ -156,6 +156,7 @@ namespace ICSharpCode.ILSpy.TextView @@ -156,6 +156,7 @@ namespace ICSharpCode.ILSpy.TextView
.RegisterCommands(Application.Current.MainWindow.CommandBindings);
ShowLineMargin();
SetHighlightCurrentLine();
// add marker service & margin
textEditor.TextArea.TextView.BackgroundRenderers.Add(textMarkerService);
@ -180,10 +181,14 @@ namespace ICSharpCode.ILSpy.TextView @@ -180,10 +181,14 @@ namespace ICSharpCode.ILSpy.TextView
void CurrentDisplaySettings_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == "ShowLineNumbers")
if (e.PropertyName == nameof(DisplaySettings.ShowLineNumbers))
{
ShowLineMargin();
}
else if (e.PropertyName == nameof(DisplaySettings.HighlightCurrentLine))
{
SetHighlightCurrentLine();
}
}
void ShowLineMargin()
@ -197,6 +202,11 @@ namespace ICSharpCode.ILSpy.TextView @@ -197,6 +202,11 @@ namespace ICSharpCode.ILSpy.TextView
}
}
void SetHighlightCurrentLine()
{
textEditor.Options.HighlightCurrentLine = DisplaySettingsPanel.CurrentDisplaySettings.HighlightCurrentLine;
}
#endregion
#region Tooltip support

Loading…
Cancel
Save