From e0b6c4f9000abe8cb963f2e22ec03304dc281c00 Mon Sep 17 00:00:00 2001 From: Sour Date: Sat, 12 Jan 2019 22:20:43 -0500 Subject: [PATCH] Debugger: Added ability to configure an external code editor (for use in Source View mode) --- GUI.NET/Config/DebugInfo.cs | 31 ++++ GUI.NET/Config/DebuggerShortcutsConfig.cs | 2 + .../Controls/CodeViewerActions.Designer.cs | 13 +- .../Debugger/Controls/CodeViewerActions.cs | 12 +- GUI.NET/Debugger/Controls/ICodeViewer.cs | 1 + GUI.NET/Debugger/Controls/ctrlDebuggerCode.cs | 5 + GUI.NET/Debugger/Controls/ctrlSourceViewer.cs | 23 +++ GUI.NET/Debugger/DbgImporter.cs | 2 + GUI.NET/Debugger/frmDbgPreferences.cs | 1 + GUI.NET/Debugger/frmDebugger.Designer.cs | 93 ++++++------ GUI.NET/Debugger/frmDebugger.cs | 7 + .../frmExternalEditorConfig.Designer.cs | 139 ++++++++++++++++++ GUI.NET/Debugger/frmExternalEditorConfig.cs | 27 ++++ GUI.NET/Debugger/frmExternalEditorConfig.resx | 123 ++++++++++++++++ GUI.NET/GUI.NET.csproj | 9 ++ 15 files changed, 445 insertions(+), 43 deletions(-) create mode 100644 GUI.NET/Debugger/frmExternalEditorConfig.Designer.cs create mode 100644 GUI.NET/Debugger/frmExternalEditorConfig.cs create mode 100644 GUI.NET/Debugger/frmExternalEditorConfig.resx diff --git a/GUI.NET/Config/DebugInfo.cs b/GUI.NET/Config/DebugInfo.cs index 391ec14b..8c8dcfc8 100644 --- a/GUI.NET/Config/DebugInfo.cs +++ b/GUI.NET/Config/DebugInfo.cs @@ -355,6 +355,9 @@ namespace Mesen.GUI.Config public bool TextHookerIgnoreMirroredNametables = true; public bool TextHookerAutoCopyToClipboard = false; + public string ExternalEditorPath; + public string ExternalEditorArguments; + public DebuggerShortcutsConfig Shortcuts = new DebuggerShortcutsConfig(); public DebugImportConfig ImportConfig = new DebugImportConfig(); @@ -374,6 +377,34 @@ namespace Mesen.GUI.Config UseLabels = false, StatusFormat = StatusFlagFormat.Hexadecimal }; + + if(ExternalEditorPath == null || ExternalEditorArguments == null) { + ExternalEditorPath = ""; + ExternalEditorArguments = ""; + + //Setup a default editor when possible + if(Program.IsMono) { + string geditPath = "/usr/bin/gedit"; + string katePath = "/usr/bin/kate"; + if(File.Exists(geditPath)) { + ExternalEditorPath = geditPath; + ExternalEditorArguments = "+%L %F"; + } else if(File.Exists(katePath)) { + ExternalEditorPath = katePath; + ExternalEditorArguments = "%F -l %L"; + } + } else { + string notepadPath32 = "C:\\Program Files (x86)\\Notepad++\\notepad++.exe"; + string notepadPath64 = "C:\\Program Files\\Notepad++\\notepad++.exe"; + if(File.Exists(notepadPath32)) { + ExternalEditorPath = notepadPath32; + ExternalEditorArguments = "%F -n%L"; + } else if(File.Exists(notepadPath64)) { + ExternalEditorPath = notepadPath64; + ExternalEditorArguments = "%F -n%L"; + } + } + } } static public void ApplyConfig() diff --git a/GUI.NET/Config/DebuggerShortcutsConfig.cs b/GUI.NET/Config/DebuggerShortcutsConfig.cs index 84443970..188aa946 100644 --- a/GUI.NET/Config/DebuggerShortcutsConfig.cs +++ b/GUI.NET/Config/DebuggerShortcutsConfig.cs @@ -127,6 +127,8 @@ namespace Mesen.GUI.Config public XmlKeys CodeWindow_EditSubroutine = Keys.F4; [ShortcutName("Code Window: Edit Selected Code")] public XmlKeys CodeWindow_EditSelectedCode = Keys.None; + [ShortcutName("Code Window: Edit Source File (Source View)")] + public XmlKeys CodeWindow_EditSourceFile = Keys.F4; [ShortcutName("Code Window: Edit Label")] public XmlKeys CodeWindow_EditLabel = Keys.F2; [ShortcutName("Code Window: Navigate Back")] diff --git a/GUI.NET/Debugger/Controls/CodeViewerActions.Designer.cs b/GUI.NET/Debugger/Controls/CodeViewerActions.Designer.cs index 1c28b0ef..c62432e7 100644 --- a/GUI.NET/Debugger/Controls/CodeViewerActions.Designer.cs +++ b/GUI.NET/Debugger/Controls/CodeViewerActions.Designer.cs @@ -69,6 +69,7 @@ this.sepSwitchView = new System.Windows.Forms.ToolStripSeparator(); this.mnuSwitchView = new System.Windows.Forms.ToolStripMenuItem(); this.mnuShowSourceAsComments = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuEditSourceFile = new System.Windows.Forms.ToolStripMenuItem(); this.contextMenu.SuspendLayout(); this.SuspendLayout(); // @@ -77,6 +78,7 @@ this.contextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.mnuMarkSelectionAs, this.sepMarkSelectionAs, + this.mnuEditSourceFile, this.mnuEditSelectedCode, this.mnuEditSubroutine, this.mnuUndoPrgChrEdit, @@ -104,7 +106,7 @@ this.mnuSwitchView, this.mnuShowSourceAsComments}); this.contextMenu.Name = "contextMenuWatch"; - this.contextMenu.Size = new System.Drawing.Size(254, 514); + this.contextMenu.Size = new System.Drawing.Size(254, 536); this.contextMenu.Closed += new System.Windows.Forms.ToolStripDropDownClosedEventHandler(this.contextMenuCode_Closed); this.contextMenu.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuCode_Opening); // @@ -402,6 +404,14 @@ this.mnuShowSourceAsComments.Text = "Show source code as comments"; this.mnuShowSourceAsComments.Click += new System.EventHandler(this.mnuShowSourceAsComments_Click); // + // mnuEditSourceFile + // + this.mnuEditSourceFile.Image = global::Mesen.GUI.Properties.Resources.Edit; + this.mnuEditSourceFile.Name = "mnuEditSourceFile"; + this.mnuEditSourceFile.Size = new System.Drawing.Size(253, 22); + this.mnuEditSourceFile.Text = "Edit Source File"; + this.mnuEditSourceFile.Click += new System.EventHandler(this.mnuEditSourceFile_Click); + // // CodeViewerActions // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -454,5 +464,6 @@ private System.Windows.Forms.ToolStripMenuItem mnuSwitchView; public System.Windows.Forms.ContextMenuStrip contextMenu; private System.Windows.Forms.ToolStripMenuItem mnuShowSourceAsComments; + private System.Windows.Forms.ToolStripMenuItem mnuEditSourceFile; } } diff --git a/GUI.NET/Debugger/Controls/CodeViewerActions.cs b/GUI.NET/Debugger/Controls/CodeViewerActions.cs index 2c8ed2c2..0fc7c591 100644 --- a/GUI.NET/Debugger/Controls/CodeViewerActions.cs +++ b/GUI.NET/Debugger/Controls/CodeViewerActions.cs @@ -68,6 +68,8 @@ namespace Mesen.GUI.Debugger.Controls mnuMarkAsCode.InitShortcut(parent, nameof(DebuggerShortcutsConfig.MarkAsCode)); mnuMarkAsData.InitShortcut(parent, nameof(DebuggerShortcutsConfig.MarkAsData)); mnuMarkAsUnidentifiedData.InitShortcut(parent, nameof(DebuggerShortcutsConfig.MarkAsUnidentified)); + } else { + mnuEditSourceFile.InitShortcut(parent, nameof(DebuggerShortcutsConfig.CodeWindow_EditSourceFile)); } } @@ -407,6 +409,11 @@ namespace Mesen.GUI.Debugger.Controls this.OnSetNextStatement?.Invoke(new AddressEventArgs() { Address = (UInt32)Viewer.CodeViewer.CurrentLine }); } + private void mnuEditSourceFile_Click(object sender, EventArgs e) + { + Viewer.EditSourceFile(); + } + private void mnuEditSubroutine_Click(object sender, EventArgs e) { Viewer.EditSubroutine(); @@ -462,6 +469,7 @@ namespace Mesen.GUI.Debugger.Controls { mnuEditSelectedCode.Enabled = true; mnuEditSubroutine.Enabled = true; + mnuEditSourceFile.Enabled = true; } public void UpdateContextMenuItemVisibility(ToolStripItemCollection items) @@ -475,7 +483,7 @@ namespace Mesen.GUI.Debugger.Controls items[nameof(mnuShowSourceAsComments)].Visible = hasSymbolProvider; items[nameof(mnuSwitchView)].Visible = hasSymbolProvider; items[nameof(sepSwitchView)].Visible = hasSymbolProvider; - + if(IsSourceView) { items[nameof(mnuMarkSelectionAs)].Visible = false; @@ -487,6 +495,8 @@ namespace Mesen.GUI.Debugger.Controls items[nameof(sepNavigation)].Visible = false; items[nameof(mnuShowSourceAsComments)].Visible = false; items[nameof(sepMarkSelectionAs)].Visible = false; + } else { + items[nameof(mnuEditSourceFile)].Visible = false; } } diff --git a/GUI.NET/Debugger/Controls/ICodeViewer.cs b/GUI.NET/Debugger/Controls/ICodeViewer.cs index 236f6e8c..fa7b1256 100644 --- a/GUI.NET/Debugger/Controls/ICodeViewer.cs +++ b/GUI.NET/Debugger/Controls/ICodeViewer.cs @@ -18,6 +18,7 @@ namespace Mesen.GUI.Debugger.Controls void SetConfig(DebugViewInfo config, bool disableActions = false); void EditSubroutine(); void EditSelectedCode(); + void EditSourceFile(); void SetMessage(TextboxMessageInfo message); diff --git a/GUI.NET/Debugger/Controls/ctrlDebuggerCode.cs b/GUI.NET/Debugger/Controls/ctrlDebuggerCode.cs index 4befd777..353a6513 100644 --- a/GUI.NET/Debugger/Controls/ctrlDebuggerCode.cs +++ b/GUI.NET/Debugger/Controls/ctrlDebuggerCode.cs @@ -354,6 +354,11 @@ namespace Mesen.GUI.Debugger } } + public void EditSourceFile() + { + //TODO: Not supported yet + } + public void FindAllOccurrences(Ld65DbgImporter.SymbolInfo symbol) { FindAllOccurrences(symbol.Name, true, true); diff --git a/GUI.NET/Debugger/Controls/ctrlSourceViewer.cs b/GUI.NET/Debugger/Controls/ctrlSourceViewer.cs index 9ee33c44..a3378fc4 100644 --- a/GUI.NET/Debugger/Controls/ctrlSourceViewer.cs +++ b/GUI.NET/Debugger/Controls/ctrlSourceViewer.cs @@ -12,6 +12,7 @@ using System.IO; using Mesen.GUI.Config; using Mesen.GUI.Controls; using System.Text.RegularExpressions; +using System.Diagnostics; namespace Mesen.GUI.Debugger.Controls { @@ -386,6 +387,28 @@ namespace Mesen.GUI.Debugger.Controls { //Not supported } + + public void EditSourceFile() + { + if(string.IsNullOrWhiteSpace(ConfigManager.Config.DebugInfo.ExternalEditorPath) || !File.Exists(ConfigManager.Config.DebugInfo.ExternalEditorPath)) { + using(frmExternalEditorConfig frm = new frmExternalEditorConfig()) { + frm.ShowDialog(null, this.ParentForm); + } + } + + if(File.Exists(ConfigManager.Config.DebugInfo.ExternalEditorPath)) { + string filePath = Path.Combine(_symbolProvider.DbgPath, CurrentFile.Name); + if(File.Exists(filePath)) { + filePath = "\"" + filePath + "\""; + string lineNumber = (ctrlCodeViewer.SelectedLine + 1).ToString(); + + Process.Start( + ConfigManager.Config.DebugInfo.ExternalEditorPath, + ConfigManager.Config.DebugInfo.ExternalEditorArguments.Replace("%F", filePath).Replace("%f", filePath).Replace("%L", lineNumber).Replace("%l", lineNumber) + ); + } + } + } public void FindAllOccurrences(SymbolInfo symbol) { diff --git a/GUI.NET/Debugger/DbgImporter.cs b/GUI.NET/Debugger/DbgImporter.cs index 68f36d4f..2ecc54fb 100644 --- a/GUI.NET/Debugger/DbgImporter.cs +++ b/GUI.NET/Debugger/DbgImporter.cs @@ -57,6 +57,7 @@ namespace Mesen.GUI.Debugger public Dictionary Files { get { return _files; } } public DateTime DbgFileStamp { get; private set; } + public string DbgPath { get; private set; } public int GetPrgAddress(int fileID, int lineIndex) { @@ -726,6 +727,7 @@ namespace Mesen.GUI.Debugger string[] fileRows = File.ReadAllLines(path); string basePath = Path.GetDirectoryName(path); + DbgPath = basePath; foreach(string row in fileRows) { try { if(LoadLines(row) || LoadSpans(row) || LoadSymbols(row) || LoadCSymbols(row) || LoadFiles(row, basePath) || LoadSegments(row)) { diff --git a/GUI.NET/Debugger/frmDbgPreferences.cs b/GUI.NET/Debugger/frmDbgPreferences.cs index f84defcd..f9ce1e5d 100644 --- a/GUI.NET/Debugger/frmDbgPreferences.cs +++ b/GUI.NET/Debugger/frmDbgPreferences.cs @@ -90,6 +90,7 @@ namespace Mesen.GUI.Debugger GetMember(nameof(DebuggerShortcutsConfig.CodeWindow_SetNextStatement)), GetMember(nameof(DebuggerShortcutsConfig.CodeWindow_EditSubroutine)), GetMember(nameof(DebuggerShortcutsConfig.CodeWindow_EditSelectedCode)), + GetMember(nameof(DebuggerShortcutsConfig.CodeWindow_EditSourceFile)), GetMember(nameof(DebuggerShortcutsConfig.CodeWindow_EditLabel)), GetMember(nameof(DebuggerShortcutsConfig.CodeWindow_NavigateBack)), GetMember(nameof(DebuggerShortcutsConfig.CodeWindow_NavigateForward)), diff --git a/GUI.NET/Debugger/frmDebugger.Designer.cs b/GUI.NET/Debugger/frmDebugger.Designer.cs index 58d9d872..6e0a807b 100644 --- a/GUI.NET/Debugger/frmDebugger.Designer.cs +++ b/GUI.NET/Debugger/frmDebugger.Designer.cs @@ -96,6 +96,8 @@ namespace Mesen.GUI.Debugger this.mnuBreakIn = new System.Windows.Forms.ToolStripMenuItem(); this.mnuBreakOn = new System.Windows.Forms.ToolStripMenuItem(); this.searchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuGoToAll = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem29 = new System.Windows.Forms.ToolStripSeparator(); this.mnuFind = new System.Windows.Forms.ToolStripMenuItem(); this.mnuFindNext = new System.Windows.Forms.ToolStripMenuItem(); this.mnuFindPrev = new System.Windows.Forms.ToolStripMenuItem(); @@ -109,7 +111,6 @@ namespace Mesen.GUI.Debugger this.mnuGoToResetHandler = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem23 = new System.Windows.Forms.ToolStripSeparator(); this.mnuGoToProgramCount = new System.Windows.Forms.ToolStripMenuItem(); - this.mnuGoToAll = new System.Windows.Forms.ToolStripMenuItem(); this.mnuOptions = new System.Windows.Forms.ToolStripMenuItem(); this.mnuDisassemblyOptions = new System.Windows.Forms.ToolStripMenuItem(); this.mnuDisassemble = new System.Windows.Forms.ToolStripMenuItem(); @@ -183,6 +184,7 @@ namespace Mesen.GUI.Debugger this.mnuRefreshWhileRunning = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem6 = new System.Windows.Forms.ToolStripSeparator(); this.mnuPreferences = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuConfigureExternalEditor = new System.Windows.Forms.ToolStripMenuItem(); this.toolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.mnuApuViewer = new System.Windows.Forms.ToolStripMenuItem(); this.mnuAssembler = new System.Windows.Forms.ToolStripMenuItem(); @@ -216,7 +218,6 @@ namespace Mesen.GUI.Debugger this.ctrlPpuMemoryMapping = new Mesen.GUI.Debugger.Controls.ctrlMemoryMapping(); this.ctrlCpuMemoryMapping = new Mesen.GUI.Debugger.Controls.ctrlMemoryMapping(); this.tsToolbar = new Mesen.GUI.Controls.ctrlMesenToolStrip(); - this.toolStripMenuItem29 = new System.Windows.Forms.ToolStripSeparator(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit(); this.splitContainer.Panel1.SuspendLayout(); this.splitContainer.Panel2.SuspendLayout(); @@ -261,7 +262,7 @@ namespace Mesen.GUI.Debugger this.splitContainer.Panel2.Controls.Add(this.tableLayoutPanel10); this.splitContainer.Panel2MinSize = 100; this.splitContainer.Size = new System.Drawing.Size(1075, 570); - this.splitContainer.SplitterDistance = 404; + this.splitContainer.SplitterDistance = 400; this.splitContainer.SplitterWidth = 7; this.splitContainer.TabIndex = 1; this.splitContainer.TabStop = false; @@ -285,7 +286,7 @@ namespace Mesen.GUI.Debugger // this.ctrlSplitContainerTop.Panel2.Controls.Add(this.tlpFunctionLabelLists); this.ctrlSplitContainerTop.Panel2MinSize = 150; - this.ctrlSplitContainerTop.Size = new System.Drawing.Size(1075, 404); + this.ctrlSplitContainerTop.Size = new System.Drawing.Size(1075, 400); this.ctrlSplitContainerTop.SplitterDistance = 750; this.ctrlSplitContainerTop.SplitterWidth = 7; this.ctrlSplitContainerTop.TabIndex = 3; @@ -306,8 +307,8 @@ namespace Mesen.GUI.Debugger this.tlpTop.Name = "tlpTop"; this.tlpTop.RowCount = 1; this.tlpTop.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tlpTop.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 404F)); - this.tlpTop.Size = new System.Drawing.Size(750, 404); + this.tlpTop.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 400F)); + this.tlpTop.Size = new System.Drawing.Size(750, 400); this.tlpTop.TabIndex = 2; // // panel1 @@ -318,7 +319,7 @@ namespace Mesen.GUI.Debugger this.panel1.Location = new System.Drawing.Point(3, 0); this.panel1.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(286, 404); + this.panel1.Size = new System.Drawing.Size(286, 400); this.panel1.TabIndex = 5; // // ctrlSourceViewer @@ -327,7 +328,7 @@ namespace Mesen.GUI.Debugger this.ctrlSourceViewer.Dock = System.Windows.Forms.DockStyle.Fill; this.ctrlSourceViewer.Location = new System.Drawing.Point(0, 0); this.ctrlSourceViewer.Name = "ctrlSourceViewer"; - this.ctrlSourceViewer.Size = new System.Drawing.Size(286, 404); + this.ctrlSourceViewer.Size = new System.Drawing.Size(286, 400); this.ctrlSourceViewer.SymbolProvider = null; this.ctrlSourceViewer.TabIndex = 7; this.ctrlSourceViewer.Visible = false; @@ -340,7 +341,7 @@ namespace Mesen.GUI.Debugger this.ctrlDebuggerCode.Location = new System.Drawing.Point(0, 0); this.ctrlDebuggerCode.Name = "ctrlDebuggerCode"; this.ctrlDebuggerCode.ShowMemoryValues = false; - this.ctrlDebuggerCode.Size = new System.Drawing.Size(286, 404); + this.ctrlDebuggerCode.Size = new System.Drawing.Size(286, 400); this.ctrlDebuggerCode.SymbolProvider = null; this.ctrlDebuggerCode.TabIndex = 2; this.ctrlDebuggerCode.OnEditCode += new Mesen.GUI.Debugger.ctrlDebuggerCode.AssemblerEventHandler(this.ctrlDebuggerCode_OnEditCode); @@ -354,7 +355,7 @@ namespace Mesen.GUI.Debugger this.panel2.Location = new System.Drawing.Point(292, 0); this.panel2.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0); this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(1, 404); + this.panel2.Size = new System.Drawing.Size(1, 400); this.panel2.TabIndex = 6; // // ctrlSourceViewerSplit @@ -363,7 +364,7 @@ namespace Mesen.GUI.Debugger this.ctrlSourceViewerSplit.Dock = System.Windows.Forms.DockStyle.Fill; this.ctrlSourceViewerSplit.Location = new System.Drawing.Point(0, 0); this.ctrlSourceViewerSplit.Name = "ctrlSourceViewerSplit"; - this.ctrlSourceViewerSplit.Size = new System.Drawing.Size(1, 404); + this.ctrlSourceViewerSplit.Size = new System.Drawing.Size(1, 400); this.ctrlSourceViewerSplit.SymbolProvider = null; this.ctrlSourceViewerSplit.TabIndex = 8; this.ctrlSourceViewerSplit.Visible = false; @@ -376,7 +377,7 @@ namespace Mesen.GUI.Debugger this.ctrlDebuggerCodeSplit.Location = new System.Drawing.Point(0, 0); this.ctrlDebuggerCodeSplit.Name = "ctrlDebuggerCodeSplit"; this.ctrlDebuggerCodeSplit.ShowMemoryValues = false; - this.ctrlDebuggerCodeSplit.Size = new System.Drawing.Size(1, 404); + this.ctrlDebuggerCodeSplit.Size = new System.Drawing.Size(1, 400); this.ctrlDebuggerCodeSplit.SymbolProvider = null; this.ctrlDebuggerCodeSplit.TabIndex = 4; this.ctrlDebuggerCodeSplit.Visible = false; @@ -396,7 +397,7 @@ namespace Mesen.GUI.Debugger this.tableLayoutPanel1.RowCount = 2; 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.Size = new System.Drawing.Size(458, 404); + this.tableLayoutPanel1.Size = new System.Drawing.Size(458, 400); this.tableLayoutPanel1.TabIndex = 7; // // ctrlConsoleStatus @@ -420,7 +421,7 @@ namespace Mesen.GUI.Debugger this.tlpVerticalLayout.Name = "tlpVerticalLayout"; this.tlpVerticalLayout.RowCount = 1; this.tlpVerticalLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tlpVerticalLayout.Size = new System.Drawing.Size(458, 4); + this.tlpVerticalLayout.Size = new System.Drawing.Size(458, 1); this.tlpVerticalLayout.TabIndex = 4; // // tlpFunctionLabelLists @@ -436,16 +437,16 @@ namespace Mesen.GUI.Debugger this.tlpFunctionLabelLists.RowCount = 2; this.tlpFunctionLabelLists.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); this.tlpFunctionLabelLists.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tlpFunctionLabelLists.Size = new System.Drawing.Size(318, 404); + this.tlpFunctionLabelLists.Size = new System.Drawing.Size(318, 400); this.tlpFunctionLabelLists.TabIndex = 5; // // grpLabels // this.grpLabels.Controls.Add(this.ctrlLabelList); this.grpLabels.Dock = System.Windows.Forms.DockStyle.Fill; - this.grpLabels.Location = new System.Drawing.Point(3, 205); + this.grpLabels.Location = new System.Drawing.Point(3, 203); this.grpLabels.Name = "grpLabels"; - this.grpLabels.Size = new System.Drawing.Size(312, 196); + this.grpLabels.Size = new System.Drawing.Size(312, 194); this.grpLabels.TabIndex = 6; this.grpLabels.TabStop = false; this.grpLabels.Text = "Labels"; @@ -455,10 +456,10 @@ namespace Mesen.GUI.Debugger this.ctrlLabelList.Dock = System.Windows.Forms.DockStyle.Fill; this.ctrlLabelList.Location = new System.Drawing.Point(3, 16); this.ctrlLabelList.Name = "ctrlLabelList"; - this.ctrlLabelList.Size = new System.Drawing.Size(306, 177); + this.ctrlLabelList.Size = new System.Drawing.Size(306, 175); this.ctrlLabelList.TabIndex = 0; this.ctrlLabelList.OnFindOccurrence += new System.EventHandler(this.ctrlLabelList_OnFindOccurrence); - this.ctrlLabelList.OnLabelSelected += new GoToDestinationEventHandler(this.ctrlLabelList_OnLabelSelected); + this.ctrlLabelList.OnLabelSelected += new Mesen.GUI.Debugger.GoToDestinationEventHandler(this.ctrlLabelList_OnLabelSelected); // // grpFunctions // @@ -466,7 +467,7 @@ namespace Mesen.GUI.Debugger this.grpFunctions.Dock = System.Windows.Forms.DockStyle.Fill; this.grpFunctions.Location = new System.Drawing.Point(3, 3); this.grpFunctions.Name = "grpFunctions"; - this.grpFunctions.Size = new System.Drawing.Size(312, 196); + this.grpFunctions.Size = new System.Drawing.Size(312, 194); this.grpFunctions.TabIndex = 5; this.grpFunctions.TabStop = false; this.grpFunctions.Text = "Functions"; @@ -476,10 +477,10 @@ namespace Mesen.GUI.Debugger this.ctrlFunctionList.Dock = System.Windows.Forms.DockStyle.Fill; this.ctrlFunctionList.Location = new System.Drawing.Point(3, 16); this.ctrlFunctionList.Name = "ctrlFunctionList"; - this.ctrlFunctionList.Size = new System.Drawing.Size(306, 177); + this.ctrlFunctionList.Size = new System.Drawing.Size(306, 175); this.ctrlFunctionList.TabIndex = 0; this.ctrlFunctionList.OnFindOccurrence += new System.EventHandler(this.ctrlFunctionList_OnFindOccurrence); - this.ctrlFunctionList.OnFunctionSelected += new GoToDestinationEventHandler(this.ctrlFunctionList_OnFunctionSelected); + this.ctrlFunctionList.OnFunctionSelected += new Mesen.GUI.Debugger.GoToDestinationEventHandler(this.ctrlFunctionList_OnFunctionSelected); // // picWatchHelp // @@ -507,7 +508,7 @@ namespace Mesen.GUI.Debugger this.tableLayoutPanel10.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel10.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel10.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel10.Size = new System.Drawing.Size(1075, 159); + this.tableLayoutPanel10.Size = new System.Drawing.Size(1075, 166); this.tableLayoutPanel10.TabIndex = 0; // // grpWatch @@ -516,7 +517,7 @@ namespace Mesen.GUI.Debugger this.grpWatch.Dock = System.Windows.Forms.DockStyle.Fill; this.grpWatch.Location = new System.Drawing.Point(3, 3); this.grpWatch.Name = "grpWatch"; - this.grpWatch.Size = new System.Drawing.Size(352, 153); + this.grpWatch.Size = new System.Drawing.Size(352, 160); this.grpWatch.TabIndex = 2; this.grpWatch.TabStop = false; this.grpWatch.Text = "Watch"; @@ -526,7 +527,7 @@ namespace Mesen.GUI.Debugger this.ctrlWatch.Dock = System.Windows.Forms.DockStyle.Fill; this.ctrlWatch.Location = new System.Drawing.Point(3, 16); this.ctrlWatch.Name = "ctrlWatch"; - this.ctrlWatch.Size = new System.Drawing.Size(346, 134); + this.ctrlWatch.Size = new System.Drawing.Size(346, 141); this.ctrlWatch.TabIndex = 0; // // grpBreakpoints @@ -535,7 +536,7 @@ namespace Mesen.GUI.Debugger this.grpBreakpoints.Dock = System.Windows.Forms.DockStyle.Fill; this.grpBreakpoints.Location = new System.Drawing.Point(361, 3); this.grpBreakpoints.Name = "grpBreakpoints"; - this.grpBreakpoints.Size = new System.Drawing.Size(352, 153); + this.grpBreakpoints.Size = new System.Drawing.Size(352, 160); this.grpBreakpoints.TabIndex = 3; this.grpBreakpoints.TabStop = false; this.grpBreakpoints.Text = "Breakpoints"; @@ -545,7 +546,7 @@ namespace Mesen.GUI.Debugger this.ctrlBreakpoints.Dock = System.Windows.Forms.DockStyle.Fill; this.ctrlBreakpoints.Location = new System.Drawing.Point(3, 16); this.ctrlBreakpoints.Name = "ctrlBreakpoints"; - this.ctrlBreakpoints.Size = new System.Drawing.Size(346, 134); + this.ctrlBreakpoints.Size = new System.Drawing.Size(346, 141); this.ctrlBreakpoints.TabIndex = 0; this.ctrlBreakpoints.BreakpointNavigation += new System.EventHandler(this.ctrlBreakpoints_BreakpointNavigation); // @@ -555,7 +556,7 @@ namespace Mesen.GUI.Debugger this.grpCallstack.Dock = System.Windows.Forms.DockStyle.Fill; this.grpCallstack.Location = new System.Drawing.Point(719, 3); this.grpCallstack.Name = "grpCallstack"; - this.grpCallstack.Size = new System.Drawing.Size(353, 153); + this.grpCallstack.Size = new System.Drawing.Size(353, 160); this.grpCallstack.TabIndex = 4; this.grpCallstack.TabStop = false; this.grpCallstack.Text = "Call Stack"; @@ -565,7 +566,7 @@ namespace Mesen.GUI.Debugger this.ctrlCallstack.Dock = System.Windows.Forms.DockStyle.Fill; this.ctrlCallstack.Location = new System.Drawing.Point(3, 16); this.ctrlCallstack.Name = "ctrlCallstack"; - this.ctrlCallstack.Size = new System.Drawing.Size(347, 134); + this.ctrlCallstack.Size = new System.Drawing.Size(347, 141); this.ctrlCallstack.TabIndex = 0; this.ctrlCallstack.FunctionSelected += new System.EventHandler(this.ctrlCallstack_FunctionSelected); // @@ -927,6 +928,18 @@ namespace Mesen.GUI.Debugger this.searchToolStripMenuItem.Size = new System.Drawing.Size(54, 20); this.searchToolStripMenuItem.Text = "Search"; // + // mnuGoToAll + // + this.mnuGoToAll.Name = "mnuGoToAll"; + this.mnuGoToAll.Size = new System.Drawing.Size(183, 22); + this.mnuGoToAll.Text = "Go to All"; + this.mnuGoToAll.Click += new System.EventHandler(this.mnuGoToAll_Click); + // + // toolStripMenuItem29 + // + this.toolStripMenuItem29.Name = "toolStripMenuItem29"; + this.toolStripMenuItem29.Size = new System.Drawing.Size(180, 6); + // // mnuFind // this.mnuFind.Image = global::Mesen.GUI.Properties.Resources.Find; @@ -1023,13 +1036,6 @@ namespace Mesen.GUI.Debugger this.mnuGoToProgramCount.Text = "Program Counter"; this.mnuGoToProgramCount.Click += new System.EventHandler(this.mnuGoToProgramCount_Click); // - // mnuGoToAll - // - this.mnuGoToAll.Name = "mnuGoToAll"; - this.mnuGoToAll.Size = new System.Drawing.Size(183, 22); - this.mnuGoToAll.Text = "Go to All"; - this.mnuGoToAll.Click += new System.EventHandler(this.mnuGoToAll_Click); - // // mnuOptions // this.mnuOptions.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -1057,6 +1063,7 @@ namespace Mesen.GUI.Debugger this.mnuAlwaysScrollToCenter, this.mnuRefreshWhileRunning, this.toolStripMenuItem6, + this.mnuConfigureExternalEditor, this.mnuPreferences}); this.mnuOptions.Name = "mnuOptions"; this.mnuOptions.Size = new System.Drawing.Size(61, 20); @@ -1642,6 +1649,14 @@ namespace Mesen.GUI.Debugger this.mnuPreferences.Text = "Configure shortcut keys..."; this.mnuPreferences.Click += new System.EventHandler(this.mnuPreferences_Click); // + // mnuConfigureExternalEditor + // + this.mnuConfigureExternalEditor.Image = global::Mesen.GUI.Properties.Resources.Edit; + this.mnuConfigureExternalEditor.Name = "mnuConfigureExternalEditor"; + this.mnuConfigureExternalEditor.Size = new System.Drawing.Size(266, 22); + this.mnuConfigureExternalEditor.Text = "Configure external code editor..."; + this.mnuConfigureExternalEditor.Click += new System.EventHandler(this.mnuConfigureExternalEditor_Click); + // // toolsToolStripMenuItem // this.toolsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -1915,11 +1930,6 @@ namespace Mesen.GUI.Debugger this.tsToolbar.Text = "toolStrip1"; this.tsToolbar.Visible = false; // - // toolStripMenuItem29 - // - this.toolStripMenuItem29.Name = "toolStripMenuItem29"; - this.toolStripMenuItem29.Size = new System.Drawing.Size(180, 6); - // // frmDebugger // this.AllowDrop = true; @@ -2157,5 +2167,6 @@ namespace Mesen.GUI.Debugger private System.Windows.Forms.ToolStripSeparator toolStripMenuItem28; private System.Windows.Forms.ToolStripMenuItem mnuGoToAll; private System.Windows.Forms.ToolStripSeparator toolStripMenuItem29; + private System.Windows.Forms.ToolStripMenuItem mnuConfigureExternalEditor; } } \ No newline at end of file diff --git a/GUI.NET/Debugger/frmDebugger.cs b/GUI.NET/Debugger/frmDebugger.cs index df9a0bf4..772e3026 100644 --- a/GUI.NET/Debugger/frmDebugger.cs +++ b/GUI.NET/Debugger/frmDebugger.cs @@ -1814,5 +1814,12 @@ namespace Mesen.GUI.Debugger } } } + + private void mnuConfigureExternalEditor_Click(object sender, EventArgs e) + { + using(frmExternalEditorConfig frm = new frmExternalEditorConfig()) { + frm.ShowDialog(mnuConfigureExternalEditor, this); + } + } } } diff --git a/GUI.NET/Debugger/frmExternalEditorConfig.Designer.cs b/GUI.NET/Debugger/frmExternalEditorConfig.Designer.cs new file mode 100644 index 00000000..2db0c7f1 --- /dev/null +++ b/GUI.NET/Debugger/frmExternalEditorConfig.Designer.cs @@ -0,0 +1,139 @@ +namespace Mesen.GUI.Debugger +{ + partial class frmExternalEditorConfig + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if(disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.txtArguments = new System.Windows.Forms.TextBox(); + this.lblPath = new System.Windows.Forms.Label(); + this.lblArguments = new System.Windows.Forms.Label(); + this.lblHint = new System.Windows.Forms.Label(); + this.txtPath = new System.Windows.Forms.TextBox(); + this.tableLayoutPanel1.SuspendLayout(); + this.SuspendLayout(); + // + // baseConfigPanel + // + this.baseConfigPanel.Location = new System.Drawing.Point(0, 127); + this.baseConfigPanel.Size = new System.Drawing.Size(488, 29); + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.ColumnCount = 2; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.Controls.Add(this.txtArguments, 1, 1); + this.tableLayoutPanel1.Controls.Add(this.lblPath, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.lblArguments, 0, 1); + this.tableLayoutPanel1.Controls.Add(this.lblHint, 1, 2); + this.tableLayoutPanel1.Controls.Add(this.txtPath, 1, 0); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 3; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + 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.Size = new System.Drawing.Size(488, 127); + this.tableLayoutPanel1.TabIndex = 2; + // + // txtArguments + // + this.txtArguments.Dock = System.Windows.Forms.DockStyle.Fill; + this.txtArguments.Location = new System.Drawing.Point(137, 29); + this.txtArguments.Name = "txtArguments"; + this.txtArguments.Size = new System.Drawing.Size(348, 20); + this.txtArguments.TabIndex = 4; + // + // lblPath + // + this.lblPath.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.lblPath.AutoSize = true; + this.lblPath.Location = new System.Drawing.Point(3, 6); + this.lblPath.Name = "lblPath"; + this.lblPath.Size = new System.Drawing.Size(79, 13); + this.lblPath.TabIndex = 0; + this.lblPath.Text = "Editor filename:"; + // + // lblArguments + // + this.lblArguments.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.lblArguments.AutoSize = true; + this.lblArguments.Location = new System.Drawing.Point(3, 32); + this.lblArguments.Name = "lblArguments"; + this.lblArguments.Size = new System.Drawing.Size(128, 13); + this.lblArguments.TabIndex = 1; + this.lblArguments.Text = "Command line arguments:"; + // + // lblHint + // + this.lblHint.AutoSize = true; + this.lblHint.Location = new System.Drawing.Point(137, 57); + this.lblHint.Margin = new System.Windows.Forms.Padding(3, 5, 3, 0); + this.lblHint.Name = "lblHint"; + this.lblHint.Size = new System.Drawing.Size(183, 65); + this.lblHint.TabIndex = 2; + this.lblHint.Text = "%F = the file to edit\r\n%L = the line at which to open the file\r\n\r\ne.g: for Notepa" + + "d++:\r\n%F -n%L"; + // + // txtPath + // + this.txtPath.Dock = System.Windows.Forms.DockStyle.Fill; + this.txtPath.Location = new System.Drawing.Point(137, 3); + this.txtPath.Name = "txtPath"; + this.txtPath.Size = new System.Drawing.Size(348, 20); + this.txtPath.TabIndex = 3; + // + // frmExternalEditorConfig + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(488, 156); + this.Controls.Add(this.tableLayoutPanel1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.MaximizeBox = false; + this.Name = "frmExternalEditorConfig"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Configure external code editor..."; + this.Controls.SetChildIndex(this.baseConfigPanel, 0); + this.Controls.SetChildIndex(this.tableLayoutPanel1, 0); + this.tableLayoutPanel1.ResumeLayout(false); + this.tableLayoutPanel1.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private System.Windows.Forms.TextBox txtArguments; + private System.Windows.Forms.Label lblPath; + private System.Windows.Forms.Label lblArguments; + private System.Windows.Forms.Label lblHint; + private System.Windows.Forms.TextBox txtPath; + } +} \ No newline at end of file diff --git a/GUI.NET/Debugger/frmExternalEditorConfig.cs b/GUI.NET/Debugger/frmExternalEditorConfig.cs new file mode 100644 index 00000000..d1b7b6d2 --- /dev/null +++ b/GUI.NET/Debugger/frmExternalEditorConfig.cs @@ -0,0 +1,27 @@ +using Mesen.GUI.Config; +using Mesen.GUI.Forms; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Mesen.GUI.Debugger +{ + public partial class frmExternalEditorConfig : BaseConfigForm + { + public frmExternalEditorConfig() + { + InitializeComponent(); + + Entity = ConfigManager.Config.DebugInfo; + + AddBinding("ExternalEditorPath", txtPath); + AddBinding("ExternalEditorArguments", txtArguments); + } + } +} diff --git a/GUI.NET/Debugger/frmExternalEditorConfig.resx b/GUI.NET/Debugger/frmExternalEditorConfig.resx new file mode 100644 index 00000000..8766f298 --- /dev/null +++ b/GUI.NET/Debugger/frmExternalEditorConfig.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 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/GUI.NET.csproj b/GUI.NET/GUI.NET.csproj index d5ca4232..e0b582e0 100644 --- a/GUI.NET/GUI.NET.csproj +++ b/GUI.NET/GUI.NET.csproj @@ -661,6 +661,12 @@ frmAssembler.cs + + Form + + + frmExternalEditorConfig.cs + Form @@ -1359,6 +1365,9 @@ ctrlSourceViewer.cs + + frmExternalEditorConfig.cs + frmGoToAll.cs