Mercurial > wow > reaction
changeset 123:943eed2c7def
Fixes for new ActionButton implementation
author | Flick <flickerstreak@gmail.com> |
---|---|
date | Mon, 23 Feb 2009 19:41:11 +0000 |
parents | a2d2f23137c8 |
children | 0c5017f6062d |
files | classes/ActionButton.lua classes/Bar.lua classes/Button.lua classes/classes.xml |
diffstat | 4 files changed, 35 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/classes/ActionButton.lua Mon Feb 23 18:56:57 2009 +0000 +++ b/classes/ActionButton.lua Mon Feb 23 19:41:11 2009 +0000 @@ -155,13 +155,9 @@ ReAction.Button.Action = Action function Action:New( idx, config, bar, idHint ) - self = Super.New( - self, - format("ReAction_%s_Action_%d",bar:GetName(),idx), - config, - bar, - idx, - "ActionButtonTemplate, SecureActionButtonTemplate" ) + local name = format("ReAction_%s_Action_%d",bar:GetName(),idx) + + self = Super.New(self, name, config, bar, idx, "ActionButtonTemplate, SecureActionButtonTemplate" ) local f = self:GetFrame() local barFrame = bar:GetFrame() @@ -207,7 +203,7 @@ f:SetScript("PostClick", function(frame, ...) self:PostClick(...) end) f:SetScript("OnUpdate", function(frame, elapsed) self:OnUpdate(elapsed) end) f:SetScript("OnDragStart", function(frame) self:OnDragStart() end) - f:SetScript("OnReceiveDrag", function(frame), self:OnReceiveDrag() end) + f:SetScript("OnReceiveDrag", function(frame) self:OnReceiveDrag() end) -- secure handlers f:SetAttribute("_childupate", _childupdate) @@ -234,12 +230,16 @@ bar:SkinButton(self) -- initial display - self:ShowGrid(not barFrame:GetConfig().hideEmpty) + self:ShowGrid(not bar:GetConfig().hideEmpty) if ReAction:GetConfigMode() then self:ShowGrid(true) end + f:Show() + self:Refresh() + + return self end function Action:Destroy() @@ -299,8 +299,10 @@ -- so that the showgrid secure handler can make decisions accordingly local f = self:GetFrame() f:SetAttribute("hasaction-"..self.config.actionID, HasAction(self.config.actionID)) - for i = 1, self.nPages do - f:SetAttribute("hasaction-"..self.config.pageactions[i], HasAction(self.config.pageactions[i]) + if self.config.pageactions then + for i = 1, self.nPages do + f:SetAttribute("hasaction-"..self.config.pageactions[i], HasAction(self.config.pageactions[i])) + end end -- the following is an out-of-combat show/hide to supplement the secure -- handling and clean up after it when it guesses @@ -330,7 +332,6 @@ self.rangeTimer = nil f:SetNormalTexture("Interface\\Buttons\\UI-Quickslot") hotkey:SetVertexColor(0.6, 0.6, 0.6) - end end end @@ -455,7 +456,7 @@ else self:UpdateUsable() end - frame.rangeTimer = TOOLTIP_UPDATE_TIME + self.rangeTimer = TOOLTIP_UPDATE_TIME end end end @@ -526,7 +527,7 @@ end end -function Action:SetupBarHeader( bar ) -- call this as a static method +function Action.SetupBarHeader( bar ) -- call this as a static method local f = bar:GetFrame() local c = bar:GetConfig() f:SetAttribute("mindcontrol",c.mindcontrol) @@ -551,6 +552,18 @@ end +function Action.SetButtonLock( bar, lock, lockCombat ) -- call this as a static method + local f = bar:GetFrame() + f:SetAttribute("lockbuttons",lock) + f:SetAttribute("lockbuttonscombat",lockCombat) + f:Execute( + [[ + lockButtons = self:GetAttribute("lockbuttons") + lockButtonsCombat = self:GetAttribute("lockbuttonscombat") + ]]) +end + + function Action:ShowVehicleExit(show) local f = self:GetFrame() local tx = f.vehicleExitTexture
--- a/classes/Bar.lua Mon Feb 23 18:56:57 2009 +0000 +++ b/classes/Bar.lua Mon Feb 23 19:41:11 2009 +0000 @@ -77,6 +77,10 @@ f:ClearAllPoints() end +function Bar:GetConfig() + return self.config +end + function Bar:OnConfigModeChanged(event, mode) self:ShowControls(mode) -- Bar:ShowControls() defined in Overlay.lua end
--- a/classes/Button.lua Mon Feb 23 18:56:57 2009 +0000 +++ b/classes/Button.lua Mon Feb 23 19:41:11 2009 +0000 @@ -111,13 +111,13 @@ if not poolID or not maxID then error("AcquireActionID: must setup pool first with SetActionIDPool") end - local pool = pools[poolID] + local pool = idPools[poolID] if not pool then pool = { nWraps = 0, useCount = { } } for i = 1, maxID do pool.useCount[i] = 0 end - pools[poolID] = pool + idPools[poolID] = pool end local useCount = pool.useCount if id == nil then @@ -159,7 +159,7 @@ if not poolID then error("ReleaseActionID: must setup pool first with SetActionIDPool") end - local pool = pools[poolID] + local pool = idPools[poolID] if pool and id and pool.useCount[id] then pool.useCount[id] = pool.useCount[id] - 1 pool.nWraps = min(pool.useCount[id], pool.nWraps)