Browse Source

Merge pull request #624 from MattDuffin/wordwrap

Added word wrapping
pull/620/merge
Daniel Grunwald 11 years ago
parent
commit
415931a130
  1. 15
      ILSpy/Options/DisplaySettings.cs
  2. 1
      ILSpy/Options/DisplaySettingsPanel.xaml
  3. 2
      ILSpy/Options/DisplaySettingsPanel.xaml.cs
  4. 1
      ILSpy/TextView/DecompilerTextView.cs

15
ILSpy/Options/DisplaySettings.cs

@ -96,12 +96,27 @@ namespace ICSharpCode.ILSpy.Options
} }
} }
bool enableWordWrap;
public bool EnableWordWrap
{
get { return enableWordWrap; }
set
{
if (enableWordWrap != value) {
enableWordWrap = value;
OnPropertyChanged("EnableWordWrap");
}
}
}
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; this.ShowLineNumbers = s.showLineNumbers;
this.ShowMetadataTokens = s.showMetadataTokens; this.ShowMetadataTokens = s.showMetadataTokens;
this.EnableWordWrap = s.enableWordWrap;
} }
} }
} }

1
ILSpy/Options/DisplaySettingsPanel.xaml

@ -61,6 +61,7 @@
<StackPanel Margin="3"> <StackPanel Margin="3">
<CheckBox IsChecked="{Binding ShowLineNumbers}">Show line numbers</CheckBox> <CheckBox IsChecked="{Binding ShowLineNumbers}">Show line numbers</CheckBox>
<CheckBox IsChecked="{Binding ShowMetadataTokens}">Show metadata tokens</CheckBox> <CheckBox IsChecked="{Binding ShowMetadataTokens}">Show metadata tokens</CheckBox>
<CheckBox IsChecked="{Binding EnableWordWrap}">Enable word wrap</CheckBox>
</StackPanel> </StackPanel>
</GroupBox> </GroupBox>
</Grid> </Grid>

2
ILSpy/Options/DisplaySettingsPanel.xaml.cs

@ -101,6 +101,7 @@ namespace ICSharpCode.ILSpy.Options
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; s.ShowLineNumbers = (bool?)e.Attribute("ShowLineNumbers") ?? false;
s.ShowMetadataTokens = (bool?) e.Attribute("ShowMetadataTokens") ?? false; s.ShowMetadataTokens = (bool?) e.Attribute("ShowMetadataTokens") ?? false;
s.EnableWordWrap = (bool?)e.Attribute("EnableWordWrap") ?? false;
return s; return s;
} }
@ -116,6 +117,7 @@ namespace ICSharpCode.ILSpy.Options
section.SetAttributeValue("FontSize", s.SelectedFontSize); section.SetAttributeValue("FontSize", s.SelectedFontSize);
section.SetAttributeValue("ShowLineNumbers", s.ShowLineNumbers); section.SetAttributeValue("ShowLineNumbers", s.ShowLineNumbers);
section.SetAttributeValue("ShowMetadataTokens", s.ShowMetadataTokens); section.SetAttributeValue("ShowMetadataTokens", s.ShowMetadataTokens);
section.SetAttributeValue("EnableWordWrap", s.EnableWordWrap);
XElement existingElement = root.Element("DisplaySettings"); XElement existingElement = root.Element("DisplaySettings");
if (existingElement != null) if (existingElement != null)

1
ILSpy/TextView/DecompilerTextView.cs

@ -97,6 +97,7 @@ namespace ICSharpCode.ILSpy.TextView
textEditor.TextArea.TextView.MouseDown += TextViewMouseDown; textEditor.TextArea.TextView.MouseDown += TextViewMouseDown;
textEditor.SetBinding(Control.FontFamilyProperty, new Binding { Source = DisplaySettingsPanel.CurrentDisplaySettings, Path = new PropertyPath("SelectedFont") }); textEditor.SetBinding(Control.FontFamilyProperty, new Binding { Source = DisplaySettingsPanel.CurrentDisplaySettings, Path = new PropertyPath("SelectedFont") });
textEditor.SetBinding(Control.FontSizeProperty, new Binding { Source = DisplaySettingsPanel.CurrentDisplaySettings, Path = new PropertyPath("SelectedFontSize") }); textEditor.SetBinding(Control.FontSizeProperty, new Binding { Source = DisplaySettingsPanel.CurrentDisplaySettings, Path = new PropertyPath("SelectedFontSize") });
textEditor.SetBinding(TextEditor.WordWrapProperty, new Binding { Source = DisplaySettingsPanel.CurrentDisplaySettings, Path = new PropertyPath("EnableWordWrap") });
textMarkerService = new TextMarkerService(textEditor.TextArea.TextView); textMarkerService = new TextMarkerService(textEditor.TextArea.TextView);
textEditor.TextArea.TextView.BackgroundRenderers.Add(textMarkerService); textEditor.TextArea.TextView.BackgroundRenderers.Add(textMarkerService);

Loading…
Cancel
Save