mirror of
https://github.com/SourMesen/Mesen.git
synced 2025-04-02 10:52:48 -04:00
Debugger: Added "Show In Split View" shortcut in code window
This commit is contained in:
parent
c1df2c92dd
commit
0fd4b0bd5f
4 changed files with 63 additions and 7 deletions
|
@ -53,7 +53,9 @@
|
|||
this.sepAddToWatch = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.mnuAddToWatch = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mnuFindOccurrences = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.mnuGoToLocation = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mnuShowInSplitView = 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();
|
||||
|
@ -101,12 +103,14 @@
|
|||
this.sepAddToWatch,
|
||||
this.mnuAddToWatch,
|
||||
this.mnuFindOccurrences,
|
||||
this.toolStripMenuItem2,
|
||||
this.mnuGoToLocation,
|
||||
this.mnuShowInSplitView,
|
||||
this.toolStripMenuItem3,
|
||||
this.mnuNavigateBackward,
|
||||
this.mnuNavigateForward});
|
||||
this.contextMenuCode.Name = "contextMenuWatch";
|
||||
this.contextMenuCode.Size = new System.Drawing.Size(259, 364);
|
||||
this.contextMenuCode.Size = new System.Drawing.Size(259, 414);
|
||||
this.contextMenuCode.Closed += new System.Windows.Forms.ToolStripDropDownClosedEventHandler(this.contextMenuCode_Closed);
|
||||
this.contextMenuCode.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuCode_Opening);
|
||||
//
|
||||
|
@ -291,6 +295,11 @@
|
|||
this.mnuFindOccurrences.Text = "Find Occurrences";
|
||||
this.mnuFindOccurrences.Click += new System.EventHandler(this.mnuFindOccurrences_Click);
|
||||
//
|
||||
// toolStripMenuItem2
|
||||
//
|
||||
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
|
||||
this.toolStripMenuItem2.Size = new System.Drawing.Size(255, 6);
|
||||
//
|
||||
// mnuGoToLocation
|
||||
//
|
||||
this.mnuGoToLocation.Name = "mnuGoToLocation";
|
||||
|
@ -299,6 +308,15 @@
|
|||
this.mnuGoToLocation.Text = "Go to Location";
|
||||
this.mnuGoToLocation.Click += new System.EventHandler(this.mnuGoToLocation_Click);
|
||||
//
|
||||
// mnuShowInSplitView
|
||||
//
|
||||
this.mnuShowInSplitView.Image = global::Mesen.GUI.Properties.Resources.SplitView;
|
||||
this.mnuShowInSplitView.Name = "mnuShowInSplitView";
|
||||
this.mnuShowInSplitView.ShortcutKeyDisplayString = "Ctrl+Alt+Click";
|
||||
this.mnuShowInSplitView.Size = new System.Drawing.Size(258, 22);
|
||||
this.mnuShowInSplitView.Text = "Show in Split View";
|
||||
this.mnuShowInSplitView.Click += new System.EventHandler(this.mnuShowInSplitView_Click);
|
||||
//
|
||||
// toolStripMenuItem3
|
||||
//
|
||||
this.toolStripMenuItem3.Name = "toolStripMenuItem3";
|
||||
|
@ -548,5 +566,7 @@
|
|||
private System.Windows.Forms.ToolStripMenuItem mnuEditSelectedCode;
|
||||
private System.Windows.Forms.ToolStripMenuItem copySelectionToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuEditInMemoryViewer;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem2;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuShowInSplitView;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,11 +15,12 @@ namespace Mesen.GUI.Debugger
|
|||
{
|
||||
public partial class ctrlDebuggerCode : BaseScrollableTextboxUserControl
|
||||
{
|
||||
public delegate void AddressEventHandler(AddressEventArgs args);
|
||||
public delegate void AddressEventHandler(ctrlDebuggerCode sender, AddressEventArgs args);
|
||||
public delegate void WatchEventHandler(WatchEventArgs args);
|
||||
public delegate void AssemblerEventHandler(AssemblerEventArgs args);
|
||||
public event AssemblerEventHandler OnEditCode;
|
||||
public event AddressEventHandler OnSetNextStatement;
|
||||
public event AddressEventHandler OnScrollToAddress;
|
||||
private DebugViewInfo _config;
|
||||
|
||||
List<int> _lineNumbers = new List<int>(10000);
|
||||
|
@ -485,6 +486,9 @@ namespace Mesen.GUI.Debugger
|
|||
mnuGoToLocation.Enabled = true;
|
||||
mnuGoToLocation.Text = $"Go to Location ({word})";
|
||||
|
||||
mnuShowInSplitView.Enabled = true;
|
||||
mnuShowInSplitView.Text = $"Show in Split View ({word})";
|
||||
|
||||
mnuAddToWatch.Enabled = true;
|
||||
mnuAddToWatch.Text = $"Add to Watch ({word})";
|
||||
|
||||
|
@ -501,6 +505,8 @@ namespace Mesen.GUI.Debugger
|
|||
} else {
|
||||
mnuGoToLocation.Enabled = false;
|
||||
mnuGoToLocation.Text = "Go to Location";
|
||||
mnuShowInSplitView.Enabled = false;
|
||||
mnuShowInSplitView.Text = "Show in Split View";
|
||||
mnuAddToWatch.Enabled = false;
|
||||
mnuAddToWatch.Text = "Add to Watch";
|
||||
mnuFindOccurrences.Enabled = false;
|
||||
|
@ -523,6 +529,8 @@ namespace Mesen.GUI.Debugger
|
|||
_newWatchValue = $"[{address}]";
|
||||
_lastWord = address;
|
||||
|
||||
mnuShowInSplitView.Enabled = true;
|
||||
mnuShowInSplitView.Text = $"Show in Split View ({address})";
|
||||
mnuAddToWatch.Enabled = true;
|
||||
mnuAddToWatch.Text = $"Add to Watch ({address})";
|
||||
mnuFindOccurrences.Enabled = true;
|
||||
|
@ -560,7 +568,9 @@ namespace Mesen.GUI.Debugger
|
|||
{
|
||||
if(UpdateContextMenu(e.Location)) {
|
||||
if(e.Button == MouseButtons.Left) {
|
||||
if(ModifierKeys.HasFlag(Keys.Control)) {
|
||||
if(ModifierKeys.HasFlag(Keys.Control) && ModifierKeys.HasFlag(Keys.Alt)) {
|
||||
ShowInSplitView();
|
||||
} else if(ModifierKeys.HasFlag(Keys.Control)) {
|
||||
AddWatch();
|
||||
} else if(ModifierKeys.HasFlag(Keys.Alt)) {
|
||||
FindAllOccurrences(_lastWord, true, true);
|
||||
|
@ -724,6 +734,16 @@ namespace Mesen.GUI.Debugger
|
|||
this.ctrlCodeViewer.ScrollToLineNumber((int)_lastClickedAddress);
|
||||
}
|
||||
|
||||
private void mnuShowInSplitView_Click(object sender, EventArgs e)
|
||||
{
|
||||
ShowInSplitView();
|
||||
}
|
||||
|
||||
private void ShowInSplitView()
|
||||
{
|
||||
this.OnScrollToAddress?.Invoke(this, new AddressEventArgs() { Address = (UInt32)_lastClickedAddress });
|
||||
}
|
||||
|
||||
private void AddWatch()
|
||||
{
|
||||
WatchManager.AddWatch(_newWatchValue);
|
||||
|
@ -731,9 +751,7 @@ namespace Mesen.GUI.Debugger
|
|||
|
||||
private void mnuSetNextStatement_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(this.OnSetNextStatement != null) {
|
||||
this.OnSetNextStatement(new AddressEventArgs() { Address = (UInt32)this.ctrlCodeViewer.CurrentLine });
|
||||
}
|
||||
this.OnSetNextStatement?.Invoke(this, new AddressEventArgs() { Address = (UInt32)this.ctrlCodeViewer.CurrentLine });
|
||||
}
|
||||
|
||||
private void ctrlCodeViewer_FontSizeChanged(object sender, EventArgs e)
|
||||
|
|
2
GUI.NET/Debugger/frmDebugger.Designer.cs
generated
2
GUI.NET/Debugger/frmDebugger.Designer.cs
generated
|
@ -261,6 +261,7 @@ namespace Mesen.GUI.Debugger
|
|||
this.ctrlDebuggerCode.Size = new System.Drawing.Size(384, 394);
|
||||
this.ctrlDebuggerCode.TabIndex = 2;
|
||||
this.ctrlDebuggerCode.OnEditCode += new Mesen.GUI.Debugger.ctrlDebuggerCode.AssemblerEventHandler(this.ctrlDebuggerCode_OnEditCode);
|
||||
this.ctrlDebuggerCode.OnScrollToAddress += new Mesen.GUI.Debugger.ctrlDebuggerCode.AddressEventHandler(this.ctrlDebuggerCode_OnScrollToAddress);
|
||||
this.ctrlDebuggerCode.OnSetNextStatement += new Mesen.GUI.Debugger.ctrlDebuggerCode.AddressEventHandler(this.ctrlDebuggerCode_OnSetNextStatement);
|
||||
this.ctrlDebuggerCode.Enter += new System.EventHandler(this.ctrlDebuggerCode_Enter);
|
||||
//
|
||||
|
@ -284,6 +285,7 @@ namespace Mesen.GUI.Debugger
|
|||
this.ctrlDebuggerCodeSplit.TabIndex = 4;
|
||||
this.ctrlDebuggerCodeSplit.Visible = false;
|
||||
this.ctrlDebuggerCodeSplit.OnEditCode += new Mesen.GUI.Debugger.ctrlDebuggerCode.AssemblerEventHandler(this.ctrlDebuggerCode_OnEditCode);
|
||||
this.ctrlDebuggerCodeSplit.OnScrollToAddress += new Mesen.GUI.Debugger.ctrlDebuggerCode.AddressEventHandler(this.ctrlDebuggerCode_OnScrollToAddress);
|
||||
this.ctrlDebuggerCodeSplit.OnSetNextStatement += new Mesen.GUI.Debugger.ctrlDebuggerCode.AddressEventHandler(this.ctrlDebuggerCode_OnSetNextStatement);
|
||||
this.ctrlDebuggerCodeSplit.Enter += new System.EventHandler(this.ctrlDebuggerCodeSplit_Enter);
|
||||
//
|
||||
|
|
|
@ -462,8 +462,24 @@ namespace Mesen.GUI.Debugger
|
|||
ctrlConsoleStatus.ApplyChanges();
|
||||
InteropEmu.DebugPpuStep(89341);
|
||||
}
|
||||
|
||||
private void ctrlDebuggerCode_OnScrollToAddress(ctrlDebuggerCode sender, AddressEventArgs args)
|
||||
{
|
||||
UInt16 addr = (UInt16)args.Address;
|
||||
if(sender == ctrlDebuggerCode) {
|
||||
if(!ConfigManager.Config.DebugInfo.SplitView) {
|
||||
mnuSplitView.Checked = true;
|
||||
ConfigManager.Config.DebugInfo.SplitView = true;
|
||||
ConfigManager.ApplyChanges();
|
||||
UpdateDebugger(false);
|
||||
}
|
||||
ctrlDebuggerCodeSplit.ScrollToLineNumber(addr);
|
||||
} else {
|
||||
ctrlDebuggerCode.ScrollToLineNumber(addr);
|
||||
}
|
||||
}
|
||||
|
||||
private void ctrlDebuggerCode_OnSetNextStatement(AddressEventArgs args)
|
||||
private void ctrlDebuggerCode_OnSetNextStatement(ctrlDebuggerCode sender, AddressEventArgs args)
|
||||
{
|
||||
UInt16 addr = (UInt16)args.Address;
|
||||
InteropEmu.DebugSetNextStatement(addr);
|
||||
|
|
Loading…
Add table
Reference in a new issue