<UserControl
    x:Class="Ryujinx.Ava.UI.Views.Settings.SettingsHotkeysView"
    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:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
    xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels"
    xmlns:helpers="clr-namespace:Ryujinx.Ava.UI.Helpers"
    mc:Ignorable="d"
    x:DataType="viewModels:SettingsViewModel"
    x:CompileBindings="True"
    Focusable="True">
    <Design.DataContext>
        <viewModels:SettingsViewModel />
    </Design.DataContext>
    <UserControl.Resources>
        <helpers:KeyValueConverter x:Key="Key" />
    </UserControl.Resources>
    <UserControl.Styles>
        <Style Selector="StackPanel StackPanel">
            <Setter Property="Margin" Value="10, 0, 0, 0" />
            <Setter Property="Orientation" Value="Horizontal" />
        </Style>
        <Style Selector="StackPanel StackPanel > TextBlock">
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="Width" Value="230" />
        </Style>
        <Style Selector="ToggleButton, Button">
            <Setter Property="Width" Value="90" />
            <Setter Property="Height" Value="27" />
        </Style>
        <Style Selector="ToggleButton > TextBlock">
            <Setter Property="TextAlignment" Value="Center" />
        </Style>
    </UserControl.Styles>
    <ScrollViewer
        Name="HotkeysPage"
        HorizontalAlignment="Stretch"
        VerticalAlignment="Stretch"
        HorizontalScrollBarVisibility="Disabled"
        VerticalScrollBarVisibility="Auto">
        <Border Classes="settings">
            <StackPanel
                Margin="10"
                HorizontalAlignment="Stretch"
                Orientation="Vertical"
                Spacing="10"
                Name="SettingButtons">
                <TextBlock
                    Classes="h1"
                    Text="{locale:Locale SettingsTabHotkeysHotkeys}" />
                <StackPanel
                    Margin="10,0,0,0"
                    Spacing="10"
                    Orientation="Vertical">
                    <StackPanel>
                        <TextBlock Text="{locale:Locale SettingsTabHotkeysToggleVsyncHotkey}" />
                        <ToggleButton Name="ToggleVsync">
                            <TextBlock Text="{Binding KeyboardHotkey.ToggleVsync, Converter={StaticResource Key}}" />
                        </ToggleButton>
                    </StackPanel>
                    <StackPanel>
                        <TextBlock Text="{locale:Locale SettingsTabHotkeysScreenshotHotkey}" />
                        <ToggleButton Name="Screenshot">
                            <TextBlock Text="{Binding KeyboardHotkey.Screenshot, Converter={StaticResource Key}}" />
                        </ToggleButton>
                    </StackPanel>
                    <StackPanel>
                        <TextBlock Text="{locale:Locale SettingsTabHotkeysShowUiHotkey}" />
                        <ToggleButton Name="ShowUI">
                            <TextBlock Text="{Binding KeyboardHotkey.ShowUI, Converter={StaticResource Key}}" />
                        </ToggleButton>
                    </StackPanel>
                    <StackPanel>
                        <TextBlock Text="{locale:Locale SettingsTabHotkeysPauseHotkey}" />
                        <ToggleButton Name="Pause">
                            <TextBlock Text="{Binding KeyboardHotkey.Pause, Converter={StaticResource Key}}" />
                        </ToggleButton>
                    </StackPanel>
                    <StackPanel>
                        <TextBlock Text="{locale:Locale SettingsTabHotkeysToggleMuteHotkey}" />
                        <ToggleButton Name="ToggleMute">
                            <TextBlock Text="{Binding KeyboardHotkey.ToggleMute, Converter={StaticResource Key}}" />
                        </ToggleButton>
                    </StackPanel>
                    <StackPanel>
                        <TextBlock Text="{locale:Locale SettingsTabHotkeysResScaleUpHotkey}" />
                        <ToggleButton Name="ResScaleUp">
                            <TextBlock Text="{Binding KeyboardHotkey.ResScaleUp, Converter={StaticResource Key}}" />
                        </ToggleButton>
                    </StackPanel>
                    <StackPanel>
                        <TextBlock Text="{locale:Locale SettingsTabHotkeysResScaleDownHotkey}" />
                        <ToggleButton Name="ResScaleDown">
                            <TextBlock Text="{Binding KeyboardHotkey.ResScaleDown, Converter={StaticResource Key}}" />
                        </ToggleButton>
                    </StackPanel>
                    <StackPanel>
                        <TextBlock Text="{locale:Locale SettingsTabHotkeysVolumeUpHotkey}" />
                        <ToggleButton Name="VolumeUp">
                            <TextBlock Text="{Binding KeyboardHotkey.VolumeUp, Converter={StaticResource Key}}" />
                        </ToggleButton>
                    </StackPanel>
                    <StackPanel>
                        <TextBlock Text="{locale:Locale SettingsTabHotkeysVolumeDownHotkey}" />
                        <ToggleButton Name="VolumeDown">
                            <TextBlock Text="{Binding KeyboardHotkey.VolumeDown, Converter={StaticResource Key}}" />
                        </ToggleButton>
                    </StackPanel>
                </StackPanel>
                <Separator Height="1" />
                <StackPanel Margin="0">
                    <TextBlock
                        Classes="h1"
                        Text="{locale:Locale SettingsTabHotkeysCycleControllers}" />
                    <Button
                        Margin="10,0,0,0"
                        Content="+"
                        Command="{Binding KeyboardHotkey.AddCycleController}" />
                    <Button
                        Margin="10,0,0,0"
                        Content="-"
                        IsEnabled="{Binding KeyboardHotkey.CanRemoveCycleController}"
                        Command="{Binding KeyboardHotkey.RemoveCycleController}" />
                </StackPanel>
                <ItemsControl ItemsSource="{Binding KeyboardHotkey.CycleControllers}"
                    Name="CycleControllers">
                    <ItemsControl.ItemsPanel>
                        <ItemsPanelTemplate>
                            <StackPanel
                                Margin="0"
                                Orientation="Vertical"
                                Spacing="10" />
                        </ItemsPanelTemplate>
                    </ItemsControl.ItemsPanel>
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <StackPanel>
                                <TextBlock Text="{Binding Player}" />
                                <ToggleButton>
                                    <TextBlock
                                        Text="{Binding Hotkey, Converter={StaticResource Key}}" />
                                </ToggleButton>
                            </StackPanel>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
            </StackPanel>
        </Border>
   </ScrollViewer>
</UserControl>
