diff options
Diffstat (limited to 'win')
10 files changed, 160 insertions, 26 deletions
diff --git a/win/CS/HandBrakeWPF/Converters/Subtitles/CanBurnSubtitleConverter.cs b/win/CS/HandBrakeWPF/Converters/Subtitles/CanBurnSubtitleConverter.cs new file mode 100644 index 000000000..36bd40892 --- /dev/null +++ b/win/CS/HandBrakeWPF/Converters/Subtitles/CanBurnSubtitleConverter.cs @@ -0,0 +1,47 @@ +// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="CanBurnSubtitleConverter.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> +// Subtitle Behaviour Converter +// </summary> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrakeWPF.Converters.Subtitles +{ + using System; + using System.Globalization; + using System.Windows.Data; + + using HandBrakeWPF.Services.Encode.Model; + using HandBrakeWPF.Services.Encode.Model.Models; + + public class CanBurnSubtitleConverter : IMultiValueConverter + { + + + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + if (values.Length >= 1) + { + bool sourceTrackCanBurn = (bool)values[0]; + SubtitleType type = (SubtitleType)values[1]; + EncodeTask task = values[2] as EncodeTask; + + if (task != null && OutputFormat.Mp4.Equals(task.OutputFormat) && SubtitleType.PGS.Equals(type)) + { + return false; + } + + return sourceTrackCanBurn; + } + + return true; + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj index dea2d44d0..0e2d5c5ea 100644 --- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj +++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj @@ -162,6 +162,7 @@ <Compile Include="Converters\OptionTabConverter.cs" />
<Compile Include="Converters\PresetsMenuConverter.cs" />
<Compile Include="Converters\Queue\PictureSettingsDescConveter.cs" />
+ <Compile Include="Converters\Subtitles\CanBurnSubtitleConverter.cs" />
<Compile Include="Converters\Subtitles\SubtitleBurnInBehaviourConverter.cs" />
<Compile Include="Converters\Subtitles\SubtitleBehaviourConverter.cs" />
<Compile Include="Converters\Video\VideoOptionsTooltipConverter.cs" />
diff --git a/win/CS/HandBrakeWPF/Properties/ResourcesUI.Designer.cs b/win/CS/HandBrakeWPF/Properties/ResourcesUI.Designer.cs index 089502218..4868b37f5 100644 --- a/win/CS/HandBrakeWPF/Properties/ResourcesUI.Designer.cs +++ b/win/CS/HandBrakeWPF/Properties/ResourcesUI.Designer.cs @@ -1006,6 +1006,15 @@ namespace HandBrakeWPF.Properties { }
/// <summary>
+ /// Looks up a localized string similar to Show Preview.
+ /// </summary>
+ public static string MainView_ShowPreview {
+ get {
+ return ResourceManager.GetString("MainView_ShowPreview", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Show Queue.
/// </summary>
public static string MainView_ShowQueue {
diff --git a/win/CS/HandBrakeWPF/Properties/ResourcesUI.resx b/win/CS/HandBrakeWPF/Properties/ResourcesUI.resx index 0b8c69afa..8379ecb7d 100644 --- a/win/CS/HandBrakeWPF/Properties/ResourcesUI.resx +++ b/win/CS/HandBrakeWPF/Properties/ResourcesUI.resx @@ -1019,4 +1019,7 @@ This will not affect your current settings in the Subtitle tab.</value> <data name="MainView_SaveNewPreset" xml:space="preserve">
<value>Save New Preset</value>
</data>
+ <data name="MainView_ShowPreview" xml:space="preserve">
+ <value>Show Preview</value>
+ </data>
</root>
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/Services/Encode/Model/Models/SubtitleTrack.cs b/win/CS/HandBrakeWPF/Services/Encode/Model/Models/SubtitleTrack.cs index d29709310..e481907bb 100644 --- a/win/CS/HandBrakeWPF/Services/Encode/Model/Models/SubtitleTrack.cs +++ b/win/CS/HandBrakeWPF/Services/Encode/Model/Models/SubtitleTrack.cs @@ -171,8 +171,10 @@ namespace HandBrakeWPF.Services.Encode.Model.Models if (this.sourceTrack != null) { this.Track = this.sourceTrack.ToString(); + this.SubtitleType = this.sourceTrack.SubtitleType; } - + + this.NotifyOfPropertyChange(() => this.SubtitleType); this.NotifyOfPropertyChange(() => this.CanBeBurned); this.NotifyOfPropertyChange(() => this.CanBeForced); diff --git a/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs b/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs index beceb9361..7558bc163 100644 --- a/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs +++ b/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs @@ -388,7 +388,8 @@ namespace HandBrakeWPF.Services.Scan MainTitle = titles.MainFeature == title.Index, Playlist = title.Type == 1 ? string.Format(" {0:d5}.MPLS", title.Playlist).Trim() : null, FramerateNumerator = title.FrameRate.Num, - FramerateDenominator = title.FrameRate.Den + FramerateDenominator = title.FrameRate.Den, + Type = title.Type }; int currentTrack = 1; diff --git a/win/CS/HandBrakeWPF/Services/Scan/Model/Title.cs b/win/CS/HandBrakeWPF/Services/Scan/Model/Title.cs index 32fddb36d..e60520fa7 100644 --- a/win/CS/HandBrakeWPF/Services/Scan/Model/Title.cs +++ b/win/CS/HandBrakeWPF/Services/Scan/Model/Title.cs @@ -11,10 +11,14 @@ namespace HandBrakeWPF.Services.Scan.Model { using System; using System.Collections.Generic; + using System.IO; using System.Linq; using HandBrake.ApplicationServices.Interop.Model; + using HandBrakeWPF.Model; + using HandBrakeWPF.Utilities; + /// <summary> /// An object that represents a single Title of a DVD /// </summary> @@ -123,6 +127,52 @@ namespace HandBrakeWPF.Services.Scan.Model /// </summary> public string SourceName { get; set; } + public string SourceDisplayName + { + get + { + switch (this.Type) + { + case 0: // HB_DVD_TYPE + case 1: // HB_BD_TYPE + default: + return string.Empty; + case 2: // HB_STREAM_TYPE + case 3: // HB_FF_STREAM_TYPE + return Path.GetFileNameWithoutExtension(this.SourceName); + } + } + } + + public string ItemDisplayText + { + get + { + return string.Format( + "{0}{1} ({2:00}:{3:00}:{4:00}) {5}", + this.TitleNumber, + this.Playlist, + this.Duration.Hours, + this.Duration.Minutes, + this.Duration.Seconds, + this.SourceDisplayName); + } + } + + public string ItemDisplayTextClosed + { + get + { + return string.Format( + "{0}{1} ({2:00}:{3:00}:{4:00})", + this.TitleNumber, + this.Playlist, + this.Duration.Hours, + this.Duration.Minutes, + this.Duration.Seconds); + } + } + #endregion /// <summary> diff --git a/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs index c05fda5e5..bc8ba1ce2 100644 --- a/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs @@ -576,7 +576,7 @@ namespace HandBrakeWPF.ViewModels SubtitleTrack track = new SubtitleTrack
{
- SubtitleType = SubtitleType.VobSub,
+ SubtitleType = source.SubtitleType,
SourceTrack = source,
};
diff --git a/win/CS/HandBrakeWPF/Views/MainView.xaml b/win/CS/HandBrakeWPF/Views/MainView.xaml index 9d6e28452..d8e7a27fa 100644 --- a/win/CS/HandBrakeWPF/Views/MainView.xaml +++ b/win/CS/HandBrakeWPF/Views/MainView.xaml @@ -179,20 +179,6 @@ </Button>
- <Button Name="ShowQueue" AutomationProperties.Name="Show Queue" cal:Message.Attach="[Event Click] = [Action OpenQueueWindow]">
- <StackPanel Orientation="Horizontal">
- <Image Width="32"
- Height="32"
- SnapsToDevicePixels="True"
- Source="Images/Queue_small.png"/>
- <Label Margin="8,0,0,0"
- VerticalAlignment="Center"
- Content="{Binding QueueLabel, FallbackValue='{x:Static Properties:ResourcesUI.MainView_ShowQueue}'}"/>
- </StackPanel>
- </Button>
-
- <Separator />
-
<Button Name="Start" AutomationProperties.Name="{x:Static Properties:ResourcesUI.MainView_StartEncode}"
cal:Message.Attach="[Event Click] = [Action StartEncode]"
Visibility="{Binding IsEncoding,
@@ -242,7 +228,19 @@ <Separator />
- <Button Name="Preview" AutomationProperties.Name="Preview Encode" cal:Message.Attach="[Event Click] = [Action OpenPreviewWindow]" >
+ <Button Name="ShowQueue" AutomationProperties.Name="Show Queue" cal:Message.Attach="[Event Click] = [Action OpenQueueWindow]">
+ <StackPanel Orientation="Horizontal">
+ <Image Width="32"
+ Height="32"
+ SnapsToDevicePixels="True"
+ Source="Images/Queue_small.png"/>
+ <Label Margin="8,0,0,0"
+ VerticalAlignment="Center"
+ Content="{Binding QueueLabel, FallbackValue='{x:Static Properties:ResourcesUI.MainView_ShowQueue}'}"/>
+ </StackPanel>
+ </Button>
+
+ <Button Name="Preview" AutomationProperties.Name="Preview Picture Preview Window" cal:Message.Attach="[Event Click] = [Action OpenPreviewWindow]" >
<StackPanel Orientation="Horizontal">
<Image Width="32"
Height="32"
@@ -250,7 +248,7 @@ Source="Images/picture_small.png"/>
<Label Margin="8,0,0,0"
VerticalAlignment="Center"
- Content="Preview"/>
+ Content="{x:Static Properties:ResourcesUI.MainView_ShowPreview}"/>
</StackPanel>
</Button>
@@ -306,11 +304,25 @@ <StackPanel Orientation="Horizontal" Grid.Row="1" Margin="0,5,0,0">
<Label FontWeight="Bold" Content="{x:Static Properties:ResourcesUI.MainView_Title}" />
<ComboBox Name="Titles"
- MinWidth="100"
- Margin="17,0,0,0"
- ItemsSource="{Binding ScannedSource.Titles}"
- ToolTip="{x:Static Properties:ResourcesTooltips.MainView_Title}"
- SelectedItem="{Binding Path=SelectedTitle}" />
+ Width="160"
+ Margin="17,0,0,0"
+ ItemsSource="{Binding ScannedSource.Titles}"
+ ToolTip="{x:Static Properties:ResourcesTooltips.MainView_Title}"
+ SelectedItem="{Binding Path=SelectedTitle}" >
+
+ <ComboBox.Style>
+ <Style TargetType="{x:Type ComboBox}">
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding Path=IsDropDownOpen, ElementName=Titles}" Value="True">
+ <Setter Property="DisplayMemberPath" Value="ItemDisplayText" />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding Path=IsDropDownOpen, ElementName=Titles}" Value="False">
+ <Setter Property="DisplayMemberPath" Value="ItemDisplayTextClosed" />
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </ComboBox.Style>
+ </ComboBox>
<Label Margin="8,0,0,0" FontWeight="Bold" Content="{x:Static Properties:ResourcesUI.MainView_Angle}" />
<ComboBox Name="Angles"
diff --git a/win/CS/HandBrakeWPF/Views/SubtitlesView.xaml b/win/CS/HandBrakeWPF/Views/SubtitlesView.xaml index 2268d5aaa..2d4d7492d 100644 --- a/win/CS/HandBrakeWPF/Views/SubtitlesView.xaml +++ b/win/CS/HandBrakeWPF/Views/SubtitlesView.xaml @@ -10,12 +10,14 @@ xmlns:controls="clr-namespace:HandBrakeWPF.Controls"
xmlns:splitButton="clr-namespace:HandBrakeWPF.Controls.SplitButton"
xmlns:Properties="clr-namespace:HandBrakeWPF.Properties"
+ xmlns:subtitles="clr-namespace:HandBrakeWPF.Converters.Subtitles"
d:DesignHeight="350"
d:DesignWidth="500"
mc:Ignorable="d"
x:Name="subTab">
<UserControl.Resources>
<Converters:BooleanToVisibilityConverter x:Key="booleanToVisConverter" />
+ <subtitles:CanBurnSubtitleConverter x:Key="canBurnSubtitleConverter" />
<Style x:Key="LongToolTip" TargetType="TextBlock">
<Setter Property="Width" Value="400" />
@@ -102,7 +104,7 @@ <!-- Row 2 -->
<ListBox Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2"
- Margin="10,10,10,10"
+ Margin="10,10,10,10" x:Name="subtitleListBox"
dd:DragDrop.DropHandler="{Binding}"
dd:DragDrop.IsDragSource="True"
dd:DragDrop.IsDropTarget="True"
@@ -175,7 +177,14 @@ <CheckBox Grid.Column="3" Margin="5,0,5,0" VerticalAlignment="Center" IsEnabled="{Binding CanBeForced}" IsChecked="{Binding Forced}" />
<TextBlock Grid.Column="4" VerticalAlignment="Center" FontWeight="Bold" Text="Burn In" />
- <CheckBox Grid.Column="5" Margin="5,0,5,0" VerticalAlignment="Center" IsChecked="{Binding Burned}" IsEnabled="{Binding CanBeBurned}">
+ <CheckBox Grid.Column="5" Margin="5,0,5,0" VerticalAlignment="Center" IsChecked="{Binding Burned}" x:Name="burnInCheckbox">
+ <CheckBox.IsEnabled>
+ <MultiBinding Converter="{StaticResource canBurnSubtitleConverter}">
+ <Binding Path="CanBeBurned" />
+ <Binding Path="SubtitleType" />
+ <Binding ElementName="subtitleListBox" Path="DataContext.Task" />
+ </MultiBinding>
+ </CheckBox.IsEnabled>
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<cal:ActionMessage MethodName="SetBurnedToFalseForAllExcept">
|