- build the config on demand (might break stuff, srsly)
- add options for configuring the modifier switching
This commit is contained in:
+103
-88
@@ -14,97 +14,106 @@ do
|
||||
end
|
||||
end
|
||||
|
||||
function Bartender4:SetupOptions()
|
||||
self.options = {
|
||||
type = "group",
|
||||
name = "Bartender4",
|
||||
icon = "Interface\\Icons\\INV_Drink_05",
|
||||
childGroups = "tree",
|
||||
plugins = {},
|
||||
args = {
|
||||
lock = {
|
||||
order = 1,
|
||||
type = "toggle",
|
||||
name = "Lock",
|
||||
desc = "Lock all bars.",
|
||||
get = function() return Bartender4.Locked end,
|
||||
set = function(info, value) Bartender4[value and "Lock" or "Unlock"](Bartender4) end,
|
||||
},
|
||||
buttonlock = {
|
||||
order = 2,
|
||||
type = "toggle",
|
||||
name = "Button Lock",
|
||||
desc = "Lock the buttons.",
|
||||
get = getFunc,
|
||||
set = setFunc,
|
||||
},
|
||||
bars = {
|
||||
order = 20,
|
||||
type = "group",
|
||||
name = "Bars",
|
||||
args = {
|
||||
range = {
|
||||
order = 1,
|
||||
name = "Out of Range Indicator",
|
||||
desc = "Configure how the Out of Range Indicator should display on the buttons.",
|
||||
type = "select",
|
||||
style = "dropdown",
|
||||
get = function()
|
||||
return Bartender4.db.profile.outofrange
|
||||
end,
|
||||
set = function(info, value)
|
||||
Bartender4.db.profile.outofrange = value
|
||||
Bartender4.Bar:ForAll("ApplyConfig")
|
||||
end,
|
||||
values = { none = "No Display", button = "Full Button Mode", hotkey = "Hotkey Mode" },
|
||||
},
|
||||
colors = {
|
||||
order = 3,
|
||||
type = "group",
|
||||
guiInline = true,
|
||||
name = "Colors",
|
||||
get = function(info)
|
||||
local color = Bartender4.db.profile.colors[info[#info]]
|
||||
return color.r, color.g, color.b
|
||||
end,
|
||||
set = function(info, r, g, b)
|
||||
local color = Bartender4.db.profile.colors[info[#info]]
|
||||
color.r, color.g, color.b = r, g, b
|
||||
Bartender4.Bar:ForAll("ApplyConfig")
|
||||
end,
|
||||
args = {
|
||||
range = {
|
||||
order = 1,
|
||||
type = "color",
|
||||
name = "Out of Range Indicator",
|
||||
desc = "Specify the Color of the Out of Range Indicator",
|
||||
},
|
||||
mana = {
|
||||
order = 2,
|
||||
type = "color",
|
||||
name = "Out of Mana Indicator",
|
||||
desc = "Specify the Color of the Out of Mana Indicator",
|
||||
local function getOptions()
|
||||
if not Bartender4.options then
|
||||
Bartender4.options = {
|
||||
type = "group",
|
||||
name = "Bartender4",
|
||||
icon = "Interface\\Icons\\INV_Drink_05",
|
||||
childGroups = "tree",
|
||||
plugins = {},
|
||||
args = {
|
||||
lock = {
|
||||
order = 1,
|
||||
type = "toggle",
|
||||
name = "Lock",
|
||||
desc = "Lock all bars.",
|
||||
get = function() return Bartender4.Locked end,
|
||||
set = function(info, value) Bartender4[value and "Lock" or "Unlock"](Bartender4) end,
|
||||
},
|
||||
buttonlock = {
|
||||
order = 2,
|
||||
type = "toggle",
|
||||
name = "Button Lock",
|
||||
desc = "Lock the buttons.",
|
||||
get = getFunc,
|
||||
set = setFunc,
|
||||
},
|
||||
bars = {
|
||||
order = 20,
|
||||
type = "group",
|
||||
name = "Bars",
|
||||
args = {
|
||||
range = {
|
||||
order = 1,
|
||||
name = "Out of Range Indicator",
|
||||
desc = "Configure how the Out of Range Indicator should display on the buttons.",
|
||||
type = "select",
|
||||
style = "dropdown",
|
||||
get = function()
|
||||
return Bartender4.db.profile.outofrange
|
||||
end,
|
||||
set = function(info, value)
|
||||
Bartender4.db.profile.outofrange = value
|
||||
Bartender4.Bar:ForAll("ApplyConfig")
|
||||
end,
|
||||
values = { none = "No Display", button = "Full Button Mode", hotkey = "Hotkey Mode" },
|
||||
},
|
||||
colors = {
|
||||
order = 3,
|
||||
type = "group",
|
||||
guiInline = true,
|
||||
name = "Colors",
|
||||
get = function(info)
|
||||
local color = Bartender4.db.profile.colors[info[#info]]
|
||||
return color.r, color.g, color.b
|
||||
end,
|
||||
set = function(info, r, g, b)
|
||||
local color = Bartender4.db.profile.colors[info[#info]]
|
||||
color.r, color.g, color.b = r, g, b
|
||||
Bartender4.Bar:ForAll("ApplyConfig")
|
||||
end,
|
||||
args = {
|
||||
range = {
|
||||
order = 1,
|
||||
type = "color",
|
||||
name = "Out of Range Indicator",
|
||||
desc = "Specify the Color of the Out of Range Indicator",
|
||||
},
|
||||
mana = {
|
||||
order = 2,
|
||||
type = "color",
|
||||
name = "Out of Mana Indicator",
|
||||
desc = "Specify the Color of the Out of Mana Indicator",
|
||||
},
|
||||
},
|
||||
},
|
||||
tooltip = {
|
||||
order = 2,
|
||||
name = "Button Tooltip",
|
||||
type = "select",
|
||||
desc = "Configure the Button Tooltip.",
|
||||
values = { ["disabled"] = "Disabled", ["nocombat"] = "Disabled in Combat", ["enabled"] = "Enabled" },
|
||||
get = function() return Bartender4.db.profile.tooltip end,
|
||||
set = function(info, value) Bartender4.db.profile.tooltip = value end,
|
||||
},
|
||||
},
|
||||
tooltip = {
|
||||
order = 2,
|
||||
name = "Button Tooltip",
|
||||
type = "select",
|
||||
desc = "Configure the Button Tooltip.",
|
||||
values = { ["disabled"] = "Disabled", ["nocombat"] = "Disabled in Combat", ["enabled"] = "Enabled" },
|
||||
get = function() return Bartender4.db.profile.tooltip end,
|
||||
set = function(info, value) Bartender4.db.profile.tooltip = value end,
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
self.options.plugins.profiles = { profiles = LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db) }
|
||||
|
||||
|
||||
LibStub("AceConfig-3.0"):RegisterOptionsTable("Bartender4", self.options, "bttest")
|
||||
}
|
||||
},
|
||||
}
|
||||
Bartender4.options.plugins.profiles = { profiles = LibStub("AceDBOptions-3.0"):GetOptionsTable(Bartender4.db) }
|
||||
for k,v in Bartender4:IterateModules() do
|
||||
if v.SetupOptions then
|
||||
v:SetupOptions()
|
||||
end
|
||||
end
|
||||
end
|
||||
return Bartender4.options
|
||||
end
|
||||
|
||||
function Bartender4:SetupOptions()
|
||||
LibStub("AceConfig-3.0"):RegisterOptionsTable("Bartender4", getOptions, "bttest")
|
||||
AceConfigDialog:SetDefaultSize("Bartender4", 680,525)
|
||||
local optFunc = function()
|
||||
if InCombatLockdown() then return end
|
||||
AceConfigDialog:Open("Bartender4")
|
||||
@@ -121,10 +130,16 @@ function Bartender4:SetupOptions()
|
||||
end
|
||||
|
||||
function Bartender4:RegisterModuleOptions(key, table)
|
||||
if not self.options then
|
||||
error("Options table has not been created yet, respond to the callback!", 2)
|
||||
end
|
||||
self.options.plugins[key] = { [key] = table }
|
||||
end
|
||||
|
||||
function Bartender4:RegisterBarOptions(id, table)
|
||||
if not self.options then
|
||||
error("Options table has not been created yet, respond to the callback!", 2)
|
||||
end
|
||||
self.options.args.bars.args[id] = table
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user