1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-11-26 21:49:45 +00:00

Flip name/value columns in Symbols window

The Symbols window showed Type-Name-Value, which feels like the
natural order.  However, the Value field has a narrow max width,
while the Name field can get pretty long.  It makes more sense to
let Name fill out to the right edge, allowing the user to scroll
horizontally to view longer-than-usual names.

Also, noticed that the column sort preference wasn't being
restored.  Fixed that.

(Issue #12)
This commit is contained in:
Andy McFadden 2018-10-02 13:55:23 -07:00
parent 99a77c0341
commit 37bbc3bd41
3 changed files with 31 additions and 24 deletions

View File

@ -170,8 +170,8 @@ namespace SourceGen.AppForms
this.symbolPlatformCheckBox = new System.Windows.Forms.CheckBox();
this.symbolListView = new System.Windows.Forms.ListView();
this.symbolTypeColumnHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.symbolNameColumnHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.symbolValueColumnHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.symbolNameColumnHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.infoGroupBox = new System.Windows.Forms.GroupBox();
this.infoTextBox = new System.Windows.Forms.TextBox();
this.mainMenuStrip.SuspendLayout();
@ -1374,8 +1374,8 @@ namespace SourceGen.AppForms
| System.Windows.Forms.AnchorStyles.Right)));
this.symbolListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.symbolTypeColumnHeader,
this.symbolNameColumnHeader,
this.symbolValueColumnHeader});
this.symbolValueColumnHeader,
this.symbolNameColumnHeader});
this.symbolListView.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.symbolListView.FullRowSelect = true;
this.symbolListView.GridLines = true;
@ -1399,15 +1399,15 @@ namespace SourceGen.AppForms
this.symbolTypeColumnHeader.Text = "Type";
this.symbolTypeColumnHeader.Width = 44;
//
// symbolNameColumnHeader
//
this.symbolNameColumnHeader.Text = "Name";
this.symbolNameColumnHeader.Width = 84;
//
// symbolValueColumnHeader
//
this.symbolValueColumnHeader.Text = "Value";
this.symbolValueColumnHeader.Width = 68;
this.symbolValueColumnHeader.Width = 54;
//
// symbolNameColumnHeader
//
this.symbolNameColumnHeader.Text = "Name";
this.symbolNameColumnHeader.Width = 100;
//
// infoGroupBox
//
@ -1527,8 +1527,8 @@ namespace SourceGen.AppForms
private System.Windows.Forms.CheckBox symbolAutoCheckBox;
private System.Windows.Forms.GroupBox symbolsGroupBox;
private System.Windows.Forms.ListView symbolListView;
private System.Windows.Forms.ColumnHeader symbolNameColumnHeader;
private System.Windows.Forms.ColumnHeader symbolValueColumnHeader;
private System.Windows.Forms.ColumnHeader symbolNameColumnHeader;
private System.Windows.Forms.ColumnHeader symbolTypeColumnHeader;
private System.Windows.Forms.ColumnHeader offsetColumnHeader;
private System.Windows.Forms.ColumnHeader addressColumnHeader;

View File

@ -51,7 +51,7 @@ namespace SourceGen.AppForms {
/// Symbol subset, used to supply data to the symbol ListView. Initialized with
/// an empty symbol table.
/// </summary>
private SymbolTableSubset mSymbolSubset = new SymbolTableSubset(new SymbolTable());
private SymbolTableSubset mSymbolSubset;
/// <summary>
/// Current code list view selection. The length will match the DisplayList Count.
@ -233,20 +233,26 @@ namespace SourceGen.AppForms {
mActionsMenuItems[i] = actionsToolStripMenuItem.DropDownItems[i];
}
// Load the settings from the file. Some things (like the symbol subset) need
// these. The general "apply settings" doesn't happen until a bit later, after
// the sub-windows have been initialized.
LoadAppSettings();
// Init primary ListView (virtual, ownerdraw)
InitCodeListView();
// Init Symbols ListView (virtual, non-ownerdraw)
mSymbolSubset = new SymbolTableSubset(new SymbolTable());
symbolListView.SetDoubleBuffered(true);
InitSymbolListView();
LoadAppSettings();
SetAppWindowLocation();
ApplyAppSettings();
// Init References ListView (non-virtual, non-ownerdraw)
referencesListView.SetDoubleBuffered(true);
// Place the main window and apply the various settings.
SetAppWindowLocation();
ApplyAppSettings();
UpdateActionMenu();
UpdateMenuItemsAndTitle();
UpdateRecentLinks();
@ -3490,8 +3496,8 @@ namespace SourceGen.AppForms {
// Save a copy of the column header names as entered in the designer.
mSymbolColumnHeaderNames = new string[3];
mSymbolColumnHeaderNames[0] = symbolTypeColumnHeader.Text;
mSymbolColumnHeaderNames[1] = symbolNameColumnHeader.Text;
mSymbolColumnHeaderNames[2] = symbolValueColumnHeader.Text;
mSymbolColumnHeaderNames[1] = symbolValueColumnHeader.Text;
mSymbolColumnHeaderNames[2] = symbolNameColumnHeader.Text;
SetSymbolColumnHeaders();
}
@ -3540,9 +3546,9 @@ namespace SourceGen.AppForms {
ListViewItem lvi = new ListViewItem();
lvi.Text = sym.SourceTypeString;
mSymbolSubArray[0] = new ListViewItem.ListViewSubItem(lvi, sym.Label);
mSymbolSubArray[1] = new ListViewItem.ListViewSubItem(lvi,
mSymbolSubArray[0] = new ListViewItem.ListViewSubItem(lvi,
mOutputFormatter.FormatHexValue(sym.Value, 0));
mSymbolSubArray[1] = new ListViewItem.ListViewSubItem(lvi, sym.Label);
lvi.SubItems.AddRange(mSymbolSubArray);
return lvi;
}
@ -3607,11 +3613,11 @@ namespace SourceGen.AppForms {
symbolTypeColumnHeader.Text =
(sortCol == SymbolTableSubset.SortCol.Type ? sortStr : "") +
mSymbolColumnHeaderNames[0];
symbolNameColumnHeader.Text =
(sortCol == SymbolTableSubset.SortCol.Name ? sortStr : "") +
mSymbolColumnHeaderNames[1];
symbolValueColumnHeader.Text =
(sortCol == SymbolTableSubset.SortCol.Value ? sortStr : "") +
mSymbolColumnHeaderNames[1];
symbolNameColumnHeader.Text =
(sortCol == SymbolTableSubset.SortCol.Name ? sortStr : "") +
mSymbolColumnHeaderNames[2];
}

View File

@ -21,6 +21,9 @@ using System.Text;
namespace SourceGen {
public class SymbolTableSubset {
// Sort: which column? Note we store the int value in the app settings.
public enum SortCol { Type = 0, Value = 1, Name = 2 };
private SymbolTable mSymbolTable;
// Internal dirty flag.
@ -155,8 +158,6 @@ namespace SourceGen {
}
}
}
// Sort: which column? Note we store the int value in the app settings.
public enum SortCol { Type = 0, Name = 1, Value = 2 };
private SortCol mSortColumn = SortCol.Name;
public SortCol SortColumn {
get {