Debugger: Reworked "Code" menu and enabled it on Linux, fixed issues where some shortcuts didn't work (e.g Mark As...)
This commit is contained in:
parent
c54fad0325
commit
0b7660a3fa
5 changed files with 171 additions and 119 deletions
|
@ -257,18 +257,20 @@ namespace Mesen.GUI.Config
|
|||
}
|
||||
}
|
||||
|
||||
private static void ClearProcessCmdKeyHandler(ToolStripMenuItem item, Control parent)
|
||||
public static void ClearProcessCmdKeyHandler(ToolStripMenuItem item, Control parent)
|
||||
{
|
||||
Form parentForm = parent.FindForm();
|
||||
if(parentForm is BaseForm) {
|
||||
(parentForm as BaseForm).OnProcessCmdKey -= (ProcessCmdKeyHandler)item.Tag;
|
||||
(parentForm as BaseForm).OnProcessCmdKey -= ((ShortcutInfo)item.Tag).KeyHandler;
|
||||
}
|
||||
item.Tag = null;
|
||||
((ShortcutInfo)item.Tag).KeyHandler = null;
|
||||
}
|
||||
|
||||
public static void UpdateShortcutItem(ToolStripMenuItem item, Control parent, string fieldName)
|
||||
{
|
||||
if(item.Tag is ProcessCmdKeyHandler) {
|
||||
if(item.Tag == null) {
|
||||
item.Tag = new ShortcutInfo() { KeyHandler = null, ShortcutKey = fieldName };
|
||||
} else if(((ShortcutInfo)item.Tag).KeyHandler != null) {
|
||||
ClearProcessCmdKeyHandler(item, parent);
|
||||
}
|
||||
|
||||
|
@ -288,7 +290,7 @@ namespace Mesen.GUI.Config
|
|||
return false;
|
||||
};
|
||||
|
||||
item.Tag = onProcessCmdKeyHandler;
|
||||
((ShortcutInfo)item.Tag).KeyHandler = onProcessCmdKeyHandler;
|
||||
(parentForm as BaseForm).OnProcessCmdKey += onProcessCmdKeyHandler;
|
||||
}
|
||||
} else {
|
||||
|
@ -307,6 +309,12 @@ namespace Mesen.GUI.Config
|
|||
}
|
||||
}
|
||||
|
||||
public class ShortcutInfo
|
||||
{
|
||||
public string ShortcutKey;
|
||||
public ProcessCmdKeyHandler KeyHandler;
|
||||
}
|
||||
|
||||
public class XmlKeys
|
||||
{
|
||||
private Keys _keys = Keys.None;
|
||||
|
|
|
@ -140,7 +140,7 @@ namespace Mesen.GUI.Debugger.Controls
|
|||
|
||||
private void contextMenuCode_Opening(object sender, CancelEventArgs e)
|
||||
{
|
||||
UpdateContextMenuItemVisibility(true);
|
||||
UpdateContextMenuItemVisibility(contextMenu.Items, true);
|
||||
|
||||
int startAddress, endAddress;
|
||||
string range;
|
||||
|
@ -413,48 +413,38 @@ namespace Mesen.GUI.Debugger.Controls
|
|||
mnuEditSubroutine.Enabled = true;
|
||||
}
|
||||
|
||||
public void UpdateContextMenuItemVisibility(bool? visible = null)
|
||||
public void UpdateContextMenuItemVisibility(ToolStripItemCollection items, bool? visible = null)
|
||||
{
|
||||
mnuUndoPrgChrEdit.Enabled = InteropEmu.DebugHasUndoHistory();
|
||||
mnuShowNextStatement.Enabled = Viewer.ActiveAddress.HasValue;
|
||||
mnuSetNextStatement.Enabled = Viewer.ActiveAddress.HasValue;
|
||||
mnuEditSelectedCode.Enabled = mnuEditSubroutine.Enabled = InteropEmu.DebugIsExecutionStopped() && Viewer.CodeViewer.CurrentLine >= 0;
|
||||
|
||||
if(visible.HasValue) {
|
||||
mnuAddToWatch.Visible = visible.Value;
|
||||
mnuEditLabel.Visible = visible.Value;
|
||||
mnuGoToLocation.Visible = visible.Value;
|
||||
mnuToggleBreakpoint.Visible = visible.Value;
|
||||
sepAddToWatch.Visible = visible.Value;
|
||||
sepEditLabel.Visible = visible.Value;
|
||||
mnuFindOccurrences.Visible = visible.Value;
|
||||
}
|
||||
items[nameof(mnuUndoPrgChrEdit)].Enabled = InteropEmu.DebugHasUndoHistory();
|
||||
items[nameof(mnuShowNextStatement)].Enabled = Viewer.ActiveAddress.HasValue;
|
||||
items[nameof(mnuSetNextStatement)].Enabled = Viewer.ActiveAddress.HasValue;
|
||||
items[nameof(mnuEditSelectedCode)].Enabled = items[nameof(mnuEditSubroutine)].Enabled = InteropEmu.DebugIsExecutionStopped() && Viewer.CodeViewer.CurrentLine >= 0;
|
||||
|
||||
if(SourceView) {
|
||||
mnuMarkSelectionAs.Visible = false;
|
||||
mnuShowCodeNotes.Visible = false;
|
||||
items[nameof(mnuMarkSelectionAs)].Visible = false;
|
||||
items[nameof(mnuShowCodeNotes)].Visible = false;
|
||||
|
||||
mnuFindOccurrences.Visible = false;
|
||||
mnuEditSubroutine.Visible = false;
|
||||
mnuEditSelectedCode.Visible = false;
|
||||
mnuNavigateForward.Visible = false;
|
||||
mnuNavigateBackward.Visible = false;
|
||||
mnuEditLabel.Visible = false;
|
||||
sepNavigation.Visible = false;
|
||||
mnuShowSourceAsComments.Visible = false;
|
||||
items[nameof(mnuFindOccurrences)].Visible = false;
|
||||
items[nameof(mnuEditSubroutine)].Visible = false;
|
||||
items[nameof(mnuEditSelectedCode)].Visible = false;
|
||||
items[nameof(mnuNavigateForward)].Visible = false;
|
||||
items[nameof(mnuNavigateBackward)].Visible = false;
|
||||
items[nameof(mnuEditLabel)].Visible = false;
|
||||
items[nameof(sepNavigation)].Visible = false;
|
||||
items[nameof(mnuShowSourceAsComments)].Visible = false;
|
||||
}
|
||||
|
||||
bool hasSymbolProvider = Viewer.SymbolProvider != null;
|
||||
mnuShowSourceAsComments.Visible = hasSymbolProvider;
|
||||
mnuSwitchView.Visible = hasSymbolProvider;
|
||||
sepSwitchView.Visible = hasSymbolProvider;
|
||||
items[nameof(mnuShowSourceAsComments)].Visible = hasSymbolProvider;
|
||||
items[nameof(mnuSwitchView)].Visible = hasSymbolProvider;
|
||||
items[nameof(sepSwitchView)].Visible = hasSymbolProvider;
|
||||
}
|
||||
|
||||
private bool UpdateContextMenu(Point mouseLocation)
|
||||
{
|
||||
_lastLocation = mouseLocation;
|
||||
|
||||
UpdateContextMenuItemVisibility(true);
|
||||
UpdateContextMenuItemVisibility(contextMenu.Items, true);
|
||||
|
||||
mnuSwitchView.Text = SourceView ? "Switch to Disassembly View" : "Switch to Source View";
|
||||
|
||||
|
|
|
@ -246,7 +246,7 @@ namespace Mesen.GUI.Debugger
|
|||
|
||||
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
|
||||
{
|
||||
_codeViewerActions.UpdateContextMenuItemVisibility();
|
||||
_codeViewerActions.UpdateContextMenuItemVisibility(_codeViewerActions.contextMenu.Items);
|
||||
return base.ProcessCmdKey(ref msg, keyData);
|
||||
}
|
||||
|
||||
|
|
81
GUI.NET/Debugger/frmDebugger.Designer.cs
generated
81
GUI.NET/Debugger/frmDebugger.Designer.cs
generated
|
@ -167,6 +167,8 @@ namespace Mesen.GUI.Debugger
|
|||
this.mnuSplitView = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mnuUseVerticalLayout = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem11 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.mnuAutoCreateJumpLabels = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem25 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.mnuHidePauseIcon = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mnuPpuPartialDraw = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mnuPpuShowPreviousFrame = new System.Windows.Forms.ToolStripMenuItem();
|
||||
|
@ -208,8 +210,6 @@ namespace Mesen.GUI.Debugger
|
|||
this.ctrlPpuMemoryMapping = new Mesen.GUI.Debugger.Controls.ctrlMemoryMapping();
|
||||
this.ctrlCpuMemoryMapping = new Mesen.GUI.Debugger.Controls.ctrlMemoryMapping();
|
||||
this.tsToolbar = new Mesen.GUI.Controls.ctrlMesenToolStrip();
|
||||
this.mnuAutoCreateJumpLabels = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem25 = new System.Windows.Forms.ToolStripSeparator();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
|
||||
this.splitContainer.Panel1.SuspendLayout();
|
||||
this.splitContainer.Panel2.SuspendLayout();
|
||||
|
@ -254,7 +254,7 @@ namespace Mesen.GUI.Debugger
|
|||
this.splitContainer.Panel2.Controls.Add(this.tableLayoutPanel10);
|
||||
this.splitContainer.Panel2MinSize = 100;
|
||||
this.splitContainer.Size = new System.Drawing.Size(1075, 570);
|
||||
this.splitContainer.SplitterDistance = 411;
|
||||
this.splitContainer.SplitterDistance = 425;
|
||||
this.splitContainer.SplitterWidth = 7;
|
||||
this.splitContainer.TabIndex = 1;
|
||||
this.splitContainer.TabStop = false;
|
||||
|
@ -278,7 +278,7 @@ namespace Mesen.GUI.Debugger
|
|||
//
|
||||
this.ctrlSplitContainerTop.Panel2.Controls.Add(this.tlpFunctionLabelLists);
|
||||
this.ctrlSplitContainerTop.Panel2MinSize = 150;
|
||||
this.ctrlSplitContainerTop.Size = new System.Drawing.Size(1075, 411);
|
||||
this.ctrlSplitContainerTop.Size = new System.Drawing.Size(1075, 425);
|
||||
this.ctrlSplitContainerTop.SplitterDistance = 750;
|
||||
this.ctrlSplitContainerTop.SplitterWidth = 7;
|
||||
this.ctrlSplitContainerTop.TabIndex = 3;
|
||||
|
@ -299,8 +299,8 @@ namespace Mesen.GUI.Debugger
|
|||
this.tlpTop.Name = "tlpTop";
|
||||
this.tlpTop.RowCount = 1;
|
||||
this.tlpTop.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.tlpTop.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 411F));
|
||||
this.tlpTop.Size = new System.Drawing.Size(750, 411);
|
||||
this.tlpTop.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 408F));
|
||||
this.tlpTop.Size = new System.Drawing.Size(750, 425);
|
||||
this.tlpTop.TabIndex = 2;
|
||||
//
|
||||
// panel1
|
||||
|
@ -311,7 +311,7 @@ namespace Mesen.GUI.Debugger
|
|||
this.panel1.Location = new System.Drawing.Point(3, 0);
|
||||
this.panel1.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(286, 411);
|
||||
this.panel1.Size = new System.Drawing.Size(286, 425);
|
||||
this.panel1.TabIndex = 5;
|
||||
//
|
||||
// ctrlSourceViewer
|
||||
|
@ -320,7 +320,7 @@ namespace Mesen.GUI.Debugger
|
|||
this.ctrlSourceViewer.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ctrlSourceViewer.Location = new System.Drawing.Point(0, 0);
|
||||
this.ctrlSourceViewer.Name = "ctrlSourceViewer";
|
||||
this.ctrlSourceViewer.Size = new System.Drawing.Size(286, 411);
|
||||
this.ctrlSourceViewer.Size = new System.Drawing.Size(286, 425);
|
||||
this.ctrlSourceViewer.SymbolProvider = null;
|
||||
this.ctrlSourceViewer.TabIndex = 7;
|
||||
this.ctrlSourceViewer.Visible = false;
|
||||
|
@ -333,7 +333,7 @@ namespace Mesen.GUI.Debugger
|
|||
this.ctrlDebuggerCode.Location = new System.Drawing.Point(0, 0);
|
||||
this.ctrlDebuggerCode.Name = "ctrlDebuggerCode";
|
||||
this.ctrlDebuggerCode.ShowMemoryValues = false;
|
||||
this.ctrlDebuggerCode.Size = new System.Drawing.Size(286, 411);
|
||||
this.ctrlDebuggerCode.Size = new System.Drawing.Size(286, 425);
|
||||
this.ctrlDebuggerCode.SymbolProvider = null;
|
||||
this.ctrlDebuggerCode.TabIndex = 2;
|
||||
this.ctrlDebuggerCode.OnEditCode += new Mesen.GUI.Debugger.ctrlDebuggerCode.AssemblerEventHandler(this.ctrlDebuggerCode_OnEditCode);
|
||||
|
@ -347,7 +347,7 @@ namespace Mesen.GUI.Debugger
|
|||
this.panel2.Location = new System.Drawing.Point(292, 0);
|
||||
this.panel2.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
|
||||
this.panel2.Name = "panel2";
|
||||
this.panel2.Size = new System.Drawing.Size(1, 411);
|
||||
this.panel2.Size = new System.Drawing.Size(1, 425);
|
||||
this.panel2.TabIndex = 6;
|
||||
//
|
||||
// ctrlSourceViewerSplit
|
||||
|
@ -356,7 +356,7 @@ namespace Mesen.GUI.Debugger
|
|||
this.ctrlSourceViewerSplit.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ctrlSourceViewerSplit.Location = new System.Drawing.Point(0, 0);
|
||||
this.ctrlSourceViewerSplit.Name = "ctrlSourceViewerSplit";
|
||||
this.ctrlSourceViewerSplit.Size = new System.Drawing.Size(1, 411);
|
||||
this.ctrlSourceViewerSplit.Size = new System.Drawing.Size(1, 425);
|
||||
this.ctrlSourceViewerSplit.SymbolProvider = null;
|
||||
this.ctrlSourceViewerSplit.TabIndex = 8;
|
||||
this.ctrlSourceViewerSplit.Visible = false;
|
||||
|
@ -369,7 +369,7 @@ namespace Mesen.GUI.Debugger
|
|||
this.ctrlDebuggerCodeSplit.Location = new System.Drawing.Point(0, 0);
|
||||
this.ctrlDebuggerCodeSplit.Name = "ctrlDebuggerCodeSplit";
|
||||
this.ctrlDebuggerCodeSplit.ShowMemoryValues = false;
|
||||
this.ctrlDebuggerCodeSplit.Size = new System.Drawing.Size(1, 411);
|
||||
this.ctrlDebuggerCodeSplit.Size = new System.Drawing.Size(1, 425);
|
||||
this.ctrlDebuggerCodeSplit.SymbolProvider = null;
|
||||
this.ctrlDebuggerCodeSplit.TabIndex = 4;
|
||||
this.ctrlDebuggerCodeSplit.Visible = false;
|
||||
|
@ -389,7 +389,7 @@ namespace Mesen.GUI.Debugger
|
|||
this.tableLayoutPanel1.RowCount = 2;
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(458, 411);
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(458, 425);
|
||||
this.tableLayoutPanel1.TabIndex = 7;
|
||||
//
|
||||
// ctrlConsoleStatus
|
||||
|
@ -413,7 +413,7 @@ namespace Mesen.GUI.Debugger
|
|||
this.tlpVerticalLayout.Name = "tlpVerticalLayout";
|
||||
this.tlpVerticalLayout.RowCount = 1;
|
||||
this.tlpVerticalLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tlpVerticalLayout.Size = new System.Drawing.Size(458, 11);
|
||||
this.tlpVerticalLayout.Size = new System.Drawing.Size(458, 25);
|
||||
this.tlpVerticalLayout.TabIndex = 4;
|
||||
//
|
||||
// tlpFunctionLabelLists
|
||||
|
@ -429,16 +429,16 @@ namespace Mesen.GUI.Debugger
|
|||
this.tlpFunctionLabelLists.RowCount = 2;
|
||||
this.tlpFunctionLabelLists.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tlpFunctionLabelLists.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tlpFunctionLabelLists.Size = new System.Drawing.Size(318, 411);
|
||||
this.tlpFunctionLabelLists.Size = new System.Drawing.Size(318, 425);
|
||||
this.tlpFunctionLabelLists.TabIndex = 5;
|
||||
//
|
||||
// grpLabels
|
||||
//
|
||||
this.grpLabels.Controls.Add(this.ctrlLabelList);
|
||||
this.grpLabels.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.grpLabels.Location = new System.Drawing.Point(3, 208);
|
||||
this.grpLabels.Location = new System.Drawing.Point(3, 215);
|
||||
this.grpLabels.Name = "grpLabels";
|
||||
this.grpLabels.Size = new System.Drawing.Size(312, 200);
|
||||
this.grpLabels.Size = new System.Drawing.Size(312, 207);
|
||||
this.grpLabels.TabIndex = 6;
|
||||
this.grpLabels.TabStop = false;
|
||||
this.grpLabels.Text = "Labels";
|
||||
|
@ -448,7 +448,7 @@ namespace Mesen.GUI.Debugger
|
|||
this.ctrlLabelList.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ctrlLabelList.Location = new System.Drawing.Point(3, 16);
|
||||
this.ctrlLabelList.Name = "ctrlLabelList";
|
||||
this.ctrlLabelList.Size = new System.Drawing.Size(306, 181);
|
||||
this.ctrlLabelList.Size = new System.Drawing.Size(306, 188);
|
||||
this.ctrlLabelList.TabIndex = 0;
|
||||
this.ctrlLabelList.OnFindOccurrence += new System.EventHandler(this.ctrlLabelList_OnFindOccurrence);
|
||||
this.ctrlLabelList.OnLabelSelected += new System.EventHandler(this.ctrlLabelList_OnLabelSelected);
|
||||
|
@ -459,7 +459,7 @@ namespace Mesen.GUI.Debugger
|
|||
this.grpFunctions.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.grpFunctions.Location = new System.Drawing.Point(3, 3);
|
||||
this.grpFunctions.Name = "grpFunctions";
|
||||
this.grpFunctions.Size = new System.Drawing.Size(312, 199);
|
||||
this.grpFunctions.Size = new System.Drawing.Size(312, 206);
|
||||
this.grpFunctions.TabIndex = 5;
|
||||
this.grpFunctions.TabStop = false;
|
||||
this.grpFunctions.Text = "Functions";
|
||||
|
@ -469,7 +469,7 @@ namespace Mesen.GUI.Debugger
|
|||
this.ctrlFunctionList.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ctrlFunctionList.Location = new System.Drawing.Point(3, 16);
|
||||
this.ctrlFunctionList.Name = "ctrlFunctionList";
|
||||
this.ctrlFunctionList.Size = new System.Drawing.Size(306, 180);
|
||||
this.ctrlFunctionList.Size = new System.Drawing.Size(306, 187);
|
||||
this.ctrlFunctionList.TabIndex = 0;
|
||||
this.ctrlFunctionList.OnFindOccurrence += new System.EventHandler(this.ctrlFunctionList_OnFindOccurrence);
|
||||
this.ctrlFunctionList.OnFunctionSelected += new System.EventHandler(this.ctrlFunctionList_OnFunctionSelected);
|
||||
|
@ -500,7 +500,7 @@ namespace Mesen.GUI.Debugger
|
|||
this.tableLayoutPanel10.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.tableLayoutPanel10.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel10.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel10.Size = new System.Drawing.Size(1075, 152);
|
||||
this.tableLayoutPanel10.Size = new System.Drawing.Size(1075, 138);
|
||||
this.tableLayoutPanel10.TabIndex = 0;
|
||||
//
|
||||
// grpWatch
|
||||
|
@ -509,7 +509,7 @@ namespace Mesen.GUI.Debugger
|
|||
this.grpWatch.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.grpWatch.Location = new System.Drawing.Point(3, 3);
|
||||
this.grpWatch.Name = "grpWatch";
|
||||
this.grpWatch.Size = new System.Drawing.Size(352, 146);
|
||||
this.grpWatch.Size = new System.Drawing.Size(352, 132);
|
||||
this.grpWatch.TabIndex = 2;
|
||||
this.grpWatch.TabStop = false;
|
||||
this.grpWatch.Text = "Watch";
|
||||
|
@ -519,7 +519,7 @@ namespace Mesen.GUI.Debugger
|
|||
this.ctrlWatch.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ctrlWatch.Location = new System.Drawing.Point(3, 16);
|
||||
this.ctrlWatch.Name = "ctrlWatch";
|
||||
this.ctrlWatch.Size = new System.Drawing.Size(346, 127);
|
||||
this.ctrlWatch.Size = new System.Drawing.Size(346, 113);
|
||||
this.ctrlWatch.TabIndex = 0;
|
||||
//
|
||||
// grpBreakpoints
|
||||
|
@ -528,7 +528,7 @@ namespace Mesen.GUI.Debugger
|
|||
this.grpBreakpoints.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.grpBreakpoints.Location = new System.Drawing.Point(361, 3);
|
||||
this.grpBreakpoints.Name = "grpBreakpoints";
|
||||
this.grpBreakpoints.Size = new System.Drawing.Size(352, 146);
|
||||
this.grpBreakpoints.Size = new System.Drawing.Size(352, 132);
|
||||
this.grpBreakpoints.TabIndex = 3;
|
||||
this.grpBreakpoints.TabStop = false;
|
||||
this.grpBreakpoints.Text = "Breakpoints";
|
||||
|
@ -538,7 +538,7 @@ namespace Mesen.GUI.Debugger
|
|||
this.ctrlBreakpoints.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ctrlBreakpoints.Location = new System.Drawing.Point(3, 16);
|
||||
this.ctrlBreakpoints.Name = "ctrlBreakpoints";
|
||||
this.ctrlBreakpoints.Size = new System.Drawing.Size(346, 127);
|
||||
this.ctrlBreakpoints.Size = new System.Drawing.Size(346, 113);
|
||||
this.ctrlBreakpoints.TabIndex = 0;
|
||||
this.ctrlBreakpoints.BreakpointNavigation += new System.EventHandler(this.ctrlBreakpoints_BreakpointNavigation);
|
||||
//
|
||||
|
@ -548,7 +548,7 @@ namespace Mesen.GUI.Debugger
|
|||
this.grpCallstack.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.grpCallstack.Location = new System.Drawing.Point(719, 3);
|
||||
this.grpCallstack.Name = "grpCallstack";
|
||||
this.grpCallstack.Size = new System.Drawing.Size(353, 146);
|
||||
this.grpCallstack.Size = new System.Drawing.Size(353, 132);
|
||||
this.grpCallstack.TabIndex = 4;
|
||||
this.grpCallstack.TabStop = false;
|
||||
this.grpCallstack.Text = "Call Stack";
|
||||
|
@ -558,7 +558,7 @@ namespace Mesen.GUI.Debugger
|
|||
this.ctrlCallstack.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ctrlCallstack.Location = new System.Drawing.Point(3, 16);
|
||||
this.ctrlCallstack.Name = "ctrlCallstack";
|
||||
this.ctrlCallstack.Size = new System.Drawing.Size(347, 127);
|
||||
this.ctrlCallstack.Size = new System.Drawing.Size(347, 113);
|
||||
this.ctrlCallstack.TabIndex = 0;
|
||||
this.ctrlCallstack.FunctionSelected += new System.EventHandler(this.ctrlCallstack_FunctionSelected);
|
||||
//
|
||||
|
@ -736,7 +736,6 @@ namespace Mesen.GUI.Debugger
|
|||
this.mnuCode.Name = "mnuCode";
|
||||
this.mnuCode.Size = new System.Drawing.Size(47, 20);
|
||||
this.mnuCode.Text = "Code";
|
||||
this.mnuCode.DropDownClosed += new System.EventHandler(this.mnuCode_DropDownClosed);
|
||||
this.mnuCode.DropDownOpening += new System.EventHandler(this.mnuCode_DropDownOpening);
|
||||
//
|
||||
// debugToolStripMenuItem
|
||||
|
@ -1517,6 +1516,19 @@ namespace Mesen.GUI.Debugger
|
|||
this.toolStripMenuItem11.Name = "toolStripMenuItem11";
|
||||
this.toolStripMenuItem11.Size = new System.Drawing.Size(263, 6);
|
||||
//
|
||||
// mnuAutoCreateJumpLabels
|
||||
//
|
||||
this.mnuAutoCreateJumpLabels.CheckOnClick = true;
|
||||
this.mnuAutoCreateJumpLabels.Name = "mnuAutoCreateJumpLabels";
|
||||
this.mnuAutoCreateJumpLabels.Size = new System.Drawing.Size(266, 22);
|
||||
this.mnuAutoCreateJumpLabels.Text = "Auto-create jump labels";
|
||||
this.mnuAutoCreateJumpLabels.Click += new System.EventHandler(this.mnuAutoCreateJumpLabels_Click);
|
||||
//
|
||||
// toolStripMenuItem25
|
||||
//
|
||||
this.toolStripMenuItem25.Name = "toolStripMenuItem25";
|
||||
this.toolStripMenuItem25.Size = new System.Drawing.Size(263, 6);
|
||||
//
|
||||
// mnuHidePauseIcon
|
||||
//
|
||||
this.mnuHidePauseIcon.CheckOnClick = true;
|
||||
|
@ -1848,19 +1860,6 @@ namespace Mesen.GUI.Debugger
|
|||
this.tsToolbar.Text = "toolStrip1";
|
||||
this.tsToolbar.Visible = false;
|
||||
//
|
||||
// mnuAutoCreateJumpLabels
|
||||
//
|
||||
this.mnuAutoCreateJumpLabels.CheckOnClick = true;
|
||||
this.mnuAutoCreateJumpLabels.Name = "mnuAutoCreateJumpLabels";
|
||||
this.mnuAutoCreateJumpLabels.Size = new System.Drawing.Size(266, 22);
|
||||
this.mnuAutoCreateJumpLabels.Text = "Auto-create jump labels";
|
||||
this.mnuAutoCreateJumpLabels.Click += new System.EventHandler(this.mnuAutoCreateJumpLabels_Click);
|
||||
//
|
||||
// toolStripMenuItem25
|
||||
//
|
||||
this.toolStripMenuItem25.Name = "toolStripMenuItem25";
|
||||
this.toolStripMenuItem25.Size = new System.Drawing.Size(263, 6);
|
||||
//
|
||||
// frmDebugger
|
||||
//
|
||||
this.AllowDrop = true;
|
||||
|
|
|
@ -28,6 +28,16 @@ namespace Mesen.GUI.Debugger
|
|||
private Size _minimumSize;
|
||||
private int _topPanelMinSize;
|
||||
|
||||
public ICodeViewer LastCodeWindow
|
||||
{
|
||||
get { return _lastCodeWindow; }
|
||||
set
|
||||
{
|
||||
_lastCodeWindow = value;
|
||||
UpdateCodeMenu();
|
||||
}
|
||||
}
|
||||
|
||||
public frmDebugger()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
@ -40,11 +50,6 @@ namespace Mesen.GUI.Debugger
|
|||
_minimumSize = this.MinimumSize;
|
||||
_topPanelMinSize = splitContainer.Panel1MinSize;
|
||||
|
||||
if(Program.IsMono) {
|
||||
//This doesn't work in Mono (menu is blank) - hide it for now
|
||||
mnuCode.Visible = false;
|
||||
}
|
||||
|
||||
_wasPaused = InteropEmu.IsPaused();
|
||||
bool debuggerAlreadyRunning = InteropEmu.DebugIsDebuggerRunning();
|
||||
|
||||
|
@ -154,7 +159,7 @@ namespace Mesen.GUI.Debugger
|
|||
|
||||
this.mnuUseVerticalLayout.Checked = ConfigManager.Config.DebugInfo.VerticalLayout;
|
||||
|
||||
_lastCodeWindow = ctrlDebuggerCode;
|
||||
LastCodeWindow = ctrlDebuggerCode;
|
||||
|
||||
this.toolTip.SetToolTip(this.picWatchHelp,
|
||||
frmBreakpoint.GetConditionTooltip(true) + Environment.NewLine + Environment.NewLine +
|
||||
|
@ -292,6 +297,14 @@ namespace Mesen.GUI.Debugger
|
|||
|
||||
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
|
||||
{
|
||||
if(ctrlWatch.ContainsFocus) {
|
||||
//Allow Ctrl+C, etc to work normally while editing watch
|
||||
CleanupMenu(mnuCode.DropDownItems);
|
||||
mnuCode.DropDownItems.Clear();
|
||||
} else {
|
||||
this.LastCodeWindow.CodeViewerActions.UpdateContextMenuItemVisibility(mnuCode.DropDownItems);
|
||||
}
|
||||
|
||||
if(keyData == ConfigManager.Config.DebugInfo.Shortcuts.ToggleBreakContinue) {
|
||||
if(mnuBreak.Enabled) {
|
||||
ctrlConsoleStatus.ApplyChanges();
|
||||
|
@ -318,7 +331,7 @@ namespace Mesen.GUI.Debugger
|
|||
int relativeAddress = InteropEmu.DebugGetRelativeAddress((UInt32)sender, AddressType.PrgRom);
|
||||
if(relativeAddress >= 0) {
|
||||
BringToFront();
|
||||
_lastCodeWindow.ScrollToLineNumber(relativeAddress);
|
||||
LastCodeWindow.ScrollToLineNumber(relativeAddress);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -610,11 +623,11 @@ namespace Mesen.GUI.Debugger
|
|||
ctrlDebuggerCodeSplit.Code = ctrlDebuggerCode.Code;
|
||||
}
|
||||
} else {
|
||||
_lastCodeWindow = ctrlSourceViewer.Visible ? (ICodeViewer)ctrlSourceViewer : (ICodeViewer)ctrlDebuggerCode;
|
||||
LastCodeWindow = ctrlSourceViewer.Visible ? (ICodeViewer)ctrlSourceViewer : (ICodeViewer)ctrlDebuggerCode;
|
||||
}
|
||||
|
||||
if(updateActiveAddress) {
|
||||
_lastCodeWindow.SelectActiveAddress(state.CPU.DebugPC);
|
||||
LastCodeWindow.SelectActiveAddress(state.CPU.DebugPC);
|
||||
}
|
||||
|
||||
ctrlDebuggerCode.SetActiveAddress(state.CPU.DebugPC);
|
||||
|
@ -671,7 +684,7 @@ namespace Mesen.GUI.Debugger
|
|||
|
||||
private void ToggleBreakpoint(bool toggleEnabled)
|
||||
{
|
||||
_lastCodeWindow.CodeViewerActions.ToggleBreakpoint(toggleEnabled);
|
||||
LastCodeWindow.CodeViewerActions.ToggleBreakpoint(toggleEnabled);
|
||||
}
|
||||
|
||||
private void ResumeExecution()
|
||||
|
@ -830,17 +843,17 @@ namespace Mesen.GUI.Debugger
|
|||
|
||||
private void mnuFind_Click(object sender, EventArgs e)
|
||||
{
|
||||
_lastCodeWindow.CodeViewer.OpenSearchBox();
|
||||
LastCodeWindow.CodeViewer.OpenSearchBox();
|
||||
}
|
||||
|
||||
private void mnuFindNext_Click(object sender, EventArgs e)
|
||||
{
|
||||
_lastCodeWindow.CodeViewer.FindNext();
|
||||
LastCodeWindow.CodeViewer.FindNext();
|
||||
}
|
||||
|
||||
private void mnuFindPrev_Click(object sender, EventArgs e)
|
||||
{
|
||||
_lastCodeWindow.CodeViewer.FindPrevious();
|
||||
LastCodeWindow.CodeViewer.FindPrevious();
|
||||
}
|
||||
|
||||
private void mnuSplitView_Click(object sender, EventArgs e)
|
||||
|
@ -873,55 +886,55 @@ namespace Mesen.GUI.Debugger
|
|||
|
||||
public void ScrollToAddress(int address)
|
||||
{
|
||||
_lastCodeWindow.ScrollToLineNumber(address);
|
||||
LastCodeWindow.ScrollToLineNumber(address);
|
||||
}
|
||||
|
||||
private void ctrlDebuggerCode_Enter(object sender, EventArgs e)
|
||||
{
|
||||
_lastCodeWindow = (ICodeViewer)sender;
|
||||
LastCodeWindow = (ICodeViewer)sender;
|
||||
}
|
||||
|
||||
private void mnuGoToAddress_Click(object sender, EventArgs e)
|
||||
{
|
||||
_lastCodeWindow.CodeViewer.GoToAddress();
|
||||
LastCodeWindow.CodeViewer.GoToAddress();
|
||||
}
|
||||
|
||||
private void mnuGoToIrqHandler_Click(object sender, EventArgs e)
|
||||
{
|
||||
int address = (InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFF) << 8) | InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFE);
|
||||
_lastCodeWindow.ScrollToLineNumber(address);
|
||||
LastCodeWindow.ScrollToLineNumber(address);
|
||||
}
|
||||
|
||||
private void mnuGoToNmiHandler_Click(object sender, EventArgs e)
|
||||
{
|
||||
int address = (InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFB) << 8) | InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFA);
|
||||
_lastCodeWindow.ScrollToLineNumber(address);
|
||||
LastCodeWindow.ScrollToLineNumber(address);
|
||||
}
|
||||
|
||||
private void mnuGoToResetHandler_Click(object sender, EventArgs e)
|
||||
{
|
||||
int address = (InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFD) << 8) | InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFC);
|
||||
_lastCodeWindow.ScrollToLineNumber(address);
|
||||
LastCodeWindow.ScrollToLineNumber(address);
|
||||
}
|
||||
|
||||
private void mnuGoToProgramCount_Click(object sender, EventArgs e)
|
||||
{
|
||||
_lastCodeWindow.CodeViewerActions.ScrollToActiveAddress();
|
||||
LastCodeWindow.CodeViewerActions.ScrollToActiveAddress();
|
||||
}
|
||||
|
||||
private void mnuIncreaseFontSize_Click(object sender, EventArgs e)
|
||||
{
|
||||
_lastCodeWindow.CodeViewer.TextZoom += 10;
|
||||
LastCodeWindow.CodeViewer.TextZoom += 10;
|
||||
}
|
||||
|
||||
private void mnuDecreaseFontSize_Click(object sender, EventArgs e)
|
||||
{
|
||||
_lastCodeWindow.CodeViewer.TextZoom -= 10;
|
||||
LastCodeWindow.CodeViewer.TextZoom -= 10;
|
||||
}
|
||||
|
||||
private void mnuResetFontSize_Click(object sender, EventArgs e)
|
||||
{
|
||||
_lastCodeWindow.CodeViewer.TextZoom = 100;
|
||||
LastCodeWindow.CodeViewer.TextZoom = 100;
|
||||
}
|
||||
|
||||
private void mnuClose_Click(object sender, EventArgs e)
|
||||
|
@ -974,7 +987,7 @@ namespace Mesen.GUI.Debugger
|
|||
|
||||
private void ctrlCallstack_FunctionSelected(object sender, EventArgs e)
|
||||
{
|
||||
_lastCodeWindow.ScrollToLineNumber((int)sender);
|
||||
LastCodeWindow.ScrollToLineNumber((int)sender);
|
||||
}
|
||||
|
||||
private void ctrlConsoleStatus_OnStateChanged(object sender, EventArgs e)
|
||||
|
@ -1017,7 +1030,7 @@ namespace Mesen.GUI.Debugger
|
|||
if(bp.IsCpuBreakpoint) {
|
||||
int relAddress = bp.GetRelativeAddress();
|
||||
if(relAddress >= 0) {
|
||||
_lastCodeWindow.ScrollToLineNumber(relAddress);
|
||||
LastCodeWindow.ScrollToLineNumber(relAddress);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1237,7 +1250,7 @@ namespace Mesen.GUI.Debugger
|
|||
|
||||
private void ctrlFunctionList_OnFunctionSelected(object relativeAddress, EventArgs e)
|
||||
{
|
||||
_lastCodeWindow.ScrollToLineNumber((Int32)relativeAddress);
|
||||
LastCodeWindow.ScrollToLineNumber((Int32)relativeAddress);
|
||||
}
|
||||
|
||||
private void LabelManager_OnLabelUpdated(object sender, EventArgs e)
|
||||
|
@ -1250,7 +1263,7 @@ namespace Mesen.GUI.Debugger
|
|||
|
||||
private void ctrlLabelList_OnLabelSelected(object relativeAddress, EventArgs e)
|
||||
{
|
||||
_lastCodeWindow.ScrollToLineNumber((Int32)relativeAddress);
|
||||
LastCodeWindow.ScrollToLineNumber((Int32)relativeAddress);
|
||||
}
|
||||
|
||||
private void mnuResetWorkspace_Click(object sender, EventArgs e)
|
||||
|
@ -1312,12 +1325,12 @@ namespace Mesen.GUI.Debugger
|
|||
private void ctrlLabelList_OnFindOccurrence(object sender, EventArgs e)
|
||||
{
|
||||
CodeLabel label = sender as CodeLabel;
|
||||
_lastCodeWindow.FindAllOccurrences(label.Label, true, true);
|
||||
LastCodeWindow.FindAllOccurrences(label.Label, true, true);
|
||||
}
|
||||
|
||||
private void ctrlFunctionList_OnFindOccurrence(object sender, EventArgs e)
|
||||
{
|
||||
_lastCodeWindow.FindAllOccurrences(sender as string, true, true);
|
||||
LastCodeWindow.FindAllOccurrences(sender as string, true, true);
|
||||
}
|
||||
|
||||
private void mnuBreakIn_Click(object sender, EventArgs e)
|
||||
|
@ -1338,7 +1351,7 @@ namespace Mesen.GUI.Debugger
|
|||
{
|
||||
frmFindOccurrences frm = new Debugger.frmFindOccurrences();
|
||||
if(frm.ShowDialog() == DialogResult.OK) {
|
||||
_lastCodeWindow.FindAllOccurrences(frm.SearchString, frm.MatchWholeWord, frm.MatchCase);
|
||||
LastCodeWindow.FindAllOccurrences(frm.SearchString, frm.MatchWholeWord, frm.MatchCase);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1362,7 +1375,7 @@ namespace Mesen.GUI.Debugger
|
|||
|
||||
private void ctrlConsoleStatus_OnGotoLocation(object sender, EventArgs e)
|
||||
{
|
||||
_lastCodeWindow.ScrollToLineNumber((int)sender);
|
||||
LastCodeWindow.ScrollToLineNumber((int)sender);
|
||||
}
|
||||
|
||||
private void UpdateDisassembleFlags()
|
||||
|
@ -1511,24 +1524,66 @@ namespace Mesen.GUI.Debugger
|
|||
DebugWindowManager.OpenAssembler(args.Code, args.StartAddress, args.BlockLength);
|
||||
}
|
||||
|
||||
private void mnuCode_DropDownOpening(object sender, EventArgs e)
|
||||
private void CopyMenu(ToolStripItemCollection source, ToolStripItemCollection dest)
|
||||
{
|
||||
this._lastCodeWindow.CodeViewerActions.UpdateContextMenuItemVisibility(false);
|
||||
|
||||
List<ToolStripItem> items = new List<ToolStripItem>();
|
||||
foreach(ToolStripItem item in this._lastCodeWindow.CodeViewerActions.contextMenu.Items) {
|
||||
items.Add(item);
|
||||
foreach(ToolStripItem item in source) {
|
||||
if(item is ToolStripSeparator) {
|
||||
ToolStripSeparator sep = new ToolStripSeparator();
|
||||
sep.Name = item.Name;
|
||||
sep.Visible = true;
|
||||
items.Add(sep);
|
||||
} else if(item is ToolStripMenuItem) {
|
||||
ToolStripMenuItem copy = new ToolStripMenuItem(item.Text, item.Image);
|
||||
copy.Name = item.Name;
|
||||
copy.Enabled = item.Enabled;
|
||||
copy.CheckOnClick = ((ToolStripMenuItem)item).CheckOnClick;
|
||||
copy.Checked = ((ToolStripMenuItem)item).Checked;
|
||||
copy.Visible = true;
|
||||
copy.Click += (s, e) => {
|
||||
item.PerformClick();
|
||||
};
|
||||
|
||||
if(((ToolStripMenuItem)item).DropDownItems.Count > 0) {
|
||||
CopyMenu(((ToolStripMenuItem)item).DropDownItems, copy.DropDownItems);
|
||||
}
|
||||
|
||||
if(item.Tag is ShortcutInfo) {
|
||||
copy.InitShortcut(this, ((ShortcutInfo)item.Tag).ShortcutKey);
|
||||
}
|
||||
|
||||
items.Add(copy);
|
||||
} else {
|
||||
//Not used
|
||||
}
|
||||
}
|
||||
mnuCode.DropDownItems.AddRange(items.ToArray());
|
||||
dest.AddRange(items.ToArray());
|
||||
}
|
||||
|
||||
private void mnuCode_DropDownClosed(object sender, EventArgs e)
|
||||
private void CleanupMenu(ToolStripItemCollection items)
|
||||
{
|
||||
List<ToolStripItem> items = new List<ToolStripItem>();
|
||||
foreach(ToolStripItem item in mnuCode.DropDownItems) {
|
||||
items.Add(item);
|
||||
foreach(ToolStripItem item in items) {
|
||||
if(item.Tag is ShortcutInfo && ((ShortcutInfo)item.Tag).KeyHandler != null) {
|
||||
DebuggerShortcutsConfig.ClearProcessCmdKeyHandler((ToolStripMenuItem)item, this);
|
||||
}
|
||||
|
||||
if(item is ToolStripMenuItem && ((ToolStripMenuItem)item).HasDropDownItems) {
|
||||
CleanupMenu(((ToolStripMenuItem)item).DropDownItems);
|
||||
}
|
||||
}
|
||||
this._lastCodeWindow.CodeViewerActions.contextMenu.Items.AddRange(items.ToArray());
|
||||
}
|
||||
|
||||
private void UpdateCodeMenu()
|
||||
{
|
||||
CleanupMenu(mnuCode.DropDownItems);
|
||||
mnuCode.DropDownItems.Clear();
|
||||
CopyMenu(this.LastCodeWindow.CodeViewerActions.contextMenu.Items, mnuCode.DropDownItems);
|
||||
this.LastCodeWindow.CodeViewerActions.UpdateContextMenuItemVisibility(mnuCode.DropDownItems, false);
|
||||
}
|
||||
|
||||
private void mnuCode_DropDownOpening(object sender, EventArgs e)
|
||||
{
|
||||
UpdateCodeMenu();
|
||||
}
|
||||
|
||||
private void mnuCdlStripUsedData_Click(object sender, EventArgs e)
|
||||
|
|
Loading…
Add table
Reference in a new issue