1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-06-14 05:29:32 +00:00

Merge menu items for "edit operand" and "edit data"

The instruction operand editor and data operand editor are very
different, but there's no need to impose that distinction on the
user.  They want to edit the operand either way.  We now provide a
single "edit operand" menu item, and open the appropriate dialog
based on what they have selected.

This uses Ctrl+O as the keyboard shortcut, stealing it from
File > Open.

(issue #11)
This commit is contained in:
Andy McFadden 2018-10-08 12:49:26 -07:00
parent 9be99a7cac
commit 3a001c5f8a
9 changed files with 66 additions and 59 deletions

View File

@ -506,7 +506,7 @@ namespace SourceGen.AppForms {
this.Name = "EditData";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Edit Data";
this.Text = "Edit Data Format";
this.Load += new System.EventHandler(this.EditData_Load);
this.Shown += new System.EventHandler(this.EditData_Shown);
this.symbolPartPanel.ResumeLayout(false);

View File

@ -340,7 +340,7 @@ namespace SourceGen.AppForms {
this.Name = "EditOperand";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Edit Operand";
this.Text = "Edit Instruction Operand";
this.Load += new System.EventHandler(this.EditOperand_Load);
this.Shown += new System.EventHandler(this.EditOperand_Shown);
this.mainRadioPanel.ResumeLayout(false);

View File

@ -72,6 +72,7 @@ namespace SourceGen.AppForms
this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator();
this.editHeaderCommentToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.projectPropertiesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toggleDataScanToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem7 = new System.Windows.Forms.ToolStripSeparator();
this.settingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.actionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -79,7 +80,6 @@ namespace SourceGen.AppForms
this.overrideStatusFlagsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.editLabelToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.editOperandToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.editDataFormatToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.editCommentToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.editLongCommentToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.editNoteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -175,7 +175,6 @@ namespace SourceGen.AppForms
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.toggleDataScanToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.mainMenuStrip.SuspendLayout();
this.mainStatusStrip.SuspendLayout();
this.mainToolStrip.SuspendLayout();
@ -247,7 +246,6 @@ namespace SourceGen.AppForms
// openToolStripMenuItem
//
this.openToolStripMenuItem.Name = "openToolStripMenuItem";
this.openToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O)));
this.openToolStripMenuItem.Size = new System.Drawing.Size(208, 22);
this.openToolStripMenuItem.Text = "Open";
this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click);
@ -356,7 +354,7 @@ namespace SourceGen.AppForms
this.undoToolStripMenuItem.Name = "undoToolStripMenuItem";
this.undoToolStripMenuItem.ShortcutKeyDisplayString = "";
this.undoToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Z)));
this.undoToolStripMenuItem.Size = new System.Drawing.Size(201, 22);
this.undoToolStripMenuItem.Size = new System.Drawing.Size(207, 22);
this.undoToolStripMenuItem.Text = "Undo";
this.undoToolStripMenuItem.Click += new System.EventHandler(this.undoToolStripMenuItem_Click);
//
@ -364,33 +362,33 @@ namespace SourceGen.AppForms
//
this.redoToolStripMenuItem.Name = "redoToolStripMenuItem";
this.redoToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Y)));
this.redoToolStripMenuItem.Size = new System.Drawing.Size(201, 22);
this.redoToolStripMenuItem.Size = new System.Drawing.Size(207, 22);
this.redoToolStripMenuItem.Text = "Redo";
this.redoToolStripMenuItem.Click += new System.EventHandler(this.redoToolStripMenuItem_Click);
//
// toolStripMenuItem1
//
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(198, 6);
this.toolStripMenuItem1.Size = new System.Drawing.Size(204, 6);
//
// copyToolStripMenuItem
//
this.copyToolStripMenuItem.Name = "copyToolStripMenuItem";
this.copyToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C)));
this.copyToolStripMenuItem.Size = new System.Drawing.Size(201, 22);
this.copyToolStripMenuItem.Size = new System.Drawing.Size(207, 22);
this.copyToolStripMenuItem.Text = "Copy";
this.copyToolStripMenuItem.Click += new System.EventHandler(this.copyToolStripMenuItem_Click);
//
// toolStripMenuItem2
//
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
this.toolStripMenuItem2.Size = new System.Drawing.Size(198, 6);
this.toolStripMenuItem2.Size = new System.Drawing.Size(204, 6);
//
// selectAllToolStripMenuItem
//
this.selectAllToolStripMenuItem.Name = "selectAllToolStripMenuItem";
this.selectAllToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.A)));
this.selectAllToolStripMenuItem.Size = new System.Drawing.Size(201, 22);
this.selectAllToolStripMenuItem.Size = new System.Drawing.Size(207, 22);
this.selectAllToolStripMenuItem.Text = "Select All";
this.selectAllToolStripMenuItem.Click += new System.EventHandler(this.selectAllToolStripMenuItem_Click);
//
@ -398,7 +396,7 @@ namespace SourceGen.AppForms
//
this.findToolStripMenuItem.Name = "findToolStripMenuItem";
this.findToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F)));
this.findToolStripMenuItem.Size = new System.Drawing.Size(201, 22);
this.findToolStripMenuItem.Size = new System.Drawing.Size(207, 22);
this.findToolStripMenuItem.Text = "Find...";
this.findToolStripMenuItem.Click += new System.EventHandler(this.findToolStripMenuItem_Click);
//
@ -406,7 +404,7 @@ namespace SourceGen.AppForms
//
this.findNextToolStripMenuItem.Name = "findNextToolStripMenuItem";
this.findNextToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F3;
this.findNextToolStripMenuItem.Size = new System.Drawing.Size(201, 22);
this.findNextToolStripMenuItem.Size = new System.Drawing.Size(207, 22);
this.findNextToolStripMenuItem.Text = "Find Next";
this.findNextToolStripMenuItem.Click += new System.EventHandler(this.findNextToolStripMenuItem_Click);
//
@ -414,38 +412,46 @@ namespace SourceGen.AppForms
//
this.gotoToolStripMenuItem.Name = "gotoToolStripMenuItem";
this.gotoToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.G)));
this.gotoToolStripMenuItem.Size = new System.Drawing.Size(201, 22);
this.gotoToolStripMenuItem.Size = new System.Drawing.Size(207, 22);
this.gotoToolStripMenuItem.Text = "Go To...";
this.gotoToolStripMenuItem.Click += new System.EventHandler(this.gotoToolStripMenuItem_Click);
//
// toolStripMenuItem3
//
this.toolStripMenuItem3.Name = "toolStripMenuItem3";
this.toolStripMenuItem3.Size = new System.Drawing.Size(198, 6);
this.toolStripMenuItem3.Size = new System.Drawing.Size(204, 6);
//
// editHeaderCommentToolStripMenuItem
//
this.editHeaderCommentToolStripMenuItem.Name = "editHeaderCommentToolStripMenuItem";
this.editHeaderCommentToolStripMenuItem.Size = new System.Drawing.Size(201, 22);
this.editHeaderCommentToolStripMenuItem.Size = new System.Drawing.Size(207, 22);
this.editHeaderCommentToolStripMenuItem.Text = "Edit Header Comment...";
this.editHeaderCommentToolStripMenuItem.Click += new System.EventHandler(this.editHeaderCommentToolStripMenuItem_Click);
//
// projectPropertiesToolStripMenuItem
//
this.projectPropertiesToolStripMenuItem.Name = "projectPropertiesToolStripMenuItem";
this.projectPropertiesToolStripMenuItem.Size = new System.Drawing.Size(201, 22);
this.projectPropertiesToolStripMenuItem.Size = new System.Drawing.Size(207, 22);
this.projectPropertiesToolStripMenuItem.Text = "Project Properties...";
this.projectPropertiesToolStripMenuItem.Click += new System.EventHandler(this.projectPropertiesToolStripMenuItem_Click);
//
// toggleDataScanToolStripMenuItem
//
this.toggleDataScanToolStripMenuItem.Name = "toggleDataScanToolStripMenuItem";
this.toggleDataScanToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.D)));
this.toggleDataScanToolStripMenuItem.Size = new System.Drawing.Size(207, 22);
this.toggleDataScanToolStripMenuItem.Text = "Toggle Data Scan";
this.toggleDataScanToolStripMenuItem.Click += new System.EventHandler(this.toggleDataScanToolStripMenuItem_Click);
//
// toolStripMenuItem7
//
this.toolStripMenuItem7.Name = "toolStripMenuItem7";
this.toolStripMenuItem7.Size = new System.Drawing.Size(198, 6);
this.toolStripMenuItem7.Size = new System.Drawing.Size(204, 6);
//
// settingsToolStripMenuItem
//
this.settingsToolStripMenuItem.Name = "settingsToolStripMenuItem";
this.settingsToolStripMenuItem.Size = new System.Drawing.Size(201, 22);
this.settingsToolStripMenuItem.Size = new System.Drawing.Size(207, 22);
this.settingsToolStripMenuItem.Text = "Settings...";
this.settingsToolStripMenuItem.Click += new System.EventHandler(this.settingsToolStripMenuItem_Click);
//
@ -456,7 +462,6 @@ namespace SourceGen.AppForms
this.overrideStatusFlagsToolStripMenuItem,
this.editLabelToolStripMenuItem,
this.editOperandToolStripMenuItem,
this.editDataFormatToolStripMenuItem,
this.editCommentToolStripMenuItem,
this.editLongCommentToolStripMenuItem,
this.editNoteToolStripMenuItem,
@ -502,20 +507,16 @@ namespace SourceGen.AppForms
// editOperandToolStripMenuItem
//
this.editOperandToolStripMenuItem.Name = "editOperandToolStripMenuItem";
this.editOperandToolStripMenuItem.ShortcutKeyDisplayString = "";
this.editOperandToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O)));
this.editOperandToolStripMenuItem.Size = new System.Drawing.Size(289, 22);
this.editOperandToolStripMenuItem.Text = "Edit Operand...";
this.editOperandToolStripMenuItem.Click += new System.EventHandler(this.EditOperand_Click);
//
// editDataFormatToolStripMenuItem
//
this.editDataFormatToolStripMenuItem.Name = "editDataFormatToolStripMenuItem";
this.editDataFormatToolStripMenuItem.Size = new System.Drawing.Size(289, 22);
this.editDataFormatToolStripMenuItem.Text = "Edit Data Format...";
this.editDataFormatToolStripMenuItem.Click += new System.EventHandler(this.EditData_Click);
this.editOperandToolStripMenuItem.Click += new System.EventHandler(this.EditInstrDataOperand_Click);
//
// editCommentToolStripMenuItem
//
this.editCommentToolStripMenuItem.Name = "editCommentToolStripMenuItem";
this.editCommentToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl+;";
this.editCommentToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Oem1)));
this.editCommentToolStripMenuItem.Size = new System.Drawing.Size(289, 22);
this.editCommentToolStripMenuItem.Text = "Edit Comment...";
@ -1449,14 +1450,6 @@ namespace SourceGen.AppForms
this.infoTextBox.Size = new System.Drawing.Size(177, 120);
this.infoTextBox.TabIndex = 0;
//
// toggleDataScanToolStripMenuItem
//
this.toggleDataScanToolStripMenuItem.Name = "toggleDataScanToolStripMenuItem";
this.toggleDataScanToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.D)));
this.toggleDataScanToolStripMenuItem.Size = new System.Drawing.Size(207, 22);
this.toggleDataScanToolStripMenuItem.Text = "Toggle Data Scan";
this.toggleDataScanToolStripMenuItem.Click += new System.EventHandler(this.toggleDataScanToolStripMenuItem_Click);
//
// ProjectView
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -1573,7 +1566,6 @@ namespace SourceGen.AppForms
private System.Windows.Forms.ToolStripMenuItem overrideStatusFlagsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem editLabelToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem editOperandToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem editDataFormatToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem editCommentToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem editLongCommentToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem editNoteToolStripMenuItem;

