13
0

Add Lua signal emitted when editor selection changed

This commit is contained in:
Robin Gareus 2023-07-04 21:06:25 +02:00
parent efed61af44
commit 9b8040a9f4
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
3 changed files with 20 additions and 0 deletions

View File

@ -539,6 +539,7 @@ using namespace ARDOUR;
PBD::Signal0<void> LuaInstance::LuaTimerS;
PBD::Signal0<void> LuaInstance::LuaTimerDS;
PBD::Signal0<void> LuaInstance::SetSession;
PBD::Signal0<void> LuaInstance::SelectionChanged;
void
LuaInstance::register_hooks (lua_State* L)
@ -1346,6 +1347,12 @@ LuaInstance::init ()
luabridge::push <PublicEditor *> (L, &PublicEditor::instance());
lua_setglobal (L, "Editor");
Selection& sel (PublicEditor::instance().get_selection ());
sel.TimeChanged.connect (sigc::mem_fun (*this, &LuaInstance::selection_changed));
sel.RegionsChanged.connect (sigc::mem_fun (*this, &LuaInstance::selection_changed));
sel.TracksChanged.connect (sigc::mem_fun (*this, &LuaInstance::selection_changed));
sel.MarkersChanged.connect (sigc::mem_fun (*this, &LuaInstance::selection_changed));
}
int
@ -1458,6 +1465,12 @@ LuaInstance::every_point_one_seconds ()
LuaTimerDS (); // emit signal
}
void
LuaInstance::selection_changed ()
{
SelectionChanged (); // emit signal
}
int
LuaInstance::set_state (const XMLNode& node)
{

View File

@ -154,6 +154,7 @@ public:
static PBD::Signal0<void> LuaTimerS; // deci-seconds (Timer every 1s)
static PBD::Signal0<void> LuaTimerDS; // deci-seconds (Timer every .1s)
static PBD::Signal0<void> SetSession; // emitted when a session is loaded
static PBD::Signal0<void> SelectionChanged; // emitted when editor selection changes
private:
LuaInstance();
@ -180,11 +181,14 @@ private:
LuaCallbackMap _callbacks;
PBD::ScopedConnectionList _slotcon;
void selection_changed ();
void every_second ();
sigc::connection second_connection;
void every_point_one_seconds ();
sigc::connection point_one_second_connection;
};
#endif

View File

@ -91,6 +91,9 @@ STATIC(LuaTimerDS, &LuaInstance::LuaTimerDS, 0)
// Session load
STATIC(SetSession, &LuaInstance::SetSession, 0)
// Editor Selection Changed
STATIC(SelectionChanged, &LuaInstance::SelectionChanged, 0)
// TODO per track/route signals,
// TODO per plugin actions / controllables
// TODO per region actions