Mercurial > wow > reaction
diff classes/ActionButton.lua @ 129:28b430de5875
More fixes for new action button
author | Flick <flickerstreak@gmail.com> |
---|---|
date | Fri, 06 Mar 2009 23:44:33 +0000 |
parents | 729232aeeb5e |
children | e39d80bb0b7a |
line wrap: on
line diff
--- a/classes/ActionButton.lua Thu Mar 05 01:28:48 2009 +0000 +++ b/classes/ActionButton.lua Fri Mar 06 23:44:33 2009 +0000 @@ -2,7 +2,6 @@ local L = ReAction.L local _G = _G local CreateFrame = CreateFrame -local GetBindingKey = GetBindingKey local format = string.format local IsUsableAction = IsUsableAction local IsEquippedAction = IsEquippedAction @@ -120,10 +119,10 @@ local _onReceiveDrag = -- function(self, button, kind, value, ...) [[ - if kind == "spell" or kind == "item" or kind == "macro" then - -- assume it's a valid action - self:SetAttribute("hasaction-"..self:GetAttribute("action"),true) + if kind ~= "spell" and kind ~= "item" and kind ~= "macro" then + return kind, value, ... end + self:SetAttribute("hasaction-"..self:GetAttribute("action"),true) return "action", self:GetAttribute("action") ]] @@ -162,7 +161,8 @@ function Action:New( idx, barConfig, bar, idHint ) local name = format("ReAction_%s_Action_%d",bar:GetName(),idx) - self = Super.New(self, name, barConfig, bar, idx, "SecureActionButtonTemplate, ActionButtonTemplate" ) + self = Super.New(self, name, barConfig.buttons[idx], bar, idx, "SecureActionButtonTemplate, ActionButtonTemplate" ) + self.barConfig = barConfig local f = self:GetFrame() local barFrame = bar:GetFrame() @@ -193,7 +193,6 @@ f:SetAttribute("type","action") f:SetAttribute("checkselfcast", true) f:SetAttribute("checkfocuscast", true) - f:SetAttribute("useparent-unit", true) f:SetAttribute("action", config.actionID) f:SetAttribute("default-action", config.actionID) f:SetAttribute("bar-idx",idx) @@ -258,8 +257,14 @@ Super.Destroy(self) end +function Action:GetBarConfig() + -- this is the per-bar Action module config structure, + -- not the config structure of the bar itself + return self.barConfig +end + function Action:Refresh() - self.bar:PlaceButton(self, 36, 36) + Super.Refresh(self) self:RefreshPages() self:InstallVehicle() self:ShowGrid(not self:GetBarConfig().hideEmpty) @@ -536,7 +541,8 @@ id = tonumber(id) page = tonumber(page) if id == nil or id < 1 or id > 120 then - error("Action:SetActionID - invalid action ID") + ReAction:UserError(L["Action ID range is 1-120"]) + return end if page and page ~= 1 then if not self.config.pageactions then @@ -574,12 +580,12 @@ else c[i] = self.config.actionID -- page 1 is the same as the base actionID end - f:SetAttribute(("action-page%d"):format(i),c[i]) + f:SetAttribute("action-page"..i,c[i]) end for i = nPages+1, #c do self:ReleaseActionID(c[i]) c[i] = nil - f:SetAttribute(("action-page%d"):format(i),nil) + f:SetAttribute("action-page"..i,nil) end self.nPages = nPages end