13
0

Remove unused ArdourUI code to add/remove Lua Session Scripts.

This commit is contained in:
Robin Gareus 2017-02-19 00:11:08 +01:00
parent 356a422531
commit b15bebd3c0
3 changed files with 0 additions and 94 deletions

View File

@ -4185,89 +4185,6 @@ ARDOUR_UI::add_route_dialog_finished (int r)
}
}
void
ARDOUR_UI::add_lua_script ()
{
if (!_session) {
return;
}
LuaScriptInfoPtr spi;
ScriptSelector ss ("Add Lua Session Script", LuaScriptInfo::Session);
switch (ss.run ()) {
case Gtk::RESPONSE_ACCEPT:
spi = ss.script();
break;
default:
return;
}
ss.hide();
std::string script = "";
try {
script = Glib::file_get_contents (spi->path);
} catch (Glib::FileError e) {
string msg = string_compose (_("Cannot read session script '%1': %2"), spi->path, e.what());
MessageDialog am (msg);
am.run ();
return;
}
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);
switch (spd.run ()) {
case Gtk::RESPONSE_ACCEPT:
break;
default:
return;
}
try {
_session->register_lua_function (spd.name(), script, lsp);
} catch (luabridge::LuaException const& e) {
string msg = string_compose (_("Session script '%1' instantiation failed: %2"), spd.name(), e.what ());
MessageDialog am (msg);
am.run ();
} catch (SessionException e) {
string msg = string_compose (_("Loading Session script '%1' failed: %2"), spd.name(), e.what ());
MessageDialog am (msg);
am.run ();
}
}
void
ARDOUR_UI::remove_lua_script ()
{
if (!_session) {
return;
}
if (_session->registered_lua_function_count () == 0) {
string msg = _("There are no active Lua session scripts present in this session.");
MessageDialog am (msg);
am.run ();
return;
}
std::vector<std::string> reg = _session->registered_lua_functions ();
SessionScriptManager sm ("Remove Lua Session Script", reg);
switch (sm.run ()) {
case Gtk::RESPONSE_ACCEPT:
break;
default:
return;
}
try {
_session->unregister_lua_function (sm.name());
} catch (luabridge::LuaException const& e) {
string msg = string_compose (_("Session script '%1' removal failed: %2"), sm.name(), e.what ());
MessageDialog am (msg);
am.run ();
}
}
void
ARDOUR_UI::stop_video_server (bool ask_confirm)
{

View File

@ -273,9 +273,6 @@ public:
void start_duplicate_routes ();
void add_lua_script ();
void remove_lua_script ();
void add_video (Gtk::Window* float_window);
void remove_video ();
void start_video_server_menu (Gtk::Window* float_window);

View File

@ -186,14 +186,6 @@ ARDOUR_UI::install_actions ()
act = global_actions.register_action (main_actions, X_("Scripting"), S_("Session|Scripting"));
ActionManager::session_sensitive_actions.push_back (act);
act = global_actions.register_action (main_actions, X_("AddLuaScript"), _("Add Lua Script..."),
sigc::mem_fun (*this, &ARDOUR_UI::add_lua_script));
ActionManager::session_sensitive_actions.push_back (act);
act = global_actions.register_action (main_actions, X_("RemoveLuaScript"), _("Remove Lua Script"),
sigc::mem_fun (*this, &ARDOUR_UI::remove_lua_script));
ActionManager::session_sensitive_actions.push_back (act);
act = global_actions.register_action (main_actions, X_("OpenVideo"), _("Open Video..."),
sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::add_video), (Gtk::Window*) 0));
ActionManager::session_sensitive_actions.push_back (act);