From 4b9ab622cac00c36d0c0da808d36386f6972f0bd Mon Sep 17 00:00:00 2001 From: Souryo Date: Mon, 3 Aug 2015 21:53:46 -0400 Subject: [PATCH] Debugger - Search functionality (Ctrl-F, F3) --- GUI.NET/Debugger/Controls/ctrlDebuggerCode.cs | 26 +++- .../Controls/ctrlScrollableTextbox.cs | 93 ++++++++++++- .../ctrlScrollableTextbox.designer.cs | 113 ++++++++++++++- GUI.NET/Debugger/Controls/ctrlTextbox.cs | 88 +++++++++++- GUI.NET/Debugger/frmDebugger.Designer.cs | 131 +++++++++--------- GUI.NET/Debugger/frmDebugger.cs | 11 ++ GUI.NET/GUI.NET.csproj | 3 + GUI.NET/Properties/Resources.Designer.cs | 30 ++++ GUI.NET/Properties/Resources.resx | 9 ++ GUI.NET/Resources/Close.png | Bin 0 -> 239 bytes GUI.NET/Resources/NextArrow.png | Bin 0 -> 356 bytes GUI.NET/Resources/PreviousArrow.png | Bin 0 -> 361 bytes 12 files changed, 423 insertions(+), 81 deletions(-) create mode 100644 GUI.NET/Resources/Close.png create mode 100644 GUI.NET/Resources/NextArrow.png create mode 100644 GUI.NET/Resources/PreviousArrow.png diff --git a/GUI.NET/Debugger/Controls/ctrlDebuggerCode.cs b/GUI.NET/Debugger/Controls/ctrlDebuggerCode.cs index 0da4ba0c..2b7f928e 100644 --- a/GUI.NET/Debugger/Controls/ctrlDebuggerCode.cs +++ b/GUI.NET/Debugger/Controls/ctrlDebuggerCode.cs @@ -39,7 +39,7 @@ namespace Mesen.GUI.Debugger public void SelectActiveAddress(UInt32 address) { this.SetActiveAddress(address); - this.ctrlCodeViewer.ScrollIntoView((int)address); + this.ctrlCodeViewer.ScrollToLineNumber((int)address); } public void SetActiveAddress(UInt32 address) @@ -59,10 +59,27 @@ namespace Mesen.GUI.Debugger { return this.ctrlCodeViewer.GetWordUnderLocation(position); } + + public void OpenSearchBox() + { + this.ctrlCodeViewer.OpenSearchBox(); + } + + public void FindNext() + { + this.ctrlCodeViewer.FindNext(); + } + + public void FindPrevious() + { + this.ctrlCodeViewer.FindPrevious(); + } public bool UpdateCode(bool forceUpdate = false) { if(_codeChanged || forceUpdate) { + System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); + sw.Start(); this.ctrlCodeViewer.ClearLineStyles(); List lineNumbers = new List(); @@ -98,6 +115,7 @@ namespace Mesen.GUI.Debugger ctrlCodeViewer.TextLines = codeLines.ToArray(); ctrlCodeViewer.LineNumbers = lineNumbers.ToArray(); + sw.Stop(); _codeChanged = false; return true; } @@ -164,7 +182,7 @@ namespace Mesen.GUI.Debugger Point topLeft = this.PointToScreen(new Point(0, 0)); frm.Location = new Point(topLeft.X + (this.Width - frm.Width) / 2, topLeft.Y + (this.Height - frm.Height) / 2); if(frm.ShowDialog() == DialogResult.OK) { - ctrlCodeViewer.ScrollIntoView((int)address.Address); + ctrlCodeViewer.ScrollToLineNumber((int)address.Address); } } @@ -212,7 +230,7 @@ namespace Mesen.GUI.Debugger private void mnuShowNextStatement_Click(object sender, EventArgs e) { - this.ctrlCodeViewer.ScrollIntoView((int)_currentActiveAddress.Value); + this.ctrlCodeViewer.ScrollToLineNumber((int)_currentActiveAddress.Value); } private void mnuShowOnlyDisassembledCode_Click(object sender, EventArgs e) @@ -225,7 +243,7 @@ namespace Mesen.GUI.Debugger private void mnuGoToLocation_Click(object sender, EventArgs e) { - this.ctrlCodeViewer.ScrollIntoView((int)_lastClickedAddress); + this.ctrlCodeViewer.ScrollToLineNumber((int)_lastClickedAddress); } private void mnuAddToWatch_Click(object sender, EventArgs e) diff --git a/GUI.NET/Debugger/Controls/ctrlScrollableTextbox.cs b/GUI.NET/Debugger/Controls/ctrlScrollableTextbox.cs index 28957ae7..bcd611f1 100644 --- a/GUI.NET/Debugger/Controls/ctrlScrollableTextbox.cs +++ b/GUI.NET/Debugger/Controls/ctrlScrollableTextbox.cs @@ -32,6 +32,10 @@ namespace Mesen.GUI.Debugger this.ctrlTextbox.ShowLineInHex = true; this.vScrollBar.ValueChanged += vScrollBar_ValueChanged; this.ctrlTextbox.ScrollPositionChanged += ctrlTextbox_ScrollPositionChanged; + + new ToolTip().SetToolTip(picCloseSearch, "Close"); + new ToolTip().SetToolTip(picSearchNext, "Find Next (F3)"); + new ToolTip().SetToolTip(picSearchPrevious, "Find Previous (Shift-F3)"); } public string GetWordUnderLocation(Point position) @@ -64,9 +68,9 @@ namespace Mesen.GUI.Debugger return this.ctrlTextbox.GetLineNumber(lineIndex); } - public void ScrollIntoView(int lineNumber) + public void ScrollToLineNumber(int lineNumber) { - this.ctrlTextbox.ScrollIntoView(lineNumber); + this.ctrlTextbox.ScrollToLineNumber(lineNumber); } public int CurrentLine @@ -84,12 +88,22 @@ namespace Mesen.GUI.Debugger { switch(keyData) { case Keys.Down: + case Keys.Right: this.ctrlTextbox.CursorPosition++; return true; case Keys.Up: + case Keys.Left: this.ctrlTextbox.CursorPosition--; return true; + case Keys.Home: + this.ctrlTextbox.CursorPosition = 0; + return true; + + case Keys.End: + this.ctrlTextbox.CursorPosition = this.ctrlTextbox.LineCount - 1; + return true; + case Keys.PageUp: this.ctrlTextbox.CursorPosition-=20; return true; @@ -97,6 +111,14 @@ namespace Mesen.GUI.Debugger case Keys.PageDown: this.ctrlTextbox.CursorPosition+=20; return true; + + case Keys.Control | Keys.F: + this.OpenSearchBox(); + return true; + + case Keys.Escape: + this.CloseSearchBox(); + return true; } return base.ProcessCmdKey(ref msg, keyData); @@ -123,5 +145,72 @@ namespace Mesen.GUI.Debugger this.ctrlTextbox.CustomLineNumbers = value; } } + + public void OpenSearchBox() + { + bool focus = !this.panelSearch.Visible; + this.panelSearch.Visible = true; + if(focus) { + this.cboSearch.Focus(); + this.cboSearch.SelectAll(); + } + } + + private void CloseSearchBox() + { + this.ctrlTextbox.Search(null, false, false); + this.panelSearch.Visible = false; + this.Focus(); + } + + public void FindNext() + { + this.OpenSearchBox(); + this.ctrlTextbox.Search(this.cboSearch.Text, false, false); + } + + public void FindPrevious() + { + this.OpenSearchBox(); + this.ctrlTextbox.Search(this.cboSearch.Text, true, false); + } + + private void picCloseSearch_Click(object sender, EventArgs e) + { + this.CloseSearchBox(); + } + + private void picSearchPrevious_MouseUp(object sender, MouseEventArgs e) + { + this.FindPrevious(); + } + + private void picSearchNext_MouseUp(object sender, MouseEventArgs e) + { + this.FindNext(); + } + + private void cboSearch_TextUpdate(object sender, EventArgs e) + { + if(!this.ctrlTextbox.Search(this.cboSearch.Text, false, true)) { + this.cboSearch.BackColor = Color.Coral; + } else { + this.cboSearch.BackColor = Color.Empty; + } + } + + private void cboSearch_KeyDown(object sender, KeyEventArgs e) + { + if(e.KeyCode == Keys.Enter) { + this.FindNext(); + if(this.cboSearch.Items.Contains(this.cboSearch.Text)) { + this.cboSearch.Items.Remove(this.cboSearch.Text); + } + this.cboSearch.Items.Insert(0, this.cboSearch.Text); + + e.Handled = true; + e.SuppressKeyPress = true; + } + } } } diff --git a/GUI.NET/Debugger/Controls/ctrlScrollableTextbox.designer.cs b/GUI.NET/Debugger/Controls/ctrlScrollableTextbox.designer.cs index 2741ae61..3eb3d3e9 100644 --- a/GUI.NET/Debugger/Controls/ctrlScrollableTextbox.designer.cs +++ b/GUI.NET/Debugger/Controls/ctrlScrollableTextbox.designer.cs @@ -28,18 +28,110 @@ private void InitializeComponent() { this.vScrollBar = new System.Windows.Forms.VScrollBar(); + this.panelSearch = new System.Windows.Forms.Panel(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.picCloseSearch = new System.Windows.Forms.PictureBox(); + this.picSearchNext = new System.Windows.Forms.PictureBox(); + this.picSearchPrevious = new System.Windows.Forms.PictureBox(); + this.cboSearch = new System.Windows.Forms.ComboBox(); this.ctrlTextbox = new Mesen.GUI.Debugger.ctrlTextbox(); + this.panelSearch.SuspendLayout(); + this.tableLayoutPanel1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.picCloseSearch)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.picSearchNext)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.picSearchPrevious)).BeginInit(); this.SuspendLayout(); // // vScrollBar // this.vScrollBar.Dock = System.Windows.Forms.DockStyle.Right; this.vScrollBar.LargeChange = 20; - this.vScrollBar.Location = new System.Drawing.Point(130, 0); + this.vScrollBar.Location = new System.Drawing.Point(305, 0); this.vScrollBar.Name = "vScrollBar"; - this.vScrollBar.Size = new System.Drawing.Size(18, 148); + this.vScrollBar.Size = new System.Drawing.Size(18, 174); this.vScrollBar.TabIndex = 0; // + // panelSearch + // + this.panelSearch.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.panelSearch.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.panelSearch.Controls.Add(this.tableLayoutPanel1); + this.panelSearch.Location = new System.Drawing.Point(81, -1); + this.panelSearch.Name = "panelSearch"; + this.panelSearch.Size = new System.Drawing.Size(222, 28); + this.panelSearch.TabIndex = 2; + this.panelSearch.Visible = false; + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.ColumnCount = 4; + 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.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel1.Controls.Add(this.picCloseSearch, 3, 0); + this.tableLayoutPanel1.Controls.Add(this.picSearchNext, 2, 0); + this.tableLayoutPanel1.Controls.Add(this.picSearchPrevious, 1, 0); + this.tableLayoutPanel1.Controls.Add(this.cboSearch, 0, 0); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(0); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 1; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(220, 26); + this.tableLayoutPanel1.TabIndex = 0; + // + // picCloseSearch + // + this.picCloseSearch.Anchor = System.Windows.Forms.AnchorStyles.None; + this.picCloseSearch.Cursor = System.Windows.Forms.Cursors.Hand; + this.picCloseSearch.Image = global::Mesen.GUI.Properties.Resources.Close; + this.picCloseSearch.Location = new System.Drawing.Point(201, 5); + this.picCloseSearch.Name = "picCloseSearch"; + this.picCloseSearch.Size = new System.Drawing.Size(16, 16); + this.picCloseSearch.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; + this.picCloseSearch.TabIndex = 3; + this.picCloseSearch.TabStop = false; + this.picCloseSearch.Click += new System.EventHandler(this.picCloseSearch_Click); + // + // picSearchNext + // + this.picSearchNext.Anchor = System.Windows.Forms.AnchorStyles.None; + this.picSearchNext.Cursor = System.Windows.Forms.Cursors.Hand; + this.picSearchNext.Image = global::Mesen.GUI.Properties.Resources.NextArrow; + this.picSearchNext.Location = new System.Drawing.Point(179, 5); + this.picSearchNext.Name = "picSearchNext"; + this.picSearchNext.Size = new System.Drawing.Size(16, 16); + this.picSearchNext.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; + this.picSearchNext.TabIndex = 2; + this.picSearchNext.TabStop = false; + this.picSearchNext.MouseUp += new System.Windows.Forms.MouseEventHandler(this.picSearchNext_MouseUp); + // + // picSearchPrevious + // + this.picSearchPrevious.Anchor = System.Windows.Forms.AnchorStyles.None; + this.picSearchPrevious.Cursor = System.Windows.Forms.Cursors.Hand; + this.picSearchPrevious.Image = global::Mesen.GUI.Properties.Resources.PreviousArrow; + this.picSearchPrevious.Location = new System.Drawing.Point(157, 5); + this.picSearchPrevious.Name = "picSearchPrevious"; + this.picSearchPrevious.Size = new System.Drawing.Size(16, 16); + this.picSearchPrevious.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; + this.picSearchPrevious.TabIndex = 1; + this.picSearchPrevious.TabStop = false; + this.picSearchPrevious.MouseUp += new System.Windows.Forms.MouseEventHandler(this.picSearchPrevious_MouseUp); + // + // cboSearch + // + this.cboSearch.Dock = System.Windows.Forms.DockStyle.Fill; + this.cboSearch.FormattingEnabled = true; + this.cboSearch.Location = new System.Drawing.Point(3, 3); + this.cboSearch.Name = "cboSearch"; + this.cboSearch.Size = new System.Drawing.Size(148, 21); + this.cboSearch.TabIndex = 4; + this.cboSearch.TextUpdate += new System.EventHandler(this.cboSearch_TextUpdate); + this.cboSearch.KeyDown += new System.Windows.Forms.KeyEventHandler(this.cboSearch_KeyDown); + // // ctrlTextbox // this.ctrlTextbox.CursorPosition = -1; @@ -50,7 +142,7 @@ this.ctrlTextbox.ScrollPosition = 0; this.ctrlTextbox.ShowLineInHex = false; this.ctrlTextbox.ShowLineNumbers = true; - this.ctrlTextbox.Size = new System.Drawing.Size(130, 148); + this.ctrlTextbox.Size = new System.Drawing.Size(305, 174); this.ctrlTextbox.TabIndex = 1; // // ctrlScrollableTextbox @@ -58,10 +150,17 @@ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.Controls.Add(this.panelSearch); this.Controls.Add(this.ctrlTextbox); this.Controls.Add(this.vScrollBar); this.Name = "ctrlScrollableTextbox"; - this.Size = new System.Drawing.Size(148, 148); + this.Size = new System.Drawing.Size(323, 174); + this.panelSearch.ResumeLayout(false); + this.tableLayoutPanel1.ResumeLayout(false); + this.tableLayoutPanel1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.picCloseSearch)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.picSearchNext)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.picSearchPrevious)).EndInit(); this.ResumeLayout(false); } @@ -70,6 +169,12 @@ private System.Windows.Forms.VScrollBar vScrollBar; private ctrlTextbox ctrlTextbox; + private System.Windows.Forms.Panel panelSearch; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private System.Windows.Forms.PictureBox picSearchPrevious; + private System.Windows.Forms.PictureBox picSearchNext; + private System.Windows.Forms.PictureBox picCloseSearch; + private System.Windows.Forms.ComboBox cboSearch; } } diff --git a/GUI.NET/Debugger/Controls/ctrlTextbox.cs b/GUI.NET/Debugger/Controls/ctrlTextbox.cs index 59cc82b9..05c28379 100644 --- a/GUI.NET/Debugger/Controls/ctrlTextbox.cs +++ b/GUI.NET/Debugger/Controls/ctrlTextbox.cs @@ -38,6 +38,7 @@ namespace Mesen.GUI.Debugger private bool _showLineInHex = false; private int _cursorPosition = 0; private int _scrollPosition = 0; + private string _searchString = null; public ctrlTextbox() { @@ -85,6 +86,56 @@ namespace Mesen.GUI.Debugger } } + public bool Search(string searchString, bool searchBackwards, bool isNewSearch) + { + if(string.IsNullOrWhiteSpace(searchString)) { + this._searchString = null; + this.Invalidate(); + return true; + } else { + int startPosition; + int endPosition; + + this._searchString = searchString.ToLowerInvariant(); + int searchOffset = (searchBackwards ? -1 : 1); + if(isNewSearch) { + startPosition = this.CursorPosition; + endPosition = this.CursorPosition - searchOffset; + if(endPosition < 0) { + endPosition = _contents.Length - 1; + } else if(endPosition >= _contents.Length) { + endPosition = 0; + } + + } else { + startPosition = this.CursorPosition + searchOffset; + endPosition = this.CursorPosition; + if(startPosition < 0) { + startPosition = _contents.Length - 1; + } else if(startPosition >= _contents.Length) { + startPosition = 0; + } + } + + for(int i = startPosition; i != endPosition; i += searchOffset) { + string line = _contents[i].ToLowerInvariant(); + if(line.Contains(searchString)) { + this.ScrollToLineIndex(i); + return true; + } + + //Continue search from start/end of document + if(!searchBackwards && i == this._contents.Length - 1) { + i = 0; + } else if(searchBackwards && i == 0) { + i = this._contents.Length - 1; + } + } + this.Invalidate(); + return _contents[_cursorPosition].ToLowerInvariant().Contains(this._searchString); + } + } + public void ClearLineStyles() { _lineProperties.Clear(); @@ -127,15 +178,20 @@ namespace Mesen.GUI.Debugger return _lineNumbers[lineIndex]; } - public void ScrollIntoView(int lineNumber) + public void ScrollToLineIndex(int lineIndex) + { + if(lineIndex < this.ScrollPosition || lineIndex > this.GetLastVisibleLineIndex()) { + //Line isn't currently visible, scroll it to the middle of the viewport + this.ScrollPosition = lineIndex - this.GetNumberVisibleLines()/2; + } + this.CursorPosition = lineIndex; + } + + public void ScrollToLineNumber(int lineNumber) { int lineIndex = this.GetLineIndex(lineNumber); if(lineIndex >= 0) { - if(lineIndex < this.ScrollPosition || lineIndex > this.GetLastVisibleLineIndex()) { - //Line isn't currently visible, scroll it to the middle of the viewport - this.ScrollPosition = lineIndex - this.GetNumberVisibleLines()/2; - } - this.CursorPosition = lineIndex; + ScrollToLineIndex(lineIndex); } } @@ -310,7 +366,25 @@ namespace Mesen.GUI.Debugger } using(Brush fgBrush = new SolidBrush(textColor)) { - g.DrawString(_contents[currentLine], this.Font, fgBrush, marginLeft, positionY); + int searchIndex; + if(!string.IsNullOrWhiteSpace(this._searchString) && (searchIndex = _contents[currentLine].ToLowerInvariant().IndexOf(this._searchString)) >= 0) { + //Draw colored search string + string searchString = _contents[currentLine].Substring(searchIndex, this._searchString.Length); + StringFormat stringFormat = new StringFormat(StringFormat.GenericTypographic) { FormatFlags = StringFormatFlags.MeasureTrailingSpaces }; + float searchStringWidth = g.MeasureString(searchString, this.Font, Int32.MaxValue, stringFormat).Width; + g.DrawString(_contents[currentLine].Substring(0, searchIndex), this.Font, fgBrush, marginLeft, positionY); + + float offsetX = g.MeasureString(_contents[currentLine].Substring(0, searchIndex), this.Font, Int32.MaxValue, stringFormat).Width; + using(Brush selBrush = new SolidBrush(Color.White), selBgBrush = new SolidBrush(Color.CornflowerBlue)) { + g.FillRectangle(selBgBrush, marginLeft+offsetX+1, positionY, searchStringWidth+2, this.Font.Height - 1); + g.DrawString(searchString, this.Font, selBrush, marginLeft+offsetX, positionY); + } + offsetX += searchStringWidth; + + g.DrawString(_contents[currentLine].Substring(searchIndex+this._searchString.Length), this.Font, fgBrush, marginLeft+offsetX, positionY); + } else { + g.DrawString(_contents[currentLine], this.Font, fgBrush, marginLeft, positionY); + } } } diff --git a/GUI.NET/Debugger/frmDebugger.Designer.cs b/GUI.NET/Debugger/frmDebugger.Designer.cs index f61cc7fd..be9f8d2e 100644 --- a/GUI.NET/Debugger/frmDebugger.Designer.cs +++ b/GUI.NET/Debugger/frmDebugger.Designer.cs @@ -34,17 +34,12 @@ this.components = new System.ComponentModel.Container(); this.splitContainer = new System.Windows.Forms.SplitContainer(); this.tlpTop = new System.Windows.Forms.TableLayoutPanel(); - this.ctrlDebuggerCode = new Mesen.GUI.Debugger.ctrlDebuggerCode(); this.contextMenuCode = new System.Windows.Forms.ContextMenuStrip(this.components); this.mnuShowNextStatement = new System.Windows.Forms.ToolStripMenuItem(); this.mnuSetNextStatement = new System.Windows.Forms.ToolStripMenuItem(); - this.ctrlConsoleStatus = new Mesen.GUI.Debugger.ctrlConsoleStatus(); - this.ctrlDebuggerCodeSplit = new Mesen.GUI.Debugger.ctrlDebuggerCode(); this.tableLayoutPanel10 = new System.Windows.Forms.TableLayoutPanel(); this.grpBreakpoints = new System.Windows.Forms.GroupBox(); - this.ctrlBreakpoints = new Mesen.GUI.Debugger.Controls.ctrlBreakpoints(); this.grpWatch = new System.Windows.Forms.GroupBox(); - this.ctrlWatch = new Mesen.GUI.Debugger.ctrlWatch(); this.menuStrip = new System.Windows.Forms.MenuStrip(); this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.mnuClose = new System.Windows.Forms.ToolStripMenuItem(); @@ -64,12 +59,17 @@ this.mnuFind = new System.Windows.Forms.ToolStripMenuItem(); this.mnuFindNext = new System.Windows.Forms.ToolStripMenuItem(); this.mnuFindPrev = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuGoTo = new System.Windows.Forms.ToolStripMenuItem(); this.toolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.nametableViewerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.cHRViewerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator(); this.mnuMemoryViewer = new System.Windows.Forms.ToolStripMenuItem(); - this.mnuGoTo = new System.Windows.Forms.ToolStripMenuItem(); + this.ctrlDebuggerCode = new Mesen.GUI.Debugger.ctrlDebuggerCode(); + this.ctrlConsoleStatus = new Mesen.GUI.Debugger.ctrlConsoleStatus(); + this.ctrlDebuggerCodeSplit = new Mesen.GUI.Debugger.ctrlDebuggerCode(); + this.ctrlBreakpoints = new Mesen.GUI.Debugger.Controls.ctrlBreakpoints(); + this.ctrlWatch = new Mesen.GUI.Debugger.ctrlWatch(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit(); this.splitContainer.Panel1.SuspendLayout(); this.splitContainer.Panel2.SuspendLayout(); @@ -106,8 +106,8 @@ // tlpTop // this.tlpTop.ColumnCount = 3; - this.tlpTop.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tlpTop.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tlpTop.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tlpTop.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 0F)); this.tlpTop.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.tlpTop.Controls.Add(this.ctrlDebuggerCode, 0, 0); this.tlpTop.Controls.Add(this.ctrlConsoleStatus, 2, 0); @@ -120,18 +120,6 @@ this.tlpTop.Size = new System.Drawing.Size(984, 422); this.tlpTop.TabIndex = 2; // - // ctrlDebuggerCode - // - this.ctrlDebuggerCode.Code = null; - this.ctrlDebuggerCode.ContextMenuStrip = this.contextMenuCode; - this.ctrlDebuggerCode.Dock = System.Windows.Forms.DockStyle.Fill; - this.ctrlDebuggerCode.Location = new System.Drawing.Point(3, 3); - this.ctrlDebuggerCode.Name = "ctrlDebuggerCode"; - this.ctrlDebuggerCode.Size = new System.Drawing.Size(270, 416); - this.ctrlDebuggerCode.TabIndex = 2; - this.ctrlDebuggerCode.OnWatchAdded += new Mesen.GUI.Debugger.ctrlDebuggerCode.WatchAddedEventHandler(this.ctrlDebuggerCode_OnWatchAdded); - this.ctrlDebuggerCode.Enter += new System.EventHandler(this.ctrlDebuggerCode_Enter); - // // contextMenuCode // this.contextMenuCode.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -156,26 +144,6 @@ this.mnuSetNextStatement.Size = new System.Drawing.Size(258, 22); this.mnuSetNextStatement.Text = "Set Next Statement"; // - // ctrlConsoleStatus - // - this.ctrlConsoleStatus.Dock = System.Windows.Forms.DockStyle.Top; - this.ctrlConsoleStatus.Location = new System.Drawing.Point(552, 0); - this.ctrlConsoleStatus.Margin = new System.Windows.Forms.Padding(0); - this.ctrlConsoleStatus.Name = "ctrlConsoleStatus"; - this.ctrlConsoleStatus.Size = new System.Drawing.Size(432, 362); - this.ctrlConsoleStatus.TabIndex = 3; - // - // ctrlDebuggerCodeSplit - // - this.ctrlDebuggerCodeSplit.Code = null; - this.ctrlDebuggerCodeSplit.Dock = System.Windows.Forms.DockStyle.Fill; - this.ctrlDebuggerCodeSplit.Location = new System.Drawing.Point(279, 3); - this.ctrlDebuggerCodeSplit.Name = "ctrlDebuggerCodeSplit"; - this.ctrlDebuggerCodeSplit.Size = new System.Drawing.Size(270, 416); - this.ctrlDebuggerCodeSplit.TabIndex = 4; - this.ctrlDebuggerCodeSplit.OnWatchAdded += new Mesen.GUI.Debugger.ctrlDebuggerCode.WatchAddedEventHandler(this.ctrlDebuggerCode_OnWatchAdded); - this.ctrlDebuggerCodeSplit.Enter += new System.EventHandler(this.ctrlDebuggerCodeSplit_Enter); - // // tableLayoutPanel10 // this.tableLayoutPanel10.ColumnCount = 2; @@ -206,15 +174,6 @@ this.grpBreakpoints.TabStop = false; this.grpBreakpoints.Text = "Breakpoints"; // - // ctrlBreakpoints - // - 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(480, 137); - this.ctrlBreakpoints.TabIndex = 0; - this.ctrlBreakpoints.BreakpointChanged += new System.EventHandler(this.ctrlBreakpoints_BreakpointChanged); - // // grpWatch // this.grpWatch.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -228,14 +187,6 @@ this.grpWatch.TabStop = false; this.grpWatch.Text = "Watch"; // - // ctrlWatch - // - 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(480, 137); - this.ctrlWatch.TabIndex = 0; - // // menuStrip // this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -276,7 +227,7 @@ // this.mnuSplitView.CheckOnClick = true; this.mnuSplitView.Name = "mnuSplitView"; - this.mnuSplitView.Size = new System.Drawing.Size(152, 22); + this.mnuSplitView.Size = new System.Drawing.Size(125, 22); this.mnuSplitView.Text = "Split View"; this.mnuSplitView.Click += new System.EventHandler(this.mnuSplitView_Click); // @@ -389,6 +340,7 @@ this.mnuFindNext.ShortcutKeys = System.Windows.Forms.Keys.F3; this.mnuFindNext.Size = new System.Drawing.Size(196, 22); this.mnuFindNext.Text = "Find Next"; + this.mnuFindNext.Click += new System.EventHandler(this.mnuFindNext_Click); // // mnuFindPrev // @@ -396,6 +348,15 @@ this.mnuFindPrev.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Shift | System.Windows.Forms.Keys.F3))); this.mnuFindPrev.Size = new System.Drawing.Size(196, 22); this.mnuFindPrev.Text = "Find Previous"; + this.mnuFindPrev.Click += new System.EventHandler(this.mnuFindPrev_Click); + // + // mnuGoTo + // + this.mnuGoTo.Name = "mnuGoTo"; + this.mnuGoTo.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.G))); + this.mnuGoTo.Size = new System.Drawing.Size(196, 22); + this.mnuGoTo.Text = "Go to..."; + this.mnuGoTo.Click += new System.EventHandler(this.mnuGoTo_Click); // // toolsToolStripMenuItem // @@ -432,13 +393,55 @@ this.mnuMemoryViewer.Text = "Memory Viewer"; this.mnuMemoryViewer.Click += new System.EventHandler(this.mnuMemoryViewer_Click); // - // mnuGoTo + // ctrlDebuggerCode // - this.mnuGoTo.Name = "mnuGoTo"; - this.mnuGoTo.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.G))); - this.mnuGoTo.Size = new System.Drawing.Size(196, 22); - this.mnuGoTo.Text = "Go to..."; - this.mnuGoTo.Click += new System.EventHandler(this.mnuGoTo_Click); + this.ctrlDebuggerCode.Code = null; + this.ctrlDebuggerCode.ContextMenuStrip = this.contextMenuCode; + this.ctrlDebuggerCode.Dock = System.Windows.Forms.DockStyle.Fill; + this.ctrlDebuggerCode.Location = new System.Drawing.Point(3, 3); + this.ctrlDebuggerCode.Name = "ctrlDebuggerCode"; + this.ctrlDebuggerCode.Size = new System.Drawing.Size(546, 416); + this.ctrlDebuggerCode.TabIndex = 2; + this.ctrlDebuggerCode.OnWatchAdded += new Mesen.GUI.Debugger.ctrlDebuggerCode.WatchAddedEventHandler(this.ctrlDebuggerCode_OnWatchAdded); + this.ctrlDebuggerCode.Enter += new System.EventHandler(this.ctrlDebuggerCode_Enter); + // + // ctrlConsoleStatus + // + this.ctrlConsoleStatus.Dock = System.Windows.Forms.DockStyle.Top; + this.ctrlConsoleStatus.Location = new System.Drawing.Point(552, 0); + this.ctrlConsoleStatus.Margin = new System.Windows.Forms.Padding(0); + this.ctrlConsoleStatus.Name = "ctrlConsoleStatus"; + this.ctrlConsoleStatus.Size = new System.Drawing.Size(432, 362); + this.ctrlConsoleStatus.TabIndex = 3; + // + // ctrlDebuggerCodeSplit + // + this.ctrlDebuggerCodeSplit.Code = null; + this.ctrlDebuggerCodeSplit.Dock = System.Windows.Forms.DockStyle.Fill; + this.ctrlDebuggerCodeSplit.Location = new System.Drawing.Point(555, 3); + this.ctrlDebuggerCodeSplit.Name = "ctrlDebuggerCodeSplit"; + this.ctrlDebuggerCodeSplit.Size = new System.Drawing.Size(1, 416); + this.ctrlDebuggerCodeSplit.TabIndex = 4; + this.ctrlDebuggerCodeSplit.Visible = false; + this.ctrlDebuggerCodeSplit.OnWatchAdded += new Mesen.GUI.Debugger.ctrlDebuggerCode.WatchAddedEventHandler(this.ctrlDebuggerCode_OnWatchAdded); + this.ctrlDebuggerCodeSplit.Enter += new System.EventHandler(this.ctrlDebuggerCodeSplit_Enter); + // + // ctrlBreakpoints + // + 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(480, 137); + this.ctrlBreakpoints.TabIndex = 0; + this.ctrlBreakpoints.BreakpointChanged += new System.EventHandler(this.ctrlBreakpoints_BreakpointChanged); + // + // ctrlWatch + // + 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(480, 137); + this.ctrlWatch.TabIndex = 0; // // frmDebugger // diff --git a/GUI.NET/Debugger/frmDebugger.cs b/GUI.NET/Debugger/frmDebugger.cs index af5adb6e..20939941 100644 --- a/GUI.NET/Debugger/frmDebugger.cs +++ b/GUI.NET/Debugger/frmDebugger.cs @@ -59,6 +59,7 @@ namespace Mesen.GUI.Debugger tlpTop.ColumnStyles[1].Width = 0f; this.MinimumSize = new Size(1000, 650); } + ctrlDebuggerCodeSplit.Visible = mnuSplitView.Checked; return mnuSplitView.Checked; } @@ -152,7 +153,17 @@ namespace Mesen.GUI.Debugger private void mnuFind_Click(object sender, EventArgs e) { + _lastCodeWindow.OpenSearchBox(); + } + + private void mnuFindNext_Click(object sender, EventArgs e) + { + _lastCodeWindow.FindNext(); + } + private void mnuFindPrev_Click(object sender, EventArgs e) + { + _lastCodeWindow.FindPrevious(); } private void mnuSplitView_Click(object sender, EventArgs e) diff --git a/GUI.NET/GUI.NET.csproj b/GUI.NET/GUI.NET.csproj index b67f597a..4772a746 100644 --- a/GUI.NET/GUI.NET.csproj +++ b/GUI.NET/GUI.NET.csproj @@ -335,6 +335,9 @@ + + + diff --git a/GUI.NET/Properties/Resources.Designer.cs b/GUI.NET/Properties/Resources.Designer.cs index 602bcfcc..1d54d584 100644 --- a/GUI.NET/Properties/Resources.Designer.cs +++ b/GUI.NET/Properties/Resources.Designer.cs @@ -60,6 +60,16 @@ namespace Mesen.GUI.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap Close { + get { + object obj = ResourceManager.GetObject("Close", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). /// @@ -79,5 +89,25 @@ namespace Mesen.GUI.Properties { return ((System.Drawing.Bitmap)(obj)); } } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap NextArrow { + get { + object obj = ResourceManager.GetObject("NextArrow", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap PreviousArrow { + get { + object obj = ResourceManager.GetObject("PreviousArrow", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } } } diff --git a/GUI.NET/Properties/Resources.resx b/GUI.NET/Properties/Resources.resx index cdc6126c..c9368818 100644 --- a/GUI.NET/Properties/Resources.resx +++ b/GUI.NET/Properties/Resources.resx @@ -118,10 +118,19 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\resources\close.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Icon.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\MesenLogo.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\NextArrow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\resources\previousarrow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/GUI.NET/Resources/Close.png b/GUI.NET/Resources/Close.png new file mode 100644 index 0000000000000000000000000000000000000000..f9be61945c6f726a39d9f5e46fa344971143727a GIT binary patch literal 239 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmSN`?>!lvI6;>1s;*b z3=DjSL74G){)!Z!phSslL`iUdT1k0gQ7S`0VrE{6US4X6f{C7io@r{UQ7TYPuBVG* zh=u>so|C)>6nI!(_8!u>d(lm4(^(deiZjXQlhWK5{A^W-%2wO+e4$Ot)@#yMm8UmO z@ZS8!QXphbud9VX<%5&Sf-dcT89HpvGO`zTIIBB8*=SN(XDs_ZrQ!ki>KcuUJDe*u e{xF`cT@#bNVwJIP^ok~+#SEUVelF{r5}E+eHBtot literal 0 HcmV?d00001 diff --git a/GUI.NET/Resources/NextArrow.png b/GUI.NET/Resources/NextArrow.png new file mode 100644 index 0000000000000000000000000000000000000000..b04a5901c1c2326cca01f13bfe229f444a241694 GIT binary patch literal 356 zcmV-q0h|7bP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0QpHoK~y+Ty^=Am zML-mWf3K6M^b!jYo!EdKsFdu%4k#&=I;~bzDmFl=L@!ZjWUd(#$&KVb?n~a+j5Fi^ z#u+0JLhu)U`1m#dBgnFhgkeawZM*b)OR%mhs;WX9#~6m;O>#@H@65)sERm)u`o2FU z>@Q5yMB29HQ&*a%L0#9p0u)6-6h)9_SzrR&w#huteEA-Gm`RwxvaGKzgQ}{>8Hl3D zCZ0euuInCO&~+Ud$B{2xDT;!=!z)0NBm_YKP1BAu_>CkPx#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0RBltK~y+T#gnm) zMnDk9XLTw)uYgV@Jb~65P-;b|QD{AaPE;O1rPeD|s3j7GM&>?~J-IJm;(T|P+^?DZ zXLtVD-I-;G2){w#@yGnV!M^X9rYROhaqDhR2GcZQmSxa14Q$)Sv)7ykecxlA=TO%* z>BmVZeg}17o@Wfh5XN!jX#m@{!Llr_UePoSWLaix7zQeSnDC{0NRk9qRWTt+lDCTw zmSv$Rc%BEMD3W-G&l-AzuIn(4V_4Ufk_W1)g5x+`y`m_}v4@?b+_o*2WqFv9c3l^O zAYddeINNBNCi8tC48!1=dpr%2uIns{B0B!p>s;~QzY*XAfaPVffvof@00000NkvXX Hu0mjfVg{7- literal 0 HcmV?d00001