diff --git a/Bartender4.lua b/Bartender4.lua
index 71a1787..a806297 100644
--- a/Bartender4.lua
+++ b/Bartender4.lua
@@ -99,4 +99,10 @@ function Bartender4.modulePrototype:ToggleModule(info, value)
self:Disable()
end
end
+
+function Bartender4.modulePrototype:ToggleOptions()
+ if self.options then
+ self.options.args = self:IsEnabled() and self.optionobject.table or self.disabledoptions
+ end
+end
Bartender4:SetDefaultModulePrototype(Bartender4.modulePrototype)
diff --git a/Bartender4.toc b/Bartender4.toc
index 9973c1d..2fee0c6 100644
--- a/Bartender4.toc
+++ b/Bartender4.toc
@@ -17,15 +17,10 @@ Bartender4.lua
Options.lua
## Prototypes ##
-Bar.lua
-ButtonBar.lua
-Button.lua
+barPrototype\Bar.xml
+buttonBarPrototype\ButtonBar.xml
+buttonPrototypes\Buttons.xml
## Modules ##
-ActionBars.lua
-ActionBarPrototype.lua
-ActionBarStates.lua
-StanceBar.lua
-PetBar.lua
-MicroMenu.lua
-BagBar.lua
+actionBar\ActionBars.xml
+specialBars\SpecialBars.xml
diff --git a/ActionBars.lua b/actionBar/ActionBars.lua
similarity index 91%
rename from ActionBars.lua
rename to actionBar/ActionBars.lua
index 9558d1c..3c625db 100644
--- a/ActionBars.lua
+++ b/actionBar/ActionBars.lua
@@ -153,29 +153,6 @@ function BT4ActionBars:UpdateButtons(force)
end
end
-function BT4ActionBars: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
-
function BT4ActionBars:ReassignBindings()
if InCombatLockdown() then return end
if not self.actionbars or not self.actionbars[1] then return end
diff --git a/actionBar/ActionBars.xml b/actionBar/ActionBars.xml
new file mode 100644
index 0000000..b78fb16
--- /dev/null
+++ b/actionBar/ActionBars.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
diff --git a/actionBar/Options.lua b/actionBar/Options.lua
new file mode 100644
index 0000000..da41e58
--- /dev/null
+++ b/actionBar/Options.lua
@@ -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
diff --git a/ActionBarPrototype.lua b/actionBar/Prototype.lua
similarity index 53%
rename from ActionBarPrototype.lua
rename to actionBar/Prototype.lua
index c0ff434..5d9a1e1 100644
--- a/ActionBarPrototype.lua
+++ b/actionBar/Prototype.lua
@@ -1,133 +1,9 @@
--[[ $Id$ ]]
-local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
local ButtonBar = Bartender4.ButtonBar.prototype
local ActionBar = setmetatable({}, {__index = ButtonBar})
Bartender4.ActionBar = 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
-
--[[===================================================================================
ActionBar Prototype
===================================================================================]]--
diff --git a/ActionBarStates.lua b/actionBar/States.lua
similarity index 54%
rename from ActionBarStates.lua
rename to actionBar/States.lua
index bd97913..01919af 100644
--- a/ActionBarStates.lua
+++ b/actionBar/States.lua
@@ -1,5 +1,4 @@
--[[ $Id$ ]]
-local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
local ActionBar = Bartender4.ActionBar
local module = Bartender4:GetModule("ActionBars")
@@ -17,218 +16,8 @@ local function tfind(haystack, needle, searchfunc)
return nil
end
-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", ["1"] = ("Page %d"):format(1), ["2"] = ("Page %d"):format(2), ["3"] = ("Page %d"):format(3), ["4"] = ("Page %d"):format(4), ["5"] = ("Page %d"):format(5), ["6"] = ("Page %d"):format(6), ["7"] = ("Page %d"):format(7), ["8"] = ("Page %d"):format(8), ["9"] = ("Page %d"):format(9), ["10"] = ("Page %d"):format(10) }
-
-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
-
-- specifiy the available stances for each class
module.DefaultStanceMap = setmetatable({}, { __index = function(t,k)
local newT = nil
diff --git a/actionBar/StatesOptions.lua b/actionBar/StatesOptions.lua
new file mode 100644
index 0000000..6d2626f
--- /dev/null
+++ b/actionBar/StatesOptions.lua
@@ -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
diff --git a/barPrototype/Bar.xml b/barPrototype/Bar.xml
new file mode 100644
index 0000000..ba4bbf7
--- /dev/null
+++ b/barPrototype/Bar.xml
@@ -0,0 +1,5 @@
+
+
+
+
diff --git a/barPrototype/Options.lua b/barPrototype/Options.lua
new file mode 100644
index 0000000..a92bab7
--- /dev/null
+++ b/barPrototype/Options.lua
@@ -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
diff --git a/Bar.lua b/barPrototype/Prototype.lua
similarity index 69%
rename from Bar.lua
rename to barPrototype/Prototype.lua
index 6e28c99..52f1089 100644
--- a/Bar.lua
+++ b/barPrototype/Prototype.lua
@@ -3,7 +3,6 @@
]]
--[[ $Id$ ]]
-local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
local Bar = CreateFrame("Button")
local Bar_MT = {__index = Bar}
@@ -129,144 +128,6 @@ function Bartender4.Bar:ForAll(method, ...)
end
end
---[[===================================================================================
- Bar Options
-===================================================================================]]--
-
--- 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
-
--[[===================================================================================
Universal Bar Prototype
===================================================================================]]--
@@ -353,6 +214,7 @@ function Bar:SetShow(show)
self:ApplyVisibilityDriver()
else
self:Show()
+ self:InitVisibilityDriver()
if self.config.show == "alwayshide" then
self.overlay:SetBackdropColor(1, 0, 0, 0.5)
else
diff --git a/buttonBarPrototype/ButtonBar.xml b/buttonBarPrototype/ButtonBar.xml
new file mode 100644
index 0000000..ba4bbf7
--- /dev/null
+++ b/buttonBarPrototype/ButtonBar.xml
@@ -0,0 +1,5 @@
+
+
+
+
diff --git a/buttonBarPrototype/Options.lua b/buttonBarPrototype/Options.lua
new file mode 100644
index 0000000..8330ece
--- /dev/null
+++ b/buttonBarPrototype/Options.lua
@@ -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
diff --git a/ButtonBar.lua b/buttonBarPrototype/Prototype.lua
similarity index 67%
rename from ButtonBar.lua
rename to buttonBarPrototype/Prototype.lua
index a6eb0af..5f73a7d 100644
--- a/ButtonBar.lua
+++ b/buttonBarPrototype/Prototype.lua
@@ -1,5 +1,4 @@
--[[ $Id$ ]]
-local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
--[[ Generic Template for a Bar which contains Buttons ]]
local Bar = Bartender4.Bar.prototype
@@ -48,88 +47,6 @@ function Bartender4.ButtonBar:SkinChanged(SkinID, Gloss, Backdrop, Group, Button
bar:SkinChanged(SkinID, Gloss, Backdrop, Colors, Button)
end
---[[===================================================================================
- 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
-
-local options
-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 LBF 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
-
-
function ButtonBar:ApplyConfig(config)
Bar.ApplyConfig(self, config)
-- any module inherting this template should call UpdateButtonLayout after setting up its buttons, we cannot call it here
diff --git a/Button.lua b/buttonPrototypes/ActionButton.lua
similarity index 100%
rename from Button.lua
rename to buttonPrototypes/ActionButton.lua
diff --git a/buttonPrototypes/Buttons.xml b/buttonPrototypes/Buttons.xml
new file mode 100644
index 0000000..9789060
--- /dev/null
+++ b/buttonPrototypes/Buttons.xml
@@ -0,0 +1,5 @@
+
+
+
+
diff --git a/PetBar.lua b/buttonPrototypes/PetButton.lua
similarity index 51%
rename from PetBar.lua
rename to buttonPrototypes/PetButton.lua
index d11c4d1..bd14408 100644
--- a/PetBar.lua
+++ b/buttonPrototypes/PetButton.lua
@@ -1,88 +1,32 @@
+--[[
+ Pet Button template
+]]
+
--[[ $Id$ ]]
-local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
--- register module
-local PetBarMod = Bartender4:NewModule("PetBar", "AceEvent-3.0")
--- fetch upvalues
-local ActionBars = Bartender4:GetModule("ActionBars")
-local ButtonBar = Bartender4.ButtonBar.prototype
-
--- create prototype information
-local PetBar = setmetatable({}, {__index = ButtonBar})
local PetButtonPrototype = CreateFrame("CheckButton")
local PetButton_MT = {__index = PetButtonPrototype}
local LBF = LibStub("LibButtonFacade", true)
local KeyBound = LibStub("LibKeyBound-1.0")
-local defaults = { profile = Bartender4:Merge({
- enabled = true,
- scale = 1.0,
-}, Bartender4.ButtonBar.defaults) }
-
-function PetBarMod:OnInitialize()
- self.db = Bartender4.db:RegisterNamespace("PetBar", defaults)
- self:SetEnabledState(self.db.profile.enabled)
-end
-
-function PetBarMod:OnEnable()
- if not self.bar then
- self.bar = setmetatable(Bartender4.ButtonBar:Create("PetBar", self.db.profile, L["Pet Bar"]), {__index = PetBar})
-
- local buttons = {}
- for i=1,10 do
- buttons[i] = self:CreatePetButton(i)
- end
- self.bar.buttons = buttons
-
- -- TODO: real positioning
- self.bar:ClearSetPoint("CENTER")
-
- self.bar:SetScript("OnEvent", PetBar.OnEvent)
-
- self.bar:SetAttribute("unit", "pet")
- end
- self.bar:Enable()
-
- RegisterUnitWatch(self.bar, false)
-
- self.bar:RegisterEvent("PLAYER_CONTROL_LOST")
- self.bar:RegisterEvent("PLAYER_CONTROL_GAINED")
- self.bar:RegisterEvent("PLAYER_FARSIGHT_FOCUS_CHANGED")
- self.bar:RegisterEvent("UNIT_PET")
- self.bar:RegisterEvent("UNIT_FLAGS")
- self.bar:RegisterEvent("UNIT_AURA")
- self.bar:RegisterEvent("PET_BAR_UPDATE")
- self.bar:RegisterEvent("PET_BAR_UPDATE_COOLDOWN")
- self.bar:RegisterEvent("PET_BAR_SHOWGRID")
- self.bar:RegisterEvent("PET_BAR_HIDEGRID")
-
- self:ApplyConfig()
- self:ToggleOptions()
-
- self:RegisterEvent("UPDATE_BINDINGS", "ReassignBindings")
- self:ReassignBindings()
-end
-
-function PetBarMod:OnDisable()
- if not self.bar then return end
-
- UnregisterUnitWatch(self.bar)
-
- self.bar:Disable()
- self:ToggleOptions()
-end
+-- upvalues
+local _G = _G
+local format = string.format
local function onEnter(self, ...)
self:OnEnter(...)
KeyBound:Set(self)
end
-function PetBarMod:CreatePetButton(id)
+Bartender4.PetButton = {}
+Bartender4.PetButton.prototype = PetButtonPrototype
+function Bartender4.PetButton:Create(id, parent)
local name = "BT4PetButton" .. id
- local button = setmetatable(CreateFrame("CheckButton", name, self.bar, "PetActionButtonTemplate"), PetButton_MT)
+ local button = setmetatable(CreateFrame("CheckButton", name, parent, "PetActionButtonTemplate"), PetButton_MT)
button.showgrid = 0
button.id = id
+ button.parent = parent
button:SetFrameStrata("MEDIUM")
button:SetID(id)
@@ -114,7 +58,7 @@ function PetBarMod:CreatePetButton(id)
button.textureCache.highlight = button.highlightTexture:GetTexture()
if LBF then
- local group = self.bar.LBFGroup
+ local group = parent.LBFGroup
button.LBFButtonData = {
Button = button,
Normal = button.normalTexture,
@@ -124,72 +68,6 @@ function PetBarMod:CreatePetButton(id)
return button
end
-function PetBarMod:SetupOptions()
- if not self.options then
- self.optionobject = Bartender4.ButtonBar.prototype: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
-
-function PetBarMod:ToggleOptions()
- if self.options then
- self.options.args = self:IsEnabled() and self.optionobject.table or self.disabledoptions
- end
-end
-
-function PetBarMod:ReassignBindings()
- if InCombatLockdown() then return end
- if not self.bar or not self.bar.buttons then return end
- ClearOverrideBindings(self.bar)
- for i = 1, 10 do
- local button, real_button = ("BONUSACTIONBUTTON%d"):format(i), ("BT4PetButton%d"):format(i)
- for k=1, select('#', GetBindingKey(button)) do
- local key = select(k, GetBindingKey(button))
- SetOverrideBindingClick(self.bar, false, key, real_button)
- end
- end
-end
-
-function PetBarMod:ApplyConfig()
- if not self:IsEnabled() then return end
- self.bar:ApplyConfig(self.db.profile)
- self:ReassignBindings()
-end
-
function PetButtonPrototype:Update()
local name, subtext, texture, isToken, isActive, autoCastAllowed, autoCastEnabled = GetPetActionInfo(self.id)
@@ -234,7 +112,7 @@ function PetButtonPrototype:Update()
self.normalTexture:SetTexture("Interface\\Buttons\\UI-Quickslot")
self.normalTexture:SetTexCoord(-0.1, 1.1, -0.1, 1.12)
self:HideButton()
- if self.showgrid == 0 and not PetBarMod.db.profile.showgrid then
+ if self.showgrid == 0 and not self.parent.config.showgrid then
self.normalTexture:Hide()
if self.overlay then
self.overlay:Hide()
@@ -282,7 +160,7 @@ end
function PetButtonPrototype:HideGrid()
if self.showgrid > 0 then self.showgrid = self.showgrid - 1 end
- if self.showgrid == 0 and not (GetPetActionInfo(self.id)) and not PetBarMod.db.profile.showgrid then
+ if self.showgrid == 0 and not (GetPetActionInfo(self.id)) and not self.parent.config.showgrid then
self.normalTexture:Hide()
end
end
@@ -335,38 +213,3 @@ function PetButtonPrototype:ClearSetPoint(...)
self:ClearAllPoints()
self:SetPoint(...)
end
-
-PetBar.button_width = 30
-PetBar.button_height = 30
-function PetBar:OnEvent(event, arg1)
- if event == "PET_BAR_UPDATE" or
- (event == "UNIT_PET" and arg1 == "player") or
- ((event == "UNIT_FLAGS" or event == "UNIT_AURA") and arg1 == "pet") or
- event == "PLAYER_CONTROL_LOST" or event == "PLAYER_CONTROL_GAINED" or event == "PLAYER_FARSIGHT_FOCUS_CHANGED"
- then
- self:ForAll("Update")
- elseif event == "PET_BAR_UPDATE_COOLDOWN" then
- self:ForAll("UpdateCooldown")
- elseif event == "PET_BAR_SHOWGRID" then
- self:ForAll("ShowGrid")
- elseif event == "PET_BAR_HIDEGRID" then
- self:ForAll("HideGrid")
- end
-end
-
-function PetBar:ApplyConfig(config)
- ButtonBar.ApplyConfig(self, config)
- self:UpdateButtonLayout()
- self:ForAll("Update")
- self:ForAll("ApplyStyle", self.config.style)
-end
-
-function PetBar:Unlock()
- UnregisterUnitWatch(self)
- ButtonBar.Unlock(self)
-end
-
-function PetBar:Lock()
- ButtonBar.Lock(self)
- RegisterUnitWatch(self, false)
-end
diff --git a/locale/Babelfish.lua b/locale/Babelfish.lua
index 329b1f4..127d03c 100644
--- a/locale/Babelfish.lua
+++ b/locale/Babelfish.lua
@@ -10,18 +10,27 @@ local locale = {
"ruRU"
}
local files = {
- "ActionBarPrototype.lua",
- "ActionBars.lua",
- "ActionBarStates.lua",
- "BagBar.lua",
- "Bar.lua",
"Bartender4.lua",
- "Button.lua",
- "ButtonBar.lua",
- "MicroMenu.lua",
"Options.lua",
- "PetBar.lua",
- "StanceBar.lua",
+ "actionBar/Prototype.lua",
+ "actionBar/Options.lua",
+ "actionBar/ActionBars.lua",
+ "actionBar/States.lua",
+ "actionBar/StatesOptions.lua",
+ "barPrototype/Prototype.lua",
+ "barPrototype/Options.lua",
+ "buttonBarPrototype/Prototype.lua",
+ "buttonBarPrototype/Options.lua",
+ "buttonPrototypes/ActionButton.lua",
+ "buttonPrototypes/PetButton.lua",
+ "specialBars/BagBar.lua",
+ "specialBars/BagBarOptions.lua",
+ "specialBars/MicroMenu.lua",
+ "specialBars/MicroMenuOptions.lua",
+ "specialBars/PetBar.lua",
+ "specialBars/PetBarOptions.lua",
+ "specialBars/StanceBar.lua",
+ "specialBars/StanceBarOptions.lua",
}
local strings = {}
diff --git a/BagBar.lua b/specialBars/BagBar.lua
similarity index 59%
rename from BagBar.lua
rename to specialBars/BagBar.lua
index dcec61b..b34f49d 100644
--- a/BagBar.lua
+++ b/specialBars/BagBar.lua
@@ -47,71 +47,6 @@ function BagBarMod:ApplyConfig()
self.bar:ApplyConfig(self.db.profile)
end
-local button_count = 5
-function BagBarMod:SetupOptions()
- if not self.options then
- self.optionobject = ButtonBar:GetOptionObject()
- self.optionobject.table.general.args.rows.max = 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
-
-function BagBarMod:ToggleOptions()
- if self.options then
- self.options.args = self:IsEnabled() and self.optionobject.table or self.disabledoptions
- end
-end
-
function BagBar:ApplyConfig(config)
ButtonBar.ApplyConfig(self, config)
self:FeedButtons()
@@ -125,6 +60,7 @@ end
BagBar.button_width = 37
BagBar.button_height = 37
+BagBarMod.button_count = 5
function BagBar:FeedButtons()
local count = 1
if self.buttons then
@@ -178,9 +114,8 @@ function BagBar:FeedButtons()
v.ClearSetPoint = clearSetPoint
end
- button_count = count
+ BagBarMod.button_count = count
if BagBarMod.optionobject then
BagBarMod.optionobject.table.general.args.rows.max = count
end
end
-
diff --git a/specialBars/BagBarOptions.lua b/specialBars/BagBarOptions.lua
new file mode 100644
index 0000000..78a228b
--- /dev/null
+++ b/specialBars/BagBarOptions.lua
@@ -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
diff --git a/MicroMenu.lua b/specialBars/MicroMenu.lua
similarity index 68%
rename from MicroMenu.lua
rename to specialBars/MicroMenu.lua
index 84891f1..4861bed 100644
--- a/MicroMenu.lua
+++ b/specialBars/MicroMenu.lua
@@ -64,49 +64,6 @@ function MicroMenuMod:ApplyConfig()
self.bar:ApplyConfig(self.db.profile)
end
-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
-
-function MicroMenuMod:ToggleOptions()
- if self.options then
- self.options.args = self:IsEnabled() and self.optionobject.table or self.disabledoptions
- end
-end
-
function MicroMenuBar:ApplyConfig(config)
Bar.ApplyConfig(self, config)
self:PerformLayout()
diff --git a/specialBars/MicroMenuOptions.lua b/specialBars/MicroMenuOptions.lua
new file mode 100644
index 0000000..58c4cd3
--- /dev/null
+++ b/specialBars/MicroMenuOptions.lua
@@ -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
diff --git a/specialBars/PetBar.lua b/specialBars/PetBar.lua
new file mode 100644
index 0000000..1fffbfd
--- /dev/null
+++ b/specialBars/PetBar.lua
@@ -0,0 +1,123 @@
+--[[ $Id$ ]]
+local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
+-- register module
+local PetBarMod = Bartender4:NewModule("PetBar", "AceEvent-3.0")
+
+-- fetch upvalues
+local ActionBars = Bartender4:GetModule("ActionBars")
+local ButtonBar = Bartender4.ButtonBar.prototype
+
+-- create prototype information
+local PetBar = setmetatable({}, {__index = ButtonBar})
+
+local defaults = { profile = Bartender4:Merge({
+ enabled = true,
+ scale = 1.0,
+}, Bartender4.ButtonBar.defaults) }
+
+function PetBarMod:OnInitialize()
+ self.db = Bartender4.db:RegisterNamespace("PetBar", defaults)
+ self:SetEnabledState(self.db.profile.enabled)
+end
+
+function PetBarMod:OnEnable()
+ if not self.bar then
+ self.bar = setmetatable(Bartender4.ButtonBar:Create("PetBar", self.db.profile, L["Pet Bar"]), {__index = PetBar})
+
+ local buttons = {}
+ for i=1,10 do
+ buttons[i] = Bartender4.PetButton:Create(i, self.bar)
+ end
+ self.bar.buttons = buttons
+
+ -- TODO: real positioning
+ self.bar:ClearSetPoint("CENTER")
+
+ self.bar:SetScript("OnEvent", PetBar.OnEvent)
+
+ self.bar:SetAttribute("unit", "pet")
+ end
+ self.bar:Enable()
+
+ RegisterUnitWatch(self.bar, false)
+
+ self.bar:RegisterEvent("PLAYER_CONTROL_LOST")
+ self.bar:RegisterEvent("PLAYER_CONTROL_GAINED")
+ self.bar:RegisterEvent("PLAYER_FARSIGHT_FOCUS_CHANGED")
+ self.bar:RegisterEvent("UNIT_PET")
+ self.bar:RegisterEvent("UNIT_FLAGS")
+ self.bar:RegisterEvent("UNIT_AURA")
+ self.bar:RegisterEvent("PET_BAR_UPDATE")
+ self.bar:RegisterEvent("PET_BAR_UPDATE_COOLDOWN")
+ self.bar:RegisterEvent("PET_BAR_SHOWGRID")
+ self.bar:RegisterEvent("PET_BAR_HIDEGRID")
+
+ self:ApplyConfig()
+ self:ToggleOptions()
+
+ self:RegisterEvent("UPDATE_BINDINGS", "ReassignBindings")
+ self:ReassignBindings()
+end
+
+function PetBarMod:OnDisable()
+ if not self.bar then return end
+
+ UnregisterUnitWatch(self.bar)
+
+ self.bar:Disable()
+ self:ToggleOptions()
+end
+
+function PetBarMod:ReassignBindings()
+ if InCombatLockdown() then return end
+ if not self.bar or not self.bar.buttons then return end
+ ClearOverrideBindings(self.bar)
+ for i = 1, 10 do
+ local button, real_button = ("BONUSACTIONBUTTON%d"):format(i), ("BT4PetButton%d"):format(i)
+ for k=1, select('#', GetBindingKey(button)) do
+ local key = select(k, GetBindingKey(button))
+ SetOverrideBindingClick(self.bar, false, key, real_button)
+ end
+ end
+end
+
+function PetBarMod:ApplyConfig()
+ if not self:IsEnabled() then return end
+ self.bar:ApplyConfig(self.db.profile)
+ self:ReassignBindings()
+end
+
+PetBar.button_width = 30
+PetBar.button_height = 30
+function PetBar:OnEvent(event, arg1)
+ if event == "PET_BAR_UPDATE" or
+ (event == "UNIT_PET" and arg1 == "player") or
+ ((event == "UNIT_FLAGS" or event == "UNIT_AURA") and arg1 == "pet") or
+ event == "PLAYER_CONTROL_LOST" or event == "PLAYER_CONTROL_GAINED" or event == "PLAYER_FARSIGHT_FOCUS_CHANGED"
+ then
+ self:ForAll("Update")
+ elseif event == "PET_BAR_UPDATE_COOLDOWN" then
+ self:ForAll("UpdateCooldown")
+ elseif event == "PET_BAR_SHOWGRID" then
+ self:ForAll("ShowGrid")
+ elseif event == "PET_BAR_HIDEGRID" then
+ self:ForAll("HideGrid")
+ end
+end
+
+function PetBar:ApplyConfig(config)
+ ButtonBar.ApplyConfig(self, config)
+ self:UpdateButtonLayout()
+ self:ForAll("Update")
+ self:ForAll("ApplyStyle", self.config.style)
+end
+
+function PetBar:Unlock()
+ UnregisterUnitWatch(self)
+ ButtonBar.Unlock(self)
+end
+
+function PetBar:Lock()
+ ButtonBar.Lock(self)
+ RegisterUnitWatch(self, false)
+end
diff --git a/specialBars/PetBarOptions.lua b/specialBars/PetBarOptions.lua
new file mode 100644
index 0000000..2b1d2dc
--- /dev/null
+++ b/specialBars/PetBarOptions.lua
@@ -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
diff --git a/specialBars/SpecialBars.xml b/specialBars/SpecialBars.xml
new file mode 100644
index 0000000..1354bef
--- /dev/null
+++ b/specialBars/SpecialBars.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/StanceBar.lua b/specialBars/StanceBar.lua
similarity index 83%
rename from StanceBar.lua
rename to specialBars/StanceBar.lua
index cec801c..9a6e905 100644
--- a/StanceBar.lua
+++ b/specialBars/StanceBar.lua
@@ -55,52 +55,7 @@ function StanceBarMod:OnDisable()
self:ToggleOptions()
end
-local button_count = 10
-function StanceBarMod:SetupOptions()
- if not self.options then
- self.optionobject = Bartender4.ButtonBar.prototype:GetOptionObject()
- self.optionobject.table.general.args.rows.max = 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
-
-function StanceBarMod:ToggleOptions()
- if self.options then
- self.options.args = self:IsEnabled() and self.optionobject.table or self.disabledoptions
- end
-end
+StanceBarMod.button_count = 10
function StanceBarMod:ApplyConfig()
if not self:IsEnabled() then return end
@@ -255,7 +210,7 @@ function StanceBar:UpdateStanceButtons()
buttons[i]:Hide()
end
- button_count = num_stances
+ StanceBarMod.button_count = num_stances
if StanceBarMod.optionobject then
StanceBarMod.optionobject.table.general.args.rows.max = num_stances
end
diff --git a/specialBars/StanceBarOptions.lua b/specialBars/StanceBarOptions.lua
new file mode 100644
index 0000000..383aa31
--- /dev/null
+++ b/specialBars/StanceBarOptions.lua
@@ -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