From 968613450ac5fa03a1f66b6dfe8b2dd6f8a40a30 Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Sat, 3 May 2008 12:55:33 +0000 Subject: [PATCH] Bartender4: - options to configure self-casting - implement right-click self-cast --- ActionBarPrototype.lua | 8 ++++++++ ActionBarStates.lua | 7 ++++--- Bartender4.lua | 2 ++ Button.lua | 7 +++---- Options.lua | 28 +++++++++++++++++++++++++--- TODO.txt | 3 +-- 6 files changed, 43 insertions(+), 12 deletions(-) diff --git a/ActionBarPrototype.lua b/ActionBarPrototype.lua index b522360..dea395c 100644 --- a/ActionBarPrototype.lua +++ b/ActionBarPrototype.lua @@ -131,6 +131,7 @@ function ActionBar:ApplyConfig(config) if not config.position then initialPosition(self) end self:UpdateButtons() + self:UpdateSelfCast(true) self:UpdateStates() end @@ -214,3 +215,10 @@ function ActionBar:SetGrid(state) self:ForAll("HideGrid", true) end end + +function ActionBar:UpdateSelfCast(nostates) + self:ForAll("SetAttribute", "checkselfcast", Bartender4.db.profile.selfcastmodifier and true or nil) + if not nostates then + self:UpdateStates() + end +end diff --git a/ActionBarStates.lua b/ActionBarStates.lua index 69bb5a5..ccf91ea 100644 --- a/ActionBarStates.lua +++ b/ActionBarStates.lua @@ -258,6 +258,7 @@ function module:CreateStanceMap() end function ActionBar:UpdateStates() + self.statebutton = {} if not module.stancemap and module.DefaultStanceMap[playerclass] then module.stancemap = module.DefaultStanceMap[playerclass] end @@ -361,14 +362,14 @@ function ActionBar:AddRightClickState(state) local scrc = Bartender4.db.profile.selfcastrightclick local target = scrc and "player" or nil - self:SetAttribute("unit-S" .. state .. "2", target) + self:SetAttribute("unit-S" .. state .. "Right", target) end function ActionBar:ApplyStateButton() local states1, states2 = {}, {} for _,v in pairs(self.statebutton) do - table_insert(states1, fmt("%s:S%s1;", v, v)) - table_insert(states2, fmt("%s:S%s2;", v, v)) + table_insert(states1, fmt("%s:S%s;", v, v)) + table_insert(states2, fmt("%s:S%sRight;", v, v)) end self:SetAttribute("statebutton", table_concat(states1, "")) self:SetAttribute("statebutton2", table_concat(states2, "")) diff --git a/Bartender4.lua b/Bartender4.lua index 66f9dc7..cdf9c60 100644 --- a/Bartender4.lua +++ b/Bartender4.lua @@ -8,6 +8,8 @@ local defaults = { buttonlock = false, outofrange = "button", colors = { range = { r = 0.8, g = 0.1, b = 0.1 }, mana = { r = 0.5, g = 0.5, b = 1.0 } }, + selfcastmodifier = true, + selfcastrightclick = false, } } diff --git a/Button.lua b/Button.lua index 1c6725b..e807bf8 100644 --- a/Button.lua +++ b/Button.lua @@ -89,7 +89,7 @@ function Bartender4.Button:Create(id, parent) button:SetAttribute("useparent-unit", true) button:SetAttribute("useparent-statebutton", true) button:SetAttribute("hidestates", "-1") - button:SetAttribute("checkselfcast", true) + --button:SetAttribute("checkselfcast", true) button:RegisterForDrag("LeftButton", "RightButton") button:RegisterForClicks("AnyUp") @@ -182,9 +182,8 @@ function onUpdate(self, elapsed) end function Button:SetStateAction(state, action) - for i=1,2 do - self:SetAttribute(("*action-S%d%d"):format(state, i), action) - end + self:SetAttribute(("*action-S%d"):format(state), action) + self:SetAttribute(("*action-S%dRight"):format(state), action) end function Button:CalculateAction() diff --git a/Options.lua b/Options.lua index a4d4b98..f6c53f7 100644 --- a/Options.lua +++ b/Options.lua @@ -44,8 +44,30 @@ local function getOptions() type = "group", name = "Bars", args = { - range = { + selfcastmodifier = { order = 1, + type = "toggle", + name = "Self-Cast by modifier", + desc = "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 = "Right-click Self-Cast", + desc = "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 = "Out of Range Indicator", desc = "Configure how the Out of Range Indicator should display on the buttons.", type = "select", @@ -60,7 +82,7 @@ local function getOptions() values = { none = "No Display", button = "Full Button Mode", hotkey = "Hotkey Mode" }, }, colors = { - order = 3, + order = 13, type = "group", guiInline = true, name = "Colors", @@ -89,7 +111,7 @@ local function getOptions() }, }, tooltip = { - order = 2, + order = 20, name = "Button Tooltip", type = "select", desc = "Configure the Button Tooltip.", diff --git a/TODO.txt b/TODO.txt index 5811bf0..58417bb 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,7 +1,6 @@ Bartender4 TODO List -- Config Settings for self-cast behaviour -- Right-click self-cast +- Option to change self-cast modifier assignment (Blizzard kinda removed that <.<) - Bag Bar - XP/Reputation Bar - Alignment Menu