Implemented playback mouse middle button functionality for Qt Tas editor.
This commit is contained in:
parent
a7244cf343
commit
27fb529830
|
@ -925,6 +925,10 @@ void BOOKMARKS::mousePressEvent(QMouseEvent * event)
|
||||||
bookmarksArray[bookmarkRightclicked].flashType = FLASH_TYPE_SET;
|
bookmarksArray[bookmarkRightclicked].flashType = FLASH_TYPE_SET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( event->button() & Qt::MiddleButton )
|
||||||
|
{
|
||||||
|
playback->handleMiddleButtonClick();
|
||||||
|
}
|
||||||
//printf("Mouse Button Pressed: 0x%x (%i,%i)\n", event->button(), c.x(), c.y() );
|
//printf("Mouse Button Pressed: 0x%x (%i,%i)\n", event->button(), c.x(), c.y() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -596,6 +596,10 @@ void BRANCHES::mousePressEvent(QMouseEvent * event)
|
||||||
//if (branches.branchRightclicked >= 0 && branches.branchRightclicked < TOTAL_BOOKMARKS)
|
//if (branches.branchRightclicked >= 0 && branches.branchRightclicked < TOTAL_BOOKMARKS)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else if (event->button() & Qt::MiddleButton)
|
||||||
|
{
|
||||||
|
playback->handleMiddleButtonClick();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BRANCHES::mouseReleaseEvent(QMouseEvent * event)
|
void BRANCHES::mouseReleaseEvent(QMouseEvent * event)
|
||||||
|
|
|
@ -20,6 +20,8 @@ Playback - Player of emulation states
|
||||||
* stores resources: upper text field prefix, timings of target frame animation, response times of GUI buttons, progressbar scale
|
* stores resources: upper text field prefix, timings of target frame animation, response times of GUI buttons, progressbar scale
|
||||||
------------------------------------------------------------------------------------ */
|
------------------------------------------------------------------------------------ */
|
||||||
|
|
||||||
|
#include <QApplication>
|
||||||
|
|
||||||
#include "fceu.h"
|
#include "fceu.h"
|
||||||
#include "driver.h"
|
#include "driver.h"
|
||||||
#include "Qt/TasEditor/taseditor_project.h"
|
#include "Qt/TasEditor/taseditor_project.h"
|
||||||
|
@ -287,48 +289,60 @@ void PLAYBACK::restoreLastPosition()
|
||||||
}
|
}
|
||||||
void PLAYBACK::handleMiddleButtonClick()
|
void PLAYBACK::handleMiddleButtonClick()
|
||||||
{
|
{
|
||||||
// if (emuPausedState)
|
if (emuPausedState)
|
||||||
// {
|
{
|
||||||
// // Unpause or start seeking
|
int msState = QApplication::mouseButtons();
|
||||||
// // works only when right mouse button is released
|
int kbModifiers = QApplication::keyboardModifiers();
|
||||||
// if (GetAsyncKeyState(GetSystemMetrics(SM_SWAPBUTTON) ? VK_LBUTTON : VK_RBUTTON) >= 0)
|
//bool alt_down = (kbModifiers & Qt::AltModifier ) ? 1 : 0;
|
||||||
// {
|
bool shift_down = (kbModifiers & Qt::ShiftModifier ) ? 1 : 0;
|
||||||
// if (GetAsyncKeyState(VK_SHIFT) < 0)
|
bool ctrl_down = (kbModifiers & Qt::ControlModifier) ? 1 : 0;
|
||||||
// {
|
bool rgtMsBtnDown = (msState & Qt::RightButton) ? 1 : 0;
|
||||||
// // if Shift is held, seek to nearest Marker
|
|
||||||
// int last_frame = markersManager.getMarkersArraySize() - 1; // the end of movie Markers
|
// Unpause or start seeking
|
||||||
// int target_frame = currFrameCounter + 1;
|
// works only when right mouse button is released
|
||||||
// for (; target_frame <= last_frame; ++target_frame)
|
if (!rgtMsBtnDown)
|
||||||
// if (markersManager.getMarkerAtFrame(target_frame)) break;
|
{
|
||||||
// if (target_frame <= last_frame)
|
if (shift_down)
|
||||||
// startSeekingToFrame(target_frame);
|
{
|
||||||
// } else if (GetAsyncKeyState(VK_CONTROL) < 0)
|
// if Shift is held, seek to nearest Marker
|
||||||
// {
|
int last_frame = markersManager->getMarkersArraySize() - 1; // the end of movie Markers
|
||||||
// // if Ctrl is held, seek to Selection cursor or replay from Selection cursor
|
int target_frame = currFrameCounter + 1;
|
||||||
// int selection_beginning = selection.getCurrentRowsSelectionBeginning();
|
for (; target_frame <= last_frame; ++target_frame)
|
||||||
// if (selection_beginning > currFrameCounter)
|
if (markersManager->getMarkerAtFrame(target_frame)) break;
|
||||||
// {
|
if (target_frame <= last_frame)
|
||||||
// startSeekingToFrame(selection_beginning);
|
startSeekingToFrame(target_frame);
|
||||||
// } else if (selection_beginning < currFrameCounter)
|
}
|
||||||
// {
|
else if (ctrl_down)
|
||||||
// int saved_currFrameCounter = currFrameCounter;
|
{
|
||||||
// if (selection_beginning < 0)
|
// if Ctrl is held, seek to Selection cursor or replay from Selection cursor
|
||||||
// selection_beginning = 0;
|
int selection_beginning = selection->getCurrentRowsSelectionBeginning();
|
||||||
// jump(selection_beginning);
|
if (selection_beginning > currFrameCounter)
|
||||||
// startSeekingToFrame(saved_currFrameCounter);
|
{
|
||||||
// }
|
startSeekingToFrame(selection_beginning);
|
||||||
// } else if (getPauseFrame() < 0 && getLastPosition() >= greenzone.getSize())
|
}
|
||||||
// {
|
else if (selection_beginning < currFrameCounter)
|
||||||
// restoreLastPosition();
|
{
|
||||||
// } else
|
int saved_currFrameCounter = currFrameCounter;
|
||||||
// {
|
if (selection_beginning < 0)
|
||||||
// unpauseEmulation();
|
selection_beginning = 0;
|
||||||
// }
|
jump(selection_beginning);
|
||||||
// }
|
startSeekingToFrame(saved_currFrameCounter);
|
||||||
// } else
|
}
|
||||||
// {
|
}
|
||||||
// pauseEmulation();
|
else if (getPauseFrame() < 0 && getLastPosition() >= greenzone->getSize())
|
||||||
// }
|
{
|
||||||
|
restoreLastPosition();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
unpauseEmulation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pauseEmulation();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PLAYBACK::startSeekingToFrame(int frame)
|
void PLAYBACK::startSeekingToFrame(int frame)
|
||||||
|
|
Loading…
Reference in New Issue