<Window x:Class="ScreenToGif.Windows.Other.Preset"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:n="clr-namespace:ScreenToGif.Controls"
        xmlns:i="clr-namespace:ScreenToGif.Controls.Items"
        xmlns:u="clr-namespace:ScreenToGif.Util"
        Title="{DynamicResource S.Preset.Title}" Width="400" Height="390" MinWidth="300" MinHeight="390" SizeToContent="Height"
        WindowStartupLocation="CenterScreen" SnapsToDevicePixels="True" Background="{DynamicResource Panel.Background}" Loaded="Window_Loaded">

    <Window.CommandBindings>
        <CommandBinding Command="{StaticResource Command.Ok}" CanExecute="Ok_CanExecute" Executed="Ok_Executed"/>
    </Window.CommandBindings>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="35"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="40"/>
        </Grid.RowDefinitions>

        <Grid Grid.Row="0" Background="{DynamicResource Panel.Background.Level4}">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="40"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>

            <Border Grid.Column="0" x:Name="IconBorder" Margin="6" Background="{StaticResource Vector.Add}" Opacity="{DynamicResource Element.Opacity}"/>

            <TextBlock Grid.Column="1" x:Name="ModeTextBlock" Text="{DynamicResource S.Add}" Margin="5" VerticalAlignment="Center" 
                       FontFamily="Segoe UI Semilight" FontSize="18" Foreground="{DynamicResource Element.Foreground.Header}"/>

            <TextBlock Grid.Column="2" x:Name="ExtensionTextBlock" Text=".mp4" Margin="5,0" Foreground="{DynamicResource Element.Foreground.Detail}" FontStyle="Italic" 
                       FontSize="12" TextWrapping="WrapWithOverflow" VerticalAlignment="Center"/>
        </Grid>

        <n:StatusBand Grid.Row="1" x:Name="StatusBand"/>

        <Grid Grid.Row="2">
            <Grid.RowDefinitions>
                <RowDefinition Height="23"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="23"/>
                <RowDefinition Height="29"/>
                <RowDefinition Height="23"/>
                <RowDefinition Height="Auto" MinHeight="29"/>
                <RowDefinition Height="23"/>
                <RowDefinition Height="29"/>
                <RowDefinition/>
            </Grid.RowDefinitions>

            <n:LabelSeparator Grid.Row="0" Text="{DynamicResource S.Preset.Encoder}"/>
            <ComboBox Grid.Row="1" x:Name="EncoderComboBox" VerticalAlignment="Center" Margin="5,3" Height="38" ItemTemplate="{StaticResource Template.ComboBox.Simple}"
                      SelectedValuePath="Value" ToolTip="{DynamicResource S.SaveAs.Encoder.Info}">
                <ComboBox.ItemContainerStyle>
                    <Style TargetType="ComboBoxItem">
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding IsEnabled}" Value="False">
                                <Setter Property="Visibility" Value="Collapsed"/>
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </ComboBox.ItemContainerStyle>

                <i:GenericItem x:Name="EncoderScreenToGifItem" Title="ScreenToGif" Description="{DynamicResource S.SaveAs.Encoder.ScreenToGif.Info}"
                               Value="{x:Static u:EncoderType.ScreenToGif}" ImageId="Vector.Logo"/>

                <i:GenericItem x:Name="EncoderFfmpegItem" Title="FFmpeg" Description="{DynamicResource S.SaveAs.Encoder.Ffmpeg.Info}"
                               Value="{x:Static u:EncoderType.FFmpeg}" ImageId="Vector.Ffmpeg"/>

                <i:GenericItem x:Name="EncoderGifskiItem" Title="Gifski" Description="{DynamicResource S.SaveAs.Encoder.Gifski.Info}"
                               Value="{x:Static u:EncoderType.Gifski}" ImageId="Vector.Gifski"/>

                <i:GenericItem x:Name="EncoderSystemItem" Title="System" Description="{DynamicResource S.SaveAs.Encoder.System.Info}"
                               Value="{x:Static u:EncoderType.System}" ImageId="Vector.Net"/>
            </ComboBox>
            
            <n:LabelSeparator Grid.Row="2" Text="{DynamicResource S.Preset.Name}"/>
            <n:ExtendedTextBox Grid.Row="3" x:Name="TitleTextBox" Margin="5,3" MaxLength="50" IsObligatory="True"/>

            <n:LabelSeparator Grid.Row="4" Text="{DynamicResource S.Preset.Description}"/>
            <n:ExtendedTextBox Grid.Row="5" x:Name="DescriptionTextBox" MinHeight="23" Margin="5,3" VerticalContentAlignment="Top" TextWrapping="Wrap" MaxLength="100"/>

            <n:LabelSeparator Grid.Row="6" Text="{DynamicResource S.Preset.Other}"/>
            <n:ExtendedCheckBox Grid.Row="7" x:Name="AutoSaveCheckBox" Text="{DynamicResource S.Preset.AutoSave}" Margin="5,3" HorizontalAlignment="Center" CheckedChanged="AutoSaveCheckBox_CheckedChanged"/>
        </Grid>

        <Grid Grid.Row="3" x:Name="InfoGrid" Margin="5,3">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>

            <Border Grid.Column="0" Width="15" Height="15" Background="{StaticResource Vector.Info}" Opacity="{DynamicResource Element.Opacity}"/>
            <TextBlock Grid.Column="1" x:Name="SaveInfoTextBlock" Text="{DynamicResource S.Preset.Info.Automatic}" Foreground="{DynamicResource Element.Foreground.Detail}" 
                       FontStyle="Italic" FontSize="12" Padding="3" TextWrapping="WrapWithOverflow"/>
        </Grid>

        <Grid Grid.Row="4" Background="{DynamicResource Panel.Background.Level3}">
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition Width="Auto" MinWidth="100"/>
                <ColumnDefinition Width="Auto" MinWidth="100"/>
            </Grid.ColumnDefinitions>

            <n:ExtendedButton Grid.Column="1" x:Name="OkButton" Text="{DynamicResource S.Ok}" Icon="{StaticResource Vector.Ok}" 
                              ContentWidth="18" ContentHeight="18" Padding="5,0" MinWidth="90" Margin="5" Command="{StaticResource Command.Ok}"/>
            <n:ExtendedButton Grid.Column="2" x:Name="CancelButton" Text="{DynamicResource S.Cancel}" Icon="{StaticResource Vector.Cancel}" 
                              ContentWidth="18" ContentHeight="18" Padding="5,0" MinWidth="90" Margin="5" Click="CancelButton_Click" IsCancel="True"/>
        </Grid>
    </Grid>
</Window>