From 170a11c975c0e68a27ca2cc2bec753739d7fa69a Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Sat, 1 Nov 2008 17:08:08 +0100 Subject: [PATCH] Tweaks to the state and visibility configuration --- ActionBarStates.lua | 8 ++++---- Options/ActionBarStates.lua | 35 ++++++++++++++++++++++++----------- Options/Bar.lua | 8 +++++++- 3 files changed, 35 insertions(+), 16 deletions(-) diff --git a/ActionBarStates.lua b/ActionBarStates.lua index fde4e93..3b47dfc 100644 --- a/ActionBarStates.lua +++ b/ActionBarStates.lua @@ -71,14 +71,14 @@ function ActionBar:UpdateStates(returnOnly) if returnOnly or not self:GetStateOption("customEnabled") then statedriver = {} - if self:GetStateOption("possess") then - table_insert(statedriver, "[bonusbar:5]11") - end - local stateconfig = self.config.states if self:GetStateOption("enabled") then -- 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 for _,v in pairs(modifiers) do local page = self:GetStateOption(v) diff --git a/Options/ActionBarStates.lua b/Options/ActionBarStates.lua index f689981..91d055d 100644 --- a/Options/ActionBarStates.lua +++ b/Options/ActionBarStates.lua @@ -84,6 +84,16 @@ local disabledFunc = function(info) return not bar:GetStateOption("enabled") 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() local options = { enabled = { @@ -99,11 +109,11 @@ function module:GetStateOptionsTable() type = "description", name = "", }, - actionbar = { - order = 5, + autoassist = { + order = 3, type = "toggle", - name = L["ActionBar Paging"], - 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."], + 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 = "full", @@ -115,14 +125,16 @@ function module:GetStateOptionsTable() desc = L["Switch this bar to the Possess Bar when possessing a npc (eg. Mind Control)"], get = optGetter, set = optSetter, + disabled = stateOffOrCustomOn, }, - autoassist = { + actionbar = { 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."], + name = L["ActionBar Paging"], + 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, set = optSetter, + disabled = stateOffOrCustomOn, }, def_desc = { order = 10, @@ -136,7 +148,7 @@ function module:GetStateOptionsTable() values = validStanceTable, get = optGetter, set = optSetter, - disabled = disabledFunc, + disabled = stateOffOrCustomOn, }, modifiers = { order = 30, @@ -145,7 +157,7 @@ function module:GetStateOptionsTable() name = "", get = optGetter, set = optSetter, - disabled = disabledFunc, + disabled = stateOffOrCustomOn, args = { header = { order = 1, @@ -189,7 +201,7 @@ function module:GetStateOptionsTable() hidden = function() return not (Bartender4.StanceMap[playerclass]) end, get = optGetter, set = optSetter, - disabled = disabledFunc, + disabled = stateOffOrCustomOn, args = { stance_header = { order = 1, @@ -224,6 +236,7 @@ function module:GetStateOptionsTable() name = L["Copy Conditionals"], desc = L["Create a copy of the auto-generated conditionals in the custom configuration as a base template."], func = optSetter, + disabled = disabledFunc, }, customDesc = { order = 52, @@ -238,7 +251,7 @@ function module:GetStateOptionsTable() width = "full", get = optGetter, set = optSetter, - disabled = disabledFunc, + disabled = stateOffOrCustomOff, multiline = true, }, } diff --git a/Options/Bar.lua b/Options/Bar.lua index c607135..00e7462 100644 --- a/Options/Bar.lua +++ b/Options/Bar.lua @@ -8,7 +8,7 @@ local Bar = Bartender4.Bar.prototype local barregistry = Bartender4.Bar.barregistry -- option utilty functions -local optGetter, optSetter, visibilityGetter, visibilitySetter, customEnabled +local optGetter, optSetter, visibilityGetter, visibilitySetter, customEnabled, customDisabled, customCopy do local getBar, optionMap, callFunc -- maps option keys to function names @@ -65,6 +65,11 @@ do return bar:GetVisibilityOption("custom") end + function customDisabled(info) + local bar = getBar(info[2]) + return not bar:GetVisibilityOption("custom") + end + function customCopy(info) local bar = getBar(info[2]) 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"], width = "full", multiline = true, + disabled = customDisabled, }, }, },