13
0

Pre-seed Lua action-buttons

This commit is contained in:
Robin Gareus 2019-12-12 20:35:14 +01:00
parent 3208535c20
commit d226b63e70
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 20 additions and 0 deletions

View File

@ -1320,6 +1320,7 @@ LuaInstance::load_state ()
{
std::string uiscripts;
if (!find_file (ardour_config_search_path(), ui_scripts_file_name, uiscripts)) {
pre_seed_scripts ();
return -1;
}
XMLTree tree;
@ -1466,6 +1467,24 @@ LuaInstance::set_state (const XMLNode& node)
return 0;
}
void
LuaInstance::pre_seed_scripts ()
{
LuaScriptInfoPtr spi = LuaScripting::instance ().by_name ("Mixer Screenshot", LuaScriptInfo::EditorAction);
int id = 0;
if (spi) {
try {
std::string script = Glib::file_get_contents (spi->path);
LuaState ls;
register_classes (ls.getState ());
LuaScriptParamList lsp = LuaScriptParams::script_params (ls, spi->path, "action_params");
LuaScriptParamPtr lspp (new LuaScriptParam("x-script-origin", "", spi->path, false, true));
lsp.push_back (lspp);
set_lua_action (id++, "Mixer Screenshot", script, lsp);
} catch (...) { }
}
}
bool
LuaInstance::interactive_add (LuaScriptInfo::ScriptType type, int id)
{

View File

@ -155,6 +155,7 @@ private:
void init ();
void set_dirty ();
void session_going_away ();
void pre_seed_scripts ();
LuaState lua;