Tweaks to the state and visibility configuration

This commit is contained in:
Hendrik Leppkes
2008-11-01 17:08:08 +01:00
parent 29f204b662
commit 170a11c975
3 changed files with 35 additions and 16 deletions
+4 -4
View File
@@ -71,14 +71,14 @@ function ActionBar:UpdateStates(returnOnly)
if returnOnly or not self:GetStateOption("customEnabled") then if returnOnly or not self:GetStateOption("customEnabled") then
statedriver = {} statedriver = {}
if self:GetStateOption("possess") then
table_insert(statedriver, "[bonusbar:5]11")
end
local stateconfig = self.config.states local stateconfig = self.config.states
if self:GetStateOption("enabled") then if self:GetStateOption("enabled") then
-- arguments will be parsed from left to right, so we have a priority here -- arguments will be parsed from left to right, so we have a priority here
if self:GetStateOption("possess") then
table_insert(statedriver, "[bonusbar:5]11")
end
-- highest priority have our temporary quick-swap keys -- highest priority have our temporary quick-swap keys
for _,v in pairs(modifiers) do for _,v in pairs(modifiers) do
local page = self:GetStateOption(v) local page = self:GetStateOption(v)
+24 -11
View File
@@ -84,6 +84,16 @@ local disabledFunc = function(info)
return not bar:GetStateOption("enabled") return not bar:GetStateOption("enabled")
end end
local stateOffOrCustomOn = function(info)
local bar = module.actionbars[tonumber(info[2])]
return (not bar:GetStateOption("enabled")) or (bar:GetStateOption("customEnabled"))
end
local stateOffOrCustomOff = function(info)
local bar = module.actionbars[tonumber(info[2])]
return (not bar:GetStateOption("enabled")) or (not bar:GetStateOption("customEnabled"))
end
function module:GetStateOptionsTable() function module:GetStateOptionsTable()
local options = { local options = {
enabled = { enabled = {
@@ -99,11 +109,11 @@ function module:GetStateOptionsTable()
type = "description", type = "description",
name = "", name = "",
}, },
actionbar = { autoassist = {
order = 5, order = 3,
type = "toggle", type = "toggle",
name = L["ActionBar Paging"], name = L["Auto-Assist"],
desc = L["Enable Bar Switching based on the actionbar controls provided by the game. \nSee Blizzard Key Bindings for assignments - Usually Shift-Mouse Wheel and Shift+1 - Shift+6."], 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, get = optGetter,
set = optSetter, set = optSetter,
width = "full", width = "full",
@@ -115,14 +125,16 @@ function module:GetStateOptionsTable()
desc = L["Switch this bar to the Possess Bar when possessing a npc (eg. Mind Control)"], desc = L["Switch this bar to the Possess Bar when possessing a npc (eg. Mind Control)"],
get = optGetter, get = optGetter,
set = optSetter, set = optSetter,
disabled = stateOffOrCustomOn,
}, },
autoassist = { actionbar = {
order = 6, order = 6,
type = "toggle", type = "toggle",
name = L["Auto-Assist"], name = L["ActionBar Paging"],
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."], desc = L["Enable Bar Switching based on the actionbar controls provided by the game. \nSee Blizzard Key Bindings for assignments - Usually Shift-Mouse Wheel and Shift+1 - Shift+6."],
get = optGetter, get = optGetter,
set = optSetter, set = optSetter,
disabled = stateOffOrCustomOn,
}, },
def_desc = { def_desc = {
order = 10, order = 10,
@@ -136,7 +148,7 @@ function module:GetStateOptionsTable()
values = validStanceTable, values = validStanceTable,
get = optGetter, get = optGetter,
set = optSetter, set = optSetter,
disabled = disabledFunc, disabled = stateOffOrCustomOn,
}, },
modifiers = { modifiers = {
order = 30, order = 30,
@@ -145,7 +157,7 @@ function module:GetStateOptionsTable()
name = "", name = "",
get = optGetter, get = optGetter,
set = optSetter, set = optSetter,
disabled = disabledFunc, disabled = stateOffOrCustomOn,
args = { args = {
header = { header = {
order = 1, order = 1,
@@ -189,7 +201,7 @@ function module:GetStateOptionsTable()
hidden = function() return not (Bartender4.StanceMap[playerclass]) end, hidden = function() return not (Bartender4.StanceMap[playerclass]) end,
get = optGetter, get = optGetter,
set = optSetter, set = optSetter,
disabled = disabledFunc, disabled = stateOffOrCustomOn,
args = { args = {
stance_header = { stance_header = {
order = 1, order = 1,
@@ -224,6 +236,7 @@ function module:GetStateOptionsTable()
name = L["Copy Conditionals"], name = L["Copy Conditionals"],
desc = L["Create a copy of the auto-generated conditionals in the custom configuration as a base template."], desc = L["Create a copy of the auto-generated conditionals in the custom configuration as a base template."],
func = optSetter, func = optSetter,
disabled = disabledFunc,
}, },
customDesc = { customDesc = {
order = 52, order = 52,
@@ -238,7 +251,7 @@ function module:GetStateOptionsTable()
width = "full", width = "full",
get = optGetter, get = optGetter,
set = optSetter, set = optSetter,
disabled = disabledFunc, disabled = stateOffOrCustomOff,
multiline = true, multiline = true,
}, },
} }
+7 -1
View File
@@ -8,7 +8,7 @@ local Bar = Bartender4.Bar.prototype
local barregistry = Bartender4.Bar.barregistry local barregistry = Bartender4.Bar.barregistry
-- option utilty functions -- option utilty functions
local optGetter, optSetter, visibilityGetter, visibilitySetter, customEnabled local optGetter, optSetter, visibilityGetter, visibilitySetter, customEnabled, customDisabled, customCopy
do do
local getBar, optionMap, callFunc local getBar, optionMap, callFunc
-- maps option keys to function names -- maps option keys to function names
@@ -65,6 +65,11 @@ do
return bar:GetVisibilityOption("custom") return bar:GetVisibilityOption("custom")
end end
function customDisabled(info)
local bar = getBar(info[2])
return not bar:GetVisibilityOption("custom")
end
function customCopy(info) function customCopy(info)
local bar = getBar(info[2]) local bar = getBar(info[2])
bar:CopyCustomConditionals() bar:CopyCustomConditionals()
@@ -250,6 +255,7 @@ function Bar:GetOptionObject()
desc = L["You can use any macro conditionals in the custom string, using \"show\" and \"hide\" as values.\n\nExample: [combat]hide;show"], desc = L["You can use any macro conditionals in the custom string, using \"show\" and \"hide\" as values.\n\nExample: [combat]hide;show"],
width = "full", width = "full",
multiline = true, multiline = true,
disabled = customDisabled,
}, },
}, },
}, },