1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
|
<UserControl x:Class="HandBrakeWPF.Views.AudioView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:cal="http://www.caliburnproject.org"
xmlns:NumericUpDown="clr-namespace:EagleBoost.Wpf.Presentation.Controls.NumericUpDown;assembly=EagleBoost.Wpf.Presentation"
xmlns:Conveters="clr-namespace:HandBrakeWPF.Converters"
xmlns:dd="clr-namespace:GongSolutions.Wpf.DragDrop;assembly=GongSolutions.Wpf.DragDrop"
xmlns:Audio="clr-namespace:HandBrakeWPF.Converters.Audio" mc:Ignorable="d">
<UserControl.Resources>
<Conveters:EnumComboConverter x:Key="enumComboConverter" />
<Conveters:BooleanToVisibilityConverter x:Key="boolToVisConverter" />
<Conveters:BooleanToHiddenVisibilityConverter x:Key="boolToHiddenVisConverter" />
<Audio:AudioBitrateConverter x:Key="audioBitrateConverter" />
<Audio:AudioEncoderConverter x:Key="audioEncoderConverter" />
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Text="Audio Tracks" FontWeight="Bold" Margin="10,5,0,0" Grid.Row="0" ></TextBlock>
<Grid Grid.Row="1" Margin="10,5,10,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Button Content="Add Track" cal:Message.Attach="[Event Click] = [Action Add]" Grid.Column="0" Width="75" Margin="0,0,10,0" />
<StackPanel Orientation="Horizontal" Grid.Column="2" Visibility="{Binding ShowPassthruOptions, Converter={StaticResource boolToVisConverter}}" >
<TextBlock Text="Auto Passthru:" Margin="5,0,5,0" />
<CheckBox Content="MP3" Margin="0,0,5,0" IsChecked="{Binding Task.AllowedPassthruOptions.AudioAllowMP3Pass}" />
<CheckBox Content="AAC" Margin="0,0,5,0" IsChecked="{Binding Task.AllowedPassthruOptions.AudioAllowAACPass}" />
<CheckBox Content="AC3" Margin="0,0,5,0" IsChecked="{Binding Task.AllowedPassthruOptions.AudioAllowAC3Pass}" />
<CheckBox Content="DTS" Margin="0,0,5,0" IsChecked="{Binding Task.AllowedPassthruOptions.AudioAllowDTSPass}" />
<CheckBox Content="DTSHD" Margin="0,0,5,0" IsChecked="{Binding Task.AllowedPassthruOptions.AudioAllowDTSHDPass}" />
<TextBlock Text="Fallback:" Margin="5,0,5,0" />
<ComboBox Width="100" Grid.Column="3" Margin="10,0,5,0" Height="22"
ItemsSource="{Binding DataContext.AudioEncoders, Converter={StaticResource enumComboConverter}, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}"
SelectedItem="{Binding Task.AllowedPassthruOptions.AudioEncoderFallback, Converter={StaticResource enumComboConverter}}"/>
</StackPanel>
</Grid>
<ListBox Grid.Row="2" ItemsSource="{Binding Task.AudioTracks}"
SelectionMode="Extended" Background="LightGray" Margin="10,10,10,10"
dd:DragDrop.IsDragSource="True" dd:DragDrop.IsDropTarget="True"
dd:DragDrop.DropHandler="{Binding}">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
<Setter Property="Background" Value="WhiteSmoke" />
<Setter Property="Margin" Value="0,0,0,1" />
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<Grid HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<!-- Marker -->
<Image Source="Images/Movies.png" Width="16" Height="16" Grid.Column="0" Margin="10,0,10,0" />
<!-- Settings -->
<Grid Grid.Column="1" HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="28" />
<RowDefinition Height="28" />
</Grid.RowDefinitions>
<!-- Row 1-->
<TextBlock Text="Source" FontWeight="Bold" Grid.Column="0" VerticalAlignment="Center" />
<ComboBox Width="100" Grid.Column="1" Margin="5,0,5,0" Height="22"
ItemsSource="{Binding DataContext.SourceTracks, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}"
SelectedItem="{Binding ScannedTrack}"/>
<TextBlock Text="Codec" FontWeight="Bold" Grid.Column="2" VerticalAlignment="Center" />
<ComboBox Width="100" Grid.Column="3" Margin="5,0,5,0" Height="22">
<ComboBox.SelectedItem>
<MultiBinding Converter="{StaticResource audioEncoderConverter}">
<Binding Path="Encoder" />
</MultiBinding>
</ComboBox.SelectedItem>
<ComboBox.ItemsSource>
<MultiBinding Converter="{StaticResource audioEncoderConverter}">
<Binding Path="DataContext.AudioEncoders"
RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type UserControl}}" />
<Binding Path="DataContext.Task"
RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type UserControl}}" />
</MultiBinding>
</ComboBox.ItemsSource>
</ComboBox>
<TextBlock Text="Bitrate" FontWeight="Bold" Grid.Column="4" VerticalAlignment="Center"
Visibility="{Binding IsPassthru, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" />
<ComboBox Width="70" Grid.Column="5" Margin="5,0,5,0" Height="22"
SelectedItem="{Binding Bitrate}"
ItemsSource="{Binding TrackReference, Converter={StaticResource audioBitrateConverter}}"
Visibility="{Binding IsPassthru, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" />
<TextBlock Text="Samplerate" FontWeight="Bold" Grid.Column="6" VerticalAlignment="Center"
Visibility="{Binding IsPassthru, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" />
<ComboBox Width="70" Grid.Column="7" Margin="5,0,5,0" Height="22"
ItemsSource="{Binding DataContext.SampleRates, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}"
SelectedItem="{Binding SampleRateDisplayValue}"
Visibility="{Binding IsPassthru, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" />
<!-- Row 2-->
<TextBlock Text="Mixdown" FontWeight="Bold" Grid.Column="0" Grid.Row="1" VerticalAlignment="Center"
Visibility="{Binding IsPassthru, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" />
<ComboBox Width="100" Grid.Column="1" Margin="5,0,5,0" Grid.Row="1" Height="22"
ItemsSource="{Binding DataContext.AudioMixdowns, Converter={StaticResource enumComboConverter}, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}"
SelectedItem="{Binding MixDown, Converter={StaticResource enumComboConverter}}"
Visibility="{Binding IsPassthru, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" />
<TextBlock Text="DRC" FontWeight="Bold" Grid.Column="2" Grid.Row="1" VerticalAlignment="Center"
Visibility="{Binding IsPassthru, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" />
<NumericUpDown:NumericUpDown Name="drcNumericCtl" Width="45" Value="{Binding DRC, Mode=TwoWay}" Grid.Row="1" Grid.Column="3" HorizontalAlignment="Left" Margin="5,0,5,0"
Minimum="0" Maximum="4" DecimalPlace="1" LargeChange="0.1" SmallChange="0.1"
Visibility="{Binding IsPassthru, Converter={StaticResource boolToHiddenVisConverter}, ConverterParameter=true}" />
<TextBlock Text="Gain" FontWeight="Bold" Grid.Column="4" Grid.Row="1" VerticalAlignment="Center"
Visibility="{Binding IsPassthru, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" />
<NumericUpDown:NumericUpDown Name="gainNumericCtl" Width="45" Value="{Binding Gain, Mode=TwoWay}" Grid.Row="1" Grid.Column="5" HorizontalAlignment="Left" Margin="5,0,5,0"
Minimum="-20" Maximum="20" DecimalPlace="0" SmallChange="1" LargeChange="1"
Visibility="{Binding IsPassthru, Converter={StaticResource boolToHiddenVisConverter}, ConverterParameter=true}"/>
</Grid>
<!-- Delete -->
<Image Source="Images/delete.png" Width="16" Height="16" Grid.Column="2" Margin="10,0,10,0">
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseDown">
<cal:ActionMessage MethodName="Remove">
<cal:Parameter Value="{Binding}" />
</cal:ActionMessage>
</i:EventTrigger>
</i:Interaction.Triggers>
</Image>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</UserControl>
|