From: sr55 Date: Sat, 10 Feb 2018 21:22:53 +0000 (+0000) Subject: WinGui: New shortcuts for easier accessibility. Ctrl 1 through 7 activate given... X-Git-Tag: 1.1.0~35 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6b4325cfd832590c54863c688262e4a923717486;p=handbrake WinGui: New shortcuts for easier accessibility. Ctrl 1 through 7 activate given tabs and set focus to allow easier tab navigation of the guil --- 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. /// void FilesDroppedOnWindow(DragEventArgs e); + + /// + /// Handle Tab Switching + /// + /// The Tab Number + 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; } + /// + /// Active Tab. + /// + /// + /// Should move this to the view when refactoring the keyboard shotcut handling. + /// + 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); + } + /// /// The Destination Path /// 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 @@ 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) {