Debugger - Search functionality (Ctrl-F, F3)
This commit is contained in:
parent
fe2e70fe52
commit
4b9ab622ca
12 changed files with 423 additions and 81 deletions
|
@ -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<int> lineNumbers = new List<int>();
|
||||
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
131
GUI.NET/Debugger/frmDebugger.Designer.cs
generated
131
GUI.NET/Debugger/frmDebugger.Designer.cs
generated
|
@ -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
|
||||
//
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -335,6 +335,9 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Icon.ico" />
|
||||
<None Include="Resources\Close.png" />
|
||||
<None Include="Resources\PreviousArrow.png" />
|
||||
<None Include="Resources\NextArrow.png" />
|
||||
<None Include="Resources\MesenIcon.ico" />
|
||||
<None Include="Resources\MesenLogo.bmp" />
|
||||
</ItemGroup>
|
||||
|
|
30
GUI.NET/Properties/Resources.Designer.cs
generated
30
GUI.NET/Properties/Resources.Designer.cs
generated
|
@ -60,6 +60,16 @@ namespace Mesen.GUI.Properties {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Close {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Close", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
|
||||
/// </summary>
|
||||
|
@ -79,5 +89,25 @@ namespace Mesen.GUI.Properties {
|
|||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap NextArrow {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("NextArrow", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap PreviousArrow {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("PreviousArrow", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,10 +118,19 @@
|
|||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="Close" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\resources\close.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="MesenIcon" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Icon.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="MesenLogo" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\MesenLogo.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="NextArrow" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\NextArrow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="PreviousArrow" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\resources\previousarrow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
BIN
GUI.NET/Resources/Close.png
Normal file
BIN
GUI.NET/Resources/Close.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 239 B |
BIN
GUI.NET/Resources/NextArrow.png
Normal file
BIN
GUI.NET/Resources/NextArrow.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 356 B |
BIN
GUI.NET/Resources/PreviousArrow.png
Normal file
BIN
GUI.NET/Resources/PreviousArrow.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 361 B |
Loading…
Add table
Reference in a new issue