From 48e2f8c7dd5e8767fd37dbde1aea48dd9ff5e01f Mon Sep 17 00:00:00 2001 From: pasky1382 Date: Tue, 12 Jun 2012 03:50:25 +0000 Subject: [PATCH] Added Highlight, Freeze, and Freeze Highlight color options in the hex editor. Cleaned out the custom color code from HexEditor.cs --- BizHawk.MultiClient/Config.cs | 1 - .../tools/HexColor.Designer.cs | 158 +++++++++++++----- BizHawk.MultiClient/tools/HexColor.cs | 30 ++++ BizHawk.MultiClient/tools/HexEditor.cs | 26 +-- 4 files changed, 154 insertions(+), 61 deletions(-) diff --git a/BizHawk.MultiClient/Config.cs b/BizHawk.MultiClient/Config.cs index 0874d232e4..fce60eeca2 100644 --- a/BizHawk.MultiClient/Config.cs +++ b/BizHawk.MultiClient/Config.cs @@ -280,7 +280,6 @@ namespace BizHawk.MultiClient public bool HexEditorBigEndian = false; public int HexEditorDataSize = 1; //Hex Editor Colors - public bool hexcustom; public Color HexBackgrndColor; public Color HexForegrndColor; public Color HexMenubarColor; diff --git a/BizHawk.MultiClient/tools/HexColor.Designer.cs b/BizHawk.MultiClient/tools/HexColor.Designer.cs index 4db248f02f..8c754ab143 100644 --- a/BizHawk.MultiClient/tools/HexColor.Designer.cs +++ b/BizHawk.MultiClient/tools/HexColor.Designer.cs @@ -29,11 +29,17 @@ private void InitializeComponent() { this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.HexMenubar = new System.Windows.Forms.Panel(); - this.label3 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.label1 = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); + this.HexFreezeHL = new System.Windows.Forms.Panel(); + this.label5 = new System.Windows.Forms.Label(); + this.HexFreeze = new System.Windows.Forms.Panel(); + this.label4 = new System.Windows.Forms.Label(); + this.HexHighlight = new System.Windows.Forms.Panel(); this.HexForegrnd = new System.Windows.Forms.Panel(); + this.label1 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.HexMenubar = new System.Windows.Forms.Panel(); + this.label2 = new System.Windows.Forms.Label(); this.HexBackgrnd = new System.Windows.Forms.Panel(); this.colorDialog1 = new System.Windows.Forms.ColorDialog(); this.groupBox1.SuspendLayout(); @@ -41,64 +47,129 @@ // // groupBox1 // + this.groupBox1.Controls.Add(this.label6); + this.groupBox1.Controls.Add(this.HexFreezeHL); + this.groupBox1.Controls.Add(this.label5); + this.groupBox1.Controls.Add(this.HexFreeze); + this.groupBox1.Controls.Add(this.label4); + this.groupBox1.Controls.Add(this.HexHighlight); + this.groupBox1.Controls.Add(this.HexForegrnd); + this.groupBox1.Controls.Add(this.label1); + this.groupBox1.Controls.Add(this.label3); this.groupBox1.Controls.Add(this.HexMenubar); + this.groupBox1.Controls.Add(this.label2); + this.groupBox1.Controls.Add(this.HexBackgrnd); this.groupBox1.Location = new System.Drawing.Point(3, 2); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(154, 173); + this.groupBox1.Size = new System.Drawing.Size(144, 192); this.groupBox1.TabIndex = 0; this.groupBox1.TabStop = false; // - // HexMenubar + // label6 // - this.HexMenubar.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.HexMenubar.Location = new System.Drawing.Point(4, 122); - this.HexMenubar.Name = "HexMenubar"; - this.HexMenubar.Size = new System.Drawing.Size(46, 42); - this.HexMenubar.TabIndex = 8; - this.HexMenubar.MouseClick += new System.Windows.Forms.MouseEventHandler(this.HexMenubar_Click); + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(30, 171); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(110, 13); + this.label6.TabIndex = 17; + this.label6.Text = "Freeze Highlight Color"; // - // label3 + // HexFreezeHL // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(59, 143); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(76, 13); - this.label3.TabIndex = 11; - this.label3.Text = "Menubar Color"; + this.HexFreezeHL.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.HexFreezeHL.Location = new System.Drawing.Point(5, 166); + this.HexFreezeHL.Name = "HexFreezeHL"; + this.HexFreezeHL.Size = new System.Drawing.Size(20, 20); + this.HexFreezeHL.TabIndex = 16; + this.HexFreezeHL.MouseClick += new System.Windows.Forms.MouseEventHandler(this.HexFreezeHL_Click); // - // label2 + // label5 // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(59, 86); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(55, 13); - this.label2.TabIndex = 10; - this.label2.Text = "Font Color"; + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(30, 139); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(66, 13); + this.label5.TabIndex = 15; + this.label5.Text = "Freeze Color"; + // + // HexFreeze + // + this.HexFreeze.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.HexFreeze.Location = new System.Drawing.Point(5, 135); + this.HexFreeze.Name = "HexFreeze"; + this.HexFreeze.Size = new System.Drawing.Size(20, 20); + this.HexFreeze.TabIndex = 14; + this.HexFreeze.MouseClick += new System.Windows.Forms.MouseEventHandler(this.HexFreeze_Click); + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(30, 108); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(75, 13); + this.label4.TabIndex = 13; + this.label4.Text = "Highlight Color"; + // + // HexHighlight + // + this.HexHighlight.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.HexHighlight.Location = new System.Drawing.Point(5, 104); + this.HexHighlight.Name = "HexHighlight"; + this.HexHighlight.Size = new System.Drawing.Size(20, 20); + this.HexHighlight.TabIndex = 12; + this.HexHighlight.MouseClick += new System.Windows.Forms.MouseEventHandler(this.HexHighlight_Click); + // + // HexForegrnd + // + this.HexForegrnd.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.HexForegrnd.Location = new System.Drawing.Point(5, 42); + this.HexForegrnd.Name = "HexForegrnd"; + this.HexForegrnd.Size = new System.Drawing.Size(20, 20); + this.HexForegrnd.TabIndex = 7; + this.HexForegrnd.MouseClick += new System.Windows.Forms.MouseEventHandler(this.HexForegrnd_Click); // // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(59, 30); + this.label1.Location = new System.Drawing.Point(30, 15); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(92, 13); this.label1.TabIndex = 9; this.label1.Text = "Background Color"; // - // HexForegrnd + // label3 // - this.HexForegrnd.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.HexForegrnd.Location = new System.Drawing.Point(7, 71); - this.HexForegrnd.Name = "HexForegrnd"; - this.HexForegrnd.Size = new System.Drawing.Size(46, 42); - this.HexForegrnd.TabIndex = 7; - this.HexForegrnd.MouseClick += new System.Windows.Forms.MouseEventHandler(this.HexForegrnd_Click); + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(30, 77); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(76, 13); + this.label3.TabIndex = 11; + this.label3.Text = "Menubar Color"; + // + // HexMenubar + // + this.HexMenubar.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.HexMenubar.Location = new System.Drawing.Point(5, 73); + this.HexMenubar.Name = "HexMenubar"; + this.HexMenubar.Size = new System.Drawing.Size(20, 20); + this.HexMenubar.TabIndex = 8; + this.HexMenubar.MouseClick += new System.Windows.Forms.MouseEventHandler(this.HexMenubar_Click); + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(30, 46); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(55, 13); + this.label2.TabIndex = 10; + this.label2.Text = "Font Color"; // // HexBackgrnd // this.HexBackgrnd.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.HexBackgrnd.Location = new System.Drawing.Point(7, 15); + this.HexBackgrnd.Location = new System.Drawing.Point(5, 11); this.HexBackgrnd.Name = "HexBackgrnd"; - this.HexBackgrnd.Size = new System.Drawing.Size(46, 42); + this.HexBackgrnd.Size = new System.Drawing.Size(20, 20); this.HexBackgrnd.TabIndex = 6; this.HexBackgrnd.MouseClick += new System.Windows.Forms.MouseEventHandler(this.HexBackgrnd_Click); // @@ -106,12 +177,7 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(159, 178); - this.Controls.Add(this.label3); - this.Controls.Add(this.label2); - this.Controls.Add(this.label1); - this.Controls.Add(this.HexForegrnd); - this.Controls.Add(this.HexBackgrnd); + this.ClientSize = new System.Drawing.Size(149, 197); this.Controls.Add(this.groupBox1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.MaximizeBox = false; @@ -120,8 +186,8 @@ this.Text = "Colors"; this.Load += new System.EventHandler(this.HexColors_Form_Load); this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); this.ResumeLayout(false); - this.PerformLayout(); } @@ -135,6 +201,12 @@ private System.Windows.Forms.Panel HexBackgrnd; private System.Windows.Forms.ColorDialog colorDialog1; private System.Windows.Forms.Panel HexMenubar; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Panel HexFreezeHL; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Panel HexFreeze; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Panel HexHighlight; } } \ No newline at end of file diff --git a/BizHawk.MultiClient/tools/HexColor.cs b/BizHawk.MultiClient/tools/HexColor.cs index 79594857b0..7dc3769d8c 100644 --- a/BizHawk.MultiClient/tools/HexColor.cs +++ b/BizHawk.MultiClient/tools/HexColor.cs @@ -21,6 +21,9 @@ namespace BizHawk.MultiClient HexBackgrnd.BackColor = Global.Config.HexBackgrndColor; HexForegrnd.BackColor = Global.Config.HexForegrndColor; HexMenubar.BackColor = Global.Config.HexMenubarColor; + HexFreeze.BackColor = Global.Config.HexFreezeColor; + HexFreezeHL.BackColor = Global.Config.HexHighlightFreezeColor; + HexHighlight.BackColor = Global.Config.HexHighlightColor; } private void HexBackgrnd_Click(Object sender, MouseEventArgs e) @@ -53,5 +56,32 @@ namespace BizHawk.MultiClient this.HexMenubar.BackColor = colorDialog1.Color; } } + + private void HexHighlight_Click(Object sender, MouseEventArgs e) + { + if (colorDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) + { + Global.Config.HexHighlightColor = colorDialog1.Color; + this.HexHighlight.BackColor = colorDialog1.Color; + } + } + + private void HexFreeze_Click(Object sender, MouseEventArgs e) + { + if (colorDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) + { + Global.Config.HexFreezeColor = colorDialog1.Color; + this.HexFreeze.BackColor = colorDialog1.Color; + } + } + + private void HexFreezeHL_Click(Object sender, MouseEventArgs e) + { + if (colorDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) + { + Global.Config.HexHighlightFreezeColor = colorDialog1.Color; + this.HexFreezeHL.BackColor = colorDialog1.Color; + } + } } } diff --git a/BizHawk.MultiClient/tools/HexEditor.cs b/BizHawk.MultiClient/tools/HexEditor.cs index 5af4b9e67b..fd9452d6d2 100644 --- a/BizHawk.MultiClient/tools/HexEditor.cs +++ b/BizHawk.MultiClient/tools/HexEditor.cs @@ -75,6 +75,10 @@ namespace BizHawk.MultiClient Height_ = Global.Config.HexEditorHeight; BigEndian = Global.Config.HexEditorBigEndian; DataSize = Global.Config.HexEditorDataSize; + //Colors + menuStrip1.BackColor = Global.Config.HexMenubarColor; + MemoryViewerBox.BackColor = Global.Config.HexBackgrndColor; + MemoryViewerBox.ForeColor = Global.Config.HexForegrndColor; } public void SaveConfigSettings() @@ -104,21 +108,6 @@ namespace BizHawk.MultiClient if (Width_ >= 0 && Height_ >= 0) this.Size = new System.Drawing.Size(Width_, Height_); } - - if (Global.Config.hexcustom) - { - menuStrip1.BackColor = Global.Config.HexMenubarColor; - MemoryViewerBox.BackColor = Global.Config.HexBackgrndColor; - MemoryViewerBox.ForeColor = Global.Config.HexForegrndColor; - } - else - { - Global.Config.HexMenubarColor = this.menuStrip1.BackColor; - Global.Config.HexBackgrndColor = this.MemoryViewerBox.BackColor; - Global.Config.HexForegrndColor = this.AddressesLabel.ForeColor; - Global.Config.hexcustom = true; - } - SetMemoryDomainMenu(); SetDataSize(DataSize); UpdateValues(); @@ -1476,11 +1465,14 @@ namespace BizHawk.MultiClient private void resetToDefaultToolStripMenuItem1_Click(object sender, EventArgs e) { this.MemoryViewerBox.BackColor = Color.FromName("Control"); - Global.Config.HexBackgrndColor = Color.FromName("Control"); this.MemoryViewerBox.ForeColor = Color.FromName("ControlText"); - Global.Config.HexForegrndColor = Color.FromName("ControlText"); this.menuStrip1.BackColor = Color.FromName("Control"); Global.Config.HexMenubarColor = Color.FromName("Control"); + Global.Config.HexForegrndColor = Color.FromName("ControlText"); + Global.Config.HexBackgrndColor = Color.FromName("Control"); + Global.Config.HexFreezeColor = Color.LightBlue; + Global.Config.HexHighlightColor = Color.Pink; + Global.Config.HexHighlightFreezeColor = Color.Violet; } } } \ No newline at end of file