View File

@ -1137,7 +1137,7 @@ namespace SourceGen.AppForms {
// regardless of which has focus, making it useful for keyboard shortcuts.
// Return true to indicate that we've handled the key.
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) {
// Handle the Ctrl+H chord.
// Handle the Ctrl+H sequence.
if (mCtrlHSeen) {
if (keyData == (Keys.Control | Keys.C)) {
if (hintAsCodeToolStripMenuItem.Enabled) {
@ -1167,7 +1167,7 @@ namespace SourceGen.AppForms {
return true;
}
// Ctrl-Shift-Z is an alias for Redo (Ctrl-Y).
// Ctrl+Shift+Z is an alias for Redo (Ctrl+Y).
if (keyData == (Keys.Control | Keys.Shift | Keys.Z)) {
if (redoToolStripMenuItem.Enabled) {
redoToolStripMenuItem_Click(null, null);
@ -2054,9 +2054,7 @@ namespace SourceGen.AppForms {
break;
case ColumnIndex.Operand:
if (editOperandToolStripMenuItem.Enabled) {
EditOperand_Click(sender, e);
} else if (editDataFormatToolStripMenuItem.Enabled) {
EditData_Click(sender, e);
EditInstrDataOperand_Click(sender, e);
}
break;
case ColumnIndex.Comment:
@ -2203,6 +2201,9 @@ namespace SourceGen.AppForms {
ListView.SelectedIndexCollection sel = codeListView.SelectedIndices;
EntityCounts entityCounts;
bool editDataOperandEnabled = false;
bool editInstrOperandEnabled = false;
// Use IsSingleItemSelected(), rather than just checking sel.Count, because we
// want the user to be able to e.g. EditData on a multi-line string even if all
// lines in the string are selected.
@ -2217,11 +2218,9 @@ namespace SourceGen.AppForms {
setAddressToolStripMenuItem.Enabled =
(isCodeOrData || lineType == DisplayList.Line.Type.OrgDirective);
editOperandToolStripMenuItem.Enabled =
(lineType == DisplayList.Line.Type.Code &&
mProject.GetAnattrib(line.FileOffset).IsInstructionWithOperand);
editDataFormatToolStripMenuItem.Enabled =
(lineType == DisplayList.Line.Type.Data);
editInstrOperandEnabled = (lineType == DisplayList.Line.Type.Code &&
mProject.GetAnattrib(line.FileOffset).IsInstructionWithOperand);
editDataOperandEnabled = (lineType == DisplayList.Line.Type.Data);
editLabelToolStripMenuItem.Enabled = isCodeOrData;
editCommentToolStripMenuItem.Enabled = isCodeOrData;
editLongCommentToolStripMenuItem.Enabled =
@ -2249,7 +2248,7 @@ namespace SourceGen.AppForms {
// Disable all single-target-only items.
setAddressToolStripMenuItem.Enabled = false;
editOperandToolStripMenuItem.Enabled = false;
editInstrOperandEnabled = false;
editLabelToolStripMenuItem.Enabled = false;
editCommentToolStripMenuItem.Enabled = false;
editLongCommentToolStripMenuItem.Enabled = false;
@ -2260,7 +2259,7 @@ namespace SourceGen.AppForms {
if (sel.Count == 0) {
// Disable everything else.
editDataFormatToolStripMenuItem.Enabled = false;
editDataOperandEnabled = false;
hintAsCodeToolStripMenuItem.Enabled = false;
hintAsDataToolStripMenuItem.Enabled = false;
hintAsInlineDataToolStripMenuItem.Enabled = false;
@ -2268,11 +2267,16 @@ namespace SourceGen.AppForms {
} else {
// Must be all data items. Blank lines are okay. Currently allowing
// control lines as well.
editDataFormatToolStripMenuItem.Enabled =
editDataOperandEnabled =
(entityCounts.mDataLines > 0 && entityCounts.mCodeLines == 0);
}
}
// Enable the "edit operand" menu item if either instruction or data operand
// editing is allowed.
editOperandToolStripMenuItem.Enabled =
editDataOperandEnabled || editInstrOperandEnabled;
formatSplitAddressTableToolStripMenuItem.Enabled =
(entityCounts.mDataLines > 0 && entityCounts.mCodeLines == 0);
toggleSingleBytesToolStripMenuItem.Enabled =
@ -2549,6 +2553,16 @@ namespace SourceGen.AppForms {
dlg.Dispose();
}
// Convert generic "edit operand" request to instruction or data edit call.
private void EditInstrDataOperand_Click(object sender, EventArgs e) {
ListView.SelectedIndexCollection sel = codeListView.SelectedIndices;
if (mDisplayList[sel[0]].LineType == DisplayList.Line.Type.Code) {
EditOperand_Click(sender, e);
} else {
EditData_Click(sender, e);
}
}
private void EditOperand_Click(Object sender, EventArgs e) {
Debug.Assert(IsSingleItemSelected());
ListView.SelectedIndexCollection sel = codeListView.SelectedIndices;

View File

@ -48,7 +48,7 @@ always output as-is. Exported labels are added to a table that may
be imported by other projects.</p>
<h2><a name="operand">Edit Operand</a></h2>
<h2><a name="operand">Edit Instruction Operand</a></h2>
<p>Operands can be displayed in a variety of numeric formats, or as a
symbol. The ASCII character format is only available for operands
whose value falls into the range of low- or high-ASCII characters.</p>

View File

@ -66,7 +66,7 @@ and 65816 code. The official web site is
<li><a href="editors.html#address">Edit Address</a></li>
<li><a href="editors.html#flags">Edit Status Flags</a></li>
<li><a href="editors.html#label">Edit Label</a></li>
<li><a href="editors.html#operand">Edit Operand</a></li>
<li><a href="editors.html#operand">Edit Instruction Operand</a></li>
<li><a href="editors.html#data">Edit Data Format</a></li>
<li><a href="editors.html#comment">Edit Comment</a></li>
<li><a href="editors.html#long-comment">Edit Long Comment</a></li>

View File

@ -159,12 +159,11 @@ enabled will depend on what you have selected in the main window.</p>
<li><a href="editors.html#label">Edit Label</a>. Sets the label
at that offset. Enabled when a single instruction or data line is
selected.</li>
<li><a href="editors.html#operand">Edit Operand</a>. Sets the
operand format for that instruction. Enabled when a single instruction
line is selected.</li>
<li><a href="editors.html#data">Edit Data Format</a>. Sets the
format for data operands. Enabled when one or more data
lines are selected.</li>
<li><a href="editors.html#operand">Edit Operand</a>. Opens the
Edit Instruction Operand or Edit Data Format window, depending on
what's selected.
Enabled when a single instruction line is selected, or when one
or more data lines are selected.</li>
<li><a href="editors.html#comment">Edit Comment</a>. Sets the
comment at that offset. Enabled when a single instruction or data
line is selected.</li>

View File

@ -33,6 +33,8 @@ The currently-supported parameters are:
default is "emulation".
* undocumented-opcodes={true|false} - Enable or disable undocumented
opcodes. They are disabled by default.
* first-word-is-load-addr={true|false} - If true, the first two bytes of
the file contain the load address.
All of these things can be changed after the project has begun, but it's
nice to have them configured in advance.

View File

@ -140,7 +140,7 @@
"Name" : "Atari Lynx",
"GroupName" : "Atari",
"Cpu" : "65SC02",
"Speed" : "4.00",
"Speed" : "4",
"Description" : "Atari Lynx [placeholder].",
"SymbolFiles" : [
],