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 @@ @@ -3,7 +3,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:styles="urn:TomsToolbox.Wpf.Styles"
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>
<Style x:Key="DialogWindow" TargetType="{x:Type Window}">
<Setter Property="ShowInTaskbar" Value="False" />
@ -24,7 +26,13 @@ @@ -24,7 +26,13 @@
</Style>
<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>
</Application.Resources>

2
ILSpy/App.xaml.cs

@ -69,6 +69,8 @@ namespace ICSharpCode.ILSpy @@ -69,6 +69,8 @@ namespace ICSharpCode.ILSpy
var cmdArgs = Environment.GetCommandLineArgs().Skip(1);
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();
bool forceSingleInstance = (CommandLineArguments.SingleInstance ?? true)

12
ILSpy/Controls/ZoomScrollViewer.xaml

@ -1,10 +1,18 @@ @@ -1,10 +1,18 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
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}">
<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.Value>
<ControlTemplate TargetType="{x:Type Controls:ZoomScrollViewer}">

8
ILSpy/Options/DisplaySettings.cs

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

1
ILSpy/Options/DisplaySettingsPanel.xaml

@ -78,6 +78,7 @@ @@ -78,6 +78,7 @@
<StackPanel Margin="3">
<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.EnableSmoothScrolling}" Content="{x:Static properties:Resources.EnableSmoothScrolling}"></CheckBox>
</StackPanel>
</GroupBox>
</StackPanel>

9
ILSpy/Properties/Resources.Designer.cs generated

@ -1722,6 +1722,15 @@ namespace ICSharpCode.ILSpy.Properties { @@ -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>
/// Looks up a localized string similar to Enable word wrap.
/// </summary>

3
ILSpy/Properties/Resources.resx

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

Loading…
Cancel
Save