<UserControl x:Class="HandBrakeWPF.Views.SubtitlesDefaultsView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:cal="http://www.caliburnproject.org"
             xmlns:Converters="clr-namespace:HandBrakeWPF.Converters"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:dd="clr-namespace:GongSolutions.Wpf.DragDrop;assembly=GongSolutions.Wpf.DragDrop"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:helpers="clr-namespace:HandBrakeWPF.Helpers"
             xmlns:subtitles="clr-namespace:HandBrakeWPF.Converters.Subtitles"
             xmlns:Properties="clr-namespace:HandBrakeWPF.Properties"
             d:DesignHeight="350"
             d:DesignWidth="500"
             mc:Ignorable="d"
             x:Name="subTab">
    <UserControl.Resources>
        <Converters:BooleanToVisibilityConverter x:Key="booleanToVisConverter" />
        <subtitles:SubtitleBehaviourConverter x:Key="subtitleBehaviourConverter" />
        <subtitles:SubtitleBurnInBehaviourConverter x:Key="subtitleBurnInBehaviourConverter" />

        <Style x:Key="LongToolTip" TargetType="TextBlock">
            <Setter Property="Width" Value="400" />
            <Setter Property="TextWrapping" Value="Wrap" />
            <Setter Property="ToolTipService.ShowDuration" Value="20000" />
            <Setter Property="Margin" Value="0,2,0,2" />
        </Style>

    </UserControl.Resources>

    <Grid VerticalAlignment="Top">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>


        <!-- Row 0 -->
        <StackPanel Grid.Row="0" Grid.Column="0"  Margin="10,0,0,0">

            <Grid Margin="5,0,0,0" >
                <Grid.RowDefinitions>
                    <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="*" />
                </Grid.ColumnDefinitions>

                <!-- Subtitles -->
                <TextBlock Text="{x:Static Properties:ResourcesUI.SubtitlesView_TrackSelectionBehaviour}"  Grid.Column="2" Grid.Row="0" Margin="0,0,5,0" HorizontalAlignment="Left" VerticalAlignment="Center" />
                <ComboBox Name="autoSubtitleMode"  Grid.Column="3" Grid.Row="0" HorizontalAlignment="Left"
                          ItemsSource="{Binding SubtitleBehaviourModeList, Converter={StaticResource subtitleBehaviourConverter}}" 
                          SelectedItem="{Binding SubtitleBehaviours.SelectedBehaviour, Converter={StaticResource subtitleBehaviourConverter}}" Width="210" Margin="0,0,5,0" />
                <TextBlock Text="{x:Static Properties:ResourcesUI.SubtitlesView_BurnInBehaviour}"  Grid.Column="2" Grid.Row="1" Margin="0,5,5,0" HorizontalAlignment="Left" VerticalAlignment="Center" />
                <ComboBox Name="burninBehaviour"  Grid.Column="3" Grid.Row="1" HorizontalAlignment="Left"
                          ItemsSource="{Binding SubtitleBurnInBehaviourModeList, Converter={StaticResource subtitleBurnInBehaviourConverter}}" 
                          SelectedItem="{Binding SubtitleBehaviours.SelectedBurnInBehaviour, Converter={StaticResource subtitleBurnInBehaviourConverter}}" Width="210" Margin="0,5,5,0">
                    <ComboBox.ToolTip>
                        <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Subtitles_BurnInBehaviourModes}" />
                    </ComboBox.ToolTip>
                </ComboBox>
                <CheckBox Content="{x:Static Properties:ResourcesUI.SubtitlesView_AddCC}"  Grid.Column="3" Grid.Row="2" Margin="0,5,0,0" 
                                  HorizontalAlignment="Left" IsChecked="{Binding SubtitleBehaviours.AddClosedCaptions}"/>
                <CheckBox Content="{x:Static Properties:ResourcesUI.SubtitlesView_AddForeignAudioSearch}"  Grid.Column="3" Grid.Row="3" Margin="0,5,0,0" 
                                  HorizontalAlignment="Left" IsChecked="{Binding SubtitleBehaviours.AddForeignAudioScanTrack}"/>
            </Grid>

            <TextBlock Text="{x:Static Properties:ResourcesUI.Shared_ChooseLanguages}" Margin="5,15,0,0"/>

            <Grid Margin="20,5,0,0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>

                <StackPanel Orientation="Horizontal">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>

                        <StackPanel Orientation="Vertical" Grid.Column="0">
                            <TextBlock Text="{x:Static Properties:ResourcesUI.Shared_AvailableLanguages}" Margin="0,0,0,5"/>
                            <ListBox Name="availableLanguages" ItemsSource="{Binding AvailableLanguages}" 
                                     helpers:ListBoxHelper.SelectedItems="{Binding SelectedAvailableToMove}" 
                                             SelectionMode="Extended" Width="140" Height="120" />
                        </StackPanel>

                        <DockPanel Grid.Column="1" Margin="10,0,10,0">
                            <StackPanel Orientation="Vertical" VerticalAlignment="Center">
                                <Button Content="{x:Static Properties:ResourcesUI.Generic_MoveRight}"  VerticalAlignment="Center" Margin="0,0,0,5" cal:Message.Attach="[Event Click] = [Action LanguageMoveRight]" MaxWidth="90" />
                                <Button Content="{x:Static Properties:ResourcesUI.Generic_MoveLeft}"  VerticalAlignment="Center" Margin="0,0,0,5" cal:Message.Attach="[Event Click] = [Action LanguageMoveLeft]" MaxWidth="90" />
                                <Button Content="{x:Static Properties:ResourcesUI.Generic_Clear}" VerticalAlignment="Center" Margin="0,0,0,5" cal:Message.Attach="[Event Click] = [Action LanguageClearAll]" Width="80"/>
                            </StackPanel>
                        </DockPanel>

                        <StackPanel Orientation="Vertical" Grid.Column="2">
                            <TextBlock Text="{x:Static Properties:ResourcesUI.Shared_ChosenLangages}"  Margin="0,0,0,5"/>
                            <ListBox Name="selectedLangauges" ItemsSource="{Binding SubtitleBehaviours.SelectedLangauges}" 
                                     helpers:ListBoxHelper.SelectedItems="{Binding SelectedLangaugesToMove}" 
                                             SelectionMode="Extended" Width="140" Height="120"
                                             dd:DragDrop.DropHandler="{Binding}"
                                             dd:DragDrop.IsDragSource="True"
                                             dd:DragDrop.IsDropTarget="True"/>
                        </StackPanel>
                    </Grid>
                </StackPanel>
            </Grid>

        </StackPanel>


    </Grid>
</UserControl>
