edit dialog formatting
[ardour.git] / scripts / mixer_settings_store.lua
index 4b0d7ca46f45f4230a1afb1b308a92cfca882598..489ae678944c18ffe13e17f5aac61ab5fd507fb2 100644 (file)
@@ -30,6 +30,19 @@ function factory () return function ()
                end return ok, err
        end
 
+       function whoami()
+               if not pcall(function() local first_check = Session:get_mixbus(0) end) then
+                       return "Ardour"
+               else
+                       local second_check = Session:get_mixbus(11)
+                       if second_check:isnil() then
+                               return "Mixbus"
+                       else
+                               return "32C"
+                       end
+               end
+       end
+
        function isdir(path)
                return exists(path.."/")
        end
@@ -40,7 +53,7 @@ function factory () return function ()
                if not(isdir(global_path)) then
                        global_ok, _, _ = os.execute('mkdir '.. global_path)
                        if global_ok == 0 then
-                               local default_file = ARDOUR.LuaAPI.build_filename(global_path, 'factory_default.lua')
+                               local default_file = ARDOUR.LuaAPI.build_filename(global_path, 'FactoryDefault-'..whoami()..'.lua')
                                local file = io.open(default_file, "w")
                                file:write("")
                                file:close()
@@ -300,19 +313,19 @@ function factory () return function ()
        end
 
        local store_options = {
-               { type = "label",    col=0, colspan=1, align="left", title = "Settings name:" },
-               { type = "entry",    col=1, colspan=1, align="right" , key = "filename", default = Session:name(), title=""},
-               { type = "label",    col=0, colspan=1, align="left", title = "Selected Tracks Only:" },
-               { type = "checkbox", col=1, colspan=1, align="right",  key = "selected", default = false, title = ""},
-               { type = "hseparator", title="", col=0, colspan = 3},
-               { type = "label",    col=0, colspan=1, align="left", title = "Store Settings:" },
+               { type = "label",    col=0, colspan=1, align="right", title = "Settings name:" },
+               { type = "entry",    col=1, colspan=1, align="left" , key = "filename", default = Session:name(), title=""},
+               { type = "label",    col=0, colspan=1, align="right", title = "Store Settings:" },
                {
-                       type = "radio",  col=1, colspan=3, align="right", key = "store-dir", title = "", values =
+                       type = "radio",  col=1, colspan=3, align="left", key = "store-dir", title = "", values =
                        {
                                ['Global (accessible from any session)'] = 1, ['Locally (this session only)'] = 2
                        },
                        default = 'Locally (this session only)'
                },
+               { type = "hseparator", title="", col=0, colspan = 3},
+               { type = "label",    col=0, colspan=1, align="right", title = "Selected Tracks Only:" },
+               { type = "checkbox", col=1, colspan=1, align="left",  key = "selected", default = false, title = ""},
                --{ type = "label", col=0, colspan=2, align="left", title = ''},
                --{ type = "label", col=0, colspan=2, align="left", title = "Global Path: " .. global_path},
                --{ type = "label", col=0, colspan=2, align="left", title = "Local Path: "  .. local_path},
@@ -327,13 +340,13 @@ function factory () return function ()
 
                local filename = rv['filename']
                if rv['store-dir'] == 1 then
-                       local store_path = ARDOUR.LuaAPI.build_filename(global_path, filename .. '.lua')
+                       local store_path = ARDOUR.LuaAPI.build_filename(global_path, string.format("%s-%s.lua", filename, whoami()))
                        local selected = rv['selected']
                        mark_tracks(selected, store_path)
                end
 
                if rv['store-dir'] == 2 then
-                       local store_path = ARDOUR.LuaAPI.build_filename(local_path, filename .. '.lua')
+                       local store_path = ARDOUR.LuaAPI.build_filename(local_path, string.format("%s-%s.lua", filename, whoami()))
                        print(store_path)
                        local selected = rv['selected']
                        mark_tracks(selected, store_path)