From 83ba7796f914b7aa62073823ee4a67dee95ca626 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sat, 20 Dec 2014 14:45:06 +0000 Subject: [PATCH] Debugger - tooltips on disabled things, explaining the situation --- .../tools/Debugger/BreakpointControl.cs | 1 + .../Debugger/GenericDebugger.Designer.cs | 5 ++ .../tools/Debugger/GenericDebugger.cs | 48 +++++++++++++++++++ .../tools/Debugger/GenericDebugger.resx | 3 ++ 4 files changed, 57 insertions(+) diff --git a/BizHawk.Client.EmuHawk/tools/Debugger/BreakpointControl.cs b/BizHawk.Client.EmuHawk/tools/Debugger/BreakpointControl.cs index 429b22be22..8329b89f65 100644 --- a/BizHawk.Client.EmuHawk/tools/Debugger/BreakpointControl.cs +++ b/BizHawk.Client.EmuHawk/tools/Debugger/BreakpointControl.cs @@ -89,6 +89,7 @@ namespace BizHawk.Client.EmuHawk.tools.Debugger else { this.Enabled = false; + ParentDebugger.DisableBreakpointBox(); } } diff --git a/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.Designer.cs b/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.Designer.cs index dc9fe509f1..063f741ac3 100644 --- a/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.Designer.cs +++ b/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.Designer.cs @@ -28,6 +28,7 @@ /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(GenericDebugger)); this.menuStrip1 = new MenuStripEx(); this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -55,6 +56,7 @@ this.StepOutBtn = new System.Windows.Forms.Button(); this.StepIntoBtn = new System.Windows.Forms.Button(); this.StepOverBtn = new System.Windows.Forms.Button(); + this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.menuStrip1.SuspendLayout(); this.RegistersGroupBox.SuspendLayout(); this.BreakpointsGroupBox.SuspendLayout(); @@ -227,6 +229,7 @@ | System.Windows.Forms.AnchorStyles.Right))); this.BreakPointControl1.Core = null; this.BreakPointControl1.Location = new System.Drawing.Point(8, 19); + this.BreakPointControl1.MCS = null; this.BreakPointControl1.Name = "BreakPointControl1"; this.BreakPointControl1.ParentDebugger = null; this.BreakPointControl1.Size = new System.Drawing.Size(225, 256); @@ -339,6 +342,7 @@ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Debugger"; this.Load += new System.EventHandler(this.GenericDebugger_Load); + this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.GenericDebugger_MouseMove); this.menuStrip1.ResumeLayout(false); this.menuStrip1.PerformLayout(); this.RegistersGroupBox.ResumeLayout(false); @@ -378,5 +382,6 @@ private System.Windows.Forms.ToolStripMenuItem StepIntoMenuItem; private System.Windows.Forms.ToolStripMenuItem StepOverMenuItem; private System.Windows.Forms.ToolStripMenuItem StepOutMenuItem; + private System.Windows.Forms.ToolTip toolTip1; } } \ No newline at end of file diff --git a/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.cs b/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.cs index 6cd7e77ad9..c54bd03e5f 100644 --- a/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.cs +++ b/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.cs @@ -77,6 +77,13 @@ namespace BizHawk.Client.EmuHawk public void DisableRegisterBox() { RegistersGroupBox.Enabled = false; + toolTip1.SetToolTip(RegistersGroupBox, "This core does not currently support reading registers"); + } + + public void DisableBreakpointBox() + { + BreakpointsGroupBox.Enabled = false; + toolTip1.SetToolTip(BreakpointsGroupBox, "This core does not currently support breakpoints"); } private void OnCpuDropDownIndexChanged(object sender, EventArgs e) @@ -130,6 +137,8 @@ namespace BizHawk.Client.EmuHawk Location = new Point(35, 23), Text = "Unknown" }); + + toolTip1.SetToolTip(DisassemblerBox, "This core does not currently support disassembling"); } RegisterPanel.Core = Debuggable; @@ -144,6 +153,21 @@ namespace BizHawk.Client.EmuHawk StepIntoMenuItem.Enabled = StepIntoBtn.Enabled = CanStepInto; StepOutMenuItem.Enabled = StepOutBtn.Enabled = CanStepOut; StepOverMenuItem.Enabled = StepOverBtn.Enabled = CanStepOver; + + if (!StepIntoMenuItem.Enabled) + { + toolTip1.SetToolTip(StepIntoBtn, "This core does not currently implement this feature"); + } + + if (!StepOutMenuItem.Enabled) + { + toolTip1.SetToolTip(StepOutBtn, "This core does not currently implement this feature"); + } + + if (!StepOverMenuItem.Enabled) + { + toolTip1.SetToolTip(StepOverBtn, "This core does not currently implement this feature"); + } } private void DisengageDebugger() @@ -339,5 +363,29 @@ namespace BizHawk.Client.EmuHawk return base.ProcessCmdKey(ref msg, keyData); } } + + private Control _currentToolTipControl = null; + private void GenericDebugger_MouseMove(object sender, MouseEventArgs e) + { + var control = GetChildAtPoint(e.Location); + if (control != null) + { + if (!control.Enabled && _currentToolTipControl == null) + { + string toolTipString = toolTip1.GetToolTip(control); + toolTip1.Show(toolTipString, control, control.Width / 2, control.Height / 2); + _currentToolTipControl = control; + } + } + else + { + if (_currentToolTipControl != null) + { + toolTip1.Hide(_currentToolTipControl); + } + + _currentToolTipControl = null; + } + } } } diff --git a/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.resx b/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.resx index 20de0324f7..8bc76d63e4 100644 --- a/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.resx +++ b/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.resx @@ -120,6 +120,9 @@ 17, 17 + + 132, 17 +