Emit a signal when Lua session script change (prepare UI update to un/set)
authorRobin Gareus <robin@gareus.org>
Sat, 18 Feb 2017 23:06:01 +0000 (00:06 +0100)
committerRobin Gareus <robin@gareus.org>
Sun, 19 Feb 2017 00:29:08 +0000 (01:29 +0100)
libs/ardour/ardour/session.h
libs/ardour/session.cc

index 637412390e8b90deb2cad1b2184fe44811f017a5..dac899db5cc6936e21f5d1fc70591915b5506637 100644 (file)
@@ -823,6 +823,8 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
        uint32_t registered_lua_function_count () const { return _n_lua_scripts; }
        void scripts_changed (); // called from lua, updates _n_lua_scripts
 
+       PBD::Signal0<void> LuaScriptsChanged;
+
        /* flattening stuff */
 
        boost::shared_ptr<Region> write_one_track (Track&, framepos_t start, framepos_t end,
index e28685d03f9e1c9200c848d2c574282da9800a0a..8edc14300f344342089e0db14e425305a9633e0c 100644 (file)
@@ -5271,6 +5271,9 @@ Session::register_lua_function (
                tbl_arg[(*i)->name] = (*i)->value;
        }
        (*_lua_add)(name, bytecode, tbl_arg); // throws luabridge::LuaException
+       lm.release();
+
+       LuaScriptsChanged (); /* EMIT SIGNAL */
        set_dirty();
 }
 
@@ -5280,6 +5283,9 @@ Session::unregister_lua_function (const std::string& name)
        Glib::Threads::Mutex::Lock lm (lua_lock);
        (*_lua_del)(name); // throws luabridge::LuaException
        lua.collect_garbage ();
+       lm.release();
+
+       LuaScriptsChanged (); /* EMIT SIGNAL */
        set_dirty();
 }