Debugger - Register box - make label spacing dynamic based on the largest register name
This commit is contained in:
parent
f7280b4ca9
commit
19450e50f7
|
@ -144,13 +144,17 @@ namespace BizHawk.Client.EmuHawk
|
|||
var registers = Core.GetCpuFlagsAndRegisters();
|
||||
|
||||
int y = UIHelper.ScaleY(0);
|
||||
|
||||
var maxCharSize = registers.Where(r => r.Value.BitSize != 1).Max(r => r.Key.Length);
|
||||
var width = maxCharSize * 5;
|
||||
|
||||
foreach (var register in registers.Where(r => r.Value.BitSize != 1))
|
||||
{
|
||||
this.Controls.Add(new Label
|
||||
{
|
||||
Text = register.Key.Replace("Flag ", "") + (canset ? ": " : ""),
|
||||
Text = register.Key,
|
||||
Location = new Point(UIHelper.ScaleX(5), y + UIHelper.ScaleY(2)),
|
||||
Size = new Size(UIHelper.ScaleX(35), UIHelper.ScaleY(15))
|
||||
Size = new Size(UIHelper.ScaleX(width), UIHelper.ScaleY(15))
|
||||
});
|
||||
|
||||
if (canset)
|
||||
|
@ -160,7 +164,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
Name = register.Key,
|
||||
Text = register.Value.Value.ToHexString(register.Value.BitSize / 16),
|
||||
Width = UIHelper.ScaleX(6 + ((register.Value.BitSize / 4) * 9)),
|
||||
Location = new Point(UIHelper.ScaleX(40), y),
|
||||
Location = new Point(UIHelper.ScaleX(width + 10), y),
|
||||
MaxLength = register.Value.BitSize / 4,
|
||||
CharacterCasing = CharacterCasing.Upper
|
||||
};
|
||||
|
@ -188,8 +192,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
Name = register.Key,
|
||||
Text = register.Value.Value.ToString(),
|
||||
Size = new Size(UIHelper.ScaleX(45), UIHelper.ScaleY(15)),
|
||||
Location = new Point(UIHelper.ScaleX(40), y)
|
||||
Size = new Size(UIHelper.ScaleX(6 + ((register.Value.BitSize / 4) * 9)), UIHelper.ScaleY(15)),
|
||||
Location = new Point(UIHelper.ScaleX(width + 10), y)
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue