13
0

Fix Lua bindings, Session is-a HistoryOwner

For derived classes to work in Lua w/o explicit cast,
it needs to be the first parent.
This commit is contained in:
Robin Gareus 2024-08-18 22:34:31 +02:00 committed by Paul Davis
parent 2fceb66193
commit 7e7440bc33
2 changed files with 16 additions and 11 deletions

View File

@ -204,12 +204,12 @@ private:
};
/** Ardour Session */
class LIBARDOUR_API Session : public PBD::StatefulDestructible,
class LIBARDOUR_API Session : public PBD::HistoryOwner,
public PBD::StatefulDestructible,
public PBD::ScopedConnectionList,
public SessionEventManager,
public TransportAPI,
public Temporal::TimeDomainProvider,
public PBD::HistoryOwner
public Temporal::TimeDomainProvider
{
public:
enum RecordState {

View File

@ -22,6 +22,7 @@
#include <glibmm.h>
#include "pbd/history_owner.h"
#include "pbd/stateful_diff_command.h"
#include "pbd/openuri.h"
#include "pbd/progress.h"
@ -295,6 +296,7 @@ CLASSKEYS(Temporal::superclock_t)
CLASSKEYS(PBD::ID);
CLASSKEYS(PBD::Configuration);
CLASSKEYS(PBD::HistoryOwner);
CLASSKEYS(PBD::PropertyChange);
CLASSKEYS(PBD::StatefulDestructible);
@ -503,6 +505,16 @@ LuaBindings::common (lua_State* L)
.beginClass <PBD::Progress> ("Progress")
.endClass ()
.beginClass <PBD::HistoryOwner> ("HistoryOwner")
.addFunction ("begin_reversible_command", (void (PBD::HistoryOwner::*)(const std::string&))&PBD::HistoryOwner::begin_reversible_command)
.addFunction ("commit_reversible_command", &PBD::HistoryOwner::commit_reversible_command)
.addFunction ("abort_reversible_command", &PBD::HistoryOwner::abort_reversible_command)
.addFunction ("collected_undo_commands", &PBD::HistoryOwner::collected_undo_commands)
.addFunction ("abort_empty_reversible_command", &PBD::HistoryOwner::abort_empty_reversible_command)
.addFunction ("add_command", &PBD::HistoryOwner::add_command)
.addFunction ("add_stateful_diff_command", &PBD::HistoryOwner::add_stateful_diff_command)
.endClass ()
.beginClass <PBD::Stateful> ("Stateful")
.addFunction ("id", &PBD::Stateful::id)
.addFunction ("properties", &PBD::Stateful::properties)
@ -3027,7 +3039,7 @@ LuaBindings::common (lua_State* L)
// functions which can be used from realtime and non-realtime contexts
luabridge::getGlobalNamespace (L)
.beginNamespace ("ARDOUR")
.beginClass <Session> ("Session")
.deriveClass <Session, PBD::HistoryOwner> ("Session")
.addFunction ("scripts_changed", &Session::scripts_changed) // used internally
.addFunction ("engine_speed", &Session::engine_speed)
.addFunction ("actual_speed", &Session::actual_speed)
@ -3113,13 +3125,6 @@ LuaBindings::common (lua_State* L)
.addFunction ("set_controls", &Session::set_controls)
.addFunction ("set_control", &Session::set_control)
.addFunction ("set_exclusive_input_active", &Session::set_exclusive_input_active)
.addFunction ("begin_reversible_command", (void (Session::*)(const std::string&))&Session::begin_reversible_command)
.addFunction ("commit_reversible_command", &Session::commit_reversible_command)
.addFunction ("abort_reversible_command", &Session::abort_reversible_command)
.addFunction ("collected_undo_commands", &Session::collected_undo_commands)
.addFunction ("abort_empty_reversible_command", &Session::abort_empty_reversible_command)
.addFunction ("add_command", &Session::add_command)
.addFunction ("add_stateful_diff_command", &Session::add_stateful_diff_command)
.addFunction ("playlists", &Session::playlists)
.addFunction ("engine", (AudioEngine& (Session::*)())&Session::engine)
.addFunction ("get_block_size", &Session::get_block_size)