use new action map API instead of ActionManager::get_action
[ardour.git] / gtk2_ardour / editor_actions.cc
index b1ed4365b1e67315027e72408744008ad3fbaec1..befe85934d45d295116986cf50ce588d8e8ee7b2 100644 (file)
@@ -219,9 +219,6 @@ Editor::register_actions ()
        reg_sens (editor_actions, "playhead-to-range-end", _("Playhead to Range End"), sigc::bind (sigc::mem_fun(*this, &Editor::cursor_to_selection_end), playhead_cursor));
 
        reg_sens (editor_actions, "select-all-objects", _("Select All Objects"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_objects), Selection::Set));
-       reg_sens (editor_actions, "select-all-tracks", _("Select All Tracks"), sigc::mem_fun(*this, &Editor::select_all_tracks));
-       reg_sens (editor_actions, "deselect-all", _("Deselect All"), sigc::mem_fun(*this, &Editor::deselect_all));
-       reg_sens (editor_actions, "invert-selection", _("Invert Selection"), sigc::mem_fun(*this, &Editor::invert_selection));
 
        reg_sens (editor_actions, "select-loop-range", _("Set Range to Loop Range"), sigc::mem_fun(*this, &Editor::set_selection_from_loop));
        reg_sens (editor_actions, "select-punch-range", _("Set Range to Punch Range"), sigc::mem_fun(*this, &Editor::set_selection_from_punch));
@@ -473,7 +470,7 @@ Editor::register_actions ()
 
        myactions.register_action (editor_actions, X_("cycle-zoom-focus"), _("Next Zoom Focus"), sigc::mem_fun (*this, &Editor::cycle_zoom_focus));
 
-       for (int i = 1; i <= 9; ++i) {
+       for (int i = 1; i <= MAX_LUA_ACTION_SCRIPTS; ++i) {
                string const a = string_compose (X_("script-action-%1"), i);
                string const n = string_compose (_("Unset #%1"), i);
                act = myactions.register_action (editor_actions, a.c_str(), n.c_str(), sigc::bind (sigc::mem_fun (*this, &Editor::trigger_script), i - 1));
@@ -758,13 +755,15 @@ Editor::trigger_script_by_name (const std::string script_name)
                        script_path = (*s)->path;
 
                        if (!Glib::file_test (script_path, Glib::FILE_TEST_EXISTS | Glib::FILE_TEST_IS_REGULAR)) {
+#ifndef NDEBUG
                                cerr << "Lua Script action: path to " << script_path << " does not appear to be valid" << endl;
+#endif
                                return;
                        }
 
                        LuaState lua;
-                       lua.Print.connect (&_lua_print);  //ToDo
-                       lua.sandbox (true);
+                       lua.Print.connect (&_lua_print);
+                       lua.sandbox (false);
                        lua_State* L = lua.getState();
                        LuaInstance::register_classes (L);
                        LuaBindings::set_session (L, _session);
@@ -774,9 +773,6 @@ Editor::trigger_script_by_name (const std::string script_name)
                        lua.do_file (script_path);
                        luabridge::LuaRef args (luabridge::newTable (L));
 
-                       //ToDo:  args?
-                       //      args["how_many"]   = count;
-
                        try {
                                luabridge::LuaRef fn = luabridge::getGlobal (L, "factory");
                                if (fn.isFunction()) {
@@ -787,12 +783,12 @@ Editor::trigger_script_by_name (const std::string script_name)
                        } catch (...) {
                                cerr << "Lua script failed: " << script_path << endl;
                        }
-                               
-                       continue;  //script found; we're done
+                       return;
                }
        }
-
+#ifndef NDEBUG
        cerr << "Lua script was not found: " << script_name << endl;
+#endif
 }
 
 void
@@ -1489,8 +1485,6 @@ Editor::parameter_changed (std::string p)
                                tact->set_active (s);
                        }
                }
-       } else if (p == "velocity-display") {
-               _track_canvas->request_redraw (_track_canvas->visible_area());
        }
 }