From 150a1feb12495bd27794e14a797c1d1f358a9306 Mon Sep 17 00:00:00 2001 From: Sour Date: Wed, 3 Jan 2018 21:33:04 -0500 Subject: [PATCH] Debugger: Code window syntax highlighting support --- GUI.NET/Config/DebugInfo.cs | 5 +- GUI.NET/Debugger/Controls/ctrlDebuggerCode.cs | 1 + GUI.NET/Debugger/Controls/ctrlTextbox.cs | 153 ++++++++------ GUI.NET/Debugger/frmAssembler.cs | 1 + .../Debugger/frmAssemblerColors.Designer.cs | 22 +- GUI.NET/Debugger/frmAssemblerColors.cs | 4 +- .../Debugger/frmDebuggerColors.Designer.cs | 200 +++++++++++++++++- GUI.NET/Debugger/frmDebuggerColors.cs | 22 ++ 8 files changed, 327 insertions(+), 81 deletions(-) diff --git a/GUI.NET/Config/DebugInfo.cs b/GUI.NET/Config/DebugInfo.cs index 313750d4..a2117226 100644 --- a/GUI.NET/Config/DebugInfo.cs +++ b/GUI.NET/Config/DebugInfo.cs @@ -134,6 +134,7 @@ namespace Mesen.GUI.Config public XmlColor CodeWriteBreakpointColor = Color.FromArgb(40, 120, 80); public XmlColor CodeReadBreakpointColor = Color.FromArgb(40, 40, 200); public XmlColor CodeActiveStatementColor = Color.Yellow; + public XmlColor CodeEffectiveAddressColor = Color.SteelBlue; public bool RamAutoRefresh = true; public int RamColumnCount = 2; @@ -203,8 +204,8 @@ namespace Mesen.GUI.Config public int ScriptZoom = 100; public bool AssemblerCodeHighlighting = true; - public XmlColor AssemblerOpcodeColor = Color.DarkSlateGray; - public XmlColor AssemblerLabelDefinitionColor = Color.Blue; + public XmlColor AssemblerOpcodeColor = Color.FromArgb(22, 37, 37); + public XmlColor AssemblerLabelDefinitionColor = Color.FromArgb(0, 114, 174); public XmlColor AssemblerImmediateColor = Color.Chocolate; public XmlColor AssemblerAddressColor = Color.DarkRed; public XmlColor AssemblerCommentColor = Color.Green; diff --git a/GUI.NET/Debugger/Controls/ctrlDebuggerCode.cs b/GUI.NET/Debugger/Controls/ctrlDebuggerCode.cs index b5f9a81e..a9223ff8 100644 --- a/GUI.NET/Debugger/Controls/ctrlDebuggerCode.cs +++ b/GUI.NET/Debugger/Controls/ctrlDebuggerCode.cs @@ -245,6 +245,7 @@ namespace Mesen.GUI.Debugger } } + result.Add(""); return result; } diff --git a/GUI.NET/Debugger/Controls/ctrlTextbox.cs b/GUI.NET/Debugger/Controls/ctrlTextbox.cs index 8daf82a6..58ee04a0 100644 --- a/GUI.NET/Debugger/Controls/ctrlTextbox.cs +++ b/GUI.NET/Debugger/Controls/ctrlTextbox.cs @@ -1,4 +1,5 @@ -using System; +using Mesen.GUI.Config; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; @@ -39,6 +40,7 @@ namespace Mesen.GUI.Debugger public partial class ctrlTextbox : Control { + private Regex _codeRegex = new Regex("([a-z]{3})([*]{0,1})[ ]{0,1}([(]{0,1})(([#]{0,1}[$][0-9a-f]*)|([@_a-z]([@_a-z0-9])*)){0,1}([)]{0,1})(,X|,Y){0,1}([)]{0,1})", RegexOptions.IgnoreCase | RegexOptions.Compiled); public event EventHandler ScrollPositionChanged; private bool _disableScrollPositionChangedEvent; @@ -836,13 +838,13 @@ namespace Mesen.GUI.Debugger bool isBlockStart = codeString.StartsWith("__") && codeString.EndsWith("__"); bool isBlockEnd = codeString.StartsWith("--") && codeString.EndsWith("--"); - Color textColor = Color.Black; + Color? textColor = null; LineProperties lineProperties = GetLineStyle(currentLine); //Setup text and bg color (only if the line is not the start/end of a block) if(lineProperties != null) { //Process background, foreground, outline color and line symbol - textColor = lineProperties.FgColor ?? Color.Black; + textColor = lineProperties.FgColor; if(lineProperties.LineBgColor.HasValue) { using(Brush bgBrush = new SolidBrush(lineProperties.LineBgColor.Value)) { @@ -856,7 +858,20 @@ namespace Mesen.GUI.Debugger } } } + } + if(currentLine >= this.SelectionStart && currentLine <= this.SelectionStart + this.SelectionLength) { + //Highlight current line + using(Brush brush = new SolidBrush(Color.FromArgb(150, 185, 210, 255))) { + int offset = currentLine - 1 == this.SelectedLine ? 1 : 0; + g.FillRectangle(brush, originalMargin, positionY + offset, Math.Max(_maxLineWidth, this.ClientRectangle.Width), lineHeight - offset); + } + if(currentLine == this.SelectedLine) { + g.DrawRectangle(Pens.Blue, originalMargin + 1, positionY + 1, Math.Max(_maxLineWidth, this.ClientRectangle.Width - originalMargin) - 1, lineHeight); + } + } + + if(lineProperties != null) { if(!isBlockStart && !isBlockEnd && lineProperties.TextBgColor.HasValue) { using(Brush bgBrush = new SolidBrush(lineProperties.TextBgColor.Value)) { int yOffset = Program.IsMono ? 2 : 1; @@ -866,22 +881,11 @@ namespace Mesen.GUI.Debugger if(!isBlockStart && !isBlockEnd && lineProperties.OutlineColor.HasValue) { using(Pen outlinePen = new Pen(lineProperties.OutlineColor.Value, 1)) { - g.DrawRectangle(outlinePen, marginLeft, positionY + 1, codeStringLength, lineHeight-1); + g.DrawRectangle(outlinePen, marginLeft, positionY + 1, codeStringLength, lineHeight - 1); } } } - if(currentLine >= this.SelectionStart && currentLine <= this.SelectionStart + this.SelectionLength) { - //Highlight current line - using(Brush brush = new SolidBrush(Color.FromArgb(150, 200, 200, 255))) { - int offset = currentLine - 1 == this.SelectedLine ? 1 : 0; - g.FillRectangle(brush, originalMargin, positionY + offset, Math.Max(_maxLineWidth, this.ClientRectangle.Width), lineHeight - offset); - } - if(currentLine == this.SelectedLine) { - g.DrawRectangle(Pens.Blue, originalMargin + 1, positionY + 1, Math.Max(_maxLineWidth, this.ClientRectangle.Width - originalMargin) - 1, lineHeight); - } - } - this.DrawLineText(g, currentLine, marginLeft, positionY, codeString, addressString, commentString, codeStringLength, addressStringLength, textColor, lineHeight); } @@ -911,55 +915,82 @@ namespace Mesen.GUI.Debugger } } - private void DrawLineText(Graphics g, int currentLine, int marginLeft, int positionY, string codeString, string addressString, string commentString, float codeStringLength, float addressStringLength, Color textColor, int lineHeight) + private void DrawLineText(Graphics g, int currentLine, int marginLeft, int positionY, string codeString, string addressString, string commentString, float codeStringLength, float addressStringLength, Color? textColor, int lineHeight) { - using(Brush fgBrush = new SolidBrush(textColor)) { - if(codeString.StartsWith("__") && codeString.EndsWith("__") || codeString.StartsWith("--") && codeString.EndsWith("--")) { - //Draw block start/end - g.TranslateTransform(HorizontalScrollPosition * HorizontalScrollFactor, 0); - string text = codeString.Substring(2, codeString.Length - 4); - float yOffset = codeString.StartsWith("__") ? 2 : -2; - if(text.Length > 0) { - SizeF size = g.MeasureString(text, this._noteFont, int.MaxValue, StringFormat.GenericTypographic); - float textLength = size.Width; - float textHeight = size.Height; - float positionX = (marginLeft + this.Width - textLength) / 2; - g.DrawLine(Pens.Black, marginLeft, yOffset + positionY + lineHeight / 2, marginLeft + this.Width, yOffset + positionY + lineHeight / 2); - yOffset = codeString.StartsWith("__") ? 3 : 2; - g.FillRectangle(Brushes.White, positionX - 4, yOffset + positionY, textLength + 8, textHeight); - g.DrawRectangle(Pens.Black, positionX - 4, yOffset + positionY, textLength + 8, textHeight); - g.DrawString(text, this._noteFont, fgBrush, positionX, yOffset + positionY, StringFormat.GenericTypographic); - } else { - g.DrawLine(Pens.Black, marginLeft, yOffset + positionY + lineHeight / 2, marginLeft + this.Width, yOffset + positionY + lineHeight / 2); - } - g.TranslateTransform(-HorizontalScrollPosition * HorizontalScrollFactor, 0); + DebugInfo info = ConfigManager.Config.DebugInfo; + + if(codeString.StartsWith("__") && codeString.EndsWith("__") || codeString.StartsWith("--") && codeString.EndsWith("--")) { + //Draw block start/end + g.TranslateTransform(HorizontalScrollPosition * HorizontalScrollFactor, 0); + string text = codeString.Substring(2, codeString.Length - 4); + float yOffset = codeString.StartsWith("__") ? 2 : -2; + if(text.Length > 0) { + SizeF size = g.MeasureString(text, this._noteFont, int.MaxValue, StringFormat.GenericTypographic); + float textLength = size.Width; + float textHeight = size.Height; + float positionX = (marginLeft + this.Width - textLength) / 2; + g.DrawLine(Pens.Black, marginLeft, yOffset + positionY + lineHeight / 2, marginLeft + this.Width, yOffset + positionY + lineHeight / 2); + yOffset = codeString.StartsWith("__") ? 3 : 2; + g.FillRectangle(Brushes.White, positionX - 4, yOffset + positionY, textLength + 8, textHeight); + g.DrawRectangle(Pens.Black, positionX - 4, yOffset + positionY, textLength + 8, textHeight); + g.DrawString(text, this._noteFont, Brushes.Black, positionX, yOffset + positionY, StringFormat.GenericTypographic); } else { - //Draw line content - g.DrawString(codeString, this.Font, fgBrush, marginLeft, positionY, StringFormat.GenericTypographic); - - if(!string.IsNullOrWhiteSpace(addressString)) { - using(Brush addressBrush = new SolidBrush(Color.SteelBlue)) { - g.DrawString(addressString, this.Font, addressBrush, marginLeft + codeStringLength, positionY, StringFormat.GenericTypographic); - } - } - - if(!string.IsNullOrWhiteSpace(commentString)) { - using(Brush commentBrush = new SolidBrush(Color.DarkGreen)) { - int padding = Math.Max(CommentSpacingCharCount, codeString.Length + addressString.Length); - if(codeString.Length == 0 && addressString.Length == 0) { - //Draw comment left-aligned, next to the margin when there is no code on the line - padding = 0; - } - g.DrawString(commentString.PadLeft(padding+commentString.Length), this.Font, commentBrush, marginLeft, positionY, StringFormat.GenericTypographic); - } - } - - if(this.ShowContentNotes && !this.ShowSingleContentLineNotes) { - g.DrawString(_contentNotes[currentLine], _noteFont, Brushes.Gray, marginLeft, positionY + this.Font.Size+3, StringFormat.GenericTypographic); - } - this.DrawHighlightedSearchString(g, codeString, marginLeft, positionY); - this.DrawHighlightedCompareString(g, codeString, currentLine, marginLeft, positionY); + g.DrawLine(Pens.Black, marginLeft, yOffset + positionY + lineHeight / 2, marginLeft + this.Width, yOffset + positionY + lineHeight / 2); } + g.TranslateTransform(-HorizontalScrollPosition * HorizontalScrollFactor, 0); + } else { + //Draw line content + Color defaultColor = Color.FromArgb(60, 60, 60); + if(codeString.Length > 0) { + Match match = _codeRegex.Match(codeString); + if(match.Success && !codeString.EndsWith(":") && textColor == null) { + string opcode = match.Groups[1].Value; + string invalidStar = match.Groups[2].Value; + string paren1 = match.Groups[3].Value; + string operand = match.Groups[4].Value; + string paren2 = match.Groups[8].Value; + string indirect = match.Groups[9].Value; + string paren3 = match.Groups[10].Value; + List parts = new List() { opcode, invalidStar, " ", paren1, operand, paren2, indirect, paren3 }; + Color operandColor = operand.Length > 0 ? (operand[0] == '#' ? (Color)info.AssemblerImmediateColor : (operand[0] == '$' ? (Color)info.AssemblerAddressColor : (Color)info.AssemblerLabelDefinitionColor)) : Color.Black; + List colors = new List() { info.AssemblerOpcodeColor, defaultColor, defaultColor, defaultColor, operandColor, defaultColor, defaultColor, defaultColor }; + + float xOffset = 0; + for(int i = 0; i < parts.Count; i++) { + using(Brush b = new SolidBrush(colors[i])) { + g.DrawString(parts[i], this.Font, b, marginLeft + xOffset, positionY, StringFormat.GenericTypographic); + xOffset += g.MeasureString("".PadLeft(parts[i].Length, 'w'), this.Font, Point.Empty, StringFormat.GenericTypographic).Width; + } + } + } else { + using(Brush fgBrush = new SolidBrush(codeString.EndsWith(":") ? (Color)info.AssemblerLabelDefinitionColor : (textColor ?? defaultColor))) { + g.DrawString(codeString, this.Font, fgBrush, marginLeft, positionY, StringFormat.GenericTypographic); + } + } + } + + if(!string.IsNullOrWhiteSpace(addressString)) { + using(Brush addressBrush = new SolidBrush(info.CodeEffectiveAddressColor)) { + g.DrawString(addressString, this.Font, addressBrush, marginLeft + codeStringLength, positionY, StringFormat.GenericTypographic); + } + } + + if(!string.IsNullOrWhiteSpace(commentString)) { + using(Brush commentBrush = new SolidBrush(info.AssemblerCommentColor)) { + int padding = Math.Max(CommentSpacingCharCount, codeString.Length + addressString.Length + 1); + if(codeString.Length == 0 && addressString.Length == 0) { + //Draw comment left-aligned, next to the margin when there is no code on the line + padding = 0; + } + g.DrawString(commentString.PadLeft(padding+commentString.Length), this.Font, commentBrush, marginLeft, positionY, StringFormat.GenericTypographic); + } + } + + if(this.ShowContentNotes && !this.ShowSingleContentLineNotes) { + g.DrawString(_contentNotes[currentLine], _noteFont, Brushes.Gray, marginLeft, positionY + this.Font.Size+3, StringFormat.GenericTypographic); + } + this.DrawHighlightedSearchString(g, codeString, marginLeft, positionY); + this.DrawHighlightedCompareString(g, codeString, currentLine, marginLeft, positionY); } } diff --git a/GUI.NET/Debugger/frmAssembler.cs b/GUI.NET/Debugger/frmAssembler.cs index 9bcbf57d..7c0aeb8f 100644 --- a/GUI.NET/Debugger/frmAssembler.cs +++ b/GUI.NET/Debugger/frmAssembler.cs @@ -97,6 +97,7 @@ namespace Mesen.GUI.Debugger syntax.styles.Add(new TextStyle(new SolidBrush(ConfigManager.Config.DebugInfo.AssemblerCommentColor), Brushes.Transparent, FontStyle.Regular)); syntax.rules.Add(new RuleDesc() { style = syntax.styles[0], pattern = @"(\n|^)[ \t]*(?[a-zA-Z]{3}[*]{0,1})( |[^:a-zA-Z])" }); syntax.rules.Add(new RuleDesc() { style = syntax.styles[1], pattern = @"(\n|^)[ \t]*(?[a-zA-Z_]*):" }); + syntax.rules.Add(new RuleDesc() { style = syntax.styles[1], pattern = @"(\n|^)[ \t]*[a-zA-Z]{3}[*]{0,1}[ \t]+[(]{0,1}(?[@_a-zA-Z]([@_a-zA-Z0-9])+)" }); syntax.rules.Add(new RuleDesc() { style = syntax.styles[2], pattern = @"(\n|^)[ \t]*[a-zA-Z]{3}[*]{0,1}[ \t]+(?#[$]{0,1}([A-Fa-f0-9])+)" }); syntax.rules.Add(new RuleDesc() { style = syntax.styles[3], pattern = @"(\n|^)[ \t]*[a-zA-Z]{3}[*]{0,1}[ \t]+[(]{0,1}(?([$][A-Fa-f0-9]+)|([0-9]+))[)]{0,1}[ \t]*(,X|,Y|,x|,y){0,1}[)]{0,1}" }); syntax.rules.Add(new RuleDesc() { style = syntax.styles[4], pattern = @"(\n|^)[^\n;]*(?;[^\n]*)" }); diff --git a/GUI.NET/Debugger/frmAssemblerColors.Designer.cs b/GUI.NET/Debugger/frmAssemblerColors.Designer.cs index a9c34f5d..0a1cccaf 100644 --- a/GUI.NET/Debugger/frmAssemblerColors.Designer.cs +++ b/GUI.NET/Debugger/frmAssemblerColors.Designer.cs @@ -33,7 +33,7 @@ this.picImmediate = new System.Windows.Forms.PictureBox(); this.picLabelDefinition = new System.Windows.Forms.PictureBox(); this.lblImmediate = new System.Windows.Forms.Label(); - this.lblLabelDefinition = new System.Windows.Forms.Label(); + this.lblLabel = new System.Windows.Forms.Label(); this.lblOpcode = new System.Windows.Forms.Label(); this.lblAddress = new System.Windows.Forms.Label(); this.lblComment = new System.Windows.Forms.Label(); @@ -65,7 +65,7 @@ this.tableLayoutPanel1.Controls.Add(this.picImmediate, 1, 2); this.tableLayoutPanel1.Controls.Add(this.picLabelDefinition, 1, 1); this.tableLayoutPanel1.Controls.Add(this.lblImmediate, 0, 2); - this.tableLayoutPanel1.Controls.Add(this.lblLabelDefinition, 0, 1); + this.tableLayoutPanel1.Controls.Add(this.lblLabel, 0, 1); this.tableLayoutPanel1.Controls.Add(this.lblOpcode, 0, 0); this.tableLayoutPanel1.Controls.Add(this.lblAddress, 0, 3); this.tableLayoutPanel1.Controls.Add(this.lblComment, 0, 4); @@ -137,15 +137,15 @@ this.lblImmediate.TabIndex = 4; this.lblImmediate.Text = "Immediate Value:"; // - // lblLabelDefinition + // lblLabel // - this.lblLabelDefinition.Anchor = System.Windows.Forms.AnchorStyles.Left; - this.lblLabelDefinition.AutoSize = true; - this.lblLabelDefinition.Location = new System.Drawing.Point(3, 50); - this.lblLabelDefinition.Name = "lblLabelDefinition"; - this.lblLabelDefinition.Size = new System.Drawing.Size(83, 13); - this.lblLabelDefinition.TabIndex = 2; - this.lblLabelDefinition.Text = "Label Definition:"; + this.lblLabel.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.lblLabel.AutoSize = true; + this.lblLabel.Location = new System.Drawing.Point(3, 50); + this.lblLabel.Name = "lblLabel"; + this.lblLabel.Size = new System.Drawing.Size(36, 13); + this.lblLabel.TabIndex = 2; + this.lblLabel.Text = "Label:"; // // lblOpcode // @@ -225,7 +225,7 @@ private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; private System.Windows.Forms.Label lblImmediate; - private System.Windows.Forms.Label lblLabelDefinition; + private System.Windows.Forms.Label lblLabel; private System.Windows.Forms.Label lblOpcode; private System.Windows.Forms.Label lblAddress; private System.Windows.Forms.Label lblComment; diff --git a/GUI.NET/Debugger/frmAssemblerColors.cs b/GUI.NET/Debugger/frmAssemblerColors.cs index 540e4fa4..2fa8dcad 100644 --- a/GUI.NET/Debugger/frmAssemblerColors.cs +++ b/GUI.NET/Debugger/frmAssemblerColors.cs @@ -53,8 +53,8 @@ namespace Mesen.GUI.Debugger private void btnReset_Click(object sender, EventArgs e) { - picOpcode.BackColor = Color.DarkSlateGray; - picLabelDefinition.BackColor = Color.Blue; + picOpcode.BackColor = Color.FromArgb(22, 37, 37); + picLabelDefinition.BackColor = Color.FromArgb(0, 114, 174); picImmediate.BackColor = Color.Chocolate; picAddress.BackColor = Color.DarkRed; picComment.BackColor = Color.Green; diff --git a/GUI.NET/Debugger/frmDebuggerColors.Designer.cs b/GUI.NET/Debugger/frmDebuggerColors.Designer.cs index d1c38a78..e8e79fdf 100644 --- a/GUI.NET/Debugger/frmDebuggerColors.Designer.cs +++ b/GUI.NET/Debugger/frmDebuggerColors.Designer.cs @@ -28,6 +28,8 @@ private void InitializeComponent() { this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.lblOpcode = new System.Windows.Forms.Label(); + this.lblPauseBackgroundSettings = new System.Windows.Forms.Label(); this.picActiveStatement = new System.Windows.Forms.PictureBox(); this.lblActiveStatement = new System.Windows.Forms.Label(); this.lblExecBreakpoint = new System.Windows.Forms.Label(); @@ -42,7 +44,18 @@ this.picVerifiedData = new System.Windows.Forms.PictureBox(); this.lblReadBreakpoint = new System.Windows.Forms.Label(); this.picReadBreakpoint = new System.Windows.Forms.PictureBox(); + this.picOpcode = new System.Windows.Forms.PictureBox(); + this.lblLabelDefinition = new System.Windows.Forms.Label(); + this.picLabelDefinition = new System.Windows.Forms.PictureBox(); + this.lblImmediate = new System.Windows.Forms.Label(); + this.picImmediate = new System.Windows.Forms.PictureBox(); + this.lblAddress = new System.Windows.Forms.Label(); + this.picAddress = new System.Windows.Forms.PictureBox(); + this.lblComment = new System.Windows.Forms.Label(); + this.picComment = new System.Windows.Forms.PictureBox(); this.btnReset = new System.Windows.Forms.Button(); + this.lblEffectiveAddress = new System.Windows.Forms.Label(); + this.picEffectiveAddress = new System.Windows.Forms.PictureBox(); this.baseConfigPanel.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.picActiveStatement)).BeginInit(); @@ -52,12 +65,18 @@ ((System.ComponentModel.ISupportInitialize)(this.picUnexecutedCode)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.picVerifiedData)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.picReadBreakpoint)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.picOpcode)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.picLabelDefinition)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.picImmediate)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.picAddress)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.picComment)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.picEffectiveAddress)).BeginInit(); this.SuspendLayout(); // // baseConfigPanel // this.baseConfigPanel.Controls.Add(this.btnReset); - this.baseConfigPanel.Location = new System.Drawing.Point(0, 116); + this.baseConfigPanel.Location = new System.Drawing.Point(0, 212); this.baseConfigPanel.Size = new System.Drawing.Size(555, 29); this.baseConfigPanel.Controls.SetChildIndex(this.btnReset, 0); // @@ -72,6 +91,8 @@ this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33334F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel1.Controls.Add(this.lblOpcode, 0, 4); + this.tableLayoutPanel1.Controls.Add(this.lblPauseBackgroundSettings, 0, 3); this.tableLayoutPanel1.Controls.Add(this.picActiveStatement, 1, 2); this.tableLayoutPanel1.Controls.Add(this.lblActiveStatement, 0, 2); this.tableLayoutPanel1.Controls.Add(this.lblExecBreakpoint, 0, 1); @@ -86,20 +107,54 @@ this.tableLayoutPanel1.Controls.Add(this.picVerifiedData, 1, 0); this.tableLayoutPanel1.Controls.Add(this.lblReadBreakpoint, 6, 1); this.tableLayoutPanel1.Controls.Add(this.picReadBreakpoint, 7, 1); + this.tableLayoutPanel1.Controls.Add(this.picOpcode, 1, 4); + this.tableLayoutPanel1.Controls.Add(this.lblLabelDefinition, 3, 4); + this.tableLayoutPanel1.Controls.Add(this.picLabelDefinition, 4, 4); + this.tableLayoutPanel1.Controls.Add(this.lblImmediate, 6, 4); + this.tableLayoutPanel1.Controls.Add(this.picImmediate, 7, 4); + this.tableLayoutPanel1.Controls.Add(this.lblAddress, 0, 5); + this.tableLayoutPanel1.Controls.Add(this.picAddress, 1, 5); + this.tableLayoutPanel1.Controls.Add(this.lblComment, 3, 5); + this.tableLayoutPanel1.Controls.Add(this.picComment, 4, 5); + this.tableLayoutPanel1.Controls.Add(this.lblEffectiveAddress, 3, 2); + this.tableLayoutPanel1.Controls.Add(this.picEffectiveAddress, 4, 2); this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 6; + this.tableLayoutPanel1.RowCount = 7; 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()); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); 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.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(555, 145); + this.tableLayoutPanel1.Size = new System.Drawing.Size(555, 241); this.tableLayoutPanel1.TabIndex = 2; // + // lblOpcode + // + this.lblOpcode.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.lblOpcode.AutoSize = true; + this.lblOpcode.Location = new System.Drawing.Point(3, 146); + this.lblOpcode.Name = "lblOpcode"; + this.lblOpcode.Size = new System.Drawing.Size(48, 13); + this.lblOpcode.TabIndex = 25; + this.lblOpcode.Text = "Opcode:"; + // + // lblPauseBackgroundSettings + // + this.lblPauseBackgroundSettings.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.lblPauseBackgroundSettings.AutoSize = true; + this.tableLayoutPanel1.SetColumnSpan(this.lblPauseBackgroundSettings, 3); + this.lblPauseBackgroundSettings.ForeColor = System.Drawing.SystemColors.GrayText; + this.lblPauseBackgroundSettings.Location = new System.Drawing.Point(0, 121); + this.lblPauseBackgroundSettings.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0); + this.lblPauseBackgroundSettings.Name = "lblPauseBackgroundSettings"; + this.lblPauseBackgroundSettings.Size = new System.Drawing.Size(97, 13); + this.lblPauseBackgroundSettings.TabIndex = 24; + this.lblPauseBackgroundSettings.Text = "Syntax Highlighting"; + // // picActiveStatement // this.picActiveStatement.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; @@ -247,6 +302,101 @@ this.picReadBreakpoint.TabStop = false; this.picReadBreakpoint.Click += new System.EventHandler(this.picColorPicker_Click); // + // picOpcode + // + this.picOpcode.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.picOpcode.Cursor = System.Windows.Forms.Cursors.Hand; + this.picOpcode.Location = new System.Drawing.Point(136, 137); + this.picOpcode.Name = "picOpcode"; + this.picOpcode.Size = new System.Drawing.Size(32, 32); + this.picOpcode.TabIndex = 26; + this.picOpcode.TabStop = false; + this.picOpcode.Click += new System.EventHandler(this.picColorPicker_Click); + // + // lblLabelDefinition + // + this.lblLabelDefinition.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.lblLabelDefinition.AutoSize = true; + this.lblLabelDefinition.Location = new System.Drawing.Point(194, 146); + this.lblLabelDefinition.Name = "lblLabelDefinition"; + this.lblLabelDefinition.Size = new System.Drawing.Size(36, 13); + this.lblLabelDefinition.TabIndex = 27; + this.lblLabelDefinition.Text = "Label:"; + // + // picLabelDefinition + // + this.picLabelDefinition.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.picLabelDefinition.Cursor = System.Windows.Forms.Cursors.Hand; + this.picLabelDefinition.Location = new System.Drawing.Point(327, 137); + this.picLabelDefinition.Name = "picLabelDefinition"; + this.picLabelDefinition.Size = new System.Drawing.Size(32, 32); + this.picLabelDefinition.TabIndex = 28; + this.picLabelDefinition.TabStop = false; + this.picLabelDefinition.Click += new System.EventHandler(this.picColorPicker_Click); + // + // lblImmediate + // + this.lblImmediate.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.lblImmediate.AutoSize = true; + this.lblImmediate.Location = new System.Drawing.Point(385, 146); + this.lblImmediate.Name = "lblImmediate"; + this.lblImmediate.Size = new System.Drawing.Size(88, 13); + this.lblImmediate.TabIndex = 29; + this.lblImmediate.Text = "Immediate Value:"; + // + // picImmediate + // + this.picImmediate.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.picImmediate.Cursor = System.Windows.Forms.Cursors.Hand; + this.picImmediate.Location = new System.Drawing.Point(518, 137); + this.picImmediate.Name = "picImmediate"; + this.picImmediate.Size = new System.Drawing.Size(32, 32); + this.picImmediate.TabIndex = 30; + this.picImmediate.TabStop = false; + this.picImmediate.Click += new System.EventHandler(this.picColorPicker_Click); + // + // lblAddress + // + this.lblAddress.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.lblAddress.AutoSize = true; + this.lblAddress.Location = new System.Drawing.Point(3, 184); + this.lblAddress.Name = "lblAddress"; + this.lblAddress.Size = new System.Drawing.Size(77, 13); + this.lblAddress.TabIndex = 31; + this.lblAddress.Text = "Address value:"; + // + // picAddress + // + this.picAddress.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.picAddress.Cursor = System.Windows.Forms.Cursors.Hand; + this.picAddress.Location = new System.Drawing.Point(136, 175); + this.picAddress.Name = "picAddress"; + this.picAddress.Size = new System.Drawing.Size(32, 32); + this.picAddress.TabIndex = 32; + this.picAddress.TabStop = false; + this.picAddress.Click += new System.EventHandler(this.picColorPicker_Click); + // + // lblComment + // + this.lblComment.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.lblComment.AutoSize = true; + this.lblComment.Location = new System.Drawing.Point(194, 184); + this.lblComment.Name = "lblComment"; + this.lblComment.Size = new System.Drawing.Size(51, 13); + this.lblComment.TabIndex = 33; + this.lblComment.Text = "Comment"; + // + // picComment + // + this.picComment.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.picComment.Cursor = System.Windows.Forms.Cursors.Hand; + this.picComment.Location = new System.Drawing.Point(327, 175); + this.picComment.Name = "picComment"; + this.picComment.Size = new System.Drawing.Size(32, 32); + this.picComment.TabIndex = 34; + this.picComment.TabStop = false; + this.picComment.Click += new System.EventHandler(this.picColorPicker_Click); + // // btnReset // this.btnReset.Location = new System.Drawing.Point(3, 3); @@ -257,11 +407,32 @@ this.btnReset.UseVisualStyleBackColor = true; this.btnReset.Click += new System.EventHandler(this.btnReset_Click); // + // lblEffectiveAddress + // + this.lblEffectiveAddress.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.lblEffectiveAddress.AutoSize = true; + this.lblEffectiveAddress.Location = new System.Drawing.Point(194, 88); + this.lblEffectiveAddress.Name = "lblEffectiveAddress"; + this.lblEffectiveAddress.Size = new System.Drawing.Size(93, 13); + this.lblEffectiveAddress.TabIndex = 35; + this.lblEffectiveAddress.Text = "Effective Address:"; + // + // picEffectiveAddress + // + this.picEffectiveAddress.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.picEffectiveAddress.Cursor = System.Windows.Forms.Cursors.Hand; + this.picEffectiveAddress.Location = new System.Drawing.Point(327, 79); + this.picEffectiveAddress.Name = "picEffectiveAddress"; + this.picEffectiveAddress.Size = new System.Drawing.Size(32, 32); + this.picEffectiveAddress.TabIndex = 36; + this.picEffectiveAddress.TabStop = false; + this.picEffectiveAddress.Click += new System.EventHandler(this.picColorPicker_Click); + // // frmDebuggerColors // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(555, 145); + this.ClientSize = new System.Drawing.Size(555, 241); this.Controls.Add(this.tableLayoutPanel1); this.Name = "frmDebuggerColors"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; @@ -278,6 +449,12 @@ ((System.ComponentModel.ISupportInitialize)(this.picUnexecutedCode)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.picVerifiedData)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.picReadBreakpoint)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.picOpcode)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.picLabelDefinition)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.picImmediate)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.picAddress)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.picComment)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.picEffectiveAddress)).EndInit(); this.ResumeLayout(false); } @@ -300,5 +477,18 @@ private System.Windows.Forms.Button btnReset; private System.Windows.Forms.Label lblReadBreakpoint; private System.Windows.Forms.PictureBox picReadBreakpoint; + private System.Windows.Forms.Label lblPauseBackgroundSettings; + private System.Windows.Forms.Label lblOpcode; + private System.Windows.Forms.PictureBox picOpcode; + private System.Windows.Forms.Label lblLabelDefinition; + private System.Windows.Forms.PictureBox picLabelDefinition; + private System.Windows.Forms.Label lblImmediate; + private System.Windows.Forms.PictureBox picImmediate; + private System.Windows.Forms.Label lblAddress; + private System.Windows.Forms.PictureBox picAddress; + private System.Windows.Forms.Label lblComment; + private System.Windows.Forms.PictureBox picComment; + private System.Windows.Forms.Label lblEffectiveAddress; + private System.Windows.Forms.PictureBox picEffectiveAddress; } } \ No newline at end of file diff --git a/GUI.NET/Debugger/frmDebuggerColors.cs b/GUI.NET/Debugger/frmDebuggerColors.cs index c3d965d3..0dbfab35 100644 --- a/GUI.NET/Debugger/frmDebuggerColors.cs +++ b/GUI.NET/Debugger/frmDebuggerColors.cs @@ -26,6 +26,13 @@ namespace Mesen.GUI.Debugger picWriteBreakpoint.BackColor = ConfigManager.Config.DebugInfo.CodeWriteBreakpointColor; picReadBreakpoint.BackColor = ConfigManager.Config.DebugInfo.CodeReadBreakpointColor; picActiveStatement.BackColor = ConfigManager.Config.DebugInfo.CodeActiveStatementColor; + picEffectiveAddress.BackColor = ConfigManager.Config.DebugInfo.CodeEffectiveAddressColor; + + picOpcode.BackColor = ConfigManager.Config.DebugInfo.AssemblerOpcodeColor; + picLabelDefinition.BackColor = ConfigManager.Config.DebugInfo.AssemblerLabelDefinitionColor; + picImmediate.BackColor = ConfigManager.Config.DebugInfo.AssemblerImmediateColor; + picAddress.BackColor = ConfigManager.Config.DebugInfo.AssemblerAddressColor; + picComment.BackColor = ConfigManager.Config.DebugInfo.AssemblerCommentColor; } private void picColorPicker_Click(object sender, EventArgs e) @@ -53,6 +60,13 @@ namespace Mesen.GUI.Debugger ConfigManager.Config.DebugInfo.CodeWriteBreakpointColor = picWriteBreakpoint.BackColor; ConfigManager.Config.DebugInfo.CodeReadBreakpointColor = picReadBreakpoint.BackColor; ConfigManager.Config.DebugInfo.CodeActiveStatementColor = picActiveStatement.BackColor; + ConfigManager.Config.DebugInfo.CodeEffectiveAddressColor = picEffectiveAddress.BackColor; + + ConfigManager.Config.DebugInfo.AssemblerOpcodeColor = picOpcode.BackColor; + ConfigManager.Config.DebugInfo.AssemblerLabelDefinitionColor = picLabelDefinition.BackColor; + ConfigManager.Config.DebugInfo.AssemblerImmediateColor = picImmediate.BackColor; + ConfigManager.Config.DebugInfo.AssemblerAddressColor = picAddress.BackColor; + ConfigManager.Config.DebugInfo.AssemblerCommentColor = picComment.BackColor; ConfigManager.ApplyChanges(); } @@ -68,6 +82,14 @@ namespace Mesen.GUI.Debugger picWriteBreakpoint.BackColor = Color.FromArgb(40, 120, 80); picReadBreakpoint.BackColor = Color.FromArgb(40, 40, 200); picActiveStatement.BackColor = Color.Yellow; + picEffectiveAddress.BackColor = Color.SteelBlue; + + + picOpcode.BackColor = Color.FromArgb(22, 37, 37); + picLabelDefinition.BackColor = Color.FromArgb(0, 114, 174); + picImmediate.BackColor = Color.Chocolate; + picAddress.BackColor = Color.DarkRed; + picComment.BackColor = Color.Green; } } }