tastudio: introduce fast scroll idea via timer

seek frame is reset only if paused OR 100ms since last scroll haven't elapsed
This commit is contained in:
feos 2015-07-12 21:54:31 +03:00
parent f9dad99484
commit de699656d6
2 changed files with 20 additions and 3 deletions

View File

@ -42,7 +42,9 @@ namespace BizHawk.Client.EmuHawk
}
private bool _triggerAutoRestore; // If true, autorestore will be called on mouse up
private int? _triggerAutoRestoreFromFrame; // If set and _triggerAutoRestore is true, will call GoToFrameIfNecessary() with this value
private int? _triggerAutoRestoreFromFrame; // If set and _triggerAutoRestore is true, will call GoToFrameIfNecessary() with this value
private System.Timers.Timer _mouseWheelTimer;
// public static Color CurrentFrame_FrameCol = Color.FromArgb(0xCFEDFC); Why?
public static Color CurrentFrame_InputLog = Color.FromArgb(0xB5E7F7);
@ -494,6 +496,12 @@ namespace BizHawk.Client.EmuHawk
GoToPreviousFrame();
}
}
if (_mouseWheelTimer.Enabled) // dunno if this is telling enough and nothing like bool _mouseWheelFast is needed, but we need to check on the first scroll event, and just decide by delta if it's fast enough to increase actual scrolling speed
{
_mouseWheelTimer.Stop();
}
_mouseWheelTimer.Start();
}
private void TasView_MouseDoubleClick(object sender, MouseEventArgs e)

View File

@ -302,6 +302,11 @@ namespace BizHawk.Client.EmuHawk
Global.Config.MovieEndAction = MovieEndAction.Record;
GlobalWin.MainForm.SetMainformMovieInfo();
Global.MovieSession.ReadOnly = true;
_mouseWheelTimer = new System.Timers.Timer(100); // consider sub 100 ms fast scrolling
_mouseWheelTimer.Elapsed += (s, e) =>
{
_mouseWheelTimer.Stop();
};
}
#endregion
@ -448,6 +453,7 @@ namespace BizHawk.Client.EmuHawk
// Do not keep TAStudio's disk save states.
if (Directory.Exists(PathManager.MakeAbsolutePath(Global.Config.PathEntries["Global", "TAStudio states"].Path, null)))
Directory.Delete(PathManager.MakeAbsolutePath(Global.Config.PathEntries["Global", "TAStudio states"].Path, null), true);
_mouseWheelTimer.Dispose();
}
/// <summary>
@ -536,8 +542,11 @@ namespace BizHawk.Client.EmuHawk
LoadState(closestState);
}
GlobalWin.MainForm.PauseOnFrame = frame;
GlobalWin.MainForm.UnpauseEmulator();
if (GlobalWin.MainForm.EmulatorPaused || _mouseWheelTimer.Enabled) // make seek frame keep up with emulation on fast scrolls
{
GlobalWin.MainForm.PauseOnFrame = frame;
GlobalWin.MainForm.UnpauseEmulator();
}
}
private void LoadState(KeyValuePair<int, byte[]> state)