<Window x:Class="HobbitSpeedrunTools.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        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"
        mc:Ignorable="d"
        Title="HobbitSpeedrunTools" SizeToContent="WidthAndHeight" Style="{DynamicResource CustomWindowStyle}" Background="{StaticResource dark1}" Icon="../../img/icon.png" SnapsToDevicePixels="True" ResizeMode="NoResize">
    <Window.Resources>
        <DataTemplate x:Key="CheatToggleTemplate">
            <CheckBox Content="{Binding Path=Name}" HorizontalAlignment="Stretch" Margin="0,0,0,0" Checked="cbxCheat_Checked" Unchecked="cbxCheat_Unchecked" Loaded="cbxCheat_Loaded" IsThreeState="True" Indeterminate="CheckBox_Indeterminate" ToolTip="{Binding Path=ToolTip}"/>
        </DataTemplate>
    </Window.Resources>

    <Grid Margin="10,10,10,10">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="auto" MinWidth="210"/>
            <ColumnDefinition Width="1*"/>
            <ColumnDefinition Width="auto" MinWidth="280"/>
        </Grid.ColumnDefinitions>

        <GroupBox Header="Cheats" Grid.Row="0"  Margin="0,0,10,0">
            <ItemsControl x:Name="itcCheats" Margin="0,0,0,0"  HorizontalAlignment="Stretch" ItemsSource="{Binding}" ItemTemplate="{StaticResource CheatToggleTemplate}"/>
        </GroupBox>

        <Grid Grid.Column="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="auto"/>
                <RowDefinition Height="1*"/>
            </Grid.RowDefinitions>

            <GroupBox Header="Save Manager" Grid.Row="0" Grid.Column="1" Margin="0,0,0,10">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="auto"/>
                        <RowDefinition Height="auto"/>
                        <RowDefinition Height="auto"/>
                        <RowDefinition Height="auto"/>
                    </Grid.RowDefinitions>
                    <Label Grid.Row="0" x:Name="lblSaveCollection" Content="Save Collection" HorizontalAlignment="Stretch" Margin="0,0,0,0" VerticalAlignment="Top" Width="auto" Padding="0,0,0,0"/>
                    <ComboBox Grid.Row="1" x:Name="cbxSaveCollections" HorizontalAlignment="Stretch" Margin="0,5,0,0" VerticalAlignment="Top" Width="auto" Padding="0,0,0,0" SelectionChanged="cbxSaveCollections_SelectionChanged"/>
                    <Label Grid.Row="2" x:Name="lblSaves" Content="Save" HorizontalAlignment="Stretch" Margin="0,10,0,0" VerticalAlignment="Top" Width="auto" Padding="0,0,0,0"/>
                    <ComboBox Grid.Row="3" x:Name="cbxSaves" HorizontalAlignment="Stretch" Margin="0,5,0,0" VerticalAlignment="Top" Width="auto" IsEnabled="False" SelectionChanged="cbxSaves_SelectionChanged"/>
                </Grid>
            </GroupBox>

            <GroupBox Header="Info" Grid.Row="1" Grid.Column="1" Margin="0,0,0,0">
                <Grid Grid.Column="1">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="1*"/>
                        <ColumnDefinition Width="auto"/>
                        <ColumnDefinition Width="auto"/>
                        <ColumnDefinition Width="auto"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="auto"/>
                        <RowDefinition Height="auto"/>
                        <RowDefinition Height="auto"/>
                    </Grid.RowDefinitions>
                    <TextBlock Grid.Row="0" Grid.Column="0" Text="Bilbo Position:"/>
                    <TextBox Grid.Row="0" Grid.Column="1" x:Name="txtBilboPosX" Width="100" Margin="10,0,5,0" Text="X: 0.0" IsReadOnly="True" HorizontalContentAlignment="Right"/>
                    <TextBox Grid.Row="0" Grid.Column="2" x:Name="txtBilboPosY" Width="100" Margin="0,0,5,0" Text="Y: 0.0" IsReadOnly="True" HorizontalContentAlignment="Right"/>
                    <TextBox Grid.Row="0" Grid.Column="3" x:Name="txtBilboPosZ" Width="100" Text="Z: 0.0" IsReadOnly="True" HorizontalContentAlignment="Right"/>
                    <TextBlock Grid.Row="1" Grid.Column="0" Text="Bilbo Rotation:" Margin="0,5,0,0"/>
                    <TextBox Grid.Row="1" Grid.Column="3" x:Name="txtBilboRotation" Width="100" Margin="0,5,0,0" Text="0.0" IsReadOnly="True" HorizontalContentAlignment="Right"/>
                    <TextBlock Grid.Row="2" Grid.Column="0" Text="Clipwarp Position:" Margin="0,5,0,0"/>
                    <TextBox Grid.Row="2" Grid.Column="1" x:Name="txtClipwarpPosX" Width="100" Margin="10,5,5,0" Text="X: 000000.0" IsReadOnly="True" HorizontalContentAlignment="Right"/>
                    <TextBox Grid.Row="2" Grid.Column="2" x:Name="txtClipwarpPosY" Width="100" Margin="0,5,5,0" Text="Y: 0.0" IsReadOnly="True" HorizontalContentAlignment="Right"/>
                    <TextBox Grid.Row="2" Grid.Column="3" x:Name="txtClipwarpPosZ" Width="100" Margin="0,5,0,0" Text="Z: 0.0" IsReadOnly="True" HorizontalContentAlignment="Right"/>
                </Grid>
            </GroupBox>
        </Grid>
        <Grid Grid.Column="2" Margin="10,0,0,0">
            <Grid.RowDefinitions>
                <RowDefinition Height="1*"/>
                <RowDefinition Height="auto"/>
            </Grid.RowDefinitions>
            <GroupBox Header="Segment Timer" Grid.Row="0" Grid.Column="3" Margin="0,0,0,10">
                <Grid Grid.Column="1">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="auto"/>
                        <ColumnDefinition Width="1*"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="auto"/>
                        <RowDefinition Height="auto"/>
                        <RowDefinition Height="auto"/>
                        <RowDefinition Height="auto"/>
                        <RowDefinition Height="auto"/>
                        <RowDefinition Height="auto"/>
                        <RowDefinition Height="auto"/>
                    </Grid.RowDefinitions>
                    <TextBlock Grid.Row="0" Grid.Column="0" Text="Timer" VerticalAlignment="Center" Margin="0,0,0,5"/>
                    <TextBox Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2" x:Name="txtTimer" Margin="10,0,0,5" Text="00:00.000" IsReadOnly="True" HorizontalContentAlignment="Right"/>
                    <TextBlock Grid.Row="1" Grid.Column="0" Text="Best Time" VerticalAlignment="Center" Margin="0,0,0,5"/>
                    <Grid Grid.Row="1" Grid.Column="2">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="1*"/>
                            <ColumnDefinition Width="auto"/>
                        </Grid.ColumnDefinitions>
                        <TextBox Grid.Column="0" x:Name="txtBestTime" Margin="10,0,5,5" Text="00:00.000" IsReadOnly="True" HorizontalContentAlignment="Right"/>
                        <Button Grid.Column="1" Content="↻" x:Name="btnResetBestTime" Margin="0,0,0,0" VerticalAlignment="Top" Click="btnResetBestTime_Click"/>
                    </Grid>
                    <TextBlock Grid.Row="2" Grid.Column="0" Text="Average Time" VerticalAlignment="Center" Margin="0,0,0,5"/>
                    <Grid Grid.Row="2" Grid.Column="2">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="1*"/>
                            <ColumnDefinition Width="auto"/>
                        </Grid.ColumnDefinitions>
                        <TextBox Grid.Column="0" x:Name="txtAverageTime" Margin="10,0,5,5" Text="00:00.000" IsReadOnly="True" HorizontalContentAlignment="Right"/>
                        <Button Grid.Column="1" Content="↻" x:Name="btnResetAverageTime" Margin="0,0,0,0" VerticalAlignment="Top" Click="btnResetAverageTime_Click"/>
                    </Grid>
                    <TextBlock Grid.Row="3" Grid.Column="0" Text="Mode" VerticalAlignment="Center" Margin="0,0,0,0"/>
                    <ComboBox SelectedValuePath="Content" Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="2" x:Name="cbxTimerMode" HorizontalAlignment="Stretch" Margin="10,0,0,0" VerticalAlignment="Top" Width="auto" SelectionChanged="cbxTimerMode_SelectionChanged">
                        <ComboBoxItem IsSelected="True">Off</ComboBoxItem>
                        <ComboBoxItem>Full Level</ComboBoxItem>
                        <ComboBoxItem>Move To Point</ComboBoxItem>
                    </ComboBox>
                    <TextBlock Grid.Row="4" Grid.Column="0" Text="End Point" VerticalAlignment="Center" x:Name="lblEndPoint" Margin="0,5,0,0" Visibility="Collapsed"/>
                    <Button Grid.Row="4" Grid.Column="1" Content="Set" x:Name="btnSetEndPoint" Margin="10,5,0,0" VerticalAlignment="Top" Click="btnSetEndPoint_Click" Visibility="Collapsed"/>
                    <TextBlock Grid.Row="5" Grid.Column="0" Text="Point Radius" x:Name="lblPointRadius" VerticalAlignment="Center" Margin="0,5,0,0" Visibility="Collapsed"/>
                    <TextBox Grid.Row="5" Grid.Column="1" Grid.ColumnSpan="2" x:Name="txtPointRadius" Margin="10,5,0,0" Text="100" HorizontalContentAlignment="Right" TextChanged="txtPointRadius_TextChanged" Visibility="Collapsed"/>
                    <TextBlock Grid.Row="6" Grid.Column="0" Text="Level" VerticalAlignment="Center" x:Name="lblSelectedLevel" Margin="0,5,0,0" Visibility="Collapsed"/>
                    <ComboBox SelectedValuePath="Content" Grid.Row="6" Grid.Column="1" Grid.ColumnSpan="2" x:Name="cbxSelectedLevel" HorizontalAlignment="Stretch" Margin="10,5,0,0" VerticalAlignment="Top" Width="auto" SelectionChanged="cbxSelectedLevel_SelectionChanged" Visibility="Collapsed">
                        <ComboBoxItem IsSelected="True">Dream World</ComboBoxItem>
                        <ComboBoxItem>Unexpected Party</ComboBoxItem>
                        <ComboBoxItem>Roast Mutton</ComboBoxItem>
                        <ComboBoxItem>Troll Hole</ComboBoxItem>
                        <ComboBoxItem>Over Hill</ComboBoxItem>
                        <ComboBoxItem>Riddles</ComboBoxItem>
                        <ComboBoxItem>Flies</ComboBoxItem>
                        <ComboBoxItem>Barrels</ComboBoxItem>
                        <ComboBoxItem>Warm Welcome</ComboBoxItem>
                        <ComboBoxItem>Inside Info</ComboBoxItem>
                        <ComboBoxItem>Gathering</ComboBoxItem>
                        <ComboBoxItem>Clouds Burst</ComboBoxItem>
                    </ComboBox>
                </Grid>
            </GroupBox>

            <GroupBox Header="Settings" Grid.Column="0" Grid.Row="1" Margin="0,0,0,0">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="1*"/>
                        <ColumnDefinition Width="1*"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="auto"/>
                        <RowDefinition Height="auto"/>
                        <RowDefinition Height="auto"/>
                        <RowDefinition Height="auto"/>
                    </Grid.RowDefinitions>
                    <Button Grid.Column="0" Grid.Row="0" x:Name="btnOpenConfig" Content="Open Config" Click="btnOpenConfig_Click" Margin="0,0,2.5,0"/>
                    <Button Grid.Column="1" Grid.Row="0" x:Name="btnOpenHelp" Content="Help" Margin="2.5,0,0,0" Click="btnOpenHelp_Click"/>
                    <CheckBox Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="2" x:Name="cbxLoadCheatsWithSave" Content="Load applied cheats with save" HorizontalAlignment="Stretch" Margin="0,5,0,0" Click="cbxLoadCheatsWithSave_Click" IsThreeState="True" Indeterminate="CheckBox_Indeterminate"/>
                    <Button Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="2" x:Name="btnApplyCheatsSave" Content="Apply Cheats to Save" Margin="0,5,0,0" Click="btnApplyCheatsSave_Click"/>
                    <Button Grid.Column="0" Grid.Row="3" Grid.ColumnSpan="2" x:Name="btnApplyCheatsCollection" Content="Apply Cheats to Collection" Margin="0,5,0,0" Click="btnApplyCheatsCollection_Click"/>
                </Grid>
            </GroupBox>
        </Grid>

    </Grid>
</Window>
