<rtf:ManagedWindow x:Class="TankIconMaker.MainWindow" x:ClassModifier="internal"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:rtf="clr-namespace:RT.Util.Forms;assembly=RT.Util"
        xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
        xmlns:src="clr-namespace:TankIconMaker"
        xmlns:wpfc="clr-namespace:WpfCrutches;assembly=WpfCrutches"
        Title="Tank Icon Maker"
        TextOptions.TextFormattingMode="Display"
        wpfc:AccessKeysScopeBugfix.IsEnabled="true"
        Width="881" Height="550"
        Icon="/TankIconMaker;component/Resources/Graphics/icon.ico">
    <Window.Resources>
        <BitmapImage x:Key="imgUpvote" UriSource="/Resources/Graphics/upvote.png" />
        <BitmapImage x:Key="imgUpvoteDown" UriSource="/Resources/Graphics/upvote-down.png" />

        <LinearGradientBrush StartPoint="0,0" EndPoint="1,0" x:Key="panelBackgroundBrush">
            <LinearGradientBrush.GradientStops>
                <GradientStop Color="#FFE5E5E5" Offset="0" />
                <GradientStop Color="#FFC0C6CB" Offset="1" />
            </LinearGradientBrush.GradientStops>
        </LinearGradientBrush>

        <Style TargetType="{x:Type Rectangle}">
            <Style.Triggers>
                <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type UIElement}, AncestorLevel=1}, Path=IsEnabled}" Value="False">
                    <Setter Property="Opacity" Value="0.3"></Setter>
                </DataTrigger>
            </Style.Triggers>
        </Style>
        <Style TargetType="{x:Type Path}">
            <Style.Triggers>
                <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type UIElement}, AncestorLevel=1}, Path=IsEnabled}" Value="False">
                    <Setter Property="Opacity" Value="0.3"></Setter>
                </DataTrigger>
            </Style.Triggers>
        </Style>
        <Style x:Key="gridSplitterStyle" TargetType="{x:Type GridSplitter}">
            <Setter Property="TextElement.Foreground" Value="#FF204D89" />
            <Setter Property="Border.BorderBrush" Value="#FF999999" />
            <Setter Property="Panel.Background" Value="{StaticResource panelBackgroundBrush}" />
            <Setter Property="Border.BorderThickness" Value="1,1,1,1" />
            <Setter Property="UIElement.SnapsToDevicePixels" Value="True" />
            <Setter Property="Control.Padding" Value="7,7,7,7" />
            <Setter Property="Control.Template">
                <Setter.Value>
                    <ControlTemplate>
                        <Border BorderThickness="{TemplateBinding Border.BorderThickness}" BorderBrush="{TemplateBinding Border.BorderBrush}" Background="{TemplateBinding Panel.Background}">
                            <Border BorderThickness="1,0,0,0" BorderBrush="{StaticResource panelBackgroundBrush}">
                                <Canvas Width="3" Height="19">
                                    <Rectangle Fill="{TemplateBinding TextElement.Foreground}" Width="2" Height="2" Canvas.Left="0" Canvas.Top="0" />
                                    <Rectangle Fill="{TemplateBinding TextElement.Foreground}" Width="2" Height="2" Canvas.Left="0" Canvas.Top="4" />
                                    <Rectangle Fill="{TemplateBinding TextElement.Foreground}" Width="2" Height="2" Canvas.Left="0" Canvas.Top="8" />
                                    <Rectangle Fill="{TemplateBinding TextElement.Foreground}" Width="2" Height="2" Canvas.Left="0" Canvas.Top="12" />
                                    <Rectangle Fill="{TemplateBinding TextElement.Foreground}" Width="2" Height="2" Canvas.Left="0" Canvas.Top="16" />
                                </Canvas>
                            </Border>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <SolidColorBrush x:Key="bkgCheckeredBrush1" Color="#FFc0c0c0"/>
        <SolidColorBrush x:Key="bkgCheckeredBrush2" Color="#FFa0a0a0"/>
        <SolidColorBrush x:Key="bkgSolidBrush" Color="#FF80c0ff"/>

        <DrawingBrush x:Key="bkgCheckered" Stretch="None" TileMode="Tile" Viewport="0,0,30,30" ViewportUnits="Absolute">
            <DrawingBrush.Drawing>
                <DrawingGroup>
                    <GeometryDrawing Geometry="M0,0 L30,0 30,30, 0,30Z" Brush="{StaticResource ResourceKey=bkgCheckeredBrush1}"/>
                    <GeometryDrawing Geometry="M0,15 L30,15 30,30, 15,30 15,0 0,0Z" Brush="{StaticResource ResourceKey=bkgCheckeredBrush2}"/>
                </DrawingGroup>
            </DrawingBrush.Drawing>
        </DrawingBrush>

        <ScaleTransform x:Key="UiZoomer" CenterX="0" CenterY="0" ScaleX="1" ScaleY="1" />
    </Window.Resources>

    <Grid Name="ctOuterGrid" Background="{StaticResource ResourceKey=bkgCheckered}" LayoutTransform="{StaticResource UiZoomer}">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="325" Name="ctLeftColumn" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>

        <Grid Name="ctLeftPane" Grid.Column="0" Background="#87FFFFFF" AllowDrop="False" Margin ="0,0,8,0">
            <Grid.RowDefinitions>
                <RowDefinition Height="auto" />
                <RowDefinition Height="*" />
                <RowDefinition Height="auto" />
            </Grid.RowDefinitions>
            <StackPanel Grid.Row="0" Margin="8,8,8,0">
                <Label Padding="3,0,0,0" Target="{Binding ElementName=ctGamePath}" Name="ctGameDirLabel">Game _directory:</Label>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="auto"/>
                        <ColumnDefinition Width="auto"/>
                    </Grid.ColumnDefinitions>
                    <ComboBox Name="ctGamePath" Grid.Column="0"></ComboBox>
                    <Button Name="ctAddGamePath" Grid.Column="1" MinWidth="25" Margin="4,0,0,0" Click="AddGamePath">
                        <Path Fill="Lime" Stroke="Green" Data="M 4.5,0.5 H 7.5 V 4.5 H 11.5 V 7.5 H 7.5 V 11.5 H 4.5 V 7.5 H 0.5 V 4.5 H 4.5 Z" SnapsToDevicePixels="True" />
                    </Button>
                    <Button Name="ctRemoveGamePath" Grid.Column="2" MinWidth="25" Margin="4,0,0,0" Click="RemoveGamePath">
                        <Rectangle Width="10" Height="4" Fill="Red" Stroke="DarkRed" SnapsToDevicePixels="True"/>
                    </Button>
                </Grid>
                <TextBlock Padding="3,6,0,0" Name="ctGameInstallationWarning" Foreground="Maroon" FontWeight="Bold" TextWrapping="Wrap" MouseDown="ctGameInstallationWarning_MouseDown">
                    <TextBlock.Style>
                        <Style TargetType="{x:Type TextBlock}">
                            <Setter Property="Cursor" Value="Hand"/>
                            <Style.Triggers>
                                <Trigger Property="Text" Value="">
                                    <Setter Property="Visibility" Value="Collapsed"/>
                                </Trigger>
                                <Trigger Property="Tag" Value="{x:Null}">
                                    <Setter Property="Cursor" Value="Arrow"/>
                                </Trigger>
                            </Style.Triggers>
                        </Style>
                    </TextBlock.Style>
                </TextBlock>
                <Label Padding="3,6,0,0" Target="{Binding ElementName=ctStyleDropdown}" Name="ctIconStyleLabel">_Icon style:</Label>
                <ComboBox Name="ctStyleDropdown"/>
                <DockPanel Margin="0,8,0,0">
                    <Button Margin="0,0,0,0" Name="ctStyleNew" Command="src:TankStyleCommands.Add">
                        <AccessText Margin="6,0" Name="ctStyleNewLabel">_New</AccessText>
                    </Button>
                    <Button Margin="6,0,0,0" Name="ctStyleImport" Command="src:TankStyleCommands.Import">
                        <AccessText Margin="6,0" Name="ctStyleImportLabel">Im_port</AccessText>
                    </Button>
                    <Button Margin="6,0,0,0" Name="ctStyleExport" Command="src:TankStyleCommands.Export">
                        <AccessText Margin="6,0" Name="ctStyleExportLabel">E_xport</AccessText>
                    </Button>
                    <Button Margin="6,0,0,0" Name="ctUpvote" ToolTip="Upvote the author of this style" Click="ctUpvote_Click">
                        <Button.Template>
                            <ControlTemplate>
                                <Grid>
                                    <Image Name="imgUpvoteNormal" Source="{StaticResource imgUpvote}" Width="19" Height="19" />
                                    <Image Name="imgUpvotePressed" Source="{StaticResource imgUpvoteDown}" Width="19" Height="19" Visibility="Hidden" />
                                </Grid>
                                <ControlTemplate.Triggers>
                                    <Trigger Property="Button.IsMouseOver" Value="True">
                                        <Setter Property="UIElement.Effect">
                                            <Setter.Value>
                                                <DropShadowEffect BlurRadius="4" Color="White" Direction="0" Opacity="0.6" RenderingBias="Performance" ShadowDepth="0" />
                                            </Setter.Value>
                                        </Setter>
                                    </Trigger>
                                    <Trigger Property="Button.IsPressed" Value="True">
                                        <Setter TargetName="imgUpvoteNormal" Property="Visibility" Value="Hidden"/>
                                        <Setter TargetName="imgUpvotePressed" Property="Visibility" Value="Visible"/>
                                    </Trigger>
                                </ControlTemplate.Triggers>
                            </ControlTemplate>
                        </Button.Template>
                    </Button>
                    <Button Margin="6,0,0,0" Name="ctStyleMore" HorizontalAlignment="Right" Click="ctStyleMore_Click">
                        <StackPanel Orientation="Horizontal" UseLayoutRounding="True" SnapsToDevicePixels="True">
                            <AccessText Margin="6,0" Name="ctStyleMoreLabel">_More</AccessText>
                            <Path Fill="Black" Stroke="Black"  Margin="0,0,3,0" Data="M 0.25,0.5 L 2.5,3.5 4.75,0.5 Z"  SnapsToDevicePixels="True" Stretch="None" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                        </StackPanel>
                        <Button.ContextMenu>
                            <ContextMenu LayoutTransform="{StaticResource UiZoomer}">
                                <MenuItem Header="Icon width" Name="ctStyleIconWidth" Command="src:TankStyleCommands.IconWidth"/>
                                <MenuItem Header="Icon height" Name="ctStyleIconHeight" Command="src:TankStyleCommands.IconHeight"/>
                                <MenuItem Header="Centerable" Name="ctStyleCenterable" Command="src:TankStyleCommands.Centerable"/>
                                <Separator/>
                                <MenuItem Header="Change _name" Name="ctStyleChangeName" Command="src:TankStyleCommands.ChangeName"/>
                                <MenuItem Header="Change _author" Name="ctStyleChangeAuthor" Command="src:TankStyleCommands.ChangeAuthor"/>
                                <Separator/>
                                <MenuItem Header="_Duplicate" Name="ctStyleDuplicate" Command="src:TankStyleCommands.Duplicate"/>
                                <MenuItem Header="D_elete" Name="ctStyleDelete" Command="src:TankStyleCommands.Delete"/>
                            </ContextMenu>
                        </Button.ContextMenu>
                    </Button>
                </DockPanel>
                <Border Margin="0,5,0,5"></Border>
                <Label Padding="3,0,0,0" Target="{Binding ElementName=ctLayersTree}" Name="ctLayersLabel">_Layers:</Label>
            </StackPanel>
            <DockPanel Name="ctLeftBottomPane" Grid.Row="1">
                <wpfc:TreeViewWithItem x:Name="ctLayersTree" DockPanel.Dock="Top" MinHeight="60" Margin="8,0,8,0" PreviewMouseRightButtonDown="ctLayersTree_PreviewMouseRightButtonDown">
                    <wpfc:TreeViewWithItem.Resources>
                        <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="#B8DBFF"></SolidColorBrush>
                        <HierarchicalDataTemplate DataType = "{x:Type src:LayerBase}" ItemsSource = "{Binding Effects}">
                            <StackPanel Orientation="Horizontal">
                                <Path Margin="1,0,4,0" Data="M 9.5,0 L 11.7,6.9 L 19.0,6.9 L 13.1,11.2 L 15.4,18.1 L 9.5,13.8 L 3.6,18.1 L 5.9,11.2 L 0.0,6.9 L 7.3,6.9 Z" SnapsToDevicePixels="True" Stretch="None" HorizontalAlignment="Center" VerticalAlignment="Center">
                                    <Path.LayoutTransform>
                                        <ScaleTransform ScaleX="0.6" ScaleY="0.6"/>
                                    </Path.LayoutTransform>
                                    <Path.Style>
                                        <Style>
                                            <Style.Triggers>
                                                <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=TreeViewItem}, Path=Header.Visible}" Value="True">
                                                    <Setter Property="Path.Fill" Value="Yellow"/>
                                                    <Setter Property="Path.Stroke" Value="Brown"/>
                                                </DataTrigger>
                                                <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=TreeViewItem}, Path=Header.Visible}" Value="False">
                                                    <Setter Property="Path.Fill" Value="#eeeeee"/>
                                                    <Setter Property="Path.Stroke" Value="#999999"/>
                                                </DataTrigger>
                                            </Style.Triggers>
                                        </Style>
                                    </Path.Style>
                                </Path>
                                <TextBlock Text="{Binding Path=Name}" Visibility="{Binding Path=NameVisibility}"/>
                                <TextBlock Text=" – " Visibility="{Binding Path=NameVisibility}"/>
                                <TextBlock Text="{Binding Path=TypeName}" Margin="0,0,4,0"/>
                            </StackPanel>
                        </HierarchicalDataTemplate>
                        <DataTemplate DataType = "{x:Type src:EffectBase}">
                            <StackPanel Orientation="Horizontal">
                                <Path Margin="1,0,4,0" Data="M 9.5,0 L 11.7,6.9 L 19.0,6.9 L 13.1,11.2 L 15.4,18.1 L 9.5,13.8 L 3.6,18.1 L 5.9,11.2 L 0.0,6.9 L 7.3,6.9 Z" SnapsToDevicePixels="True" Stretch="None" HorizontalAlignment="Center" VerticalAlignment="Center">
                                    <Path.LayoutTransform>
                                        <ScaleTransform ScaleX="0.6" ScaleY="0.6"/>
                                    </Path.LayoutTransform>
                                    <Path.Style>
                                        <Style>
                                            <Style.Triggers>
                                                <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=TreeViewItem}, Path=Header.Visible}" Value="True">
                                                    <Setter Property="Path.Fill" Value="#F6D8F8"/>
                                                    <Setter Property="Path.Stroke" Value="#7A1881"/>
                                                </DataTrigger>
                                                <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=TreeViewItem}, Path=Header.Visible}" Value="False">
                                                    <Setter Property="Path.Fill" Value="#eeeeee"/>
                                                    <Setter Property="Path.Stroke" Value="#999999"/>
                                                </DataTrigger>
                                            </Style.Triggers>
                                        </Style>
                                    </Path.Style>
                                </Path>
                                <TextBlock Text="{Binding Path=Name}" Visibility="{Binding Path=NameVisibility}"/>
                                <TextBlock Text=" – " Visibility="{Binding Path=NameVisibility}"/>
                                <TextBlock Text="{Binding Path=TypeName}" Margin="0,0,4,0"/>
                            </StackPanel>
                        </DataTemplate>
                    </wpfc:TreeViewWithItem.Resources>
                    <wpfc:TreeViewWithItem.InputBindings>
                        <KeyBinding Command="src:TankLayerCommands.AddLayer" Key="Insert" />
                        <KeyBinding Command="src:TankLayerCommands.AddEffect" Modifiers="Alt" Key="Insert" />
                        <KeyBinding Command="src:TankLayerCommands.Rename" Key="F2" />
                        <KeyBinding Command="src:TankLayerCommands.Copy" Modifiers="Ctrl" Key="C" />
                        <KeyBinding Command="src:TankLayerCommands.CopyEffects" Modifiers="Ctrl+Alt" Key="C" />
                        <KeyBinding Command="src:TankLayerCommands.Paste" Modifiers="Ctrl" Key="V" />
                        <KeyBinding Command="src:TankLayerCommands.Delete" Key="Delete" />
                        <KeyBinding Command="src:TankLayerCommands.MoveUp" Modifiers="Ctrl" Key="Up" />
                        <KeyBinding Command="src:TankLayerCommands.MoveDown" Modifiers="Ctrl" Key="Down" />
                        <KeyBinding Command="src:TankLayerCommands.ToggleVisibility" Key="F3" />
                    </wpfc:TreeViewWithItem.InputBindings>
                    <wpfc:TreeViewWithItem.ContextMenu>
                        <ContextMenu LayoutTransform="{StaticResource UiZoomer}">
                            <!-- Used letters: CDEFLMOPUV -->
                            <MenuItem Header="Add _layer..." Name="ctLayersAddLayer"  Command="src:TankLayerCommands.AddLayer" InputGestureText="Insert" />
                            <MenuItem Header="Add _effect..." Name="ctLayersAddEffect"  Command="src:TankLayerCommands.AddEffect" InputGestureText="Alt+Insert" />
                            <Separator/>
                            <MenuItem Header="_Copy" Name="ctLayersCopy" Command="src:TankLayerCommands.Copy" InputGestureText="Ctrl+C" />
                            <MenuItem Header="Copy e_ffects" Name="ctLayersCopyEffects" Command="src:TankLayerCommands.CopyEffects" InputGestureText="Ctrl+Alt+C"/>
                            <MenuItem Header="_Paste" Name="ctLayersPaste" Command="src:TankLayerCommands.Paste" InputGestureText="Ctrl+V" />
                            <MenuItem Header="_Delete" Name="ctLayersDelete"  Command="src:TankLayerCommands.Delete" InputGestureText="Delete" />
                            <Separator/>
                            <MenuItem Header="_Rename" Name="ctLayersRename"  Command="src:TankLayerCommands.Rename" InputGestureText="F2" />
                            <MenuItem Header="Move _up" Name="ctLayersMoveUp"  Command="src:TankLayerCommands.MoveUp" InputGestureText="Ctrl+↑" />
                            <MenuItem Header="Move d_own" Name="ctLayersMoveDown"  Command="src:TankLayerCommands.MoveDown" InputGestureText="Ctrl+↓" />
                            <Separator/>
                            <MenuItem Header="Toggle _visibility" Name="ctLayersToggleVisibility"  Command="src:TankLayerCommands.ToggleVisibility" InputGestureText="F3" />
                        </ContextMenu>
                    </wpfc:TreeViewWithItem.ContextMenu>
                </wpfc:TreeViewWithItem>
                <xctk:PropertyGrid Margin="8" Name="ctLayerProperties" NameColumnWidth="150"/>
            </DockPanel>
        </Grid>

        <GridSplitter Width="8" Style="{StaticResource gridSplitterStyle}" />

        <Grid Grid.Column="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="auto" />
                <RowDefinition Height="*" />
                <RowDefinition Height="auto" />
            </Grid.RowDefinitions>
            <DockPanel Grid.Row="0" Background="#87FFFFFF">
                <CheckBox Name="ctZoomCheckbox" Margin="8,11,8,8" TabIndex="1">_Zoom</CheckBox>
                <ComboBox Name="ctDisplayMode" Margin="8" TabIndex="2">
                    <ComboBoxItem Name="ctDisplayModeAll" Selector.IsSelected="True">All tanks</ComboBoxItem>
                    <ComboBoxItem Name="ctDisplayModeOneEach">One of each combination</ComboBoxItem>
                    <Separator/>
                    <ComboBoxItem Name="ctDisplayModeCountryUSSR">USSR</ComboBoxItem>
                    <ComboBoxItem Name="ctDisplayModeCountryGermany">Germany</ComboBoxItem>
                    <ComboBoxItem Name="ctDisplayModeCountryUSA">USA</ComboBoxItem>
                    <ComboBoxItem Name="ctDisplayModeCountryFrance">France</ComboBoxItem>
                    <ComboBoxItem Name="ctDisplayModeCountryUK">UK</ComboBoxItem>
                    <ComboBoxItem Name="ctDisplayModeCountryChina">China</ComboBoxItem>
                    <ComboBoxItem Name="ctDisplayModeCountryJapan">Japan</ComboBoxItem>
                    <ComboBoxItem Name="ctDisplayModeCountryCzech">Czech</ComboBoxItem>
                    <ComboBoxItem Name="ctDisplayModeCountrySweden">Sweden</ComboBoxItem>
                    <ComboBoxItem Name="ctDisplayModeCountryPoland">Poland</ComboBoxItem>
                    <ComboBoxItem Name="ctDisplayModeCountryItaly">Italy</ComboBoxItem>
                    <Separator/>
                    <ComboBoxItem Name="ctDisplayModeClassLight">Light tanks</ComboBoxItem>
                    <ComboBoxItem Name="ctDisplayModeClassMedium">Medium tanks</ComboBoxItem>
                    <ComboBoxItem Name="ctDisplayModeClassHeavy">Heavy tanks</ComboBoxItem>
                    <ComboBoxItem Name="ctDisplayModeClassArtillery">Artillery</ComboBoxItem>
                    <ComboBoxItem Name="ctDisplayModeClassDestroyer">Tank destroyers</ComboBoxItem>
                    <Separator/>
                    <ComboBoxItem Name="ctDisplayModeCategoryNormal">Normal</ComboBoxItem>
                    <ComboBoxItem Name="ctDisplayModeCategoryPremium">Premium</ComboBoxItem>
                    <ComboBoxItem Name="ctDisplayModeCategorySpecial">Special</ComboBoxItem>
                    <Separator/>
                    <ComboBoxItem Name="ctDisplayModeTierLow">Low tiers</ComboBoxItem>
                    <ComboBoxItem Name="ctDisplayModeTierMedHigh">Medium and high tiers</ComboBoxItem>
                    <ComboBoxItem Name="ctDisplayModeTierHigh">High tiers</ComboBoxItem>
                </ComboBox>
                <Button Margin="8" Name="ctLanguage" DockPanel.Dock="Right" Click="ctLanguage_Click" VerticalAlignment="Center" HorizontalAlignment="Right" TabIndex="6">
                    <StackPanel Orientation="Horizontal" UseLayoutRounding="True" SnapsToDevicePixels="True">
                        <AccessText Margin="6,0" Name="ctLanguageLabel">Lang_uage</AccessText>
                        <Path Fill="Black" Stroke="Black"  Margin="0,0,3,0" Data="M 0.25,0.5 L 2.5,3.5 4.75,0.5 Z"  SnapsToDevicePixels="True" Stretch="None" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                    </StackPanel>
                    <Button.ContextMenu>
                        <ContextMenu LayoutTransform="{StaticResource UiZoomer}">
                            <Separator/>
                        </ContextMenu>
                    </Button.ContextMenu>
                </Button>
                <Button Margin="8,8,0,8" Name="ctBackground" DockPanel.Dock="Right" Click="ctBackground_Click" VerticalAlignment="Center" HorizontalAlignment="Right" TabIndex="5">
                    <StackPanel Orientation="Horizontal" UseLayoutRounding="True" SnapsToDevicePixels="True">
                        <AccessText Margin="6,0" Name="ctBackgroundLabel">_Background</AccessText>
                        <Path Fill="Black" Stroke="Black"  Margin="0,0,3,0" Data="M 0.25,0.5 L 2.5,3.5 4.75,0.5 Z"  SnapsToDevicePixels="True" Stretch="None" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                    </StackPanel>
                    <Button.ContextMenu>
                        <ContextMenu LayoutTransform="{StaticResource UiZoomer}">
                            <Separator/>
                        </ContextMenu>
                    </Button.ContextMenu>
                </Button>
                <Button Margin="2,8,0,8" Name="ctUiZoomIn" DockPanel.Dock="Right" VerticalAlignment="Center" HorizontalAlignment="Right" Click="ctUiZoomIn_Click" TabIndex="4">
                    <Viewbox Stretch="Uniform" Height="23">
                        <Canvas Width="178" Height="180">
                            <Canvas.RenderTransform>
                                <TranslateTransform X="-252" Y="-393"/>
                            </Canvas.RenderTransform>
                            <Path StrokeThickness="35" Stroke="#FF333333" StrokeMiterLimit="4" StrokeLineJoin="Miter" StrokeStartLineCap="Flat" StrokeEndLineCap="Flat">
                                <Path.Data>
                                    <CombinedGeometry>
                                        <CombinedGeometry.Geometry1>
                                            <PathGeometry Figures="m 403.24232 437.1969 c 0 40.63952 -32.94484 73.58437 -73.58436 73.58437 -40.63952 0 -73.58437 -32.94485 -73.58437 -73.58437 0 -40.63952 32.94485 -73.58437 73.58437 -73.58437 40.63952 0 73.58436 32.94485 73.58436 73.58437 z" FillRule="nonzero"/>
                                        </CombinedGeometry.Geometry1>
                                        <CombinedGeometry.Geometry2>
                                            <RectangleGeometry Rect="323,530,14,60"/>
                                        </CombinedGeometry.Geometry2>
                                    </CombinedGeometry>
                                </Path.Data>
                                <Path.RenderTransform>
                                    <MatrixTransform Matrix="0.47860653 0.47860653 -0.47860653 0.47860653 409.59166 98.335539"/>
                                </Path.RenderTransform>
                            </Path>
                            <Path Fill="#FF333333" StrokeThickness="0">
                                <Path.Data>
                                    <PathGeometry Figures="m 351.21658 441.59165 0 16.84375 -16.84375 0 0 13.84376 16.84375 0 0 16.84375 13.8125 0 0 -16.84375 16.84375 0 0 -13.84376 -16.84375 0 0 -16.84375 -13.8125 0 z" FillRule="nonzero"/>
                                </Path.Data>
                            </Path>
                        </Canvas>
                    </Viewbox>
                </Button>
                <Button Margin="8,8,0,8" Name="ctUiZoomOut" DockPanel.Dock="Right" VerticalAlignment="Center" HorizontalAlignment="Right" Click="ctUiZoomOut_Click" TabIndex="3">
                    <Viewbox Stretch="Uniform" Height="23">
                        <Canvas Width="178" Height="180">
                            <Canvas.RenderTransform>
                                <TranslateTransform X="-252" Y="-393"/>
                            </Canvas.RenderTransform>
                            <Path StrokeThickness="35" Stroke="#FF333333" StrokeMiterLimit="4" StrokeLineJoin="Miter" StrokeStartLineCap="Flat" StrokeEndLineCap="Flat">
                                <Path.Data>
                                    <CombinedGeometry>
                                        <CombinedGeometry.Geometry1>
                                            <PathGeometry Figures="m 403.24232 437.1969 c 0 40.63952 -32.94484 73.58437 -73.58436 73.58437 -40.63952 0 -73.58437 -32.94485 -73.58437 -73.58437 0 -40.63952 32.94485 -73.58437 73.58437 -73.58437 40.63952 0 73.58436 32.94485 73.58436 73.58437 z" FillRule="nonzero"/>
                                        </CombinedGeometry.Geometry1>
                                        <CombinedGeometry.Geometry2>
                                            <RectangleGeometry Rect="323,530,14,60"/>
                                        </CombinedGeometry.Geometry2>
                                    </CombinedGeometry>
                                </Path.Data>
                                <Path.RenderTransform>
                                    <MatrixTransform Matrix="0.47860653 0.47860653 -0.47860653 0.47860653 409.59166 98.335539"/>
                                </Path.RenderTransform>
                            </Path>
                            <Path Fill="#FF333333" StrokeThickness="0">
                                <Path.Data>
                                    <PathGeometry Figures="m 334.37283 458.4354 0 13.84376 47.53126 0 0 -13.84375 z" FillRule="nonzero"/>
                                </Path.Data>
                            </Path>
                        </Canvas>
                    </Viewbox>
                </Button>
            </DockPanel>
            <ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Auto">
                <WrapPanel Name="ctIconsPanel" Orientation="Vertical" Margin="15" RenderOptions.BitmapScalingMode="NearestNeighbor">
                </WrapPanel>
            </ScrollViewer>
            <Grid Grid.Row="2" Background="#87FFFFFF">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="auto"/>
                    <ColumnDefinition Width="auto"/>
                    <ColumnDefinition Width="auto"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="auto"/>
                    <ColumnDefinition Width="auto"/>
                    <ColumnDefinition Width="auto"/>
                </Grid.ColumnDefinitions>
                <Image Grid.Column="0" Name="ctWarning" Margin="8,0,0,0" Cursor="Hand" Visibility="Collapsed" Source="pack://application:,,,/Resources/Graphics/warning.png" Height="24" MouseUp="ctWarning_MouseUp"
                       ToolTip="Indicates that a problem has occurred. Click this icon to view details of the problem." />
                <Button Grid.Column="1" Name="ctSave" Margin="8,8,0,8" Click="ctSave_Click">
                    <AccessText Margin="8,0" Name="ctSaveLabel">_Save</AccessText>
                </Button>
                <Button Grid.Column="2" Name="ctSaveAs" Margin="8,8,0,8" Click="ctSaveAs_Click" IsEnabled="{Binding ElementName=ctSave, Path=IsEnabled}">
                    <AccessText Margin="8,0" Name="ctSaveAsLabel">Save _as...</AccessText>
                    <Button.ContextMenu>
                        <ContextMenu LayoutTransform="{StaticResource UiZoomer}">
                            <!-- Taken: ACFGS -->
                            <MenuItem Header="Save to _game folder" Name="ctSaveIconsToGameFolder" Click="ctSaveIconsToGameFolder_Click"/>
                            <MenuItem Header="Save icons to _folder..." Name="ctSaveIconsToSpecifiedFolder" Click="ctSaveIconsToSpecifiedFolder_Click"/>
                            <MenuItem Header="Save _BattleAtlas..." Name="ctSaveIconsToBattleAtlas" Click="ctSaveIconsToBattleAtlas_Click"/>
                            <MenuItem Header="Save _VehicleMarkerAtlas..." Name="ctSaveIconsToVehicleMarkerAtlas" Click="ctSaveIconsToVehicleMarkerAtlas_Click"/>
                            <MenuItem Header="Save a_tlas..." Name="ctSaveToAtlas" Click="ctSaveToAtlas_Click"/>
                            <MenuItem Header="Bulk _save" Name="ctBulkSaveIcons" Click="ctBulkSaveIcons_Click"/>
                            <MenuItem Header="Bulk s_ave to folder..." Name="ctBulkSaveIconsToFolder" Click="ctBulkSaveIconsToFolder_Click"/>
                        </ContextMenu>
                    </Button.ContextMenu>
                </Button>
                <Grid Grid.Column="3" Width="auto" HorizontalAlignment="Left">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="auto"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="auto"/>
                    </Grid.ColumnDefinitions>
                    <Rectangle Grid.Column="0" Grid.ColumnSpan="2" Fill="White" Opacity="0.8" Margin="6,10,0,10">
                        <Rectangle.Effect>
                            <BlurEffect Radius="10"/>
                        </Rectangle.Effect>
                    </Rectangle>
                    <TextBlock Grid.Column="0" Name="ctPathTemplateLabel" Margin="8,8,0,8" VerticalAlignment="Center" >Path:</TextBlock>
                    <TextBlock Grid.Column="1" Name="ctPathTemplate" Margin="8,8,0,8" VerticalAlignment="Center" HorizontalAlignment="Left" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis"
                               Text="{Binding UpdateSourceTrigger=PropertyChanged, Path=PathTemplate}"/>
                    <Button Grid.Column="2"  Name="ctEditPathTemplate" Margin="8,8,16,8" Click="ctEditPathTemplate_Click" IsEnabled="{Binding ElementName=ctSave, Path=IsEnabled}">
                        <AccessText Margin="4,0" Name="ctEditPathTemplateLabel">_...</AccessText>
                    </Button>
                </Grid>
                <Button Grid.Column="4" Name="ctReload" Margin="0,8,0,8" Click="ctReload_Click">
                    <AccessText Margin="8,0" Name="ctReloadLabel">_Reload data</AccessText>
                </Button>
                <Button Grid.Column="5" Name="ctAbout" Margin="8" DockPanel.Dock="Right" HorizontalAlignment="Right" VerticalAlignment="Center" Click="ctAbout_Click">
                    <AccessText Margin="8,0" Name="ctAboutLabel">About...</AccessText>
                </Button>
            </Grid>
        </Grid>

        <Border Grid.ColumnSpan="2" Name="ctGlobalStatusBox" BorderThickness="3" HorizontalAlignment="Center" VerticalAlignment="Center" CornerRadius="8" BorderBrush="#FF5C5C5C"
                Visibility="Collapsed">
            <Border.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#D25F5F5F" Offset="1" />
                    <GradientStop Color="#D2B4B4B4" Offset="0.484" />
                    <GradientStop Color="#D2FFFFFF" Offset="0.131" />
                    <GradientStop Color="#D2DEDEDE" Offset="0.418" />
                </LinearGradientBrush>
            </Border.Background>
            <TextBlock Margin="15" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="25" FontFamily="Maiandra GD" TextAlignment="Center">Loading...</TextBlock>
        </Border>
    </Grid>

</rtf:ManagedWindow>
