Skip to content

Commit 344951a

Browse files
committed
no need to save Width in addition to VerticalWidth/HorizontalHeight
fixes cursor column when rotating after loading an old movie allow `tastudio.addcolumn` to update column width (they might be 0 now, after loading an old movie); also text because why not
1 parent cad83d4 commit 344951a

2 files changed

Lines changed: 16 additions & 7 deletions

File tree

src/BizHawk.Client.EmuHawk/CustomControls/InputRoll/RollColumn.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ public class RollColumn
99
public int VerticalWidth { get; set; }
1010
public int HorizontalHeight { get; set; }
1111

12+
[JsonIgnore]
1213
public int Width
1314
{
1415
get => (owner?.HorizontalOrientation == true) ? HorizontalHeight : VerticalWidth;
@@ -33,7 +34,7 @@ public int ScaledWidth
3334
public string Name { get; }
3435

3536
/// <remarks>TODO rename to <c>Label</c>?</remarks>
36-
public string Text { get; }
37+
public string Text { get; set; }
3738

3839
public bool Visible { get; set; } = true;
3940

src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -578,15 +578,22 @@ private void SetupCustomPatterns()
578578
/// <remarks>for Lua</remarks>
579579
public void AddColumn(string name, string text, int widthUnscaled, int rollIndex)
580580
{
581-
if (_inputRolls[0].AllColumns.Exists(c => c.Name == name)) return;
582-
583581
for (int i = 0; i < _inputRolls.Count; i++)
584582
{
585-
RollColumn col = new(name: name, widthUnscaled: widthUnscaled, text: text);
583+
RollColumn/*?*/ col = _inputRolls[i].AllColumns[name];
584+
if (col == null)
585+
{
586+
col = new(name: name, widthUnscaled: widthUnscaled, text: text);
587+
_inputRolls[i].AllColumns.Add(col);
588+
}
589+
else
590+
{
591+
col.VerticalWidth = col.HorizontalHeight = widthUnscaled;
592+
col.Text = text;
593+
}
586594
col.Visible = i == rollIndex;
587-
_inputRolls[rollIndex].AllColumns.Add(col);
588-
_inputRolls[rollIndex].AllColumns.ColumnsChanged();
589-
_inputRolls[rollIndex].Refresh();
595+
_inputRolls[i].AllColumns.ColumnsChanged();
596+
_inputRolls[i].Refresh();
590597
}
591598

592599
SetUpToolStripColumns();
@@ -776,6 +783,7 @@ private bool StartNewMovieWrapper(ITasMovie movie, bool isNew)
776783
roll.HorizontalOrientation = _movieSettings.HorizontalOrientation = inputRollSettings.HorizontalOrientation;
777784
roll.LagFramesToHide = _movieSettings.LagFramesToHide = inputRollSettings.LagFramesToHide;
778785
roll.HideWasLagFrames = _movieSettings.HideWasLagFrames = inputRollSettings.HideWasLagFrames;
786+
roll.AllColumns[CursorColumnName].VerticalWidth = roll.AllColumns[CursorColumnName].HorizontalHeight = 18;
779787
UpdateColumnWidths(roll);
780788
UpdateInputRollDefinition(roll);
781789
}

0 commit comments

Comments
 (0)