Added missing follow playback cursor if needed function in Qt TAS GUI.

This commit is contained in:
mjbudd77 2021-12-22 23:54:14 -05:00
parent a442354ef6
commit b4735a1aea
3 changed files with 25 additions and 4 deletions

View File

@ -5533,6 +5533,22 @@ void QPianoRoll::followPlaybackCursor(void)
{ {
centerListAroundLine(currFrameCounter); centerListAroundLine(currFrameCounter);
} }
//----------------------------------------------------------------------------
void QPianoRoll::followPlaybackCursorIfNeeded(bool followPauseframe)
{
if (taseditorConfig->followPlaybackCursor)
{
if (playback->getPauseFrame() < 0)
{
ensureTheLineIsVisible( currFrameCounter );
}
else if (followPauseframe)
{
ensureTheLineIsVisible( playback->getPauseFrame() );
}
}
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void QPianoRoll::followPauseframe(void) void QPianoRoll::followPauseframe(void)
{ {

View File

@ -151,6 +151,7 @@ class QPianoRoll : public QWidget
void handleColumnSet(int column, bool altPressed); void handleColumnSet(int column, bool altPressed);
void centerListAroundLine(int rowIndex); void centerListAroundLine(int rowIndex);
void ensureTheLineIsVisible( int lineNum ); void ensureTheLineIsVisible( int lineNum );
void followPlaybackCursorIfNeeded(bool followPauseframe);
void followMarker(int markerID); void followMarker(int markerID);
void followSelection(void); void followSelection(void);
void followPlaybackCursor(void); void followPlaybackCursor(void);

View File

@ -159,7 +159,7 @@ void PLAYBACK::update()
bookmarks->redrawChangedBookmarks(currFrameCounter); bookmarks->redrawChangedBookmarks(currFrameCounter);
lastCursorPos = currFrameCounter; lastCursorPos = currFrameCounter;
// follow the Playback cursor, but in case of seeking don't follow it // follow the Playback cursor, but in case of seeking don't follow it
//pianoRoll.followPlaybackCursorIfNeeded(false); //pianoRoll.updatePlaybackCursorPositionInPianoRoll(); // an unfinished experiment tasWin->pianoRoll->followPlaybackCursorIfNeeded(false); //pianoRoll.updatePlaybackCursorPositionInPianoRoll(); // an unfinished experiment
// enforce redrawing now // enforce redrawing now
//UpdateWindow(pianoRoll.hwndList); //UpdateWindow(pianoRoll.hwndList);
// lazy update of "Playback's Marker text" // lazy update of "Playback's Marker text"
@ -396,10 +396,12 @@ void PLAYBACK::handleRewindFrame()
else else
{ {
// cursor is at frame 0 - can't rewind, but still must make cursor visible if needed // cursor is at frame 0 - can't rewind, but still must make cursor visible if needed
//pianoRoll.followPlaybackCursorIfNeeded(true); tasWin->pianoRoll->followPlaybackCursorIfNeeded(true);
} }
if (!pauseFrame) if (!pauseFrame)
{
pauseEmulation(); pauseEmulation();
}
} }
void PLAYBACK::handleForwardFrame() void PLAYBACK::handleForwardFrame()
{ {
@ -478,11 +480,13 @@ void PLAYBACK::ensurePlaybackIsInsideGreenzone(bool executeLua)
{ {
// since the game state was changed by this jump, we must update possible Lua callbacks and other tools that would normally only update in FCEUI_Emulate // since the game state was changed by this jump, we must update possible Lua callbacks and other tools that would normally only update in FCEUI_Emulate
if (executeLua) if (executeLua)
{
ForceExecuteLuaFrameFunctions(); ForceExecuteLuaFrameFunctions();
}
//Update_RAM_Search(); // Update_RAM_Watch() is also called. //Update_RAM_Search(); // Update_RAM_Watch() is also called.
} }
// follow the Playback cursor, but in case of seeking don't follow it // follow the Playback cursor, but in case of seeking don't follow it
//pianoRoll.followPlaybackCursorIfNeeded(false); tasWin->pianoRoll->followPlaybackCursorIfNeeded(false);
} }
// an interface for sending Playback cursor to any frame // an interface for sending Playback cursor to any frame
@ -515,7 +519,7 @@ void PLAYBACK::jump(int frame, bool forceStateReload, bool executeLua, bool foll
} }
// follow the Playback cursor, and optionally follow pauseframe (if seeking was launched) // follow the Playback cursor, and optionally follow pauseframe (if seeking was launched)
//pianoRoll.followPlaybackCursorIfNeeded(followPauseframe); tasWin->pianoRoll->followPlaybackCursorIfNeeded(followPauseframe);
// redraw respective Piano Roll lines if needed // redraw respective Piano Roll lines if needed
if (lastCursor != currFrameCounter) if (lastCursor != currFrameCounter)