diff --git a/Futonizer.csproj b/Futonizer.csproj index bb34256..b83777d 100644 --- a/Futonizer.csproj +++ b/Futonizer.csproj @@ -9,8 +9,8 @@ enable Futonizer Futonizer - 1.0.10 - 1.0.10.0 + 1.0.11 + 1.0.11.0 Assets\app.ico diff --git a/MainWindow.xaml b/MainWindow.xaml index 3a00537..2c300ea 100644 --- a/MainWindow.xaml +++ b/MainWindow.xaml @@ -149,6 +149,7 @@ VirtualizingPanel.ScrollUnit="Pixel" PreviewMouseWheel="SmoothList_PreviewMouseWheel" PreviewKeyDown="FileQueueList_PreviewKeyDown" + MouseDoubleClick="FileQueueList_MouseDoubleClick" ItemContainerStyle="{StaticResource QueueListBoxItemStyle}" SelectionChanged="FileQueueList_SelectionChanged"> @@ -289,7 +290,7 @@ GridLinesVisibility="None" VirtualizingPanel.ScrollUnit="Pixel" PreviewMouseWheel="SmoothList_PreviewMouseWheel" - PreviewKeyDown="TrackGrid_PreviewKeyDown" + MouseDoubleClick="TrackGrid_MouseDoubleClick" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto"> diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs index 00d8b14..e5633d3 100644 --- a/MainWindow.xaml.cs +++ b/MainWindow.xaml.cs @@ -519,13 +519,6 @@ public partial class MainWindow : FluentWindow /// private void FileQueueList_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e) { - if (e.Key == System.Windows.Input.Key.Space) - { - OpenSelectedFileInDefaultPlayer(); - e.Handled = true; - return; - } - if (e.Key != System.Windows.Input.Key.Delete) return; var selected = FileQueueList.SelectedItems.Cast().ToList(); @@ -545,13 +538,39 @@ public partial class MainWindow : FluentWindow /// Windows has associated with .mkv files (typically the default video /// player), so the user can quickly preview a file without leaving the app. /// - private void TrackGrid_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e) + private void FileQueueList_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e) { - if (e.Key != System.Windows.Input.Key.Space) return; OpenSelectedFileInDefaultPlayer(); e.Handled = true; } + /// + /// Same as , but for the track + /// table. Ignores double-clicks on the "Copy" checkbox column so toggling + /// it rapidly doesn't also launch the default player. + /// + private void TrackGrid_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e) + { + if (e.OriginalSource is DependencyObject source && FindAncestor(source) != null) return; + OpenSelectedFileInDefaultPlayer(); + e.Handled = true; + } + + /// + /// Walks up the visual tree from looking for an + /// ancestor (or the element itself) of type . + /// + private static T? FindAncestor(DependencyObject source) where T : DependencyObject + { + var current = source; + while (current != null) + { + if (current is T typed) return typed; + current = System.Windows.Media.VisualTreeHelper.GetParent(current); + } + return null; + } + private void OpenSelectedFileInDefaultPlayer() { if (FileQueueList.SelectedItem is not QueuedFileItem item) return;