Hooked up Lua menu actions in Qt Tas Editor.

This commit is contained in:
mjbudd77 2021-11-26 06:16:38 -05:00
parent fa748b0a41
commit 4b3ae8fead
3 changed files with 32 additions and 9 deletions

View File

@ -183,6 +183,12 @@ void FCEUD_MovieRecordTo(void);
void FCEUD_MovieReplayFrom(void);
void FCEUD_LuaRunFrom(void);
#ifdef _S9XLUA_H
// lua engine
void TaseditorAutoFunction(void);
void TaseditorManualFunction(void);
#endif
int32 FCEUI_GetDesiredFPS(void);
void FCEUI_SaveSnapshot(void);
void FCEUI_SaveSnapshotAs(void);

View File

@ -846,7 +846,7 @@ QMenuBar *TasEditorWindow::buildMenuBar(void)
//act->setShortcut(QKeySequence(tr("Ctrl+N")));
act->setStatusTip(tr("Run Function"));
//act->setIcon( style()->standardIcon( QStyle::SP_FileDialogStart ) );
//connect(act, SIGNAL(triggered()), this, SLOT(createNewProject(void)) );
connect(act, SIGNAL(triggered()), this, SLOT(manLuaRun(void)) );
luaMenu->addAction(act);
@ -858,7 +858,7 @@ QMenuBar *TasEditorWindow::buildMenuBar(void)
//act->setShortcut(QKeySequence(tr("Ctrl+N")));
act->setStatusTip(tr("Auto Function"));
//act->setIcon( style()->standardIcon( QStyle::SP_FileDialogStart ) );
//connect(act, SIGNAL(triggered()), this, SLOT(createNewProject(void)) );
connect(act, SIGNAL(triggered(bool)), this, SLOT(autoLuaRunChanged(bool)) );
luaMenu->addAction(act);
@ -1364,7 +1364,7 @@ int TasEditorWindow::initModules(void)
// create initial snapshot in history
history.reset();
// reset Taseditor variables
//mustCallManualLuaFunction = false;
mustCallManualLuaFunction = false;
//SetFocus(history.hwndHistoryList); // set focus only once, to show blue selection cursor
//SetFocus(pianoRoll.hwndList);
@ -1392,16 +1392,19 @@ void TasEditorWindow::frameUpdate(void)
splicer.update();
history.update();
project.update();
#ifdef _S9XLUA_H
// run Lua functions if needed
if (taseditorConfig.enableLuaAutoFunction)
{
//TaseditorAutoFunction();
TaseditorAutoFunction();
}
//if (mustCallManualLuaFunction)
//{
// TaseditorManualFunction();
// mustCallManualLuaFunction = false;
//}
if (mustCallManualLuaFunction)
{
TaseditorManualFunction();
mustCallManualLuaFunction = false;
}
#endif
pianoRoll->update();
@ -2356,6 +2359,16 @@ void TasEditorWindow::pauseAtEndActChanged(bool val)
taseditorConfig.autopauseAtTheEndOfMovie = val;
}
//----------------------------------------------------------------------------
void TasEditorWindow::manLuaRun(void)
{
mustCallManualLuaFunction = true;
}
//----------------------------------------------------------------------------
void TasEditorWindow::autoLuaRunChanged(bool val)
{
taseditorConfig.enableLuaAutoFunction = val;
}
//----------------------------------------------------------------------------
void TasEditorWindow::showToolTipsActChanged(bool val)
{
taseditorConfig.tooltipsEnabled = val;

View File

@ -295,6 +295,8 @@ class TasEditorWindow : public QDialog
std::vector<std::string> patternsNames;
std::vector<std::vector<uint8_t>> patterns;
bool mustCallManualLuaFunction;
private:
int initModules(void);
@ -373,6 +375,8 @@ class TasEditorWindow : public QDialog
void setMaxUndoCapacity(void);
void setCurrentPattern(int);
void tabViewChanged(int);
void autoLuaRunChanged(bool);
void manLuaRun(void);
friend class RECORDER;
friend class SPLICER;