summaryrefslogtreecommitdiffstats
path: root/win/CS
diff options
context:
space:
mode:
authorsr55 <[email protected]>2017-09-08 22:23:55 +0100
committersr55 <[email protected]>2017-09-08 22:23:55 +0100
commit57e74ceea2136142d40b964084fa7a4d2bb39270 (patch)
tree6ba210b1dc88756b162172187484dc2db4c8fba1 /win/CS
parent655285b62296302cfbedba00b22fa1dca4450866 (diff)
WinGui: Change the Audio and Subtitle Tab's "Add" Split Button" to a Dropdown Button with a system native feel. The legacy button was always styled to Windows 7 regardless of platform. This resolves that issue.
Diffstat (limited to 'win/CS')
-rw-r--r--win/CS/HandBrakeWPF/Views/AudioView.xaml28
-rw-r--r--win/CS/HandBrakeWPF/Views/AudioView.xaml.cs14
-rw-r--r--win/CS/HandBrakeWPF/Views/MainView.xaml2
-rw-r--r--win/CS/HandBrakeWPF/Views/SubtitlesView.xaml30
-rw-r--r--win/CS/HandBrakeWPF/Views/SubtitlesView.xaml.cs14
5 files changed, 70 insertions, 18 deletions
diff --git a/win/CS/HandBrakeWPF/Views/AudioView.xaml b/win/CS/HandBrakeWPF/Views/AudioView.xaml
index 16c7a75bd..33d5344ac 100644
--- a/win/CS/HandBrakeWPF/Views/AudioView.xaml
+++ b/win/CS/HandBrakeWPF/Views/AudioView.xaml
@@ -61,13 +61,27 @@
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
- <splitButton:SplitMenuButton Content="{x:Static Properties:ResourcesUI.Shared_AddTrack}" cal:Message.Attach="[Event Click] = [Action Add]" FontWeight="Bold" Margin="0,0,10,0" Grid.Column="0">
- <splitButton:SplitMenuButton.ItemSource>
- <MenuItem Header="{x:Static Properties:ResourcesUI.Shared_AddNewTrack}" cal:Message.Attach="[Event Click] = [Action Add]" />
- <MenuItem Header="{x:Static Properties:ResourcesUI.Shared_AddAllRemaining}" cal:Message.Attach="[Event Click] = [Action AddAllRemaining]" />
- <MenuItem Header="{x:Static Properties:ResourcesUI.Shared_AddAllForSelected}" cal:Message.Attach="[Event Click] = [Action AddAllRemainingForSelectedLanguages]" />
- </splitButton:SplitMenuButton.ItemSource>
- </splitButton:SplitMenuButton>
+ <Button x:Name="audioOptionsButton" FontWeight="Bold" Margin="0,0,10,0" Grid.Column="0" Click="AudioOptionsButton_OnClick">
+ <Button.Content>
+ <StackPanel Orientation="Horizontal">
+ <TextBlock Margin="0,0,5,0" Padding="0"
+ VerticalAlignment="Center"
+ Text="{x:Static Properties:ResourcesUI.Shared_AddTrack}" />
+
+ <Path Height="5" Margin="2,2,0,0" VerticalAlignment="Center" HorizontalAlignment="Center"
+ Data="M 0 0 L 4 4 L 8 0 Z"
+ Fill="{DynamicResource GlyphBrush}" x:Name="dropdownArrowPreset" />
+ </StackPanel>
+ </Button.Content>
+
+ <Button.ContextMenu>
+ <ContextMenu x:Name="MainContextMenu" PlacementRectangle="{Binding RelativeSource={RelativeSource Self}}">
+ <MenuItem Header="{x:Static Properties:ResourcesUI.Shared_AddNewTrack}" cal:Message.Attach="[Event Click] = [Action Add]" />
+ <MenuItem Header="{x:Static Properties:ResourcesUI.Shared_AddAllRemaining}" cal:Message.Attach="[Event Click] = [Action AddAllRemaining]" />
+ <MenuItem Header="{x:Static Properties:ResourcesUI.Shared_AddAllForSelected}" cal:Message.Attach="[Event Click] = [Action AddAllRemainingForSelectedLanguages]" />
+ </ContextMenu>
+ </Button.ContextMenu>
+ </Button>
<Button MinWidth="65" Grid.Column="1"
Margin="0,0,10,0"
diff --git a/win/CS/HandBrakeWPF/Views/AudioView.xaml.cs b/win/CS/HandBrakeWPF/Views/AudioView.xaml.cs
index 0dc1dc9b8..c76cc1588 100644
--- a/win/CS/HandBrakeWPF/Views/AudioView.xaml.cs
+++ b/win/CS/HandBrakeWPF/Views/AudioView.xaml.cs
@@ -9,6 +9,7 @@
namespace HandBrakeWPF.Views
{
+ using System.Windows;
using System.Windows.Controls;
/// <summary>
@@ -21,7 +22,18 @@ namespace HandBrakeWPF.Views
/// </summary>
public AudioView()
{
- InitializeComponent();
+ this.InitializeComponent();
+ }
+
+ private void AudioOptionsButton_OnClick(object sender, RoutedEventArgs e)
+ {
+ var button = sender as FrameworkElement;
+ if (button != null && button.ContextMenu != null)
+ {
+ button.ContextMenu.PlacementTarget = button;
+ button.ContextMenu.Placement = System.Windows.Controls.Primitives.PlacementMode.Bottom;
+ button.ContextMenu.IsOpen = true;
+ }
}
}
}
diff --git a/win/CS/HandBrakeWPF/Views/MainView.xaml b/win/CS/HandBrakeWPF/Views/MainView.xaml
index 019d8f790..60365e104 100644
--- a/win/CS/HandBrakeWPF/Views/MainView.xaml
+++ b/win/CS/HandBrakeWPF/Views/MainView.xaml
@@ -340,7 +340,7 @@
VerticalAlignment="Center"
Text="{x:Static Properties:ResourcesUI.MainView_Options}" />
- <Path Height="5" Margin="2,2,2,0" VerticalAlignment="Center" HorizontalAlignment="Center"
+ <Path Height="5" Margin="2,2,0,0" VerticalAlignment="Center" HorizontalAlignment="Center"
Data="M 0 0 L 4 4 L 8 0 Z"
Fill="{DynamicResource GlyphBrush}" x:Name="dropdownArrowPreset" />
</StackPanel>
diff --git a/win/CS/HandBrakeWPF/Views/SubtitlesView.xaml b/win/CS/HandBrakeWPF/Views/SubtitlesView.xaml
index 54df67b38..a945b6fcc 100644
--- a/win/CS/HandBrakeWPF/Views/SubtitlesView.xaml
+++ b/win/CS/HandBrakeWPF/Views/SubtitlesView.xaml
@@ -57,14 +57,28 @@
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
- <splitButton:SplitMenuButton Content="{x:Static Properties:ResourcesUI.Shared_AddTrack}" cal:Message.Attach="[Event Click] = [Action Add]" FontWeight="Bold" Margin="0,0,10,0" Grid.Column="0">
- <splitButton:SplitMenuButton.ItemSource>
- <MenuItem Header="{x:Static Properties:ResourcesUI.Shared_AddNewTrack}" cal:Message.Attach="[Event Click] = [Action Add]" />
- <MenuItem Header="Add All Remaining Tracks" cal:Message.Attach="[Event Click] = [Action AddAllRemaining]" />
- <MenuItem Header="Add All Remaining Closed Captions" cal:Message.Attach="[Event Click] = [Action AddAllClosedCaptions]" />
- <MenuItem Header="Add All Remaining Selected Languages" cal:Message.Attach="[Event Click] = [Action AddAllRemainingForSelectedLanguages]" />
- </splitButton:SplitMenuButton.ItemSource>
- </splitButton:SplitMenuButton>
+ <Button x:Name="subtitleOptionsButton" FontWeight="Bold" Margin="0,0,10,0" Grid.Column="0" Click="SubtitleOptionsButton_OnClick">
+ <Button.Content>
+ <StackPanel Orientation="Horizontal">
+ <TextBlock Margin="0,0,5,0" Padding="0"
+ VerticalAlignment="Center"
+ Text="{x:Static Properties:ResourcesUI.Shared_AddTrack}" />
+
+ <Path Height="5" Margin="2,2,0,0" VerticalAlignment="Center" HorizontalAlignment="Center"
+ Data="M 0 0 L 4 4 L 8 0 Z"
+ Fill="{DynamicResource GlyphBrush}" x:Name="dropdownArrowPreset" />
+ </StackPanel>
+ </Button.Content>
+
+ <Button.ContextMenu>
+ <ContextMenu x:Name="MainContextMenu" PlacementRectangle="{Binding RelativeSource={RelativeSource Self}}">
+ <MenuItem Header="{x:Static Properties:ResourcesUI.Shared_AddNewTrack}" cal:Message.Attach="[Event Click] = [Action Add]" />
+ <MenuItem Header="Add All Remaining Tracks" cal:Message.Attach="[Event Click] = [Action AddAllRemaining]" />
+ <MenuItem Header="Add All Remaining Closed Captions" cal:Message.Attach="[Event Click] = [Action AddAllClosedCaptions]" />
+ <MenuItem Header="Add All Remaining Selected Languages" cal:Message.Attach="[Event Click] = [Action AddAllRemainingForSelectedLanguages]" />
+ </ContextMenu>
+ </Button.ContextMenu>
+ </Button>
<Button MinWidth="75" Grid.Column="1"
cal:Message.Attach="[Event Click] = [Action Import]"
diff --git a/win/CS/HandBrakeWPF/Views/SubtitlesView.xaml.cs b/win/CS/HandBrakeWPF/Views/SubtitlesView.xaml.cs
index ea3e67114..373734bb0 100644
--- a/win/CS/HandBrakeWPF/Views/SubtitlesView.xaml.cs
+++ b/win/CS/HandBrakeWPF/Views/SubtitlesView.xaml.cs
@@ -9,6 +9,7 @@
namespace HandBrakeWPF.Views
{
+ using System.Windows;
using System.Windows.Controls;
/// <summary>
@@ -21,7 +22,18 @@ namespace HandBrakeWPF.Views
/// </summary>
public SubtitlesView()
{
- InitializeComponent();
+ this.InitializeComponent();
+ }
+
+ private void SubtitleOptionsButton_OnClick(object sender, RoutedEventArgs e)
+ {
+ var button = sender as FrameworkElement;
+ if (button != null && button.ContextMenu != null)
+ {
+ button.ContextMenu.PlacementTarget = button;
+ button.ContextMenu.Placement = System.Windows.Controls.Primitives.PlacementMode.Bottom;
+ button.ContextMenu.IsOpen = true;
+ }
}
}
}