- build the config on demand (might break stuff, srsly)
- add options for configuring the modifier switching
This commit is contained in:
+55
-4
@@ -25,6 +25,7 @@ do
|
||||
stance = "StanceStateOption",
|
||||
enabled = "StateOption",
|
||||
def_state = "DefaultState",
|
||||
states = "StateOption",
|
||||
}
|
||||
-- retrieves a valid bar object from the modules actionbars table
|
||||
function getBar(id)
|
||||
@@ -83,14 +84,17 @@ local function createOptionGroup(k, id)
|
||||
order = 10 * k,
|
||||
type = "select",
|
||||
arg = "stance",
|
||||
get = optGetter,
|
||||
set = optSetter,
|
||||
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 = {
|
||||
@@ -113,6 +117,50 @@ function module:GetStateOptionsTable()
|
||||
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 = "Modifier Based Switching",
|
||||
},
|
||||
ctrl = {
|
||||
order = 10,
|
||||
type = "select",
|
||||
name = "CTRL",
|
||||
arg = "states",
|
||||
values = validStanceTable,
|
||||
desc = "Configure actionbar paging when the ctrl key is down.",
|
||||
--width = "half",
|
||||
},
|
||||
alt = {
|
||||
order = 15,
|
||||
type = "select",
|
||||
name = "ALT",
|
||||
arg = "states",
|
||||
values = validStanceTable,
|
||||
desc = "Configure actionbar paging when the alt key is down.",
|
||||
--width = "half",
|
||||
},
|
||||
shift = {
|
||||
order = 20,
|
||||
type = "select",
|
||||
name = "SHIFT",
|
||||
arg = "states",
|
||||
values = validStanceTable,
|
||||
desc = "Configure actionbar paging when the shift key is down.",
|
||||
--width = "half",
|
||||
},
|
||||
},
|
||||
},
|
||||
stances = {
|
||||
order = 20,
|
||||
@@ -120,6 +168,9 @@ function module:GetStateOptionsTable()
|
||||
inline = true,
|
||||
name = "",
|
||||
hidden = function() return not (module.DefaultStanceMap[playerclass]) end,
|
||||
get = optGetter,
|
||||
set = optSetter,
|
||||
disabled = disabledFunc,
|
||||
args = {
|
||||
stance_header = {
|
||||
order = 1,
|
||||
@@ -310,10 +361,10 @@ function ActionBar:SetStateOption(key, value)
|
||||
end
|
||||
|
||||
function ActionBar:GetDefaultState()
|
||||
return self.config.states.stance.default
|
||||
return self.config.states.default
|
||||
end
|
||||
|
||||
function ActionBar:SetDefaultState(_, value)
|
||||
self.config.states.stance.default = value
|
||||
self.config.states.default = value
|
||||
self:UpdateStates()
|
||||
end
|
||||
|
||||
+39
-26
@@ -12,8 +12,11 @@ local abdefaults = {
|
||||
showgrid = false,
|
||||
states = {
|
||||
enabled = false,
|
||||
stance = {
|
||||
default = 0,
|
||||
ctrl = 0,
|
||||
alt = 0,
|
||||
shift = 0,
|
||||
stance = {
|
||||
['**'] = {
|
||||
['*'] = 0,
|
||||
},
|
||||
@@ -53,9 +56,6 @@ local defaults = {
|
||||
function BT4ActionBars:OnInitialize()
|
||||
self.db = Bartender4.db:RegisterNamespace("ActionBars", defaults)
|
||||
|
||||
|
||||
self:SetupOptions()
|
||||
|
||||
-- fetch the prototype information
|
||||
ActionBar = Bartender4.ActionBar
|
||||
ActionBar_MT = {__index = ActionBar}
|
||||
@@ -81,6 +81,40 @@ function BT4ActionBars:OnEnable()
|
||||
self:ReassignBindings()
|
||||
end
|
||||
|
||||
function BT4ActionBars:SetupOptions()
|
||||
if not self.options then
|
||||
self.options = {}
|
||||
|
||||
self.disabledoptions = {
|
||||
general = {
|
||||
type = "group",
|
||||
name = "General Settings",
|
||||
cmdInline = true,
|
||||
order = 1,
|
||||
args = {
|
||||
enabled = {
|
||||
type = "toggle",
|
||||
name = "Enabled",
|
||||
desc = "Enable/Disable the bar.",
|
||||
set = function(info, v) if v then BT4ActionBars:EnableBar(info[2]) end end,
|
||||
get = function() return false end,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for i=1,10 do
|
||||
local config = self.db.profile.actionbars[i]
|
||||
if config.enabled then
|
||||
self:CreateBarOption(i, self:GetOptionsTable())
|
||||
else
|
||||
self:CreateBarOption(i, self.disabledoptions)
|
||||
end
|
||||
end
|
||||
end
|
||||
return self.options
|
||||
end
|
||||
|
||||
-- Applys the config in the current profile to all active Bars
|
||||
function BT4ActionBars:ApplyConfig()
|
||||
for i=1,10 do
|
||||
@@ -123,29 +157,8 @@ function BT4ActionBars:ForAllButtons(...)
|
||||
self:ForAll("ForAll", ...)
|
||||
end
|
||||
|
||||
function BT4ActionBars:SetupOptions()
|
||||
self.options = {}
|
||||
|
||||
self.disabledoptions = {
|
||||
general = {
|
||||
type = "group",
|
||||
name = "General Settings",
|
||||
cmdInline = true,
|
||||
order = 1,
|
||||
args = {
|
||||
enabled = {
|
||||
type = "toggle",
|
||||
name = "Enabled",
|
||||
desc = "Enable/Disable the bar.",
|
||||
set = function(info, v) if v then BT4ActionBars:EnableBar(info[2]) end end,
|
||||
get = function() return false end,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
function BT4ActionBars:CreateBarOption(id, options)
|
||||
if not self.options then return end
|
||||
id = tostring(id)
|
||||
if not self.options[id] then
|
||||
self.options[id] = {
|
||||
|
||||
+8
-3
@@ -20,7 +20,6 @@ local defaults = { profile = Bartender4:Merge({
|
||||
function MicroMenuMod:OnInitialize()
|
||||
self.db = Bartender4.db:RegisterNamespace("MicroMenu", defaults)
|
||||
self:SetEnabledState(self.db.profile.enabled)
|
||||
self:SetupOptions()
|
||||
end
|
||||
|
||||
local noopFunc = function() end
|
||||
@@ -53,7 +52,7 @@ function MicroMenuMod:OnEnable()
|
||||
self.bar:ApplyConfig(self.db.profile)
|
||||
end
|
||||
self.bar.disabled = nil
|
||||
self:SetupOptions()
|
||||
self:ToggleOptions()
|
||||
end
|
||||
|
||||
function MicroMenuMod:OnDisable()
|
||||
@@ -61,7 +60,7 @@ function MicroMenuMod:OnDisable()
|
||||
self.bar.disabled = true
|
||||
self.bar:UnregisterAllEvents()
|
||||
self.bar:Hide()
|
||||
self:SetupOptions()
|
||||
self:ToggleOptions()
|
||||
end
|
||||
|
||||
function MicroMenuMod:ApplyConfig()
|
||||
@@ -105,6 +104,12 @@ function MicroMenuMod:SetupOptions()
|
||||
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()
|
||||
|
||||
+21
-6
@@ -14,8 +14,9 @@ do
|
||||
end
|
||||
end
|
||||
|
||||
function Bartender4:SetupOptions()
|
||||
self.options = {
|
||||
local function getOptions()
|
||||
if not Bartender4.options then
|
||||
Bartender4.options = {
|
||||
type = "group",
|
||||
name = "Bartender4",
|
||||
icon = "Interface\\Icons\\INV_Drink_05",
|
||||
@@ -100,11 +101,19 @@ function Bartender4:SetupOptions()
|
||||
}
|
||||
},
|
||||
}
|
||||
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
|
||||
|
||||
self.options.plugins.profiles = { profiles = LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db) }
|
||||
|
||||
|
||||
LibStub("AceConfig-3.0"):RegisterOptionsTable("Bartender4", self.options, "bttest")
|
||||
function Bartender4:SetupOptions()
|
||||
LibStub("AceConfig-3.0"):RegisterOptionsTable("Bartender4", getOptions, "bttest")
|
||||
AceConfigDialog:SetDefaultSize("Bartender4", 680,525)
|
||||
local optFunc = function()
|
||||
if InCombatLockdown() then return end
|
||||
AceConfigDialog:Open("Bartender4")
|
||||
@@ -121,10 +130,16 @@ function Bartender4:SetupOptions()
|
||||
end
|
||||
|
||||
function Bartender4:RegisterModuleOptions(key, table)
|
||||
if not self.options then
|
||||
error("Options table has not been created yet, respond to the callback!", 2)
|
||||
end
|
||||
self.options.plugins[key] = { [key] = table }
|
||||
end
|
||||
|
||||
function Bartender4:RegisterBarOptions(id, table)
|
||||
if not self.options then
|
||||
error("Options table has not been created yet, respond to the callback!", 2)
|
||||
end
|
||||
self.options.args.bars.args[id] = table
|
||||
end
|
||||
|
||||
|
||||
+8
-3
@@ -20,7 +20,6 @@ local defaults = { profile = Bartender4:Merge({
|
||||
function PetBarMod:OnInitialize()
|
||||
self.db = Bartender4.db:RegisterNamespace("PetBar", defaults)
|
||||
self:SetEnabledState(self.db.profile.enabled)
|
||||
self:SetupOptions()
|
||||
end
|
||||
|
||||
function PetBarMod:OnEnable()
|
||||
@@ -56,7 +55,7 @@ function PetBarMod:OnEnable()
|
||||
self.bar:RegisterEvent("PET_BAR_HIDEGRID")
|
||||
|
||||
self:ApplyConfig()
|
||||
self:SetupOptions()
|
||||
self:ToggleOptions()
|
||||
|
||||
self:RegisterEvent("UPDATE_BINDINGS", "ReassignBindings")
|
||||
self:ReassignBindings()
|
||||
@@ -70,7 +69,7 @@ function PetBarMod:OnDisable()
|
||||
|
||||
self.bar:UnregisterAllEvents()
|
||||
self.bar:Hide()
|
||||
self:SetupOptions()
|
||||
self:ToggleOptions()
|
||||
end
|
||||
|
||||
local function onEnter(self, ...)
|
||||
@@ -149,6 +148,12 @@ function PetBarMod:SetupOptions()
|
||||
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 not self.bar or not self.bar.buttons then return end
|
||||
ClearOverrideBindings(self.bar)
|
||||
|
||||
+8
-3
@@ -22,7 +22,6 @@ local defaults = { profile = Bartender4:Merge({
|
||||
function StanceBarMod:OnInitialize()
|
||||
self.db = Bartender4.db:RegisterNamespace("StanceBar", defaults)
|
||||
self:SetEnabledState(self.db.profile.enabled)
|
||||
self:SetupOptions()
|
||||
end
|
||||
|
||||
function StanceBarMod:OnEnable()
|
||||
@@ -33,7 +32,7 @@ function StanceBarMod:OnEnable()
|
||||
self.bar:ApplyConfig()
|
||||
self.bar:SetScript("OnEvent", StanceBar.OnEvent)
|
||||
end
|
||||
self:SetupOptions()
|
||||
self:ToggleOptions()
|
||||
self.bar:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
self.bar:RegisterEvent("UPDATE_SHAPESHIFT_FORMS")
|
||||
self.bar:RegisterEvent("SPELL_UPDATE_COOLDOWN")
|
||||
@@ -49,7 +48,7 @@ function StanceBarMod:OnDisable()
|
||||
if not self.bar then return end
|
||||
self.bar:UnregisterAllEvents()
|
||||
self.bar:Hide()
|
||||
self:SetupOptions()
|
||||
self:ToggleOptions()
|
||||
end
|
||||
|
||||
function StanceBarMod:SetupOptions()
|
||||
@@ -92,6 +91,12 @@ function StanceBarMod:SetupOptions()
|
||||
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
|
||||
|
||||
function StanceBarMod:ApplyConfig()
|
||||
if not self:IsEnabled() then return end
|
||||
self.bar:ApplyConfig(self.db.profile)
|
||||
|
||||
Reference in New Issue
Block a user