<Window x:Class="SpineViewer.Views.PreferenceDialog"
        xmlns:hc="https://handyorg.github.io/handycontrol"  
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:SpineViewer.Views"
        xmlns:models="clr-namespace:SpineViewer.Models"
        xmlns:vm="clr-namespace:SpineViewer.ViewModels.MainWindow"
        d:DataContext="{d:DesignInstance Type=models:PreferenceModel}"
        mc:Ignorable="d"
        Title="{DynamicResource Str_Preference}"
        Background="{DynamicResource RegionBrush}"
        Height="650" 
        Width="600"    
        ShowInTaskbar="False"
        WindowStartupLocation="CenterOwner">
    <DockPanel>
        <Border DockPanel.Dock="Bottom">
            <WrapPanel HorizontalAlignment="Center">
                <WrapPanel.Resources>
                    <Style TargetType="{x:Type Button}" BasedOn="{StaticResource ButtonDefault}">
                        <Setter Property="Margin" Value="5"/>
                        <Setter Property="Width" Value="100"/>
                    </Style>
                </WrapPanel.Resources>
                <Button Content="{DynamicResource Str_OK}" Click="ButtonOK_Click"/>
                <Button Content="{DynamicResource Str_Cancel}" Click="ButtonCancel_Click"/>
            </WrapPanel>
        </Border>

        <Border>
            <Border.Resources>
                <Style TargetType="{x:Type Label}" BasedOn="{StaticResource LabelDefault}">
                    <Setter Property="HorizontalAlignment" Value="Stretch"/>
                    <Setter Property="HorizontalContentAlignment" Value="Right"/>
                </Style>
                <Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource TextBoxBaseStyle}">
                    <Setter Property="HorizontalContentAlignment" Value="Right"/>
                </Style>
                <Style TargetType="{x:Type ComboBox}" BasedOn="{StaticResource ComboBoxBaseStyle}">
                    <Setter Property="HorizontalContentAlignment" Value="Right"/>
                </Style>
                <Style TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource MyToggleButtonBaseStyle}">
                    <Setter Property="HorizontalAlignment" Value="Right"/>
                </Style>
                <Style TargetType="{x:Type GroupBox}" BasedOn="{StaticResource MyGroupBoxBaseStyle}">
                    <Setter Property="Margin" Value="0 5 0 10"/>
                </Style>
            </Border.Resources>

            <ScrollViewer Style="{StaticResource MyVerticalScrollViewerBaseStyle}">
                <StackPanel Grid.IsSharedSizeScope="True">
                    <GroupBox Header="{DynamicResource Str_TextureLoadPreference}">
                        <StackPanel>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Label Content="{DynamicResource Str_ForcePremul}" ToolTip="{DynamicResource Str_ForcePremulTooltip}"/>
                                <ToggleButton Grid.Column="1" IsChecked="{Binding ForcePremul}" ToolTip="{DynamicResource Str_ForcePremulTooltip}"/>
                            </Grid>

                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Label Content="{DynamicResource Str_ForceNearest}"/>
                                <ToggleButton Grid.Column="1" IsChecked="{Binding ForceNearest}"/>
                            </Grid>

                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Label Content="{DynamicResource Str_ForceMipmap}" ToolTip="{DynamicResource Str_ForceMipmapTooltip}"/>
                                <ToggleButton Grid.Column="1" IsChecked="{Binding ForceMipmap}" ToolTip="{DynamicResource Str_ForceMipmapTooltip}"/>
                            </Grid>
                        </StackPanel>
                    </GroupBox>

                    <GroupBox Header="{DynamicResource Str_SpineLoadPreference}">
                        <StackPanel>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Label Content="{DynamicResource Str_IsShown}"/>
                                <ToggleButton Grid.Column="1" IsChecked="{Binding IsShown}"/>
                            </Grid>

                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Label Content="{DynamicResource Str_UsePma}"/>
                                <ToggleButton Grid.Column="1" IsChecked="{Binding UsePma}"/>
                            </Grid>

                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Label Content="{DynamicResource Str_DebugTexture}"/>
                                <ToggleButton Grid.Column="1" IsChecked="{Binding DebugTexture}"/>
                            </Grid>

                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Label Content="{DynamicResource Str_DebugBounds}"/>
                                <ToggleButton Grid.Column="1" IsChecked="{Binding DebugBounds}"/>
                            </Grid>

                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Label Content="{DynamicResource Str_DebugBones}"/>
                                <ToggleButton Grid.Column="1" IsChecked="{Binding DebugBones}"/>
                            </Grid>

                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Label Content="{DynamicResource Str_DebugRegions}"/>
                                <ToggleButton Grid.Column="1" IsChecked="{Binding DebugRegions}"/>
                            </Grid>

                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Label Content="{DynamicResource Str_DebugMeshHulls}"/>
                                <ToggleButton Grid.Column="1" IsChecked="{Binding DebugMeshHulls}"/>
                            </Grid>

                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Label Content="{DynamicResource Str_DebugMeshes}"/>
                                <ToggleButton Grid.Column="1" IsChecked="{Binding DebugMeshes}"/>
                            </Grid>

                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Label Content="{DynamicResource Str_DebugClippings}"/>
                                <ToggleButton Grid.Column="1" IsChecked="{Binding DebugClippings}"/>
                            </Grid>

                            <!-- <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Label Content="{DynamicResource Str_DebugBoundingBoxes}"/>
                                <ToggleButton Grid.Column="1" IsChecked="{Binding DebugBoundingBoxes}"/>
                            </Grid>

                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Label Content="{DynamicResource Str_DebugPaths}"/>
                                <ToggleButton Grid.Column="1" IsChecked="{Binding DebugPaths}"/>
                            </Grid>

                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Label Content="{DynamicResource Str_DebugPoints}"/>
                                <ToggleButton Grid.Column="1" IsChecked="{Binding DebugPoints}"/>
                            </Grid> -->

                        </StackPanel>
                    </GroupBox>

                    <GroupBox Header="{DynamicResource Str_AppPreference}">
                        <StackPanel>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Label Content="{DynamicResource Str_Language}"/>
                                <ComboBox Grid.Column="1" 
                                          SelectedItem="{Binding AppLanguage}"
                                          ItemsSource="{x:Static vm:PreferenceViewModel.AppLanguageOptions}"/>
                            </Grid>

                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Label Content="{DynamicResource Str_Skin}"/>
                                <ComboBox Grid.Column="1" 
                                          SelectedItem="{Binding AppSkin}"
                                          ItemsSource="{x:Static vm:PreferenceViewModel.AppSkinOptions}"/>
                            </Grid>

                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Label Content="{DynamicResource Str_RenderSelectedOnly}"/>
                                <ToggleButton Grid.Column="1" IsChecked="{Binding RenderSelectedOnly}"/>
                            </Grid>

                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Label Content="{DynamicResource Str_HitTestLevel}"/>
                                <ComboBox Grid.Column="1" 
                                          SelectedItem="{Binding HitTestLevel}"
                                          ItemsSource="{x:Static vm:PreferenceViewModel.HitTestLevelOptions}"/>
                            </Grid>

                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Label Content="{DynamicResource Str_LogHitSlots}" ToolTip="{DynamicResource Str_LogHitSlotsTooltip}"/>
                                <ToggleButton Grid.Column="1" IsChecked="{Binding LogHitSlots}" ToolTip="{DynamicResource Str_LogHitSlotsTooltip}"/>
                            </Grid>

                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Label Content="{DynamicResource Str_WallpaperView}"/>
                                <ToggleButton Grid.Column="1" IsChecked="{Binding WallpaperView}"/>
                            </Grid>

                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Label Content="{DynamicResource Str_CloseToTray}"/>
                                <ToggleButton Grid.Column="1" IsChecked="{Binding CloseToTray}"/>
                            </Grid>

                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Label Content="{DynamicResource Str_AutoRun}"/>
                                <ToggleButton Grid.Column="1" IsChecked="{Binding AutoRun}"/>
                            </Grid>
                            
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Label Content="{DynamicResource Str_AutoRunWorkspaceConfigPath}"
                                       ToolTip="{DynamicResource Str_AutoRunWorkspaceConfigPathTooltip}"/>
                                <DockPanel Grid.Column="1" IsEnabled="{Binding AutoRun}">
                                    <Button DockPanel.Dock="Right"
                                            Content="..."
                                            Command="{Binding Cmd_SelectAutoRunWorkspaceConfigPath}"/>
                                    <TextBox Grid.Column="1"
                                             Text="{Binding AutoRunWorkspaceConfigPath}"
                                             ToolTip="{DynamicResource Str_AutoRunWorkspaceConfigPathTooltip}"/>
                                </DockPanel>
                            </Grid>

                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Label Content="{DynamicResource Str_AssociateFileSuffix}"/>
                                <ToggleButton Grid.Column="1" IsChecked="{Binding AssociateFileSuffix}"/>
                            </Grid>
                        </StackPanel>
                    </GroupBox>
                </StackPanel>
            </ScrollViewer>
        </Border>
    </DockPanel>
</Window>
