<Window
    BorderThickness="1"
    CanResize="False"
    CornerRadius="8"
    SizeToContent="WidthAndHeight"
    Title="Loading..."
    x:Class="PicView.Avalonia.Win32.Views.EffectsWindow"
    x:DataType="viewModels:MainViewModel"
    xmlns="https://github.com/avaloniaui"
    xmlns:customControls="clr-namespace:PicView.Avalonia.CustomControls;assembly=PicView.Avalonia"
    xmlns:main="clr-namespace:PicView.Avalonia.Views.Main;assembly=PicView.Avalonia"
    xmlns:viewModels="clr-namespace:PicView.Avalonia.ViewModels;assembly=PicView.Avalonia"
    xmlns:views="clr-namespace:PicView.Avalonia.Views;assembly=PicView.Avalonia"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <Border
        BorderBrush="{DynamicResource WindowBorderColor}"
        BorderThickness="1"
        PointerPressed="MoveWindow"
        x:Name="ParentBorder">
        <StackPanel>

            <DockPanel
                Background="{DynamicResource WindowSecondaryBackgroundColor}"
                Height="28"
                LastChildFill="True"
                x:Name="TitleBarPanel">

                <Border
                    Background="{DynamicResource WindowButtonBackgroundColor}"
                    BorderBrush="{DynamicResource MainBorderColor}"
                    BorderThickness="0,0,1,0"
                    DockPanel.Dock="Left"
                    x:Name="IconBorder">
                    <Image
                        Height="25"
                        Margin="7,1,7,1"
                        Source="{StaticResource LogoImage}"
                        Width="20" />
                </Border>

                <customControls:IconButton
                    Background="{DynamicResource WindowButtonBackgroundColor}"
                    BorderThickness="0"
                    Classes="hover"
                    Click="Close"
                    ClickMode="Release"
                    Data="{StaticResource CloseGeometry}"
                    DockPanel.Dock="Right"
                    Foreground="{DynamicResource MainTextColor}"
                    IconHeight="10"
                    IconWidth="10"
                    IsRepeatEnabled="False"
                    Width="30"
                    x:Name="CloseButton" />

                <customControls:IconButton
                    Background="{DynamicResource WindowButtonBackgroundColor}"
                    BorderBrush="{DynamicResource MainBorderColor}"
                    BorderThickness="1,0,1,0"
                    Classes="hover"
                    Click="Minimize"
                    Data="{StaticResource MinimizeGeometry}"
                    DockPanel.Dock="Right"
                    Foreground="{DynamicResource MainTextColor}"
                    IconHeight="12"
                    IconWidth="12"
                    IsRepeatEnabled="False"
                    Width="30"
                    x:Name="MinimizeButton" />

                <customControls:IconButton
                    BorderBrush="{DynamicResource MainBorderColor}"
                    BorderThickness="1,0,0,0"
                    Classes="noBorderHover"
                    ClickMode="Press"
                    Data="{StaticResource CogGeometry}"
                    DockPanel.Dock="Right"
                    Foreground="{DynamicResource MainTextColor}"
                    IconHeight="12"
                    IconWidth="12"
                    Width="30">
                    <customControls:IconButton.Flyout>
                        <MenuFlyout FlyoutPresenterClasses="noCornerRadius" Placement="Bottom">
                            <MenuItem Command="{CompiledBinding Tools.SaveFileCommand}" Header="{CompiledBinding Translation.Save.Value, Mode=OneWay}">
                                <MenuItem.Icon>
                                    <Path
                                        Data="{StaticResource SaveGeometry}"
                                        Fill="{DynamicResource MainTextColor}"
                                        Height="12"
                                        Stretch="Fill"
                                        Width="12" />
                                </MenuItem.Icon>
                            </MenuItem>
                            <MenuItem Command="{CompiledBinding Tools.SaveFileAsCommand}" Header="{CompiledBinding Translation.SaveAs.Value, Mode=OneWay}">
                                <MenuItem.Icon>
                                    <Path
                                        Data="{StaticResource SaveGeometry}"
                                        Fill="{DynamicResource MainTextColor}"
                                        Height="12"
                                        Stretch="Fill"
                                        Width="12" />
                                </MenuItem.Icon>
                            </MenuItem>
                            <MenuItem Command="{CompiledBinding Tools.CopyImageCommand}" Header="{CompiledBinding Translation.CopyImage.Value, Mode=OneWay}">
                                <MenuItem.Icon>
                                    <Path
                                        Data="{StaticResource CopyGeometry}"
                                        Fill="{DynamicResource MainTextColor}"
                                        Height="12"
                                        Stretch="Fill"
                                        Width="12" />
                                </MenuItem.Icon>
                            </MenuItem>
                            <Separator />
                            <MenuItem
                                Command="{CompiledBinding Tools.SetAsWallpaperFilledCommand}"
                                CommandParameter="{CompiledBinding PicViewer.FileInfo.Value.FullName,
                                                                   FallbackValue=''}"
                                Header="{CompiledBinding Translation.SetAsWallpaper.Value,
                                                         Mode=OneWay}"
                                IsVisible="{CompiledBinding GlobalSettings.ShowSetAsWallpaper.Value}">
                                <MenuItem.Icon>
                                    <Path
                                        Data="{StaticResource PanoramaGeometry}"
                                        Fill="{DynamicResource MainTextColor}"
                                        Height="10.40"
                                        Stretch="Fill"
                                        Width="13" />
                                </MenuItem.Icon>
                            </MenuItem>
                            <Separator IsVisible="{CompiledBinding GlobalSettings.ShowSetAsWallpaper.Value}" />
                            <MenuItem Header="{CompiledBinding Translation.ClearEffects.Value, Mode=OneWay}" x:Name="ClearEffectsItem">
                                <MenuItem.Icon>
                                    <Image
                                        Height="12"
                                        Source="{StaticResource ClearImage}"
                                        Width="12" />
                                </MenuItem.Icon>
                            </MenuItem>
                        </MenuFlyout>
                    </customControls:IconButton.Flyout>
                </customControls:IconButton>

                <TextBlock
                    Classes="txt"
                    Foreground="{DynamicResource MainTextColor}"
                    Height="28"
                    LineHeight="28"
                    Padding="30,0,0,0"
                    Text="{CompiledBinding Translation.Effects.Value,
                                           Mode=OneWay}"
                    TextAlignment="Center"
                    x:Name="TitleText" />
            </DockPanel>

            <Rectangle
                Fill="{DynamicResource WindowBorderColor}"
                Height="1"
                x:Name="BorderRectangle" />

            <main:EffectsView
                Background="{DynamicResource NoisyTexture}"
                Focusable="True"
                x:Name="EffectsView" />
        </StackPanel>
    </Border>
</Window>