HexEditor - Add ZeroColor option to HexColor
This commit is contained in:
parent
d0411b5ee1
commit
1c7684c6e3
|
@ -41,7 +41,9 @@
|
|||
this.HexMenubar = new System.Windows.Forms.Panel();
|
||||
this.label2 = new BizHawk.WinForms.Controls.LocLabelEx();
|
||||
this.HexBackgrnd = new System.Windows.Forms.Panel();
|
||||
this.colorDialog1 = new System.Windows.Forms.ColorDialog();
|
||||
this.label7 = new BizHawk.WinForms.Controls.LocLabelEx();
|
||||
this.Hex00 = new System.Windows.Forms.Panel();
|
||||
this.colorDialog1 = new System.Windows.Forms.ColorDialog();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
|
@ -59,9 +61,11 @@
|
|||
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.Controls.Add(this.label7);
|
||||
this.groupBox1.Controls.Add(this.Hex00);
|
||||
this.groupBox1.Location = new System.Drawing.Point(3, 2);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(144, 192);
|
||||
this.groupBox1.Size = new System.Drawing.Size(144, 222);
|
||||
this.groupBox1.TabIndex = 0;
|
||||
this.groupBox1.TabStop = false;
|
||||
//
|
||||
|
@ -154,12 +158,27 @@
|
|||
this.HexBackgrnd.Size = new System.Drawing.Size(20, 20);
|
||||
this.HexBackgrnd.TabIndex = 6;
|
||||
this.HexBackgrnd.MouseClick += new System.Windows.Forms.MouseEventHandler(this.HexBackground_Click);
|
||||
//
|
||||
// HexColors_Form
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
//
|
||||
// label7
|
||||
//
|
||||
this.label7.Location = new System.Drawing.Point(30, 200);
|
||||
this.label7.Name = "label7";
|
||||
this.label7.Text = "Zero Color";
|
||||
//
|
||||
// Hex00
|
||||
//
|
||||
this.Hex00.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.Hex00.Location = new System.Drawing.Point(5, 196);
|
||||
this.Hex00.Name = "Hex00";
|
||||
this.Hex00.Size = new System.Drawing.Size(20, 20);
|
||||
this.Hex00.TabIndex = 18;
|
||||
this.Hex00.MouseClick += new System.Windows.Forms.MouseEventHandler(this.Hex00_Click);
|
||||
//
|
||||
// HexColors_Form
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(149, 197);
|
||||
this.ClientSize = new System.Drawing.Size(149, 230);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.MaximizeBox = false;
|
||||
|
@ -190,6 +209,7 @@
|
|||
private System.Windows.Forms.Panel HexFreeze;
|
||||
private BizHawk.WinForms.Controls.LocLabelEx label4;
|
||||
private System.Windows.Forms.Panel HexHighlight;
|
||||
|
||||
}
|
||||
private BizHawk.WinForms.Controls.LocLabelEx label7;
|
||||
private System.Windows.Forms.Panel Hex00;
|
||||
}
|
||||
}
|
|
@ -20,6 +20,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
HexFreeze.BackColor = _hexEditor.Colors.Freeze;
|
||||
HexFreezeHL.BackColor = _hexEditor.Colors.HighlightFreeze;
|
||||
HexHighlight.BackColor = _hexEditor.Colors.Highlight;
|
||||
Hex00.BackColor = _hexEditor.Colors.Foreground00;
|
||||
}
|
||||
|
||||
private void HexBackground_Click(object sender, MouseEventArgs e)
|
||||
|
@ -33,6 +34,15 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
private void Hex00_Click(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (colorDialog1.ShowDialog().IsOk())
|
||||
{
|
||||
_hexEditor.Colors.Foreground00 = colorDialog1.Color;
|
||||
Hex00.BackColor = colorDialog1.Color;
|
||||
}
|
||||
}
|
||||
|
||||
private void HexForeground_Click(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (colorDialog1.ShowDialog().IsOk())
|
||||
|
|
|
@ -454,7 +454,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
this.AddressesLabel.MouseLeave += new System.EventHandler(this.AddressesLabel_MouseLeave);
|
||||
this.AddressesLabel.MouseMove += new System.Windows.Forms.MouseEventHandler(this.AddressesLabel_MouseMove);
|
||||
this.AddressesLabel.MouseUp += new System.Windows.Forms.MouseEventHandler(this.AddressesLabel_MouseUp);
|
||||
this.AddressesLabel.Paint += new System.Windows.Forms.PaintEventHandler(this.AddressesLabel_Paint);
|
||||
//
|
||||
// Header
|
||||
//
|
||||
|
|
|
@ -133,6 +133,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
public Color Freeze { get; set; }= Color.LightBlue;
|
||||
public Color Highlight { get; set; } = Color.Pink;
|
||||
public Color HighlightFreeze { get; set; } = Color.Violet;
|
||||
public Color Foreground00 { get; set; } = Color.SlateGray;
|
||||
}
|
||||
|
||||
[ConfigPersist]
|
||||
|
@ -219,11 +220,21 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
protected override void UpdateAfter()
|
||||
{
|
||||
if (AddressesLabel.ZeroColor != Colors.Foreground00)
|
||||
{
|
||||
AddressesLabel.ZeroColor = Colors.Foreground00;
|
||||
}
|
||||
|
||||
AddressesLabel.Text = GenerateMemoryViewString(true);
|
||||
}
|
||||
|
||||
protected override void GeneralUpdate()
|
||||
{
|
||||
if (AddressesLabel.ZeroColor != Colors.Foreground00)
|
||||
{
|
||||
AddressesLabel.ZeroColor = Colors.Foreground00;
|
||||
}
|
||||
|
||||
AddressesLabel.Text = GenerateMemoryViewString(true);
|
||||
AddressLabel.Text = GenerateAddressString();
|
||||
}
|
||||
|
@ -2055,54 +2066,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
private void AddressesLabel_Paint(object sender, PaintEventArgs e)
|
||||
{
|
||||
return;
|
||||
|
||||
if (sender is not Label label)
|
||||
return;
|
||||
|
||||
char gap = ' ';
|
||||
|
||||
//PointF point = new PointF(label.Location.X, label.Location.Y);
|
||||
PointF point = new PointF(0, 0);
|
||||
string text = label.Text;
|
||||
Font font = label.Font;
|
||||
|
||||
string[] lines = text.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None);
|
||||
|
||||
Color color = label.ForeColor;
|
||||
|
||||
foreach (string line in lines)
|
||||
{
|
||||
string[] words = line.Split(gap);
|
||||
|
||||
foreach (string word in words)
|
||||
{
|
||||
if (word == "00")
|
||||
{
|
||||
color = Color.SlateGray;
|
||||
}
|
||||
else
|
||||
{
|
||||
color = label.ForeColor;
|
||||
}
|
||||
|
||||
SizeF size = e.Graphics.MeasureString(word, font);
|
||||
|
||||
using (Brush brush = new SolidBrush(color))
|
||||
{
|
||||
e.Graphics.DrawString(word, font, brush, point);
|
||||
}
|
||||
|
||||
point.X += size.Width + e.Graphics.MeasureString(gap.ToString(), font).Width;
|
||||
}
|
||||
|
||||
point.X = label.Location.X;
|
||||
point.Y += e.Graphics.MeasureString(line, font).Height;
|
||||
}
|
||||
}
|
||||
|
||||
private void MemoryViewerBox_Paint(object sender, PaintEventArgs e)
|
||||
{
|
||||
var activeCheats = MainForm.CheatList.Where(x => x.Enabled);
|
||||
|
|
Loading…
Reference in New Issue