1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-09-11 04:57:02 +00:00
6502bench/SourceGen/WpfGui/EditInstructionOperand.xaml

191 lines
11 KiB
Plaintext
Raw Normal View History

<!--
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.EditInstructionOperand"
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 Instruction Operand"
SizeToContent="WidthAndHeight" ResizeMode="NoResize"
ShowInTaskbar="False" WindowStartupLocation="CenterOwner"
Loaded="Window_Loaded"
ContentRendered="Window_ContentRendered">
<Window.Resources>
<BooleanToVisibilityConverter x:Key="BoolToVis"/>
<system:String x:Key="str_SymbolNotUsed">N/A</system:String>
<system:String x:Key="str_SymbolNotValid">[invalid symbol name]</system:String>
<system:String x:Key="str_SymbolUnknown">?</system:String>
<system:String x:Key="str_CreateLocalVariable">Create Local Variable</system:String>
<system:String x:Key="str_EditLocalVariable">Edit Local Variable</system:String>
</Window.Resources>
<Grid Margin="8" Width="500">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2" Margin="0,0,0,8"
Text="Select operand format:"/>
<StackPanel Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="2" Orientation="Horizontal" Margin="0,0,0,8">
<RadioButton GroupName="Main" Margin="0,2,0,0"
Content="Default (auto-format as hex, local var, or reference to label/platform/project symbol)"
IsChecked="{Binding FormatDefault}"/>
</StackPanel>
<GroupBox Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="2" Padding="2,4" Header="Explicit Format">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0">
<RadioButton GroupName="Main" Content="Hexadecimal"
IsChecked="{Binding FormatHex}"/>
<RadioButton GroupName="Main" Content="Decimal" Margin="0,2,0,0"
IsChecked="{Binding FormatDecimal}"/>
<RadioButton GroupName="Main" Content="Binary" Margin="0,2,0,0"
IsChecked="{Binding FormatBinary}"/>
<RadioButton GroupName="Main" Content="ASCII (low or high) character" Margin="0,2,0,0"
IsEnabled="{Binding IsFormatAsciiAllowed}" IsChecked="{Binding FormatAscii}"/>
<RadioButton GroupName="Main" Content="C64 PETSCII character" Margin="0,2,0,0"
IsEnabled="{Binding IsFormatPetsciiAllowed}" IsChecked="{Binding FormatPetscii}"/>
<RadioButton GroupName="Main" Content="C64 Screen character" Margin="0,2,0,0"
IsEnabled="{Binding IsFormatScreenCodeAllowed}" IsChecked="{Binding FormatScreenCode}"/>
</StackPanel>
<Grid Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<RadioButton Name="formatSymbolButton" Grid.Column="0" Grid.Row="0" GroupName="Main"
Content="Symbol" IsChecked="{Binding FormatSymbol}"/>
<StackPanel Grid.Column="0" Grid.Row="1" Orientation="Horizontal" Margin="18,1,0,0">
<TextBox Name="symbolTextBox" Grid.Column="0" Grid.Row="1" Width="150"
FontFamily="{StaticResource GeneralMonoFont}"
Text="{Binding SymbolLabel, UpdateSourceTrigger=PropertyChanged}"/>
<TextBlock Text="(auto)" Foreground="Red" Margin="4,0,0,0"
Visibility="{Binding IsSymbolAuto, Converter={StaticResource BoolToVis}}"/>
</StackPanel>
<StackPanel Grid.Column="0" Grid.Row="2" Orientation="Horizontal" Margin="18,4,0,0"
IsEnabled="{Binding IsPartPanelEnabled}">
<RadioButton GroupName="Part" Content="Low"
IsChecked="{Binding FormatPartLow}"/>
<RadioButton GroupName="Part" Content="High" Margin="10,0,0,0"
IsChecked="{Binding FormatPartHigh}"/>
<RadioButton GroupName="Part" Content="Bank" Margin="10,0,0,0"
IsChecked="{Binding FormatPartBank}"/>
</StackPanel>
<!-- show the symbol's value -->
<Grid Grid.Column="0" Grid.Row="3" Margin="18,8,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Grid.Column="0" Grid.Row="0" Text="Value:" Margin="0,0,16,0"/>
<TextBlock Grid.Column="1" Grid.Row="0"
Text="{Binding SymbolValueHex, FallbackValue=$112233}"/>
<TextBlock Grid.Column="1" Grid.Row="1"
Text="{Binding SymbolValueDecimal, FallbackValue=16777215}"/>
</Grid>
</Grid>
</Grid>
</GroupBox>
<!-- Preview box spans the full window. Most of the time this isn't necessary, but
sometimes you get long symbols with complex expressions, and the window needs to be
fairly wide. So might as well just use it all. -->
<DockPanel Grid.Column="0" Grid.Row="3" Grid.ColumnSpan="2" Margin="0,8">
<TextBlock DockPanel.Dock="Left" Text="Preview:"/>
<TextBox DockPanel.Dock="Left" IsReadOnly="True" Margin="8,1,0,0"
FontFamily="{StaticResource GeneralMonoFont}" Text="{Binding PreviewText}"/>
</DockPanel>
<!-- numeric reference box, for labels and project/platform symbols -->
<GroupBox Grid.Column="0" Grid.Row="4" Margin="0,4,0,0" Padding="2,4" Header="Numeric Address Reference">
<StackPanel>
<TextBlock Text="Operand is not an 8, 16, or 24-bit address"/>
<TextBlock Text="Address is inside the project"/>
<TextBlock Text="Address is NOT the start of a thing"/>
<TextBlock Text="Label at target address: ______"/>
<Button Width="120" Content="Edit Label"/>
<TextBlock Text="Address is outside the project"/>
<TextBlock Text="No matching platform / project symbol"/>
<TextBlock Text="Found matching {platform|project} symbol"/>
<TextBlock Text="[______] ($value)"/>
<Button Width="120" Content="Create/Edit Project Symbol"/>
</StackPanel>
</GroupBox>
<!-- local variable controls -->
<GroupBox Grid.Column="1" Grid.Row="4" Margin="0,4,0,0" Padding="2,4" Header="Local Variable">
<StackPanel>
<TextBlock Text="Operand is not a zero page address or stack relative" TextWrapping="Wrap"
Visibility="{Binding ShowLvNotApplicable, Converter={StaticResource BoolToVis}}"/>
<TextBlock Text="No local variable tables have been defined before this point" TextWrapping="Wrap"
Visibility="{Binding ShowLvTableNotFound, Converter={StaticResource BoolToVis}}"/>
<TextBlock Text="No matching local variable found" TextWrapping="Wrap"
Visibility="{Binding ShowLvNoMatchFound, Converter={StaticResource BoolToVis}}"/>
<StackPanel Orientation="Horizontal"
Visibility="{Binding ShowLvMatchFound, Converter={StaticResource BoolToVis}}">
<TextBlock Text="Match found:"/>
<TextBlock Margin="4,2,0,0" FontFamily="{StaticResource GeneralMonoFont}"
Text="{Binding LocalVariableLabel, FallbackValue=VAR_NAME}"/>
</StackPanel>
<Button Width="150" Margin="0,4,0,0"
Content="{Binding CreateEditLocalVariableText, FallbackValue=Diddle Local Variable}"
Visibility="{Binding ShowLvCreateEditButton, Converter={StaticResource BoolToVis}}"
Click="EditLocalVariableButton_Click"/>
</StackPanel>
</GroupBox>
<DockPanel Grid.Column="0" Grid.Row="5" Grid.ColumnSpan="2" Margin="0,16,0,0" LastChildFill="False">
<Button DockPanel.Dock="Right" Content="Cancel" Width="70" IsCancel="True" Margin="8,0,0,0"/>
<Button DockPanel.Dock="Right" Content="OK" Width="70" IsDefault="True"
IsEnabled="{Binding IsValid}" Click="OkButton_Click"/>
</DockPanel>
</Grid>
</Window>