<UserControl xmlns="https://github.com/avaloniaui"
             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:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
             xmlns:playback="clr-namespace:Artemis.UI.Screens.ProfileEditor.Playback"
             mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="48"
             x:Class="Artemis.UI.Screens.ProfileEditor.Playback.PlaybackView"
             x:DataType="playback:PlaybackViewModel">
    <Grid Margin="8 0">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="200"/>
        </Grid.ColumnDefinitions>
        <StackPanel Grid.Column="0" Orientation="Horizontal" Spacing="5">
            <Button Classes="icon-button icon-button-large"
                    ToolTip.Tip="Play from start (Shift+Space)" Command="{CompiledBinding PlayFromStart}"
                    Focusable="False">
                <avalonia:MaterialIcon Kind="StepForward" />
            </Button>
            <Button Classes="icon-button icon-button-large"
                    ToolTip.Tip="Toggle play/pause (Space)" Command="{CompiledBinding TogglePlay}" Focusable="False">
                <StackPanel>
                    <avalonia:MaterialIcon Kind="Play" IsVisible="{CompiledBinding !Playing}" />
                    <avalonia:MaterialIcon Kind="Pause" IsVisible="{CompiledBinding Playing}" />
                </StackPanel>
            </Button>
            <Button Classes="icon-button icon-button-large" ToolTip.Tip="Go to start" Command="{CompiledBinding GoToStart}" Focusable="False">
                <avalonia:MaterialIcon Kind="SkipBackward" />
            </Button>
            <Button Classes="icon-button icon-button-large" ToolTip.Tip="Go to end" Command="{CompiledBinding GoToEnd}" Focusable="False">
                <avalonia:MaterialIcon Kind="SkipForward" />
            </Button>
            <Button Classes="icon-button icon-button-large" ToolTip.Tip="Previous frame" Command="{CompiledBinding GoToPreviousFrame}" Focusable="False">
                <avalonia:MaterialIcon Kind="SkipPrevious" />
            </Button>
            <Button Classes="icon-button icon-button-large" ToolTip.Tip="Next frame" Command="{CompiledBinding GoToNextFrame}" Focusable="False">
                <avalonia:MaterialIcon Kind="SkipNext" />
            </Button>
            <ToggleButton Classes="icon-button icon-button-large"
                          IsChecked="{CompiledBinding Repeating, Mode=OneWay}"
                          Focusable="False"
                          Command="{CompiledBinding CycleRepeating}">
                <ToolTip.Tip>
                    <StackPanel>
                        <StackPanel IsVisible="{CompiledBinding Repeating}">
                            <TextBlock Text="Repeat entire timeline"
                                       IsVisible="{CompiledBinding RepeatTimeline}" />
                            <TextBlock Text="Repeat segment"
                                       IsVisible="{CompiledBinding RepeatSegment}" />
                        </StackPanel>
                        <TextBlock IsVisible="{CompiledBinding !Repeating}">
                            Don't repeat the timeline
                        </TextBlock>
                        <TextBlock TextWrapping="Wrap">
                            This setting only applies to the editor and does not affect the repeat mode during normal profile playback
                        </TextBlock>
                    </StackPanel>
                </ToolTip.Tip>
                <Grid>
                    <avalonia:MaterialIcon Kind="Repeat" IsVisible="{CompiledBinding RepeatTimeline}" />
                    <avalonia:MaterialIcon Kind="RepeatOne" IsVisible="{CompiledBinding RepeatSegment}" />
                </Grid>

            </ToggleButton>
        </StackPanel>
        <TextBlock Grid.Column="1" Classes="h4" Height="32" Text="{CompiledBinding FormattedCurrentTime, FallbackValue=00.000}" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0" />
    </Grid>
</UserControl>