From 25e24e30b0966176d2fd82cb06966549ea698d07 Mon Sep 17 00:00:00 2001 From: Sour Date: Thu, 3 Jan 2019 12:14:37 -0500 Subject: [PATCH] Debugger: Automatically go into source view if we were in source view when we closed the debugger (when possible) --- GUI.NET/Config/DebugInfo.cs | 1 + GUI.NET/Debugger/frmDebugger.cs | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/GUI.NET/Config/DebugInfo.cs b/GUI.NET/Config/DebugInfo.cs index dc029ca4..0203c89a 100644 --- a/GUI.NET/Config/DebugInfo.cs +++ b/GUI.NET/Config/DebugInfo.cs @@ -34,6 +34,7 @@ namespace Mesen.GUI.Config public ByteCodePosition ByteCodePosition = ByteCodePosition.Hidden; public PrgAddressPosition PrgAddressPosition = PrgAddressPosition.Hidden; public int TextZoom = 100; + public bool UsingSourceView = false; } public class DebugWorkspace diff --git a/GUI.NET/Debugger/frmDebugger.cs b/GUI.NET/Debugger/frmDebugger.cs index c3a9b0d8..e2c6f86f 100644 --- a/GUI.NET/Debugger/frmDebugger.cs +++ b/GUI.NET/Debugger/frmDebugger.cs @@ -645,6 +645,14 @@ namespace Mesen.GUI.Debugger ResumeExecution(); } _firstBreak = false; + + //Switch to source viewer after reopening debugger if we were in source viewer when we closed it + if(ctrlSourceViewer.CurrentFile != null && ConfigManager.Config.DebugInfo.LeftView.UsingSourceView) { + ctrlDebuggerCode_OnSwitchView(this.ctrlDebuggerCode); + } + if(ctrlSourceViewerSplit.CurrentFile != null && ConfigManager.Config.DebugInfo.RightView.UsingSourceView) { + ctrlDebuggerCode_OnSwitchView(this.ctrlDebuggerCodeSplit); + } } } @@ -961,6 +969,10 @@ namespace Mesen.GUI.Debugger ConfigManager.Config.DebugInfo.WindowHeight = this.WindowState != FormWindowState.Normal ? this.RestoreBounds.Height : this.Height; ConfigManager.Config.DebugInfo.TopPanelHeight = this.splitContainer.GetSplitterDistance(); ConfigManager.Config.DebugInfo.LeftPanelWidth = this.ctrlSplitContainerTop.GetSplitterDistance(); + + ConfigManager.Config.DebugInfo.LeftView.UsingSourceView = this.ctrlSourceViewer.Visible; + ConfigManager.Config.DebugInfo.RightView.UsingSourceView = this.ctrlSourceViewerSplit.Visible; + ConfigManager.ApplyChanges(); DebugWorkspaceManager.SaveWorkspace();