Browse Source

Fix #3393: Option to turn off smooth scrolling

pull/3405/head
tom-englert 3 months ago
parent
commit
8eadd907c9
  1. 12
      ILSpy/App.xaml
  2. 2
      ILSpy/App.xaml.cs
  3. 12
      ILSpy/Controls/ZoomScrollViewer.xaml
  4. 8
      ILSpy/Options/DisplaySettings.cs
  5. 1
      ILSpy/Options/DisplaySettingsPanel.xaml
  6. 9
      ILSpy/Properties/Resources.Designer.cs
  7. 3
      ILSpy/Properties/Resources.resx

12
ILSpy/App.xaml

@ -3,7 +3,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:styles="urn:TomsToolbox.Wpf.Styles" xmlns:styles="urn:TomsToolbox.Wpf.Styles"
xmlns:toms="urn:TomsToolbox" xmlns:toms="urn:TomsToolbox"
xmlns:themes="clr-namespace:ICSharpCode.ILSpy.Themes"> xmlns:themes="clr-namespace:ICSharpCode.ILSpy.Themes"
xmlns:composition="urn:TomsToolbox.Composition"
xmlns:util="clr-namespace:ICSharpCode.ILSpy.Util">
<Application.Resources> <Application.Resources>
<Style x:Key="DialogWindow" TargetType="{x:Type Window}"> <Style x:Key="DialogWindow" TargetType="{x:Type Window}">
<Setter Property="ShowInTaskbar" Value="False" /> <Setter Property="ShowInTaskbar" Value="False" />
@ -24,7 +26,13 @@
</Style> </Style>
<Style TargetType="ScrollViewer"> <Style TargetType="ScrollViewer">
<Setter Property="toms:AdvancedScrollWheelBehavior.Attach" Value="WithAnimation" /> <Setter Property="toms:StyleBindings.Behaviors">
<Setter.Value>
<toms:BehaviorCollection>
<toms:AdvancedScrollWheelBehavior UseScrollingAnimation="{Binding Path=(util:SettingsService.DisplaySettings).EnableSmoothScrolling, Source={composition:Import util:SettingsService}}"/>
</toms:BehaviorCollection>
</Setter.Value>
</Setter>
</Style> </Style>
</Application.Resources> </Application.Resources>

2
ILSpy/App.xaml.cs

@ -69,6 +69,8 @@ namespace ICSharpCode.ILSpy
var cmdArgs = Environment.GetCommandLineArgs().Skip(1); var cmdArgs = Environment.GetCommandLineArgs().Skip(1);
CommandLineArguments = CommandLineArguments.Create(cmdArgs); CommandLineArguments = CommandLineArguments.Create(cmdArgs);
// This is only a temporary, read only handle to the settings service to access the AllowMultipleInstances setting before DI is initialized.
// At runtime, you must use the service via DI!
var settingsService = new SettingsService(); var settingsService = new SettingsService();
bool forceSingleInstance = (CommandLineArguments.SingleInstance ?? true) bool forceSingleInstance = (CommandLineArguments.SingleInstance ?? true)

12
ILSpy/Controls/ZoomScrollViewer.xaml

@ -1,10 +1,18 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Controls="clr-namespace:ICSharpCode.ILSpy.Controls" xmlns:Controls="clr-namespace:ICSharpCode.ILSpy.Controls"
xmlns:toms="urn:TomsToolbox"> xmlns:toms="urn:TomsToolbox"
xmlns:composition="urn:TomsToolbox.Composition"
xmlns:util="clr-namespace:ICSharpCode.ILSpy.Util">
<Style TargetType="{x:Type Controls:ZoomScrollViewer}"> <Style TargetType="{x:Type Controls:ZoomScrollViewer}">
<Setter Property="toms:AdvancedScrollWheelBehavior.Attach" Value="WithAnimation" /> <Setter Property="toms:StyleBindings.Behaviors">
<Setter.Value>
<toms:BehaviorCollection>
<toms:AdvancedScrollWheelBehavior UseScrollingAnimation="{Binding Path=(util:SettingsService.DisplaySettings).EnableSmoothScrolling, Source={composition:Import util:SettingsService}}"/>
</toms:BehaviorCollection>
</Setter.Value>
</Setter>
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="{x:Type Controls:ZoomScrollViewer}"> <ControlTemplate TargetType="{x:Type Controls:ZoomScrollViewer}">

8
ILSpy/Options/DisplaySettings.cs

