From 19450e50f765127de77958e1da5583534b111e1e Mon Sep 17 00:00:00 2001 From: adelikat Date: Fri, 23 Jan 2015 23:17:24 +0000 Subject: [PATCH] Debugger - Register box - make label spacing dynamic based on the largest register name --- .../tools/Debugger/RegisterBoxControl.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/BizHawk.Client.EmuHawk/tools/Debugger/RegisterBoxControl.cs b/BizHawk.Client.EmuHawk/tools/Debugger/RegisterBoxControl.cs index 73beaeb406..e8eafb5414 100644 --- a/BizHawk.Client.EmuHawk/tools/Debugger/RegisterBoxControl.cs +++ b/BizHawk.Client.EmuHawk/tools/Debugger/RegisterBoxControl.cs @@ -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) }); }