13
0

UI part of lua code/header consolidation.

This commit is contained in:
Robin Gareus 2016-03-23 13:49:25 +01:00
parent 829da7eb33
commit 627f2aae48
3 changed files with 9 additions and 26 deletions

View File

@ -4000,7 +4000,7 @@ ARDOUR_UI::add_lua_script ()
return;
}
LuaScriptParamList lsp = LuaScripting::session_script_params (spi);
LuaScriptParamList lsp = LuaScriptParams::script_params (spi, "sess_params");
std::vector<std::string> reg = _session->registered_lua_functions ();
ScriptParameterDialog spd (_("Set Script Parameters"), spi, reg, lsp);

View File

@ -677,7 +677,7 @@ LuaInstance::interactive_add (LuaScriptInfo::ScriptType type, int id)
return false;
}
LuaScriptParamList lsp = LuaScripting::script_params (spi, "action_params");
LuaScriptParamList lsp = LuaScriptParams::script_params (spi, "action_params");
ScriptParameterDialog spd (_("Set Script Parameters"), spi, reg, lsp);
switch (spd.run ()) {
@ -839,18 +839,9 @@ LuaInstance::lua_action (const int id, std::string& name, std::string& script, L
if (!lsi) {
return false;
}
args = LuaScripting::script_params (lsi, "action_params");
for (luabridge::Iterator i (static_cast<luabridge::LuaRef>(ref["args"])); !i.isNil (); ++i) {
if (!i.key ().isString ()) { assert(0); continue; }
std::string name = i.key ().cast<std::string> ();
std::string value = i.value ().cast<std::string> ();
for (LuaScriptParamList::const_iterator ii = args.begin(); ii != args.end(); ++ii) {
if ((*ii)->name == name) {
(*ii)->value = value;
break;
}
}
}
args = LuaScriptParams::script_params (lsi, "action_params");
luabridge::LuaRef rargs (ref["args"]);
LuaScriptParams::ref_to_params (args, &rargs);
return true;
} catch (luabridge::LuaException const& e) {
cerr << "LuaException:" << e.what () << endl;
@ -1216,18 +1207,9 @@ LuaCallback::lua_slot (std::string& name, std::string& script, ActionHook& ah, A
if (!lsi) {
return false;
}
args = LuaScripting::script_params (lsi, "action_params");
for (luabridge::Iterator i (static_cast<luabridge::LuaRef>(ref["args"])); !i.isNil (); ++i) {
if (!i.key ().isString ()) { assert(0); continue; }
std::string name = i.key ().cast<std::string> ();
std::string value = i.value ().cast<std::string> ();
for (LuaScriptParamList::const_iterator ii = args.begin(); ii != args.end(); ++ii) {
if ((*ii)->name == name) {
(*ii)->value = value;
break;
}
}
}
args = LuaScriptParams::script_params (lsi, "action_params");
luabridge::LuaRef rargs (ref["args"]);
LuaScriptParams::ref_to_params (args, &rargs);
return true;
} catch (luabridge::LuaException const& e) {
cerr << "LuaException:" << e.what () << endl;

View File

@ -8,6 +8,7 @@
#include "pbd/xml++.h"
#include "ardour/luascripting.h"
#include "ardour/lua_script_params.h"
#include "ardour/luabindings.h"
#include "ardour/session_handle.h"