<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:System="clr-namespace:System;assembly=mscorlib"
      xmlns:local="clr-namespace:ForzaUI;assembly="
      x:Class="ForzaUI.A_RouteBlueprintHud"
      x:Name="Page"
      WindowTitle="Page"
      FlowDirection="LeftToRight"
      Style="{StaticResource A_Style_Page_Generic}"
      DataContext="{Binding RelativeSource={x:Static RelativeSource.Self}}">

    <Page.Resources>
        <ResourceDictionary>

            <local:LinearTransformConverter x:Key="A_TransformConverter_LengthRatio" Scale="356"/>

            <Style x:Key="A_Style_FZRun_HIGHLIGHT" TargetType="{x:Type local:FZRun}">
                <Setter Property="Color" Value="{StaticResource A_Color_HUD_HighlightText}"/>
            </Style>

        </ResourceDictionary>
    </Page.Resources>
    
    <local:UIPageTransitionManager.TransitionManager>
        <local:UIPageTransitionManager Preset="{StaticResource A_UIPageTransitionManagerPreset_Hud}" />
    </local:UIPageTransitionManager.TransitionManager>

    <Grid x:Name="LayoutRoot">
        <ContentControl Style="{StaticResource A_Style_ButtonBar}">
          <local:ControllerButtonPanel x:Name="HelpPanel"
                           Style="{StaticResource A_Style_ControllerButtonPanel_Default}">
            <local:ControllerButtonControl InputOverride="{local:Input Command=INPUTCMD_ACTIVATE, Context=INPUTCONTEXT_RACING}"
                               Description="{local:Loc HelpButtons.IDS_RouteBlueprint_Checkpoint_Place}"
                               Visibility="{Binding CanPlaceCheckpoint, Converter={StaticResource A_FZBooleanToVisibilityConverter}}"/>
            <local:ControllerButtonControl InputOverride="{local:Input Command=INPUTCMD_MULLIGAN, Context=INPUTCONTEXT_RACING}"
                               Description="{local:Loc HelpButtons.IDS_Mulligan}" 
                               Visibility="{Binding CanRewind, Converter={StaticResource A_FZBooleanToVisibilityConverter}}"/>
            <local:ControllerButtonControl InputOverride="{local:Input Command=INPUTCMD_PAUSE_GAME, Context=INPUTCONTEXT_RACING}"
                               Description="{local:Loc HelpButtons.IDS_RouteBlueprint_RouteOptions}" />
            </local:ControllerButtonPanel>
        </ContentControl>
      
        <Grid Style="{StaticResource A_Style_FrameworkElement_FadeOnlyTransition_0}">
            <!-- screen space shadow -->
            <local:FZMaterial Preset="{StaticResource A_FZMaterialPresetScreenShadow_ARUI}" />

            <Grid Style="{StaticResource A_Style_FrameworkElement_LayoutRoot}">
                <Grid x:Name="AdjustableSafeFrame"
                      Margin="{Binding SafeFrameMargin}">

                    <Decorator HorizontalAlignment="Left"
                               VerticalAlignment="Bottom"
                               Margin="0,0,0,83">
                        <local:HUDAnnaControl x:Name="HUDStatusAnna" />
                    </Decorator>

                    <local:HUDSpeedometerControl x:Name="HUDStatusSpeedometer" />

                    <Decorator HorizontalAlignment="Left"
                               VerticalAlignment="Bottom" 
                               Margin="0,0,0,49">
                        <local:HUDRadioControl x:Name="HUDStatusRadio" />
                    </Decorator>
                    <Decorator DataContext="{Binding DataContext, ElementName=HUDStatusSpeedometer}"
                           Style="{StaticResource A_Style_FrameworkElement_WaitSpinnerPositioner}">
                        <local:HUDWaitSpinnerControl x:Name="HUDStatusWaitSpinner" />
                    </Decorator>

                    <StackPanel HorizontalAlignment="Right" VerticalAlignment="Top">
                        <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_HudMediumLarge}" Text="{local:Loc EventBlueprint.IDS_RouteBlueprint_Hud_RouteLengthTitle}" HorizontalAlignment="Right"/>
                        <Decorator Height="12"/>
                        <Grid HorizontalAlignment="Right">
                            <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_GlassHudItem}"  Preset="{StaticResource A_FZMaterialPresetGlassRoundtangle_GlassPanel_OuterAll}"/>

                            <DockPanel Width="356" Height="36">
                                <Grid ClipToBounds="True" Width="{Binding RouteLengthRatio, Converter={StaticResource A_TransformConverter_LengthRatio}}" HorizontalAlignment="Left">
                                    <local:FZMaterial Color="#2C815F" 
                                              Preset="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_OuterAll}"
                                              HorizontalAlignment="Left"
                                              Width="356"/>
                                </Grid>
                            </DockPanel>
                            <local:FastTextBlock Text="{Binding RouteLength}" Style="{StaticResource A_Style_FastTextBlock_HudMedium}" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,10,0"/>
                        </Grid>
                        <Decorator Height="6"/>
                        <Grid HorizontalAlignment="Right">
                            <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_GlassHudItem}"  Preset="{StaticResource A_FZMaterialPresetGlassRoundtangle_GlassPanel_OuterAll}"/>
                            <DockPanel Width="356" Height="36">
                                <local:FZTextBlock DockPanel.Dock="Right" 
                                               local:MultiStringFormatter.Format="{local:Loc EventBlueprint.IDS_RouteBlueprint_CheckpointProgress}"
                                               local:MultiStringFormatter.Param0="{Binding AmountOfPlacedCheckpoints}"
                                               local:MultiStringFormatter.Param1="{Binding MaxCheckpoints}"
                                               local:TextBlockInlineMarkup.Markup="{Binding (local:MultiStringFormatter.Output), RelativeSource={RelativeSource Self}}"
                                               local:TextBlockInlineMarkup.ResourceBaseName="A_Style_FZRun_"
                                               Style="{StaticResource A_Style_FZTextBlock_HudMedium}" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,10,0"/>
                                <local:FZTextBlock Text="{local:Loc EventBlueprint.IDS_RouteBlueprint_CheckPoints}" Style="{StaticResource A_Style_FZTextBlock_HudMedium}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10,0"/>
                            </DockPanel>
                        </Grid>
                    </StackPanel>

                    <!-- Network Controls -->
                    <local:HUDNetworkStatusControl x:Name="HUDStatusNetworkStatus" />
                        
                    <Decorator Margin="0,0,0,24" VerticalAlignment="Bottom">
                        <local:HUDPressButtonControl x:Name="HUDStatusPressButton" Margin="0,0,0,0"/>
                    </Decorator>
                </Grid>
            </Grid>
        </Grid>
    </Grid>
</Page>
