diff options
author | sr55 <[email protected]> | 2013-06-01 14:21:10 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2013-06-01 14:21:10 +0000 |
commit | ca5ac69f4f80e86e396f0c21aa5a16c364997b89 (patch) | |
tree | 5b962419fe18a97b64ad8646205dca0d354e6e22 | |
parent | 665b3364b361897b572bfafb80e36a993668a943 (diff) |
WinGui: Change the Add button on the Audio/Subtitle tabs to DropButtons to better expose the add options.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5538 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | win/CS/HandBrakeWPF/Controls/DropButton/DropButton.cs | 65 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/HandBrakeWPF.csproj | 1 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/AudioView.xaml | 19 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/MainView.xaml | 2 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/Styles/Styles.xaml | 24 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/SubtitlesView.xaml | 17 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/defaultsettings.xml | 2 |
7 files changed, 116 insertions, 14 deletions
diff --git a/win/CS/HandBrakeWPF/Controls/DropButton/DropButton.cs b/win/CS/HandBrakeWPF/Controls/DropButton/DropButton.cs new file mode 100644 index 000000000..22383b871 --- /dev/null +++ b/win/CS/HandBrakeWPF/Controls/DropButton/DropButton.cs @@ -0,0 +1,65 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="DropButton.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// <summary>
+// Defines the DropDownButton type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Controls.DropButton
+{
+ using System.Windows;
+ using System.Windows.Controls;
+ using System.Windows.Controls.Primitives;
+ using System.Windows.Data;
+
+ /// <summary>
+ /// The drop down button.
+ /// </summary>
+ public class DropButton : ToggleButton
+ {
+ /// <summary>
+ /// The drop down property.
+ /// </summary>
+ public static readonly DependencyProperty DropDownProperty =
+ DependencyProperty.Register("DropDown",
+ typeof(ContextMenu),
+ typeof(DropButton),
+ new UIPropertyMetadata(null));
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="DropButton"/> class.
+ /// </summary>
+ public DropButton()
+ {
+ // Bind the ToogleButton.IsChecked property to the drop-down's IsOpen property
+ Binding binding = new Binding("DropDown.IsOpen") { Source = this };
+ this.SetBinding(IsCheckedProperty, binding);
+ }
+
+ /// <summary>
+ /// Gets or sets the drop down.
+ /// </summary>
+ public ContextMenu DropDown
+ {
+ get { return (ContextMenu)this.GetValue(DropDownProperty); }
+ set { this.SetValue(DropDownProperty, value); }
+ }
+
+ /// <summary>
+ /// Handle the users click on the button.
+ /// </summary>
+ protected override void OnClick()
+ {
+ if (this.DropDown != null)
+ {
+ // If there is a drop-down assigned to this button, then position and display it
+
+ this.DropDown.PlacementTarget = this;
+ this.DropDown.Placement = PlacementMode.Bottom;
+ this.DropDown.IsOpen = true;
+ }
+ }
+ }
+}
diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj index bc8018c08..85ee06fb7 100644 --- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj +++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj @@ -132,6 +132,7 @@ <Compile Include="Commands\SourceMenuCommand.cs" />
<Compile Include="Commands\AdvancedEncoderOptionsCommand.cs" />
<Compile Include="Constants.cs" />
+ <Compile Include="Controls\DropButton\DropButton.cs" />
<Compile Include="Controls\TimeSpanBox.xaml.cs">
<DependentUpon>TimeSpanBox.xaml</DependentUpon>
</Compile>
diff --git a/win/CS/HandBrakeWPF/Views/AudioView.xaml b/win/CS/HandBrakeWPF/Views/AudioView.xaml index 1a1042e4d..28d17d776 100644 --- a/win/CS/HandBrakeWPF/Views/AudioView.xaml +++ b/win/CS/HandBrakeWPF/Views/AudioView.xaml @@ -9,7 +9,7 @@ xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:NumericUpDown="clr-namespace:EagleBoost.Wpf.Presentation.Controls.NumericUpDown;assembly=EagleBoost.Wpf.Presentation"
- xmlns:controls="clr-namespace:HandBrakeWPF.Controls"
+ xmlns:dropButton="clr-namespace:HandBrakeWPF.Controls.DropButton"
d:DesignHeight="170"
d:DesignWidth="616"
mc:Ignorable="d">
@@ -42,15 +42,22 @@ </Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" Grid.Row="0">
- <Button MinWidth="65"
- Margin="0,0,10,0"
- cal:Message.Attach="[Event Click] = [Action Add]"
- Content="Add Track" />
-
+ <dropButton:DropButton Content="Add Track" FontWeight="Bold" Margin="0,0,10,0" Style="{StaticResource DropButtonStyle}">
+ <dropButton:DropButton.DropDown>
+ <ContextMenu>
+ <MenuItem Header="Add New Track" 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 Selected Languages" cal:Message.Attach="[Event Click] = [Action AddAllRemainingForSelectedLanguages]" />
+ </ContextMenu>
+ </dropButton:DropButton.DropDown>
+ </dropButton:DropButton>
+
<Button MinWidth="65"
Margin="0,0,10,0"
cal:Message.Attach="[Event Click] = [Action Clear]"
Content="Clear" />
+
+
</StackPanel>
<StackPanel Grid.Column="2"
diff --git a/win/CS/HandBrakeWPF/Views/MainView.xaml b/win/CS/HandBrakeWPF/Views/MainView.xaml index a1f2c9e5e..8d7575f54 100644 --- a/win/CS/HandBrakeWPF/Views/MainView.xaml +++ b/win/CS/HandBrakeWPF/Views/MainView.xaml @@ -271,7 +271,7 @@ </StackPanel>
</MenuItem.Header>
<MenuItem Header="Add All" Micro:Message.Attach="[Event Click] = [Action AddAllToQueue]" />
- <!--<MenuItem Header="Add Selection" Micro:Message.Attach="[Event Click] = [Action AddSelectionToQueue]" />-->
+ <MenuItem Header="Add Selection" Micro:Message.Attach="[Event Click] = [Action AddSelectionToQueue]" />
</MenuItem>
</Menu>
diff --git a/win/CS/HandBrakeWPF/Views/Styles/Styles.xaml b/win/CS/HandBrakeWPF/Views/Styles/Styles.xaml index 407666234..88624c5df 100644 --- a/win/CS/HandBrakeWPF/Views/Styles/Styles.xaml +++ b/win/CS/HandBrakeWPF/Views/Styles/Styles.xaml @@ -3,7 +3,6 @@ <Style x:Key="{x:Type StatusBar}" TargetType="{x:Type StatusBar}">
<Setter Property="SnapsToDevicePixels" Value="True"/>
- <Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type StatusBar}">
@@ -34,4 +33,27 @@ <SolidColorBrush x:Key="GlyphBrush" Color="#444"/>
+ <Style x:Key="DropButtonStyle" TargetType="ToggleButton" >
+ <Setter Property="Padding" Value="2,2" />
+ <Setter Property="ContentTemplate">
+ <Setter.Value>
+ <DataTemplate>
+ <Grid VerticalAlignment="Stretch">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
+
+ <TextBlock Text="{TemplateBinding Content}" Margin="4,0,0,0" Grid.Column="0" />
+
+ <!--<Rectangle Grid.Column="1" Width="1" Fill="Black" Opacity="0.4" Margin="6,2,0,2"/>-->
+
+ <Path Data="M 0,0 L 8,0 L 4,4 Z" Fill="Black" Grid.Column="2" Margin="4,0,4,0" VerticalAlignment="Center"/>
+ </Grid>
+ </DataTemplate>
+ </Setter.Value>
+ </Setter>
+ </Style>
+
</ResourceDictionary>
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/Views/SubtitlesView.xaml b/win/CS/HandBrakeWPF/Views/SubtitlesView.xaml index 48c2e68b0..2eeb5dfdf 100644 --- a/win/CS/HandBrakeWPF/Views/SubtitlesView.xaml +++ b/win/CS/HandBrakeWPF/Views/SubtitlesView.xaml @@ -9,6 +9,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:NumericUpDown="clr-namespace:EagleBoost.Wpf.Presentation.Controls.NumericUpDown;assembly=EagleBoost.Wpf.Presentation"
xmlns:controls="clr-namespace:HandBrakeWPF.Controls"
+ xmlns:dropButton="clr-namespace:HandBrakeWPF.Controls.DropButton"
d:DesignHeight="153"
d:DesignWidth="319"
mc:Ignorable="d">
@@ -29,11 +30,17 @@ Text="Subtitles" />
<StackPanel Grid.Row="1" Margin="10,5,10,0" Orientation="Horizontal">
- <Button Name="AddTrack"
- MinWidth="75"
- Margin="0,0,10,0"
- cal:Message.Attach="[Event Click] = [Action Add]"
- Content="Add" />
+ <dropButton:DropButton Content="Add Track" FontWeight="Bold" Margin="0,0,10,0" Style="{StaticResource DropButtonStyle}">
+ <dropButton:DropButton.DropDown>
+ <ContextMenu>
+ <MenuItem Header="Add New Track" 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>
+ </dropButton:DropButton.DropDown>
+ </dropButton:DropButton>
+
<Button MinWidth="75"
cal:Message.Attach="[Event Click] = [Action Import]"
Content="Import SRT"
diff --git a/win/CS/HandBrakeWPF/defaultsettings.xml b/win/CS/HandBrakeWPF/defaultsettings.xml index d14f6f7f3..10480d486 100644 --- a/win/CS/HandBrakeWPF/defaultsettings.xml +++ b/win/CS/HandBrakeWPF/defaultsettings.xml @@ -429,7 +429,7 @@ <string>ShowAdvancedTab</string>
</key>
<value>
- <anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:boolean" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">true</anyType>
+ <anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:boolean" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">false</anyType>
</value>
</item>
<item>
|