Mercurial > wow > reaction
comparison modules/Action.lua @ 113:77bb68eb402b
Fixed bug with mindcontrol actions: simplified action attributes
| author | Flick <flickerstreak@gmail.com> |
|---|---|
| date | Fri, 09 Jan 2009 18:11:12 +0000 |
| parents | 410d036c43b2 |
| children | fb48811a8736 |
comparison
equal
deleted
inserted
replaced
| 112:a66595385917 | 113:77bb68eb402b |
|---|---|
| 934 | 934 |
| 935 self.hotkey = f.hotkey | 935 self.hotkey = f.hotkey |
| 936 self.border = _G[name.."Border"] | 936 self.border = _G[name.."Border"] |
| 937 | 937 |
| 938 f:SetAttribute("action", config.actionID) | 938 f:SetAttribute("action", config.actionID) |
| 939 f:SetAttribute("default-action", config.actionID) | |
| 939 -- install mind control actions for all buttons just for simplicity | 940 -- install mind control actions for all buttons just for simplicity |
| 940 if self.idx <= 12 then | 941 if self.idx <= 12 then |
| 941 f:SetAttribute("*action-mc", 120 + self.idx) | 942 f:SetAttribute("mindcontrol-action", 120 + self.idx) |
| 942 end | 943 end |
| 943 | 944 |
| 944 -- set a _childupdate handler, called within the header's context | 945 -- set a _childupdate handler, called within the header's context |
| 945 f:SetAttribute("_childupdate", | 946 f:SetAttribute("_childupdate", |
| 946 -- function _childupdate(self, snippetid, message) | 947 -- function _childupdate(self, snippetid, message) |
| 947 [[ | 948 [[ |
| 948 local action = "action" | 949 local action = "default-action" |
| 949 if doMindControl and GetBonusBarOffset() == 5 then | 950 if doMindControl and GetBonusBarOffset() == 5 then |
| 950 action = "*action-mc" | 951 action = "mindcontrol-action" |
| 951 elseif page and state and page[state] then | 952 elseif page and state and page[state] then |
| 952 action = "*action-"..page[state] | 953 action = "action-"..page[state] |
| 953 end | 954 end |
| 954 local value = self:GetAttribute(action) | 955 local value = self:GetAttribute(action) |
| 955 self:SetAttribute("action",value) | 956 if value then |
| 957 self:SetAttribute("action",value) | |
| 958 end | |
| 956 ]]) | 959 ]]) |
| 957 | 960 |
| 958 -- install drag wrappers to lock buttons | 961 -- install drag wrappers to lock buttons |
| 959 bar:GetFrame():WrapScript(f, "OnDragStart", | 962 bar:GetFrame():WrapScript(f, "OnDragStart", |
| 960 -- OnDragStart(self, button, kind, value, ...) | 963 -- OnDragStart(self, button, kind, value, ...) |
| 1057 if self.config.pageactions[page] then | 1060 if self.config.pageactions[page] then |
| 1058 IDAlloc:Release(self.config.pageactions[page]) | 1061 IDAlloc:Release(self.config.pageactions[page]) |
| 1059 end | 1062 end |
| 1060 self.config.pageactions[page] = id | 1063 self.config.pageactions[page] = id |
| 1061 IDAlloc:Acquire(self.config.pageactions[page]) | 1064 IDAlloc:Acquire(self.config.pageactions[page]) |
| 1062 self.frame:SetAttribute(("*action-page%d"):format(page),id) | 1065 self.frame:SetAttribute(("action-page%d"):format(page),id) |
| 1063 else | 1066 else |
| 1064 IDAlloc:Release(self.config.actionID) | 1067 IDAlloc:Release(self.config.actionID) |
| 1065 self.config.actionID = id | 1068 self.config.actionID = id |
| 1066 IDAlloc:Acquire(self.config.actionID) | 1069 IDAlloc:Acquire(self.config.actionID) |
| 1067 self.frame:SetAttribute("action",id) | 1070 self.frame:SetAttribute("action",id) |
| 1068 if self.config.pageactions then | 1071 if self.config.pageactions then |
| 1069 self.config.pageactions[1] = id | 1072 self.config.pageactions[1] = id |
| 1070 self.frame:SetAttribute("*action-page1",id) | 1073 self.frame:SetAttribute("action-page1",id) |
| 1071 end | 1074 end |
| 1072 end | 1075 end |
| 1073 end | 1076 end |
| 1074 | 1077 |
| 1075 function Button:RefreshPages( force ) | 1078 function Button:RefreshPages( force ) |
| 1085 if i > 1 then | 1088 if i > 1 then |
| 1086 c[i] = IDAlloc:Acquire(c[i], self.config.actionID + (i-1)*self.bar:GetNumButtons()) | 1089 c[i] = IDAlloc:Acquire(c[i], self.config.actionID + (i-1)*self.bar:GetNumButtons()) |
| 1087 else | 1090 else |
| 1088 c[i] = self.config.actionID -- page 1 is the same as the base actionID | 1091 c[i] = self.config.actionID -- page 1 is the same as the base actionID |
| 1089 end | 1092 end |
| 1090 f:SetAttribute(("*action-page%d"):format(i),c[i]) | 1093 f:SetAttribute(("action-page%d"):format(i),c[i]) |
| 1091 end | 1094 end |
| 1092 for i = nPages+1, #c do | 1095 for i = nPages+1, #c do |
| 1093 IDAlloc:Release(c[i]) | 1096 IDAlloc:Release(c[i]) |
| 1094 c[i] = nil | 1097 c[i] = nil |
| 1095 f:SetAttribute(("*action-page%d"):format(i),nil) | 1098 f:SetAttribute(("action-page%d"):format(i),nil) |
| 1096 end | 1099 end |
| 1097 self.nPages = nPages | 1100 self.nPages = nPages |
| 1098 end | 1101 end |
| 1099 end | 1102 end |
| 1100 | 1103 |
