13
0

Connect Script Manager "Edit" -> Lua Scripting Window

This commit is contained in:
Robin Gareus 2017-02-19 01:27:16 +01:00
parent ceb7884380
commit 05149f9bc5
3 changed files with 15 additions and 15 deletions

View File

@ -24,6 +24,7 @@
#include "LuaBridge/LuaBridge.h"
#include "lua_script_manager.h"
#include "luawindow.h"
#include "script_selector.h"
#include "pbd/i18n.h"
@ -226,7 +227,7 @@ LuaScriptManager::action_selection_changed ()
if (row && row[_a_model.enabled]) {
_a_del_button.set_sensitive (true);
_a_edit_button.set_sensitive (false); // TODO
_a_edit_button.set_sensitive (true);
_a_call_button.set_sensitive (true);
} else {
_a_del_button.set_sensitive (false);
@ -276,20 +277,7 @@ LuaScriptManager::edit_action_btn_clicked ()
if (!li->lua_action (id, name, script, args)) {
return;
}
// TODO text-editor window, update script directly
if (!LuaScripting::try_compile (script, args)) {
// compilation failed, keep editing
return;
}
if (li->set_lua_action (id, name, script, args)) {
// OK
} else {
// load failed, keep editing..
}
action_selection_changed ();
LuaWindow::instance()->edit_script (name, script);
}
void

View File

@ -322,6 +322,17 @@ LuaWindow::clear_output ()
tb->set_text ("");
}
void
LuaWindow::edit_script (const std::string& name, const std::string& script)
{
ScriptBuffer* sb = new LuaWindow::ScriptBuffer (name);
sb->script = script;
script_buffers.push_back (ScriptBufferPtr (sb));
script_selection_changed (script_buffers.back ());
refresh_scriptlist ();
show_window ();
}
void
LuaWindow::new_script ()
{

View File

@ -53,6 +53,7 @@ class LuaWindow :
void show_window ();
bool hide_window (GdkEventAny *ev);
void edit_script (const std::string&, const std::string&);
void set_session (ARDOUR::Session* s);