config: split modules into categories
This commit is contained in:
+55
-19
@@ -79,21 +79,65 @@ end)
|
||||
settings.load = function(self)
|
||||
settings.entries = settings.entries or {}
|
||||
local expansion = ShaguTweaks:GetExpansion()
|
||||
local entry = 1
|
||||
|
||||
-- sort all configs into categories
|
||||
local gui = {}
|
||||
for title, module in pairs(ShaguTweaks.mods) do
|
||||
if module.expansions[expansion] or ShaguTweaks.debug then
|
||||
if not settings.entries[entry] then
|
||||
settings.entries[entry] = CreateFrame("CheckButton", "AdvancedSettingsGUI" .. entry, settings, "OptionsCheckButtonTemplate")
|
||||
if module.expansions[expansion] then
|
||||
local category = module.category or "General"
|
||||
gui[category] = gui[category] or {}
|
||||
gui[category][title] = module
|
||||
end
|
||||
end
|
||||
|
||||
local yoff = 25
|
||||
local entrysize = 25
|
||||
for category, entries in ShaguTweaks.spairs(gui) do
|
||||
local entry, spacing = 1, 20
|
||||
yoff = yoff + 12
|
||||
|
||||
-- add category background
|
||||
settings.category = settings.category or {}
|
||||
settings.category[category] = settings.category[category] or CreateFrame("Frame", nil, settings)
|
||||
settings.category[category]:SetPoint("TOPLEFT", settings, "TOPLEFT", spacing, -yoff)
|
||||
settings.category[category]:SetBackdrop({
|
||||
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
|
||||
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
|
||||
tile = true, tileSize = 8, edgeSize = 16,
|
||||
insets = { left = 3, right = 3, top = 3, bottom = 3 }
|
||||
})
|
||||
|
||||
if ShaguTweaks.DarkMode then
|
||||
settings.category[category]:SetBackdropColor(.1,.1,.1,1)
|
||||
settings.category[category]:SetBackdropBorderColor(.2,.2,.2,1)
|
||||
else
|
||||
settings.category[category]:SetBackdropColor(.2,.2,.2,1)
|
||||
settings.category[category]:SetBackdropBorderColor(.5,.5,.5,1)
|
||||
end
|
||||
|
||||
-- add category title
|
||||
settings.category[category].text = settings.category[category].text or settings.category[category]:CreateFontString(nil, "HIGH", "GameFontHighlightSmall")
|
||||
settings.category[category].text:SetText(category)
|
||||
settings.category[category].text:SetPoint("TOPLEFT", 5, 10)
|
||||
yoff = yoff + spacing/2
|
||||
|
||||
for title, module in ShaguTweaks.spairs(entries) do
|
||||
if not settings.entries[title] then
|
||||
settings.entries[title] = CreateFrame("CheckButton", "AdvancedSettingsGUI" .. title, settings.category[category], "OptionsCheckButtonTemplate")
|
||||
settings.entries[title]:SetHeight(24)
|
||||
settings.entries[title]:SetWidth(24)
|
||||
end
|
||||
|
||||
local button = _G["AdvancedSettingsGUI" .. entry]
|
||||
local text = _G["AdvancedSettingsGUI" .. entry .. "Text"]
|
||||
local button = _G["AdvancedSettingsGUI" .. title]
|
||||
local text = _G["AdvancedSettingsGUI" .. title .. "Text"]
|
||||
|
||||
button.title = title
|
||||
button:SetChecked(current_config[title] == 1 and true or nil)
|
||||
|
||||
button:SetPoint("TOPLEFT", settings, "TOPLEFT", mod(entry, 2) == 1 and 17 or 17+200, math.ceil(entry/2)*-30)
|
||||
button:SetPoint("TOPLEFT", settings.category[category], "TOPLEFT", mod(entry, 2) == 1 and 17 or 17+200, math.ceil(entry/2-1)*-entrysize-spacing/2)
|
||||
|
||||
-- add another yoff row
|
||||
if mod(entry, 2) == 1 then yoff = yoff + entrysize end
|
||||
|
||||
local description = module.description
|
||||
button:SetScript("OnEnter", function()
|
||||
@@ -115,21 +159,13 @@ settings.load = function(self)
|
||||
end)
|
||||
text:SetText(title)
|
||||
entry = entry + 1
|
||||
|
||||
-- show unavailable modules in debug mode
|
||||
if ShaguTweaks.debug then
|
||||
if module.expansions[expansion] then
|
||||
button:Enable()
|
||||
text:SetTextColor(1,.8,0,1)
|
||||
elseif not module.expansions[expansion] then
|
||||
button:Disable()
|
||||
text:SetTextColor(.5,.5,.5,.5)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
yoff = yoff + spacing/2
|
||||
settings.category[category]:SetPoint("BOTTOMRIGHT", settings, "TOPRIGHT", -spacing, -yoff)
|
||||
end
|
||||
|
||||
settings:SetHeight(80 + math.floor(entry/2)*30)
|
||||
settings:SetHeight(yoff + 40)
|
||||
end
|
||||
|
||||
settings.defaults = function()
|
||||
|
||||
@@ -5,6 +5,7 @@ local module = ShaguTweaks:register({
|
||||
title = "Blue Shaman Class Colors",
|
||||
description = "Changes the class color code of shamans to blue, as known from TBC+.",
|
||||
expansions = { ["vanilla"] = true, ["tbc"] = nil },
|
||||
category = "Social & Chat",
|
||||
enabled = true,
|
||||
})
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ local module = ShaguTweaks:register({
|
||||
title = "Chat Hyperlinks",
|
||||
description = "Copy website URLs from the chat, transforms CLINKs into real items and handles quest links.",
|
||||
expansions = { ["vanilla"] = true, ["tbc"] = true },
|
||||
category = "Social & Chat",
|
||||
enabled = true,
|
||||
})
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ local module = ShaguTweaks:register({
|
||||
title = "Chat Tweaks",
|
||||
description = "Allows to scroll using the mouse wheel, enables sticky chat channels and repeats message on arrow up.",
|
||||
expansions = { ["vanilla"] = true, ["tbc"] = true },
|
||||
category = "Social & Chat",
|
||||
enabled = true,
|
||||
})
|
||||
|
||||
|
||||
@@ -192,6 +192,8 @@ module.enable = function(self)
|
||||
DarkenFrame(DropDownList2)
|
||||
DarkenFrame(DropDownList3)
|
||||
|
||||
ShaguTweaks.DarkMode = true
|
||||
|
||||
for _, button in pairs({ MinimapZoomOut, MinimapZoomIn }) do
|
||||
for _, func in pairs({ "GetNormalTexture", "GetDisabledTexture", "GetPushedTexture" }) do
|
||||
if button[func] then
|
||||
|
||||
@@ -7,6 +7,7 @@ local module = ShaguTweaks:register({
|
||||
title = "Real Health Numbers",
|
||||
description = "Estimates health numbers, and shows numbers on player, pet and target unit frames.",
|
||||
expansions = { ["vanilla"] = true, ["tbc"] = true },
|
||||
category = "Unit Frames",
|
||||
enabled = true,
|
||||
})
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ local module = ShaguTweaks:register({
|
||||
title = "Item Rarity Borders",
|
||||
description = "Show item rarity as the border color on bags, bank, character and inspect frames.",
|
||||
expansions = { ["vanilla"] = true, ["tbc"] = true },
|
||||
category = "Tooltip & Items",
|
||||
enabled = true,
|
||||
})
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ local module = ShaguTweaks:register({
|
||||
title = "MiniMap Clock",
|
||||
description = "Adds a small 24h clock to the mini map.",
|
||||
expansions = { ["vanilla"] = true, ["tbc"] = nil },
|
||||
category = "World & MiniMap",
|
||||
enabled = nil,
|
||||
})
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ local module = ShaguTweaks:register({
|
||||
title = "MiniMap Square",
|
||||
description = "Draw the mini map in a squared shape instead of a round one.",
|
||||
expansions = { ["vanilla"] = true, ["tbc"] = true },
|
||||
category = "World & MiniMap",
|
||||
enabled = nil,
|
||||
})
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ local module = ShaguTweaks:register({
|
||||
title = "MiniMap Tweaks",
|
||||
description = "Hides unnecessary mini map buttons and allows to zoom using the mouse wheel.",
|
||||
expansions = { ["vanilla"] = true, ["tbc"] = true },
|
||||
category = "World & MiniMap",
|
||||
enabled = nil,
|
||||
})
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ local module = ShaguTweaks:register({
|
||||
title = "Movable Unit Frames",
|
||||
description = "Player and Target unit frames can be moved while <Shift> and <Ctrl> are pressed together.",
|
||||
expansions = { ["vanilla"] = true, ["tbc"] = true },
|
||||
category = "Unit Frames",
|
||||
enabled = nil,
|
||||
})
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ local module = ShaguTweaks:register({
|
||||
title = "Sell Junk",
|
||||
description = "Adds a “Sell Junk” button to every merchant window, that sells all grey items.",
|
||||
expansions = { ["vanilla"] = true, ["tbc"] = true },
|
||||
category = "Tooltip & Items",
|
||||
enabled = true,
|
||||
})
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ local module = ShaguTweaks:register({
|
||||
title = "Social Colors",
|
||||
description = "Show class colors in Who, Guild, Friends and Chat.",
|
||||
expansions = { ["vanilla"] = true, ["tbc"] = true },
|
||||
category = "Social & Chat",
|
||||
enabled = nil,
|
||||
})
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ local module = ShaguTweaks:register({
|
||||
title = "Enemy Castbars",
|
||||
description = "Shows an enemy castbar on target unit frame.",
|
||||
expansions = { ["vanilla"] = true, ["tbc"] = nil },
|
||||
category = "Unit Frames",
|
||||
enabled = true,
|
||||
})
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ local module = ShaguTweaks:register({
|
||||
title = "Debuff Timer",
|
||||
description = "Show debuff durations on the target unit frame.",
|
||||
expansions = { ["vanilla"] = true, ["tbc"] = nil },
|
||||
category = "Unit Frames",
|
||||
enabled = true,
|
||||
})
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ local module = ShaguTweaks:register({
|
||||
title = "Tooltip Details",
|
||||
description = "Display health, class color, guild name, guild rank and current target on unit tooltips.",
|
||||
expansions = { ["vanilla"] = true, ["tbc"] = true },
|
||||
category = "Tooltip & Items",
|
||||
enabled = nil,
|
||||
})
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ local module = ShaguTweaks:register({
|
||||
title = "Unit Frame Class Colors",
|
||||
description = "Adds class colors to the player, target and party unit frames.",
|
||||
expansions = { ["vanilla"] = true, ["tbc"] = true },
|
||||
category = "Unit Frames",
|
||||
enabled = nil,
|
||||
})
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ local module = ShaguTweaks:register({
|
||||
title = "Vendor Values",
|
||||
description = "Shows the vendor sell values on all item tooltips.",
|
||||
expansions = { ["vanilla"] = true, ["tbc"] = true },
|
||||
category = "Tooltip & Items",
|
||||
enabled = true,
|
||||
})
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ local module = ShaguTweaks:register({
|
||||
title = "WorldMap Coordinates",
|
||||
description = "Adds coordinates to the bottom of the World Map.",
|
||||
expansions = { ["vanilla"] = true, ["tbc"] = true },
|
||||
category = "World & MiniMap",
|
||||
enabled = nil,
|
||||
})
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ local module = ShaguTweaks:register({
|
||||
title = "WorldMap Window",
|
||||
description = "Turns the world map into a movable window. The map can be scaled with <Ctrl> + Mousewheel.",
|
||||
expansions = { ["vanilla"] = true, ["tbc"] = true },
|
||||
category = "World & MiniMap",
|
||||
enabled = true,
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user