<Window x:Class="HandBrakeWPF.Views.LogView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:Properties="clr-namespace:HandBrakeWPF.Properties"
        xmlns:converters="clr-namespace:HandBrakeWPF.Converters"
        Title="{Binding Title}"
        Width="740"
        Height="650"
        MinWidth="625"
        MinHeight="600"
        WindowStartupLocation="CenterScreen"
        TextOptions.TextFormattingMode="Display"
        PreviewKeyDown="LogView_OnPreviewKeyDown">

    <Window.Resources>
        <converters:ThemeImageConverter x:Key="themeConverter" />
    </Window.Resources>

    <Grid>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
                       
            <ToolBar Grid.Row="0"
                     ToolBar.OverflowMode="Never" 
                     ToolBarTray.IsLocked="True"
                     Loaded="ToolBarLoaded"
                     >

                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="{x:Static Properties:Resources.LogView_ChooseLogFile}" Margin="5,0,5,0"></TextBlock>
                    <ComboBox ItemsSource="{Binding LogFiles}" SelectedItem="{Binding SelectedLogFile}" DisplayMemberPath="FileDisplayName" Width="250" MaxWidth="300" />
                </StackPanel>

                <Button Command="{Binding RelayCommand}" CommandParameter="CopyLog" Margin="10,0,0,0" 
                        AutomationProperties.Name="{x:Static Properties:Resources.LogView_CopyClipboard}" >
                    <StackPanel Orientation="Horizontal">
                        <Image Width="16" Source="{Binding Converter={StaticResource themeConverter}, ConverterParameter='../Views/Images/Copy.png'}" />
                        <TextBlock Margin="2,0,0,0" Text="{x:Static Properties:Resources.LogView_CopyClipboard}" />
                    </StackPanel>
                </Button>
                <Button Margin="5,0,0,0" Command="{Binding RelayCommand}" CommandParameter="OpenLogDirectory"
                        AutomationProperties.Name="{x:Static Properties:Resources.LogView_OpenLogDir}" >
                    <StackPanel Orientation="Horizontal">
                        <Image Width="16" Source="{Binding Converter={StaticResource themeConverter}, ConverterParameter='Folder.png'}" />
                        <TextBlock Margin="2,0,0,0" Text="{x:Static Properties:Resources.LogView_OpenLogDir}" />
                    </StackPanel>
                </Button>

            </ToolBar>

            <TextBox Grid.Row="2" ScrollViewer.VerticalScrollBarVisibility="Visible" TextWrapping="Wrap" x:Name="logText" VerticalContentAlignment="Top" IsReadOnly="True">

                <TextBox.ContextMenu>
                    <ContextMenu>
                        <MenuItem Header="{x:Static Properties:Resources.LogView_CopyClipboard}" Command="{Binding RelayCommand}" CommandParameter="CopyLog" >
                            <MenuItem.Icon>
                                <Image Width="16" Source="{Binding Converter={StaticResource themeConverter}, ConverterParameter='../Views/Images/Copy.png'}" />
                            </MenuItem.Icon>
                        </MenuItem>
                        <MenuItem Header="{x:Static Properties:Resources.LogView_OpenLogDir}" Command="{Binding RelayCommand}" CommandParameter="OpenLogDirectory">
                            <MenuItem.Icon>
                                <Image Width="16" Source="{Binding Converter={StaticResource themeConverter}, ConverterParameter='../Views/Images/Folder.png'}" />
                            </MenuItem.Icon>
                        </MenuItem>
                        <Separator />
                        <MenuItem Header="{x:Static Properties:Resources.LogView_AutoScrolling}" IsCheckable="True" IsChecked="True" x:Name="AutoScroll" />
                        
                    </ContextMenu>
                </TextBox.ContextMenu>
            </TextBox>

        </Grid>

    </Grid>
</Window>
