summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF/Views/MainView.xaml
blob: 347b85dacc3460684aed9fe011dfee46a4fc88d7 (plain)
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
<Window x:Class="HandBrakeWPF.Views.MainView"
        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"
        xmlns:Micro="clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro"
        xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" Title="{Data:Binding Path=WindowTitle}" Height="625" Width="1015" FontSize="11" Background="#FFF0F0F0"
        Micro:Message.Attach="[Event Loaded] = [Action Load]"
        UseLayoutRounding="True"
        AllowDrop="True">

    <i:Interaction.Triggers>
        <i:EventTrigger EventName="Drop">
            <Micro:ActionMessage MethodName="FilesDroppedOnWindow">
                <Micro:Parameter Value="$eventArgs"></Micro:Parameter>
            </Micro:ActionMessage>
        </i:EventTrigger>
    </i:Interaction.Triggers>

    <Window.Resources>

        <Style TargetType="Button">
            <Setter Property="Foreground" Value="DarkOrange" />
            <Setter Property="FontWeight" Value="Bold" />
            <Setter Property="Padding" Value="5,1" />
            <Setter Property="FontSize" Value="11.5" />
            <Setter Property="VerticalAlignment" Value="Center" />
        </Style>

        <Style x:Key="textBlockOrangeStyle" TargetType="TextBlock">
            <Setter Property="Foreground" Value="DarkOrange" />
            <Setter Property="FontWeight" Value="Bold" />
            <Setter Property="Padding" Value="5,5" />
        </Style>


        <CollectionViewSource x:Key="presetsCvs" Source="{Binding Presets}">
            <CollectionViewSource.GroupDescriptions>
                <PropertyGroupDescription PropertyName="Category"/>
            </CollectionViewSource.GroupDescriptions>
        </CollectionViewSource>

        <DataTemplate x:Key="presetsTemplate">
            <StackPanel>
                <TextBlock Text="{Binding Path=Name}"/>
            </StackPanel>
        </DataTemplate>

        <HierarchicalDataTemplate x:Key="presetsCategoryTemplate" ItemsSource="{Binding Path=Items}" 
                                  ItemTemplate="{StaticResource presetsTemplate}">
            <TextBlock Text="{Binding Path=Name}" FontWeight="Bold"/>
        </HierarchicalDataTemplate>

        <Style TargetType="TreeViewItem">
            <Setter Property="IsExpanded" Value="True" />
            <Setter Property="Padding" Value="0,2,0,2" />
            <Style.Triggers>
                <DataTrigger Binding="{Binding IsBuildIn}" Value="True">
                    <Setter Property="Foreground" Value="DarkBlue" />
                </DataTrigger>
            </Style.Triggers>
        </Style>

        <Converters:BooleanToVisibilityConverter x:Key="boolToVisConverter" />
    </Window.Resources>

    <Grid>
        <StackPanel Orientation="Vertical" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
            <!-- Menu and Taskbar-->
            <StackPanel Orientation="Vertical" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
                <!-- Main Menu -->
                <Menu Height="23" VerticalAlignment="Top" HorizontalAlignment="Stretch">
                    <MenuItem Header="File">
                        <MenuItem Header="Cancel Scan" Micro:Message.Attach="[Event Click] = [Action CancelScan]" />
                        <Separator />
                        <MenuItem Header="Exit" Micro:Message.Attach="[Event Click] = [Action ExitApplication]" />
                    </MenuItem>

                    <MenuItem Header="Tools">
                        <MenuItem Header="Show Queue" Micro:Message.Attach="[Event Click] = [Action OpenQueueWindow]" >
                            <MenuItem.Icon>
                                <Image Source="Images/Queue_Small.png" Width="16" />
                            </MenuItem.Icon>
                        </MenuItem>
                        <MenuItem Header="Activity Window" Micro:Message.Attach="[Event Click] = [Action OpenLogWindow]" >
                            <MenuItem.Icon>
                                <Image Source="Images/Output_Small.png" Width="16" />
                            </MenuItem.Icon>
                        </MenuItem>
                        <Separator />
                        <MenuItem Header="Options" Micro:Message.Attach="[Event Click] = [Action OpenOptionsWindow]" >
                            <MenuItem.Icon>
                                <Image Source="Images/Pref_Small.png" Width="16" />
                            </MenuItem.Icon>
                        </MenuItem>
                    </MenuItem>

                    <MenuItem Header="Help">
                        <MenuItem Header="HandBrake User Guide (HTTP)" Micro:Message.Attach="[Event Click] = [Action LaunchHelp]" >
                            <MenuItem.Icon>
                                <Image Source="Images/Help16.png" Width="16" />
                            </MenuItem.Icon>
                        </MenuItem>
                        <Separator />
                        <MenuItem Header="Check for Updates" Micro:Message.Attach="[Event Click] = [Action CheckForUpdates]" />
                        <Separator />
                        <MenuItem Header="About..." Micro:Message.Attach="[Event Click] = [Action OpenAboutApplication]" />
                    </MenuItem>

                    <MenuItem Header="Debug">
                        <MenuItem Header="Show CLI Equiv" Micro:Message.Attach="[Event Click] = [Action ShowCliQuery]" />
                    </MenuItem>
                </Menu>

                <!-- ToolBar -->
                <ToolBar Name="mainToolBar" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"  SnapsToDevicePixels="False">
                    <Menu Background="Transparent" >
                        <MenuItem ItemsSource="{Binding SourceToolbarMenu}">
                            <MenuItem.Header>
                                <StackPanel Orientation="Horizontal">
                                    <Image Source="Images/Movies.png" Height="32" Width="32" />
                                    <Label Content="Source"  Margin="8,0,0,0" VerticalAlignment="Center" />
                                </StackPanel>
                            </MenuItem.Header>

                        </MenuItem>
                    </Menu>

                    <Separator />

                    <Button Name="Start" Micro:Message.Attach="[Event Click] = [Action StartEncode]" Visibility="{Binding IsEncoding, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}">
                        <StackPanel Orientation="Horizontal">
                            <Image Source="Images/Play.png" Height="32" Width="32" />
                            <Label Content="Start"  Margin="8,0,0,0" VerticalAlignment="Center" />
                        </StackPanel>
                    </Button>

                    <Button Name="Stop" Micro:Message.Attach="[Event Click] = [Action StopEncode]" Visibility="{Binding IsEncoding, Converter={StaticResource boolToVisConverter}, ConverterParameter=false}">
                        <StackPanel Orientation="Horizontal">
                            <Image Source="Images/stop.png" Height="32" Width="32" SnapsToDevicePixels="True" />
                            <Label Content="Stop"  Margin="8,0,0,0" VerticalAlignment="Center" />
                        </StackPanel>
                    </Button>

                    <Button Name="AddToQueue"  Micro:Message.Attach="[Event Click] = [Action AddToQueue]">
                        <StackPanel Orientation="Horizontal">
                            <Image Source="Images/AddToQueue.png" Height="32" Width="32" SnapsToDevicePixels="True" />
                            <Label Content="Add To Queue"  Margin="8,0,0,0" VerticalAlignment="Center" />
                        </StackPanel>
                    </Button>

                    <Button Name="ShowQueue"  Micro:Message.Attach="[Event Click] = [Action OpenQueueWindow]">
                        <StackPanel Orientation="Horizontal">
                            <Image Source="Images/Queue.png" Height="32" Width="32" SnapsToDevicePixels="True" />
                            <Label Content="Show Queue"  Margin="8,0,0,0" VerticalAlignment="Center" />
                        </StackPanel>
                    </Button>

                    <Separator />

                    <Button Name="Preview" Micro:Message.Attach="[Event Click] = [Action OpenPreviewWindow]">
                        <StackPanel Orientation="Horizontal">
                            <Image Source="Images/window.png" Height="32" Width="32" SnapsToDevicePixels="True" />
                            <Label Content="Preview"  Margin="8,0,0,0" VerticalAlignment="Center" />
                        </StackPanel>
                    </Button>

                    <Button Name="ActivityWindow" Micro:Message.Attach="[Event Click] = [Action OpenLogWindow]">
                        <StackPanel Orientation="Horizontal">
                            <Image Source="Images/ActivityWindow.png" Height="32" Width="32" />
                            <Label Content="Activity Window"  Margin="8,0,0,0" VerticalAlignment="Center" />
                        </StackPanel>
                    </Button>
                </ToolBar>
            </StackPanel>

            <!-- Main Body-->
            <StackPanel Orientation="Horizontal">

                <!-- Main Controls-->
                <StackPanel Orientation="Vertical">
                    <!-- Source -->
                    <StackPanel Margin="10,5,10,5" MaxWidth="725" Width="725" HorizontalAlignment="Left">
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Source" FontWeight="Bold" />
                            <Label Content="{Binding Path=SourceLabel}" />
                        </StackPanel>

                        <StackPanel Orientation="Horizontal">
                            <Label Content="Title" Margin="8,0,0,0" />
                            <ComboBox Name="Titles" Margin="8,0,0,0" MinWidth="100" ItemsSource="{Binding ScannedSource.Titles}" SelectedItem="{Binding Path=SelectedTitle}" />

                            <Label Content="Angle" Margin="8,0,0,0" />
                            <ComboBox Name="Angles" Margin="8,0,0,0" MinWidth="60" ItemsSource="{Binding Angles}"  SelectedItem="{Binding SelectedAngle}"/>

                            <ComboBox Name="PointToPointMode" Margin="8,0,0,0" MinWidth="80" ItemsSource="{Binding RangeMode}" SelectedItem="{Binding SelectedPointToPoint}" />

                            <ComboBox Name="StartPoint" Margin="8,0,0,0" MinWidth="60" ItemsSource="{Binding StartEndRangeItems}" SelectedItem="{Binding SelectedStartPoint}"
                                      Visibility="{Binding ShowTextEntryForPointToPointMode,Converter={StaticResource boolToVisConverter}, ConverterParameter=true}"/>
                            <TextBox Name="StartPointText" Margin="8,0,0,0" MinWidth="60" Text="{Binding SelectedStartPoint}"
                                     Visibility="{Binding ShowTextEntryForPointToPointMode, Converter={StaticResource boolToVisConverter}, ConverterParameter=false}"/>

                            <Label Content="through" Margin="8,0,0,0" />
                            <ComboBox Name="EndPoint" Margin="8,0,0,0" MinWidth="60" ItemsSource="{Binding StartEndRangeItems}" SelectedItem="{Binding SelectedEndPoint}"
                                      Visibility="{Binding ShowTextEntryForPointToPointMode, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}"/>
                            <TextBox Name="EndPointText" Margin="8,0,0,0" MinWidth="60" Text="{Binding SelectedEndPoint}" 
                                     Visibility="{Binding ShowTextEntryForPointToPointMode, Converter={StaticResource boolToVisConverter}, ConverterParameter=false}" />

                            <Label Content="Duration" Margin="8,0,0,0" />
                            <Label Content="{Binding Duration}" Margin="8,0,0,0" />
                        </StackPanel>
                    </StackPanel>

                    <!-- Destination -->
                    <StackPanel Margin="10,5,10,5" MaxWidth="725" Width="725" HorizontalAlignment="Left">
                        <Label Content="Destination" FontWeight="Bold" />
                        <StackPanel Orientation="Horizontal">
                            <Label Content="File" Margin="8,0,0,0" />
                            <TextBox Name="Destination" Margin="8,0,0,0" Width="600" Text="{Binding CurrentTask.Destination}" />
                            <Button Name="DestinationBrowser" Margin="8,0,0,0" Content="Browse" Micro:Message.Attach="[Event Click] = [Action BrowseDestination]" />
                        </StackPanel>
                    </StackPanel>

                    <!-- Output Options -->
                    <StackPanel Margin="10,5,10,5" MaxWidth="725" Width="725" HorizontalAlignment="Left">
                        <Label Content="Output Settings" FontWeight="Bold" />
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Container" Margin="8,0,0,0" />
                            <ComboBox Name="Container" Margin="8,0,0,0" MinWidth="100" ItemsSource="{Binding OutputFormats}" SelectedItem="{Binding SelectedOutputFormat}" />

                            <CheckBox Name="LargeFileMp4" Content="Large File Size" IsChecked="{Binding Path=CurrentTask.LargeFile}"
                                      Visibility="{Binding IsMkv, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" VerticalAlignment="Center" Margin="8,0,0,0" />
                            <CheckBox Name="WebOptimized" Content="Web Optimized" IsChecked="{Binding Path=CurrentTask.OptimizeMP4}"
                                      Visibility="{Binding IsMkv, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" VerticalAlignment="Center" Margin="8,0,0,0" />
                            <CheckBox Name="iPod5G" Content="iPod 5G Support" IsChecked="{Binding Path=CurrentTask.IPod5GSupport}"
                                      Visibility="{Binding IsMkv, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" VerticalAlignment="Center" Margin="8,0,0,0" />
                        </StackPanel>
                    </StackPanel>

                    <!-- Tab Control -->
                    <TabControl HorizontalAlignment="Left" VerticalAlignment="Stretch" Width="725" Height="300" Margin="10,10,10,10" Name="tabControl" >
                        <TabItem Header="Picture" Name="pictureTab">
                            <ContentControl x:Name="PictureSettingsViewModel" ></ContentControl>
                        </TabItem>
                        <TabItem Header="Video Filters" Name="filtersTab">
                            <ContentControl x:Name="FiltersViewModel" ></ContentControl>
                        </TabItem>
                        <TabItem Header="Video" Name="videoTab">
                            <ContentControl x:Name="VideoViewModel" ></ContentControl>
                        </TabItem>
                        <TabItem Header="Audio" Name="audioTab">
                            <ContentControl x:Name="AudioViewModel" ></ContentControl>
                        </TabItem>
                        <TabItem Header="Subtitles" Name="subtitlesTab">
                            <ContentControl x:Name="SubtitleViewModel"></ContentControl>
                        </TabItem>
                        <TabItem Header="Chapters" Name="chaptersTab">
                            <ContentControl x:Name="ChaptersViewModel"></ContentControl>
                        </TabItem>
                        <TabItem Header="Advanced" Name="advancedTab">
                            <ContentControl x:Name="AdvancedViewModel"></ContentControl>
                        </TabItem>
                    </TabControl>

                </StackPanel>

                <!-- Presets -->
                <StackPanel Margin="5,5,5,5" Orientation="Vertical">
                    <GroupBox Header="Presets" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
                        <StackPanel Orientation="Vertical">

                            <TreeView ItemsSource="{Binding Source={StaticResource presetsCvs}, Path=Groups}" 
                                      ItemTemplate="{StaticResource presetsCategoryTemplate}" Width="240" Height="430"
                                      >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="SelectedItemChanged">
                                        <Micro:ActionMessage MethodName="SetSelectedPreset">
                                            <Micro:Parameter Value="$eventArgs"></Micro:Parameter>
                                        </Micro:ActionMessage>
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>

                            </TreeView>


                            <ToolBar Name="presetsToolBar" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" UseLayoutRounding="False" Background="Transparent" 
                                     SnapsToDevicePixels="False">
                                <Button Micro:Message.Attach="[Event Click] = [Action PresetAdd]">
                                    <Button.Content>
                                        <StackPanel Orientation="Horizontal">
                                            <Image Source="Images/Add16.png" Height="16" Width="16" />
                                            <TextBlock Text="Add" Style="{StaticResource textBlockOrangeStyle}"  Margin="2,0,0,0" VerticalAlignment="Center" />
                                        </StackPanel>
                                    </Button.Content>
                                </Button>

                                <Button Micro:Message.Attach="[Event Click] = [Action PresetRemove]">
                                    <Button.Content>
                                        <StackPanel Orientation="Horizontal">
                                            <Image Source="Images/Close.png" Height="16" Width="16" />
                                            <TextBlock Text="Remove" Style="{StaticResource textBlockOrangeStyle}"  Margin="2,0,0,0" VerticalAlignment="Center" />
                                        </StackPanel>
                                    </Button.Content>
                                </Button>

                                <Menu Background="Transparent" >
                                    <MenuItem ToolBar.OverflowMode="Never">
                                        <MenuItem.Header>
                                            <StackPanel Orientation="Horizontal">
                                                <Image Source="Images/Options24.png" Height="16" Width="16" />
                                                <TextBlock Text="Options" Style="{StaticResource textBlockOrangeStyle}" Margin="2,0,0,0" VerticalAlignment="Center" />
                                            </StackPanel>
                                        </MenuItem.Header>

                                        <MenuItem Header="Set Default" Micro:Message.Attach="[Event Click] = [Action PresetSetDefault]" />
                                        <Separator />
                                        <MenuItem Header="Import" Micro:Message.Attach="[Event Click] = [Action PresetImport]" />
                                        <MenuItem Header="Export" Micro:Message.Attach="[Event Click] = [Action PresetExport]" />
                                        <Separator />
                                        <MenuItem Header="Reset Built-in Presets" Micro:Message.Attach="[Event Click] = [Action PresetReset]" />
                                    </MenuItem>
                                </Menu>


                            </ToolBar>
                        </StackPanel>
                    </GroupBox>
                </StackPanel>

            </StackPanel>

            <!-- Status Bar -->
            <StatusBar Padding="0" Margin="0" Grid.Row="6" Height="32" Grid.ColumnSpan="2" VerticalAlignment="Bottom" >
                <Label Content="{Binding Path=StatusLabel}" FontSize="11" Padding="0,0,0,5" VerticalAlignment="Center" />

                <TextBlock VerticalAlignment="Top" HorizontalAlignment="Right" Padding="0,0,0,5" FontSize="11" FontWeight="Bold">
                    <Hyperlink NavigateUri="http://forum.handbrake.fr/viewtopic.php?f=11&amp;t=23843" RequestNavigate="Hyperlink_RequestNavigate">
                                BETA WPF UI Release Notes
                    </Hyperlink>
                </TextBlock>

            </StatusBar>

        </StackPanel>
    </Grid>
</Window>