]> granicus.if.org Git - handbrake/commitdiff
WinGui: New shortcuts for easier accessibility. Ctrl 1 through 7 activate given...
authorsr55 <sr55.hb@outlook.com>
Sat, 10 Feb 2018 21:22:53 +0000 (21:22 +0000)
committersr55 <sr55.hb@outlook.com>
Sat, 10 Feb 2018 21:22:53 +0000 (21:22 +0000)
win/CS/HandBrakeWPF/Commands/ProcessShortcutCommand.cs
win/CS/HandBrakeWPF/ViewModels/Interfaces/IMainViewModel.cs
win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
win/CS/HandBrakeWPF/Views/MainView.xaml
win/CS/HandBrakeWPF/Views/MainView.xaml.cs
win/CS/HandBrakeWPF/Views/ShellView.xaml.cs

index 3a50c36e3f6b2b076fb1a9b4645656ff45452ea6..5c7eb547b9ffc383f8e9897b1cd968c7fdf1a2be 100644 (file)
@@ -102,6 +102,42 @@ namespace HandBrakeWPF.Commands
                     mainViewModel.LaunchHelp();\r
                 }\r
 \r
+                // Tabs\r
+                if (gesture.Modifiers == ModifierKeys.Control && gesture.Key == Key.D1)\r
+                {\r
+                     mainViewModel.SwitchTab(0);\r
+                }\r
+\r
+                if (gesture.Modifiers == ModifierKeys.Control && gesture.Key == Key.D2)\r
+                {\r
+                    mainViewModel.SwitchTab(1);\r
+                }\r
+\r
+                if (gesture.Modifiers == ModifierKeys.Control && gesture.Key == Key.D3)\r
+                {\r
+                    mainViewModel.SwitchTab(2);\r
+                }\r
+\r
+                if (gesture.Modifiers == ModifierKeys.Control && gesture.Key == Key.D4)\r
+                {\r
+                    mainViewModel.SwitchTab(3);\r
+                }\r
+\r
+                if (gesture.Modifiers == ModifierKeys.Control && gesture.Key == Key.D5)\r
+                {\r
+                    mainViewModel.SwitchTab(4);\r
+                }\r
+\r
+                if (gesture.Modifiers == ModifierKeys.Control && gesture.Key == Key.D6)\r
+                {\r
+                    mainViewModel.SwitchTab(5);\r
+                }\r
+\r
+                if (gesture.Modifiers == ModifierKeys.Control && gesture.Key == Key.D7)\r
+                {\r
+                    mainViewModel.SwitchTab(6);\r
+                }\r
+\r
                 if (gesture.Modifiers == (ModifierKeys.Control | ModifierKeys.Shift) && gesture.Key == Key.G)\r
                 {\r
                     GC.Collect();\r
index 19b1c000149c4438fc5c48bff57a794f1018f7c8..6b02a9a467c9423f2ef98856fad175b03882b46d 100644 (file)
@@ -112,5 +112,11 @@ namespace HandBrakeWPF.ViewModels.Interfaces
         /// The e.\r
         /// </param>\r
         void FilesDroppedOnWindow(DragEventArgs e);\r
+\r
+        /// <summary>\r
+        /// Handle Tab Switching\r
+        /// </summary>\r
+        /// <param name="i">The Tab Number</param>\r
+        void SwitchTab(int i);\r
     }\r
 }
\ No newline at end of file
index 68b59817e7991ea62ff7c13f670e72e0db277812..5fa5df5764d7805c6ce518638e019fe545c67ef2 100644 (file)
@@ -296,6 +296,14 @@ namespace HandBrakeWPF.ViewModels
 \r
         public ISummaryViewModel SummaryViewModel { get; set; }\r
 \r
+        /// <summary>\r
+        /// Active Tab.\r
+        /// </summary>\r
+        /// <remarks>\r
+        ///  Should move this to the view when refactoring the keyboard shotcut handling.\r
+        /// </remarks>\r
+        public int SelectedTab { get; set; }\r
+\r
         #endregion\r
 \r
         #region Properties\r
@@ -1812,6 +1820,12 @@ namespace HandBrakeWPF.ViewModels
             e.Handled = true;\r
         }\r
 \r
+        public void SwitchTab(int i)\r
+        {\r
+            this.SelectedTab = i;\r
+            this.NotifyOfPropertyChange(() => this.SelectedTab);\r
+        }\r
+\r
         /// <summary>\r
         /// The Destination Path\r
         /// </summary>\r
index dfbc93c7c362b15e0a3727cd047780b15c15056f..049e31a284b80cbb6e05d3b86d39e968d552d532 100644 (file)
 \r
             <!--  Tab Control  -->\r
             <TabControl Name="tabControl" IsEnabled="{Binding HasSource, Converter={StaticResource booleanConverter}, ConverterParameter=false}"\r
-                        Grid.Row="2"\r
-                        Margin="15,10,10,6"\r
-                        HorizontalAlignment="Stretch"\r
+                        Grid.Row="2" Margin="15,10,10,6"\r
+                        SelectedIndex="{Binding SelectedTab}"\r
+                        HorizontalAlignment="Stretch" \r
                         VerticalAlignment="Stretch"\r
                         SelectionChanged="TabControl_OnSelectionChanged"\r
                         Visibility="{Binding IsQueueShowingInLine,  Converter={StaticResource boolToVisConverter}, ConverterParameter=true}">\r
index 26ac5a3404b28a41f185c24c75c34c0ef6147457..922746beebc00df745b1c701814d9dbdc13f0d7e 100644 (file)
@@ -73,6 +73,8 @@ namespace HandBrakeWPF.Views
                 {\r
                     ((MainViewModel)this.DataContext).SummaryViewModel.UpdateDisplayedInfo();\r
                 }\r
+\r
+                this.tabControl.Focus();\r
             }\r
         }\r
 \r
index 6fe0187bcde75e7c38aa985df94e9dacbc9898b0..c5c632c9f0e968b87463ad2eb80ea86dcaefdd8d 100644 (file)
@@ -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\r
             this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.F1, ModifierKeys.None)), new KeyGesture(Key.F1, ModifierKeys.None))); // Help\r
 \r
+\r
+            // Tabs Switching\r
+            this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.D1, ModifierKeys.Control)), new KeyGesture(Key.D1, ModifierKeys.Control))); \r
+            this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.D2, ModifierKeys.Control)), new KeyGesture(Key.D2, ModifierKeys.Control))); \r
+            this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.D3, ModifierKeys.Control)), new KeyGesture(Key.D3, ModifierKeys.Control))); \r
+            this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.D4, ModifierKeys.Control)), new KeyGesture(Key.D4, ModifierKeys.Control))); \r
+            this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.D5, ModifierKeys.Control)), new KeyGesture(Key.D5, ModifierKeys.Control)));\r
+            this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.D6, ModifierKeys.Control)), new KeyGesture(Key.D6, ModifierKeys.Control)));\r
+            this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.D7, ModifierKeys.Control)), new KeyGesture(Key.D7, ModifierKeys.Control)));\r
+\r
+\r
             // Enable Windows 7 Taskbar progress indication.\r
             if (this.TaskbarItemInfo == null)\r
             {\r