restructuring, preparing for new changes

This commit is contained in:
Hendrik Leppkes
2008-09-01 11:12:43 +00:00
parent dca3b31f9d
commit 6acaa9e6a1
27 changed files with 44 additions and 56 deletions
+151
View File
@@ -0,0 +1,151 @@
--[[ $Id$ ]]
local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
local ButtonBar = Bartender4.ButtonBar.prototype
local ActionBar = Bartender4.ActionBar
--[[===================================================================================
ActionBar Options
===================================================================================]]--
local module = Bartender4:GetModule("ActionBars")
-- option utilty functions
local optGetter, optSetter
do
local optionMap, getBar, callFunc
-- maps option keys to function names
optionMap = {
buttons = "Buttons",
enabled = "Enabled",
grid = "Grid",
macrotext = "HideMacroText",
hotkey = "HideHotkey",
}
-- retrieves a valid bar object from the modules actionbars table
function getBar(id)
local bar = module.actionbars[tonumber(id)]
assert(bar, ("Invalid bar id in options table. (%s)"):format(id))
return bar
end
-- calls a function on the bar
function callFunc(bar, type, option, ...)
local func = type .. (optionMap[option] or option)
assert(bar[func], ("Invalid get/set function %s in bar %s."):format(func, bar.id))
return bar[func](bar, ...)
end
-- universal function to get a option
function optGetter(info)
local bar = getBar(info[2])
local option = info[#info]
return callFunc(bar, "Get", option)
end
-- universal function to set a option
function optSetter(info, ...)
local bar = getBar(info[2])
local option = info[#info]
return callFunc(bar, "Set", option, ...)
end
end
-- returns the option table used for all action bars
-- creates it, if the first time called
-- the Universal Bar option table is merged into this, alot of stuff gets inherited.
function module:GetOptionsTable()
return self:GetOptionsObject().table
end
function module:GetOptionsObject()
if not self.baroptions then
local obj = ButtonBar.GetOptionObject(self)
local cat_general = {
enabled ={
order = 4,
name = L["Enabled"],
desc = L["Enable/Disable the bar."],
type = "toggle",
set = optSetter,
get = optGetter,
},
grid = {
order = 60,
type = "toggle",
name = L["Button Grid"],
desc = L["Toggle the button grid."],
set = optSetter,
get = optGetter,
},
buttons = {
order = 50,
name = L["Buttons"],
desc = L["Number of buttons."],
type = "range",
min = 1, max = 12, step = 1,
set = optSetter,
get = optGetter,
},
hidedesc = {
order = 80,
name = L["Button Look"],
type = "header",
},
macrotext = {
order = 81,
type = "toggle",
name = L["Hide Macro Text"],
desc = L["Hide the Macro Text on the buttons of this bar."],
set = optSetter,
get = optGetter,
},
hotkey = {
order = 82,
type = "toggle",
name = L["Hide Hotkey"],
desc = L["Hide the Hotkey on the buttons of this bar."],
set = optSetter,
get = optGetter,
},
}
obj:AddElementGroup("general", cat_general)
local states = {
type = "group",
name = L["State Configuration"],
cmdInline = true,
order = 2,
args = self:GetStateOptionsTable(),
}
obj:NewCategory("state", states)
self.baroptions = obj
end
return self.baroptions
end
function module:CreateBarOption(id, options)
if not self.options then return end
if not options then
options = self:GetOptionsTable()
end
id = tostring(id)
if not self.options[id] then
self.options[id] = {
order = 10 + tonumber(id),
type = "group",
name = (L["Bar %s"]):format(id),
desc = (L["Configure Bar %s"]):format(id),
childGroups = "tab",
}
end
self.options[id].args = options
-- register options in the BT GUI
Bartender4:RegisterBarOptions(id, self.options[id])
end
+215
View File
@@ -0,0 +1,215 @@
--[[ $Id$ ]]
local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
local ActionBar = Bartender4.ActionBar
local module = Bartender4:GetModule("ActionBars")
local optGetter, optSetter
do
local getBar, optionMap, callFunc
optionMap = {
stance = "StanceStateOption",
enabled = "StateOption",
def_state = "DefaultState",
states = "StateOption",
actionbar = "StateOption",
possess = "StateOption",
autoassist = "ConfigAutoAssist",
}
-- retrieves a valid bar object from the modules actionbars table
function getBar(id)
local bar = module.actionbars[tonumber(id)]
assert(bar, "Invalid bar id in options table.")
return bar
end
-- calls a function on the bar
function callFunc(bar, type, option, ...)
local func = type .. (optionMap[option] or option)
assert(bar[func], "Invalid get/set function."..func)
return bar[func](bar, ...)
end
-- universal function to get a option
function optGetter(info)
local bar = getBar(info[2])
local option = info.arg or info[#info]
return callFunc(bar, "Get", option, info[#info])
end
-- universal function to set a option
function optSetter(info, ...)
local bar = getBar(info[2])
local option = info.arg or info[#info]
return callFunc(bar, "Set", option, info[#info], ...)
end
end
local hasStances
local validStanceTable = {
[-1] = "Hide",
[0] = "Don't Page",
("Page %2d"):format(1),
("Page %2d"):format(2),
("Page %2d"):format(3),
("Page %2d"):format(4),
("Page %2d"):format(5),
("Page %2d"):format(6),
("Page %2d"):format(7),
("Page %2d"):format(8),
("Page %2d"):format(9),
("Page %2d"):format(10)
}
local _, playerclass = UnitClass("player")
local function createOptionGroup(k, id)
local tbl = {
order = 10 * k,
type = "select",
arg = "stance",
values = validStanceTable,
name = module.DefaultStanceMap[playerclass][k].name,
}
return tbl
end
local disabledFunc = function(info)
local bar = module.actionbars[tonumber(info[2])]
return not bar:GetStateOption("enabled")
end
function module:GetStateOptionsTable()
local options = {
enabled = {
order = 1,
type = "toggle",
name = L["Enabled"],
desc = L["Enable State-based Button Swaping"],
get = optGetter,
set = optSetter,
},
sep1 = {
order = 2,
type = "description",
name = "",
},
actionbar = {
order = 5,
type = "toggle",
name = L["ActionBar Switching"],
desc = L["Enable Bar Switching based on the actionbar controls provided by the game."],
get = optGetter,
set = optSetter,
},
possess = {
order = 5,
type = "toggle",
name = L["Possess Bar"],
desc = L["Switch this bar to the Possess Bar when possessing a npc (eg. Mind Control)"],
get = optGetter,
set = optSetter,
width = "half",
},
autoassist = {
order = 6,
type = "toggle",
name = L["Auto-Assist"],
desc = L["Enable Auto-Assist for this bar.\n Auto-Assist will automatically try to cast on your target's target if your target is no valid target for the selected spell."],
get = optGetter,
set = optSetter,
width = "half",
},
def_desc = {
order = 10,
type = "description",
name = L["The default behaviour of this bar when no state-based paging option affects it."],
},
def_state = {
order = 11,
type = "select",
name = L["Default Bar State"],
values = validStanceTable,
get = optGetter,
set = optSetter,
disabled = disabledFunc,
},
modifiers = {
order = 30,
type = "group",
inline = true,
name = "",
get = optGetter,
set = optSetter,
disabled = disabledFunc,
args = {
header = {
order = 1,
type = "header",
name = L["Modifier Based Switching"],
},
ctrl = {
order = 10,
type = "select",
name = L["CTRL"],
arg = "states",
values = validStanceTable,
desc = (L["Configure actionbar paging when the %s key is down."]):format(L["CTRL"]),
--width = "half",
},
alt = {
order = 15,
type = "select",
name = L["ALT"],
arg = "states",
values = validStanceTable,
desc = (L["Configure actionbar paging when the %s key is down."]):format(L["ALT"]),
--width = "half",
},
shift = {
order = 20,
type = "select",
name = L["SHIFT"],
arg = "states",
values = validStanceTable,
desc = (L["Configure actionbar paging when the %s key is down."]):format(L["SHIFT"]),
--width = "half",
},
},
},
stances = {
order = 20,
type = "group",
inline = true,
name = "",
hidden = function() return not (module.DefaultStanceMap[playerclass]) end,
get = optGetter,
set = optSetter,
disabled = disabledFunc,
args = {
stance_header = {
order = 1,
type = "header",
name = L["Stance Configuration"],
},
},
},
}
do
local defstancemap = self.DefaultStanceMap[playerclass]
if defstancemap then
for k,v in pairs(defstancemap) do
if not options.stances.args[v.id] then
options.stances.args[v.id] = createOptionGroup(k, v.id)
end
end
end
end
return options
end
+65
View File
@@ -0,0 +1,65 @@
--[[ $Id$ ]]
local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
local BagBarMod = Bartender4:GetModule("BagBar")
-- fetch upvalues
local ButtonBar = Bartender4.ButtonBar.prototype
function BagBarMod:SetupOptions()
if not self.options then
self.optionobject = ButtonBar:GetOptionObject()
self.optionobject.table.general.args.rows.max = self.button_count
local enabled = {
type = "toggle",
order = 1,
name = L["Enabled"],
desc = L["Enable the Bag Bar"],
get = function() return self.db.profile.enabled end,
set = "ToggleModule",
handler = self,
}
self.optionobject:AddElement("general", "enabled", enabled)
local onebag = {
type = "toggle",
order = 80,
name = L["One Bag"],
desc = L["Only show one Bag Button in the BagBar."],
get = function() return self.db.profile.onebag end,
set = function(info, state) self.db.profile.onebag = state; self.bar:FeedButtons(); self.bar:UpdateButtonLayout() end,
}
self.optionobject:AddElement("general", "onebag", onebag)
local keyring = {
type = "toggle",
order = 80,
name = L["Keyring"],
desc = L["Show the keyring button."],
get = function() return self.db.profile.keyring end,
set = function(info, state) self.db.profile.keyring = state; self.bar:FeedButtons(); self.bar:UpdateButtonLayout() end,
}
self.optionobject:AddElement("general", "keyring", keyring)
self.disabledoptions = {
general = {
type = "group",
name = L["General Settings"],
cmdInline = true,
order = 1,
args = {
enabled = enabled,
}
}
}
self.options = {
order = 30,
type = "group",
name = L["Bag Bar"],
desc = L["Configure the Bag Bar"],
childGroups = "tab",
}
Bartender4:RegisterBarOptions("BagBar", self.options)
end
self.options.args = self:IsEnabled() and self.optionobject.table or self.disabledoptions
end
+143
View File
@@ -0,0 +1,143 @@
--[[ $Id$ ]]
local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
local Bar = Bartender4.Bar.prototype
--[[===================================================================================
Bar Options
===================================================================================]]--
local barregistry = Bartender4.Bar.barregistry
-- option utilty functions
local optGetter, optSetter
do
local getBar, optionMap, callFunc
-- maps option keys to function names
optionMap = {
alpha = "ConfigAlpha",
scale = "ConfigScale",
show = "Show",
fadeout = "FadeOut",
fadeoutalpha = "FadeOutAlpha",
fadeoutdelay = "FadeOutDelay",
}
-- retrieves a valid bar object from the barregistry table
function getBar(id)
local bar = barregistry[tostring(id)]
assert(bar, ("Invalid bar id in options table. (%s)"):format(id))
return bar
end
-- calls a function on the bar
function callFunc(bar, type, option, ...)
local func = type .. (optionMap[option] or option)
assert(bar[func], ("Invalid get/set function %s in bar %s."):format(func, bar.id))
return bar[func](bar, ...)
end
-- universal function to get a option
function optGetter(info)
local bar = getBar(info[2])
local option = info[#info]
return callFunc(bar, "Get", option)
end
-- universal function to set a option
function optSetter(info, ...)
local bar = getBar(info[2])
local option = info[#info]
return callFunc(bar, "Set", option, ...)
end
end
local showOptions = { alwaysshow = L["Always Show"], alwayshide = L["Always Hide"], combatshow = L["Show in Combat"], combathide = L["Hide in Combat"] }
local options
function Bar:GetOptionObject()
local otbl = {
general = {
type = "group",
cmdInline = true,
name = L["General Settings"],
order = 1,
args = {
show = {
order = 5,
type = "select",
name = L["Show/Hide"],
desc = L["Configure when to Show/Hide the bar."],
get = optGetter,
set = optSetter,
values = showOptions,
},
styleheader = {
order = 10,
type = "header",
name = L["Bar Style & Layout"],
},
alpha = {
order = 20,
name = L["Alpha"],
desc = L["Configure the alpha of the bar."],
type = "range",
min = .1, max = 1, bigStep = 0.1,
get = optGetter,
set = optSetter,
},
scale = {
order = 30,
name = L["Scale"],
desc = L["Configure the scale of the bar."],
type = "range",
min = .1, max = 2, step = 0.05,
get = optGetter,
set = optSetter,
},
fadeout = {
order = 100,
name = L["Fade Out"],
desc = L["Enable the FadeOut mode"],
type = "toggle",
get = optGetter,
set = optSetter,
width = "full",
},
fadeoutalpha = {
order = 101,
name = L["Fade Out Alpha"],
desc = L["Enable the FadeOut mode"],
type = "range",
min = 0, max = 1, step = 0.05,
get = optGetter,
set = optSetter,
disabled = function(info) return not barregistry[info[2]]:GetFadeOut() end,
},
fadeoutdelay = {
order = 102,
name = L["Fade Out Delay"],
desc = L["Enable the FadeOut mode"],
type = "range",
min = 0, max = 1, step = 0.01,
get = optGetter,
set = optSetter,
disabled = function(info) return not barregistry[info[2]]:GetFadeOut() end,
},
},
},
align = {
type = "group",
cmdInline = true,
name = L["Alignment"],
order = 10,
args = {
info = {
order = 1,
type = "description",
name = L["The Alignment menu is still on the TODO.\n\nAs a quick preview of whats planned:\n\n\t- Absolute and relative Bar Positioning\n\t- Bars \"snapping\" together and building clusters"],
},
},
}
}
return Bartender4:NewOptionObject(otbl)
end
+85
View File
@@ -0,0 +1,85 @@
--[[ $Id$ ]]
local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
local Bar = Bartender4.Bar.prototype
local ButtonBar = Bartender4.ButtonBar.prototype
--[[===================================================================================
Bar Options
===================================================================================]]--
-- option utilty functions
local optGetter, optSetter
do
local getBar, optionMap, callFunc
local barregistry = Bartender4.Bar.barregistry
-- maps option keys to function names
optionMap = {
rows = "Rows",
padding = "Padding",
zoom = "Zoom",
}
-- retrieves a valid bar object from the barregistry table
function getBar(id)
local bar = barregistry[tostring(id)]
assert(bar, ("Invalid bar id in options table. (%s)"):format(id))
return bar
end
-- calls a function on the bar
function callFunc(bar, type, option, ...)
local func = type .. (optionMap[option] or option)
assert(bar[func], ("Invalid get/set function %s in bar %s."):format(func, bar.id))
return bar[func](bar, ...)
end
-- universal function to get a option
function optGetter(info)
local bar = getBar(info[2])
local option = info[#info]
return callFunc(bar, "Get", option)
end
-- universal function to set a option
function optSetter(info, ...)
local bar = getBar(info[2])
local option = info[#info]
return callFunc(bar, "Set", option, ...)
end
end
function ButtonBar:GetOptionObject()
local obj = Bar.GetOptionObject()
local otbl_general = {
padding = {
order = 40,
type = "range",
name = L["Padding"],
desc = L["Configure the padding of the buttons."],
min = -10, max = 20, step = 1,
set = optSetter,
get = optGetter,
},
zoom = {
order = 59,
name = L["Zoom"],
type = "toggle",
desc = L["Toggle Button Zoom\nFor more style options you need to install ButtonFacade"],
get = optGetter,
set = optSetter,
hidden = function() return LibStub("LibButtonFacade", true) and true or false end,
},
rows = {
order = 70,
name = L["Rows"],
desc = L["Number of rows."],
type = "range",
min = 1, max = 12, step = 1,
set = optSetter,
get = optGetter,
},
}
obj:AddElementGroup("general", otbl_general)
return obj
end
+44
View File
@@ -0,0 +1,44 @@
--[[ $Id$ ]]
local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
local MicroMenuMod = Bartender4:GetModule("MicroMenu")
-- fetch upvalues
local Bar = Bartender4.Bar.prototype
function MicroMenuMod:SetupOptions()
if not self.options then
self.optionobject = Bar:GetOptionObject()
local enabled = {
type = "toggle",
order = 1,
name = L["Enabled"],
desc = L["Enable the Micro Menu"],
get = function() return self.db.profile.enabled end,
set = "ToggleModule",
handler = self,
}
self.optionobject:AddElement("general", "enabled", enabled)
self.disabledoptions = {
general = {
type = "group",
name = L["General Settings"],
cmdInline = true,
order = 1,
args = {
enabled = enabled,
}
}
}
self.options = {
order = 30,
type = "group",
name = L["Micro Menu"],
desc = L["Configure the Micro Menu"],
childGroups = "tab",
}
Bartender4:RegisterBarOptions("MicroMenu", self.options)
end
self.options.args = self:IsEnabled() and self.optionobject.table or self.disabledoptions
end
+218
View File
@@ -0,0 +1,218 @@
--[[ $Id$ ]]
local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
local FAQ = LibStub("AceLocale-3.0"):GetLocale("Bartender4_FAQ")
local AceConfigDialog = LibStub("AceConfigDialog-3.0")
local getFunc, setFunc
do
function getFunc(info)
return (info.arg and Bartender4.db.profile[info.arg] or Bartender4.db.profile[info[#info]])
end
function setFunc(info, value)
local key = info.arg or info[#info]
Bartender4.db.profile[key] = value
end
end
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 = L["Lock"],
desc = L["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 = L["Button Lock"],
desc = L["Lock the buttons."],
get = getFunc,
set = setFunc,
},
bars = {
order = 20,
type = "group",
name = L["Bars"],
args = {
selfcastmodifier = {
order = 1,
type = "toggle",
name = L["Self-Cast by modifier"],
desc = L["Toggle the use of the modifier-based self-cast functionality."],
get = getFunc,
set = function(info, value)
Bartender4.db.profile.selfcastmodifier = value
Bartender4.Bar:ForAll("UpdateSelfCast", true)
end,
},
selfcastrightclick = {
order = 2,
type = "toggle",
name = L["Right-click Self-Cast"],
desc = L["Toggle the use of the right-click self-cast functionality."],
get = getFunc,
set = function(info, value)
Bartender4.db.profile.selfcastrightclick = value
Bartender4.Bar:ForAll("UpdateSelfCast")
end,
},
range = {
order = 10,
name = L["Out of Range Indicator"],
desc = L["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 = L["No Display"], button = L["Full Button Mode"], hotkey = L["Hotkey Mode"] },
},
colors = {
order = 13,
type = "group",
guiInline = true,
name = L["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 = L["Out of Range Indicator"],
desc = L["Specify the Color of the Out of Range Indicator"],
},
mana = {
order = 2,
type = "color",
name = L["Out of Mana Indicator"],
desc = L["Specify the Color of the Out of Mana Indicator"],
},
},
},
tooltip = {
order = 20,
name = L["Button Tooltip"],
type = "select",
desc = L["Configure the Button Tooltip."],
values = { ["disabled"] = L["Disabled"], ["nocombat"] = L["Disabled in Combat"], ["enabled"] = L["Enabled"] },
get = function() return Bartender4.db.profile.tooltip end,
set = function(info, value) Bartender4.db.profile.tooltip = value end,
},
},
},
faq = {
name = L["FAQ"],
desc = L["Frequently Asked Questions"],
type = "group",
order = 200,
args = {
faq = {
type = "description",
name = FAQ["FAQ_TEXT"],
},
},
},
},
}
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")
--[[
local status = AceConfigDialog:GetStatusTable("Bartender4")
if not status.groups then status.groups = {} end
if not status.groups.groups then status.groups.groups = {} end
status.groups.groups["actionbars"] = true
]]
end
LibStub("AceConsole-3.0"):RegisterChatCommand( "bar", optFunc)
LibStub("AceConsole-3.0"):RegisterChatCommand( "bt", optFunc)
LibStub("AceConsole-3.0"):RegisterChatCommand( "bt4", optFunc)
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
local optionParent = {}
function optionParent:NewCategory(category, data)
self.table[category] = data
end
local ov = nil
function optionParent:AddElement(category, element, data, ...)
local lvl = self.table[category]
for i = 1, select('#', ...) do
local key = select(i, ...)
if not (lvl.args[key] and lvl.args[key].args) then
error(("Sub-Level Key %s does not exist in options group or is no sub-group."):format(key), ov and 3 or 2)
end
lvl = lvl.args[key]
end
lvl.args[element] = data
end
function optionParent:AddElementGroup(category, data, ...)
ov = true
for k,v in pairs(data) do
self:AddElement(category, k, v, ...)
end
ov = nil
end
function Bartender4:NewOptionObject(otbl)
if not otbl then otbl = {} end
local tbl = { table = otbl }
for k, v in pairs(optionParent) do
tbl[k] = v
end
return tbl
end
+13
View File
@@ -0,0 +1,13 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Script file="Options.lua"/>
<Script file="Bar.lua"/>
<Script file="ButtonBar.lua"/>
<Script file="ActionBar.lua"/>
<Script file="BagBar.lua"/>
<Script file="MicroMenu.lua"/>
<Script file="PetBar.lua"/>
<Script file="StanceBar.lua"/>
</Ui>
+48
View File
@@ -0,0 +1,48 @@
--[[ $Id$ ]]
local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
local PetBarMod = Bartender4:GetModule("PetBar")
-- fetch upvalues
local ButtonBar = Bartender4.ButtonBar.prototype
function PetBarMod:SetupOptions()
if not self.options then
self.optionobject = ButtonBar:GetOptionObject()
self.optionobject.table.general.args.rows.max = 10
local enabled = {
type = "toggle",
order = 1,
name = L["Enabled"],
desc = L["Enable the PetBar"],
get = function() return self.db.profile.enabled end,
set = "ToggleModule",
handler = self,
}
self.optionobject:AddElement("general", "enabled", enabled)
self.disabledoptions = {
general = {
type = "group",
name = L["General Settings"],
cmdInline = true,
order = 1,
args = {
enabled = enabled,
}
}
}
self.options = {
order = 30,
type = "group",
name = L["Pet Bar"],
desc = L["Configure the Pet Bar"],
childGroups = "tab",
}
Bartender4:RegisterBarOptions("PetBar", self.options)
end
self.options.args = self:IsEnabled() and self.optionobject.table or self.disabledoptions
end
+48
View File
@@ -0,0 +1,48 @@
--[[ $Id$ ]]
local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
-- module
local StanceBarMod = Bartender4:GetModule("StanceBar")
-- fetch upvalues
local ButtonBar = Bartender4.ButtonBar.prototype
function StanceBarMod:SetupOptions()
if not self.options then
self.optionobject = ButtonBar:GetOptionObject()
self.optionobject.table.general.args.rows.max = self.button_count
local enabled = {
type = "toggle",
order = 1,
name = L["Enabled"],
desc = L["Enable the StanceBar"],
get = function() return self.db.profile.enabled end,
set = "ToggleModule",
handler = self,
}
self.optionobject:AddElement("general", "enabled", enabled)
self.disabledoptions = {
general = {
type = "group",
name = L["General Settings"],
cmdInline = true,
order = 1,
args = {
enabled = enabled,
}
}
}
self.options = {
order = 30,
type = "group",
name = L["Stance Bar"],
desc = L["Configure the Stance Bar"],
childGroups = "tab",
disabled = function(info) return GetNumShapeshiftForms() == 0 end,
}
Bartender4:RegisterBarOptions("StanceBar", self.options)
end
self.options.args = self:IsEnabled() and self.optionobject.table or self.disabledoptions
end