<Window x:Class="TwoMbit.SettingsWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Config" Height="400" Width="620" Activated="unpauseEmulation" WindowStartupLocation="CenterScreen" Closed="Window_Closed" >
    <Window.Resources>
        <Style x:Key="lvi" TargetType="ListViewItem">
            <Setter Property="Padding" Value="2 2 0 2" />
            <Setter Property="Margin" Value="1" />
            <Setter Property="BorderThickness" Value="0"/>
            <Style.Triggers>
                <Trigger Property="IsSelected" Value="true">
                    <Setter Property="BorderBrush" Value="#7998f1" />
                    <Setter Property="BorderThickness" Value="1"/>
                    <Setter Property="Margin" Value="0" />
                    <Setter Property="Padding" Value="5 2 0 2" />
                    <Setter Property="Foreground" Value="black" />
                </Trigger>
             </Style.Triggers>
        </Style>
        <Style x:Key="lbi" TargetType="ListBoxItem">
            <Setter Property="Padding" Value="2 2 2 2" />
            <Setter Property="Margin" Value="0" />
            <Setter Property="BorderThickness" Value="0"/>
            <Style.Triggers>
                <Trigger Property="IsSelected" Value="true">
                    <Setter Property="BorderBrush" Value="#7998f1" />
                    <Setter Property="BorderThickness" Value="1"/>
                    <Setter Property="Background" Value="#e2e9fe" />
                    <Setter Property="Margin" Value="0" />
                    <Setter Property="Padding" Value="1 1 1 1" />
                    <Setter Property="Foreground" Value="black" />
                </Trigger>
            </Style.Triggers>
        </Style>
    </Window.Resources>
   
    <StackPanel Orientation="Horizontal">
        <!-- Selection Area -->
        <StackPanel VerticalAlignment="Top" Width="70" Margin="10 10 0 0" >
            <ListView BorderThickness="1" Name="Selector">
                <ListViewItem Style="{StaticResource lvi}" Name="set_input" Content="Input" Selected="selectView" />
                <ListViewItem Style="{StaticResource lvi}" Name="adjust_video" Content="Video" Selected="selectView" />
                <ListViewItem Style="{StaticResource lvi}" Name="adjust_audio" Content="Audio" Selected="selectView" />
                <ListViewItem Style="{StaticResource lvi}" Name="set_paths" Content="Paths" Selected="selectView" />
                <ListViewItem Style="{StaticResource lvi}" Name="set_cheats" Content="Cheats" Selected="selectView" />
                <ListViewItem Style="{StaticResource lvi}" Name="set_options" Content="Options" Selected="selectView" />
            </ListView>
        </StackPanel>
        <!-- Display Area -->
        <StackPanel Width="478">
            <!-- Input Gui -->
            <StackPanel Name="InputGui" VerticalAlignment="Top" Margin="10 10">
                <StackPanel  Margin="0 0 0 10" >
                    <ComboBox Name="InputGuiSelector" HorizontalAlignment="Right" Width="70" Margin="0 0 0 0" Padding="5 0 2 2">
                        <ComboBoxItem Content="None" Name="InputNone" Selected="selectInputGui" IsSelected="True" />
                    </ComboBox>
                </StackPanel>
                <StackPanel Orientation="Horizontal">
                    <ComboBox Name="InputBox"  HorizontalAlignment="Left" Margin="0 0 10 0" Padding="4 4 4 4" Width="120" IsEnabled="false">
                        <ComboBoxItem Content="-" IsSelected="True" />
                    </ComboBox>
                    <TextBlock Text="-->"  Margin="0 0 10 0" VerticalAlignment="Center" HorizontalAlignment="Stretch" />
                    <Button Content="empty" IsEnabled="false" Click="unmapDevice" Name="InputEmpty" Padding="5 0 5 0"  />
                </StackPanel>
                <DataGrid MouseDoubleClick="remapInput" SelectionMode="Single"  BorderBrush="Gray" GridLinesVisibility="None"  IsReadOnly="True" CanUserReorderColumns="False" CanUserSortColumns = "False" HeadersVisibility="Column" AutoGenerateColumns="False" Height="200" Width="452" HorizontalAlignment="Left" Margin="0,10,0,0" Name="InputMap" VerticalAlignment="Top" Padding="0 0 0 0">
                </DataGrid>
                <TextBlock Name="InputGuiTxt" Margin="0 10 0 0" />
                <StackPanel Orientation="Horizontal" Margin="0 10 0 0">
                    <TextBlock Name="InputPort1Txt" Text="Port 1: "  Margin="0 0 0 0" VerticalAlignment="Center" />
                    <ComboBox Name="InputPort1Box"  HorizontalAlignment="Left" Margin="0 0 10 0" Padding="4 4 4 4" Width="170" IsEnabled="false">
                        <ComboBoxItem Content="-" IsSelected="True" />
                    </ComboBox>
                    <TextBlock Name="InputPort2Txt" Text="Port 2: "  Margin="30 0 0 0" VerticalAlignment="Center" />
                    <ComboBox Name="InputPort2Box"  HorizontalAlignment="Left" Margin="0 0 10 0" Padding="4 4 4 4" Width="170" IsEnabled="false">
                        <ComboBoxItem Content="-" IsSelected="True" />
                    </ComboBox>
                </StackPanel>
            </StackPanel>
            <!-- Cheats Gui -->
            <StackPanel Name="CheatsGui" VerticalAlignment="Top" Margin="10 10" Visibility="Hidden" >
                <TextBlock Name="CheatsGuiCode" Text="code:"  Margin="0 0 0 4" />
                <StackPanel Orientation="Horizontal">
                    <TextBox Name="CheatsGuiCodeBox" Width="120" Margin="0 0 10 0" IsEnabled="False" />
                    <Button Content="add code" Name="CheatsGuiAdd" Width="75" Margin="0 0 10 0" IsEnabled="False" />
                    <Button Content="delete code" Name="CheatsGuiDelete" Width="75" IsEnabled="False" />
                </StackPanel>
                <TextBlock Name="CheatsGuiDesc" Text="description:"  Margin="0 10 0 4" />
                <StackPanel Orientation="Horizontal">
                    <TextBox Name="CheatsGuiDescBox" Width="120" Margin="0 0 10 0" IsEnabled="False" />
                    <Button Content="on / off" Name="CheatsGuiActive" Width="75" Margin="0 0 10 0" IsEnabled="False" />
                    <Button Content="edit code" Name="CheatsGuiEdit" Width="75" IsEnabled="False" />
                </StackPanel>
                <DataGrid HeadersVisibility="Column"  AutoGenerateColumns="False"  HorizontalAlignment="Left" Margin="0 10 0 0" Name="CheatsGuiGrid" VerticalAlignment="Top"  Padding="0 0 0 0" >
                    <DataGrid.Columns>
                        <DataGridTextColumn Header="active" />
                        <DataGridTextColumn Header="code" />
                        <DataGridTextColumn Header="description" />
                    </DataGrid.Columns>
                </DataGrid>
            </StackPanel>
            <!--Option Gui-->
            <StackPanel Name="OptionGui" VerticalAlignment="Top" Margin="10 10" Visibility="Hidden">
                <StackPanel  Margin="0 0 0 10" >
                    <ComboBox Name="OptionGuiSelector" HorizontalAlignment="Right" Width="50" Margin="0 0 0 0" Padding="5 0 2 2">
                    </ComboBox>
                </StackPanel>
                <TextBlock Name="OptionGuiLanguage" Text="Language:"  Margin="0 5 0 2" />
                <StackPanel>
                    <ListBox Name="OptionGuiLanguageList" BorderThickness="1" >
                        <ListBoxItem Content="English" />
                        <ListBoxItem Content="German" />
                    </ListBox>
                </StackPanel>
                <StackPanel Name="OptionGuisms" Visibility="Visible">
                    <TextBlock Name="OptionGuiSmsUnit" Text="Sms Unit:"  Margin="0 10 0 4" />
                    <StackPanel Orientation="Horizontal">
                        <RadioButton Content="SMS 1" Height="14" Name="OptionGuiSmsUnit1" GroupName="OptionGuiSmsUnit" Checked="setSmsUnit" Margin="0 0 40 0" Padding="5 0 0 0" />
                        <RadioButton Content="SMS 2" Height="14" Name="OptionGuiSmsUnit2" GroupName="OptionGuiSmsUnit" Checked="setSmsUnit" Margin="0 0 40 0" Padding="5 0 0 0" />
                    </StackPanel>
                    <TextBlock Name="OptionGuiSmsUseBios" Text="Bios:"  Margin="0 10 0 4" />
                    <CheckBox Content="Use Bios" Height="20" Name="OptionGuiSmsUseBiosCheck" Click="useSmsBios" Margin="0 0 0 0" Padding="5 0 0 0" />
                </StackPanel>
                <StackPanel Name="OptionGuisnes" Visibility="Hidden">
                </StackPanel>
            </StackPanel>
            <!--Path Gui -->
            <StackPanel Name="PathGui" VerticalAlignment="Top" Margin="10 10" Visibility="Hidden">
                <StackPanel  Margin="0 0 0 10" >
                    <ComboBox Name="PathGuiSelector" HorizontalAlignment="Right" Width="50" Margin="0 0 0 0" Padding="5 0 2 2">
                    </ComboBox>
                </StackPanel>
                <StackPanel Name="PathGuisms" Visibility="Visible">
                    <TextBlock Name="PathGuiSmsRom" Text="Rom path:"  Margin="0 0 0 4" />
                    <StackPanel Orientation="Horizontal">
                        <TextBox Name="PathGuiSmsRomBox" VerticalAlignment="Center" Width="250" Margin="0 0 10 0" />
                        <Button Content="select ..." Name="PathGuiSmsRomSelect" Width="75" Margin="0 0 10 0" Click="setPath" />
                        <Button Content="default" Name="PathGuiSmsRomDefault" Width="75" Click="clearPath" />
                    </StackPanel>
                    <TextBlock Name="PathGuiSmsSram" Text="Sram path:"  Margin="0 5 0 2" />
                    <StackPanel Orientation="Horizontal">
                        <TextBox Name="PathGuiSmsSramBox" VerticalAlignment="Center" Width="250" Margin="0 0 10 0" />
                        <Button Content="select ..." Name="PathGuiSmsSramSelect" Width="75" Margin="0 0 10 0" Click="setPath" />
                        <Button Content="default" Name="PathGuiSmsSramDefault" Width="75" Click="clearPath" />
                    </StackPanel>
                    <TextBlock Name="PathGuiSmsSavestate" Text="Savestate path:"  Margin="0 5 0 2" />
                    <StackPanel Orientation="Horizontal">
                        <TextBox Name="PathGuiSmsSavestateBox" VerticalAlignment="Center" Width="250" Margin="0 0 10 0"  />
                        <Button Content="select ..." Name="PathGuiSmsSavestateSelect" Width="75" Margin="0 0 10 0" Click="setPath" />
                        <Button Content="default" Name="PathGuiSmsSavestateDefault" Width="75" Click="clearPath" />
                    </StackPanel>
                    <TextBlock Name="PathGuiSmsCheat" Text="Cheat path:"  Margin="0 5 0 2" />
                    <StackPanel Orientation="Horizontal">
                        <TextBox Name="PathGuiSmsCheatBox" VerticalAlignment="Center" Width="250" Margin="0 0 10 0" />
                        <Button Content="select ..." Name="PathGuiSmsCheatSelect" Width="75" Margin="0 0 10 0" Click="setPath" />
                        <Button Content="default" Name="PathGuiSmsCheatDefault" Width="75" Click="clearPath" />
                    </StackPanel>
                    <TextBlock Name="PathGuiSmsBiosJp" Text="SMS japanese/korean Bios:"  Margin="0 5 0 2" />
                    <StackPanel Orientation="Horizontal">
                        <TextBox Name="PathGuiSmsBiosJpBox" VerticalAlignment="Center" Width="250" Margin="0 0 10 0" />
                        <Button Content="select ..." Name="PathGuiSmsBiosJpSelect" Width="75" Margin="0 0 10 0" Click="setFile" />
                        <Button Content="default" Name="PathGuiSmsBiosJpDefault" Width="75" Click="clearPath" />
                    </StackPanel>
                    <TextBlock Name="PathGuiSmsBiosUs" Text="SMS us/eu Bios:"  Margin="0 5 0 2" />
                    <StackPanel Orientation="Horizontal">
                        <TextBox Name="PathGuiSmsBiosUsBox" VerticalAlignment="Center" Width="250" Margin="0 0 10 0" />
                        <Button Content="select ..." Name="PathGuiSmsBiosUsSelect" Width="75" Margin="0 0 10 0" Click="setFile" />
                        <Button Content="default" Name="PathGuiSmsBiosUsDefault" Width="75" Click="clearPath" />
                    </StackPanel>
                </StackPanel>
                <StackPanel Name="PathGuisnes" Visibility="Hidden">
                    <TextBlock Name="PathGuiSnesRom" Text="Rom path:"  Margin="0 0 0 4" />
                    <StackPanel Orientation="Horizontal">
                        <TextBox Name="PathGuiSnesRomBox" VerticalAlignment="Center" Width="250" Margin="0 0 10 0" />
                        <Button Content="select ..." Name="PathGuiSnesRomSelect" Width="75" Margin="0 0 10 0" Click="setPath" />
                        <Button Content="default" Name="PathGuiSnesRomDefault" Width="75" Click="clearPath" />
                    </StackPanel>
                    <TextBlock Name="PathGuiSnesSram" Text="Sram path:"  Margin="0 5 0 2" />
                    <StackPanel Orientation="Horizontal">
                        <TextBox Name="PathGuiSnesSramBox" VerticalAlignment="Center" Width="250" Margin="0 0 10 0" />
                        <Button Content="select ..." Name="PathGuiSnesSramSelect" Width="75" Margin="0 0 10 0" Click="setPath" />
                        <Button Content="default" Name="PathGuiSnesSramDefault" Width="75" Click="clearPath" />
                    </StackPanel>
                    <TextBlock Name="PathGuiSnesSavestate" Text="Savestate path:"  Margin="0 5 0 2" />
                    <StackPanel Orientation="Horizontal">
                        <TextBox Name="PathGuiSnesSavestateBox" VerticalAlignment="Center" Width="250" Margin="0 0 10 0"  />
                        <Button Content="select ..." Name="PathGuiSnesSavestateSelect" Width="75" Margin="0 0 10 0" Click="setPath" />
                        <Button Content="default" Name="PathGuiSnesSavestateDefault" Width="75" Click="clearPath" />
                    </StackPanel>
                    <TextBlock Name="PathGuiSnesCheat" Text="Cheat path:"  Margin="0 5 0 2" />
                    <StackPanel Orientation="Horizontal">
                        <TextBox Name="PathGuiSnesCheatBox" VerticalAlignment="Center" Width="250" Margin="0 0 10 0" />
                        <Button Content="select ..." Name="PathGuiSnesCheatSelect" Width="75" Margin="0 0 10 0" Click="setPath" />
                        <Button Content="default" Name="PathGuiSnesCheatDefault" Width="75" Click="clearPath" />
                    </StackPanel>
                    <TextBlock Name="PathGuiSnesSufami" Text="Sufami Turbo Bios:"  Margin="0 5 0 2" />
                    <StackPanel Orientation="Horizontal">
                        <TextBox Name="PathGuiSnesSufamiBox" VerticalAlignment="Center" Width="250" Margin="0 0 10 0" />
                        <Button Content="select ..." Name="PathGuiSnesSufamiSelect" Width="75" Margin="0 0 10 0" Click="setFile" />
                        <Button Content="default" Name="PathGuiSnesSufamiDefault" Width="75" Click="clearPath" />
                    </StackPanel>
                    <TextBlock Name="PathGuiSnesBsx" Text="BS-X Bios:"  Margin="0 5 0 2" />
                    <StackPanel Orientation="Horizontal">
                        <TextBox Name="PathGuiSnesBsxBox" VerticalAlignment="Center" Width="250" Margin="0 0 10 0" />
                        <Button Content="select ..." Name="PathGuiSnesBsxSelect" Width="75" Margin="0 0 10 0" Click="setFile" />
                        <Button Content="default" Name="PathGuiSnesBsxDefault" Width="75" Click="clearPath" />
                    </StackPanel>

                </StackPanel>
            </StackPanel>
            <!-- Audio Gui -->
            <StackPanel Name="AudioGui" VerticalAlignment="Top" Margin="10 10" Visibility="Hidden">
                <TextBlock Name="AudioGuiVolume" Text="Volume:"  Margin="0 0 0 4" />
                <StackPanel Orientation="Horizontal">
                    <Slider Name="AudioGuiVolumeSlider" Width="300" Margin="0 0 10 0" Minimum="0" Maximum="100" ValueChanged="setVolumeSlider" />
                    <TextBlock Text="100" Name="AudioGuiVolumeBox" VerticalAlignment="Center" Width="50" Margin="0 0 10 0" />
                    <Button Content="default" Name="AudioGuiVolumeDefault" Click="setVolumeDefault" Width="75" />
                </StackPanel>
                <TextBlock Name="smsAudioGuiFrequency" Text="Sms Frequency:"  Margin="0 10 0 4" />
                <StackPanel Orientation="Horizontal">
                    <Slider Name="smsAudioGuiFrequencySlider" Width="300" Margin="0 0 10 0" Minimum="0" Maximum="600" ValueChanged="setFrequencySlider" />
                    <TextBlock Text="100" Name="smsAudioGuiFrequencyBox" VerticalAlignment="Center" Width="50" Margin="0 0 10 0" />
                    <Button Content="default" Name="smsAudioGuiFrequencyDefault" Click="setFrequencyDefault" Width="75" />
                </StackPanel>
                <StackPanel Name="snesAudioFrequencyArea">
                    <TextBlock Name="snesAudioGuiFrequency" Text="Snes Frequency:"  Margin="0 10 0 4" />
                    <StackPanel Orientation="Horizontal">
                        <Slider Name="snesAudioGuiFrequencySlider" Width="300" Margin="0 0 10 0" Minimum="0" Maximum="600" ValueChanged="setFrequencySlider" />
                        <TextBlock Text="100" Name="snesAudioGuiFrequencyBox" VerticalAlignment="Center" Width="50" Margin="0 0 10 0" />
                        <Button Content="default" Name="snesAudioGuiFrequencyDefault" Click="setFrequencyDefault" Width="75" />
                    </StackPanel>
                </StackPanel>
            </StackPanel>
            <!-- Video Gui -->
            <StackPanel Name="VideoGui" VerticalAlignment="Top" Margin="10 10" Visibility="Hidden">
                <TextBlock Name="VideoGuiBrightness" Text="Brightness:"  Margin="0 0 0 4" />
                <StackPanel Orientation="Horizontal">
                    <Slider Name="VideoGuiBrightnessSlider" Width="300" Margin="0 0 10 0" Minimum="0" Maximum="200" ValueChanged="setBrightnessSlider" />
                    <TextBlock Text="100" Name="VideoGuiBrightnessBox" VerticalAlignment="Center" Width="40" Margin="0 0 10 0" />
                    <Button Content="default" Name="VideoGuiBrightnessDefault" Width="75" Click="setBrightnessDefault" />
                </StackPanel>
                <TextBlock Name="VideoGuiContrast" Text="Contrast:"  Margin="0 10 0 4" />
                <StackPanel Orientation="Horizontal">
                    <Slider Name="VideoGuiContrastSlider" Width="300" Margin="0 0 10 0" Minimum="0" Maximum="200" ValueChanged="setContrastSlider" />
                    <TextBlock Text="100" Name="VideoGuiContrastBox" VerticalAlignment="Center" Width="40" Margin="0 0 10 0" />
                    <Button Content="default" Name="AudioGuiContrastDefault" Width="75" Click="setContrastDefault" />
                </StackPanel>
                <TextBlock Name="VideoGuiGama" Text="Gamma:"  Margin="0 10 0 4" />
                <StackPanel Orientation="Horizontal">
                    <Slider Name="VideoGuiGammaSlider" Width="300" Margin="0 0 10 0" Minimum="0" Maximum="300" ValueChanged="setGammaSlider" />
                    <TextBlock Text="100" Name="VideoGuiGammaBox" VerticalAlignment="Center" Width="40" Margin="0 0 10 0" />
                    <Button Content="default" Name="VideoGuiGammaDefault" Width="75" Click="setGammaDefault" />
                </StackPanel>
                <TextBlock Name="VideoGuiScanlines" Text="Scanlines:"  Margin="0 10 0 4" />
                <StackPanel Orientation="Horizontal">
                    <Slider Name="VideoGuiScanlinesSlider" Width="300" Margin="0 0 10 0" IsEnabled="False" Minimum="0" Maximum="100" ValueChanged="setScanlineSlider" />
                    <TextBlock Text="100" Name="VideoGuiScanlinesBox" VerticalAlignment="Center" Width="40" Margin="0 0 10 0" />
                    <CheckBox Height="14" Name="VideoGuiScanlinesActive" Click="enableScanline" />
                </StackPanel>
                <Separator Height="1" Margin="0 20 0 0" />
                <TextBlock Name="VideoGuiNtsc" Text="Ntsc Filter:"  Margin="0 20 0 4" />
                <StackPanel Orientation="Horizontal">
                    <RadioButton Content="AV" Height="14" Name="VideoGuiNtscAv" Click="setNtscCable" Margin="0 0 40 0" Padding="5 0 0 0" />
                    <RadioButton Content="SVideo" Height="14" Name="VideoGuiNtscSvideo" Click="setNtscCable" Margin="0 0 40 0" Padding="5 0 0 0" />
                    <RadioButton Content="RGB" Height="14" Name="VideoGuiNtscRgb" Click="setNtscCable" Padding="5 0 0 0" />
                </StackPanel>
                <CheckBox Content="merge scan fields" Height="20" Name="VideoGuiNtscMerge" Click="setNtscMerge" Margin="0 10 0 0" Padding="5 0 0 0" />
            </StackPanel>
        </StackPanel>
    </StackPanel>
</Window>
