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.picHelp = new System.Windows.Forms.PictureBox();
this.chkHighlightUninitRead = new System.Windows.Forms.CheckBox();
this.chkHideUnusedAddresses = new System.Windows.Forms.CheckBox();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel();
this.lblSort = new System.Windows.Forms.Label();
this.cboSort = new System.Windows.Forms.ComboBox();
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.tableLayoutPanel1.SuspendLayout();
this.tableLayoutPanel3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picHelp)).BeginInit();
this.tableLayoutPanel2.SuspendLayout();
this.flowLayoutPanel2.SuspendLayout();
this.ctxMenu.SuspendLayout();
this.SuspendLayout();
//
// flowLayoutPanel1
@ -110,6 +114,7 @@
this.ctrlScrollableTextbox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.ctrlScrollableTextbox.CodeHighlightingEnabled = true;
this.tableLayoutPanel1.SetColumnSpan(this.ctrlScrollableTextbox, 2);
this.ctrlScrollableTextbox.ContextMenuStrip = this.ctxMenu;
this.ctrlScrollableTextbox.Dock = System.Windows.Forms.DockStyle.Fill;
this.ctrlScrollableTextbox.HideSelection = false;
this.ctrlScrollableTextbox.Location = new System.Drawing.Point(0, 27);
@ -179,6 +184,18 @@
this.chkHighlightUninitRead.UseVisualStyleBackColor = true;
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
//
this.tableLayoutPanel2.AutoSize = true;
@ -245,17 +262,29 @@
this.toolTip.InitialDelay = 10;
this.toolTip.ReshowDelay = 10;
//
// chkHideUnusedAddresses
// ctxMenu
//
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);
this.ctxMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuCopy,
this.mnuSelectAll});
this.ctxMenu.Name = "ctxMenu";
this.ctxMenu.Size = new System.Drawing.Size(123, 48);
//
// mnuCopy
//
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
//
@ -276,6 +305,7 @@
this.tableLayoutPanel2.PerformLayout();
this.flowLayoutPanel2.ResumeLayout(false);
this.flowLayoutPanel2.PerformLayout();
this.ctxMenu.ResumeLayout(false);
this.ResumeLayout(false);
}
@ -297,5 +327,8 @@
private System.Windows.Forms.PictureBox picHelp;
private System.Windows.Forms.ToolTip toolTip;
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 Mesen.GUI.Controls;
using Mesen.GUI.Forms;
using Mesen.GUI.Config;
namespace Mesen.GUI.Debugger.Controls
{
@ -26,11 +27,18 @@ namespace Mesen.GUI.Debugger.Controls
bool designMode = (LicenseManager.UsageMode == LicenseUsageMode.Designtime);
if(!designMode) {
InitShortcuts();
InitMemoryTypeDropdown();
cboSort.SelectedIndex = 0;
}
}
public void InitShortcuts()
{
mnuCopy.InitShortcut(this, nameof(DebuggerShortcutsConfig.Copy));
mnuSelectAll.InitShortcut(this, nameof(DebuggerShortcutsConfig.SelectAll));
}
public void InitMemoryTypeDropdown()
{
cboMemoryType.SelectedIndexChanged -= cboMemoryType_SelectedIndexChanged;
@ -112,7 +120,7 @@ namespace Mesen.GUI.Debugger.Controls
} else {
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.TextLines = content.ToArray();
}
@ -230,7 +238,7 @@ namespace Mesen.GUI.Debugger.Controls
get
{
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) +
(_execCount == 0 ? "0" : _execCount.ToString());
_needRecalc = false;
@ -241,5 +249,15 @@ namespace Mesen.GUI.Debugger.Controls
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">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</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">
<value>17, 17</value>
</metadata>

View file

@ -239,8 +239,7 @@ namespace Mesen.GUI.Debugger
{
if(!this.cboSearch.Focused) {
if(keyData == ConfigManager.Config.DebugInfo.Shortcuts.SelectAll) {
this.ctrlTextbox.SelectionStart = 0;
this.ctrlTextbox.SelectionLength = this.ctrlTextbox.LineCount;
this.SelectAll();
return true;
}
@ -330,7 +329,13 @@ namespace Mesen.GUI.Debugger
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)
{
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))) {
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;
}