From 7d1084bf98ebd02d504a240a8794cf31b769e7c8 Mon Sep 17 00:00:00 2001 From: feos Date: Thu, 8 Sep 2016 22:22:04 +0300 Subject: [PATCH] tastudio: change internals of editing input during scrolling. for now it only makes a single edit per click, since we only recalculate OnMouseDown if scrolling. this is required to get rid of scrolling recursion caused by various actions. also ClearLeftMouseStates before saving dialog pops up --- .../CustomControls/InputRoll.cs | 67 +++++++++---------- .../tools/TAStudio/TAStudio.MenuItems.cs | 1 + 2 files changed, 33 insertions(+), 35 deletions(-) diff --git a/BizHawk.Client.EmuHawk/CustomControls/InputRoll.cs b/BizHawk.Client.EmuHawk/CustomControls/InputRoll.cs index 312d102bff..071fafd12a 100644 --- a/BizHawk.Client.EmuHawk/CustomControls/InputRoll.cs +++ b/BizHawk.Client.EmuHawk/CustomControls/InputRoll.cs @@ -1016,6 +1016,38 @@ namespace BizHawk.Client.EmuHawk // TODO add query callback of whether to select the cell or not protected override void OnMouseDown(MouseEventArgs e) { + if (!GlobalWin.MainForm.EmulatorPaused && _currentX.HasValue) + { + // copypaste from OnMouseMove() + Cell newCell = CalculatePointedCell(_currentX.Value, _currentY.Value); + if (QueryFrameLag != null && newCell.RowIndex.HasValue) + { + newCell.RowIndex += CountLagFramesDisplay(newCell.RowIndex.Value); + } + newCell.RowIndex += FirstVisibleRow; + if (newCell.RowIndex < 0) + newCell.RowIndex = 0; + + if (!newCell.Equals(CurrentCell)) + { + CellChanged(newCell); + + if (IsHoveringOnColumnCell || + (WasHoveringOnColumnCell && !IsHoveringOnColumnCell)) + { + Refresh(); + } + else if (_columnDown != null) + { + Refresh(); + } + } + else if (_columnDown != null) + { + Refresh(); + } + } + if (e.Button == MouseButtons.Left) { if (IsHoveringOnColumnCell) @@ -1430,41 +1462,6 @@ namespace BizHawk.Client.EmuHawk if (CurrentCell == null) return; - - if (!GlobalWin.MainForm.EmulatorPaused && _currentX.HasValue) - { - if (CurrentCell.Column.Name == "CursorColumn" && IsPaintDown) - return; - - // copypaste from OnMouseMove() - Cell newCell = CalculatePointedCell(_currentX.Value, _currentY.Value); - if (QueryFrameLag != null && newCell.RowIndex.HasValue) - { - newCell.RowIndex += CountLagFramesDisplay(newCell.RowIndex.Value); - } - newCell.RowIndex += FirstVisibleRow; - if (newCell.RowIndex < 0) - newCell.RowIndex = 0; - - if (!newCell.Equals(CurrentCell)) - { - CellChanged(newCell); - - if (IsHoveringOnColumnCell || - (WasHoveringOnColumnCell && !IsHoveringOnColumnCell)) - { - Refresh(); - } - else if (_columnDown != null) - { - Refresh(); - } - } - else if (_columnDown != null) - { - Refresh(); - } - } } private void HorizontalBar_ValueChanged(object sender, EventArgs e) diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs index 1bd8be02f4..5551af954c 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs @@ -109,6 +109,7 @@ namespace BizHawk.Client.EmuHawk private void SaveAsTas(object sender, EventArgs e) { _autosaveTimer.Stop(); + ClearLeftMouseStates(); var filename = CurrentTasMovie.Filename; if (string.IsNullOrWhiteSpace(filename) || filename == DefaultTasProjName()) {