summaryrefslogtreecommitdiffstats
path: root/win/CS
diff options
context:
space:
mode:
authorsr55 <[email protected]>2018-02-10 21:22:53 +0000
committersr55 <[email protected]>2018-02-10 21:22:53 +0000
commit6b4325cfd832590c54863c688262e4a923717486 (patch)
tree0accf6bbd23a4e01313a617f8c3f4b7f98058f3f /win/CS
parent0a9ed4041460e099a714059148a4f844125aa64d (diff)
WinGui: New shortcuts for easier accessibility. Ctrl 1 through 7 activate given tabs and set focus to allow easier tab navigation of the guil
Diffstat (limited to 'win/CS')
-rw-r--r--win/CS/HandBrakeWPF/Commands/ProcessShortcutCommand.cs36
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/Interfaces/IMainViewModel.cs6
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs14
-rw-r--r--win/CS/HandBrakeWPF/Views/MainView.xaml6
-rw-r--r--win/CS/HandBrakeWPF/Views/MainView.xaml.cs2
-rw-r--r--win/CS/HandBrakeWPF/Views/ShellView.xaml.cs11
6 files changed, 72 insertions, 3 deletions
diff --git a/win/CS/HandBrakeWPF/Commands/ProcessShortcutCommand.cs b/win/CS/HandBrakeWPF/Commands/ProcessShortcutCommand.cs
index 3a50c36e3..5c7eb547b 100644
--- a/win/CS/HandBrakeWPF/Commands/ProcessShortcutCommand.cs
+++ b/win/CS/HandBrakeWPF/Commands/ProcessShortcutCommand.cs
@@ -102,6 +102,42 @@ namespace HandBrakeWPF.Commands
mainViewModel.LaunchHelp();
}
+ // Tabs
+ if (gesture.Modifiers == ModifierKeys.Control && gesture.Key == Key.D1)
+ {
+ mainViewModel.SwitchTab(0);
+ }
+
+ if (gesture.Modifiers == ModifierKeys.Control && gesture.Key == Key.D2)
+ {
+ mainViewModel.SwitchTab(1);
+ }
+
+ if (gesture.Modifiers == ModifierKeys.Control && gesture.Key == Key.D3)
+ {
+ mainViewModel.SwitchTab(2);
+ }
+
+ if (gesture.Modifiers == ModifierKeys.Control && gesture.Key == Key.D4)
+ {
+ mainViewModel.SwitchTab(3);
+ }
+
+ if (gesture.Modifiers == ModifierKeys.Control && gesture.Key == Key.D5)
+ {
+ mainViewModel.SwitchTab(4);
+ }
+
+ if (gesture.Modifiers == ModifierKeys.Control && gesture.Key == Key.D6)
+ {
+ mainViewModel.SwitchTab(5);
+ }
+
+ if (gesture.Modifiers == ModifierKeys.Control && gesture.Key == Key.D7)
+ {
+ mainViewModel.SwitchTab(6);
+ }
+
if (gesture.Modifiers == (ModifierKeys.Control | ModifierKeys.Shift) && gesture.Key == Key.G)
{
GC.Collect();
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IMainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IMainViewModel.cs
index 19b1c0001..6b02a9a46 100644
--- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IMainViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IMainViewModel.cs
@@ -112,5 +112,11 @@ namespace HandBrakeWPF.ViewModels.Interfaces
/// The e.
/// </param>
void FilesDroppedOnWindow(DragEventArgs e);
+
+ /// <summary>
+ /// Handle Tab Switching
+ /// </summary>
+ /// <param name="i">The Tab Number</param>
+ void SwitchTab(int i);
}
} \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
index 68b59817e..5fa5df576 100644
--- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
@@ -296,6 +296,14 @@ namespace HandBrakeWPF.ViewModels
public ISummaryViewModel SummaryViewModel { get; set; }
+ /// <summary>
+ /// Active Tab.
+ /// </summary>
+ /// <remarks>
+ /// Should move this to the view when refactoring the keyboard shotcut handling.
+ /// </remarks>
+ public int SelectedTab { get; set; }
+
#endregion
#region Properties
@@ -1812,6 +1820,12 @@ namespace HandBrakeWPF.ViewModels
e.Handled = true;
}
+ public void SwitchTab(int i)
+ {
+ this.SelectedTab = i;
+ this.NotifyOfPropertyChange(() => this.SelectedTab);
+ }
+
/// <summary>
/// The Destination Path
/// </summary>
diff --git a/win/CS/HandBrakeWPF/Views/MainView.xaml b/win/CS/HandBrakeWPF/Views/MainView.xaml
index dfbc93c7c..049e31a28 100644
--- a/win/CS/HandBrakeWPF/Views/MainView.xaml
+++ b/win/CS/HandBrakeWPF/Views/MainView.xaml
@@ -465,9 +465,9 @@
<!-- Tab Control -->
<TabControl Name="tabControl" IsEnabled="{Binding HasSource, Converter={StaticResource booleanConverter}, ConverterParameter=false}"
- Grid.Row="2"
- Margin="15,10,10,6"
- HorizontalAlignment="Stretch"
+ Grid.Row="2" Margin="15,10,10,6"
+ SelectedIndex="{Binding SelectedTab}"
+ HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
SelectionChanged="TabControl_OnSelectionChanged"
Visibility="{Binding IsQueueShowingInLine, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}">
diff --git a/win/CS/HandBrakeWPF/Views/MainView.xaml.cs b/win/CS/HandBrakeWPF/Views/MainView.xaml.cs
index 26ac5a340..922746bee 100644
--- a/win/CS/HandBrakeWPF/Views/MainView.xaml.cs
+++ b/win/CS/HandBrakeWPF/Views/MainView.xaml.cs
@@ -73,6 +73,8 @@ namespace HandBrakeWPF.Views
{
((MainViewModel)this.DataContext).SummaryViewModel.UpdateDisplayedInfo();
}
+
+ this.tabControl.Focus();
}
}
diff --git a/win/CS/HandBrakeWPF/Views/ShellView.xaml.cs b/win/CS/HandBrakeWPF/Views/ShellView.xaml.cs
index 6fe0187bc..c5c632c9f 100644
--- a/win/CS/HandBrakeWPF/Views/ShellView.xaml.cs
+++ b/win/CS/HandBrakeWPF/Views/ShellView.xaml.cs
@@ -76,6 +76,17 @@ namespace HandBrakeWPF.Views
this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.G, ModifierKeys.Control | ModifierKeys.Shift)), new KeyGesture(Key.G, ModifierKeys.Control | ModifierKeys.Shift))); // Garbage Colleciton
this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.F1, ModifierKeys.None)), new KeyGesture(Key.F1, ModifierKeys.None))); // Help
+
+ // Tabs Switching
+ this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.D1, ModifierKeys.Control)), new KeyGesture(Key.D1, ModifierKeys.Control)));
+ this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.D2, ModifierKeys.Control)), new KeyGesture(Key.D2, ModifierKeys.Control)));
+ this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.D3, ModifierKeys.Control)), new KeyGesture(Key.D3, ModifierKeys.Control)));
+ this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.D4, ModifierKeys.Control)), new KeyGesture(Key.D4, ModifierKeys.Control)));
+ this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.D5, ModifierKeys.Control)), new KeyGesture(Key.D5, ModifierKeys.Control)));
+ this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.D6, ModifierKeys.Control)), new KeyGesture(Key.D6, ModifierKeys.Control)));
+ this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.D7, ModifierKeys.Control)), new KeyGesture(Key.D7, ModifierKeys.Control)));
+
+
// Enable Windows 7 Taskbar progress indication.
if (this.TaskbarItemInfo == null)
{