Browse Source

Add line numbers to text editor and in display settings.

pull/170/merge
Eusebiu Marcu 14 years ago
parent
commit
ee2cae3d1a
  1. 13
      ILSpy/DisplaySettings.cs
  2. 7
      ILSpy/DisplaySettingsPanel.xaml
  3. 2
      ILSpy/DisplaySettingsPanel.xaml.cs
  4. 1
      ILSpy/TextView/DecompilerTextView.cs

13
ILSpy/DisplaySettings.cs

@ -71,10 +71,23 @@ namespace ICSharpCode.ILSpy
} }
} }
bool showLineNumbers;
public bool ShowLineNumbers {
get { return showLineNumbers; }
set {
if (showLineNumbers != value) {
showLineNumbers = value;
OnPropertyChanged("ShowLineNumbers");
}
}
}
public void CopyValues(DisplaySettings s) public void CopyValues(DisplaySettings s)
{ {
this.SelectedFont = s.selectedFont; this.SelectedFont = s.selectedFont;
this.SelectedFontSize = s.selectedFontSize; this.SelectedFontSize = s.selectedFontSize;
this.ShowLineNumbers = s.showLineNumbers;
} }
} }
} }

7
ILSpy/DisplaySettingsPanel.xaml

@ -6,6 +6,10 @@
<local:FontSizeConverter x:Key="fontSizeConv" /> <local:FontSizeConverter x:Key="fontSizeConv" />
</UserControl.Resources> </UserControl.Resources>
<Grid> <Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<GroupBox Header="Font"> <GroupBox Header="Font">
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
@ -53,5 +57,8 @@
</Border> </Border>
</Grid> </Grid>
</GroupBox> </GroupBox>
<GroupBox Header="Other options" Grid.Row="1">
<CheckBox Margin="3,3" IsChecked="{Binding ShowLineNumbers}">Show line numbers</CheckBox>
</GroupBox>
</Grid> </Grid>
</UserControl> </UserControl>

2
ILSpy/DisplaySettingsPanel.xaml.cs

@ -104,6 +104,7 @@ namespace ICSharpCode.ILSpy
DisplaySettings s = new DisplaySettings(); DisplaySettings s = new DisplaySettings();
s.SelectedFont = new FontFamily((string)e.Attribute("Font") ?? "Consolas"); s.SelectedFont = new FontFamily((string)e.Attribute("Font") ?? "Consolas");
s.SelectedFontSize = (double?)e.Attribute("FontSize") ?? 10.0 * 4 / 3; s.SelectedFontSize = (double?)e.Attribute("FontSize") ?? 10.0 * 4 / 3;
s.ShowLineNumbers = (bool?)e.Attribute("ShowLineNumbers") ?? false;
return s; return s;
} }
@ -117,6 +118,7 @@ namespace ICSharpCode.ILSpy
XElement section = new XElement("DisplaySettings"); XElement section = new XElement("DisplaySettings");
section.SetAttributeValue("Font", s.SelectedFont.Source); section.SetAttributeValue("Font", s.SelectedFont.Source);
section.SetAttributeValue("FontSize", s.SelectedFontSize); section.SetAttributeValue("FontSize", s.SelectedFontSize);
section.SetAttributeValue("ShowLineNumbers", s.ShowLineNumbers);
XElement existingElement = root.Element("DisplaySettings"); XElement existingElement = root.Element("DisplaySettings");
if (existingElement != null) if (existingElement != null)

1
ILSpy/TextView/DecompilerTextView.cs

@ -88,6 +88,7 @@ namespace ICSharpCode.ILSpy.TextView
textEditor.TextArea.TextView.MouseHoverStopped += TextViewMouseHoverStopped; textEditor.TextArea.TextView.MouseHoverStopped += TextViewMouseHoverStopped;
textEditor.SetBinding(TextEditor.FontFamilyProperty, new Binding { Source = DisplaySettingsPanel.CurrentDisplaySettings, Path = new PropertyPath("SelectedFont") }); textEditor.SetBinding(TextEditor.FontFamilyProperty, new Binding { Source = DisplaySettingsPanel.CurrentDisplaySettings, Path = new PropertyPath("SelectedFont") });
textEditor.SetBinding(TextEditor.FontSizeProperty, new Binding { Source = DisplaySettingsPanel.CurrentDisplaySettings, Path = new PropertyPath("SelectedFontSize") }); textEditor.SetBinding(TextEditor.FontSizeProperty, new Binding { Source = DisplaySettingsPanel.CurrentDisplaySettings, Path = new PropertyPath("SelectedFontSize") });
textEditor.SetBinding(TextEditor.ShowLineNumbersProperty, new Binding { Source = DisplaySettingsPanel.CurrentDisplaySettings, Path = new PropertyPath("ShowLineNumbers") });
} }
#endregion #endregion

Loading…
Cancel
Save