@ -148,6 +148,12 @@ namespace ICSharpCode.ILSpy.Options
set => SetProperty(ref showRawOffsetsAndBytesBeforeInstruction, value); set => SetProperty(ref showRawOffsetsAndBytesBeforeInstruction, value);
} }
private bool enableSmoothScrolling;
public bool EnableSmoothScrolling {
get => enableSmoothScrolling;
set => SetProperty(ref enableSmoothScrolling, value);
}
public XName SectionName => "DisplaySettings"; public XName SectionName => "DisplaySettings";
public void LoadFromXml(XElement section) public void LoadFromXml(XElement section)
@ -172,6 +178,7 @@ namespace ICSharpCode.ILSpy.Options
UseNestedNamespaceNodes = (bool?)section.Attribute("UseNestedNamespaceNodes") ?? false; UseNestedNamespaceNodes = (bool?)section.Attribute("UseNestedNamespaceNodes") ?? false;
ShowRawOffsetsAndBytesBeforeInstruction = (bool?)section.Attribute("ShowRawOffsetsAndBytesBeforeInstruction") ?? false; ShowRawOffsetsAndBytesBeforeInstruction = (bool?)section.Attribute("ShowRawOffsetsAndBytesBeforeInstruction") ?? false;
StyleWindowTitleBar = (bool?)section.Attribute("StyleWindowTitleBar") ?? false; StyleWindowTitleBar = (bool?)section.Attribute("StyleWindowTitleBar") ?? false;
EnableSmoothScrolling = (bool?)section.Attribute("EnableSmoothScrolling") ?? true;
} }
public XElement SaveToXml() public XElement SaveToXml()
@ -198,6 +205,7 @@ namespace ICSharpCode.ILSpy.Options
section.SetAttributeValue("UseNestedNamespaceNodes", UseNestedNamespaceNodes); section.SetAttributeValue("UseNestedNamespaceNodes", UseNestedNamespaceNodes);
section.SetAttributeValue("ShowRawOffsetsAndBytesBeforeInstruction", ShowRawOffsetsAndBytesBeforeInstruction); section.SetAttributeValue("ShowRawOffsetsAndBytesBeforeInstruction", ShowRawOffsetsAndBytesBeforeInstruction);
section.SetAttributeValue("StyleWindowTitleBar", StyleWindowTitleBar); section.SetAttributeValue("StyleWindowTitleBar", StyleWindowTitleBar);
section.SetAttributeValue("EnableSmoothScrolling", EnableSmoothScrolling);
return section; return section;
} }

1
ILSpy/Options/DisplaySettingsPanel.xaml

@ -78,6 +78,7 @@
<StackPanel Margin="3"> <StackPanel Margin="3">
<CheckBox IsChecked="{Binding Settings.SortResults}" Content="{x:Static properties:Resources.SortResultsFitness}"></CheckBox> <CheckBox IsChecked="{Binding Settings.SortResults}" Content="{x:Static properties:Resources.SortResultsFitness}"></CheckBox>
<CheckBox IsChecked="{Binding Settings.StyleWindowTitleBar}" Content="{x:Static properties:Resources.StyleTheWindowTitleBar}"></CheckBox> <CheckBox IsChecked="{Binding Settings.StyleWindowTitleBar}" Content="{x:Static properties:Resources.StyleTheWindowTitleBar}"></CheckBox>
<CheckBox IsChecked="{Binding Settings.EnableSmoothScrolling}" Content="{x:Static properties:Resources.EnableSmoothScrolling}"></CheckBox>
</StackPanel> </StackPanel>
</GroupBox> </GroupBox>
</StackPanel> </StackPanel>

9
ILSpy/Properties/Resources.Designer.cs generated

@ -1722,6 +1722,15 @@ namespace ICSharpCode.ILSpy.Properties {
} }
} }
/// <summary>
/// Looks up a localized string similar to Enable smooth scrolling.
/// </summary>
public static string EnableSmoothScrolling {
get {
return ResourceManager.GetString("EnableSmoothScrolling", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Enable word wrap. /// Looks up a localized string similar to Enable word wrap.
/// </summary> /// </summary>

3
ILSpy/Properties/Resources.resx

@ -591,6 +591,9 @@ Are you sure you want to continue?</value>
<data name="EnableFoldingBlocksBraces" xml:space="preserve"> <data name="EnableFoldingBlocksBraces" xml:space="preserve">
<value>Enable folding on all blocks in braces</value> <value>Enable folding on all blocks in braces</value>
</data> </data>
<data name="EnableSmoothScrolling" xml:space="preserve">
<value>Enable smooth scrolling</value>
</data>
<data name="EnableWordWrap" xml:space="preserve"> <data name="EnableWordWrap" xml:space="preserve">
<value>Enable word wrap</value> <value>Enable word wrap</value>
</data> </data>

Loading…
Cancel
Save