<Page
    xmlns:local="clr-namespace:ForzaUI"
    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:System="clr-namespace:System;assembly=mscorlib"
    x:Class="ForzaUI.A_LiveryPosition"
    mc:Ignorable="d"
    x:Name="Page"
    Style="{StaticResource A_Style_Page_Generic}"
    DataContext="{Binding RelativeSource={RelativeSource Self}}">
        
    <Page.Resources>
        <ResourceDictionary>
            <local:NumUnitConverter x:Key="A_NumUnitConverter_LiveryPosition" FractionDigits="2"/>

            <System:Double x:Key="A_Double_MouseMove_Translate_Modifier">0.125</System:Double>
            <System:Double x:Key="A_Double_MouseMove_Scale_Modifier">0.0025</System:Double>
            <System:Double x:Key="A_Double_MouseMove_Rotate_Modifier">0.05</System:Double>
            <System:Double x:Key="A_Double_MouseMove_Shear_Modifier">0.005</System:Double>
            <System:Double x:Key="A_Double_MouseMove_Transparency_Modifier">0.005</System:Double>
            <System:Double x:Key="A_Double_MouseMove_Modifier">1.0</System:Double>
            <System:Double x:Key="A_Double_MouseMove_SlowModifier">0.5</System:Double>
            <System:Double x:Key="A_Double_MouseMove_AccelerationModifier">500</System:Double>
            <System:Double x:Key="A_Double_MouseMove_FastNudgeModifier">20.0</System:Double>

            <Style x:Key="A_Style_FZTextBlock_LiveryData" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_HeaderBlock}">
                <Setter Property="Color" Value="{StaticResource A_Color_Tile_Text}" />
                <Setter Property="Margin" Value="0" />
                <Setter Property="CapHeight" Value="32" />
            </Style>

            <Style x:Key="A_Style_FZTextBlock_LiveryModeText" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_LiveryData}">
                <Setter Property="Color" Value="{StaticResource A_Color_DarkBodyText}" />
            </Style>

            <ControlTemplate x:Key="A_ControlTemplate_ContentControl_ImageAndDataBox" TargetType="ContentControl">
                <DockPanel MinWidth="226" MaxWidth="300" MinHeight="68">
                    <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_FlatPanel_LeftHeaderPanel}" DockPanel.Dock="Left" Width="68" Height="68">
                        <local:FZMaterial Height="68" Width="68" ImageSource="{Binding Tag, RelativeSource={RelativeSource TemplatedParent}}" />
                    </local:FZMaterial>
                    <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_FlatPanel_TileRight}">
                        <Viewbox StretchDirection="DownOnly">
                            <local:FZTextBlock Text="{Binding Content, RelativeSource={RelativeSource TemplatedParent}}" Style="{StaticResource A_Style_FZTextBlock_LiveryData}" />
                        </Viewbox>
                    </local:FZMaterial>
                </DockPanel>
            </ControlTemplate>

            <Thickness x:Key="A_Thickness_PositionControlSpacing">0,0,4,0</Thickness>
                        
            <Style x:Key="A_Style_Control_Move" TargetType="{x:Type Control}">    
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Control}">
                            <StackPanel Orientation="Horizontal">
                                <ContentControl Tag="/ForzaUI;component/Textures/Anthem/Paintshop/Livery_Position_Position_X_Icon.png" 
                                                Content="{Binding TranslationX, Converter={StaticResource A_NumUnitConverter_LiveryPosition}, ElementName=Page}" 
                                                Template="{StaticResource A_ControlTemplate_ContentControl_ImageAndDataBox}" 
                                                Margin="{StaticResource A_Thickness_PositionControlSpacing}" />

                                <ContentControl Tag="/ForzaUI;component/Textures/Anthem/Paintshop/Livery_Position_Position_Y_Icon.png" 
                                                Content="{Binding TranslationY, Converter={StaticResource A_NumUnitConverter_LiveryPosition}, ElementName=Page}" 
                                                Template="{StaticResource A_ControlTemplate_ContentControl_ImageAndDataBox}" />
                            </StackPanel>   
                        </ControlTemplate>    
                    </Setter.Value>
                </Setter>     
            </Style> 
        
            <Style x:Key="A_Style_Control_Scale" TargetType="{x:Type Control}">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Control}">
                            <Grid>
                                <StackPanel Orientation="Horizontal">
                                    <ContentControl Tag="/ForzaUI;component/Textures/Anthem/Paintshop/Livery_Position_Scale_X_Icon.png" 
                                                    Content="{Binding ScaleX, Converter={StaticResource A_NumUnitConverter_LiveryPosition}, ElementName=Page}" 
                                                    Template="{StaticResource A_ControlTemplate_ContentControl_ImageAndDataBox}" 
                                                    Margin="{StaticResource A_Thickness_PositionControlSpacing}"/>

                                    <ContentControl Tag="/ForzaUI;component/Textures/Anthem/Paintshop/Livery_Position_Scale_Y_Icon.png" 
                                                    Content="{Binding ScaleY, Converter={StaticResource A_NumUnitConverter_LiveryPosition}, ElementName=Page}" 
                                                    Template="{StaticResource A_ControlTemplate_ContentControl_ImageAndDataBox}"/>
                                </StackPanel>
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style> 
            
            <Style x:Key="A_Style_Control_ScaleUniform" TargetType="{x:Type Control}">    
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Control}">
                            <Grid>
                                <ContentControl Tag="/ForzaUI;component/Textures/Anthem/Paintshop/Livery_Position_Scale_Uniform_Icon.png" 
                                                Content="{Binding ScaleX, Converter={StaticResource A_NumUnitConverter_LiveryPosition}, ElementName=Page}" 
                                                Template="{StaticResource A_ControlTemplate_ContentControl_ImageAndDataBox}"/>
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        
            <Style x:Key="A_Style_Control_Transparency" TargetType="{x:Type Control}">    
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Control}">
                            <ContentControl Tag="/ForzaUI;component/Textures/Anthem/Paintshop/Livery_Position_Transparency_Icon.png" 
                                            Content="{Binding Transparency, Converter={StaticResource A_NumUnitConverter_LiveryPosition}, ElementName=Page}" 
                                            Template="{StaticResource A_ControlTemplate_ContentControl_ImageAndDataBox}" />
                        </ControlTemplate>  
                    </Setter.Value>
                </Setter>     
            </Style>
            
            <Style x:Key="A_Style_Control_Rotate" TargetType="{x:Type Control}">    
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Control}">
                            <ContentControl Tag="/ForzaUI;component/Textures/Anthem/Paintshop/Livery_Position_Rotate_Icon.png" 
                                            Content="{Binding Rotation, Converter={StaticResource A_NumUnitConverter_LiveryPosition}, ElementName=Page}" 
                                            Template="{StaticResource A_ControlTemplate_ContentControl_ImageAndDataBox}" />
                        </ControlTemplate>  
                    </Setter.Value>
                </Setter>     
            </Style>
                    
            <Style x:Key="A_Style_Control_Shear" TargetType="{x:Type Control}">    
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Control}">
                            <ContentControl Tag="/ForzaUI;component/Textures/Anthem/Paintshop/Livery_Position_Skew_Icon.png" 
                                            Content="{Binding Shear, Converter={StaticResource A_NumUnitConverter_LiveryPosition}, ElementName=Page}" 
                                            Template="{StaticResource A_ControlTemplate_ContentControl_ImageAndDataBox}" />
                        </ControlTemplate>  
                    </Setter.Value>
                </Setter>     
            </Style>

            <Style x:Key="A_Style_Control_PositionInfo" TargetType="{x:Type Control}">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Control}">                            
                            <Grid>
                                <Control x:Name="Control_Move" Style="{StaticResource A_Style_Control_Move}" Focusable="False"/>
                                <Control x:Name="Control_Size" Style="{StaticResource A_Style_Control_Scale}" Focusable="False"/>
                                <Control x:Name="Control_SizeUniform" Style="{StaticResource A_Style_Control_ScaleUniform}" Focusable="False"/>
                                <Control x:Name="Control_Spin" Style="{StaticResource A_Style_Control_Rotate}" Focusable="False"/>
                                <Control x:Name="Control_Skew" Style="{StaticResource A_Style_Control_Shear}" Focusable="False"/>
                                <Control x:Name="Control_Transparency" Style="{StaticResource A_Style_Control_Transparency}" Focusable="False"/>
                            </Grid>
                            
                            <ControlTemplate.Triggers>
            	                <Trigger Property="Tag"> 
                                    <Trigger.Value> 
                                        <local:LiveryPositionTabType>Translate</local:LiveryPositionTabType> 
                                    </Trigger.Value>      
                                    <Setter TargetName="Control_Move" Property="Visibility" Value="Visible"/>   
                                    <Setter TargetName="Control_Size" Property="Visibility" Value="Collapsed"/>  
                                    <Setter TargetName="Control_SizeUniform" Property="Visibility" Value="Collapsed"/>  
                                    <Setter TargetName="Control_Spin" Property="Visibility" Value="Collapsed"/>  
                                    <Setter TargetName="Control_Skew" Property="Visibility" Value="Collapsed"/>  
                                    <Setter TargetName="Control_Transparency" Property="Visibility" Value="Collapsed"/>                   
    			                </Trigger>
                                <Trigger Property="Tag">    				
                                    <Trigger.Value> 
                                        <local:LiveryPositionTabType>ScaleXY</local:LiveryPositionTabType> 
                                    </Trigger.Value>
                                    <Setter TargetName="Control_Move" Property="Visibility" Value="Collapsed"/>   
                                    <Setter TargetName="Control_Size" Property="Visibility" Value="Visible"/>  
                                    <Setter TargetName="Control_SizeUniform" Property="Visibility" Value="Collapsed"/>  
                                    <Setter TargetName="Control_Spin" Property="Visibility" Value="Collapsed"/>  
                                    <Setter TargetName="Control_Skew" Property="Visibility" Value="Collapsed"/>  
                                    <Setter TargetName="Control_Transparency" Property="Visibility" Value="Collapsed"/>              
    			                </Trigger>             
                                <Trigger Property="Tag">    				
                                    <Trigger.Value> 
                                        <local:LiveryPositionTabType>ScaleUniform</local:LiveryPositionTabType> 
                                    </Trigger.Value>
                                    <Setter TargetName="Control_Move" Property="Visibility" Value="Collapsed"/>   
                                    <Setter TargetName="Control_Size" Property="Visibility" Value="Collapsed"/>  
                                    <Setter TargetName="Control_SizeUniform" Property="Visibility" Value="Visible"/>  
                                    <Setter TargetName="Control_Spin" Property="Visibility" Value="Collapsed"/>  
                                    <Setter TargetName="Control_Skew" Property="Visibility" Value="Collapsed"/>  
                                    <Setter TargetName="Control_Transparency" Property="Visibility" Value="Collapsed"/>                 
    			                </Trigger>
                                <Trigger Property="Tag">    				
                                    <Trigger.Value> 
                                        <local:LiveryPositionTabType>Shear</local:LiveryPositionTabType> 
                                    </Trigger.Value>
                                    <Setter TargetName="Control_Move" Property="Visibility" Value="Collapsed"/>   
                                    <Setter TargetName="Control_Size" Property="Visibility" Value="Collapsed"/>  
                                    <Setter TargetName="Control_SizeUniform" Property="Visibility" Value="Collapsed"/>  
                                    <Setter TargetName="Control_Spin" Property="Visibility" Value="Collapsed"/>  
                                    <Setter TargetName="Control_Skew" Property="Visibility" Value="Visible"/>  
                                    <Setter TargetName="Control_Transparency" Property="Visibility" Value="Collapsed"/>           
    			                </Trigger>
                                <Trigger Property="Tag">    				
                                    <Trigger.Value> 
                                        <local:LiveryPositionTabType>Rotate</local:LiveryPositionTabType> 
                                    </Trigger.Value>
                                    <Setter TargetName="Control_Move" Property="Visibility" Value="Collapsed"/>   
                                    <Setter TargetName="Control_Size" Property="Visibility" Value="Collapsed"/>  
                                    <Setter TargetName="Control_SizeUniform" Property="Visibility" Value="Collapsed"/>  
                                    <Setter TargetName="Control_Spin" Property="Visibility" Value="Visible"/>  
                                    <Setter TargetName="Control_Skew" Property="Visibility" Value="Collapsed"/>  
                                    <Setter TargetName="Control_Transparency" Property="Visibility" Value="Collapsed"/>              
    			                </Trigger>
                                <Trigger Property="Tag">    				
                                    <Trigger.Value> 
                                        <local:LiveryPositionTabType>Transparency</local:LiveryPositionTabType> 
                                    </Trigger.Value>
                                    <Setter TargetName="Control_Move" Property="Visibility" Value="Collapsed"/>   
                                    <Setter TargetName="Control_Size" Property="Visibility" Value="Collapsed"/>  
                                    <Setter TargetName="Control_SizeUniform" Property="Visibility" Value="Collapsed"/>  
                                    <Setter TargetName="Control_Spin" Property="Visibility" Value="Collapsed"/>  
                                    <Setter TargetName="Control_Skew" Property="Visibility" Value="Collapsed"/>  
                                    <Setter TargetName="Control_Transparency" Property="Visibility" Value="Visible"/>              
    			                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>  
                    </Setter.Value>
                </Setter>     
    	    </Style>

        </ResourceDictionary>
    </Page.Resources>

	<local:UIPageTransitionManager.TransitionManager>
        <local:UIPageTransitionManager Preset="{StaticResource A_UIPageTransitionManagerPreset_Menu}"/>
    </local:UIPageTransitionManager.TransitionManager>

    <Grid>
        <local:FZMaterialGlassCapture />

        <local:RoutedEventCommand x:Name="StartMouseDragRoutedEventCommand"
                                  RoutedEvent="UIElement.MouseLeftButtonDown"
                                  Command="{Binding StartMouseDragCommand, RelativeSource={RelativeSource AncestorType=Page}}" />

        <local:FZMaterial x:Name="MouseMoveHelper"
                          Color="#00000000"
                          local:RoutedEventCommand.Action="{Binding ElementName=StartMouseDragRoutedEventCommand}" />

        <!-- Bars -->
        <ContentControl x:Name="BottomBar" Style="{StaticResource A_Style_ButtonBar}">
            <ContentControl Name="DefaultHelpPanel"
                            Focusable="False" 
                            Style="{StaticResource A_Style_ContentControl_DefaultButtonBar}" />
        </ContentControl>

        <Border x:Name="LayoutRoot" Style="{StaticResource A_Style_Border_ScenePadding_Opus}">
            <StackPanel Orientation="Vertical" VerticalAlignment="Bottom" >
                <!--StackPanel Orientation="Horizontal" Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_0}">
                    <ContentControl Tag="{local:Loc ScreenTitles.IDS_LiveryEditor}" Content="{Binding CurrentScreenTitle}" 
                                Style="{StaticResource A_Style_ContentControl_ScreenTitleBlock}" Focusable="False"
                                local:BindingProxy.A="/ForzaUI;component/Textures/Anthem/Icons/Titles/Layers.png" />
                </-->

                <Decorator Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_1}" Margin="0,0,0,10" Focusable="False" HorizontalAlignment="Left">
                    <local:ItemsSelector x:Name="PART_ItemsSelector_PositionType" MaxWidth="1250" Style="{StaticResource A_Style_TextTabMenuList}" ItemsSource="{Binding ModeItems}" Focusable="False" PageSize="1"/>
                </Decorator>

                <StackPanel Orientation="Horizontal" Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_2}" Margin="0,0,0,-17">
                    <Control Style="{StaticResource A_Style_Control_PositionInfo}" Tag="{Binding SelectedItem.TabType, ElementName=PART_ItemsSelector_PositionType}" Focusable="False"/>
                </StackPanel>
            </StackPanel>
        </Border>
    </Grid>
</Page>
