<!--
Copyright 2019 faddenSoft

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<Window x:Class="SourceGen.WpfGui.EditAppSettings"
        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:system="clr-namespace:System;assembly=mscorlib"
        xmlns:local="clr-namespace:SourceGen.WpfGui"
        mc:Ignorable="d"
        Title="Edit Application Settings"
        Width="700" Height="440" ResizeMode="NoResize"
        ShowInTaskbar="False" WindowStartupLocation="CenterOwner"
        Loaded="Window_Loaded">

    <Window.Resources>
        <system:String x:Key="str_PresetCustom">Custom</system:String>
        <system:String x:Key="str_PresetDefault">Default</system:String>
        <system:String x:Key="str_ExpStyleCommon">Common</system:String>
        <system:String x:Key="str_ExpStyleCc65">cc65</system:String>
        <system:String x:Key="str_ExpStyleMerlin">Merlin</system:String>
        <system:String x:Key="str_DelimStraight">Straight</system:String>
        <system:String x:Key="str_DelimMerlin">Merlin</system:String>
    </Window.Resources>

    <DockPanel Margin="8">
        <StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" HorizontalAlignment="Right">
            <Button Name="applyButton" Content="Apply" Margin="0,0,20,0"
                    Width="70" IsEnabled="{Binding IsDirty}" Click="ApplyButton_Click"/>
            <Button Name="okButton" Content="OK" IsDefault="True"
                    Width="70" Click="OkButton_Click"/>
            <Button Name="cancelButton" Content="Cancel" IsCancel="True"
                    Width="70" Margin="4,0,0,0"/>
        </StackPanel>

        <TabControl Name="tabControl" DockPanel.Dock="Top" Margin="0,0,0,8">
            <TabItem Name="codeViewTab" Header="Code View">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="0.75*"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>

                    <GroupBox Grid.Column="0" Grid.Row="0" Grid.RowSpan="2" Header="Column Visibility"
                              Margin="0,0,10,0" Padding="2,0">
                        <StackPanel>
                            <Button Name="showCol0" Content="{}{0} Offset" Width="120" Margin="0,4"
                                    Click="ColumnVisibilityButton_Click"/>
                            <Button Name="showCol1" Content="{}{0} Address" Width="120" Margin="0,4"
                                    Click="ColumnVisibilityButton_Click"/>
                            <Button Name="showCol2" Content="{}{0} Bytes" Width="120" Margin="0,4"
                                    Click="ColumnVisibilityButton_Click"/>
                            <Button Name="showCol3" Content="{}{0} Flags" Width="120" Margin="0,4"
                                    Click="ColumnVisibilityButton_Click"/>
                            <Button Name="showCol4" Content="{}{0} Attributes" Width="120" Margin="0,4"
                                    Click="ColumnVisibilityButton_Click"/>
                            <Button Name="showCol5" Content="{}{0} Label" Width="120" Margin="0,4"
                                    Click="ColumnVisibilityButton_Click"/>
                            <Button Name="showCol6" Content="{}{0} Opcode" Width="120" Margin="0,4"
                                    Click="ColumnVisibilityButton_Click"/>
                            <Button Name="showCol7" Content="{}{0} Operand" Width="120" Margin="0,4"
                                    Click="ColumnVisibilityButton_Click"/>
                            <Button Name="showCol8" Content="{}{0} Comment" Width="120" Margin="0,4"
                                    Click="ColumnVisibilityButton_Click"/>
                        </StackPanel>
                    </GroupBox>

                    <GroupBox Grid.Column="1" Grid.Row="0" Header="Code List Font"
                              Margin="5,0,5,0" Padding="2,4">
                        <StackPanel>
                            <TextBlock>Current font:</TextBlock>
                            <TextBlock Name="codeListFontDesc" Margin="0,4,0,0">10-pt Hoser Sans</TextBlock>
                            <Button Content="Select Font..." Width="120" Margin="0,8,0,0"
                                    HorizontalAlignment="Left" Click="SelectFontButton_Click"/>
                        </StackPanel>
                    </GroupBox>

                    <GroupBox Grid.Column="1" Grid.Row="1" Header="Upper Case Display"
                              Margin="5,0,5,0" Padding="2,4">
                        <StackPanel>
                            <CheckBox Content="Hexadecimal values" Margin="0,4"
                                      IsChecked="{Binding UpperHexValues}"/>
                            <CheckBox Content="Opcodes" Margin="0,4"
                                      IsChecked="{Binding UpperOpcodes}"/>
                            <CheckBox Content="Pseudo-opcodes" Margin="0,4"
                                      IsChecked="{Binding UpperPseudoOps}"/>
                            <CheckBox Content="Operand A" Margin="0,4"
                                      IsChecked="{Binding UpperOperandA}"/>
                            <CheckBox Content="Operand S" Margin="0,4"
                                      IsChecked="{Binding UpperOperandS}"/>
                            <CheckBox Content="Operand X/Y" Margin="0,4"
                                      IsChecked="{Binding UpperOperandXY}"/>
                            <StackPanel Orientation="Horizontal">
                                <Button Content="All Lower" Width="75" Margin="0,4,0,0" Click="AllLower_Click"/>
                                <Button Content="All Upper" Width="75" Margin="8,4,0,0" Click="AllUpper_Click"/>
                            </StackPanel>
                        </StackPanel>
                    </GroupBox>

                    <GroupBox Grid.Column="2" Grid.Row="0" Header="Clipboard"
                              Margin="10,0,0,0" Padding="2,4">
                        <StackPanel>
                            <TextBlock>Format for lines copied to clipboard:</TextBlock>
                            <ComboBox Name="clipboardFormatComboBox" IsReadOnly="True" Margin="0,8,0,0"
                                      ItemsSource="{Binding ClipboardFormatItems}" DisplayMemberPath="Name"
                                      SelectionChanged="ClipboardFormatComboBox_SelectionChanged"/>
                        </StackPanel>
                    </GroupBox>

                     <GroupBox Grid.Column="2" Grid.Row="1" Header="Miscellaneous"
                              Margin="10,0,0,0" Padding="2,4">
                        <StackPanel>
                            <CheckBox Content="Show cycle counts for instructions" Margin="0,4"
                                      IsChecked="{Binding ShowCycleCountsScreen}"/>
                            <CheckBox Content="Use &quot;dark&quot; color scheme" Margin="0,4"
                                      IsChecked="{Binding DarkColorScheme}"/>
                            <DockPanel LastChildFill="True">
                                <TextBlock Margin="0,3,0,0">Auto-save interval:</TextBlock>
                                <ComboBox Name="autoSaveComboBox" IsReadOnly="True" Margin="8,0,0,0"
                                          ItemsSource="{Binding AutoSaveItems}" DisplayMemberPath="Title"
                                          SelectionChanged="AutoSaveComboBox_SelectionChanged"/>
                            </DockPanel>
                        </StackPanel>
                    </GroupBox>

                    <CheckBox Grid.Column="0" Grid.Row="4" Content="Enable DEBUG menu" Margin="4,16,0,0"
                              IsChecked="{Binding EnableDebugMenu}"/>
                </Grid>
            </TabItem>


            <TabItem Name="textDelimitersTab" Header="Text Delimiters">
                <DockPanel LastChildFill="False">
                    <TextBlock DockPanel.Dock="Top" Margin="4,0,0,0"
                               Text="Configure character and string constant delimiters. This does not affect source code generation."/>

                    <Grid DockPanel.Dock="Top" Height="240" Margin="4,0">

                        <Grid.Resources>
                            <!-- TextBox spacer -->
                            <Thickness x:Key="TBS" Left="2" Top="4" Right="0" Bottom="0"/>
                            <Thickness x:Key="ENC" Left="0" Top="3" Right="4" Bottom="3"/>
                        </Grid.Resources>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>

                        <GroupBox Grid.Column="0" Grid.Row="1" Header="Character Operand Delimiters" Margin="4"
                                  Padding="2,4">
                            <StackPanel>
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="Auto"/>
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                    </Grid.RowDefinitions>

                                    <!-- decorative lines to set off row/column headers -->
                                    <Rectangle Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="5"
                                               VerticalAlignment="Bottom" Height="1"
                                               Stroke="LightGray" Fill="Transparent"/>
                                    <Rectangle Grid.Column="0" Grid.Row="0" Grid.RowSpan="5"
                                               HorizontalAlignment="Right" Width="1"
                                               Stroke="LightGray" Fill="Transparent"/>

                                    <TextBlock Grid.Column="0" Grid.Row="0" Text="Encoding" Margin="0,2,0,3"/>
                                    <TextBlock Grid.Column="1" Grid.Row="0" Text="Prefix" Margin="3,2,3,0"
                                               HorizontalAlignment="Center"/>
                                    <TextBlock Grid.Column="2" Grid.Row="0" Text="Open" Margin="3,2,3,0"
                                               HorizontalAlignment="Center"/>
                                    <TextBlock Grid.Column="3" Grid.Row="0" Text="Close" Margin="3,2,3,0"
                                               HorizontalAlignment="Center"/>
                                    <TextBlock Grid.Column="4" Grid.Row="0" Text="Suffix" Margin="3,2,3,0"
                                               HorizontalAlignment="Center"/>

                                    <TextBlock Text="Plain ASCII" Grid.Column="0" Grid.Row="1"
                                               Margin="{StaticResource ENC}"/>
                                    <TextBox Name="chrdAsciiPrefix" Grid.Column="1" Grid.Row="1"
                                             HorizontalAlignment="Center" VerticalAlignment="Top"
                                             Margin="{StaticResource TBS}" Width="65" MaxLength="8"
                                             Text="01234567"
                                             FontFamily="{StaticResource GeneralMonoFont}"/>
                                    <TextBox Name="chrdAsciiOpen" Grid.Column="2" Grid.Row="1"
                                             HorizontalAlignment="Center" VerticalAlignment="Top"
                                             Margin="{StaticResource TBS}" Width="20" MaxLength="1"
                                             FontFamily="{StaticResource GeneralMonoFont}"/>
                                    <TextBox Name="chrdAsciiClose" Grid.Column="3" Grid.Row="1"
                                             HorizontalAlignment="Center" VerticalAlignment="Top"
                                             Margin="{StaticResource TBS}" Width="20" MaxLength="1"
                                             FontFamily="{StaticResource GeneralMonoFont}"/>
                                    <TextBox Name="chrdAsciiSuffix" Grid.Column="4" Grid.Row="1"
                                             HorizontalAlignment="Center" VerticalAlignment="Top"
                                             Margin="{StaticResource TBS}" Width="65" MaxLength="12"
                                             FontFamily="{StaticResource GeneralMonoFont}"/>

                                    <TextBlock Text="High ASCII" Grid.Column="0" Grid.Row="2"
                                               Margin="{StaticResource ENC}"/>
                                    <TextBox Name="chrdHighAsciiPrefix" Grid.Column="1" Grid.Row="2"
                                             HorizontalAlignment="Center" VerticalAlignment="Top"
                                             Margin="{StaticResource TBS}" Width="65" MaxLength="8"
                                             Text="01234567"
                                             FontFamily="{StaticResource GeneralMonoFont}"/>
                                    <TextBox Name="chrdHighAsciiOpen" Grid.Column="2" Grid.Row="2"
                                             HorizontalAlignment="Center" VerticalAlignment="Top"
                                             Margin="{StaticResource TBS}" Width="20" MaxLength="1"
                                             FontFamily="{StaticResource GeneralMonoFont}"/>
                                    <TextBox Name="chrdHighAsciiClose" Grid.Column="3" Grid.Row="2"
                                             HorizontalAlignment="Center" VerticalAlignment="Top"
                                             Margin="{StaticResource TBS}" Width="20" MaxLength="1"
                                             FontFamily="{StaticResource GeneralMonoFont}"/>
                                    <TextBox Name="chrdHighAsciiSuffix" Grid.Column="4" Grid.Row="2"
                                             HorizontalAlignment="Center" VerticalAlignment="Top"
                                             Margin="{StaticResource TBS}" Width="65" MaxLength="12"
                                             FontFamily="{StaticResource GeneralMonoFont}"/>

                                    <TextBlock Text="C64 PETSCII" Grid.Column="0" Grid.Row="3"
                                               Margin="{StaticResource ENC}"/>
                                    <TextBox Name="chrdPetsciiPrefix" Grid.Column="1" Grid.Row="3"
                                             HorizontalAlignment="Center" VerticalAlignment="Top"
                                             Margin="{StaticResource TBS}" Width="65" MaxLength="8"
                                             Text="01234567"
                                             FontFamily="{StaticResource GeneralMonoFont}"/>
                                    <TextBox Name="chrdPetsciiOpen" Grid.Column="2" Grid.Row="3"
                                             HorizontalAlignment="Center" VerticalAlignment="Top"
                                             Margin="{StaticResource TBS}" Width="20" MaxLength="1"
                                             FontFamily="{StaticResource GeneralMonoFont}"/>
                                    <TextBox Name="chrdPetsciiClose" Grid.Column="3" Grid.Row="3"
                                             HorizontalAlignment="Center" VerticalAlignment="Top"
                                             Margin="{StaticResource TBS}" Width="20" MaxLength="1"
                                             FontFamily="{StaticResource GeneralMonoFont}"/>
                                    <TextBox Name="chrdPetsciiSuffix" Grid.Column="4" Grid.Row="3"
                                             HorizontalAlignment="Center" VerticalAlignment="Top"
                                             Margin="{StaticResource TBS}" Width="65" MaxLength="12"
                                             FontFamily="{StaticResource GeneralMonoFont}"/>

                                    <TextBlock Text="C64 Screen Code" Grid.Column="0" Grid.Row="4"
                                               Margin="{StaticResource ENC}"/>
                                    <TextBox Name="chrdScreenCodePrefix" Grid.Column="1" Grid.Row="4"
                                             HorizontalAlignment="Center" VerticalAlignment="Top"
                                             Margin="{StaticResource TBS}" Width="65" MaxLength="8"
                                             Text="01234567"
                                             FontFamily="{StaticResource GeneralMonoFont}"/>
                                    <TextBox Name="chrdScreenCodeOpen" Grid.Column="2" Grid.Row="4"
                                             HorizontalAlignment="Center" VerticalAlignment="Top"
                                             Margin="{StaticResource TBS}" Width="20" MaxLength="1"
                                             FontFamily="{StaticResource GeneralMonoFont}"/>
                                    <TextBox Name="chrdScreenCodeClose" Grid.Column="3" Grid.Row="4"
                                             HorizontalAlignment="Center" VerticalAlignment="Top"
                                             Margin="{StaticResource TBS}" Width="20" MaxLength="1"
                                             FontFamily="{StaticResource GeneralMonoFont}"/>
                                    <TextBox Name="chrdScreenCodeSuffix" Grid.Column="4" Grid.Row="4"
                                             HorizontalAlignment="Center" VerticalAlignment="Top"
                                             Margin="{StaticResource TBS}" Width="65" MaxLength="12"
                                             FontFamily="{StaticResource GeneralMonoFont}"/>

                                </Grid>
                            </StackPanel>
                        </GroupBox>

                        <GroupBox Grid.Column="1" Grid.Row="1" Header="Text String Delimiters" Margin="4"
                                  Padding="2,4">
                            <StackPanel>
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="Auto"/>
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                    </Grid.RowDefinitions>

                                    <!-- decorative lines to set off row/column headers -->
                                    <Rectangle Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="5"
                                               VerticalAlignment="Bottom" Height="1"
                                               Stroke="LightGray" Fill="Transparent"/>
                                    <Rectangle Grid.Column="0" Grid.Row="0" Grid.RowSpan="5"
                                               HorizontalAlignment="Right" Width="1"
                                               Stroke="LightGray" Fill="Transparent"/>

                                    <TextBlock Grid.Column="0" Grid.Row="0" Text="Encoding" Margin="0,2,0,3"/>
                                    <TextBlock Grid.Column="1" Grid.Row="0" Text="Prefix" Margin="3,2,3,0"
                                               HorizontalAlignment="Center"/>
                                    <TextBlock Grid.Column="2" Grid.Row="0" Text="Open" Margin="3,2,3,0"
                                               HorizontalAlignment="Center"/>
                                    <TextBlock Grid.Column="3" Grid.Row="0" Text="Close" Margin="3,2,3,0"
                                               HorizontalAlignment="Center"/>
                                    <TextBlock Visibility="Hidden" Grid.Column="4" Grid.Row="0" Text="Suffix" Margin="3,2,3,0"
                                               HorizontalAlignment="Center"/>

                                    <TextBlock Text="Plain ASCII" Grid.Column="0" Grid.Row="1"
                                               Margin="{StaticResource ENC}"/>
                                    <TextBox Name="strdAsciiPrefix" Grid.Column="1" Grid.Row="1"
                                             HorizontalAlignment="Center" VerticalAlignment="Top"
                                             Margin="{StaticResource TBS}" Width="65" MaxLength="8"
                                             Text="01234567"
                                             FontFamily="{StaticResource GeneralMonoFont}"/>
                                    <TextBox Name="strdAsciiOpen" Grid.Column="2" Grid.Row="1"
                                             HorizontalAlignment="Center" VerticalAlignment="Top"
                                             Margin="{StaticResource TBS}" Width="20" MaxLength="1"
                                             FontFamily="{StaticResource GeneralMonoFont}"/>
                                    <TextBox Name="strdAsciiClose" Grid.Column="3" Grid.Row="1"
                                             HorizontalAlignment="Center" VerticalAlignment="Top"
                                             Margin="{StaticResource TBS}" Width="20" MaxLength="1"
                                             FontFamily="{StaticResource GeneralMonoFont}"/>
                                    <TextBox Visibility="Hidden" Name="strdAsciiSuffix" Grid.Column="4" Grid.Row="1"
                                             HorizontalAlignment="Center" VerticalAlignment="Top"
                                             Margin="{StaticResource TBS}" Width="65" MaxLength="12"
                                             FontFamily="{StaticResource GeneralMonoFont}"/>

                                    <TextBlock Text="High ASCII" Grid.Column="0" Grid.Row="2"
                                               Margin="{StaticResource ENC}"/>
                                    <TextBox Name="strdHighAsciiPrefix" Grid.Column="1" Grid.Row="2"
                                             HorizontalAlignment="Center" VerticalAlignment="Top"
                                             Margin="{StaticResource TBS}" Width="65" MaxLength="8"
                                             Text="01234567"
                                             FontFamily="{StaticResource GeneralMonoFont}"/>
                                    <TextBox Name="strdHighAsciiOpen" Grid.Column="2" Grid.Row="2"
                                             HorizontalAlignment="Center" VerticalAlignment="Top"
                                             Margin="{StaticResource TBS}" Width="20" MaxLength="1"
                                             FontFamily="{StaticResource GeneralMonoFont}"/>
                                    <TextBox Name="strdHighAsciiClose" Grid.Column="3" Grid.Row="2"
                                             HorizontalAlignment="Center" VerticalAlignment="Top"
                                             Margin="{StaticResource TBS}" Width="20" MaxLength="1"
                                             FontFamily="{StaticResource GeneralMonoFont}"/>
                                    <TextBox Visibility="Hidden" Name="strdHighAsciiSuffix" Grid.Column="4" Grid.Row="2"
                                             HorizontalAlignment="Center" VerticalAlignment="Top"
                                             Margin="{StaticResource TBS}" Width="65" MaxLength="12"
                                             FontFamily="{StaticResource GeneralMonoFont}"/>

                                    <TextBlock Text="C64 PETSCII" Grid.Column="0" Grid.Row="3"
                                               Margin="{StaticResource ENC}"/>
                                    <TextBox Name="strdPetsciiPrefix" Grid.Column="1" Grid.Row="3"
                                             HorizontalAlignment="Center" VerticalAlignment="Top"
                                             Margin="{StaticResource TBS}" Width="65" MaxLength="8"
                                             Text="01234567"
                                             FontFamily="{StaticResource GeneralMonoFont}"/>
                                    <TextBox Name="strdPetsciiOpen" Grid.Column="2" Grid.Row="3"
                                             HorizontalAlignment="Center" VerticalAlignment="Top"
                                             Margin="{StaticResource TBS}" Width="20" MaxLength="1"
                                             FontFamily="{StaticResource GeneralMonoFont}"/>
                                    <TextBox Name="strdPetsciiClose" Grid.Column="3" Grid.Row="3"
                                             HorizontalAlignment="Center" VerticalAlignment="Top"
                                             Margin="{StaticResource TBS}" Width="20" MaxLength="1"
                                             FontFamily="{StaticResource GeneralMonoFont}"/>
                                    <TextBox Visibility="Hidden" Name="strdPetsciiSuffix" Grid.Column="4" Grid.Row="3"
                                             HorizontalAlignment="Center" VerticalAlignment="Top"
                                             Margin="{StaticResource TBS}" Width="65" MaxLength="12"
                                             FontFamily="{StaticResource GeneralMonoFont}"/>

                                    <TextBlock Text="C64 Screen Code" Grid.Column="0" Grid.Row="4"
                                               Margin="{StaticResource ENC}"/>
                                    <TextBox Name="strdScreenCodePrefix" Grid.Column="1" Grid.Row="4"
                                             HorizontalAlignment="Center" VerticalAlignment="Top"
                                             Margin="{StaticResource TBS}" Width="65" MaxLength="8"
                                             Text="01234567"
                                             FontFamily="{StaticResource GeneralMonoFont}"/>
                                    <TextBox Name="strdScreenCodeOpen" Grid.Column="2" Grid.Row="4"
                                             HorizontalAlignment="Center" VerticalAlignment="Top"
                                             Margin="{StaticResource TBS}" Width="20" MaxLength="1"
                                             FontFamily="{StaticResource GeneralMonoFont}"/>
                                    <TextBox Name="strdScreenCodeClose" Grid.Column="3" Grid.Row="4"
                                             HorizontalAlignment="Center" VerticalAlignment="Top"
                                             Margin="{StaticResource TBS}" Width="20" MaxLength="1"
                                             FontFamily="{StaticResource GeneralMonoFont}"/>
                                    <TextBox Visibility="Hidden" Name="strdScreenCodeSuffix" Grid.Column="4" Grid.Row="4"
                                             HorizontalAlignment="Center" VerticalAlignment="Top"
                                             Margin="{StaticResource TBS}" Width="65" MaxLength="12"
                                             FontFamily="{StaticResource GeneralMonoFont}"/>
                                </Grid>
                            </StackPanel>
                        </GroupBox>

                        <GroupBox Grid.Column="0" Grid.Row="2" Header="Sample Characters" Margin="4"
                                  Padding="2,4">
                            <StackPanel>
                                <TextBox IsReadOnly="True"
                                         Text="&#x2018;&#x2019;&#x2022;&#x201c;&#x201d;&#x2191;&#xab;&#xbb;&#x2770;&#x2771;"
                                         FontFamily="{StaticResource GeneralMonoFont}" FontSize="16"/>
                            </StackPanel>
                        </GroupBox>
                    </Grid>

                    <GroupBox DockPanel.Dock="Bottom" Header="Quick Set"
                              HorizontalAlignment="Left" Padding="2,4">
                        <ComboBox Name="textDelimQuickComboBox" Width="170" IsReadOnly="True"
                                  ItemsSource="{Binding DelimPresets}" DisplayMemberPath="Name"
                                  SelectionChanged="TextDelimQuickComboBox_SelectionChanged"/>
                    </GroupBox>
                </DockPanel>
            </TabItem>


            <TabItem Name="displayFormatTab" Header="Display Format">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>

                    <TextBlock Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="3" Margin="4,0,0,0"
                               Text="Configure opcode/operand display format options. This does not affect source code generation."/>
                    <DockPanel Grid.Column="0" Grid.Row="1" LastChildFill="False">
                        <GroupBox Header="Operand Width Disambiguator" Width="300" DockPanel.Dock="Top"
                                  HorizontalAlignment="Left" Margin="0,8,0,0" Padding="2,0">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="20"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                </Grid.RowDefinitions>

                                <TextBlock Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2"
                                           Text="Opcode suffix:" Margin="0,4,0,0"/>
                                <TextBlock Grid.Column="3" Grid.Row="0" Grid.ColumnSpan="2"
                                           Text="Operand prefix:" Margin="0,4,0,0"/>

                                <TextBlock Grid.Column="0" Grid.Row="1" Text="16-bit:"
                                           Margin="0,4,0,0"/>
                                <TextBox Grid.Column="1" Grid.Row="1" Margin="0,4,0,0" MaxLength="8"
                                         FontFamily="{StaticResource GeneralMonoFont}"
                                         Text="{Binding OpcodeSuffixAbs, UpdateSourceTrigger=PropertyChanged,
                                            FallbackValue=.placeho}"/>
                                <TextBlock Grid.Column="3" Grid.Row="1" Text="16-bit:"
                                           Margin="0,4,0,0"/>
                                <TextBox Grid.Column="4" Grid.Row="1" Margin="0,4,0,0" MaxLength="8"
                                         FontFamily="{StaticResource GeneralMonoFont}"
                                         Text="{Binding OperandPrefixAbs, UpdateSourceTrigger=PropertyChanged,
                                            FallbackValue=.placeho}"/>

                                <TextBlock Grid.Column="0" Grid.Row="2" Text="24-bit:"
                                           Margin="0,4,0,0"/>
                                <TextBox Grid.Column="1" Grid.Row="2" Margin="0,4,0,0" MaxLength="8"
                                         FontFamily="{StaticResource GeneralMonoFont}"
                                         Text="{Binding OpcodeSuffixLong, UpdateSourceTrigger=PropertyChanged,
                                            FallbackValue=.placeho}"/>
                                <TextBlock Grid.Column="3" Grid.Row="2" Text="24-bit:"
                                           Margin="0,4,0,0"/>
                                <TextBox Grid.Column="4" Grid.Row="2" Margin="0,4,0,0" MaxLength="8"
                                         FontFamily="{StaticResource GeneralMonoFont}"
                                         Text="{Binding OperandPrefixLong, UpdateSourceTrigger=PropertyChanged,
                                            FallbackValue=.placeho}"/>
                            </Grid>
                        </GroupBox>

                        <StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Margin="4,8,0,0">
                            <TextBlock Text="Expression style:" Margin="0,3,0,0"/>
                            <ComboBox Name="expressionStyleComboBox" Width="120" Margin="8,0,0,0"
                                      ItemsSource="{Binding ExpressionStyleItems}" DisplayMemberPath="Name"
                                      IsReadOnly="True"
                                      SelectionChanged="ExpressionStyleComboBox_SelectionChanged"/>
                        </StackPanel>

                        <StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Margin="4,8,0,0">
                            <TextBlock Text="Full-line comment delimiter:"/>
                            <TextBox Width="14" MaxLength="1" Margin="8,1,0,0"
                                     Text="{Binding FullLineCommentDelim, UpdateSourceTrigger=PropertyChanged,
                                        FallbackValue=;}"
                                     FontFamily="{StaticResource GeneralMonoFont}"/>
                        </StackPanel>

                        <StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Margin="4,4,0,0">
                            <TextBlock Text="Non-unique label prefix:"/>
                            <TextBox Width="14" MaxLength="1" Margin="8,1,0,0"
                                     Text="{Binding NonUniqueLabelPrefix, UpdateSourceTrigger=PropertyChanged,
                                        FallbackValue=@}"
                                     FontFamily="{StaticResource GeneralMonoFont}"/>
                        </StackPanel>

                        <StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Margin="4,4,0,0">
                            <TextBlock Text="Local variable prefix:"/>
                            <TextBox Width="66" MaxLength="8" Margin="8,1,0,0"
                                     Text="{Binding LocalVarPrefix, UpdateSourceTrigger=PropertyChanged,
                                        FallbackValue=.placeho}"
                                     FontFamily="{StaticResource GeneralMonoFont}"/>
                        </StackPanel>

                        <CheckBox DockPanel.Dock="Top" Margin="4,8,0,0"
                                  Content="Use comma-separated format for bulk data"
                                  IsChecked="{Binding CommaSeparatedBulkData}"/>

                        <GroupBox DockPanel.Dock="Bottom" Header="Quick Set"
                                  HorizontalAlignment="Left" Padding="2,4">
                            <ComboBox Name="displayFmtQuickComboBox" Width="170" IsReadOnly="True"
                                      ItemsSource="{Binding DisplayPresets}" DisplayMemberPath="Name"
                                      SelectionChanged="DisplayFmtQuickComboBox_SelectionChanged"/>
                        </GroupBox>
                    </DockPanel>

                    <Rectangle Grid.Column="1" Grid.Row="1" Margin="0,8,0,0"
                               VerticalAlignment="Stretch" Fill="LightGray" Width="2"/>

                    <DockPanel Grid.Column="2" Grid.Row="1" LastChildFill="False">
                        <CheckBox DockPanel.Dock="Top" Margin="4,12,0,0"
                                  Content="Add spaces in Bytes column"
                                  IsChecked="{Binding SpacesBetweenBytes}"/>

                        <StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Margin="4,8,0,0">
                            <TextBlock Text="Wrap operands at" Margin="0,3,0,0"/>
                            <ComboBox Name="operandWrapLenComboBox" Width="45" Margin="4,0,0,0"
                                      ItemsSource="{Binding OperandWrapLenItems}" IsReadOnly="True"
                                      SelectionChanged="OperandWrapLenComboBox_SelectionChanged"/>
                            <TextBlock Text="characters" Margin="4,3,0,0"/>
                        </StackPanel>

                        <StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Margin="4,8,0,0">
                            <TextBlock Text="Use hex for adjustments larger than"/>
                            <TextBox Name="hexAdjThreshTextBox" Width="50" MaxLength="8" Margin="4,1,0,0"
                                     FontFamily="{StaticResource GeneralMonoFont}">
                                <TextBox.Text>
                                    <Binding Path="HexAdjustmentThreshold" UpdateSourceTrigger="PropertyChanged"
                                             FallbackValue="255">
                                        <Binding.ValidationRules>
                                            <local:HexAdjThreshRule ValidatesOnTargetUpdated="True"/>
                                        </Binding.ValidationRules>
                                    </Binding>
                                </TextBox.Text>
                            </TextBox>
                            <TextBlock Text=" (0-65535)" Margin="2,0,0,0"/>
                        </StackPanel>
                    </DockPanel>
                </Grid>
            </TabItem>


            <TabItem Name="pseudoOpTab" Header="Pseudo-Op">
                <DockPanel LastChildFill="False">
                    <TextBlock DockPanel.Dock="Top" Margin="4,0,0,0"
                               Text="Select pseudo-op names for display. This does not affect source code generation. Blank entries get a default value."/>

                    <Grid DockPanel.Dock="Top" Height="240" Margin="4,0">
                        <Grid.Resources>
                            <!-- TextBox spacer -->
                            <Thickness x:Key="TBS" Left="6" Top="0" Right="0" Bottom="0"/>
                        </Grid.Resources>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="0.8*"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="0.8*"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="0.8*"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="0.8*"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*"/>
                            <RowDefinition Height="*"/>
                            <RowDefinition Height="*"/>
                            <RowDefinition Height="*"/>
                            <RowDefinition Height="*"/>
                            <RowDefinition Height="*"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>

                        <!-- first row -->
                        <TextBlock Grid.Column="0" Grid.Row="0" Text="Equate:"
                                   HorizontalAlignment="Right" VerticalAlignment="Center"/>
                        <TextBox Name="equDirectiveTextBox" Grid.Column="1" Grid.Row="0"
                                 VerticalAlignment="Center" Margin="{StaticResource TBS}"
                                 Text=".placeho" MaxLength="12"
                                 FontFamily="{StaticResource GeneralMonoFont}"/>
                        <TextBlock Grid.Column="2" Grid.Row="0" Text="Variable:"
                                   HorizontalAlignment="Right" VerticalAlignment="Center"/>
                        <TextBox Name="varDirectiveTextBox" Grid.Column="3" Grid.Row="0"
                                 VerticalAlignment="Center" Margin="{StaticResource TBS}"
                                 Text=".placeho" MaxLength="12"
                                 FontFamily="{StaticResource GeneralMonoFont}"/>
                        <TextBlock Grid.Column="4" Grid.Row="0" Text="Reg width:"
                                   HorizontalAlignment="Right" VerticalAlignment="Center"/>
                        <TextBox Name="regWidthDirectiveTextBox" Grid.Column="5" Grid.Row="0"
                                 VerticalAlignment="Center" Margin="{StaticResource TBS}"
                                 Text=".placeho" MaxLength="12"
                                 FontFamily="{StaticResource GeneralMonoFont}"/>

                        <!-- second row -->
                        <StackPanel Grid.Column="0" Grid.Row="1" VerticalAlignment="Center">
                            <TextBlock Text="Address range" HorizontalAlignment="Right"/>
                            <TextBlock Text="start:" HorizontalAlignment="Right"/>
                        </StackPanel>
                        <TextBox Name="arStartDirectiveTextBox" Grid.Column="1" Grid.Row="1"
                                 VerticalAlignment="Center" Margin="{StaticResource TBS}"
                                 Text=".placeho" MaxLength="12"
                                 FontFamily="{StaticResource GeneralMonoFont}"/>
                        <StackPanel Grid.Column="2" Grid.Row="1" VerticalAlignment="Center">
                            <TextBlock Text="Address range" HorizontalAlignment="Right"/>
                            <TextBlock Text="end:" HorizontalAlignment="Right"/>
                        </StackPanel>
                        <TextBox Name="arEndDirectiveTextBox" Grid.Column="3" Grid.Row="1"
                                 VerticalAlignment="Center" Margin="{StaticResource TBS}"
                                 Text=".placeho" MaxLength="12"
                                 FontFamily="{StaticResource GeneralMonoFont}"/>

                        <!-- third row -->
                        <StackPanel Grid.Column="0" Grid.Row="2" VerticalAlignment="Center">
                            <TextBlock Text="Little-endian" HorizontalAlignment="Right"/>
                            <TextBlock Text="data, one byte:" HorizontalAlignment="Right"/>
                        </StackPanel>
                        <TextBox Name="defineData1TextBox" Grid.Column="1" Grid.Row="2"
                                 VerticalAlignment="Center" Margin="{StaticResource TBS}"
                                 Text=".placeho" MaxLength="12"
                                 FontFamily="{StaticResource GeneralMonoFont}"/>
                        <TextBlock Grid.Column="2" Grid.Row="2" Text="Two bytes:"
                                   HorizontalAlignment="Right" VerticalAlignment="Center"/>
                        <TextBox Name="defineData2TextBox" Grid.Column="3" Grid.Row="2"
                                 VerticalAlignment="Center" Margin="{StaticResource TBS}"
                                 Text=".placeho" MaxLength="12"
                                 FontFamily="{StaticResource GeneralMonoFont}"/>
                        <TextBlock Grid.Column="4" Grid.Row="2" Text="Three bytes:"
                                   HorizontalAlignment="Right" VerticalAlignment="Center"/>
                        <TextBox Name="defineData3TextBox" Grid.Column="5" Grid.Row="2"
                                 VerticalAlignment="Center" Margin="{StaticResource TBS}"
                                 Text=".placeho" MaxLength="12"
                                 FontFamily="{StaticResource GeneralMonoFont}"/>
                        <TextBlock Grid.Column="6" Grid.Row="2" Text="Four bytes:"
                                   HorizontalAlignment="Right" VerticalAlignment="Center"/>
                        <TextBox Name="defineData4TextBox" Grid.Column="7" Grid.Row="2"
                                 VerticalAlignment="Center" Margin="{StaticResource TBS}"
                                 Text=".placeho" MaxLength="12"
                                 FontFamily="{StaticResource GeneralMonoFont}"/>

                        <!-- fourth row -->
                        <StackPanel Grid.Column="2" Grid.Row="3" VerticalAlignment="Center">
                            <TextBlock Text="Big-endian data," HorizontalAlignment="Right"/>
                            <TextBlock Text="two bytes:" HorizontalAlignment="Right"/>
                        </StackPanel>
                        <TextBox Name="defineBigData2TextBox" Grid.Column="3" Grid.Row="3"
                                 VerticalAlignment="Center" Margin="{StaticResource TBS}"
                                 Text=".placeho" MaxLength="12"
                                 FontFamily="{StaticResource GeneralMonoFont}"/>
                        <TextBlock Grid.Column="4" Grid.Row="3" Text="Binary include:"
                                   HorizontalAlignment="Right" VerticalAlignment="Center"/>
                        <TextBox Name="binaryIncludeTextBox" Grid.Column="5" Grid.Row="3"
                                 VerticalAlignment="Center" Margin="{StaticResource TBS}"
                                 Text=".placeho" MaxLength="12"
                                 FontFamily="{StaticResource GeneralMonoFont}"/>
                        <TextBlock Grid.Column="6" Grid.Row="3" Text="Bulk data:"
                                   HorizontalAlignment="Right" VerticalAlignment="Center"/>
                        <TextBox Name="denseTextBox" Grid.Column="7" Grid.Row="3"
                                 VerticalAlignment="Center" Margin="{StaticResource TBS}"
                                 Text=".placeho" MaxLength="12"
                                 FontFamily="{StaticResource GeneralMonoFont}"/>

                        <!-- fifth row -->
                        <TextBlock Grid.Column="0" Grid.Row="4" Text="Fill:"
                                   HorizontalAlignment="Right" VerticalAlignment="Center"/>
                        <TextBox Name="fillTextBox" Grid.Column="1" Grid.Row="4"
                                 VerticalAlignment="Center" Margin="{StaticResource TBS}"
                                 Text=".placeho" MaxLength="12"
                                 FontFamily="{StaticResource GeneralMonoFont}"/>
                        <TextBlock Grid.Column="2" Grid.Row="4" Text="Uninitialized:"
                                 HorizontalAlignment="Right" VerticalAlignment="Center"/>
                        <TextBox Name="uninitTextBox" Grid.Column="3" Grid.Row="4"
                                 VerticalAlignment="Center" Margin="{StaticResource TBS}"
                                 Text=".placeho" MaxLength="12"
                                 FontFamily="{StaticResource GeneralMonoFont}"/>
                        <TextBlock Grid.Column="4" Grid.Row="4" Text="Junk:"
                                   HorizontalAlignment="Right" VerticalAlignment="Center"/>
                        <TextBox Name="junkTextBox" Grid.Column="5" Grid.Row="4"
                                 VerticalAlignment="Center" Margin="{StaticResource TBS}"
                                 Text=".placeho" MaxLength="12"
                                 FontFamily="{StaticResource GeneralMonoFont}"/>
                        <TextBlock Grid.Column="6" Grid.Row="4" Text="Align:"
                                   HorizontalAlignment="Right" VerticalAlignment="Center"/>
                        <TextBox Name="alignTextBox" Grid.Column="7" Grid.Row="4"
                                 VerticalAlignment="Center" Margin="{StaticResource TBS}"
                                 Text=".placeho" MaxLength="12"
                                 FontFamily="{StaticResource GeneralMonoFont}"/>

                        <!-- sixth row -->
                        <TextBlock Grid.Column="0" Grid.Row="5" Text="Generic str:"
                                   HorizontalAlignment="Right" VerticalAlignment="Center"/>
                        <TextBox Name="strGenericTextBox" Grid.Column="1" Grid.Row="5"
                                 VerticalAlignment="Center" Margin="{StaticResource TBS}"
                                 Text=".placeho" MaxLength="12"
                                 FontFamily="{StaticResource GeneralMonoFont}"/>
                        <TextBlock Grid.Column="2" Grid.Row="5" Text="Reverse str:"
                                   HorizontalAlignment="Right" VerticalAlignment="Center"/>
                        <TextBox Name="strReverseTextBox" Grid.Column="3" Grid.Row="5"
                                 VerticalAlignment="Center" Margin="{StaticResource TBS}"
                                 Text=".placeho" MaxLength="12"
                                 FontFamily="{StaticResource GeneralMonoFont}"/>
                        <TextBlock Grid.Column="4" Grid.Row="5" Text="Null-term str:"
                                   HorizontalAlignment="Right" VerticalAlignment="Center"/>
                        <TextBox Name="strNullTermTextBox" Grid.Column="5" Grid.Row="5"
                                 VerticalAlignment="Center" Margin="{StaticResource TBS}"
                                 Text=".placeho" MaxLength="12"
                                 FontFamily="{StaticResource GeneralMonoFont}"/>
                        <TextBlock Grid.Column="6" Grid.Row="5" Text="DCI str:"
                                   HorizontalAlignment="Right" VerticalAlignment="Center"/>
                        <TextBox Name="strDciTextBox" Grid.Column="7" Grid.Row="5"
                                 VerticalAlignment="Center" Margin="{StaticResource TBS}"
                                 Text=".placeho" MaxLength="12"
                                 FontFamily="{StaticResource GeneralMonoFont}"/>

                        <!-- seventh row -->
                        <TextBlock Grid.Column="0" Grid.Row="6" Text="1-byte len str:"
                                   HorizontalAlignment="Right" VerticalAlignment="Center"/>
                        <TextBox Name="strLen8TextBox" Grid.Column="1" Grid.Row="6"
                                 VerticalAlignment="Center" Margin="{StaticResource TBS}"
                                 Text=".placeho" MaxLength="12"
                                 FontFamily="{StaticResource GeneralMonoFont}"/>
                        <TextBlock Grid.Column="2" Grid.Row="6" Text="2-byte len str:"
                                   HorizontalAlignment="Right" VerticalAlignment="Center"/>
                        <TextBox Name="strLen16TextBox" Grid.Column="3" Grid.Row="6"
                                 VerticalAlignment="Center" Margin="{StaticResource TBS}"
                                 Text=".placeho" MaxLength="12"
                                 FontFamily="{StaticResource GeneralMonoFont}"/>
                        <TextBlock Grid.Column="6" Grid.Row="6" Text="Data bank:"
                                   HorizontalAlignment="Right" VerticalAlignment="Center"/>
                        <TextBox Name="dataBankTextBox" Grid.Column="7" Grid.Row="6"
                                 VerticalAlignment="Center" Margin="{StaticResource TBS}"
                                 Text=".placeho" MaxLength="12"
                                 FontFamily="{StaticResource GeneralMonoFont}"/>
                    </Grid>

                    <GroupBox DockPanel.Dock="Bottom" Header="Quick Set"
                              HorizontalAlignment="Left" Padding="2,4">
                        <ComboBox Name="pseudoOpQuickComboBox" Width="170" IsReadOnly="True"
                                  ItemsSource="{Binding PseudoOpPresets}" DisplayMemberPath="Name"
                                  SelectionChanged="PseudoOpQuickComboBox_SelectionChanged"/>
                    </GroupBox>
                </DockPanel>
            </TabItem>


            <TabItem Name="asmConfigTab" Header="Asm Config">
                <StackPanel>
                    <GroupBox Header="Assembler-Specific Configuration" Padding="2,4">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition/>
                                <RowDefinition/>
                                <RowDefinition/>
                            </Grid.RowDefinitions>

                            <StackPanel Orientation="Horizontal" Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2">
                                <TextBlock Text="Select assembler to configure:"
                                           HorizontalAlignment="Right" Margin="0,7,4,0"/>
                                <ComboBox Name="asmConfigComboBox" Grid.Column="1" Grid.Row="0" IsReadOnly="True"
                                          Width="150" HorizontalAlignment="Left" Margin="0,4,0,20"
                                          ItemsSource="{Binding AssemblerList}" DisplayMemberPath="Name"
                                          SelectionChanged="AsmConfigComboBox_SelectionChanged"/>
                            </StackPanel>

                            <TextBlock Grid.Column="0" Grid.Row="1" Text="Executable:"
                                       HorizontalAlignment="Right" Margin="0,0,4,0"/>
                            <DockPanel Grid.Column="1" Grid.Row="1">
                                <Button DockPanel.Dock="Right" Content="Browse..." Width="75"
                                        Margin="8,0,0,8" Click="AsmExeBrowseButton_Click"/>
                                <TextBox Name="asmExePathTextBox" DockPanel.Dock="Left" Margin="0,0,0,8"
                                         Text="C:\something" TextChanged="AsmExePathTextBox_TextChanged"/>
                            </DockPanel>

                            <TextBlock Grid.Column="0" Grid.Row="2" Text="Column widths:"
                                       HorizontalAlignment="Right" Margin="0,0,4,0"/>
                            <StackPanel Grid.Column="1" Grid.Row="2" Orientation="Horizontal">
                                <TextBox Name="asmLabelColWidthTextBox" Width="60" Margin="0,0,4,0">
                                    <TextBox.Text>
                                        <Binding Path="AsmLabelColWidth" UpdateSourceTrigger="PropertyChanged">
                                            <Binding.ValidationRules>
                                                <local:AsmColWidthRule ValidatesOnTargetUpdated="True"/>
                                            </Binding.ValidationRules>
                                        </Binding>
                                    </TextBox.Text>
                                </TextBox>
                                <TextBox Name="asmOpcodeColWidthTextBox" Width="60" Margin="0,0,4,0">
                                    <TextBox.Text>
                                        <Binding Path="AsmOpcodeColWidth" UpdateSourceTrigger="PropertyChanged">
                                            <Binding.ValidationRules>
                                                <local:AsmColWidthRule ValidatesOnTargetUpdated="True"/>
                                            </Binding.ValidationRules>
                                        </Binding>
                                    </TextBox.Text>
                                </TextBox>
                                <TextBox Name="asmOperandColWidthTextBox" Width="60" Margin="0,0,4,0">
                                    <TextBox.Text>
                                        <Binding Path="AsmOperandColWidth" UpdateSourceTrigger="PropertyChanged">
                                            <Binding.ValidationRules>
                                                <local:AsmColWidthRule ValidatesOnTargetUpdated="True"/>
                                            </Binding.ValidationRules>
                                        </Binding>
                                    </TextBox.Text>
                                </TextBox>
                                <TextBox Name="asmCommentColWidthTextBox" Width="60" Margin="0,0,8,0">
                                    <TextBox.Text>
                                        <Binding Path="AsmCommentColWidth" UpdateSourceTrigger="PropertyChanged">
                                            <Binding.ValidationRules>
                                                <local:AsmColWidthRule ValidatesOnTargetUpdated="True"/>
                                            </Binding.ValidationRules>
                                        </Binding>
                                    </TextBox.Text>
                                </TextBox>
                                <TextBlock Text="(label, opcode, operand, comment)"/>
                            </StackPanel>
                        </Grid>
                    </GroupBox>

                    <GroupBox Header="Code Generation Settings" Padding="2,4" Margin="0,8,0,0">
                        <StackPanel>
                            <CheckBox Content="Show cycle counts in comments"
                                      IsChecked="{Binding ShowCycleCountsAsm}"/>
                            <CheckBox Content="Identify assembler in output" Margin="0,4,0,0"
                                      IsChecked="{Binding AddIdentComment}"/>
                            <CheckBox Content="Omit implied accumulator operands if allowed" Margin="0,4,0,0"
                                      IsChecked="{Binding OmitImpliedAccOperand}"/>
                            <StackPanel Orientation="Vertical" Margin="0,6,0,0">
                                <TextBlock Text="Put labels on their own line..."/>
                                <RadioButton GroupName="labelLineGroup" Margin="4,4,0,0"
                                             Content="Only when required"
                                             IsChecked="{Binding LabelPlacement_PreferSameLine}"/>
                                <RadioButton GroupName="labelLineGroup" Margin="4,4,0,0"
                                             Content="When the label is wider than the field"
                                             IsChecked="{Binding LabelPlacement_SplitIfTooLong}"/>
                                <RadioButton GroupName="labelLineGroup" Margin="4,4,0,0"
                                             Content="Whenever possible"
                                             IsChecked="{Binding LabelPlacement_PreferSeparateLine}"/>
                            </StackPanel>
                        </StackPanel>
                    </GroupBox>
                </StackPanel>
            </TabItem>

        </TabControl>
    </DockPanel>
</Window>
