(GUI): Ctrl+S hotkey toggles image scaling.

This commit is contained in:
morkt 2018-03-17 12:20:35 +04:00
parent add376037f
commit 1a60c65670
2 changed files with 13 additions and 0 deletions

View File

@ -380,6 +380,7 @@
<KeyBinding Gesture="Ctrl+H" Command="{x:Static local:Commands.FitWindow}"/> <KeyBinding Gesture="Ctrl+H" Command="{x:Static local:Commands.FitWindow}"/>
<KeyBinding Gesture="Ctrl+A" Command="{x:Static local:Commands.SelectAll}"/> <KeyBinding Gesture="Ctrl+A" Command="{x:Static local:Commands.SelectAll}"/>
<KeyBinding Gesture="Ctrl+P" Command="{x:Static local:Commands.Preferences}"/> <KeyBinding Gesture="Ctrl+P" Command="{x:Static local:Commands.Preferences}"/>
<KeyBinding Gesture="Ctrl+S" Command="{x:Static local:Commands.ScaleImage}"/>
<KeyBinding Gesture="Backspace" Command="{x:Static local:Commands.GoBack}"/> <KeyBinding Gesture="Backspace" Command="{x:Static local:Commands.GoBack}"/>
<KeyBinding Gesture="Alt+Left" Command="{x:Static local:Commands.GoBack}"/> <KeyBinding Gesture="Alt+Left" Command="{x:Static local:Commands.GoBack}"/>
<KeyBinding Gesture="Alt+Right" Command="{x:Static local:Commands.GoForward}"/> <KeyBinding Gesture="Alt+Right" Command="{x:Static local:Commands.GoForward}"/>
@ -421,6 +422,7 @@
<CommandBinding Command="{x:Static local:Commands.CheckUpdates}" Executed="CheckUpdatesExec" CanExecute="CanExecuteUpdate"/> <CommandBinding Command="{x:Static local:Commands.CheckUpdates}" Executed="CheckUpdatesExec" CanExecute="CanExecuteUpdate"/>
<CommandBinding Command="{x:Static local:Commands.StopPlayback}" Executed="StopPlaybackExec" CanExecute="CanExecutePlaybackControl"/> <CommandBinding Command="{x:Static local:Commands.StopPlayback}" Executed="StopPlaybackExec" CanExecute="CanExecutePlaybackControl"/>
<CommandBinding Command="{x:Static local:Commands.Preferences}" Executed="PreferencesExec" CanExecute="CanExecuteAlways"/> <CommandBinding Command="{x:Static local:Commands.Preferences}" Executed="PreferencesExec" CanExecute="CanExecuteAlways"/>
<CommandBinding Command="{x:Static local:Commands.ScaleImage}" Executed="ScaleImageExec" CanExecute="CanExecuteScaleImage"/>
<CommandBinding Command="{x:Static local:Commands.TroubleShooting}" Executed="TroubleShootingExec" CanExecute="CanExecuteAlways"/> <CommandBinding Command="{x:Static local:Commands.TroubleShooting}" Executed="TroubleShootingExec" CanExecute="CanExecuteAlways"/>
<CommandBinding Command="{x:Static local:Commands.Descend}" Executed="DescendExec" CanExecute="CanExecuteAlways"/> <CommandBinding Command="{x:Static local:Commands.Descend}" Executed="DescendExec" CanExecute="CanExecuteAlways"/>
<CommandBinding Command="{x:Static local:Commands.Ascend}" Executed="AscendExec" CanExecute="CanExecuteAlways"/> <CommandBinding Command="{x:Static local:Commands.Ascend}" Executed="AscendExec" CanExecute="CanExecuteAlways"/>

View File

@ -1321,6 +1321,16 @@ namespace GARbro.GUI
dialog.ShowDialog(); dialog.ShowDialog();
} }
private void ScaleImageExec (object sender, ExecutedRoutedEventArgs e)
{
DownScaleImage.Value = !DownScaleImage.Get<bool>();
}
private void CanExecuteScaleImage (object sender, CanExecuteRoutedEventArgs e)
{
e.CanExecute = ImageCanvas.Source != null;
}
private void CanExecuteAlways (object sender, CanExecuteRoutedEventArgs e) private void CanExecuteAlways (object sender, CanExecuteRoutedEventArgs e)
{ {
e.CanExecute = true; e.CanExecute = true;
@ -1553,5 +1563,6 @@ namespace GARbro.GUI
public static readonly RoutedCommand TroubleShooting = new RoutedCommand(); public static readonly RoutedCommand TroubleShooting = new RoutedCommand();
public static readonly RoutedCommand Descend = new RoutedCommand(); public static readonly RoutedCommand Descend = new RoutedCommand();
public static readonly RoutedCommand Ascend = new RoutedCommand(); public static readonly RoutedCommand Ascend = new RoutedCommand();
public static readonly RoutedCommand ScaleImage = new RoutedCommand();
} }
} }