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
178
179
|
<UserControl x:Class="HandBrakeWPF.Views.PictureSettingsView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Converters="clr-namespace:HandBrakeWPF.Converters"
xmlns:controls="clr-namespace:HandBrakeWPF.Controls"
xmlns:cal="http://www.caliburnproject.org">
<UserControl.Resources>
<Converters:BooleanConverter x:Key="boolConverter" />
<Converters:BooleanToVisibilityConverter x:Key="boolToVisConverter" />
<Converters:BooleanToHiddenVisibilityConverter x:Key="boolToVisHiddenConverter" />
<Style TargetType="controls:NumberBox">
<Setter Property="Height" Value="24" />
</Style>
</UserControl.Resources>
<Border Background="Transparent">
<Border.ContextMenu>
<ContextMenu>
<MenuItem Header="Show Still Preview (Experimental)" cal:Message.Attach="[Event Click] = [Action PreviewImage]" Visibility="Visible" />
</ContextMenu>
</Border.ContextMenu >
<Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- Size Panel-->
<StackPanel Name="SizePanel" Orientation="Vertical" VerticalAlignment="Top" Grid.Column="0" Grid.Row="0" Grid.RowSpan="1" >
<Label Content="Size" FontWeight="Bold" />
<!-- Row 1-->
<StackPanel Orientation="Horizontal" Margin="5,0,5,0">
<Label Content="Source:" />
<Label Content="{Binding SourceInfo}" Name="sourceResolution"/>
</StackPanel>
<!-- Row 2-->
<StackPanel Orientation="Horizontal" Margin="5,0,5,0">
<Label Content="Width:" />
<controls:NumberBox Number="{Binding Width, Mode=TwoWay}" UpdateBindingOnTextChange="True" IsEnabled="{Binding WidthControlEnabled}"
Modulus="{Binding SelectedModulus, Mode=OneWay}"
Minimum="0" Width="60" />
<Label Content="Height:" />
<controls:NumberBox Number="{Binding Height, Mode=TwoWay}" IsEnabled="{Binding HeightControlEnabled}" UpdateBindingOnTextChange="True"
Modulus="{Binding SelectedModulus, Mode=OneWay}"
Minimum="0" Width="60" />
<CheckBox Content="Keep Aspect Ratio" IsChecked="{Binding MaintainAspectRatio}"
Visibility="{Binding ShowKeepAR, Converter={StaticResource boolToVisHiddenConverter}}"
VerticalAlignment="Center" Margin="5,0,0,0" />
</StackPanel>
<!-- Row 3-->
<Grid Margin="5,15,5,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Label Content="Anamorphic:" Grid.Row="0" Grid.Column="0" />
<Label Content="Modulus:" Grid.Row="1" Grid.Column="0"
Visibility="{Binding ShowModulus, Converter={StaticResource boolToVisConverter}}" />
<ComboBox Width="110" Grid.Row="0" ItemsSource="{Binding AnamorphicModes}" SelectedItem="{Binding SelectedAnamorphicMode}" Grid.Column="1" HorizontalAlignment="Left" Margin="0,0,0,5" />
<ComboBox Width="110" Grid.Row="1" ItemsSource="{Binding ModulusValues}" SelectedItem="{Binding SelectedModulus}"
Visibility="{Binding ShowModulus, Converter={StaticResource boolToVisConverter}}"
Grid.Column="1" HorizontalAlignment="Left" Margin="0,0,0,5" />
</Grid>
<!-- Custom Anamoprhic -->
<Grid Margin="5,15,5,0" Visibility="{Binding ShowCustomAnamorphicControls, Converter={StaticResource boolToVisConverter}}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Label Content="Display Width:" Grid.Row="0" Grid.Column="0" />
<Label Content="PAR Width:" Grid.Row="1" Grid.Column="0" />
<Label Content="PAR Height:" Grid.Row="2" Grid.Column="0" />
<controls:NumberBox Width="60" Number="{Binding DisplayWidth, Mode=TwoWay}" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Left" Margin="0,0,0,5"
AllowEmpty="False" />
<controls:NumberBox Width="60" Number="{Binding ParWidth, Mode=TwoWay}" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Left" AllowEmpty="False"
IsEnabled="{Binding MaintainAspectRatio, Converter={StaticResource boolConverter}, ConverterParameter=true}" Margin="0,0,0,5" />
<controls:NumberBox Width="60" Number="{Binding ParHeight, Mode=TwoWay}" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Left" AllowEmpty="False"
IsEnabled="{Binding MaintainAspectRatio, Converter={StaticResource boolConverter}, ConverterParameter=true}" Margin="0,0,0,5" />
</Grid>
</StackPanel>
<!-- Crop Panel -->
<StackPanel Name="CropPanel" Margin="15,0,0,0" VerticalAlignment="Top" HorizontalAlignment="Stretch" Grid.Row="0" Grid.RowSpan="2" Grid.Column="1">
<Label Content="Cropping" FontWeight="Bold" />
<RadioButton Content="Automatic" IsChecked="{Binding IsCustomCrop, Converter={StaticResource boolConverter}, ConverterParameter=true}" Margin="10,0,0,0"/>
<RadioButton Content="Custom" IsChecked="{Binding IsCustomCrop}" Margin="10,5,0,0" />
<Grid Margin="0,10,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Label Content="Top" Grid.Row="0" Grid.Column="2" VerticalAlignment="Center" />
<Label Content="Bottom" Grid.Row="4" Grid.Column="2" VerticalAlignment="Center" />
<Label Content="Left" Grid.Row="2" Grid.Column="0" HorizontalAlignment="Center" />
<Label Content="Right" Grid.Row="2" Grid.Column="4" HorizontalAlignment="Center" />
<controls:NumberBox Width="60" HorizontalAlignment="Left" Margin="0,0,0,5" IsEnabled="{Binding IsCustomCrop}" Grid.Row="1" Grid.Column="2"
Minimum="0" Modulus="2" Number="{Binding CropTop, Mode=TwoWay}" UpdateBindingOnTextChange="True" ShowIncrementButtons="True" AllowEmpty="False" />
<controls:NumberBox Width="60" HorizontalAlignment="Left" Margin="0,0,0,5" IsEnabled="{Binding IsCustomCrop}" Grid.Row="3" Grid.Column="2"
Minimum="0" Modulus="2" Number="{Binding CropBottom, Mode=TwoWay}" UpdateBindingOnTextChange="True" ShowIncrementButtons="True" AllowEmpty="False" />
<controls:NumberBox Width="60" HorizontalAlignment="Left" Margin="0,0,0,5" IsEnabled="{Binding IsCustomCrop}" Grid.Row="2" Grid.Column="1"
Minimum="0" Modulus="2" Number="{Binding CropLeft, Mode=TwoWay}" UpdateBindingOnTextChange="True" ShowIncrementButtons="True" AllowEmpty="False" />
<controls:NumberBox Width="60" HorizontalAlignment="Left" Margin="0,0,0,5" IsEnabled="{Binding IsCustomCrop}" Grid.Row="2" Grid.Column="3"
Minimum="0" Modulus="2" Number="{Binding CropRight, Mode=TwoWay}" UpdateBindingOnTextChange="True" ShowIncrementButtons="True" AllowEmpty="False" />
</Grid>
</StackPanel>
<!-- Preview Panel -->
<StackPanel Name="PreviewPanel" Margin="0,5,0,0" VerticalAlignment="Top" HorizontalAlignment="Stretch" Grid.Row="1" Grid.Column="0">
<Label Content="Output" FontWeight="Bold" />
<Grid Margin="5,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Label Content="{Binding DisplaySize}" Grid.Row="0" Grid.Column="0" HorizontalAlignment="Left" Margin="0,0,0,5"
Visibility="{Binding ShowDisplaySize, Converter={StaticResource boolToVisConverter}}" />
<Button Content="Preview" Grid.Row="1" Margin="5,0,0,0"
cal:Message.Attach="[Event Click] = [Action PreviewImage]" HorizontalAlignment="Left" />
</Grid>
</StackPanel>
</Grid>
</Border>
</UserControl>
|