restructure configuration
This commit is contained in:
+5
-69
@@ -46,8 +46,6 @@ local abdefaults = {
|
||||
|
||||
local defaults = {
|
||||
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,
|
||||
}
|
||||
}
|
||||
@@ -126,70 +124,7 @@ function BT4ActionBars:ForAllButtons(...)
|
||||
end
|
||||
|
||||
function BT4ActionBars:SetupOptions()
|
||||
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.options = {}
|
||||
|
||||
self.disabledoptions = {
|
||||
general = {
|
||||
@@ -212,8 +147,8 @@ end
|
||||
|
||||
function BT4ActionBars:CreateBarOption(id, options)
|
||||
id = tostring(id)
|
||||
if not self.options.args[id] then
|
||||
self.options.args[id] = {
|
||||
if not self.options[id] then
|
||||
self.options[id] = {
|
||||
order = 10 + tonumber(id),
|
||||
type = "group",
|
||||
name = ("Bar %s"):format(id),
|
||||
@@ -221,7 +156,8 @@ function BT4ActionBars:CreateBarOption(id, options)
|
||||
childGroups = "tab",
|
||||
}
|
||||
end
|
||||
self.options.args[id].args = options
|
||||
self.options[id].args = options
|
||||
Bartender4:RegisterBarOptions(id, self.options[id])
|
||||
end
|
||||
|
||||
function BT4ActionBars:ReassignBindings()
|
||||
|
||||
@@ -6,6 +6,8 @@ local defaults = {
|
||||
profile = {
|
||||
tooltip = "enabled",
|
||||
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
@@ -325,8 +325,8 @@ function Button:UpdateUsable(force)
|
||||
local icon, hotkey = self.icon, self.hotkey
|
||||
if force or not oor then
|
||||
icon.state, hotkey.state = 1, 1
|
||||
oor = self.settings.profile.outofrange
|
||||
oorcolor, oomcolor = self.settings.profile.colors.range, self.settings.profile.colors.mana
|
||||
oor = Bartender4.db.profile.outofrange
|
||||
oorcolor, oomcolor = Bartender4.db.profile.colors.range, Bartender4.db.profile.colors.mana
|
||||
end
|
||||
|
||||
if oor == "button" and self.outOfRange then
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ function Bartender4.ButtonStyle.ApplyStyle(button, styleName)
|
||||
|
||||
if cy then
|
||||
style = styledata.default
|
||||
if button.overlay then
|
||||
if button.overlay and button.overlay.type ~= "cy" then
|
||||
button.overlay:Hide()
|
||||
end
|
||||
button.overlay = _G[button:GetName() .. "Overlay"]
|
||||
|
||||
+11
-10
@@ -70,7 +70,7 @@ end
|
||||
|
||||
function MicroMenuMod:SetupOptions()
|
||||
if not self.options then
|
||||
self.options = Bar:GetOptionObject()
|
||||
self.optionobject = Bar:GetOptionObject()
|
||||
local enabled = {
|
||||
type = "toggle",
|
||||
order = 1,
|
||||
@@ -80,7 +80,7 @@ function MicroMenuMod:SetupOptions()
|
||||
set = "ToggleModule",
|
||||
handler = self,
|
||||
}
|
||||
self.options:AddElement("general", "enabled", enabled)
|
||||
self.optionobject:AddElement("general", "enabled", enabled)
|
||||
|
||||
self.disabledoptions = {
|
||||
general = {
|
||||
@@ -93,15 +93,16 @@ function MicroMenuMod:SetupOptions()
|
||||
}
|
||||
}
|
||||
}
|
||||
ActionBars.options.args["MicroMenu"] = {
|
||||
order = 30,
|
||||
type = "group",
|
||||
name = "Micro Menu",
|
||||
desc = "Configure the Micro Menu",
|
||||
childGroups = "tab",
|
||||
}
|
||||
self.options = {
|
||||
order = 30,
|
||||
type = "group",
|
||||
name = "Micro Menu",
|
||||
desc = "Configure the Micro Menu",
|
||||
childGroups = "tab",
|
||||
}
|
||||
Bartender4:RegisterBarOptions("MicroMenu", self.options)
|
||||
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
|
||||
|
||||
function MicroMenuBar:ApplyConfig(config)
|
||||
|
||||
+64
@@ -38,6 +38,66 @@ function Bartender4:SetupOptions()
|
||||
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,
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
@@ -64,6 +124,10 @@ function Bartender4:RegisterModuleOptions(key, table)
|
||||
self.options.plugins[key] = { [key] = table }
|
||||
end
|
||||
|
||||
function Bartender4:RegisterBarOptions(id, table)
|
||||
self.options.args.bars.args[id] = table
|
||||
end
|
||||
|
||||
local optionParent = {}
|
||||
function optionParent:NewCategory(category, data)
|
||||
self.table[category] = data
|
||||
|
||||
+12
-10
@@ -112,7 +112,7 @@ end
|
||||
|
||||
function PetBarMod:SetupOptions()
|
||||
if not self.options then
|
||||
self.options = Bartender4.ButtonBar.prototype:GetOptionObject()
|
||||
self.optionobject = Bartender4.ButtonBar.prototype:GetOptionObject()
|
||||
|
||||
local enabled = {
|
||||
type = "toggle",
|
||||
@@ -123,7 +123,7 @@ function PetBarMod:SetupOptions()
|
||||
set = "ToggleModule",
|
||||
handler = self,
|
||||
}
|
||||
self.options:AddElement("general", "enabled", enabled)
|
||||
self.optionobject:AddElement("general", "enabled", enabled)
|
||||
|
||||
self.disabledoptions = {
|
||||
general = {
|
||||
@@ -136,15 +136,17 @@ function PetBarMod:SetupOptions()
|
||||
}
|
||||
}
|
||||
}
|
||||
ActionBars.options.args["Pet"] = {
|
||||
order = 30,
|
||||
type = "group",
|
||||
name = "Pet Bar",
|
||||
desc = "Configure the Pet Bar",
|
||||
childGroups = "tab",
|
||||
}
|
||||
|
||||
self.options = {
|
||||
order = 30,
|
||||
type = "group",
|
||||
name = "Pet Bar",
|
||||
desc = "Configure the Pet Bar",
|
||||
childGroups = "tab",
|
||||
}
|
||||
Bartender4:RegisterBarOptions("Pet", self.options)
|
||||
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
|
||||
|
||||
function PetBarMod:ReassignBindings()
|
||||
|
||||
+14
-14
@@ -54,7 +54,7 @@ end
|
||||
|
||||
function StanceBarMod:SetupOptions()
|
||||
if not self.options then
|
||||
self.options = Bartender4.ButtonBar.prototype:GetOptionObject()
|
||||
self.optionobject = Bartender4.ButtonBar.prototype:GetOptionObject()
|
||||
|
||||
local enabled = {
|
||||
type = "toggle",
|
||||
@@ -65,7 +65,7 @@ function StanceBarMod:SetupOptions()
|
||||
set = "ToggleModule",
|
||||
handler = self,
|
||||
}
|
||||
self.options:AddElement("general", "enabled", enabled)
|
||||
self.optionobject:AddElement("general", "enabled", enabled)
|
||||
|
||||
self.disabledoptions = {
|
||||
general = {
|
||||
@@ -79,17 +79,17 @@ function StanceBarMod:SetupOptions()
|
||||
}
|
||||
}
|
||||
|
||||
ActionBars.options.args["Stance"] = {
|
||||
order = 30,
|
||||
type = "group",
|
||||
name = "Stance Bar",
|
||||
desc = "Configure the Stance Bar",
|
||||
childGroups = "tab",
|
||||
disabled = function(info) return GetNumShapeshiftForms() == 0 end,
|
||||
}
|
||||
self.options = {
|
||||
order = 30,
|
||||
type = "group",
|
||||
name = "Stance Bar",
|
||||
desc = "Configure the Stance Bar",
|
||||
childGroups = "tab",
|
||||
disabled = function(info) return GetNumShapeshiftForms() == 0 end,
|
||||
}
|
||||
Bartender4:RegisterBarOptions("Stance", self.options)
|
||||
end
|
||||
|
||||
ActionBars.options.args["Stance"].args = self:IsEnabled() and self.options.table or self.disabledoptions
|
||||
self.options.args = self:IsEnabled() and self.optionobject.table or self.disabledoptions
|
||||
end
|
||||
|
||||
function StanceBarMod:ApplyConfig()
|
||||
@@ -126,9 +126,9 @@ function StanceButtonPrototype:Update()
|
||||
CooldownFrame_SetTimer(self.cooldown, start, duration, enable)
|
||||
|
||||
if ( isActive ) then
|
||||
self:SetChecked(1);
|
||||
self:SetChecked(1)
|
||||
else
|
||||
self:SetChecked(0);
|
||||
self:SetChecked(0)
|
||||
end
|
||||
|
||||
if ( isCastable ) then
|
||||
|
||||
Reference in New Issue
Block a user