From 07725134993ac9cf5f62e23cd44a91913a1a073a Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 29 Jan 2018 22:21:59 +0100 Subject: [PATCH] LuaInstance: prepare for 3 argument signal/slot callbacks --- gtk2_ardour/luainstance.cc | 22 ++++++++++++++++++++++ gtk2_ardour/luainstance.h | 3 +++ 2 files changed, 25 insertions(+) diff --git a/gtk2_ardour/luainstance.cc b/gtk2_ardour/luainstance.cc index 8f9572b98e..361b1e238c 100644 --- a/gtk2_ardour/luainstance.cc +++ b/gtk2_ardour/luainstance.cc @@ -2125,6 +2125,14 @@ LuaCallback::connect_2 (enum LuaSignal::LuaSignal ls, T ref, PBD::Signal2 void +LuaCallback::connect_3 (enum LuaSignal::LuaSignal ls, T ref, PBD::Signal3 *signal) { + signal->connect ( + _connections, invalidator (*this), + boost::bind (&LuaCallback::proxy_3, this, ls, ref, _1, _2, _3), + gui_context()); +} + template void LuaCallback::proxy_0 (enum LuaSignal::LuaSignal ls, T ref) { bool ok = true; @@ -2167,3 +2175,17 @@ LuaCallback::proxy_2 (enum LuaSignal::LuaSignal ls, T ref, C1 a1, C2 a2) { drop_callback (); /* EMIT SIGNAL */ } } + +template void +LuaCallback::proxy_3 (enum LuaSignal::LuaSignal ls, T ref, C1 a1, C2 a2, C3 a3) { + bool ok = true; + { + const luabridge::LuaRef& rv ((*_lua_call)((int)ls, ref, a1, a2, a3)); + if (! rv.cast ()) { + ok = false; + } + } + if (!ok) { + drop_callback (); /* EMIT SIGNAL */ + } +} diff --git a/gtk2_ardour/luainstance.h b/gtk2_ardour/luainstance.h index 60bbca7c88..d48ab8330a 100644 --- a/gtk2_ardour/luainstance.h +++ b/gtk2_ardour/luainstance.h @@ -70,6 +70,9 @@ private: template void connect_2 (enum LuaSignal::LuaSignal, T, PBD::Signal2*); template void proxy_2 (enum LuaSignal::LuaSignal, T, C1, C2); + + template void connect_3 (enum LuaSignal::LuaSignal, T, PBD::Signal3*); + template void proxy_3 (enum LuaSignal::LuaSignal, T, C1, C2, C3); }; typedef boost::shared_ptr LuaCallbackPtr;