Connect Script Manager "Edit" -> Lua Scripting Window
authorRobin Gareus <robin@gareus.org>
Sun, 19 Feb 2017 00:27:16 +0000 (01:27 +0100)
committerRobin Gareus <robin@gareus.org>
Sun, 19 Feb 2017 00:29:08 +0000 (01:29 +0100)
gtk2_ardour/lua_script_manager.cc
gtk2_ardour/luawindow.cc
gtk2_ardour/luawindow.h

index 0e8785d5ce4eaf7fdac89e9fc6226e37be1ac3dc..e7911e657588b3ea316579a5b3fb85d4b969a343 100644 (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
index 04e2e8c2405f27d0f2d06efd74bee0f0cac4c364..c5df8599b123dbb13dca1645317c0292f9afbd21 100644 (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 ()
 {
index 38f688d4ad8b2e5bbc521b22137c89cec862dc3b..33d7fd151755ae7e237b7a7e46cb206a5000c8f1 100644 (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);