restructure configuration

This commit is contained in:
Hendrik Leppkes
2008-03-13 16:42:26 +00:00
parent 17f6d471f1
commit f472060b0a
8 changed files with 111 additions and 106 deletions
+5 -69
View File
@@ -46,8 +46,6 @@ local abdefaults = {
local defaults = { local defaults = {
profile = { profile = {
outofrange = "button",
colors = { range = { r = 0.8, g = 0.1, b = 0.1 }, mana = { r = 0.5, g = 0.5, b = 1.0 } },
actionbars = abdefaults, actionbars = abdefaults,
} }
} }
@@ -126,70 +124,7 @@ function BT4ActionBars:ForAllButtons(...)
end end
function BT4ActionBars:SetupOptions() function BT4ActionBars:SetupOptions()
self.options = { self.options = {}
order = 20,
type = "group",
-- cmdInline = true,
name = "Action Bars",
get = getFunc,
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 BT4ActionBars.db.profile.outofrange
end,
set = function(info, value)
BT4ActionBars.db.profile.outofrange = value
BT4ActionBars:ForAllButtons("UpdateUsable")
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 = BT4ActionBars.db.profile.colors[info[#info]]
return color.r, color.g, color.b
end,
set = function(info, r, g, b)
local color = BT4ActionBars.db.profile.colors[info[#info]]
color.r, color.g, color.b = r, g, b
BT4ActionBars:ForAllButtons("UpdateUsable")
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,
},
},
}
Bartender4:RegisterModuleOptions("actionbars", self.options)
self.disabledoptions = { self.disabledoptions = {
general = { general = {
@@ -212,8 +147,8 @@ end
function BT4ActionBars:CreateBarOption(id, options) function BT4ActionBars:CreateBarOption(id, options)
id = tostring(id) id = tostring(id)
if not self.options.args[id] then if not self.options[id] then
self.options.args[id] = { self.options[id] = {
order = 10 + tonumber(id), order = 10 + tonumber(id),
type = "group", type = "group",
name = ("Bar %s"):format(id), name = ("Bar %s"):format(id),
@@ -221,7 +156,8 @@ function BT4ActionBars:CreateBarOption(id, options)
childGroups = "tab", childGroups = "tab",
} }
end end
self.options.args[id].args = options self.options[id].args = options
Bartender4:RegisterBarOptions(id, self.options[id])
end end
function BT4ActionBars:ReassignBindings() function BT4ActionBars:ReassignBindings()
+2
View File
@@ -6,6 +6,8 @@ local defaults = {
profile = { profile = {
tooltip = "enabled", tooltip = "enabled",
buttonlock = false, buttonlock = false,
outofrange = "button",
colors = { range = { r = 0.8, g = 0.1, b = 0.1 }, mana = { r = 0.5, g = 0.5, b = 1.0 } },
} }
} }
+2 -2
View File
@@ -325,8 +325,8 @@ function Button:UpdateUsable(force)
local icon, hotkey = self.icon, self.hotkey local icon, hotkey = self.icon, self.hotkey
if force or not oor then if force or not oor then
icon.state, hotkey.state = 1, 1 icon.state, hotkey.state = 1, 1
oor = self.settings.profile.outofrange oor = Bartender4.db.profile.outofrange
oorcolor, oomcolor = self.settings.profile.colors.range, self.settings.profile.colors.mana oorcolor, oomcolor = Bartender4.db.profile.colors.range, Bartender4.db.profile.colors.mana
end end
if oor == "button" and self.outOfRange then if oor == "button" and self.outOfRange then
+1 -1
View File
@@ -46,7 +46,7 @@ function Bartender4.ButtonStyle.ApplyStyle(button, styleName)
if cy then if cy then
style = styledata.default style = styledata.default
if button.overlay then if button.overlay and button.overlay.type ~= "cy" then
button.overlay:Hide() button.overlay:Hide()
end end
button.overlay = _G[button:GetName() .. "Overlay"] button.overlay = _G[button:GetName() .. "Overlay"]
+11 -10
View File
@@ -70,7 +70,7 @@ end
function MicroMenuMod:SetupOptions() function MicroMenuMod:SetupOptions()
if not self.options then if not self.options then
self.options = Bar:GetOptionObject() self.optionobject = Bar:GetOptionObject()
local enabled = { local enabled = {
type = "toggle", type = "toggle",
order = 1, order = 1,
@@ -80,7 +80,7 @@ function MicroMenuMod:SetupOptions()
set = "ToggleModule", set = "ToggleModule",
handler = self, handler = self,
} }
self.options:AddElement("general", "enabled", enabled) self.optionobject:AddElement("general", "enabled", enabled)
self.disabledoptions = { self.disabledoptions = {
general = { general = {
@@ -93,15 +93,16 @@ function MicroMenuMod:SetupOptions()
} }
} }
} }
ActionBars.options.args["MicroMenu"] = { self.options = {
order = 30, order = 30,
type = "group", type = "group",
name = "Micro Menu", name = "Micro Menu",
desc = "Configure the Micro Menu", desc = "Configure the Micro Menu",
childGroups = "tab", childGroups = "tab",
} }
Bartender4:RegisterBarOptions("MicroMenu", self.options)
end end
ActionBars.options.args["MicroMenu"].args = self:IsEnabled() and self.options.table or self.disabledoptions self.options.args = self:IsEnabled() and self.optionobject.table or self.disabledoptions
end end
function MicroMenuBar:ApplyConfig(config) function MicroMenuBar:ApplyConfig(config)
+64
View File
@@ -38,6 +38,66 @@ function Bartender4:SetupOptions()
get = getFunc, get = getFunc,
set = setFunc, 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,
},
},
}
}, },
} }
@@ -64,6 +124,10 @@ function Bartender4:RegisterModuleOptions(key, table)
self.options.plugins[key] = { [key] = table } self.options.plugins[key] = { [key] = table }
end end
function Bartender4:RegisterBarOptions(id, table)
self.options.args.bars.args[id] = table
end
local optionParent = {} local optionParent = {}
function optionParent:NewCategory(category, data) function optionParent:NewCategory(category, data)
self.table[category] = data self.table[category] = data
+12 -10
View File
@@ -112,7 +112,7 @@ end
function PetBarMod:SetupOptions() function PetBarMod:SetupOptions()
if not self.options then if not self.options then
self.options = Bartender4.ButtonBar.prototype:GetOptionObject() self.optionobject = Bartender4.ButtonBar.prototype:GetOptionObject()
local enabled = { local enabled = {
type = "toggle", type = "toggle",
@@ -123,7 +123,7 @@ function PetBarMod:SetupOptions()
set = "ToggleModule", set = "ToggleModule",
handler = self, handler = self,
} }
self.options:AddElement("general", "enabled", enabled) self.optionobject:AddElement("general", "enabled", enabled)
self.disabledoptions = { self.disabledoptions = {
general = { general = {
@@ -136,15 +136,17 @@ function PetBarMod:SetupOptions()
} }
} }
} }
ActionBars.options.args["Pet"] = {
order = 30, self.options = {
type = "group", order = 30,
name = "Pet Bar", type = "group",
desc = "Configure the Pet Bar", name = "Pet Bar",
childGroups = "tab", desc = "Configure the Pet Bar",
} childGroups = "tab",
}
Bartender4:RegisterBarOptions("Pet", self.options)
end end
ActionBars.options.args["Pet"].args = self:IsEnabled() and self.options.table or self.disabledoptions self.options.args = self:IsEnabled() and self.optionobject.table or self.disabledoptions
end end
function PetBarMod:ReassignBindings() function PetBarMod:ReassignBindings()
+14 -14
View File
@@ -54,7 +54,7 @@ end
function StanceBarMod:SetupOptions() function StanceBarMod:SetupOptions()
if not self.options then if not self.options then
self.options = Bartender4.ButtonBar.prototype:GetOptionObject() self.optionobject = Bartender4.ButtonBar.prototype:GetOptionObject()
local enabled = { local enabled = {
type = "toggle", type = "toggle",
@@ -65,7 +65,7 @@ function StanceBarMod:SetupOptions()
set = "ToggleModule", set = "ToggleModule",
handler = self, handler = self,
} }
self.options:AddElement("general", "enabled", enabled) self.optionobject:AddElement("general", "enabled", enabled)
self.disabledoptions = { self.disabledoptions = {
general = { general = {
@@ -79,17 +79,17 @@ function StanceBarMod:SetupOptions()
} }
} }
ActionBars.options.args["Stance"] = { self.options = {
order = 30, order = 30,
type = "group", type = "group",
name = "Stance Bar", name = "Stance Bar",
desc = "Configure the Stance Bar", desc = "Configure the Stance Bar",
childGroups = "tab", childGroups = "tab",
disabled = function(info) return GetNumShapeshiftForms() == 0 end, disabled = function(info) return GetNumShapeshiftForms() == 0 end,
} }
Bartender4:RegisterBarOptions("Stance", self.options)
end end
self.options.args = self:IsEnabled() and self.optionobject.table or self.disabledoptions
ActionBars.options.args["Stance"].args = self:IsEnabled() and self.options.table or self.disabledoptions
end end
function StanceBarMod:ApplyConfig() function StanceBarMod:ApplyConfig()
@@ -126,9 +126,9 @@ function StanceButtonPrototype:Update()
CooldownFrame_SetTimer(self.cooldown, start, duration, enable) CooldownFrame_SetTimer(self.cooldown, start, duration, enable)
if ( isActive ) then if ( isActive ) then
self:SetChecked(1); self:SetChecked(1)
else else
self:SetChecked(0); self:SetChecked(0)
end end
if ( isCastable ) then if ( isCastable ) then