<?xml version="1.0" encoding="UTF-8"?>
<!--
    This file is part of QTTabBar, a shell extension for Microsoft
    Windows Explorer.
    Copyright (C) 2007-2021  Quizo, Paul Accisano

    QTTabBar is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    QTTabBar is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with QTTabBar.  If not, see <http://www.gnu.org/licenses/>.
-->

<qt:OptionsDialogTab
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:qt="clr-namespace:QTTabBarLib"
    x:Class="QTTabBarLib.Options06_Appearance"
    x:ClassModifier="internal"
    DataContext="{Binding Path=WorkingConfig.skin, RelativeSource={RelativeSource Self}}">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="OptionsDialogResources.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>

    <StackPanel
        Margin="14,5,10,0"
        Orientation="Vertical">
        <StackPanel
            Margin="0,0,0,4"
            Orientation="Horizontal">
            <Image
                Source="{Binding Source={x:Static qt:Resources_Image.imgTabSkin}, Converter={StaticResource BitmapToImageSourceConverter}}"
                Style="{StaticResource PageHeaderImageStyle}"/>
            <Label
                Content="{qt:Resx Key=Options_Page06_Appearance, Index=0}"
                FontSize="13"
                VerticalAlignment="Bottom"/>
        </StackPanel>
        <Label
            Content="{qt:Resx Key=Options_Page06_Appearance, Index=1}"
            Style="{StaticResource SectionHeaderStyle}"/>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <CheckBox x:Name="chkUseTabSkin"
                Content="{qt:Resx Key=Options_Page06_Appearance, Index=2}"
                Height="16"
                IsChecked="{Binding Path=UseTabSkin}"
                Margin="0,0,5,0"/>
            <qt:FileFolderEntryBox
                FilterText="{qt:Resx Key=FileFilters, Index=0}"
                FilterExtensions="*.png;*.bmp;*.jpg;*.gif"
                Folder="False"
                Grid.Column="1"
                Grid.ColumnSpan="3"
                Margin="5,1"
                SelectedPath="{Binding Path=TabImageFile}"/>
            <Label
                Content="{qt:Resx Key=Options_Page06_Appearance, Index=3}"
                Grid.Row="1"
                Height="16"
                Margin="18,0,5,0"
                Padding="0"/>
            <qt:MarginCombo
                Grid.Column="1"
                Grid.Row="1"
                HorizontalAlignment="Left"
                Margin="5,1"
                Value="{Binding Path=TabSizeMargin}"
                Width="120"/>
            <Label
                Content="{qt:Resx Key=Options_Page06_Appearance, Index=4}"
                Grid.Column="2"
                Grid.Row="1"
                Height="16"
                Margin="18,0,5,0"
                Padding="0"/>
            <qt:Spinner
                Grid.Column="3"
                Grid.Row="1"
                HorizontalAlignment="Left"
                Margin="5,1"
                Max="20"
                Min="0"
                Value="{Binding Path=OverlapPixels}"
                Width="80"/>
            <Label
                Content="{qt:Resx Key=Options_Page06_Appearance, Index=5}"
                Grid.Row="2"
                Height="16"
                Margin="18,0,5,0"
                Padding="0"/>
            <qt:MarginCombo
                Grid.Column="1"
                Grid.Row="2"
                Margin="5,1"
                Value="{Binding Path=TabContentMargin}"
                Width="120"/>
            <CheckBox x:Name="chkHitTestTransparent"
                Content="{qt:Resx Key=Options_Page06_Appearance, Index=6}"
                Grid.Column="2"
                Grid.ColumnSpan="2"
                Grid.Row="2"
                Height="16"
                IsChecked="{Binding Path=HitTestTransparent}"
                Margin="18,0,0,0"
                />
        </Grid>
        <Label
            Content="{qt:Resx Key=Options_Page06_Appearance, Index=7}"
            Style="{StaticResource SectionHeaderStyle}"/>
        <Grid
            Height="50"
            Margin="13,1,0,1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <Label
                Content="{qt:Resx Key=Options_Page06_Appearance, Index=8}"
                Height="16"
                Margin="0,0,5,0"
                Padding="0"/>
            <StackPanel
                Grid.Column="1"
                Margin="5,0,0,0"
                Orientation="Horizontal">
                <qt:Spinner 
                    Min="0"
                    Max="100"
                    Value="{Binding Path=TabHeight}"/>
                <Label
                    Content="{qt:Resx Key=Options_Page06_Appearance, Index=9}"
                    Height="16"
                    Margin="18,0,5,0"
                    Padding="0"/>
                <qt:Spinner 
                    Min="10"
                    Max="100"
                    Value="{Binding Path=TabMinWidth}"/>
                <Label
                    Content="{qt:Resx Key=Options_Page06_Appearance, Index=10}"
                    Height="16"
                    Margin="18,0,5,0"
                    Padding="0"/>
                <qt:Spinner 
                    Min="50"
                    Max="999"
                    Value="{Binding Path=TabMaxWidth}"/>
            </StackPanel>
            <Label
                Content="{qt:Resx Key=Options_Page06_Appearance, Index=11}"
                Grid.Row="1"
                Height="16"
                Margin="0,0,5,0"
                Padding="0"/>
            <StackPanel
                Grid.Column="1"
                Grid.Row="1"
                Margin="5,0,0,0"
                Orientation="Horizontal">
                <qt:RadioButtonEx
                    Content="{qt:Resx Key=Options_Page06_Appearance, Index=12}"
                    Height="16"
                    IsChecked="{Binding Path=FixedWidthTabs, Converter={StaticResource BoolInverterConverter}}"
                    Margin="0,0,20,0"/>
                <qt:RadioButtonEx
                    Content="{qt:Resx Key=Options_Page06_Appearance, Index=13}"
                    Height="16"
                    IsChecked="{Binding Path=FixedWidthTabs}"
                    Margin="0,0,10,0"/>
            </StackPanel>
        </Grid>
        <Label
            Content="{qt:Resx Key=Options_Page06_Appearance, Index=14}"
            Style="{StaticResource SectionHeaderStyle}"/>
        <Grid
            Margin="13,1,0,1">
            <Grid.Resources>
                <Style x:Key="ColorTileStyle" TargetType="Rectangle">
                    <Setter Property="Stroke"           Value="Black"/>
                    <Setter Property="StrokeThickness"  Value="1"/>
                    <Setter Property="Height"           Value="16"/>
                    <Setter Property="Width"            Value="16"/>
                    <Setter Property="Margin"           Value="4,0"/>
                </Style>
            </Grid.Resources>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <CheckBox x:Name="chkTextShadow"
                Grid.Row="1"
                Content=""
                IsChecked="{Binding Path=TabTitleShadows}"
                VerticalAlignment="Center"/>
            <Label
                Content="{qt:Resx Key=Options_Page06_Appearance, Index=15}"
                Grid.Column="1"
                Height="16"
                Padding="0"/>
            <Label
                Content="{qt:Resx Key=Options_Page06_Appearance, Index=16}"
                Grid.Column="1"
                Grid.Row="1"
                Height="16"
                Padding="0"/>
            <ToggleButton x:Name="btnTabTextColor"
                Checked="btnShadTextColor_OnChecked"
                ContextMenuService.Placement="Bottom"
                Grid.Column="2"
                Height="24"
                HorizontalAlignment="Left"
                HorizontalContentAlignment="Stretch"
                IsChecked="{Binding ElementName=ctxTabTextColor, Path=IsOpen, Mode=TwoWay}"
                Margin="10,5,30,5"
                Width="134"
                VerticalAlignment="Center">
                <DockPanel LastChildFill="True">
                    <TextBlock
                        DockPanel.Dock="Right"
                        HorizontalAlignment="Right"
                        Margin="4,0"
                        Text="&#9660;"/>
                    <StackPanel
                        HorizontalAlignment="Center"
                        Orientation="Horizontal"
                        SnapsToDevicePixels="True">
                        <Rectangle x:Name="rectTabTextActiveColor"
                            Style="{StaticResource ColorTileStyle}"
                            Fill="{Binding Path=Tag, RelativeSource={RelativeSource Self}, Converter={StaticResource ColorToBrushConverter}}"
                            Tag="{Binding Path=TabTextActiveColor, Mode=TwoWay}"/>
                        <Rectangle x:Name="rectTabTextInactiveColor"
                            Style="{StaticResource ColorTileStyle}"
                            Fill="{Binding Path=Tag, RelativeSource={RelativeSource Self}, Converter={StaticResource ColorToBrushConverter}}"
                            Tag="{Binding Path=TabTextInactiveColor, Mode=TwoWay}"/>
                        <Rectangle x:Name="rectTabTextHotColor"
                            Style="{StaticResource ColorTileStyle}"
                            Fill="{Binding Path=Tag, RelativeSource={RelativeSource Self}, Converter={StaticResource ColorToBrushConverter}}"
                            Tag="{Binding Path=TabTextHotColor, Mode=TwoWay}"/>
                        <Rectangle x:Name="rectToolBarTextColor"
                            Style="{StaticResource ColorTileStyle}"
                            Fill="{Binding Path=Tag, RelativeSource={RelativeSource Self}, Converter={StaticResource ColorToBrushConverter}}"
                            Tag="{Binding Path=ToolBarTextColor, Mode=TwoWay}"/>
                    </StackPanel>
                </DockPanel>
                <ToggleButton.ContextMenu>
                    <ContextMenu x:Name="ctxTabTextColor" 
                        PlacementTarget="{Binding ElementName=btnTabTextColor}">
                        <MenuItem x:Name="miTabTextActiveColor"
                            Click="miColorMenuEntry_OnClick"
                            Header="{qt:Resx Key=Options_Page06_Appearance, Index=17}"
                            Tag="{Binding ElementName=rectTabTextActiveColor}"/>
                        <MenuItem x:Name="miTabTextInactiveColor"
                            Click="miColorMenuEntry_OnClick"
                            Header="{qt:Resx Key=Options_Page06_Appearance, Index=18}"
                            Tag="{Binding ElementName=rectTabTextInactiveColor}"/>
                        <MenuItem x:Name="miTabTextHotColor"
                            Click="miColorMenuEntry_OnClick"
                            Header="{qt:Resx Key=Options_Page06_Appearance, Index=19}"
                            Tag="{Binding ElementName=rectTabTextHotColor}"/>
                        <MenuItem x:Name="miToolBarTextColor"
                            Click="miColorMenuEntry_OnClick"
                            Header="Tool Bar Text Color"
                            Tag="{Binding ElementName=rectToolBarTextColor}"/>
                    </ContextMenu>
                </ToggleButton.ContextMenu>
            </ToggleButton>
            <ToggleButton x:Name="btnShadowColor"
                Checked="btnShadTextColor_OnChecked"
                ContextMenuService.Placement="Bottom"
                Grid.Row="1"
                Grid.Column="2"
                Height="24"
                HorizontalAlignment="Left"
                HorizontalContentAlignment="Stretch"
                IsChecked="{Binding ElementName=ctxShadowTextColor, Path=IsOpen, Mode=TwoWay}"
                Margin="10,5,30,5"
                Width="100"
                VerticalAlignment="Center">
                <DockPanel LastChildFill="True">
                    <TextBlock
                        DockPanel.Dock="Right"
                        HorizontalAlignment="Right"
                        Margin="4,0"
                        Text="&#9660;"/>
                    <StackPanel
                        HorizontalAlignment="Center"
                        Orientation="Horizontal"
                        SnapsToDevicePixels="True">
                        <Rectangle x:Name="rectTabShadActiveColor"
                            Style="{StaticResource ColorTileStyle}"
                            Fill="{Binding Path=Tag, RelativeSource={RelativeSource Self}, Converter={StaticResource ColorToBrushConverter}}"
                            Tag="{Binding Path=TabShadActiveColor, Mode=TwoWay}"/>
                        <Rectangle x:Name="rectTabShadInactiveColor"
                            Style="{StaticResource ColorTileStyle}"
                            Fill="{Binding Path=Tag, RelativeSource={RelativeSource Self}, Converter={StaticResource ColorToBrushConverter}}"
                            Tag="{Binding Path=TabShadInactiveColor, Mode=TwoWay}"/>
                        <Rectangle x:Name="rectTabShadMouseoverColor"
                            Style="{StaticResource ColorTileStyle}"
                            Fill="{Binding Path=Tag, RelativeSource={RelativeSource Self}, Converter={StaticResource ColorToBrushConverter}}"
                            Tag="{Binding Path=TabShadHotColor, Mode=TwoWay}"/>
                    </StackPanel>

                </DockPanel>
                <ToggleButton.ContextMenu>
                    <ContextMenu x:Name="ctxShadowTextColor" 
                        PlacementTarget="{Binding ElementName=btnTabTextColor}">
                        <MenuItem x:Name="miTabShadActiveColor"
                            Click="miColorMenuEntry_OnClick"
                            Header="{qt:Resx Key=Options_Page06_Appearance, Index=17}"
                            Tag="{Binding ElementName=rectTabShadActiveColor}"/>
                        <MenuItem x:Name="miTabShadInactiveColor"
                            Click="miColorMenuEntry_OnClick"
                            Header="{qt:Resx Key=Options_Page06_Appearance, Index=18}"
                            Tag="{Binding ElementName=rectTabShadInactiveColor}"/>
                        <MenuItem x:Name="miTabShadMouseoverColor"
                            Click="miColorMenuEntry_OnClick"
                            Header="{qt:Resx Key=Options_Page06_Appearance, Index=19}"
                            Tag="{Binding ElementName=rectTabShadMouseoverColor}"/>
                    </ContextMenu>
                </ToggleButton.ContextMenu>
            </ToggleButton>
            <Label
                Content="{qt:Resx Key=Options_Page06_Appearance, Index=20}"
                Grid.Column="3"
                Height="16"
                Padding="0"/>
            <Label
                Content="{qt:Resx Key=Options_Page06_Appearance, Index=21}"
                Grid.Column="3"
                Grid.Row="1"
                Height="16"
                Padding="0"/>
            <Button x:Name="btnTextFont"
                Click="btnFontChoose_Click" 
                Content="{Binding Path=Tag, RelativeSource={RelativeSource Self}, Converter={StaticResource FontStringConverter}}"
                Grid.Column="4"
                Grid.Row="0"
                Height="23"
                HorizontalAlignment="Stretch"
                Margin="10, 5"
                Tag="{Binding Path=TabTextFont, Mode=TwoWay}"
                VerticalAlignment="Center"/>
            <StackPanel 
                Orientation="Horizontal"
                Grid.Column="4"
                Grid.Row="1">
                <qt:RadioButtonEx x:Name="radTabTextCenteredNo"
                    Content="{qt:Resx Key=Options_Page06_Appearance, Index=22}"
                    Height="16"
                    IsChecked="{Binding Path=TabTextCentered, Converter={StaticResource BoolInverterConverter}}"
                    Margin="6, 3"
                    VerticalAlignment="Center"/>
                <qt:RadioButtonEx x:Name="radTabTextCenteredYes"
                    Content="{qt:Resx Key=Options_Page06_Appearance, Index=23}"
                    Height="16"
                    IsChecked="{Binding Path=TabTextCentered}"
                    Margin="6, 3"
                    VerticalAlignment="Center"/>
				<CheckBox x:Name="SkinAutoColorChangeClose"
							Content="Close Auto Color"
							Height="16"
							Margin="6, 3"
							IsChecked="{Binding Path=SkinAutoColorChangeClose}"/>	
            </StackPanel>
        </Grid>
        <Label
            Content="{qt:Resx Key=Options_Page06_Appearance, Index=24}"
            Style="{StaticResource SectionHeaderStyle}"/>
        <Grid
            Margin="13,1,0,1">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <CheckBox x:Name="chkUseRebarImage"
                Content="{qt:Resx Key=Options_Page06_Appearance, Index=25}"
                Height="16"
                Margin="0,0,15,0"
                IsChecked="{Binding Path=UseRebarImage}"/>
            <qt:FileFolderEntryBox
                FilterText="{qt:Resx Key=FileFilters, Index=0}"
                FilterExtensions="*.png;*.bmp;*.jpg;*.gif"
                Grid.Column="1"
                Grid.ColumnSpan="3"
                IsEnabled="{Binding Path=IsChecked, ElementName=chkUseRebarImage}"
                Margin="0,2"
                SelectedPath="{Binding Path=RebarImageFile}"/>
            <CheckBox x:Name="chkUseRebarBGColor"
                Content="{qt:Resx Key=Options_Page06_Appearance, Index=26}"
                Grid.Row="1"
                Height="16"
                IsChecked="{Binding Path=UseRebarBGColor}"
                Margin="0,0,15,0"/>
            <Button x:Name="btnRebarBGColorChoose"
                Background="{Binding Path=Tag, RelativeSource={RelativeSource Self}, Converter={StaticResource ColorToBrushConverter}}"
                Click="btnRebarBGColorChoose_Click"
                Grid.Column="1"
                Grid.Row="1"
                Height="22"
                HorizontalAlignment="Left"
                IsEnabled="{Binding Path=IsChecked, ElementName=chkUseRebarBGColor}"
                Margin="0,2"
                Tag="{Binding Path=RebarColor, Mode=TwoWay}"
                Width="22" />
            <CheckBox
                Content="{qt:Resx Key=Options_Page06_Appearance, Index=27}"
                Grid.Row="2"
                Grid.ColumnSpan="2"
                Height="16"
                IsChecked="{Binding Path=RebarImageSeperateBars}"
                Margin="0,0,15,0"/>
            <Label
                Content="{qt:Resx Key=Options_Page06_Appearance, Index=28}"
                Grid.Column="2"
                Grid.Row="1"
                Height="16"
                Margin="0,0,15,0"
                Padding="0"/>
            <ComboBox x:Name="cmbRebarStretchMode"
                Grid.Column="3"
                Grid.Row="1"
                Height="23"
                HorizontalAlignment="Stretch"
                SelectedValue="{Binding Path=RebarStretchMode}"
                SelectedValuePath="Tag">
                <ComboBoxItem
                    Content="{qt:Resx Key=Options_Page06_Appearance, Index=33}"
                    Tag="{x:Static qt:StretchMode.Full}"/>
                <ComboBoxItem
                    Content="{qt:Resx Key=Options_Page06_Appearance, Index=34}"
                    Tag="{x:Static qt:StretchMode.Real}"/>
                <ComboBoxItem
                    Content="{qt:Resx Key=Options_Page06_Appearance, Index=35}"
                    Tag="{x:Static qt:StretchMode.Tile}"/>
            </ComboBox>
            <Label
                Content="{qt:Resx Key=Options_Page06_Appearance, Index=29}"
                Grid.Column="2"
                Grid.Row="2"
                Height="16"
                Margin="0,0,15,0"
                Padding="0"/>
            <qt:MarginCombo x:Name="mcbRebarMargin"
                Grid.Column="3"
                Grid.Row="2"
                Height="23"
                HorizontalAlignment="Stretch"
                Value="{Binding Path=RebarSizeMargin}">
                <qt:MarginCombo.Style>
                    <Style TargetType="{x:Type qt:MarginCombo}">
                        <Setter Property="IsEnabled" Value="False" />
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding Path=SelectedValue, ElementName=cmbRebarStretchMode}">
                                <DataTrigger.Value>
                                    <qt:StretchMode>Full</qt:StretchMode>
                                </DataTrigger.Value>
                                <Setter Property="IsEnabled" Value="True" />
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </qt:MarginCombo.Style>
            </qt:MarginCombo>
        </Grid>
        <Label
            Content="{qt:Resx Key=Options_Page06_Appearance, Index=30}"
            Style="{StaticResource SectionHeaderStyle}"/>
        <StackPanel
            Margin="13,1,0,1"
            Orientation="Horizontal">
            <Button
				x:Name="btnImportSkin"
                Click="btnImportSkin_Click"
                Content="{qt:Resx Key=Options_Page06_Appearance, Index=31}"
                Height="23"
                Margin="0,0,10,0"
                Width="100"/>
            <Button
				x:Name="btnExportSkin"
                Click="btnExportSkin_Click"
                Content="{qt:Resx Key=Options_Page06_Appearance, Index=32}"
                Height="23"
                Margin="0,0,10,0"
                Width="100"/>
        </StackPanel>
    </StackPanel>
</qt:OptionsDialogTab>
