From e1af631af6e43662788974d60ee787abaf76c16e Mon Sep 17 00:00:00 2001 From: Morilli <35152647+Morilli@users.noreply.github.com> Date: Sun, 23 Jun 2024 02:11:24 +0200 Subject: [PATCH] Apply some sketchy nullable related changes TasView_PointedCellChanged will now not short-circuit when the OldCell has null values (happens on MouseEnter mainly). Also, null column is accepted as this allows dragging off-control without input being dropped. Also, OldCell and NewCell are assumed to never be null (is true in the current logic). --- .../tools/TAStudio/TAStudio.ListView.cs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs index f26f421f67..f70f27f92d 100644 --- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs +++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs @@ -936,10 +936,7 @@ namespace BizHawk.Client.EmuHawk private void TasView_PointedCellChanged(object sender, InputRoll.CellEventArgs e) { - // TODO: If NewCell is null, it indicates that there was a mouse leave scenario, we may want to account for that - // For now return if a null because this happens OnEnter which doesn't have any of the below behaviors yet - if (e.OldCell?.Column == null || e.OldCell?.RowIndex == null - || e.NewCell?.Column == null || e.NewCell?.RowIndex == null) + if (e.NewCell.RowIndex is null) { return; } @@ -951,7 +948,7 @@ namespace BizHawk.Client.EmuHawk if (_paintingMinFrame >= 0) { - _paintingMinFrame = Math.Min(_paintingMinFrame, e.NewCell?.RowIndex ?? 0); + _paintingMinFrame = Math.Min(_paintingMinFrame, e.NewCell.RowIndex.Value); } // skip rerecord counting on drawing entirely, mouse down is enough @@ -961,7 +958,7 @@ namespace BizHawk.Client.EmuHawk int startVal, endVal; int frame = e.NewCell.RowIndex.Value; - if (e.OldCell.RowIndex.Value < e.NewCell.RowIndex.Value) + if (e.OldCell.RowIndex < e.NewCell.RowIndex) { startVal = e.OldCell.RowIndex.Value; endVal = e.NewCell.RowIndex.Value; @@ -973,7 +970,7 @@ namespace BizHawk.Client.EmuHawk else { startVal = e.NewCell.RowIndex.Value; - endVal = e.OldCell.RowIndex.Value; + endVal = e.OldCell.RowIndex ?? e.NewCell.RowIndex.Value; if(_patternPaint) { endVal = _startRow;