1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-07-06 16:29:03 +00:00

Minor tweaks

This commit is contained in:
Andy McFadden 2019-07-13 11:29:05 -07:00
parent ea3108c564
commit 0d75282756
6 changed files with 34 additions and 17 deletions

View File

@ -820,13 +820,18 @@ namespace Asm65 {
} else if (mFormatConfig.mHexDumpAsciiOnly) {
return '.';
} else {
// These values makes the hex dump ListView freak out.
// Certain values make the hex dump ListView freak out in WinForms, but work
// fine in WPF. The "control pictures" are a nice idea, but in practice they're
// unreadably small and provide no benefit. The black-diamond "replacement
// character" is dark and makes everything feel noisy. Middle-dot is subtle,
// but sufficiently different from a '.' to be useful.
//if (ch < 0x20) {
// return (char)(ch + '\u2400'); // Unicode "control pictures" block
//}
//return '\ufffd'; // Unicode "replacement character"
//return '\u00bf'; // INVERTED QUESTION MARK
return '\u00b7'; // MIDDLE DOT
}
}

View File

@ -620,7 +620,7 @@ namespace SourceGenWPF {
}
if (intKey < 0 || intKey + dfd.Length > spf.FileDataLength) {
report.Add(FileLoadItem.Type.Warning,
string.Format(Res.Strings.ERR_BAD_FD, intKey));
string.Format(Res.Strings.ERR_BAD_FD_FMT, intKey));
continue;
}

View File

@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- Global string table. The goal is to have all English text in XAML. Strings used by C#
should either be here or in a Window-specific resource dictionary. -->
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib"
@ -31,7 +33,7 @@ limitations under the License.
<system:String x:Key="str_ClipformatAssemblerSource">Assembler Source</system:String>
<system:String x:Key="str_ClipformatDisassembly">Disassembly</system:String>
<system:String x:Key="str_DefaultValue">Default</system:String>
<system:String x:Key="str_ErrBadFd">Bad format descriptor at +{0:x6}.</system:String>
<system:String x:Key="str_ErrBadFdFmt">Bad format descriptor at +{0:x6}.</system:String>
<system:String x:Key="str_ErrBadFdFormat">Bad format descriptor type</system:String>
<system:String x:Key="str_ErrBadFileLength">Bad file length</system:String>
<system:String x:Key="str_ErrBadIdent">Invalid file identifier</system:String>

View File

@ -20,7 +20,7 @@ namespace SourceGenWPF.Res {
/// <summary>
/// This is a bridge between the XAML definitions and the C# code that uses the strings.
/// FindResource() throws an exception if the resource isn't found, so typos and missing
/// resources will cause the app to fail at launch.
/// resources will cause the app to fail the first time any string is referenced.
/// </summary>
public static class Strings {
public static string ABBREV_ADDRESS =
@ -47,8 +47,8 @@ namespace SourceGenWPF.Res {
(string)Application.Current.FindResource("str_ClipformatAssemblerSource");
public static string CLIPFORMAT_DISASSEMBLY =
(string)Application.Current.FindResource("str_ClipformatDisassembly");
public static string ERR_BAD_FD =
(string)Application.Current.FindResource("str_ErrBadFd");
public static string ERR_BAD_FD_FMT =
(string)Application.Current.FindResource("str_ErrBadFdFmt");
public static string ERR_BAD_FD_FORMAT =
(string)Application.Current.FindResource("str_ErrBadFdFormat");
public static string ERR_BAD_FILE_LENGTH =

View File

@ -45,14 +45,13 @@ namespace SourceGenWPF.Tools {
/// <summary>
/// Data formatter object.
///
/// There's currently no way to update this after the dialog is opened, which means
/// we won't track changes to hex case preference. I'm okay with that.
/// </summary>
private Formatter mFormatter;
private string[] mLines;
// Tracks the number of lines we've generated, so we can see if virtualization is
// actually happening.
private int mDebugGenLineCount;
@ -87,9 +86,9 @@ namespace SourceGenWPF.Tools {
if (mLines[index] == null) {
mLines[index] = mFormatter.FormatHexDump(mData, index * 16);
//if ((++mDebugGenLineCount % 1000) == 0) {
// Debug.WriteLine("DebugGenLineCount: " + mDebugGenLineCount);
//}
if ((++mDebugGenLineCount % 1000) == 0) {
//Debug.WriteLine("DebugGenLineCount: " + mDebugGenLineCount);
}
}
//Debug.WriteLine("GET LINE " + index + ": " + mLines[index]);
return mLines[index];
@ -155,13 +154,15 @@ namespace SourceGenWPF.Tools {
//Debug.WriteLine("VHD IndexOf " + value);
// This gets called sometimes when the selection changes, because the selection
// mechanism tracks objects rather than indices. Fortunately we can convert the
// value string to an index by parsing the first six characters.
// value string to an index by parsing the first six characters. (This is
// somewhat fragile as it relies on the way Formatter formats the string. Might
// want to make offset-from-hexdump-string a Formatter method.)
int offset = Convert.ToInt32(((string)value).Substring(0, 6), 16);
int index = offset / 16;
// Either the object at the target location matches, or it doesn't; no need to
// search. We'll get requests for nonexistent objects after we reformat the
// collection.
// collection, when the list control tries to find the selected items.
//
// Object equality is what's desired; no need for string comparison
if ((object)mLines[index] == value) {

View File

@ -39,14 +39,18 @@ namespace SourceGenWPF.Tools.WpfGui {
public VirtualHexDump HexDumpLines { get; private set; }
/// <summary>
/// Hex formatter.
/// Formatter that handles the actual string formatting.
///
/// There's currently no way to update this after the dialog is opened, which means
/// we won't track changes to hex case preference if the app settings are updated.
/// I'm okay with that.
/// </summary>
private Formatter mFormatter;
/// <summary>
/// If true, don't include non-ASCII characters in text area. (Without this we might
/// use Unicode bullets or other glyphs for unprintable text.)
/// use Unicode bullets or other glyphs for unprintable text.) Bound to a CheckBox.
/// </summary>
public bool AsciiOnlyDump {
get { return mAsciiOnlyDump; }
@ -64,6 +68,10 @@ namespace SourceGenWPF.Tools.WpfGui {
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
/// <summary>
/// Character conversion modes. These determine how we interpret bytes for the
/// ASCII portion of the dump.
/// </summary>
public enum CharConvMode {
Unknown = 0,
PlainAscii,
@ -188,6 +196,7 @@ namespace SourceGenWPF.Tools.WpfGui {
// Make sure it's visible.
hexDumpData.ScrollIntoView(HexDumpLines[endLine]);
hexDumpData.ScrollIntoView(HexDumpLines[startLine]);
hexDumpData.Focus();
}
#if false // DataGrid provides this automatically