1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-12-12 05:31:04 +00:00
6502bench/SourceGen/WpfGui/EditDefSymbol.xaml
Andy McFadden 0fb0b4cca8 Fix some address region issues
Fixed a crash when the listing is refreshed while a .adrend line is
the only thing selected.

Fixed .adrend lines being spammed if the last thing before it is a
multi-byte item, and you edit a comment / note / label on that line.
Harmless, but weird.

Also, added keyboard shortcuts in DefSymbol editor, so you can change
from address to constant with Alt+C.
2021-10-17 18:02:29 -07:00

126 lines
7.1 KiB
XML

<!--
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.EditDefSymbol"
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 Symbol"
SizeToContent="Height" Width="360" ResizeMode="NoResize"
ShowInTaskbar="False" WindowStartupLocation="CenterOwner"
Loaded="Window_Loaded"
ContentRendered="Window_ContentRendered">
<Window.Resources>
<BooleanToVisibilityConverter x:Key="BoolToVis"/>
<system:String x:Key="str_WidthLimitFmt">• Decimal or hex value, 1-{0}</system:String>
<system:String x:Key="str_ProjectConstant">_Constant</system:String>
<system:String x:Key="str_VariableConstant">Stack-Relative _Offset</system:String>
</Window.Resources>
<Grid Margin="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Grid.Column="0" Grid.Row="0" Margin="0,0,8,0">Symbol type:</TextBlock>
<StackPanel Grid.Column="1" Grid.Row="0" Orientation="Horizontal" Margin="0,1,0,12"
IsEnabled="{Binding NotReadOnlyValueAndType}">
<RadioButton Content="_Address" GroupName="Type" Margin="0,0,0,0" IsChecked="{Binding IsAddress}"/>
<RadioButton Content="{Binding ConstantLabel, FallbackValue=Constant}" Margin="8,0,0,0"
GroupName="Type" IsChecked="{Binding IsConstant}"/>
</StackPanel>
<TextBlock Grid.Column="0" Grid.Row="1" Text="Label:"/>
<StackPanel Grid.Column="1" Grid.Row="1" Margin="0,0,0,16">
<TextBox Name="labelTextBox" Margin="0,1,0,0" Text="{Binding Label, UpdateSourceTrigger=PropertyChanged}"
FontFamily="{StaticResource GeneralMonoFont}"/>
<TextBlock Name="labelNotesLabel" Text="• 2+ alphanumerics, starting with letter" Margin="0,4,0,0"/>
<TextBlock Name="projectLabelUniqueLabel" Text="• Unique among project symbols" Margin="0,4,0,0"
Visibility="{Binding IsNotVariable, Converter={StaticResource BoolToVis}}"/>
<TextBlock Name="labelUniqueLabel" Text="• Unique" Margin="0,4,0,0"
Visibility="{Binding IsVariable, Converter={StaticResource BoolToVis}}"/>
</StackPanel>
<TextBlock Grid.Column="0" Grid.Row="2" Text="Value:"/>
<StackPanel Grid.Column="1" Grid.Row="2" VerticalAlignment="Top" Margin="0,0,0,16">
<TextBox Name="valueTextBox" Margin="0,1,0,0" Text="{Binding Value, UpdateSourceTrigger=PropertyChanged}"
FontFamily="{StaticResource GeneralMonoFont}"
IsReadOnly="{Binding ReadOnlyValueAndType}"/>
<TextBlock Name="varValueRangeLabel" Text="• Value between 0-255, &lt;= 256 with width" Margin="0,4,0,0"
Visibility="{Binding IsVariable, Converter={StaticResource BoolToVis}}"/>
<TextBlock Name="addrValueRangeLabel" Text="• Address between 00/0000 - ff/ffff, incl. width" Margin="0,4,0,0"
Visibility="{Binding IsNotVariable, Converter={StaticResource BoolToVis}}"/>
<TextBlock Name="varValueUniqueLabel" Text="• Values in table must not overlap" Margin="0,4,0,0"
Visibility="{Binding IsVariable, Converter={StaticResource BoolToVis}}"/>
<TextBlock Name="valueNotesLabel" Text="• Decimal, hex ($), or binary (%)" Margin="0,4,0,0"/>
</StackPanel>
<TextBlock Grid.Column="0" Grid.Row="3" Text="Width:"/>
<StackPanel Grid.Column="1" Grid.Row="3" Margin="0,0,0,16">
<TextBox Margin="0,1,0,0" Text="{Binding VarWidth, UpdateSourceTrigger=PropertyChanged}"
FontFamily="{StaticResource GeneralMonoFont}"
IsEnabled="{Binding IsAddress}"/>
<TextBlock Name="widthNotesLabel" Margin="0,4,0,0"
Text="{Binding WidthLimitLabel, FallbackValue=• Decimal or hex value\, 1-ZZZZZ}"/>
<TextBlock Name="widthOptionalLabel" Text="• Optional for Address, ignored for Constant" Margin="0,4,0,0"
Visibility="{Binding IsNotVariable, Converter={StaticResource BoolToVis}}"/>
</StackPanel>
<TextBlock Grid.Column="0" Grid.Row="4" Text="Comment:" Margin="0,0,8,0"/>
<StackPanel Grid.Column="1" Grid.Row="4" Margin="0,0,0,16">
<TextBox Name="commentTextBox" Margin="0,1,0,0" Text="{Binding Comment, UpdateSourceTrigger=PropertyChanged}"
FontFamily="{StaticResource GeneralMonoFont}" ScrollViewer.CanContentScroll="True"/>
<TextBlock Text="• Optional" Margin="0,4,0,0"/>
</StackPanel>
<TextBlock Grid.Column="0" Grid.Row="5"
Visibility="{Binding IsNotVariable, Converter={StaticResource BoolToVis}}"
Text="Access:"/>
<StackPanel Grid.Column="1" Grid.Row="5" Margin="0,0,0,4"
Visibility="{Binding IsNotVariable, Converter={StaticResource BoolToVis}}">
<StackPanel Orientation="Horizontal" Margin="0,1,0,0"
IsEnabled="{Binding IsAddress}">
<CheckBox Content="Read" Margin="0,0,0,0" IsChecked="{Binding IsReadChecked}"/>
<CheckBox Content="Write" Margin="24,0,0,0" IsChecked="{Binding IsWriteChecked}"/>
</StackPanel>
<TextBlock Name="checkReadWriteLabel" Text="• Check one or both for Address" Margin="0,4,0,0"/>
</StackPanel>
<StackPanel Grid.Column="1" Grid.Row="6" Margin="0,16,0,0"
Orientation="Horizontal" HorizontalAlignment="Right">
<Button Content="OK" Width="70" IsDefault="True" IsEnabled="{Binding IsValid}"
Click="OkButton_Click"/>
<Button Content="Cancel" Width="70" IsCancel="True" Margin="8,0,0,0"/>
</StackPanel>
</Grid>
</Window>