Skip to content

Commit f55c37d

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 23eba7f commit f55c37d

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
@@ -579,15 +579,22 @@ private void SetupCustomPatterns()
579579
/// <remarks>for Lua</remarks>
580580
public void AddColumn(string name, string text, int widthUnscaled, int rollIndex)
581581
{
582-
if (_inputRolls[0].AllColumns.Exists(c => c.Name == name)) return;
583-
584582
for (int i = 0; i < _inputRolls.Count; i++)
585583
{
586-
RollColumn col = new(name: name, widthUnscaled: widthUnscaled, text: text);
584+
RollColumn/*?*/ col = _inputRolls[i].AllColumns[name];
585+
if (col == null)
586+
{
587+
col = new(name: name, widthUnscaled: widthUnscaled, text: text);
588+
_inputRolls[i].AllColumns.Add(col);
589+
}
590+
else
591+
{
592+
col.VerticalWidth = col.HorizontalHeight = widthUnscaled;
593+
col.Text = text;
594+
}
587595
col.Visible = i == rollIndex;
588-
_inputRolls[rollIndex].AllColumns.Add(col);
589-
_inputRolls[rollIndex].AllColumns.ColumnsChanged();
590-
_inputRolls[rollIndex].Refresh();
596+
_inputRolls[i].AllColumns.ColumnsChanged();
597+
_inputRolls[i].Refresh();
591598
}
592599

593600
SetUpToolStripColumns();
@@ -777,6 +784,7 @@ private bool StartNewMovieWrapper(ITasMovie movie, bool isNew)
777784
roll.HorizontalOrientation = _movieSettings.HorizontalOrientation = inputRollSettings.HorizontalOrientation;
778785
roll.LagFramesToHide = _movieSettings.LagFramesToHide = inputRollSettings.LagFramesToHide;
779786
roll.HideWasLagFrames = _movieSettings.HideWasLagFrames = inputRollSettings.HideWasLagFrames;
787+
roll.AllColumns[CursorColumnName].VerticalWidth = roll.AllColumns[CursorColumnName].HorizontalHeight = 18;
780788
UpdateColumnWidths(roll);
781789
UpdateInputRollDefinition(roll);
782790
}

0 commit comments

Comments
 (0)