diff --git a/SourceGen/MainController.cs b/SourceGen/MainController.cs index 9509548..3dd0a81 100644 --- a/SourceGen/MainController.cs +++ b/SourceGen/MainController.cs @@ -4151,10 +4151,10 @@ namespace SourceGen { esb.Append("End: "); esb.Append(mFormatter.FormatOffset24(region.Offset + region.ActualLength - 1)); esb.Append(CRLF); - esb.Append("Length: " + region.ActualLength + " / " + - mFormatter.FormatHexValue(region.ActualLength, 2)); + esb.Append("Length: " + region.ActualLength + " (" + + mFormatter.FormatHexValue(region.ActualLength, 2) + ")"); if (region.Length == AddressMap.FLOATING_LEN) { - esb.Append(" (floating)"); + esb.Append(" [floating]"); } esb.Append(CRLF); esb.Append("Pre-label: "); @@ -4169,7 +4169,7 @@ namespace SourceGen { !mProject.CpuDef.HasAddr16)); } } else { - esb.Append("none"); + esb.Append("(not set)"); } esb.Append(CRLF); esb.Append("Synthetic: " + isSynth); diff --git a/SourceGen/Tools/WpfGui/HexDumpViewer.xaml b/SourceGen/Tools/WpfGui/HexDumpViewer.xaml index cd975fa..795321e 100644 --- a/SourceGen/Tools/WpfGui/HexDumpViewer.xaml +++ b/SourceGen/Tools/WpfGui/HexDumpViewer.xaml @@ -25,7 +25,8 @@ limitations under the License. Title="Hex Dump Viewer" Width="542" Height="600" MinWidth="542" MinHeight="180" ResizeMode="CanResizeWithGrip" ShowInTaskbar="True" - Loaded="Window_Loaded"> + Loaded="Window_Loaded" + PreviewKeyDown="Window_KeyEventHandler"> Plain ASCII only diff --git a/SourceGen/Tools/WpfGui/HexDumpViewer.xaml.cs b/SourceGen/Tools/WpfGui/HexDumpViewer.xaml.cs index a635e1f..0e98762 100644 --- a/SourceGen/Tools/WpfGui/HexDumpViewer.xaml.cs +++ b/SourceGen/Tools/WpfGui/HexDumpViewer.xaml.cs @@ -19,6 +19,7 @@ using System.Diagnostics; using System.Runtime.CompilerServices; using System.Windows; using System.Windows.Controls; +using System.Windows.Input; using Asm65; using CharConvMode = Asm65.Formatter.FormatConfig.CharConvMode; @@ -122,6 +123,13 @@ namespace SourceGen.Tools.WpfGui { charConvComboBox.SelectedIndex = index; } + // Catch ESC key. + private void Window_KeyEventHandler(object sender, KeyEventArgs e) { + if (e.Key == Key.Escape) { + Close(); + } + } + /// /// Sets the filename associated with the data. This is for display purposes only. /// diff --git a/SourceGen/WpfGui/EditAddress.xaml b/SourceGen/WpfGui/EditAddress.xaml index 66b07b9..14f5f47 100644 --- a/SourceGen/WpfGui/EditAddress.xaml +++ b/SourceGen/WpfGui/EditAddress.xaml @@ -22,7 +22,7 @@ limitations under the License. xmlns:system="clr-namespace:System;assembly=mscorlib" xmlns:local="clr-namespace:SourceGen.WpfGui" mc:Ignorable="d" - Title="Edit Address Region Properties" + Title="Edit Address Region" Width="350" SizeToContent="Height" ResizeMode="NoResize" ShowInTaskbar="False" WindowStartupLocation="CenterOwner" ContentRendered="Window_ContentRendered"> @@ -30,28 +30,32 @@ limitations under the License. - Creating new address region + Creating new address region. Editing existing address region: - Edit only. + Edit attributes. - Edit the region's attributes. Region length will not be changed. + Edit the region's attributes. The region's length will not be changed. - Set fixed size. + Fix end point. - Edit the region's attributes, and convert the floating end to a fixed end. + Convert the floating end to a fixed end, using the current length, and edit + the region's attributes. + + + Option to set fixed end not available: end point is already fixed. Resize. Edit the region's attributes, and resize it to the selection. The new end offset will be: End: {0} Length: {1} + >Resize the region to the current selection, and edit the region's attributes. The new end point will be: Offset: {0} Length: {1} - Resize not available: cannot resize to the selection. {0} + Option to resize not available: cannot resize to the selection. {0} Create fixed. @@ -60,9 +64,6 @@ limitations under the License. Create a new region, with a fixed end point. The region will start at {0} and have a length of {1}. - - Create fixed not available: can't convert to fixed end point because it's already fixed. - Create fixed not available: unable to create a new region with a fixed end point here. @@ -79,7 +80,7 @@ limitations under the License. may change as other regions are added and removed. - Create floating not available: unable to create a new region with a floating end point here. + Option to create floating region not available: unable to create a new region with a floating end point here. Internal error. @@ -88,7 +89,7 @@ limitations under the License. The new region would have the same start offset and length as an existing region. - The start offset of the new region is the same as the start offset of an existing + The start offset of the new region would be the same as the start offset of an existing region, and one or both have a floating end point. @@ -109,13 +110,18 @@ limitations under the License. - + + - - + + + + @@ -123,8 +129,8 @@ limitations under the License. Visibility="{Binding IsFloating, Converter={StaticResource BoolToVis}}"/> - - + @@ -153,10 +159,10 @@ limitations under the License. Text="{Binding ErrorMessageStr, FallbackValue=Error Message}"/> - + - + - + - + + /// Initial address. (Does not change.) + /// + public string RegionAddressStr { + get { return "$" + mFormatter.FormatAddress(mRegionAddress, mShowBank); } + } + private int mRegionAddress; + /// /// Offset of first selected byte. (Does not change.) /// @@ -304,6 +312,7 @@ namespace SourceGen.WpfGui { UseRelativeAddressing = curRegion.IsRelative; OperationStr = (string)FindResource("str_HdrEdit"); + mRegionAddress = curRegion.Address; mRegionStartOffset = curRegion.Offset; mRegionEndOffset = curRegion.Offset + curRegion.ActualLength - 1; mPreLabelAddress = curRegion.PreLabelAddress; @@ -326,7 +335,7 @@ namespace SourceGen.WpfGui { curRegion.IsRelative); } else { option2Summ = string.Empty; - option2Msg = (string)FindResource("str_CreateFixedAlreadyFixed"); + option2Msg = (string)FindResource("str_EditFixedAlreadyFixed"); mResultEntry2 = null; EnableOption2 = false; // show it, but disabled } @@ -363,6 +372,14 @@ namespace SourceGen.WpfGui { EnableOption1 = false; CheckOption2 = true; } + + if (curRegion.ActualLength == selectionLen) { + // The selection size matches the region's length, which means they + // have the entire region selected, so "resize" and "edit" do the same + // thing. No real need to disable the resize option, but we can default + // to "edit only" to emphasize that there's no actual change. + CheckOption2 = true; + } } } else { diff --git a/SourceGen/WpfGui/MainWindow.xaml b/SourceGen/WpfGui/MainWindow.xaml index f23d666..94bd636 100644 --- a/SourceGen/WpfGui/MainWindow.xaml +++ b/SourceGen/WpfGui/MainWindow.xaml @@ -71,7 +71,7 @@ limitations under the License. Del - + diff --git a/docs/sgmanual/editors.html b/docs/sgmanual/editors.html index 5282a61..8a352e6 100644 --- a/docs/sgmanual/editors.html +++ b/docs/sgmanual/editors.html @@ -15,7 +15,7 @@

Back to index

-

Define Address Region

+

Create/Edit Address Region

Address regions may be created, edited, resized, or removed. Which diff --git a/docs/sgmanual/index.html b/docs/sgmanual/index.html index f63731e..2a3b3ae 100644 --- a/docs/sgmanual/index.html +++ b/docs/sgmanual/index.html @@ -94,7 +94,7 @@ using the Help > Help menu item or by hitting

  • Editors