From 9950a4d4cc360e01a72ff22c020974656a69d9fc Mon Sep 17 00:00:00 2001 From: Sour Date: Sun, 3 May 2020 15:14:00 -0400 Subject: [PATCH] Debugger: Added copy selection option in disassembly view --- .../Controls/ctrlDisassemblyView.Designer.cs | 28 +++++++++++++------ UI/Debugger/Controls/ctrlDisassemblyView.cs | 4 ++- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/UI/Debugger/Controls/ctrlDisassemblyView.Designer.cs b/UI/Debugger/Controls/ctrlDisassemblyView.Designer.cs index c4bbd26..17e8d12 100644 --- a/UI/Debugger/Controls/ctrlDisassemblyView.Designer.cs +++ b/UI/Debugger/Controls/ctrlDisassemblyView.Designer.cs @@ -34,6 +34,8 @@ this.mnuMarkAsCode = new System.Windows.Forms.ToolStripMenuItem(); this.mnuMarkAsData = new System.Windows.Forms.ToolStripMenuItem(); this.mnuMarkAsUnidentifiedData = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuEditSelectedCode = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuCopySelection = new System.Windows.Forms.ToolStripMenuItem(); this.sepMarkSelectionAs = new System.Windows.Forms.ToolStripSeparator(); this.mnuToggleBreakpoint = new System.Windows.Forms.ToolStripMenuItem(); this.mnuAddToWatch = new System.Windows.Forms.ToolStripMenuItem(); @@ -47,7 +49,6 @@ this.cboSourceFile = new System.Windows.Forms.ComboBox(); this.lblSourceFile = new System.Windows.Forms.Label(); this.tlpMain = new System.Windows.Forms.TableLayoutPanel(); - this.mnuEditSelectedCode = new System.Windows.Forms.ToolStripMenuItem(); this.ctxMenu.SuspendLayout(); this.tlpMain.SuspendLayout(); this.SuspendLayout(); @@ -83,6 +84,7 @@ this.ctxMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.mnuMarkSelectionAs, this.mnuEditSelectedCode, + this.mnuCopySelection, this.sepMarkSelectionAs, this.mnuToggleBreakpoint, this.mnuAddToWatch, @@ -94,7 +96,7 @@ this.sepSwitchView, this.mnuSwitchView}); this.ctxMenu.Name = "ctxMenu"; - this.ctxMenu.Size = new System.Drawing.Size(227, 242); + this.ctxMenu.Size = new System.Drawing.Size(227, 264); this.ctxMenu.Closing += new System.Windows.Forms.ToolStripDropDownClosingEventHandler(this.ctxMenu_Closing); this.ctxMenu.Opening += new System.ComponentModel.CancelEventHandler(this.ctxMenu_Opening); // @@ -129,6 +131,20 @@ this.mnuMarkAsUnidentifiedData.Size = new System.Drawing.Size(199, 22); this.mnuMarkAsUnidentifiedData.Text = "Unidentified Code/Data"; // + // mnuEditSelectedCode + // + this.mnuEditSelectedCode.Image = global::Mesen.GUI.Properties.Resources.Edit; + this.mnuEditSelectedCode.Name = "mnuEditSelectedCode"; + this.mnuEditSelectedCode.Size = new System.Drawing.Size(226, 22); + this.mnuEditSelectedCode.Text = "Edit Selected Code"; + // + // mnuCopySelection + // + this.mnuCopySelection.Image = global::Mesen.GUI.Properties.Resources.Copy; + this.mnuCopySelection.Name = "mnuCopySelection"; + this.mnuCopySelection.Size = new System.Drawing.Size(226, 22); + this.mnuCopySelection.Text = "Copy Selection"; + // // sepMarkSelectionAs // this.sepMarkSelectionAs.Name = "sepMarkSelectionAs"; @@ -236,13 +252,6 @@ this.tlpMain.Size = new System.Drawing.Size(465, 398); this.tlpMain.TabIndex = 3; // - // mnuEditSelectedCode - // - this.mnuEditSelectedCode.Image = global::Mesen.GUI.Properties.Resources.Edit; - this.mnuEditSelectedCode.Name = "mnuEditSelectedCode"; - this.mnuEditSelectedCode.Size = new System.Drawing.Size(226, 22); - this.mnuEditSelectedCode.Text = "Edit Selected Code"; - // // ctrlDisassemblyView // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -279,5 +288,6 @@ private System.Windows.Forms.ToolStripMenuItem mnuMarkAsData; private System.Windows.Forms.ToolStripMenuItem mnuMarkAsUnidentifiedData; private System.Windows.Forms.ToolStripMenuItem mnuEditSelectedCode; + private System.Windows.Forms.ToolStripMenuItem mnuCopySelection; } } diff --git a/UI/Debugger/Controls/ctrlDisassemblyView.cs b/UI/Debugger/Controls/ctrlDisassemblyView.cs index 8d2b38e..465c782 100644 --- a/UI/Debugger/Controls/ctrlDisassemblyView.cs +++ b/UI/Debugger/Controls/ctrlDisassemblyView.cs @@ -157,6 +157,9 @@ namespace Mesen.GUI.Debugger.Controls mnuEditSelectedCode.InitShortcut(this, nameof(DebuggerShortcutsConfig.CodeWindow_EditSelectedCode)); mnuEditSelectedCode.Click += (s, e) => EditSelectedCode(); + mnuCopySelection.InitShortcut(this, nameof(DebuggerShortcutsConfig.Copy)); + mnuCopySelection.Click += (s, e) => ctrlCode.CopySelection(true, false, true); + mnuAddToWatch.InitShortcut(this, nameof(DebuggerShortcutsConfig.LabelList_AddToWatch)); mnuMarkAsCode.InitShortcut(this, nameof(DebuggerShortcutsConfig.MarkAsCode)); @@ -646,7 +649,6 @@ namespace Mesen.GUI.Debugger.Controls bool showMarkAs = !_inSourceView && (_manager.CpuType == CpuType.Cpu || _manager.CpuType == CpuType.Sa1); mnuMarkSelectionAs.Visible = showMarkAs; - sepMarkSelectionAs.Visible = showMarkAs; mnuEditSelectedCode.Visible = showMarkAs; mnuAddToWatch.Enabled = active;