13
0

Allow Lua bindings of static signals with 4 parameters

This commit is contained in:
Robin Gareus 2022-03-15 22:49:28 +01:00
parent 93207d45c5
commit 87354918a1
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 25 additions and 0 deletions

View File

@ -2349,6 +2349,14 @@ LuaCallback::connect_3 (enum LuaSignal::LuaSignal ls, T ref, PBD::Signal3<void,
gui_context());
}
template <typename T, typename C1, typename C2, typename C3, typename C4> void
LuaCallback::connect_4 (enum LuaSignal::LuaSignal ls, T ref, PBD::Signal4<void, C1, C2, C3, C4> *signal) {
signal->connect (
_connections, invalidator (*this),
boost::bind (&LuaCallback::proxy_4<T, C1, C2, C3, C4>, this, ls, ref, _1, _2, _3, _4),
gui_context());
}
template <typename T> void
LuaCallback::proxy_0 (enum LuaSignal::LuaSignal ls, T ref) {
bool ok = true;
@ -2405,3 +2413,17 @@ LuaCallback::proxy_3 (enum LuaSignal::LuaSignal ls, T ref, C1 a1, C2 a2, C3 a3)
drop_callback (); /* EMIT SIGNAL */
}
}
template <typename T, typename C1, typename C2, typename C3, typename C4> void
LuaCallback::proxy_4 (enum LuaSignal::LuaSignal ls, T ref, C1 a1, C2 a2, C3 a3, C4 a4) {
bool ok = true;
{
const luabridge::LuaRef& rv ((*_lua_call)((int)ls, ref, a1, a2, a3, a4));
if (! rv.cast<bool> ()) {
ok = false;
}
}
if (!ok) {
drop_callback (); /* EMIT SIGNAL */
}
}

View File

@ -91,6 +91,9 @@ private:
template <typename T, typename C1, typename C2, typename C3> void connect_3 (enum LuaSignal::LuaSignal, T, PBD::Signal3<void, C1, C2, C3>*);
template <typename T, typename C1, typename C2, typename C3> void proxy_3 (enum LuaSignal::LuaSignal, T, C1, C2, C3);
template <typename T, typename C1, typename C2, typename C3, typename C4> void connect_4 (enum LuaSignal::LuaSignal, T, PBD::Signal4<void, C1, C2, C3, C4>*);
template <typename T, typename C1, typename C2, typename C3, typename C4> void proxy_4 (enum LuaSignal::LuaSignal, T, C1, C2, C3, C4);
};
typedef boost::shared_ptr<LuaCallback> LuaCallbackPtr;