diff options
author | sr55 <[email protected]> | 2013-06-13 18:38:02 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2013-06-13 18:38:02 +0000 |
commit | 97769166a50e30941dfad0ad227a37c8538a72e1 (patch) | |
tree | 2b254084a2eca1ec5610060a57e7eae75cfd455f /win/CS | |
parent | 8e8277e05d69226d96d75ba8667413559350c8c3 (diff) |
WinGui: Added a new option that will allow users to fallback to using system colours. This is useful for those running non-standard system themes or high contrast mode.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5575 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS')
-rw-r--r-- | win/CS/HandBrakeWPF/HandBrakeWPF.csproj | 2 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Helpers/AppStyleHelper.cs | 37 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/UserSettingConstants.cs | 5 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs | 24 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/ShellViewModel.cs | 1 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/ViewModelBase.cs | 12 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/AudioView.xaml | 17 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/MainView.xaml | 20 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/OptionsView.xaml | 15 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/ShellView.xaml | 5 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/Styles/Styles.xaml | 35 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/SubtitlesView.xaml | 17 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/defaultsettings.xml | 8 |
13 files changed, 182 insertions, 16 deletions
diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj index 85ee06fb7..83535814b 100644 --- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj +++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj @@ -157,6 +157,7 @@ <Compile Include="Converters\Video\VideoEncoderConverter.cs" />
<Compile Include="Helpers\GrayscaleImage.cs" />
<Compile Include="Helpers\GrowlCommunicator.cs" />
+ <Compile Include="Helpers\AppStyleHelper.cs" />
<Compile Include="Model\OptionsTab.cs" />
<Compile Include="Model\SelectionTitle.cs" />
<Compile Include="Services\EncodeServiceWrapper.cs" />
@@ -432,6 +433,7 @@ <ItemGroup>
<Content Include="defaultsettings.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ <SubType>Designer</SubType>
</Content>
<Resource Include="Views\Images\add40.png" />
<Resource Include="Views\Images\add.png" />
diff --git a/win/CS/HandBrakeWPF/Helpers/AppStyleHelper.cs b/win/CS/HandBrakeWPF/Helpers/AppStyleHelper.cs new file mode 100644 index 000000000..9b67f97e2 --- /dev/null +++ b/win/CS/HandBrakeWPF/Helpers/AppStyleHelper.cs @@ -0,0 +1,37 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="AppStyleHelper.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 AppStyleHelper type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Helpers
+{
+ using System.Windows;
+
+ using Caliburn.Micro;
+
+ using HandBrake.ApplicationServices.Services.Interfaces;
+
+ /// <summary>
+ /// The AppStyle Helper.
+ /// </summary>
+ public class AppStyleHelper
+ {
+ /// <summary>
+ /// Gets a value indicating whether use system colours.
+ /// </summary>
+ public static bool UseSystemColours
+ {
+ get
+ {
+ IUserSettingService userSettingService = IoC.Get<IUserSettingService>();
+ bool useSystemColours = userSettingService.GetUserSetting<bool>(UserSettingConstants.UseSystemColours);
+
+ return useSystemColours || SystemParameters.HighContrast;
+ }
+ }
+ }
+}
diff --git a/win/CS/HandBrakeWPF/UserSettingConstants.cs b/win/CS/HandBrakeWPF/UserSettingConstants.cs index b01134b91..b9ce40b0c 100644 --- a/win/CS/HandBrakeWPF/UserSettingConstants.cs +++ b/win/CS/HandBrakeWPF/UserSettingConstants.cs @@ -236,6 +236,11 @@ namespace HandBrakeWPF /// </summary>
public const string ShowPresetPanel = "ShowPresetPanel";
+ /// <summary>
+ /// The use system colours.
+ /// </summary>
+ public const string UseSystemColours = "UseSystemColours";
+
#endregion
}
}
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs index dc9f6806b..e1376363a 100644 --- a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs @@ -358,6 +358,11 @@ namespace HandBrakeWPF.ViewModels /// </summary>
private bool removePunctuation;
+ /// <summary>
+ /// The use system colours for styles.
+ /// </summary>
+ private bool useSystemColoursForStyles;
+
#endregion
#region Constructors and Destructors
@@ -604,6 +609,23 @@ namespace HandBrakeWPF.ViewModels this.NotifyOfPropertyChange("WhenDoneOptions");
}
}
+
+ /// <summary>
+ /// Gets or sets a value indicating whether use system colours.
+ /// </summary>
+ public bool UseSystemColoursForStylesForStyles
+ {
+ get
+ {
+ return this.useSystemColoursForStyles;
+ }
+ set
+ {
+ this.useSystemColoursForStyles = value;
+ this.NotifyOfPropertyChange(() => UseSystemColoursForStylesForStyles);
+ }
+ }
+
#endregion
#region Output Files
@@ -1514,6 +1536,7 @@ namespace HandBrakeWPF.ViewModels this.SendFileTo = Path.GetFileNameWithoutExtension(this.userSettingService.GetUserSetting<string>(UserSettingConstants.SendFileTo)) ?? string.Empty;
this.SendFileToPath = this.userSettingService.GetUserSetting<string>(UserSettingConstants.SendFileTo) ?? string.Empty;
this.Arguments = this.userSettingService.GetUserSetting<string>(UserSettingConstants.SendFileToArgs) ?? string.Empty;
+ this.UseSystemColoursForStylesForStyles = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.UseSystemColours);
// #############################
// Output Settings
@@ -1850,6 +1873,7 @@ namespace HandBrakeWPF.ViewModels this.userSettingService.SetUserSetting(UserSettingConstants.SendFileTo, this.SendFileToPath);
this.userSettingService.SetUserSetting(UserSettingConstants.SendFile, this.SendFileAfterEncode);
this.userSettingService.SetUserSetting(UserSettingConstants.SendFileToArgs, this.Arguments);
+ this.userSettingService.SetUserSetting(UserSettingConstants.UseSystemColours, this.UseSystemColoursForStylesForStyles);
/* Output Files */
this.userSettingService.SetUserSetting(UserSettingConstants.AutoNaming, this.AutomaticallyNameFiles);
diff --git a/win/CS/HandBrakeWPF/ViewModels/ShellViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/ShellViewModel.cs index a64378a49..39fee77fd 100644 --- a/win/CS/HandBrakeWPF/ViewModels/ShellViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/ShellViewModel.cs @@ -15,6 +15,7 @@ namespace HandBrakeWPF.ViewModels using HandBrake.ApplicationServices.Services.Interfaces;
+ using HandBrakeWPF.Helpers;
using HandBrakeWPF.Model;
using HandBrakeWPF.Services.Interfaces;
using HandBrakeWPF.ViewModels.Interfaces;
diff --git a/win/CS/HandBrakeWPF/ViewModels/ViewModelBase.cs b/win/CS/HandBrakeWPF/ViewModels/ViewModelBase.cs index f1766741e..7a13881dc 100644 --- a/win/CS/HandBrakeWPF/ViewModels/ViewModelBase.cs +++ b/win/CS/HandBrakeWPF/ViewModels/ViewModelBase.cs @@ -13,6 +13,7 @@ namespace HandBrakeWPF.ViewModels using HandBrake.ApplicationServices.Services.Interfaces;
+ using HandBrakeWPF.Helpers;
using HandBrakeWPF.ViewModels.Interfaces;
/// <summary>
@@ -65,6 +66,17 @@ namespace HandBrakeWPF.ViewModels }
/// <summary>
+ /// Gets a value indicating whether use system colours.
+ /// </summary>
+ public bool UseSystemColours
+ {
+ get
+ {
+ return AppStyleHelper.UseSystemColours;
+ }
+ }
+
+ /// <summary>
/// Gets or sets WindowManager.
/// </summary>
public IWindowManager WindowManager { get; set; }
diff --git a/win/CS/HandBrakeWPF/Views/AudioView.xaml b/win/CS/HandBrakeWPF/Views/AudioView.xaml index 28d17d776..99e0da02c 100644 --- a/win/CS/HandBrakeWPF/Views/AudioView.xaml +++ b/win/CS/HandBrakeWPF/Views/AudioView.xaml @@ -105,17 +105,30 @@ <ListBox Grid.Row="2"
Margin="10,10,10,10"
- Background="LightGray"
dd:DragDrop.DropHandler="{Binding}"
dd:DragDrop.IsDragSource="True"
dd:DragDrop.IsDropTarget="True"
ItemsSource="{Binding Task.AudioTracks}"
SelectionMode="Extended">
+ <ListBox.Style>
+ <Style TargetType="ListBox">
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding UseSystemColours}" Value="False">
+ <Setter Property="Background" Value="LightGray" />
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </ListBox.Style>
+
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
- <Setter Property="Background" Value="WhiteSmoke" />
<Setter Property="Margin" Value="0,0,0,1" />
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding UseSystemColours}" Value="False">
+ <Setter Property="Background" Value="WhiteSmoke" />
+ </DataTrigger>
+ </Style.Triggers>
</Style>
</ListBox.ItemContainerStyle>
diff --git a/win/CS/HandBrakeWPF/Views/MainView.xaml b/win/CS/HandBrakeWPF/Views/MainView.xaml index efefca5cd..d5f211174 100644 --- a/win/CS/HandBrakeWPF/Views/MainView.xaml +++ b/win/CS/HandBrakeWPF/Views/MainView.xaml @@ -7,7 +7,6 @@ xmlns:Micro="clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro"
xmlns:attachedProperties="clr-namespace:HandBrakeWPF.AttachedProperties"
AllowDrop="True"
- Background="#FFF0F0F0"
FontSize="11"
Micro:Message.Attach="[Event Loaded] = [Action Load]"
SnapsToDevicePixels="True"
@@ -22,8 +21,7 @@ </i:EventTrigger>
</i:Interaction.Triggers>
- <UserControl.Resources>
-
+ <UserControl.Resources>
<Style TargetType="Button">
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="Padding" Value="5,1" />
@@ -46,9 +44,16 @@ <Style TargetType="ListBoxItem">
<Setter Property="Padding" Value="0,2,0,2" />
<Style.Triggers>
- <DataTrigger Binding="{Binding IsBuildIn}" Value="True">
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding IsBuildIn}" Value="True" />
+ <Condition Binding="{Binding DataContext.UseSystemColours, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}" Value="False" />
+ </MultiDataTrigger.Conditions>
<Setter Property="Foreground" Value="DarkBlue" />
- </DataTrigger>
+ </MultiDataTrigger>
+ <!--<DataTrigger Binding="{Binding IsBuildIn}" Value="True">
+ <Setter Property="Foreground" Value="DarkBlue" />
+ </DataTrigger>-->
<Trigger Property="IsSelected" Value="True">
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="Background" Value="Transparent"/>
@@ -554,9 +559,8 @@ VerticalAlignment="Stretch"
Header="Presets"
Margin="0,0,0,5"
- Background="White"
- Visibility="{Binding IsPresetPanelShowing, Converter={StaticResource boolToVisConverter}}"
- >
+ Visibility="{Binding IsPresetPanelShowing, Converter={StaticResource boolToVisConverter}}">
+
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
diff --git a/win/CS/HandBrakeWPF/Views/OptionsView.xaml b/win/CS/HandBrakeWPF/Views/OptionsView.xaml index dcf9994c8..64d7389ad 100644 --- a/win/CS/HandBrakeWPF/Views/OptionsView.xaml +++ b/win/CS/HandBrakeWPF/Views/OptionsView.xaml @@ -4,7 +4,7 @@ xmlns:Options="clr-namespace:HandBrakeWPF.Converters.Options"
xmlns:dd="clr-namespace:GongSolutions.Wpf.DragDrop;assembly=GongSolutions.Wpf.DragDrop"
xmlns:Converters="clr-namespace:HandBrakeWPF.Converters" xmlns:local="clr-namespace:HandBrakeWPF.Model"
- Background="White">
+ Style="{StaticResource whiteUserControlStyle}">
<UserControl.Resources>
<Style TargetType="Button">
@@ -133,6 +133,19 @@ </StackPanel>
</StackPanel>
+
+
+ <StackPanel Orientation="Vertical" Margin="0,0,0,20">
+
+ <TextBlock Text="User Interface" Grid.Column="0" FontSize="14" Margin="0,0,0,10"/>
+
+ <StackPanel Orientation="Vertical" Grid.Column="1" Margin="20,0,0,0">
+
+ <CheckBox Content="Always use System Colours (Requires Restart)"
+ ToolTip="Note: This option will always be on for systems with a High Contrast Theme selected." IsChecked="{Binding UseSystemColoursForStylesForStyles}" />
+
+ </StackPanel>
+ </StackPanel>
</StackPanel>
<StackPanel Name="Output" Orientation="Vertical" Margin="10,10,0,0"
diff --git a/win/CS/HandBrakeWPF/Views/ShellView.xaml b/win/CS/HandBrakeWPF/Views/ShellView.xaml index d719b16fd..ae8d26747 100644 --- a/win/CS/HandBrakeWPF/Views/ShellView.xaml +++ b/win/CS/HandBrakeWPF/Views/ShellView.xaml @@ -2,17 +2,18 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Data="clr-namespace:System.Windows.Data;assembly=PresentationFramework"
- xmlns:Converters="clr-namespace:HandBrakeWPF.Converters" Title="{Data:Binding Path=WindowTitle}"
+ xmlns:Converters="clr-namespace:HandBrakeWPF.Converters"
+ Title="{Data:Binding Path=WindowTitle}"
Width="1015"
Height="670"
MinWidth="750"
MinHeight="670"
AllowDrop="True"
- Background="#FFF0F0F0"
SnapsToDevicePixels="True"
UseLayoutRounding="True"
WindowStartupLocation="CenterScreen"
TextOptions.TextFormattingMode="Display"
+ Style="{StaticResource mainWindowStyle}"
>
<Window.Resources>
<Converters:BooleanToVisibilityConverter x:Key="boolToVisConverter" />
diff --git a/win/CS/HandBrakeWPF/Views/Styles/Styles.xaml b/win/CS/HandBrakeWPF/Views/Styles/Styles.xaml index 88624c5df..1fd0b7e94 100644 --- a/win/CS/HandBrakeWPF/Views/Styles/Styles.xaml +++ b/win/CS/HandBrakeWPF/Views/Styles/Styles.xaml @@ -1,12 +1,37 @@ <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+ <Style x:Key="mainWindowStyle" TargetType="Window">
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding UseSystemColours}" Value="False">
+ <Setter Property="Background" Value="#FFF0F0F0" />
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+
+ <Style x:Key="whiteUserControlStyle" TargetType="UserControl">
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding UseSystemColours}" Value="False">
+ <Setter Property="Background" Value="White" />
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+
<Style x:Key="{x:Type StatusBar}" TargetType="{x:Type StatusBar}">
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type StatusBar}">
- <Border Background="#FAFAFA" Padding="1">
+ <Border Padding="1">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding UseSystemColours}" Value="False">
+ <Setter Property="Background" Value="#FAFAFA" />
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
<ItemsPresenter Margin="0" />
</Border>
</ControlTemplate>
@@ -14,6 +39,14 @@ </Setter>
</Style>
+ <Style TargetType="{x:Type GroupBox}">
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding UseSystemColours}" Value="False">
+ <Setter Property="Background" Value="White" />
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+
<Style TargetType="{x:Type ComboBox}">
<Setter Property="MinHeight" Value="22"/>
<Setter Property="Margin" Value="0,2,0,2" />
diff --git a/win/CS/HandBrakeWPF/Views/SubtitlesView.xaml b/win/CS/HandBrakeWPF/Views/SubtitlesView.xaml index 2eeb5dfdf..2d6dc502a 100644 --- a/win/CS/HandBrakeWPF/Views/SubtitlesView.xaml +++ b/win/CS/HandBrakeWPF/Views/SubtitlesView.xaml @@ -54,17 +54,30 @@ <ListBox Grid.Row="2"
Margin="10,10,10,10"
- Background="LightGray"
dd:DragDrop.DropHandler="{Binding}"
dd:DragDrop.IsDragSource="True"
dd:DragDrop.IsDropTarget="True"
ItemsSource="{Binding Task.SubtitleTracks}"
SelectionMode="Extended">
+ <ListBox.Style>
+ <Style TargetType="ListBox">
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding UseSystemColours}" Value="False">
+ <Setter Property="Background" Value="LightGray" />
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </ListBox.Style>
+
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
- <Setter Property="Background" Value="WhiteSmoke" />
<Setter Property="Margin" Value="0,0,0,1" />
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding UseSystemColours}" Value="False">
+ <Setter Property="Background" Value="WhiteSmoke" />
+ </DataTrigger>
+ </Style.Triggers>
</Style>
</ListBox.ItemContainerStyle>
diff --git a/win/CS/HandBrakeWPF/defaultsettings.xml b/win/CS/HandBrakeWPF/defaultsettings.xml index 7ba21e103..30eebc778 100644 --- a/win/CS/HandBrakeWPF/defaultsettings.xml +++ b/win/CS/HandBrakeWPF/defaultsettings.xml @@ -464,4 +464,12 @@ <anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:boolean" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">true</anyType>
</value>
</item>
+ <item>
+ <key>
+ <string>UseSystemColours</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">false</anyType>
+ </value>
+ </item>
</dictionary>
\ No newline at end of file |