<UserControl
    d:DesignHeight="450"
    d:DesignWidth="800"
    x:Class="PicView.Avalonia.Views.Main.SingleImageResizeView"
    x:DataType="viewModels:MainViewModel"
    xmlns="https://github.com/avaloniaui"
    xmlns:customControls="clr-namespace:PicView.Avalonia.CustomControls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:uc="clr-namespace:PicView.Avalonia.Views.UC"
    xmlns:viewModels="clr-namespace:PicView.Avalonia.ViewModels;assembly=PicView.Avalonia"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <UserControl.Resources>
        <SolidColorBrush Color="{DynamicResource MainTextColor}" x:Key="CancelBrush" />
        <SolidColorBrush Color="{StaticResource SecondaryTextColor}" x:Key="LinkBrush" />
    </UserControl.Resources>
    <Panel Background="{DynamicResource TertiaryBackgroundColor}" x:Name="BgPanel">
        <uc:SpinWaiter IsVisible="False" x:Name="SpinWaiter" />

        <StackPanel x:Name="ParentContainer">
            <Border x:Name="MainBorder">
                <StackPanel Margin="30">

                    <StackPanel Margin="0,5,0,30" Orientation="Horizontal">
                        <StackPanel>
                            <TextBlock
                                Classes="txt"
                                FontFamily="/Assets/Fonts/Roboto-Medium.ttf#Roboto"
                                FontSize="14"
                                Foreground="{StaticResource SecondaryTextColor}"
                                Margin="4,0,0,5"
                                Text="{CompiledBinding Translation.Width.Value,
                                                       Mode=OneWay}" />
                            <customControls:NumTextBox
                                Background="{DynamicResource SecondaryBackgroundColor}"
                                Classes="hover TStyle"
                                CornerRadius="4"
                                Foreground="{DynamicResource MainTextColor}"
                                Height="35"
                                Margin="0"
                                Text="{CompiledBinding PicViewer.PixelWidth.Value,
                                                       Mode=OneWay}"
                                ToolTip.Tip="{CompiledBinding Translation.SizeTooltip.Value,
                                                              Mode=OneWay}"
                                Width="195"
                                x:Name="PixelWidthTextBox" />
                        </StackPanel>

                        <customControls:IconButton
                            Background="Transparent"
                            Classes="altHover"
                            Foreground="{StaticResource LinkBrush}"
                            Height="35"
                            Icon="{StaticResource LinkChainImage}"
                            IconHeight="21"
                            IconWidth="21"
                            Margin="5,20,5,0"
                            Width="38"
                            x:Name="LinkChainButton" />


                        <StackPanel>
                            <TextBlock
                                Classes="txt"
                                FontFamily="/Assets/Fonts/Roboto-Medium.ttf#Roboto"
                                FontSize="14"
                                Foreground="{StaticResource SecondaryTextColor}"
                                Margin="4,0,0,5"
                                Text="{CompiledBinding Translation.Height.Value,
                                                       Mode=OneWay}" />
                            <customControls:NumTextBox
                                Background="{DynamicResource SecondaryBackgroundColor}"
                                Classes="hover TStyle"
                                CornerRadius="4"
                                Foreground="{DynamicResource MainTextColor}"
                                Height="35"
                                Margin="0"
                                Text="{CompiledBinding PicViewer.PixelHeight.Value,
                                                       Mode=OneWay}"
                                ToolTip.Tip="{CompiledBinding Translation.SizeTooltip,
                                                              Mode=OneWay}"
                                Width="195"
                                x:Name="PixelHeightTextBox" />
                        </StackPanel>
                    </StackPanel>

                    <StackPanel Orientation="Horizontal">
                        <StackPanel>
                            <TextBlock
                                Classes="txt"
                                FontFamily="/Assets/Fonts/Roboto-Medium.ttf#Roboto"
                                FontSize="14"
                                Foreground="{StaticResource SecondaryTextColor}"
                                Margin="5,0,0,2"
                                Text="{CompiledBinding Translation.Quality.Value,
                                                       Mode=OneWay}" />
                            <customControls:CustomSlider
                                IsSnapToTickEnabled="True"
                                Margin="5,0,0,2"
                                Maximum="100"
                                Minimum="1"
                                TickFrequency="1"
                                Value="90"
                                Width="190"
                                x:Name="QualitySlider" />
                            <TextBlock
                                Classes="txt"
                                Foreground="{StaticResource SecondaryTextColor}"
                                Margin="8,0,0,3"
                                Text="{Binding Path=Value, ElementName=QualitySlider}" />
                        </StackPanel>
                        <StackPanel Margin="48,0,0,0">
                            <TextBlock
                                Classes="txt"
                                FontFamily="/Assets/Fonts/Roboto-Medium.ttf#Roboto"
                                FontSize="14"
                                Foreground="{StaticResource SecondaryTextColor}"
                                Margin="5,0,0,5"
                                Text="{CompiledBinding Translation.ConvertTo.Value,
                                                       Mode=OneWay}" />
                            <ComboBox
                                Background="{DynamicResource SecondaryBackgroundColor}"
                                BorderBrush="{DynamicResource MainBorderColor}"
                                BorderThickness="1"
                                CornerRadius="4"
                                FontFamily="/Assets/Fonts/Roboto-Medium.ttf#Roboto"
                                Foreground="{DynamicResource MainTextColor}"
                                Height="30"
                                HorizontalAlignment="Right"
                                Margin="0"
                                Padding="5,7,0,7"
                                SelectedIndex="0"
                                Width="195"
                                x:Name="ConversionComboBox">
                                <ComboBoxItem Content="{CompiledBinding Translation.NoConversion.Value, Mode=OneWay}" x:Name="NoConversion" />
                                <ComboBoxItem Content=".png" x:Name="PngItem" />
                                <ComboBoxItem Content=".jpg" x:Name="JpgItem" />
                                <ComboBoxItem Content=".webp" x:Name="WebpItem" />
                                <ComboBoxItem Content=".avif" x:Name="AvifItem" />
                                <ComboBoxItem Content=".heic" x:Name="HeicItem" />
                                <ComboBoxItem Content=".jxl" x:Name="JxlItem" />
                            </ComboBox>
                        </StackPanel>
                    </StackPanel>
                </StackPanel>
            </Border>

            <StackPanel
                Background="#46252525"
                Height="80"
                Orientation="Horizontal"
                x:Name="BottomBorder">
                <Button
                    Classes="BorderStyle altHover mainBtn"
                    CornerRadius="4"
                    IsVisible="False"
                    Margin="30,0,60,0"
                    Width="195"
                    x:Name="ResetButton">
                    <TextBlock
                        Classes="txt"
                        Text="{CompiledBinding Translation.Reset.Value,
                                               Mode=OneWay}"
                        TextAlignment="Center" />
                </Button>

                <Button
                    Classes="BorderStyle altHover mainBtn"
                    CornerRadius="4"
                    Margin="30,0,60,0"
                    Width="195"
                    x:Name="CancelButton">
                    <TextBlock
                        Classes="txt"
                        Foreground="{StaticResource CancelBrush}"
                        Text="{CompiledBinding Translation.Cancel.Value,
                                               Mode=OneWay}"
                        TextAlignment="Center" />
                </Button>

                <SplitButton
                    Background="{DynamicResource AccentColor}"
                    Classes="BorderStyle accentHover mainBtn"
                    CornerRadius="4"
                    Padding="8"
                    Width="195"
                    x:Name="SaveButton">
                    <TextBlock
                        Classes="txt"
                        Foreground="{StaticResource SecondaryTextColor}"
                        Text="{CompiledBinding Translation.Save.Value,
                                               Mode=OneWay}"
                        TextAlignment="Center" />
                    <SplitButton.Flyout>
                        <MenuFlyout FlyoutPresenterClasses="noCornerRadius" Placement="Bottom">
                            <MenuItem
                                Background="Transparent"
                                Header="{CompiledBinding Translation.SaveAs.Value,
                                                         Mode=OneWay}"
                                HorizontalAlignment="Center"
                                Padding="0,6,24,6"
                                Width="195"
                                x:Name="SaveAsButton" />
                        </MenuFlyout>
                    </SplitButton.Flyout>
                </SplitButton>

            </StackPanel>
        </StackPanel>
    </Panel>
</UserControl>
