Debugger: Added copy/select all shortcuts to access counters

This commit is contained in:
Sour 2018-03-30 19:14:08 -04:00
parent bf731afc3c
commit bf2e733cc3
5 changed files with 76 additions and 17 deletions

View file

@ -37,18 +37,22 @@
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
this.picHelp = new System.Windows.Forms.PictureBox(); this.picHelp = new System.Windows.Forms.PictureBox();
this.chkHighlightUninitRead = new System.Windows.Forms.CheckBox(); this.chkHighlightUninitRead = new System.Windows.Forms.CheckBox();
this.chkHideUnusedAddresses = new System.Windows.Forms.CheckBox();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel(); this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel();
this.lblSort = new System.Windows.Forms.Label(); this.lblSort = new System.Windows.Forms.Label();
this.cboSort = new System.Windows.Forms.ComboBox(); this.cboSort = new System.Windows.Forms.ComboBox();
this.toolTip = new System.Windows.Forms.ToolTip(this.components); this.toolTip = new System.Windows.Forms.ToolTip(this.components);
this.chkHideUnusedAddresses = new System.Windows.Forms.CheckBox(); this.ctxMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
this.mnuCopy = new System.Windows.Forms.ToolStripMenuItem();
this.mnuSelectAll = new System.Windows.Forms.ToolStripMenuItem();
this.flowLayoutPanel1.SuspendLayout(); this.flowLayoutPanel1.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout();
this.tableLayoutPanel3.SuspendLayout(); this.tableLayoutPanel3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picHelp)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.picHelp)).BeginInit();
this.tableLayoutPanel2.SuspendLayout(); this.tableLayoutPanel2.SuspendLayout();
this.flowLayoutPanel2.SuspendLayout(); this.flowLayoutPanel2.SuspendLayout();
this.ctxMenu.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// flowLayoutPanel1 // flowLayoutPanel1
@ -110,6 +114,7 @@
this.ctrlScrollableTextbox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.ctrlScrollableTextbox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.ctrlScrollableTextbox.CodeHighlightingEnabled = true; this.ctrlScrollableTextbox.CodeHighlightingEnabled = true;
this.tableLayoutPanel1.SetColumnSpan(this.ctrlScrollableTextbox, 2); this.tableLayoutPanel1.SetColumnSpan(this.ctrlScrollableTextbox, 2);
this.ctrlScrollableTextbox.ContextMenuStrip = this.ctxMenu;
this.ctrlScrollableTextbox.Dock = System.Windows.Forms.DockStyle.Fill; this.ctrlScrollableTextbox.Dock = System.Windows.Forms.DockStyle.Fill;
this.ctrlScrollableTextbox.HideSelection = false; this.ctrlScrollableTextbox.HideSelection = false;
this.ctrlScrollableTextbox.Location = new System.Drawing.Point(0, 27); this.ctrlScrollableTextbox.Location = new System.Drawing.Point(0, 27);
@ -179,6 +184,18 @@
this.chkHighlightUninitRead.UseVisualStyleBackColor = true; this.chkHighlightUninitRead.UseVisualStyleBackColor = true;
this.chkHighlightUninitRead.CheckedChanged += new System.EventHandler(this.chkOption_CheckedChanged); this.chkHighlightUninitRead.CheckedChanged += new System.EventHandler(this.chkOption_CheckedChanged);
// //
// chkHideUnusedAddresses
//
this.chkHideUnusedAddresses.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.chkHideUnusedAddresses.AutoSize = true;
this.chkHideUnusedAddresses.Location = new System.Drawing.Point(3, 3);
this.chkHideUnusedAddresses.Name = "chkHideUnusedAddresses";
this.chkHideUnusedAddresses.Size = new System.Drawing.Size(137, 17);
this.chkHideUnusedAddresses.TabIndex = 6;
this.chkHideUnusedAddresses.Text = "Hide unused addresses";
this.chkHideUnusedAddresses.UseVisualStyleBackColor = true;
this.chkHideUnusedAddresses.CheckedChanged += new System.EventHandler(this.chkOption_CheckedChanged);
//
// tableLayoutPanel2 // tableLayoutPanel2
// //
this.tableLayoutPanel2.AutoSize = true; this.tableLayoutPanel2.AutoSize = true;
@ -245,17 +262,29 @@
this.toolTip.InitialDelay = 10; this.toolTip.InitialDelay = 10;
this.toolTip.ReshowDelay = 10; this.toolTip.ReshowDelay = 10;
// //
// chkHideUnusedAddresses // ctxMenu
// //
this.chkHideUnusedAddresses.Anchor = System.Windows.Forms.AnchorStyles.Left; this.ctxMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.chkHideUnusedAddresses.AutoSize = true; this.mnuCopy,
this.chkHideUnusedAddresses.Location = new System.Drawing.Point(3, 3); this.mnuSelectAll});
this.chkHideUnusedAddresses.Name = "chkHideUnusedAddresses"; this.ctxMenu.Name = "ctxMenu";
this.chkHideUnusedAddresses.Size = new System.Drawing.Size(137, 17); this.ctxMenu.Size = new System.Drawing.Size(123, 48);
this.chkHideUnusedAddresses.TabIndex = 6; //
this.chkHideUnusedAddresses.Text = "Hide unused addresses"; // mnuCopy
this.chkHideUnusedAddresses.UseVisualStyleBackColor = true; //
this.chkHideUnusedAddresses.CheckedChanged += new System.EventHandler(this.chkOption_CheckedChanged); this.mnuCopy.Image = global::Mesen.GUI.Properties.Resources.Copy;
this.mnuCopy.Name = "mnuCopy";
this.mnuCopy.Size = new System.Drawing.Size(122, 22);
this.mnuCopy.Text = "Copy";
this.mnuCopy.Click += new System.EventHandler(this.mnuCopy_Click);
//
// mnuSelectAll
//
this.mnuSelectAll.Image = global::Mesen.GUI.Properties.Resources.SelectAll;
this.mnuSelectAll.Name = "mnuSelectAll";
this.mnuSelectAll.Size = new System.Drawing.Size(122, 22);
this.mnuSelectAll.Text = "Select All";
this.mnuSelectAll.Click += new System.EventHandler(this.mnuSelectAll_Click);
// //
// ctrlMemoryAccessCounters // ctrlMemoryAccessCounters
// //
@ -276,6 +305,7 @@
this.tableLayoutPanel2.PerformLayout(); this.tableLayoutPanel2.PerformLayout();
this.flowLayoutPanel2.ResumeLayout(false); this.flowLayoutPanel2.ResumeLayout(false);
this.flowLayoutPanel2.PerformLayout(); this.flowLayoutPanel2.PerformLayout();
this.ctxMenu.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
} }
@ -297,5 +327,8 @@
private System.Windows.Forms.PictureBox picHelp; private System.Windows.Forms.PictureBox picHelp;
private System.Windows.Forms.ToolTip toolTip; private System.Windows.Forms.ToolTip toolTip;
private System.Windows.Forms.CheckBox chkHideUnusedAddresses; private System.Windows.Forms.CheckBox chkHideUnusedAddresses;
private System.Windows.Forms.ContextMenuStrip ctxMenu;
private System.Windows.Forms.ToolStripMenuItem mnuCopy;
private System.Windows.Forms.ToolStripMenuItem mnuSelectAll;
} }
} }

