From c9b0329fa614be92d9473c6457a5ac9888baffe0 Mon Sep 17 00:00:00 2001 From: Souryo Date: Sun, 4 Dec 2016 12:16:12 -0500 Subject: [PATCH] Debugger: Added "Toggle breakpoint" option in right-click menu --- .../Controls/ctrlDebuggerCode.Designer.cs | 35 ++++++++++++------- GUI.NET/Debugger/Controls/ctrlDebuggerCode.cs | 5 +++ 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/GUI.NET/Debugger/Controls/ctrlDebuggerCode.Designer.cs b/GUI.NET/Debugger/Controls/ctrlDebuggerCode.Designer.cs index e61a70a2..e9723066 100644 --- a/GUI.NET/Debugger/Controls/ctrlDebuggerCode.Designer.cs +++ b/GUI.NET/Debugger/Controls/ctrlDebuggerCode.Designer.cs @@ -35,11 +35,12 @@ this.mnuShowLineNotes = new System.Windows.Forms.ToolStripMenuItem(); this.mnuShowCodeNotes = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator(); + this.mnuToggleBreakpoint = new System.Windows.Forms.ToolStripMenuItem(); this.mnuEditLabel = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem4 = new System.Windows.Forms.ToolStripSeparator(); - this.mnuGoToLocation = new System.Windows.Forms.ToolStripMenuItem(); this.mnuAddToWatch = new System.Windows.Forms.ToolStripMenuItem(); this.mnuFindOccurrences = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuGoToLocation = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator(); this.mnuNavigateBackward = new System.Windows.Forms.ToolStripMenuItem(); this.mnuNavigateForward = new System.Windows.Forms.ToolStripMenuItem(); @@ -78,15 +79,16 @@ this.mnuShowCodeNotes, this.toolStripMenuItem2, this.mnuEditLabel, + this.mnuToggleBreakpoint, this.toolStripMenuItem4, - this.mnuGoToLocation, this.mnuAddToWatch, this.mnuFindOccurrences, + this.mnuGoToLocation, this.toolStripMenuItem3, this.mnuNavigateBackward, this.mnuNavigateForward}); this.contextMenuCode.Name = "contextMenuWatch"; - this.contextMenuCode.Size = new System.Drawing.Size(259, 248); + this.contextMenuCode.Size = new System.Drawing.Size(259, 292); this.contextMenuCode.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuCode_Opening); // // mnuShowNextStatement @@ -133,6 +135,14 @@ this.toolStripMenuItem2.Name = "toolStripMenuItem2"; this.toolStripMenuItem2.Size = new System.Drawing.Size(255, 6); // + // mnuToggleBreakpoint + // + this.mnuToggleBreakpoint.Name = "mnuToggleBreakpoint"; + this.mnuToggleBreakpoint.ShortcutKeyDisplayString = "F9"; + this.mnuToggleBreakpoint.Size = new System.Drawing.Size(258, 22); + this.mnuToggleBreakpoint.Text = "Toggle Breakpoint"; + this.mnuToggleBreakpoint.Click += new System.EventHandler(this.mnuToggleBreakpoint_Click); + // // mnuEditLabel // this.mnuEditLabel.Name = "mnuEditLabel"; @@ -146,14 +156,6 @@ this.toolStripMenuItem4.Name = "toolStripMenuItem4"; this.toolStripMenuItem4.Size = new System.Drawing.Size(255, 6); // - // mnuGoToLocation - // - this.mnuGoToLocation.Name = "mnuGoToLocation"; - this.mnuGoToLocation.ShortcutKeyDisplayString = "Ctrl+Click"; - this.mnuGoToLocation.Size = new System.Drawing.Size(258, 22); - this.mnuGoToLocation.Text = "Go To Location"; - this.mnuGoToLocation.Click += new System.EventHandler(this.mnuGoToLocation_Click); - // // mnuAddToWatch // this.mnuAddToWatch.Name = "mnuAddToWatch"; @@ -170,6 +172,14 @@ this.mnuFindOccurrences.Text = "Find Occurrences"; this.mnuFindOccurrences.Click += new System.EventHandler(this.mnuFindOccurrences_Click); // + // mnuGoToLocation + // + this.mnuGoToLocation.Name = "mnuGoToLocation"; + this.mnuGoToLocation.ShortcutKeyDisplayString = "Ctrl+Click"; + this.mnuGoToLocation.Size = new System.Drawing.Size(258, 22); + this.mnuGoToLocation.Text = "Go to Location"; + this.mnuGoToLocation.Click += new System.EventHandler(this.mnuGoToLocation_Click); + // // toolStripMenuItem3 // this.toolStripMenuItem3.Name = "toolStripMenuItem3"; @@ -209,8 +219,8 @@ this.ctrlCodeViewer.MouseMove += new System.Windows.Forms.MouseEventHandler(this.ctrlCodeViewer_MouseMove); this.ctrlCodeViewer.MouseDown += new System.Windows.Forms.MouseEventHandler(this.ctrlCodeViewer_MouseDown); this.ctrlCodeViewer.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.ctrlCodeViewer_MouseDoubleClick); - this.ctrlCodeViewer.FontSizeChanged += new System.EventHandler(this.ctrlCodeViewer_FontSizeChanged); this.ctrlCodeViewer.MouseLeave += new System.EventHandler(this.ctrlCodeViewer_MouseLeave); + this.ctrlCodeViewer.FontSizeChanged += new System.EventHandler(this.ctrlCodeViewer_FontSizeChanged); // // contextMenuMargin // @@ -401,5 +411,6 @@ private System.Windows.Forms.ToolStripMenuItem mnuNavigateBackward; private System.Windows.Forms.ToolStripMenuItem mnuEditLabel; private System.Windows.Forms.ToolStripSeparator toolStripMenuItem4; + private System.Windows.Forms.ToolStripMenuItem mnuToggleBreakpoint; } } diff --git a/GUI.NET/Debugger/Controls/ctrlDebuggerCode.cs b/GUI.NET/Debugger/Controls/ctrlDebuggerCode.cs index 71aebb71..cb2a0ed0 100644 --- a/GUI.NET/Debugger/Controls/ctrlDebuggerCode.cs +++ b/GUI.NET/Debugger/Controls/ctrlDebuggerCode.cs @@ -581,6 +581,11 @@ namespace Mesen.GUI.Debugger this.ctrlCodeViewer.NavigateBackward(); } + private void mnuToggleBreakpoint_Click(object sender, EventArgs e) + { + BreakpointManager.ToggleBreakpoint(this.ctrlCodeViewer.CurrentLine, false); + } + #endregion #endregion