<Window x:Class="FFXIV_TexTools.Views.Controls.ShaderConstantsEditor"
        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"
        xmlns:local="clr-namespace:FFXIV_TexTools.Views.Controls"
        mc:Ignorable="d"
        xmlns:resx="clr-namespace:FFXIV_TexTools.Resources"
        resx:Localization.Enabled="True"
        Title="Shader Constants Editor"
        ResizeMode="NoResize"
        SizeToContent="WidthAndHeight">
    <Grid Height="600" Width="750">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="60"></RowDefinition>
            <RowDefinition Height="40"></RowDefinition>
            <RowDefinition Height="1*"></RowDefinition>
            <RowDefinition Height="40"></RowDefinition>
        </Grid.RowDefinitions>
        
        <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5" TextAlignment="Center" FontStyle="Italic" FontSize="10">
            <Run Text="Shader Constants adjust individual shader effects, such as fresnel exponent or wetness intensity."/><LineBreak/>
            <Run Text="Some, but not all Constants have known names.  Others are described by their effect.  Others are unknown."/>
            <LineBreak/><Run Text="Each constant has a set number of values it expects.  It is not variable."/>
        </TextBlock>

        <Grid Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="200"></ColumnDefinition>
                <ColumnDefinition Width="100"></ColumnDefinition>
                <ColumnDefinition Width="100"></ColumnDefinition>
                <ColumnDefinition Width="100"></ColumnDefinition>
                <ColumnDefinition Width="100"></ColumnDefinition>
                <ColumnDefinition Width="100"></ColumnDefinition>
            </Grid.ColumnDefinitions>

            <Label FontWeight="Bold" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Bottom">Constant ID</Label>
            <Label FontWeight="Bold" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Bottom">Value 1</Label>
            <Label FontWeight="Bold" Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Bottom">Value 2</Label>
            <Label FontWeight="Bold" Grid.Column="3" HorizontalAlignment="Center" VerticalAlignment="Bottom">Value 3</Label>
            <Label FontWeight="Bold" Grid.Column="4" HorizontalAlignment="Center" VerticalAlignment="Bottom">Value 4</Label>
            <Button Grid.Column="5" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Click="AddConstant_Click">Add Constant</Button>
        </Grid>

        <ListBox x:Name="ConstantsList" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3">
            <ListBox.ItemContainerStyle>
                <Style TargetType="ListBoxItem">
                    <Setter Property="Padding" Value="0"/>
                </Style>
            </ListBox.ItemContainerStyle>
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="200"></ColumnDefinition>
                            <ColumnDefinition Width="100"></ColumnDefinition>
                            <ColumnDefinition Width="100"></ColumnDefinition>
                            <ColumnDefinition Width="100"></ColumnDefinition>
                            <ColumnDefinition Width="100"></ColumnDefinition>
                            <ColumnDefinition Width="100"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <ComboBox Grid.Column="0" HorizontalAlignment="Stretch" VerticalAlignment="Center"
                            DisplayMemberPath="Key"
                            SelectedValuePath="Value"
                            SelectedValue="{Binding Path=ConstantId}"
                            ItemsSource="{Binding Path=AvailableIds}"
                    />
                        <TextBox Grid.Column="1" Text="{Binding Path=Val0}" IsEnabled="{Binding Path=Val0Enabled}"></TextBox>
                        <TextBox Grid.Column="2" Text="{Binding Path=Val1}" IsEnabled="{Binding Path=Val1Enabled}"></TextBox>
                        <TextBox Grid.Column="3" Text="{Binding Path=Val2}" IsEnabled="{Binding Path=Val2Enabled}"></TextBox>
                        <TextBox Grid.Column="4" Text="{Binding Path=Val3}" IsEnabled="{Binding Path=Val3Enabled}"></TextBox>
                        <Button Grid.Column="5" Content="Remove" Click="RemoveConstant_Click"></Button>
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        
        <Button x:Name="ConfirmButton" Content="Confirm" Grid.Row="3" Width="100" Height="30" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="10,0,10,0" Click="Confirm_Click"/>
        <Button x:Name="CancelButton" Content="Cancel" Grid.Row="3" Width="100" Height="30" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10,0,10,0" Click="Cancel_Click"/>
    </Grid>
</Window>
