<Window
    x:Class="PicView.WPF.Views.Windows.ResizeWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:buttons="clr-namespace:PicView.WPF.Views.UserControls.Buttons"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:misc="clr-namespace:PicView.WPF.Views.UserControls.Misc"
    Width="500"
    AllowDrop="False"
    AllowsTransparency="True"
    BorderBrush="{StaticResource BorderBrush}"
    BorderThickness="1"
    DataContext="{Binding RelativeSource={RelativeSource Self}}"
    FontFamily="/PicView;component/Themes/Resources/fonts/#Roboto"
    Foreground="{StaticResource MainColorBrush}"
    ResizeMode="CanMinimize"
    SizeToContent="Height"
    Style="{DynamicResource MyWindowStyle}"
    WindowStartupLocation="CenterOwner"
    WindowStyle="None"
    mc:Ignorable="d">

    <Window.Resources>
        <Style TargetType="TextBlock">
            <Setter Property="FontFamily" Value="/PicView;component/Themes/Resources/fonts/#Roboto Medium" />
            <Setter Property="Width" Value="130" />
            <Setter Property="Margin" Value="15,0,0,0" />
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="TextTrimming" Value="CharacterEllipsis" />
            <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=Text}" />
        </Style>
        <Style TargetType="ScrollBar">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ScrollBar}">
                        <Track Name="PART_Track" IsDirectionReversed="True">
                            <Track.DecreaseRepeatButton>
                                <RepeatButton Command="ScrollBar.PageUpCommand" Style="{StaticResource ScrollBarPageButtonStyle}" />
                            </Track.DecreaseRepeatButton>
                            <Track.Thumb>
                                <Thumb Style="{StaticResource VerticalScrollBarThumbStyle}" />
                            </Track.Thumb>
                            <Track.IncreaseRepeatButton>
                                <RepeatButton Command="ScrollBar.PageDownCommand" Style="{StaticResource ScrollBarPageButtonStyle}" />
                            </Track.IncreaseRepeatButton>
                        </Track>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Window.Resources>

    <DockPanel Background="{StaticResource MenuBg}">
        <DockPanel
            x:Name="TitleBar"
            Height="30"
            Background="{StaticResource WindowBackgroundColorBrush}"
            DockPanel.Dock="Top">

            <misc:Icon />

            <buttons:CloseButton
                x:Name="CloseButton"
                Width="30"
                Height="30"
                DockPanel.Dock="Right" />

            <buttons:MinButton
                x:Name="MinButton"
                Width="30"
                Height="30"
                DockPanel.Dock="Right" />

            <TextBlock
                x:Name="TitleText"
                Width="Auto"
                Margin="0,0,0,0"
                VerticalAlignment="Center"
                d:Text=" BatchResize"
                FontFamily="/PicView;component/Themes/Resources/fonts/#Roboto Bold"
                FontSize="13"
                TextAlignment="Center" />
        </DockPanel>

        <Rectangle
            Height="1"
            DockPanel.Dock="Top"
            Fill="{StaticResource BorderBrush}" />

        <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
            <StackPanel Margin="0,0,0,15">

                <StackPanel Margin="0,10,0,5" Orientation="Horizontal">
                    <TextBlock x:Name="SourceFolderTextBlock" d:Text="SourceFolder" />
                    <TextBox
                        x:Name="SourceFolderInput"
                        Width="298"
                        d:Text="B:\Pictures\new folder"
                        AllowDrop="True"
                        FontSize="11"
                        IsReadOnly="False" />
                    <buttons:FolderButton x:Name="SourceFolderButton" />
                </StackPanel>

                <StackPanel
                    Margin="0,0,0,10"
                    AllowDrop="True"
                    Orientation="Horizontal">
                    <TextBlock x:Name="OutputFolderTextBlock" d:Text="OutputFolder" />
                    <TextBox
                        x:Name="OutputFolderInput"
                        Width="298"
                        d:Text="B:\Pictures\another new folder"
                        AllowDrop="True"
                        FontSize="11"
                        IsReadOnly="False" />
                    <buttons:FolderButton x:Name="OutputFolderButton" />
                </StackPanel>

                <StackPanel Margin="0,0,0,10" Orientation="Horizontal">
                    <TextBlock x:Name="ConvertToTextBlock" d:Text=" ConvertTo" />
                    <ComboBox MinWidth="130">
                        <ComboBoxItem
                            x:Name="NoConversion"
                            d:Content="NoConversion"
                            IsSelected="True" />
                        <ComboBoxItem Name="webp" Content=".webp" />
                        <ComboBoxItem Name="jpg" Content=".jpg" />
                        <ComboBoxItem Name="png" Content=".png" />
                    </ComboBox>
                </StackPanel>

                <StackPanel Margin="0,0,0,10" Orientation="Horizontal">
                    <StackPanel.Style>
                        <Style TargetType="StackPanel">
                            <Setter Property="Visibility" Value="Visible" />
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding ElementName=webp, Path=IsSelected}" Value="True">
                                    <Setter Property="Visibility" Value="Collapsed" />
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </StackPanel.Style>
                    <TextBlock x:Name="CompressionTextBlock" d:Text=" Compression" />
                    <ComboBox MinWidth="130">
                        <ComboBoxItem
                            x:Name="LosslessCompressionChoice"
                            d:Content=" Lossless"
                            IsSelected="True" />
                        <ComboBoxItem x:Name="LossyCompressionChoice" d:Content=" Lossy" />
                        <ComboBoxItem x:Name="NoneChoice" d:Content=" None}" />
                    </ComboBox>
                </StackPanel>

                <StackPanel Orientation="Horizontal">
                    <TextBlock x:Name="QualityTextBlock" d:Text="Quality" />
                    <ComboBox
                        x:Name="QualityPercentage"
                        MinWidth="130"
                        KeyboardNavigation.DirectionalNavigation="Cycle">
                        <ComboBoxItem Content="100%" />
                        <ComboBoxItem Content="95%" />
                        <ComboBoxItem Content="90%" />
                        <ComboBoxItem Content="85%" IsSelected="True" />
                        <ComboBoxItem Content="80%" />
                        <ComboBoxItem Content="75%" />
                        <ComboBoxItem Content="70%" />
                        <ComboBoxItem Content="65%" />
                        <ComboBoxItem Content="60%" />
                        <ComboBoxItem Content="55%" />
                        <ComboBoxItem Content="50%" />
                        <ComboBoxItem Content="45%" />
                        <ComboBoxItem Content="40%" />
                        <ComboBoxItem Content="35%" />
                        <ComboBoxItem Content="30%" />
                    </ComboBox>
                </StackPanel>

                <StackPanel Margin="0,10,0,0" Orientation="Horizontal">
                    <TextBlock x:Name="ResizeTextBlock" d:Text=" Resize" />
                    <ComboBox x:Name="ResizeComboBox" Width="130">
                        <ComboBoxItem
                            x:Name="NoResize"
                            Content=" NoResize"
                            IsSelected="True" />
                        <ComboBoxItem x:Name="WidthResize" Content=" Width" />
                        <ComboBoxItem x:Name="HeightResize" Content=" Height" />
                        <ComboBoxItem x:Name="PercentageResize" Content=" Percentag}" />
                    </ComboBox>
                </StackPanel>

                <StackPanel
                    Margin="0,10,0,0"
                    d:Visibility="Visible"
                    Orientation="Horizontal">
                    <StackPanel.Style>
                        <Style TargetType="StackPanel">
                            <Setter Property="Visibility" Value="Collapsed" />
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding ElementName=WidthResize, Path=IsSelected}" Value="True">
                                    <Setter Property="Visibility" Value="Visible" />
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </StackPanel.Style>

                    <TextBlock x:Name="WidthTextBlock" d:Text=" Width" />

                    <TextBox
                        x:Name="WidthValue"
                        MinWidth="130"
                        IsReadOnly="False"
                        Text="100" />
                </StackPanel>

                <StackPanel
                    Margin="0,10,0,0"
                    d:Visibility="Visible"
                    Orientation="Horizontal">
                    <StackPanel.Style>
                        <Style TargetType="StackPanel">
                            <Setter Property="Visibility" Value="Collapsed" />
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding ElementName=HeightResize, Path=IsSelected}" Value="True">
                                    <Setter Property="Visibility" Value="Visible" />
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </StackPanel.Style>

                    <TextBlock x:Name="HeightTextBlock" d:Text=" Height" />

                    <TextBox
                        x:Name="HeightValue"
                        MinWidth="130"
                        IsReadOnly="False"
                        Text="100" />
                </StackPanel>

                <StackPanel
                    Margin="0,10,0,0"
                    d:Visibility="Visible"
                    Orientation="Horizontal">
                    <StackPanel.Style>
                        <Style TargetType="StackPanel">
                            <Setter Property="Visibility" Value="Collapsed" />
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding ElementName=PercentageResize, Path=IsSelected}" Value="True">
                                    <Setter Property="Visibility" Value="Visible" />
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </StackPanel.Style>

                    <TextBlock x:Name="PercentageTextBlock" d:Text=" Percentage" />

                    <TextBox
                        x:Name="PercentageBox"
                        Width="65"
                        IsReadOnly="False"
                        Text="90" />
                    <Label
                        Margin="4,0,0,0"
                        VerticalAlignment="Center"
                        Content="%" />
                </StackPanel>

                <StackPanel Margin="0,10,0,5" Orientation="Horizontal">

                    <TextBlock x:Name="GenerateThumbnailsTextBlock" d:Text="GenerateThumbnails" />
                    <ComboBox
                        x:Name="ThumbnailsComboBox"
                        Width="65"
                        MinWidth="65">
                        <ComboBoxItem Content="0" IsSelected="True" />
                        <ComboBoxItem Content="1" />
                        <ComboBoxItem Content="2" />
                        <ComboBoxItem Content="3" />
                        <ComboBoxItem Content="4" />
                        <ComboBoxItem Content="5" />
                        <ComboBoxItem Content="6" />
                        <ComboBoxItem Content="7" />
                    </ComboBox>
                </StackPanel>

                <ScrollViewer MaxHeight="350" Margin="15,0,0,0">

                    <ScrollViewer.Style>
                        <Style TargetType="{x:Type ScrollViewer}">
                            <Setter Property="OverridesDefaultStyle" Value="True" />
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="{x:Type ScrollViewer}">
                                        <Grid>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="*" />
                                                <ColumnDefinition Width="Auto" />
                                            </Grid.ColumnDefinitions>
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="*" />
                                                <RowDefinition Height="Auto" />
                                            </Grid.RowDefinitions>
                                            <ScrollContentPresenter Grid.RowSpan="2" Grid.ColumnSpan="2" />
                                            <ScrollBar
                                                Name="PART_VerticalScrollBar"
                                                Grid.Row="0"
                                                Grid.Column="1"
                                                Maximum="{TemplateBinding ScrollableHeight}"
                                                ViewportSize="{TemplateBinding ViewportHeight}"
                                                Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
                                                Value="{TemplateBinding VerticalOffset}" />
                                        </Grid>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </ScrollViewer.Style>
                    <StackPanel x:Name="GeneratedThumbnailsContainer" />
                </ScrollViewer>

                <TextBox
                    x:Name="LogTextBox"
                    Width="474"
                    Height="150"
                    Margin="10,12,10,0"
                    HorizontalAlignment="Center"
                    AcceptsReturn="True"
                    BorderThickness="1.5"
                    Effect="{StaticResource MenuShadowButtonBorder}"
                    MaxLines="9999"
                    Text="{Binding model.LogText, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}}"
                    TextWrapping="Wrap"
                    ToolTip="{x:Null}"
                    VerticalScrollBarVisibility="Visible" />

                <Border
                    Margin="10,11,10,0"
                    BorderBrush="{StaticResource BorderBrush}"
                    BorderThickness="1"
                    CornerRadius="2">
                    <ProgressBar
                        x:Name="ProgressBar"
                        Height="20"
                        Background="{StaticResource AltInterfaceBrush}"
                        BorderThickness="0"
                        Value="0" />
                </Border>

                <StackPanel HorizontalAlignment="Center" Orientation="Horizontal">

                    <Border
                        Margin="0,10,10,0"
                        HorizontalAlignment="Center"
                        VerticalAlignment="Center"
                        Background="{StaticResource BackgroundColorBrushAlt}"
                        BorderBrush="{StaticResource BorderBrush}"
                        BorderThickness="1"
                        CornerRadius="2"
                        Effect="{StaticResource MenuShadowButtonBorder}"
                        Focusable="False">
                        <Label
                            x:Name="StartButton"
                            Padding="20,7,20,7"
                            d:Content=" Start"
                            FontFamily="/PicView;component/Themes/Resources/fonts/#Roboto Medium">
                            <Label.Background>
                                <SolidColorBrush x:Name="StartBrush" Color="{StaticResource BackgroundColorAlt}" />
                            </Label.Background>
                            <Label.Foreground>
                                <SolidColorBrush x:Name="StartText" Color="{StaticResource MainColor}" />
                            </Label.Foreground>
                        </Label>
                    </Border>

                    <Border
                        Margin="0,10,0,0"
                        HorizontalAlignment="Center"
                        VerticalAlignment="Center"
                        Background="{StaticResource BackgroundColorBrushAlt}"
                        BorderBrush="{StaticResource BorderBrush}"
                        BorderThickness="1"
                        CornerRadius="2"
                        Effect="{StaticResource MenuShadowButtonBorder}"
                        Focusable="False">
                        <Label
                            x:Name="CancelButton"
                            Padding="10,7,10,7"
                            d:Content=" Cancel"
                            FontFamily="/PicView;component/Themes/Resources/fonts/#Roboto Medium">
                            <Label.Background>
                                <SolidColorBrush x:Name="CancelBrush" Color="{StaticResource BackgroundColorAlt}" />
                            </Label.Background>
                            <Label.Foreground>
                                <SolidColorBrush x:Name="CancelText" Color="{StaticResource MainColor}" />
                            </Label.Foreground>
                        </Label>
                    </Border>
                </StackPanel>
            </StackPanel>
        </ScrollViewer>
    </DockPanel>
</Window>