View file

@ -9,6 +9,7 @@ using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using Mesen.GUI.Controls; using Mesen.GUI.Controls;
using Mesen.GUI.Forms; using Mesen.GUI.Forms;
using Mesen.GUI.Config;
namespace Mesen.GUI.Debugger.Controls namespace Mesen.GUI.Debugger.Controls
{ {
@ -26,11 +27,18 @@ namespace Mesen.GUI.Debugger.Controls
bool designMode = (LicenseManager.UsageMode == LicenseUsageMode.Designtime); bool designMode = (LicenseManager.UsageMode == LicenseUsageMode.Designtime);
if(!designMode) { if(!designMode) {
InitShortcuts();
InitMemoryTypeDropdown(); InitMemoryTypeDropdown();
cboSort.SelectedIndex = 0; cboSort.SelectedIndex = 0;
} }
} }
public void InitShortcuts()
{
mnuCopy.InitShortcut(this, nameof(DebuggerShortcutsConfig.Copy));
mnuSelectAll.InitShortcut(this, nameof(DebuggerShortcutsConfig.SelectAll));
}
public void InitMemoryTypeDropdown() public void InitMemoryTypeDropdown()
{ {
cboMemoryType.SelectedIndexChanged -= cboMemoryType_SelectedIndexChanged; cboMemoryType.SelectedIndexChanged -= cboMemoryType_SelectedIndexChanged;
@ -112,7 +120,7 @@ namespace Mesen.GUI.Debugger.Controls
} else { } else {
ctrlScrollableTextbox.StyleProvider = null; ctrlScrollableTextbox.StyleProvider = null;
} }
ctrlScrollableTextbox.Header = "Read".PadRight(12) + "Write".PadRight(12) + "Execute".PadRight(12); ctrlScrollableTextbox.Header = " " + "Read".PadRight(12) + "Write".PadRight(12) + "Execute";
ctrlScrollableTextbox.LineNumbers = addresses.ToArray(); ctrlScrollableTextbox.LineNumbers = addresses.ToArray();
ctrlScrollableTextbox.TextLines = content.ToArray(); ctrlScrollableTextbox.TextLines = content.ToArray();
} }
@ -230,7 +238,7 @@ namespace Mesen.GUI.Debugger.Controls
get get
{ {
if(this._needRecalc) { if(this._needRecalc) {
_content = (_readCount == 0 ? "0" : _readCount.ToString()).PadRight(12) + _content = " " + (_readCount == 0 ? "0" : _readCount.ToString()).PadRight(12) +
(_writeCount == 0 ? "0" : _writeCount.ToString()).PadRight(12) + (_writeCount == 0 ? "0" : _writeCount.ToString()).PadRight(12) +
(_execCount == 0 ? "0" : _execCount.ToString()); (_execCount == 0 ? "0" : _execCount.ToString());
_needRecalc = false; _needRecalc = false;
@ -241,5 +249,15 @@ namespace Mesen.GUI.Debugger.Controls
public bool UninitRead { get; set; } public bool UninitRead { get; set; }
} }
private void mnuCopy_Click(object sender, EventArgs e)
{
ctrlScrollableTextbox.CopySelection(true, false, false);
}
private void mnuSelectAll_Click(object sender, EventArgs e)
{
ctrlScrollableTextbox.SelectAll();
}
} }
} }

