From f7174eb39834922dc8a7a2b32711082a12e88a2c Mon Sep 17 00:00:00 2001 From: "J.D. Purcell" Date: Mon, 17 Feb 2020 12:34:37 -0500 Subject: [PATCH] Make display scaling apply to InputRoll column header widths. --- .../CustomControls/InputRoll/RollColumn.cs | 11 +++++++- BizHawk.Client.EmuHawk/tools/CDL.cs | 26 +++++++++---------- BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs | 18 ++++++------- .../tools/Debugger/GenericDebugger.cs | 4 +-- .../tools/Lua/LuaConsole.cs | 6 ++--- .../tools/TAStudio/BookmarksBranchesBox.cs | 6 ++--- .../tools/TAStudio/MarkerControl.cs | 4 +-- .../tools/TAStudio/TAStudio.cs | 4 +-- .../tools/TAStudio/UndoHistoryForm.cs | 4 +-- BizHawk.Client.EmuHawk/tools/TraceLogger.cs | 4 +-- .../tools/Watch/RamSearch.cs | 10 +++---- .../tools/Watch/RamWatch.cs | 16 ++++++------ 12 files changed, 61 insertions(+), 52 deletions(-) diff --git a/BizHawk.Client.EmuHawk/CustomControls/InputRoll/RollColumn.cs b/BizHawk.Client.EmuHawk/CustomControls/InputRoll/RollColumn.cs index 89896d9ee0..31bb397b64 100644 --- a/BizHawk.Client.EmuHawk/CustomControls/InputRoll/RollColumn.cs +++ b/BizHawk.Client.EmuHawk/CustomControls/InputRoll/RollColumn.cs @@ -24,6 +24,15 @@ /// /// If drawn rotated, specifies the desired height, or null to auto-size /// - public int? RotatedHeight { get; set; } + public int? RotatedHeight { get; set; } + + /// + /// Sets the desired width as appropriate for a display with no scaling. If display + /// scaling is enabled, the actual column width will be scaled accordingly. + /// + public int UnscaledWidth + { + set => Width = UIHelper.ScaleX(value); + } } } diff --git a/BizHawk.Client.EmuHawk/tools/CDL.cs b/BizHawk.Client.EmuHawk/tools/CDL.cs index 4144ced342..8b7f39297d 100644 --- a/BizHawk.Client.EmuHawk/tools/CDL.cs +++ b/BizHawk.Client.EmuHawk/tools/CDL.cs @@ -66,19 +66,19 @@ namespace BizHawk.Client.EmuHawk lvCDL.AllColumns.Clear(); lvCDL.AllColumns.AddRange(new [] { - new RollColumn { Name = "CDLFile", Text = "CDL File @", Width = 107, Type = ColumnType.Text }, - new RollColumn { Name = "Domain", Text = "Domain", Width = 126, Type = ColumnType.Text }, - new RollColumn { Name = "Percent", Text = "%", Width = 58, Type = ColumnType.Text }, - new RollColumn { Name = "Mapped", Text = "Mapped", Width = 64, Type = ColumnType.Text }, - new RollColumn { Name = "Size", Text = "Size", Width = 112, Type = ColumnType.Text }, - new RollColumn { Name = "0x01", Text = "0x01", Width = 56, Type = ColumnType.Text }, - new RollColumn { Name = "0x02", Text = "0x02", Width = 56, Type = ColumnType.Text }, - new RollColumn { Name = "0x04", Text = "0x04", Width = 56, Type = ColumnType.Text }, - new RollColumn { Name = "0x08", Text = "0x08", Width = 56, Type = ColumnType.Text }, - new RollColumn { Name = "0x10", Text = "0x10", Width = 56, Type = ColumnType.Text }, - new RollColumn { Name = "0x20", Text = "0x20", Width = 56, Type = ColumnType.Text }, - new RollColumn { Name = "0x40", Text = "0x40", Width = 56, Type = ColumnType.Text }, - new RollColumn { Name = "0x80", Text = "0x80", Width = 56, Type = ColumnType.Text } + new RollColumn { Name = "CDLFile", Text = "CDL File @", UnscaledWidth = 107, Type = ColumnType.Text }, + new RollColumn { Name = "Domain", Text = "Domain", UnscaledWidth = 126, Type = ColumnType.Text }, + new RollColumn { Name = "Percent", Text = "%", UnscaledWidth = 58, Type = ColumnType.Text }, + new RollColumn { Name = "Mapped", Text = "Mapped", UnscaledWidth = 64, Type = ColumnType.Text }, + new RollColumn { Name = "Size", Text = "Size", UnscaledWidth = 112, Type = ColumnType.Text }, + new RollColumn { Name = "0x01", Text = "0x01", UnscaledWidth = 56, Type = ColumnType.Text }, + new RollColumn { Name = "0x02", Text = "0x02", UnscaledWidth = 56, Type = ColumnType.Text }, + new RollColumn { Name = "0x04", Text = "0x04", UnscaledWidth = 56, Type = ColumnType.Text }, + new RollColumn { Name = "0x08", Text = "0x08", UnscaledWidth = 56, Type = ColumnType.Text }, + new RollColumn { Name = "0x10", Text = "0x10", UnscaledWidth = 56, Type = ColumnType.Text }, + new RollColumn { Name = "0x20", Text = "0x20", UnscaledWidth = 56, Type = ColumnType.Text }, + new RollColumn { Name = "0x40", Text = "0x40", UnscaledWidth = 56, Type = ColumnType.Text }, + new RollColumn { Name = "0x80", Text = "0x80", UnscaledWidth = 56, Type = ColumnType.Text } }); } diff --git a/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs b/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs index 4bf293b773..0507e944cb 100644 --- a/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs +++ b/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs @@ -727,15 +727,15 @@ namespace BizHawk.Client.EmuHawk { Columns = new List { - new RollColumn { Text = "Names", Name = NameColumn, Visible = true, Width = 128, Type = ColumnType.Text }, - new RollColumn { Text = "Address", Name = AddressColumn, Visible = true, Width = 60, Type = ColumnType.Text }, - new RollColumn { Text = "Value", Name = ValueColumn, Visible = true, Width = 59, Type = ColumnType.Text }, - new RollColumn { Text = "Compare", Name = CompareColumn, Visible = true, Width = 63, Type = ColumnType.Text }, - new RollColumn { Text = "Compare Type", Name = ComparisonTypeColumn, Visible = true, Width = 98, Type = ColumnType.Text }, - new RollColumn { Text = "On", Name = OnColumn, Visible = false, Width = 28, Type = ColumnType.Text }, - new RollColumn { Text = "Size", Name = SizeColumn, Visible = true, Width = 55, Type = ColumnType.Text }, - new RollColumn { Text = "Endian", Name = EndianColumn, Visible = false, Width = 55, Type = ColumnType.Text }, - new RollColumn { Text = "Display Type", Name = TypeColumn, Visible = false, Width = 88, Type = ColumnType.Text } + new RollColumn { Text = "Names", Name = NameColumn, Visible = true, UnscaledWidth = 128, Type = ColumnType.Text }, + new RollColumn { Text = "Address", Name = AddressColumn, Visible = true, UnscaledWidth = 60, Type = ColumnType.Text }, + new RollColumn { Text = "Value", Name = ValueColumn, Visible = true, UnscaledWidth = 59, Type = ColumnType.Text }, + new RollColumn { Text = "Compare", Name = CompareColumn, Visible = true, UnscaledWidth = 63, Type = ColumnType.Text }, + new RollColumn { Text = "Compare Type", Name = ComparisonTypeColumn, Visible = true, UnscaledWidth = 98, Type = ColumnType.Text }, + new RollColumn { Text = "On", Name = OnColumn, Visible = false, UnscaledWidth = 28, Type = ColumnType.Text }, + new RollColumn { Text = "Size", Name = SizeColumn, Visible = true, UnscaledWidth = 55, Type = ColumnType.Text }, + new RollColumn { Text = "Endian", Name = EndianColumn, Visible = false, UnscaledWidth = 55, Type = ColumnType.Text }, + new RollColumn { Text = "Display Type", Name = TypeColumn, Visible = false, UnscaledWidth = 88, Type = ColumnType.Text } }; } diff --git a/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.cs b/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.cs index 170df8a724..304c285033 100644 --- a/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.cs +++ b/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.cs @@ -27,14 +27,14 @@ namespace BizHawk.Client.EmuHawk { Name = AddressColumnName, Text = AddressColumnName, - Width = 94, + UnscaledWidth = 94, Type = ColumnType.Text }, new RollColumn { Name = InstructionColumnName, Text = InstructionColumnName, - Width = 291, + UnscaledWidth = 291, Type = ColumnType.Text } }); diff --git a/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs b/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs index 865bab4e3f..f2e50bc478 100644 --- a/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs +++ b/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs @@ -41,9 +41,9 @@ namespace BizHawk.Client.EmuHawk { Columns = new List { - new RollColumn { Name = IconColumnName, Text = " ", Visible = true, Width = 22, Type = ColumnType.Image }, - new RollColumn { Name = ScriptColumnName, Text = "Script", Visible = true, Width = 92, Type = ColumnType.Text }, - new RollColumn { Name = PathColumnName, Text = "Path", Visible = true, Width = 300, Type = ColumnType.Text } + new RollColumn { Name = IconColumnName, Text = " ", Visible = true, UnscaledWidth = 22, Type = ColumnType.Image }, + new RollColumn { Name = ScriptColumnName, Text = "Script", Visible = true, UnscaledWidth = 92, Type = ColumnType.Text }, + new RollColumn { Name = PathColumnName, Text = "Path", Visible = true, UnscaledWidth = 300, Type = ColumnType.Text } }; } diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs index 6d1fd21ff4..6b63b758d1 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs @@ -58,19 +58,19 @@ namespace BizHawk.Client.EmuHawk { Name = BranchNumberColumnName, Text = "#", - Width = 30 + UnscaledWidth = 30 }, new RollColumn { Name = FrameColumnName, Text = "Frame", - Width = 64 + UnscaledWidth = 64 }, new RollColumn { Name = UserTextColumnName, Text = "UserText", - Width = 90 + UnscaledWidth = 90 }, }); } diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/MarkerControl.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/MarkerControl.cs index 739b27c6eb..859d07184f 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/MarkerControl.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/MarkerControl.cs @@ -31,13 +31,13 @@ namespace BizHawk.Client.EmuHawk { Name = "FrameColumn", Text = "Frame", - Width = 52 + UnscaledWidth = 52 }, new RollColumn { Name = "LabelColumn", Text = "", - Width = 125 + UnscaledWidth = 125 } }); } diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs index b301b5f9ff..f564cf2030 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs @@ -415,7 +415,7 @@ namespace BizHawk.Client.EmuHawk { Name = FrameColumnName, Text = "Frame#", - Width = 68, + UnscaledWidth = 68, Type = ColumnType.Text, Rotatable = true }); @@ -525,7 +525,7 @@ namespace BizHawk.Client.EmuHawk { Name = columnName, Text = columnText, - Width = columnWidth, + UnscaledWidth = columnWidth, Type = columnType }); } diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/UndoHistoryForm.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/UndoHistoryForm.cs index 7e5ed8f466..028ca501fa 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/UndoHistoryForm.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/UndoHistoryForm.cs @@ -26,8 +26,8 @@ namespace BizHawk.Client.EmuHawk HistoryView.AllColumns.Clear(); HistoryView.AllColumns.AddRange(new[] { - new RollColumn { Name = IdColumnName, Text = IdColumnName, Width = 40, Type = ColumnType.Text }, - new RollColumn { Name = UndoColumnName, Text = UndoColumnName, Width = 280, Type = ColumnType.Text } + new RollColumn { Name = IdColumnName, Text = IdColumnName, UnscaledWidth = 40, Type = ColumnType.Text }, + new RollColumn { Name = UndoColumnName, Text = UndoColumnName, UnscaledWidth = 280, Type = ColumnType.Text } }); MaxStepsNum.Value = Log.MaxSteps; diff --git a/BizHawk.Client.EmuHawk/tools/TraceLogger.cs b/BizHawk.Client.EmuHawk/tools/TraceLogger.cs index c4b7ab01e6..dac0291bb8 100644 --- a/BizHawk.Client.EmuHawk/tools/TraceLogger.cs +++ b/BizHawk.Client.EmuHawk/tools/TraceLogger.cs @@ -81,14 +81,14 @@ namespace BizHawk.Client.EmuHawk { Name = DisasmColumnName, Text = DisasmColumnName, - Width = 239, + UnscaledWidth = 239, Type = ColumnType.Text }); TraceView.AllColumns.Add(new RollColumn { Name = RegistersColumnName, Text = RegistersColumnName, - Width = 357, + UnscaledWidth = 357, Type = ColumnType.Text }); } diff --git a/BizHawk.Client.EmuHawk/tools/Watch/RamSearch.cs b/BizHawk.Client.EmuHawk/tools/Watch/RamSearch.cs index 8606fd4901..0faf707b8b 100644 --- a/BizHawk.Client.EmuHawk/tools/Watch/RamSearch.cs +++ b/BizHawk.Client.EmuHawk/tools/Watch/RamSearch.cs @@ -966,11 +966,11 @@ namespace BizHawk.Client.EmuHawk { Columns = new List { - new RollColumn { Text = "Address", Name = WatchList.ADDRESS, Visible = true, Width = 60, Type = ColumnType.Text }, - new RollColumn { Text = "Value", Name = WatchList.VALUE, Visible = true, Width = 59, Type = ColumnType.Text }, - new RollColumn { Text = "Prev", Name = WatchList.PREV, Visible = true, Width = 59, Type = ColumnType.Text }, - new RollColumn { Text = "Changes", Name = WatchList.CHANGES, Visible = true, Width = 60, Type = ColumnType.Text }, - new RollColumn { Text = "Diff", Name = WatchList.DIFF, Visible = false, Width = 59, Type = ColumnType.Text }, + new RollColumn { Text = "Address", Name = WatchList.ADDRESS, Visible = true, UnscaledWidth = 60, Type = ColumnType.Text }, + new RollColumn { Text = "Value", Name = WatchList.VALUE, Visible = true, UnscaledWidth = 59, Type = ColumnType.Text }, + new RollColumn { Text = "Prev", Name = WatchList.PREV, Visible = true, UnscaledWidth = 59, Type = ColumnType.Text }, + new RollColumn { Text = "Changes", Name = WatchList.CHANGES, Visible = true, UnscaledWidth = 60, Type = ColumnType.Text }, + new RollColumn { Text = "Diff", Name = WatchList.DIFF, Visible = false, UnscaledWidth = 59, Type = ColumnType.Text }, }; PreviewMode = true; diff --git a/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs b/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs index 6d7df55ced..76f077bd42 100644 --- a/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs +++ b/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs @@ -79,14 +79,14 @@ namespace BizHawk.Client.EmuHawk { Columns = new List { - new RollColumn { Text = "Address", Name = WatchList.ADDRESS, Visible = true, Width = 60, Type = ColumnType.Text }, - new RollColumn { Text = "Value", Name = WatchList.VALUE, Visible = true, Width = 59, Type = ColumnType.Text }, - new RollColumn { Text = "Prev", Name = WatchList.PREV, Visible = false, Width = 59, Type = ColumnType.Text }, - new RollColumn { Text = "Changes", Name = WatchList.CHANGES, Visible = true, Width = 60, Type = ColumnType.Text }, - new RollColumn { Text = "Diff", Name = WatchList.DIFF, Visible = false, Width = 59, Type = ColumnType.Text }, - new RollColumn { Text = "Type", Name = WatchList.TYPE, Visible = false, Width = 55, Type = ColumnType.Text }, - new RollColumn { Text = "Domain", Name = WatchList.DOMAIN, Visible = true, Width = 55, Type = ColumnType.Text }, - new RollColumn { Text = "Notes", Name = WatchList.NOTES, Visible = true, Width = 128, Type = ColumnType.Text } + new RollColumn { Text = "Address", Name = WatchList.ADDRESS, Visible = true, UnscaledWidth = 60, Type = ColumnType.Text }, + new RollColumn { Text = "Value", Name = WatchList.VALUE, Visible = true, UnscaledWidth = 59, Type = ColumnType.Text }, + new RollColumn { Text = "Prev", Name = WatchList.PREV, Visible = false, UnscaledWidth = 59, Type = ColumnType.Text }, + new RollColumn { Text = "Changes", Name = WatchList.CHANGES, Visible = true, UnscaledWidth = 60, Type = ColumnType.Text }, + new RollColumn { Text = "Diff", Name = WatchList.DIFF, Visible = false, UnscaledWidth = 59, Type = ColumnType.Text }, + new RollColumn { Text = "Type", Name = WatchList.TYPE, Visible = false, UnscaledWidth = 55, Type = ColumnType.Text }, + new RollColumn { Text = "Domain", Name = WatchList.DOMAIN, Visible = true, UnscaledWidth = 55, Type = ColumnType.Text }, + new RollColumn { Text = "Notes", Name = WatchList.NOTES, Visible = true, UnscaledWidth = 128, Type = ColumnType.Text } }; }