set owner or disk-i/o processors
[ardour.git] / libs / ardour / luascripting.cc
index 31437fcf6eaae5a9c1e47013432db4646dee987e..5d0b45aaf5506888fe3bc126f11a37c485211846 100644 (file)
@@ -158,12 +158,9 @@ LuaScripting::scan ()
                        case LuaScriptInfo::Snippet:
                                _sl_snippet->push_back(lsi);
                                break;
-                       case LuaScriptInfo::SessionSetup:
+                       case LuaScriptInfo::SessionInit:
                                _sl_setup->push_back(lsi);
                                break;
-                       case LuaScriptInfo::TrackSetup:
-                               _sl_tracks->push_back(lsi);
-                               break;
                        default:
                                break;
                }
@@ -286,6 +283,26 @@ LuaScripting::scan_script (const std::string &fn, const std::string &sc)
                if (key == "description") { lsi->description = val; }
                if (key == "category") { lsi->category = val; }
        }
+
+
+       if (type == LuaScriptInfo::EditorAction) {
+
+               luabridge::LuaRef lua_rs = luabridge::getGlobal (L, "route_setup");
+               if (lua_rs.isFunction ()) {
+                       lsi->subtype |= LuaScriptInfo::RouteSetup;
+               }
+
+               luabridge::LuaRef lua_ss = luabridge::getGlobal (L, "session_setup");
+               if (lua_ss.isFunction ()) {
+                       try {
+                               if (lua_ss () == true) {
+                                       lsi->subtype |= LuaScriptInfo::SessionSetup;
+                               }
+                       } catch (...) { }
+               }
+
+       }
+
        return lsi;
 }
 
@@ -312,12 +329,9 @@ LuaScripting::scripts (LuaScriptInfo::ScriptType type) {
                case LuaScriptInfo::Snippet:
                        return *_sl_snippet;
                        break;
-               case LuaScriptInfo::SessionSetup:
+               case LuaScriptInfo::SessionInit:
                        return *_sl_setup;
                        break;
-               case LuaScriptInfo::TrackSetup:
-                       return *_sl_tracks;
-                       break;
                default:
                        break;
        }
@@ -333,8 +347,7 @@ LuaScriptInfo::type2str (const ScriptType t) {
                case LuaScriptInfo::EditorHook: return "EditorHook";
                case LuaScriptInfo::EditorAction: return "EditorAction";
                case LuaScriptInfo::Snippet: return "Snippet";
-               case LuaScriptInfo::SessionSetup: return "SessionSetup";
-               case LuaScriptInfo::TrackSetup: return "TrackSetup";
+               case LuaScriptInfo::SessionInit: return "SessionInit";
                default: return "Invalid";
        }
 }
@@ -347,8 +360,7 @@ LuaScriptInfo::str2type (const std::string& str) {
        if (!strcasecmp (type, "EditorHook")) {return LuaScriptInfo::EditorHook;}
        if (!strcasecmp (type, "EditorAction")) {return LuaScriptInfo::EditorAction;}
        if (!strcasecmp (type, "Snippet")) {return LuaScriptInfo::Snippet;}
-       if (!strcasecmp (type, "SessionSetup")) {return LuaScriptInfo::SessionSetup;}
-       if (!strcasecmp (type, "TrackSetup")) {return LuaScriptInfo::TrackSetup;}
+       if (!strcasecmp (type, "SessionInit")) {return LuaScriptInfo::SessionInit;}
        return LuaScriptInfo::Invalid;
 }
 
@@ -375,7 +387,7 @@ LuaScriptParams::script_params (const std::string& s, const std::string &pname,
                } else {
                        lua.do_command (s);
                }
-       } catch (luabridge::LuaException const& e) {
+       } catch (...) {
                return rv;
        }
 
@@ -472,7 +484,7 @@ LuaScripting::try_compile (const std::string& script, const LuaScriptParamList&
                cerr << e.what() << "\n";
 #endif
                lua_print (e.what());
-       }
+       } catch (...) { }
 
        return false;
 }
@@ -503,7 +515,7 @@ LuaScripting::get_factory_bytecode (const std::string& script, const std::string
                if (lua_factory.isFunction()) {
                        return (lua_dump(lua_factory)).cast<std::string> ();
                }
-       } catch (luabridge::LuaException const& e) { }
+       } catch (...) { }
        return "";
 }