<UserControl x:Class="HandBrakeWPF.Views.VideoView"
             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:Converters="clr-namespace:HandBrakeWPF.Converters" mc:Ignorable="d" >

    <UserControl.Resources>
        <Converters:BooleanConverter x:Key="boolConverter" />
        <Converters:BooleanToVisibilityConverter x:Key="boolToVisConverter" />
        <Converters:EnumComboConverter x:Key="enumComboConverter" />
    </UserControl.Resources>
   
    <Grid Margin="10,5,0,0">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>


        <Grid Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>

            <StackPanel Orientation="Vertical" Grid.Column="0" >

                <TextBlock Text="Video" FontWeight="Bold" Margin="0,0,0,10"/>

                <StackPanel Orientation="Horizontal" Margin="0,0,0,10" >
                    <TextBlock Text="Video Codec:" Width="100" />
                    <ComboBox Width="120" ItemsSource="{Binding VideoEncoders, Converter={StaticResource enumComboConverter}, Mode=TwoWay}" 
                              SelectedItem="{Binding SelectedVideoEncoder, Converter={StaticResource enumComboConverter}, Mode=TwoWay}" />
                </StackPanel>

                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="Franerate (FPS):" Width="100"/>
                    <StackPanel Orientation="Vertical">
                        <ComboBox Width="120" ItemsSource="{Binding Framerates}" SelectedItem="{Binding SelectedFramerate}" />
                        <RadioButton Content="Constant Framerate" IsChecked="{Binding IsConstantFramerate}" />
                        <RadioButton Content="Variable Framerate" IsChecked="{Binding IsVariableFramerate}" Visibility="{Binding ShowPeakFramerate, Converter={StaticResource boolToVisConverter}, ConverterParameter=false}" />
                        <RadioButton Content="Peak Framerate" IsChecked="{Binding IsPeakFramerate}" Visibility="{Binding ShowPeakFramerate, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" />
                    </StackPanel>
                </StackPanel>
            </StackPanel>


            <StackPanel Orientation="Vertical" Grid.Column="1" >
                <TextBlock Text="Quality" FontWeight="Bold" Margin="0,0,0,10"/>

                <StackPanel Orientation="Horizontal" Margin="0,0,0,10" >
                    <RadioButton Content="Constant Quality:" IsChecked="{Binding IsConstantQuantity}"  Margin="0,0,10,0"/>
                    <TextBlock Text="{Binding DisplayRF}" Width="25" />
                    <TextBlock Text="RF" FontWeight="Bold" />
                </StackPanel>

                <Slider Width="240" Value="{Binding RF}"  Maximum="{Binding QualityMax}" Minimum="{Binding QualityMin}"
                        IsEnabled="{Binding IsConstantQuantity}" Margin="0,0,0,20" />

                <StackPanel Orientation="Horizontal" Margin="0,0,0,10">
                    <RadioButton Content="Avg Bitrate (kbps):" IsChecked="{Binding IsConstantQuantity, Converter={StaticResource boolConverter}, ConverterParameter=true}" Margin="0,0,10,0"/>
                    <TextBox Width="75" Text="{Binding Task.VideoBitrate}" IsEnabled="{Binding IsConstantQuantity, Converter={StaticResource boolConverter}, ConverterParameter=true}" />
                </StackPanel>

                <StackPanel Orientation="Horizontal" Margin="30,0,0,0">
                    <CheckBox Content="2-Pass Encoding" IsEnabled="{Binding IsConstantQuantity, Converter={StaticResource boolConverter}, ConverterParameter=true}"
                              IsChecked="{Binding Task.TwoPass}" Margin="0,0,10,0" />
                    <CheckBox Content="Turbo first pass" IsEnabled="{Binding IsConstantQuantity, Converter={StaticResource boolConverter}, ConverterParameter=true}"
                              IsChecked="{Binding Task.TurboFirstPass}" />
                </StackPanel>

            </StackPanel>


        </Grid>

    </Grid>
</UserControl>
