Mercurial > wow > reaction
comparison modules/ReAction_Action/ReAction_Action.lua @ 52:c9df7866ff31
Added anchor snapping
author | Flick <flickerstreak@gmail.com> |
---|---|
date | Thu, 24 Apr 2008 19:19:42 +0000 |
parents | c3c64e2def50 |
children | 7e09c02ae620 |
comparison
equal
deleted
inserted
replaced
51:c964fb84560c | 52:c9df7866ff31 |
---|---|
46 function module:OnDisable() | 46 function module:OnDisable() |
47 ReAction:UnregisterDefaultBarConfig(L["Action Bar"]) | 47 ReAction:UnregisterDefaultBarConfig(L["Action Bar"]) |
48 end | 48 end |
49 | 49 |
50 function module:ApplyToBar(bar) | 50 function module:ApplyToBar(bar) |
51 if bar.config.type == "actionbar" then | 51 self:RefreshBar(bar) |
52 self:RefreshBar(bar) | |
53 end | |
54 end | 52 end |
55 | 53 |
56 function module:RefreshBar(bar) | 54 function module:RefreshBar(bar) |
57 if bar.config.type == "actionbar" then | 55 if bar.config.type == "actionbar" then |
58 if self.buttons[bar] == nil then | 56 if self.buttons[bar] == nil then |
71 for i = 1, n do | 69 for i = 1, n do |
72 if btnCfg[i] == nil then | 70 if btnCfg[i] == nil then |
73 btnCfg[i] = {} | 71 btnCfg[i] = {} |
74 end | 72 end |
75 if btns[i] == nil then | 73 if btns[i] == nil then |
76 btns[i] = self.BtnClass:new(bar,i,btnCfg[i]) | 74 local ok, b = pcall(self.BtnClass.new, self.BtnClass, bar, i, btnCfg[i]) |
75 if ok and b then | |
76 btns[i] = b | |
77 end | |
77 else | 78 else |
78 btns[i]:Refresh(bar,i) | 79 btns[i]:Refresh(bar,i) |
79 end | 80 end |
80 end | 81 end |
81 for i = n+1, #btns do | 82 for i = n+1, #btns do |
82 btns[i] = btns[i]:Destroy() | 83 if btns[i] then |
83 if btnCfg[i] then | 84 btns[i] = btns[i]:Destroy() |
84 btnCfg[i] = nil | 85 if btnCfg[i] then |
86 btnCfg[i] = nil | |
87 end | |
85 end | 88 end |
86 end | 89 end |
87 end | 90 end |
88 end | 91 end |
89 | 92 |
140 end | 143 end |
141 end | 144 end |
142 end | 145 end |
143 | 146 |
144 function module:showActionIDLabel(button) | 147 function module:showActionIDLabel(button) |
145 if not button.actionIDLabel then | 148 if not button.actionIDLabel and button:GetActionID() then |
146 local label = button:GetFrame():CreateFontString(nil,"OVERLAY","GameFontNormalLarge") | 149 local label = button:GetFrame():CreateFontString(nil,"OVERLAY","GameFontNormalLarge") |
147 label:SetAllPoints() | 150 label:SetAllPoints() |
148 label:SetJustifyH("CENTER") | 151 label:SetJustifyH("CENTER") |
149 label:SetShadowColor(0,0,0,1) | 152 label:SetShadowColor(0,0,0,1) |
150 label:SetShadowOffset(2,-2) | 153 label:SetShadowOffset(2,-2) |
170 if rawget(self,i) == nil then | 173 if rawget(self,i) == nil then |
171 rawset(self,i,1) | 174 rawset(self,i,1) |
172 return i | 175 return i |
173 end | 176 end |
174 end | 177 end |
178 error("ran out of action IDs") | |
175 else | 179 else |
176 local c = rawget(self,idx) or 0 | 180 local c = rawget(self,idx) or 0 |
177 rawset(self,idx,c+1) | 181 rawset(self,idx,c+1) |
178 return idx | 182 return idx |
179 end | 183 end |
236 f:SetParent(UIParent) | 240 f:SetParent(UIParent) |
237 f:ClearAllPoints() | 241 f:ClearAllPoints() |
238 if self.name then | 242 if self.name then |
239 _G[self.name] = nil | 243 _G[self.name] = nil |
240 end | 244 end |
241 ActionIDList[self.config.actionID] = nil | 245 if self.config.actionID then |
246 ActionIDList[self.config.actionID] = nil | |
247 end | |
242 self.frame = nil | 248 self.frame = nil |
243 self.config = nil | 249 self.config = nil |
244 self.bar = nil | 250 self.bar = nil |
245 end | 251 end |
246 | 252 |