From a6a2714ab7e8f37233d7f08508d87af8a9a5aa2e Mon Sep 17 00:00:00 2001 From: Souryo Date: Fri, 6 Oct 2017 18:26:02 -0400 Subject: [PATCH] Debugger: Memory viewer - reduced minimum size, improved resize logic --- .../ctrlMemoryAccessCounters.Designer.cs | 64 ++++++++++++++++--- .../Controls/ctrlMemoryAccessCounters.cs | 1 + .../Controls/ctrlMemoryAccessCounters.resx | 3 + GUI.NET/Debugger/HexBox/HexBox.cs | 2 +- GUI.NET/Debugger/frmMemoryViewer.Designer.cs | 50 +++++++-------- GUI.NET/Debugger/frmMemoryViewer.cs | 12 ++-- 6 files changed, 93 insertions(+), 39 deletions(-) diff --git a/GUI.NET/Debugger/Controls/ctrlMemoryAccessCounters.Designer.cs b/GUI.NET/Debugger/Controls/ctrlMemoryAccessCounters.Designer.cs index cc9dd00e..82fd33fb 100644 --- a/GUI.NET/Debugger/Controls/ctrlMemoryAccessCounters.Designer.cs +++ b/GUI.NET/Debugger/Controls/ctrlMemoryAccessCounters.Designer.cs @@ -27,6 +27,7 @@ /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); this.lblViewMemoryType = new System.Windows.Forms.Label(); this.cboMemoryType = new System.Windows.Forms.ComboBox(); @@ -38,10 +39,15 @@ this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel(); this.lblSort = new System.Windows.Forms.Label(); this.cboSort = new System.Windows.Forms.ComboBox(); + this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); + this.picHelp = new System.Windows.Forms.PictureBox(); + this.toolTip = new System.Windows.Forms.ToolTip(this.components); this.flowLayoutPanel1.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout(); this.tableLayoutPanel2.SuspendLayout(); this.flowLayoutPanel2.SuspendLayout(); + this.tableLayoutPanel3.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.picHelp)).BeginInit(); this.SuspendLayout(); // // flowLayoutPanel1 @@ -51,7 +57,7 @@ this.flowLayoutPanel1.Controls.Add(this.lblViewMemoryType); this.flowLayoutPanel1.Controls.Add(this.cboMemoryType); this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0); - this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(0, 0, 0, 0); + this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(0); this.flowLayoutPanel1.Name = "flowLayoutPanel1"; this.flowLayoutPanel1.Size = new System.Drawing.Size(166, 27); this.flowLayoutPanel1.TabIndex = 2; @@ -88,8 +94,8 @@ this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.tableLayoutPanel1.Controls.Add(this.ctrlScrollableTextbox, 0, 1); - this.tableLayoutPanel1.Controls.Add(this.chkHighlightUninitRead, 0, 2); this.tableLayoutPanel1.Controls.Add(this.btnReset, 1, 2); + this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel3, 0, 2); this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel2, 0, 0); this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); @@ -98,6 +104,7 @@ 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.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); this.tableLayoutPanel1.Size = new System.Drawing.Size(514, 307); this.tableLayoutPanel1.TabIndex = 3; // @@ -120,12 +127,11 @@ // this.chkHighlightUninitRead.Anchor = System.Windows.Forms.AnchorStyles.Left; this.chkHighlightUninitRead.AutoSize = true; - this.chkHighlightUninitRead.Location = new System.Drawing.Point(3, 284); + this.chkHighlightUninitRead.Location = new System.Drawing.Point(3, 6); this.chkHighlightUninitRead.Name = "chkHighlightUninitRead"; - this.chkHighlightUninitRead.Size = new System.Drawing.Size(422, 17); + this.chkHighlightUninitRead.Size = new System.Drawing.Size(192, 17); this.chkHighlightUninitRead.TabIndex = 4; - this.chkHighlightUninitRead.Text = "Highlight uninitialized memory reads (only accurate if debugger is active at powe" + - "r on)"; + this.chkHighlightUninitRead.Text = "Highlight uninitialized memory reads"; this.chkHighlightUninitRead.UseVisualStyleBackColor = true; this.chkHighlightUninitRead.CheckedChanged += new System.EventHandler(this.chkHighlightUninitRead_CheckedChanged); // @@ -167,7 +173,7 @@ this.flowLayoutPanel2.Controls.Add(this.lblSort); this.flowLayoutPanel2.Controls.Add(this.cboSort); this.flowLayoutPanel2.Location = new System.Drawing.Point(338, 0); - this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(0, 0, 0, 0); + this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(0); this.flowLayoutPanel2.Name = "flowLayoutPanel2"; this.flowLayoutPanel2.Size = new System.Drawing.Size(176, 27); this.flowLayoutPanel2.TabIndex = 3; @@ -199,12 +205,48 @@ this.cboSort.TabIndex = 1; this.cboSort.SelectedIndexChanged += new System.EventHandler(this.cboSort_SelectedIndexChanged); // + // tableLayoutPanel3 + // + this.tableLayoutPanel3.ColumnCount = 3; + this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel3.Controls.Add(this.picHelp, 1, 0); + this.tableLayoutPanel3.Controls.Add(this.chkHighlightUninitRead, 0, 0); + this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel3.Location = new System.Drawing.Point(0, 278); + this.tableLayoutPanel3.Margin = new System.Windows.Forms.Padding(0, 0, 0, 0); + this.tableLayoutPanel3.Name = "tableLayoutPanel3"; + this.tableLayoutPanel3.RowCount = 1; + this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tableLayoutPanel3.Size = new System.Drawing.Size(433, 29); + this.tableLayoutPanel3.TabIndex = 2; + // + // picHelp + // + this.picHelp.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.picHelp.Image = global::Mesen.GUI.Properties.Resources.Help; + this.picHelp.Location = new System.Drawing.Point(201, 6); + this.picHelp.Name = "picHelp"; + this.picHelp.Size = new System.Drawing.Size(16, 16); + this.picHelp.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; + this.picHelp.TabIndex = 5; + this.picHelp.TabStop = false; + // + // toolTip + // + this.toolTip.AutomaticDelay = 0; + this.toolTip.AutoPopDelay = 32700; + this.toolTip.InitialDelay = 10; + this.toolTip.ReshowDelay = 10; + // // ctrlMemoryAccessCounters // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.tableLayoutPanel1); - this.Margin = new System.Windows.Forms.Padding(0, 0, 0, 0); + this.Margin = new System.Windows.Forms.Padding(0); this.Name = "ctrlMemoryAccessCounters"; this.Size = new System.Drawing.Size(514, 307); this.flowLayoutPanel1.ResumeLayout(false); @@ -215,6 +257,9 @@ this.tableLayoutPanel2.PerformLayout(); this.flowLayoutPanel2.ResumeLayout(false); this.flowLayoutPanel2.PerformLayout(); + this.tableLayoutPanel3.ResumeLayout(false); + this.tableLayoutPanel3.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.picHelp)).EndInit(); this.ResumeLayout(false); } @@ -232,5 +277,8 @@ private System.Windows.Forms.CheckBox chkHighlightUninitRead; private System.Windows.Forms.Button btnReset; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3; + private System.Windows.Forms.PictureBox picHelp; + private System.Windows.Forms.ToolTip toolTip; } } diff --git a/GUI.NET/Debugger/Controls/ctrlMemoryAccessCounters.cs b/GUI.NET/Debugger/Controls/ctrlMemoryAccessCounters.cs index 2e28e86b..1b881208 100644 --- a/GUI.NET/Debugger/Controls/ctrlMemoryAccessCounters.cs +++ b/GUI.NET/Debugger/Controls/ctrlMemoryAccessCounters.cs @@ -22,6 +22,7 @@ namespace Mesen.GUI.Debugger.Controls InitializeComponent(); this.ctrlScrollableTextbox.FontSize = BaseControl.DefaultFontSize; + this.toolTip.SetToolTip(chkHighlightUninitRead, "The uninitialized memory reads highlight will only be accurate if the debugger was active when the game was loaded (or if the game has been power cycled since)"); bool designMode = (LicenseManager.UsageMode == LicenseUsageMode.Designtime); if(!designMode) { diff --git a/GUI.NET/Debugger/Controls/ctrlMemoryAccessCounters.resx b/GUI.NET/Debugger/Controls/ctrlMemoryAccessCounters.resx index 1af7de15..8766f298 100644 --- a/GUI.NET/Debugger/Controls/ctrlMemoryAccessCounters.resx +++ b/GUI.NET/Debugger/Controls/ctrlMemoryAccessCounters.resx @@ -117,4 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + \ No newline at end of file diff --git a/GUI.NET/Debugger/HexBox/HexBox.cs b/GUI.NET/Debugger/HexBox/HexBox.cs index fca4f2a6..118d9745 100644 --- a/GUI.NET/Debugger/HexBox/HexBox.cs +++ b/GUI.NET/Debugger/HexBox/HexBox.cs @@ -2981,7 +2981,7 @@ namespace Be.Windows.Forms _recHex.Y, (int)(_charSize.Width * _iHexMaxHBytes), _recHex.Height); - requiredWidth += _recStringView.Width; + requiredWidth += _recStringView.Width + 40; } else { diff --git a/GUI.NET/Debugger/frmMemoryViewer.Designer.cs b/GUI.NET/Debugger/frmMemoryViewer.Designer.cs index a4fce66a..4490b72d 100644 --- a/GUI.NET/Debugger/frmMemoryViewer.Designer.cs +++ b/GUI.NET/Debugger/frmMemoryViewer.Designer.cs @@ -82,20 +82,20 @@ this.btnExport = new System.Windows.Forms.ToolStripButton(); this.tabMain = new System.Windows.Forms.TabControl(); this.tpgMemoryViewer = new System.Windows.Forms.TabPage(); + this.panel1 = new System.Windows.Forms.Panel(); this.tpgAccessCounters = new System.Windows.Forms.TabPage(); this.ctrlMemoryAccessCounters = new Mesen.GUI.Debugger.Controls.ctrlMemoryAccessCounters(); this.tpgProfiler = new System.Windows.Forms.TabPage(); this.ctrlProfiler = new Mesen.GUI.Debugger.Controls.ctrlProfiler(); this.tmrRefresh = new System.Windows.Forms.Timer(this.components); - this.panel1 = new System.Windows.Forms.Panel(); this.flowLayoutPanel1.SuspendLayout(); this.menuStrip1.SuspendLayout(); this.toolStrip1.SuspendLayout(); this.tabMain.SuspendLayout(); this.tpgMemoryViewer.SuspendLayout(); + this.panel1.SuspendLayout(); this.tpgAccessCounters.SuspendLayout(); this.tpgProfiler.SuspendLayout(); - this.panel1.SuspendLayout(); this.SuspendLayout(); // // ctrlHexViewer @@ -103,7 +103,7 @@ this.ctrlHexViewer.Dock = System.Windows.Forms.DockStyle.Fill; this.ctrlHexViewer.Location = new System.Drawing.Point(0, 0); this.ctrlHexViewer.Name = "ctrlHexViewer"; - this.ctrlHexViewer.Size = new System.Drawing.Size(671, 352); + this.ctrlHexViewer.Size = new System.Drawing.Size(606, 318); this.ctrlHexViewer.TabIndex = 0; this.ctrlHexViewer.RequiredWidthChanged += new System.EventHandler(this.ctrlHexViewer_RequiredWidthChanged); this.ctrlHexViewer.InitializeContextMenu += new System.EventHandler(this.ctrlHexViewer_InitializeContextMenu); @@ -162,7 +162,7 @@ this.toolStripMenuItem1}); this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Size = new System.Drawing.Size(679, 24); + this.menuStrip1.Size = new System.Drawing.Size(614, 24); this.menuStrip1.TabIndex = 2; this.menuStrip1.Text = "menuStrip1"; // @@ -513,7 +513,7 @@ this.btnExport}); this.toolStrip1.Location = new System.Drawing.Point(0, 0); this.toolStrip1.Name = "toolStrip1"; - this.toolStrip1.Size = new System.Drawing.Size(671, 25); + this.toolStrip1.Size = new System.Drawing.Size(606, 25); this.toolStrip1.TabIndex = 3; this.toolStrip1.Text = "toolStrip1"; // @@ -544,7 +544,7 @@ this.tabMain.Location = new System.Drawing.Point(0, 24); this.tabMain.Name = "tabMain"; this.tabMain.SelectedIndex = 0; - this.tabMain.Size = new System.Drawing.Size(679, 403); + this.tabMain.Size = new System.Drawing.Size(614, 369); this.tabMain.TabIndex = 4; this.tabMain.SelectedIndexChanged += new System.EventHandler(this.tabMain_SelectedIndexChanged); // @@ -554,17 +554,27 @@ this.tpgMemoryViewer.Controls.Add(this.toolStrip1); this.tpgMemoryViewer.Location = new System.Drawing.Point(4, 22); this.tpgMemoryViewer.Name = "tpgMemoryViewer"; - this.tpgMemoryViewer.Size = new System.Drawing.Size(671, 377); + this.tpgMemoryViewer.Size = new System.Drawing.Size(606, 343); this.tpgMemoryViewer.TabIndex = 0; this.tpgMemoryViewer.Text = "Memory Viewer"; this.tpgMemoryViewer.UseVisualStyleBackColor = true; // + // panel1 + // + this.panel1.Controls.Add(this.flowLayoutPanel1); + this.panel1.Controls.Add(this.ctrlHexViewer); + this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel1.Location = new System.Drawing.Point(0, 25); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(606, 318); + this.panel1.TabIndex = 4; + // // tpgAccessCounters // this.tpgAccessCounters.Controls.Add(this.ctrlMemoryAccessCounters); this.tpgAccessCounters.Location = new System.Drawing.Point(4, 22); this.tpgAccessCounters.Name = "tpgAccessCounters"; - this.tpgAccessCounters.Size = new System.Drawing.Size(671, 377); + this.tpgAccessCounters.Size = new System.Drawing.Size(606, 343); this.tpgAccessCounters.TabIndex = 1; this.tpgAccessCounters.Text = "Access Counters"; this.tpgAccessCounters.UseVisualStyleBackColor = true; @@ -575,7 +585,7 @@ this.ctrlMemoryAccessCounters.Location = new System.Drawing.Point(0, 0); this.ctrlMemoryAccessCounters.Margin = new System.Windows.Forms.Padding(0); this.ctrlMemoryAccessCounters.Name = "ctrlMemoryAccessCounters"; - this.ctrlMemoryAccessCounters.Size = new System.Drawing.Size(671, 377); + this.ctrlMemoryAccessCounters.Size = new System.Drawing.Size(606, 343); this.ctrlMemoryAccessCounters.TabIndex = 0; // // tpgProfiler @@ -583,7 +593,7 @@ this.tpgProfiler.Controls.Add(this.ctrlProfiler); this.tpgProfiler.Location = new System.Drawing.Point(4, 22); this.tpgProfiler.Name = "tpgProfiler"; - this.tpgProfiler.Size = new System.Drawing.Size(671, 377); + this.tpgProfiler.Size = new System.Drawing.Size(606, 343); this.tpgProfiler.TabIndex = 2; this.tpgProfiler.Text = "Profiler"; this.tpgProfiler.UseVisualStyleBackColor = true; @@ -593,7 +603,7 @@ this.ctrlProfiler.Dock = System.Windows.Forms.DockStyle.Fill; this.ctrlProfiler.Location = new System.Drawing.Point(0, 0); this.ctrlProfiler.Name = "ctrlProfiler"; - this.ctrlProfiler.Size = new System.Drawing.Size(671, 377); + this.ctrlProfiler.Size = new System.Drawing.Size(606, 343); this.ctrlProfiler.TabIndex = 0; // // tmrRefresh @@ -601,25 +611,15 @@ this.tmrRefresh.Enabled = true; this.tmrRefresh.Tick += new System.EventHandler(this.tmrRefresh_Tick); // - // panel1 - // - this.panel1.Controls.Add(this.flowLayoutPanel1); - this.panel1.Controls.Add(this.ctrlHexViewer); - this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; - this.panel1.Location = new System.Drawing.Point(0, 25); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(671, 352); - this.panel1.TabIndex = 4; - // // frmMemoryViewer // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(679, 427); + this.ClientSize = new System.Drawing.Size(614, 393); this.Controls.Add(this.tabMain); this.Controls.Add(this.menuStrip1); this.MainMenuStrip = this.menuStrip1; - this.MinimumSize = new System.Drawing.Size(695, 465); + this.MinimumSize = new System.Drawing.Size(429, 337); this.Name = "frmMemoryViewer"; this.Text = "Memory Tools"; this.flowLayoutPanel1.ResumeLayout(false); @@ -631,10 +631,10 @@ this.tabMain.ResumeLayout(false); this.tpgMemoryViewer.ResumeLayout(false); this.tpgMemoryViewer.PerformLayout(); - this.tpgAccessCounters.ResumeLayout(false); - this.tpgProfiler.ResumeLayout(false); this.panel1.ResumeLayout(false); this.panel1.PerformLayout(); + this.tpgAccessCounters.ResumeLayout(false); + this.tpgProfiler.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); diff --git a/GUI.NET/Debugger/frmMemoryViewer.cs b/GUI.NET/Debugger/frmMemoryViewer.cs index a5a87bf1..a394628e 100644 --- a/GUI.NET/Debugger/frmMemoryViewer.cs +++ b/GUI.NET/Debugger/frmMemoryViewer.cs @@ -32,10 +32,6 @@ namespace Mesen.GUI.Debugger { base.OnLoad(e); - if(!ConfigManager.Config.DebugInfo.MemoryViewerSize.IsEmpty) { - this.Size = ConfigManager.Config.DebugInfo.MemoryViewerSize; - } - this.mnuAutoRefresh.Checked = ConfigManager.Config.DebugInfo.RamAutoRefresh; this.mnuShowCharacters.Checked = ConfigManager.Config.DebugInfo.RamShowCharacters; this.ctrlHexViewer.SetFontSize((int)ConfigManager.Config.DebugInfo.RamFontSize); @@ -62,12 +58,18 @@ namespace Mesen.GUI.Debugger _notifListener.OnNotification += _notifListener_OnNotification; this.mnuShowCharacters.CheckedChanged += new EventHandler(this.mnuShowCharacters_CheckedChanged); + + if(!ConfigManager.Config.DebugInfo.MemoryViewerSize.IsEmpty) { + this.Size = ConfigManager.Config.DebugInfo.MemoryViewerSize; + } } protected override void OnFormClosing(FormClosingEventArgs e) { base.OnFormClosing(e); + UpdateConfig(); ConfigManager.Config.DebugInfo.MemoryViewerSize = this.WindowState == FormWindowState.Maximized ? this.RestoreBounds.Size : this.Size; + ConfigManager.ApplyChanges(); DebugWorkspaceManager.SaveWorkspace(); } @@ -276,7 +278,7 @@ namespace Mesen.GUI.Debugger private void ctrlHexViewer_RequiredWidthChanged(object sender, EventArgs e) { - this.Size = new Size(this.ctrlHexViewer.RequiredWidth + this.Width - this.ctrlHexViewer.Width + 30, this.Height); + this.Size = new Size(this.ctrlHexViewer.RequiredWidth + 20, this.Height); } private void mnuLoadTblFile_Click(object sender, EventArgs e)