View file

@ -117,6 +117,9 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="ctxMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>107, 17</value>
</metadata>
<metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>

View file

@ -239,8 +239,7 @@ namespace Mesen.GUI.Debugger
{ {
if(!this.cboSearch.Focused) { if(!this.cboSearch.Focused) {
if(keyData == ConfigManager.Config.DebugInfo.Shortcuts.SelectAll) { if(keyData == ConfigManager.Config.DebugInfo.Shortcuts.SelectAll) {
this.ctrlTextbox.SelectionStart = 0; this.SelectAll();
this.ctrlTextbox.SelectionLength = this.ctrlTextbox.LineCount;
return true; return true;
} }
@ -330,7 +329,13 @@ namespace Mesen.GUI.Debugger
return base.ProcessCmdKey(ref msg, keyData); return base.ProcessCmdKey(ref msg, keyData);
} }
public void SelectAll()
{
this.ctrlTextbox.SelectionStart = 0;
this.ctrlTextbox.SelectionLength = this.ctrlTextbox.LineCount;
}
private void vScrollBar_ValueChanged(object sender, EventArgs e) private void vScrollBar_ValueChanged(object sender, EventArgs e)
{ {
this.ctrlTextbox.ScrollPosition = this.vScrollBar.Value; this.ctrlTextbox.ScrollPosition = this.vScrollBar.Value;

View file

@ -1311,7 +1311,7 @@ namespace Mesen.GUI.Debugger
using(Brush lightGrayBrush = new SolidBrush(Color.FromArgb(240, 240, 240))) { using(Brush lightGrayBrush = new SolidBrush(Color.FromArgb(240, 240, 240))) {
pe.Graphics.FillRectangle(lightGrayBrush, marginLeft, 0, Math.Max(_maxLineWidth, rect.Right), lineHeight); pe.Graphics.FillRectangle(lightGrayBrush, marginLeft, 0, Math.Max(_maxLineWidth, rect.Right), lineHeight);
} }
pe.Graphics.DrawString(_header, this.Font, Brushes.Gray, marginLeft, positionY); pe.Graphics.DrawString(_header, this.Font, Brushes.Gray, marginLeft, positionY, StringFormat.GenericTypographic);
positionY += lineHeight; positionY += lineHeight;
} }