mirror of
https://github.com/fadden/6502bench.git
synced 2024-08-20 11:28:58 +00:00
I looked at doing this in full WPF fashion, binding context object properties to radio button IsChecked properties, but there's a lot of conditional logic behind the scenes. I also wanted to do the various formatted strings with a StringFormat binding, but that only takes one argument, and some of them need two. On the plus side, the format strings are now in Window.Resources, rather than the global string table or the buttons themselves. (The latter always felt a little sleazy, but it seemed like the least annoying way to do it in WinForms.)
136 lines
8.3 KiB
XML
136 lines
8.3 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="SourceGenWPF.WpfGui.EditDataOperand"
|
|
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:SourceGenWPF.WpfGui"
|
|
mc:Ignorable="d"
|
|
Title="Edit Data Operand"
|
|
SizeToContent="WidthAndHeight" ResizeMode="NoResize"
|
|
ShowInTaskbar="False" WindowStartupLocation="CenterOwner"
|
|
Loaded="Window_Loaded"
|
|
ContentRendered="Window_ContentRendered">
|
|
|
|
<Window.Resources>
|
|
<system:String x:Key="str_SingleByte">Select data format (1 byte selected):</system:String>
|
|
<system:String x:Key="str_SingleGroup">Select data format ({0} bytes selected):</system:String>
|
|
<system:String x:Key="str_MultiGroup">Select data format ({0} bytes selected in {1} groups):</system:String>
|
|
|
|
<system:String x:Key="str_StringMixed">Mixed ASCII ({0} bytes) and non-ASCII ({1} bytes)</system:String>
|
|
<system:String x:Key="str_StringMixedReverse">Reversed ASCII ({0} bytes) and non-ASCII ({1} bytes)</system:String>
|
|
<system:String x:Key="str_StringNullTerm">Null-terminated strings ({0})</system:String>
|
|
<system:String x:Key="str_StringLen8">Strings prefixed with 8-bit length ({0})</system:String>
|
|
<system:String x:Key="str_StringLen16">Strings prefixed with 16-bit length ({0})</system:String>
|
|
<system:String x:Key="str_StringDci">Dextral character inverted ({0})</system:String>
|
|
</Window.Resources>
|
|
|
|
<StackPanel Margin="8">
|
|
<TextBlock Name="selectFormatLabel" Text="{StaticResource str_MultiGroup}"/>
|
|
<RadioButton Name="radioDefaultFormat" GroupName="Main" Content="_Default" Margin="0,8,0,0"/>
|
|
|
|
<TextBlock Text="Simple Data" Margin="0,12,0,0"/>
|
|
<Rectangle HorizontalAlignment="Stretch" Fill="LightGray" Height="2"/>
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition Width="*"/>
|
|
</Grid.ColumnDefinitions>
|
|
<StackPanel Grid.Column="0">
|
|
<RadioButton Name="radioSingleBytes" GroupName="Main" Content="Single _bytes" Margin="0,4,0,0"
|
|
Checked="MainGroup_CheckedChanged"/>
|
|
<RadioButton Name="radio16BitLittle" GroupName="Main" Content="16-bit words, little-endian" Margin="0,4,0,0"
|
|
Checked="MainGroup_CheckedChanged"/>
|
|
<RadioButton Name="radio16BitBig" GroupName="Main" Content="16-bit words, big-endian" Margin="0,4,0,0"
|
|
Checked="MainGroup_CheckedChanged"/>
|
|
<RadioButton Name="radio24BitLittle" GroupName="Main" Content="24-bit words, little-endian" Margin="0,4,0,0"
|
|
Checked="MainGroup_CheckedChanged"/>
|
|
<RadioButton Name="radio32BitLittle" GroupName="Main" Content="32-bit words, little-endian" Margin="0,4,0,0"
|
|
Checked="MainGroup_CheckedChanged"/>
|
|
</StackPanel>
|
|
<GroupBox Name="simpleDisplayAsGroupBox" Grid.Column="1" Header="Display As..." Margin="16,0,0,0">
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="*"/>
|
|
<ColumnDefinition Width="*"/>
|
|
</Grid.ColumnDefinitions>
|
|
<StackPanel Grid.Column="0">
|
|
<RadioButton Name="radioSimpleDataHex" GroupName="Display" Content="Hex"
|
|
Margin="0,4,0,0" Checked="SimpleDisplay_CheckedChanged"/>
|
|
<RadioButton Name="radioSimpleDataDecimal" GroupName="Display" Content="Decimal"
|
|
Margin="0,4,0,0" Checked="SimpleDisplay_CheckedChanged"/>
|
|
<RadioButton Name="radioSimpleDataBinary" GroupName="Display" Content="Binary"
|
|
Margin="0,4,0,0" Checked="SimpleDisplay_CheckedChanged"/>
|
|
<RadioButton Name="radioSimpleDataAscii" GroupName="Display" Content="ASCII"
|
|
Margin="0,4,0,0" Checked="SimpleDisplay_CheckedChanged"/>
|
|
</StackPanel>
|
|
<StackPanel Grid.Column="1">
|
|
<RadioButton Name="radioSimpleDataAddress" GroupName="Display" Content="_Address"
|
|
Margin="12,4,0,0" Checked="SimpleDisplay_CheckedChanged"/>
|
|
<RadioButton Name="radioSimpleDataSymbolic" GroupName="Display" Content="_Symbolic reference"
|
|
Margin="12,4,0,0" Checked="SimpleDisplay_CheckedChanged"/>
|
|
<TextBox Name="symbolEntryTextBox" Margin="32,4,0,0" TextChanged="SymbolEntryTextBox_TextChanged"/>
|
|
<StackPanel Orientation="Horizontal" Margin="32,4,0,0"
|
|
IsEnabled="{Binding ElementName=radioSimpleDataSymbolic, Path=IsChecked}">
|
|
<RadioButton Name="radioSymbolPartLow" GroupName="Part" Content="Low"/>
|
|
<RadioButton Name="radioSymbolPartHigh" GroupName="Part" Content="High" Margin="8,0,0,0"/>
|
|
<RadioButton Name="radioSymbolPartBank" GroupName="Part" Content="Bank" Margin="8,0,8,0"/>
|
|
</StackPanel>
|
|
</StackPanel>
|
|
</Grid>
|
|
</GroupBox>
|
|
</Grid>
|
|
|
|
<TextBlock Text="Bulk Data" Margin="0,12,0,0"/>
|
|
<Rectangle HorizontalAlignment="Stretch" Fill="LightGray" Height="2"/>
|
|
<RadioButton Name="radioDenseHex" GroupName="Main" Content="Densely-_packed bytes" Margin="0,4,0,0"
|
|
Checked="MainGroup_CheckedChanged"/>
|
|
<RadioButton Name="radioFill" GroupName="Main" Content="_Fill with value" Margin="0,4,0,0"
|
|
Checked="MainGroup_CheckedChanged"/>
|
|
|
|
<TextBlock Text="String" Margin="0,12,0,0"/>
|
|
<Rectangle HorizontalAlignment="Stretch" Fill="LightGray" Height="2"/>
|
|
<RadioButton Name="radioStringMixed" GroupName="Main" Margin="0,4,0,0"
|
|
Content="{StaticResource str_StringMixed}"
|
|
Checked="MainGroup_CheckedChanged"/>
|
|
<RadioButton Name="radioStringMixedReverse" GroupName="Main" Margin="0,4,0,0"
|
|
Content="{StaticResource str_StringMixedReverse}"
|
|
Checked="MainGroup_CheckedChanged"/>
|
|
<RadioButton Name="radioStringNullTerm" GroupName="Main" Margin="0,4,0,0"
|
|
Content="{StaticResource str_StringNullTerm}"
|
|
Checked="MainGroup_CheckedChanged"/>
|
|
<RadioButton Name="radioStringLen8" GroupName="Main" Margin="0,4,0,0"
|
|
Content="{StaticResource str_StringLen8}"
|
|
Checked="MainGroup_CheckedChanged"/>
|
|
<RadioButton Name="radioStringLen16" GroupName="Main" Margin="0,4,0,0"
|
|
Content="{StaticResource str_StringLen16}"
|
|
Checked="MainGroup_CheckedChanged"/>
|
|
<RadioButton Name="radioStringDci" GroupName="Main" Margin="0,4,0,0"
|
|
Content="{StaticResource str_StringDci}"
|
|
Checked="MainGroup_CheckedChanged"/>
|
|
|
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,8,0,0">
|
|
<Button Name="okButton" Content="OK" IsDefault="True" Width="70"
|
|
IsEnabled="{Binding IsValid}" Click="OkButton_Click"/>
|
|
<Button Name="cancelButton" Content="Cancel" IsCancel="True"
|
|
Width="70" Margin="4,0,0,0"/>
|
|
</StackPanel>
|
|
</StackPanel>
|
|
</Window>
|