<UserControl x:Class="FFXIV_TexTools.Views.Controls.FileWrapperControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:FFXIV_TexTools.Views.Controls" 
             xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
             xmlns:resx="clr-namespace:FFXIV_TexTools.Resources"
             mc:Ignorable="d" 
             d:DesignHeight="450" d:DesignWidth="800">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="1*"></RowDefinition>
            <RowDefinition Height="40"></RowDefinition>
            <RowDefinition Height="40"></RowDefinition>
        </Grid.RowDefinitions>
        
        <Grid Grid.Row="0" x:Name="FileControlEntry">
        </Grid>

        <Grid Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="60"></ColumnDefinition>
                <ColumnDefinition Width="1*"></ColumnDefinition>
                <ColumnDefinition Width="60"></ColumnDefinition>
                <ColumnDefinition Width="60"></ColumnDefinition>
                <ColumnDefinition Width="60"></ColumnDefinition>
            </Grid.ColumnDefinitions>


            <Button x:Name="RefreshButton" Margin="5" Grid.Column="0" IsEnabled="False" Click="RefreshButton_Click" ToolTip="[Ctrl+R] Reload the currently selected file from the Game Files/Transaction.">
                <iconPacks:Material Kind="Refresh" Height="12"/>

            </Button>


            <TextBox Grid.Column="1" IsReadOnly="True" Margin="5" TextAlignment="Center" Text="Loading File..." x:Name="FilePathBox" VerticalContentAlignment="Center"/>

            <Button Margin="5" Grid.Column="2" Click="Copy_Click" IsEnabled="{Binding Path=CopyPasteEnabled}" ToolTip="[Ctrl+C] Copy the current file to the clipboard.">
                <iconPacks:PackIconFontAwesome Kind="CopySolid" Height="12"/>
            </Button>
            <Button Margin="5" Grid.Column="3" Click="Paste_Click" IsEnabled="{Binding Path=CopyPasteEnabled}" ToolTip="[Ctrl+V] Paste the current file from the clipboard.">
                <iconPacks:PackIconFontAwesome Kind="PasteSolid" Height="12"/>
            </Button>
            
            <Button x:Name="PopOutButton" Margin="5" Grid.Column="4" IsEnabled="false" Click="PopOut_Click" ToolTip="[Ctrl+Q] Pop this file out in a new window.">
                <iconPacks:PackIconFontAwesome Kind="ExternalLinkSquareAltSolid" Height="12"/>
            </Button>
        </Grid>

        <Grid Grid.Row="2" x:Name="ButtonRow">
            <Grid.ColumnDefinitions>
                <ColumnDefinition></ColumnDefinition>
                <ColumnDefinition></ColumnDefinition>
                <ColumnDefinition></ColumnDefinition>
                <ColumnDefinition></ColumnDefinition>
                <ColumnDefinition Width="60"></ColumnDefinition>
            </Grid.ColumnDefinitions>

            <Grid x:Name="SaveAsGrid" Margin="5" Grid.Column="0" ToolTip="{Binding Source={x:Static resx:UIStrings.SaveAsTooltip}}">
                <Button x:Name="SaveAsButton" Grid.Column="0" Click="SaveAs_Click">
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding Source={x:Static resx:UIStrings.SaveAs}}" />
                    </StackPanel>
                </Button>
                <Button Width="32" HorizontalAlignment="Right" BorderBrush="Transparent" Click="SaveAsDropdown_Click">
                    <iconPacks:PackIconFontAwesome Kind="CaretDownSolid" Height="4"/>
                </Button>
                <Line Y1="0" Y2="1" StrokeThickness="1" Stroke="Black" Stretch="Fill" Margin="0, 6, 32, 6" HorizontalAlignment="Right" Opacity="0.25"/>

                <Grid.ContextMenu>
                    <ContextMenu x:Name="SaveAsContextMenu">
                    </ContextMenu>
                </Grid.ContextMenu>
            </Grid>
            
            <Button Margin="5" Grid.Column="1" x:Name="LoadButton" Content="{Binding Source={x:Static resx:UIStrings.Load}}" Click="Load_Click" ToolTip="{Binding Source={x:Static resx:UIStrings.LoadTooltip}}"/>

            <Button Margin="5" Grid.Column="2" x:Name="EnableDisableButton" Content="{Binding Path=EnableDisableText, FallbackValue=Enable}" Click="EnableDisable_Click" ToolTip="{Binding Source={x:Static resx:UIStrings.EnableDisableTooltip}}" IsEnabled="{Binding Path=EnableDisableEnabled}"/>


            <Grid Grid.Column="3" Margin="5" ToolTip="{Binding Path=SaveTooltip}" IsEnabled="{Binding Path=SaveEnabled}" >
                <Button x:Name="SaveButton" Click="Save_Click">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition></ColumnDefinition>
                            <ColumnDefinition></ColumnDefinition>
                        </Grid.ColumnDefinitions>

                        <TextBlock x:Name="SaveText" Text="SAVE TO FFXIV" HorizontalAlignment="Right" Grid.Column="0"/>
                        <TextBlock Text="{Binding Path=UnsavedChangesText, FallbackValue=(!)}" FontWeight="Bold" Foreground="#FFC80000" HorizontalAlignment="Left" Grid.Column="1"/>
                    </Grid>
                </Button>

                <Button Width="32" HorizontalAlignment="Right" BorderBrush="Transparent" Click="SaveDropdown_Click" Visibility="{Binding Path=SaveDropdownVisibility}">
                    <iconPacks:PackIconFontAwesome Kind="CaretDownSolid" Height="4"/>
                </Button>
                <Line Y1="0" Y2="1" StrokeThickness="1" Stroke="Black" Stretch="Fill" Margin="0, 6, 32, 6" HorizontalAlignment="Right" Opacity="0.25" Visibility="{Binding Path=SaveDropdownVisibility}"/>

                <Grid.ContextMenu>
                    <ContextMenu x:Name="SaveContextMenu">
                    </ContextMenu>
                </Grid.ContextMenu>
            </Grid>

            <Button x:Name="OpenFolderButton" Margin="5" Grid.Column="5" IsEnabled="True" Click="OpenFolder_Click" ToolTip="Show this file's default save directory.">
                <iconPacks:PackIconFontAwesome Kind="FolderOpenRegular" Height="12"/>
            </Button>
        </Grid>

    </Grid>
</UserControl>
