diff --git a/BetterAddonList.lua b/BetterAddonList.lua index 3ffdb8e..53da82c 100644 --- a/BetterAddonList.lua +++ b/BetterAddonList.lua @@ -428,23 +428,17 @@ do end local function IsSetIncluded(data) - local name, setName = data[1], data[2] - return included[name] and included[name][setName] and true + local setA, setB = data[1], data[2] + return included[setA] and included[setA][setB] and true end - local function SetSetIncluded(data, _, menu) + local function SetSetIncluded(data) local value = not IsSetIncluded(data) - local name, setName = data[1], data[2] - if not included[name] then - included[name] = {} + local setA, setB = data[1], data[2] + if not included[setA] then + included[setA] = {} end - included[name][setName] = value or nil - end - - local function RemoveIncludedSet(data) - local name, setName = data[1], data[2] - included[setName][name] = nil - -- return MenuResponse.Refresh + included[setA][setB] = value or nil end local function GenerateSetsMenu(owner, root) @@ -483,27 +477,13 @@ do set:CreateDivider() - local includeSet = set:CreateButton(L["Include with another set"]) - includeSet:SetEnabled(#list > 2) -- have more than the current set and default - includeSet:CreateTitle(L["Include with another set"]) + local includeSets = set:CreateButton(L["Enabled with this set"]) + includeSets:SetEnabled(#list > 1) -- have more than the current set + -- includeSets:CreateTitle(L["Additionally enable addons from these sets"]) for _, name in ipairs(list) do if name ~= currentSet then - local s = includeSet:CreateCheckbox(name, IsSetIncluded, SetSetIncluded, {name, currentSet}) - if included[currentSet] and included[currentSet][name] then - s:SetEnabled(false) - end - end - end - - local removeIncludedSet = set:CreateButton(L["Remove an included set"]) - removeIncludedSet:SetEnabled(included[currentSet] and next(included[currentSet]) and true) - removeIncludedSet:CreateTitle(L["Remove an included set"]) - if included[currentSet] and next(included[currentSet]) then - for name in next, included[currentSet] do - removeIncludedSet:CreateButton(name, RemoveIncludedSet, {name, currentSet}) + includeSets:CreateCheckbox(name, IsSetIncluded, SetSetIncluded, {currentSet, name}) end - else - removeIncludedSet:CreateButton(NONE):SetEnabled(false) end set:CreateDivider() diff --git a/BetterAddonList_Classic.lua b/BetterAddonList_Classic.lua index 82425ce..00d888d 100644 --- a/BetterAddonList_Classic.lua +++ b/BetterAddonList_Classic.lua @@ -379,24 +379,17 @@ do end local function IsSetIncluded(data) - local name, setName = data[1], data[2] - return included[name] and included[name][setName] and true + local setA, setB = data[1], data[2] + return included[setA] and included[setA][setB] and true end - local function SetSetIncluded(data, _, menu) + local function SetSetIncluded(data) local value = not IsSetIncluded(data) - local name, setName = data[1], data[2] - if not included[name] then - included[name] = {} + local setA, setB = data[1], data[2] + if not included[setA] then + included[setA] = {} end - included[name][setName] = value or nil - end - - local function RemoveIncludedSet(data) - local name, setName = data[1], data[2] - included[setName][name] = nil - - return MenuResponse.Refresh + included[setA][setB] = value or nil end local function GenerateSetsMenu(owner, root) @@ -435,26 +428,15 @@ do set:CreateDivider() - local includeSet = set:CreateButton(L["Include with another set"]) - includeSet:SetEnabled(#list > 2) -- have more than the current set and default - includeSet:CreateTitle(L["Include with another set"]) + local includeSets = set:CreateButton(L["Enabled with this set"]) + includeSets:SetEnabled(#list > 1) -- have more than the current set + -- includeSets:CreateTitle(L["Additionally load these sets"]) for _, name in ipairs(list) do if name ~= currentSet then - includeSet:CreateCheckbox(name, IsSetIncluded, SetSetIncluded, {name, currentSet}) + includeSets:CreateCheckbox(name, IsSetIncluded, SetSetIncluded, { currentSet, name }) end end - local removeIncludedSet = set:CreateButton(L["Remove an included set"]) - removeIncludedSet:SetEnabled(included[currentSet] and next(included[currentSet]) and true) - removeIncludedSet:CreateTitle(L["Remove an included set"]) - if included[currentSet] and next(included[currentSet]) then - for name in next, included[currentSet] do - removeIncludedSet:CreateButton(name, RemoveIncludedSet, {name, currentSet}) - end - else - removeIncludedSet:CreateButton(NONE):SetEnabled(false) - end - set:CreateDivider() set:CreateButton(L["Enable addons from this set"], function(data) addon:EnableSet(data) end, currentSet) diff --git a/locales/enUS.lua b/locales/enUS.lua index fff8c96..566593c 100644 --- a/locales/enUS.lua +++ b/locales/enUS.lua @@ -11,7 +11,7 @@ local L = setmetatable({}, { }) ns.L = L -L["... and %d more"] = true +L["Additionally enable addons from these sets"] = true L["Addon List"] = true L["Create new set"] = true L["Delete"] = true @@ -24,13 +24,13 @@ L["Disabled all addons."] = true L["Enable addons from this set"] = true L["Enabled addons in set %q."] = true L["Enabled only addons in set %q."] = true +L["Enabled with this set"] = true L["Enter the name for the new set"] = true L["Enter the new name for %s"] = true L.FILTER_ENABLED = "Enabled" L.FILTER_DISABLED = "Disabled" L.FILTER_LOD = "Load On Demand" L.FILTER_PROTECTED = "Protected" -L["Include with another set"] = true L["Load"] = true L["Load out of date"] = true L["Memory: %.02f MB"] = true @@ -39,7 +39,6 @@ L["No set named %q."] = true L["Out of date addons are being disabled! They will not be able to load until their interface version is updated or \"Load out of date AddOns\" is checked."] = true L["Problem with protected addon %q (%s)"] = true L["Reload UI to load these addons."] = true -L["Remove an included set"] = true L["Rename"] = true L["Reset"] = true L["Reset addons to what was enabled at login."] = true