1
0
Fork 0
mirror of https://github.com/wagesj45/butterflow-ui.git synced 2024-11-14 13:43:33 -06:00
butterflow-ui/butterflow-ui/MainWindow.xaml

302 lines
25 KiB
Text
Raw Normal View History

<Window x:Class="butterflow_ui.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:System="clr-namespace:System;assembly=mscorlib"
xmlns:gu="https://github.com/JohanLarsson/Gu.Wpf.Media"
xmlns:loc="clr-namespace:butterflow_ui.Localization"
xmlns:butterflow_ui="clr-namespace:butterflow_ui"
mc:Ignorable="d"
x:Name="butterflowUIWindow"
2018-06-25 01:53:27 -05:00
Title="{x:Static loc:Localization.Title}" Height="600" Width="800">
<Window.Resources>
<ObjectDataProvider x:Key="enumRegionTypeDataProvider" MethodName="GetValues"
ObjectType="{x:Type System:Enum}">
<ObjectDataProvider.MethodParameters>
<x:Type TypeName="butterflow_ui:RegionType"/>
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
<ObjectDataProvider x:Key="enumFlowFilterTypeDataProvider" MethodName="GetValues"
ObjectType="{x:Type System:Enum}">
<ObjectDataProvider.MethodParameters>
<x:Type TypeName="butterflow_ui:FlowFilterType"/>
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
</Window.Resources>
<DockPanel>
<Menu DockPanel.Dock="Top">
2018-06-25 03:44:45 -05:00
<MenuItem Header="{x:Static loc:Localization.FileMenu}">
2018-07-01 17:02:50 -05:00
<MenuItem Header="Open">
<MenuItem.Icon>
<ContentControl Template="{StaticResource OpenIcon}" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Save Configuration">
<MenuItem.Icon>
<ContentControl Template="{StaticResource SaveIcon}" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Save Configuration As...">
<MenuItem.Icon>
<ContentControl Template="{StaticResource SaveAsIcon}" />
</MenuItem.Icon>
</MenuItem>
</MenuItem>
2018-06-25 03:44:45 -05:00
<MenuItem Header="{x:Static loc:Localization.EditMenu}" />
<MenuItem Header="{x:Static loc:Localization.HelpMenu}">
<MenuItem Header="{x:Static loc:Localization.AboutButterflowMenu}" >
<MenuItem.Icon>
<ContentControl Template="{StaticResource LinkIcon}" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="{x:Static loc:Localization.AboutButterflowUIMenu}">
<MenuItem.Icon>
<ContentControl Template="{StaticResource LinkIcon}" />
</MenuItem.Icon>
</MenuItem>
2018-06-24 23:26:28 -05:00
<Separator />
2018-06-25 03:44:45 -05:00
<MenuItem Header="{x:Static loc:Localization.AboutMenu}">
<MenuItem.Icon>
<ContentControl Template="{StaticResource QuestionIcon}" />
</MenuItem.Icon>
</MenuItem>
2018-06-24 23:26:28 -05:00
</MenuItem>
</Menu>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
2018-06-25 01:53:27 -05:00
<RowDefinition Height="0.3*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<GroupBox Grid.ColumnSpan="4" Grid.Row="0" Header="{x:Static loc:Localization.FileInputGroupBox}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Content="{x:Static loc:Localization.FileLabel}"/>
2018-07-01 17:02:50 -05:00
<TextBox Name="txtFileName" Grid.Column="1" IsReadOnly="True" Text="{Binding OptionsConfiguration.VideoInput, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged}"/>
<Button Grid.Column="2" MinWidth="25" Name="btnFilePicker" Click="btnFilePicker_Click">...</Button>
</Grid>
</GroupBox>
<GroupBox Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Header="{x:Static loc:Localization.CommonOptionsGroupBox}">
<ScrollViewer>
<StackPanel>
2018-06-24 23:26:28 -05:00
<butterflow_ui:ButterflowOption LabelValue="{x:Static loc:Localization.PlaybackRateLabel}" >
<StackPanel Orientation="Vertical">
2018-06-24 03:29:34 -05:00
<butterflow_ui:ButterflowOption LabelValue="">
<RadioButton GroupName="PlaybackRate" Checked="PlaybackRateRadioButton_Checked" Content="{x:Static loc:Localization._2xLabel}" Tag="2x" />
</butterflow_ui:ButterflowOption>
2018-06-24 03:29:34 -05:00
<butterflow_ui:ButterflowOption LabelValue="">
<RadioButton GroupName="PlaybackRate" Checked="PlaybackRateRadioButton_Checked" Content="{x:Static loc:Localization._3xLabel}" Tag="3x" />
</butterflow_ui:ButterflowOption>
2018-06-24 03:29:34 -05:00
<butterflow_ui:ButterflowOption LabelValue="">
<RadioButton GroupName="PlaybackRate" Checked="PlaybackRateRadioButton_Checked" Content="{x:Static loc:Localization._4xLabel}" Tag="4x" />
</butterflow_ui:ButterflowOption>
2018-06-24 03:29:34 -05:00
<butterflow_ui:ButterflowOption LabelValue="">
<RadioButton GroupName="PlaybackRate" Checked="PlaybackRateRadioButton_Checked" Content="{x:Static loc:Localization._24fpsLabel}" Tag="24"/>
</butterflow_ui:ButterflowOption>
2018-06-24 03:29:34 -05:00
<butterflow_ui:ButterflowOption LabelValue="">
<RadioButton GroupName="PlaybackRate" Checked="PlaybackRateRadioButton_Checked" Content="{x:Static loc:Localization._30fpsLabel}" Tag="30" />
</butterflow_ui:ButterflowOption>
2018-06-24 03:29:34 -05:00
<butterflow_ui:ButterflowOption LabelValue="">
<RadioButton GroupName="PlaybackRate" Checked="PlaybackRateRadioButton_Checked" Content="{x:Static loc:Localization._60fpsLabel}" Tag="60" />
</butterflow_ui:ButterflowOption>
2018-06-24 03:29:34 -05:00
<butterflow_ui:ButterflowOption LabelValue="">
<RadioButton GroupName="PlaybackRate" Checked="PlaybackRateRadioButton_Checked" Content="{x:Static loc:Localization._120fpsLabel}" Tag="120" />
</butterflow_ui:ButterflowOption>
2018-06-24 23:26:28 -05:00
<butterflow_ui:ButterflowOption LabelValue="{x:Static loc:Localization.CustomPlaybackRateLabel}" DescriptionValue="{x:Static loc:Localization.PlaybackRateDescription}">
<TextBox Text="{Binding OptionsConfiguration.PlaybackRate, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged}" GotFocus="TextBox_GotFocus" />
</butterflow_ui:ButterflowOption>
</StackPanel>
</butterflow_ui:ButterflowOption>
2018-06-24 23:26:28 -05:00
<butterflow_ui:ButterflowOption LabelValue="{x:Static loc:Localization.RenderingLabel}">
<StackPanel>
2018-06-25 01:53:27 -05:00
<butterflow_ui:ButterflowOption DescriptionValue="{x:Static loc:Localization.KeepAudioDescription}">
2018-06-24 23:26:28 -05:00
<CheckBox IsChecked="{Binding OptionsConfiguration.KeepAudio, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged}" Content="{x:Static loc:Localization.KeepAudioLabel}" />
</butterflow_ui:ButterflowOption>
2018-06-25 01:53:27 -05:00
<butterflow_ui:ButterflowOption DescriptionValue="Renders the video with no compression.">
2018-06-24 23:26:28 -05:00
<CheckBox IsChecked="{Binding OptionsConfiguration.LosslessQuality, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged}" Content="{x:Static loc:Localization.LosslessLabel}" />
</butterflow_ui:ButterflowOption>
</StackPanel>
</butterflow_ui:ButterflowOption>
<butterflow_ui:ButterflowOption LabelValue="{x:Static loc:Localization.ResolutionLabel}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="16 " />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<butterflow_ui:ButterflowOption Grid.Column="0" LabelValue="{x:Static loc:Localization.WidthLabel}">
<TextBox Text="{Binding OptionsConfiguration.Width, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=LostFocus}" />
</butterflow_ui:ButterflowOption>
<ToggleButton Grid.Column="1" IsChecked="{Binding OptionsConfiguration.LockAspectRatio, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged}" BorderThickness="0" Background="{x:Null}">
<ToggleButton.Style>
<Style TargetType="{x:Type ToggleButton}">
<Setter Property="Content">
<Setter.Value>
<ContentControl HorizontalAlignment="Center" Template="{StaticResource UnlockedIcon}" />
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Content">
<Setter.Value>
<ContentControl HorizontalAlignment="Center" Template="{StaticResource LockedIcon}" />
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style>
</ToggleButton.Style>
</ToggleButton>
<Button BorderThickness="0" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Click="bntVideoStop_Click">
</Button>
<butterflow_ui:ButterflowOption Grid.Column="2" LabelValue="{x:Static loc:Localization.HeightLabel}">
<TextBox Text="{Binding OptionsConfiguration.Height, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=LostFocus}" IsReadOnly="{Binding OptionsConfiguration.LockAspectRatio, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged}">
<TextBox.Style>
<Style TargetType="{x:Type TextBox}">
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlColor}}" />
<Style.Triggers>
<Trigger Property="IsReadOnly" Value="True">
<Setter Property="Background" Value="Gray" />
</Trigger>
</Style.Triggers>
</Style>
</TextBox.Style>
</TextBox>
</butterflow_ui:ButterflowOption>
</Grid>
</butterflow_ui:ButterflowOption>
</StackPanel>
</ScrollViewer>
</GroupBox>
<GroupBox Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Header="{x:Static loc:Localization.AdvancedOptionsGroupBox}">
<ScrollViewer>
<StackPanel>
<butterflow_ui:ButterflowOption LabelValue="{x:Static loc:Localization.SubregionsLabel}" DescriptionValue="{x:Static loc:Localization.SubregionsDescription}">
<ListView Name="listSubregions" MinHeight="25" ItemsSource="{Binding OptionsConfiguration.Subregions, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged}">
<ListView.ItemTemplate>
<DataTemplate>
<WrapPanel>
<TextBlock Text="{x:Static loc:Localization.StartLabel}" />
<TextBlock Text="{Binding Start, Converter={x:Static gu:TimeSpanToStringConverter.Default}}" ToolTip="{Binding Start}"/>
<TextBlock Text="{x:Static loc:Localization.EndLabel}" />
<TextBlock Text="{Binding End, Converter={x:Static gu:TimeSpanToStringConverter.Default}}" ToolTip="{Binding End}"/>
<ComboBox ItemsSource="{Binding Source={StaticResource enumRegionTypeDataProvider}}" SelectedItem="{Binding SubregionType, Mode=TwoWay}"/>
<TextBox MinWidth="35" Text="{Binding Value, Mode=TwoWay}" />
<TextBlock Text="{x:Static loc:Localization.ToEndLabel}" />
<CheckBox IsChecked="{Binding ToEnd, Mode=TwoWay}" />
</WrapPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</butterflow_ui:ButterflowOption>
<butterflow_ui:ButterflowOption DescriptionValue="{x:Static loc:Localization.KeepSubregionsTooltip}">
<CheckBox IsChecked="{Binding OptionsConfiguration.KeepSubregions, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged}" Content="{x:Static loc:Localization.KeepSubregionsLabel}" />
</butterflow_ui:ButterflowOption>
<butterflow_ui:ButterflowOption DescriptionValue="{x:Static loc:Localization.SmoothMotionTooltip}">
<CheckBox IsChecked="{Binding OptionsConfiguration.SmoothMotion, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged}" Content="{x:Static loc:Localization.SmoothMotionLabel}" />
</butterflow_ui:ButterflowOption>
<butterflow_ui:ButterflowOption DescriptionValue="{x:Static loc:Localization.FastPyramidsTooltip}">
<CheckBox IsChecked="{Binding OptionsConfiguration.FastPyramid, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged}" Content="{x:Static loc:Localization.FastPyramidsLabel}" />
</butterflow_ui:ButterflowOption>
<butterflow_ui:ButterflowOption LabelValue="{x:Static loc:Localization.PyramidScaleLabel}" DescriptionValue="{x:Static loc:Localization.PyramidScaleTooltip}">
<TextBox Text="{Binding OptionsConfiguration.PyramidScale, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=LostFocus}" />
</butterflow_ui:ButterflowOption>
<butterflow_ui:ButterflowOption LabelValue="{x:Static loc:Localization.LevelsLabel}" DescriptionValue="{x:Static loc:Localization.LevelsTooltip}">
<TextBox Text="{Binding OptionsConfiguration.Levels, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=LostFocus}" />
</butterflow_ui:ButterflowOption>
<butterflow_ui:ButterflowOption LabelValue="{x:Static loc:Localization.WindowSizeLabel}" DescriptionValue="{x:Static loc:Localization.WindowSizeTooltip}">
<TextBox Text="{Binding OptionsConfiguration.WindowSize, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=LostFocus}" />
</butterflow_ui:ButterflowOption>
<butterflow_ui:ButterflowOption LabelValue="{x:Static loc:Localization.IterationsLabel}" DescriptionValue="{x:Static loc:Localization.IterationsTooltip}">
<TextBox Text="{Binding OptionsConfiguration.Iterations, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=LostFocus}" />
</butterflow_ui:ButterflowOption>
<butterflow_ui:ButterflowOption LabelValue="{x:Static loc:Localization.PixelNeighborhoodLabel}" DescriptionValue="{x:Static loc:Localization.PixelNeighborhoodTooltip}">
<TextBox Text="{Binding OptionsConfiguration.PixelNeighborhood, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=LostFocus}" />
</butterflow_ui:ButterflowOption>
<butterflow_ui:ButterflowOption LabelValue="{x:Static loc:Localization.SmoothDerivativeLabel}" DescriptionValue="{x:Static loc:Localization.SmoothDerivativeTooltip}">
<TextBox Text="{Binding OptionsConfiguration.SmoothDerivativeStandardDeviation, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=LostFocus}" />
</butterflow_ui:ButterflowOption>
<butterflow_ui:ButterflowOption LabelValue="{x:Static loc:Localization.FlowFilterLabel}" DescriptionValue="{x:Static loc:Localization.FlowFilterTooltip}">
<ComboBox ItemsSource="{Binding Source={StaticResource enumFlowFilterTypeDataProvider}}" SelectedItem="{Binding OptionsConfiguration.FlowFilterType, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged}"/>
</butterflow_ui:ButterflowOption>
</StackPanel>
</ScrollViewer>
</GroupBox>
2018-07-01 17:02:50 -05:00
<Grid Grid.Row="1" Grid.RowSpan="2" Grid.Column="2" Grid.ColumnSpan="2">
<Grid.RowDefinitions>
<RowDefinition Height="0.3*" />
2018-07-01 17:02:50 -05:00
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<ScrollViewer VerticalScrollBarVisibility="Auto" ScrollChanged="ScrollViewer_ScrollChanged">
<TextBlock Grid.Row="0" Name="txtConsoleOutput" Background="Black" Foreground="White" TextWrapping="Wrap" Text="{Binding ButterflowWrapper.ConsoleOutput, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged}" />
</ScrollViewer>
<gu:MediaElementWrapper Grid.Row="1" Name="mediaPreview" Stretch="Uniform" ScrubbingEnabled="True" Source="{Binding OptionsConfiguration.VideoInput, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged}" MediaOpened="mediaPreview_MediaOpened" MediaEnded="mediaPreview_MediaEnded" />
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Content="{Binding ElementName=mediaPreview, Path=Position, Converter={x:Static gu:TimeSpanToStringConverter.Default}}" />
<Slider Grid.Column="1" Name="sliderMedia"
Value="{Binding ElementName=mediaPreview, Path=Position, Converter={x:Static gu:NullableTimeSpanToSecondsConverter.Default}}"
Maximum="{Binding Path=Length, ElementName=mediaPreview, Converter={x:Static gu:NullableTimeSpanToSecondsConverter.Default}}" />
<Label Grid.Column="2" Content="{Binding Path=Length, ElementName=mediaPreview, Converter={x:Static gu:TimeSpanToStringConverter.Default}}" />
</Grid>
<StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Center">
2018-07-01 17:02:50 -05:00
<Button Name="bntVideoBackward" BorderThickness="0" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Click="bntVideoBackward_Click">
<ContentControl HorizontalAlignment="Center" Template="{StaticResource BackwardIcon}" />
</Button>
<Button Name="bntVideoPlay" BorderThickness="0" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Click="bntVideoPlay_Click">
<ContentControl HorizontalAlignment="Center" Name="PlayPauseButtonIcon" Template="{StaticResource PlayIcon}" />
</Button>
<Button Name="bntVideoStop" BorderThickness="0" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Click="bntVideoStop_Click">
<ContentControl HorizontalAlignment="Center" Template="{StaticResource StopIcon}" />
</Button>
<Button Name="bntVideoForward" BorderThickness="0" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Click="bntVideoForward_Click">
<ContentControl HorizontalAlignment="Center" Template="{StaticResource ForwardIcon}" />
</Button>
<Button Name="bntClip" BorderThickness="0" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Click="bntClip_Click">
<ContentControl HorizontalAlignment="Center" Name="ClippingButtonIcon" Template="{StaticResource SnipOpenIcon}" />
</Button>
2018-07-01 17:02:50 -05:00
</StackPanel>
</Grid>
<StatusBar Grid.Row="3" Grid.ColumnSpan="4">
<StatusBar.ItemsPanel>
<ItemsPanelTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
</Grid>
</ItemsPanelTemplate>
</StatusBar.ItemsPanel>
<StatusBarItem Grid.Column="0">
<Button>
<ContentControl Template="{StaticResource CopyIcon}" />
</Button>
</StatusBarItem>
<StatusBarItem Grid.Column="1">
<TextBlock Text="{Binding OptionsConfiguration.CommandLineOutput, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}}"/>
</StatusBarItem>
</StatusBar>
</Grid>
</DockPanel>
</Window>