Browse Source

feat: option to turn off smooth scrolling

pull/3394/head
Hertzole 4 months ago
parent
commit
fefd53a0da
No known key found for this signature in database
GPG Key ID: BBB7FC1B5C4757F8
  1. 9
      ILSpy/App.xaml
  2. 6
      ILSpy/App.xaml.cs
  3. 9
      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

9
ILSpy/App.xaml

@ -3,7 +3,8 @@ @@ -3,7 +3,8 @@
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:ilSpy="clr-namespace:ICSharpCode.ILSpy">
<Application.Resources>
<Style x:Key="DialogWindow" TargetType="{x:Type Window}">
<Setter Property="ShowInTaskbar" Value="False" />
@ -25,6 +26,12 @@ @@ -25,6 +26,12 @@
<Style TargetType="ScrollViewer">
<Setter Property="toms:AdvancedScrollWheelBehavior.Attach" Value="WithAnimation" />
<Style.Triggers>
<!-- Allow for disabling smooth scrolling -->
<DataTrigger Binding="{Binding Path=DisplaySettings.EnableSmoothScrolling, Source={x:Static ilSpy:App.SettingsService}}" Value="False">
<Setter Property="toms:AdvancedScrollWheelBehavior.Attach" Value="None"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Application.Resources>

6
ILSpy/App.xaml.cs

@ -59,6 +59,10 @@ namespace ICSharpCode.ILSpy @@ -59,6 +59,10 @@ namespace ICSharpCode.ILSpy
public static IExportProvider ExportProvider { get; private set; }
private readonly SettingsService settingsService;
public static SettingsService SettingsService => Current.settingsService;
internal record ExceptionData(Exception Exception)
{
public string PluginName { get; init; }
@ -69,7 +73,7 @@ namespace ICSharpCode.ILSpy @@ -69,7 +73,7 @@ namespace ICSharpCode.ILSpy
var cmdArgs = Environment.GetCommandLineArgs().Skip(1);
CommandLineArguments = CommandLineArguments.Create(cmdArgs);
var settingsService = new SettingsService();
settingsService = new SettingsService();
bool forceSingleInstance = (CommandLineArguments.SingleInstance ?? true)
&& !settingsService.MiscSettings.AllowMultipleInstances;

9
ILSpy/Controls/ZoomScrollViewer.xaml

@ -1,7 +1,8 @@ @@ -1,7 +1,8 @@
<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:ilSpy="clr-namespace:ICSharpCode.ILSpy">
<Style TargetType="{x:Type Controls:ZoomScrollViewer}">
<Setter Property="toms:AdvancedScrollWheelBehavior.Attach" Value="WithAnimation" />
@ -33,6 +34,12 @@ @@ -33,6 +34,12 @@
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<!-- Allow for disabling smooth scrolling -->
<DataTrigger Binding="{Binding Path=DisplaySettings.EnableSmoothScrolling, Source={x:Static ilSpy:App.SettingsService}}" Value="False">
<Setter Property="toms:AdvancedScrollWheelBehavior.Attach" Value="WithoutAnimation" />
</DataTrigger>
</Style.Triggers>
</Style>
<!-- Template for CollapsiblePanel -->

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