Mercurial > wow > reaction
comparison modules/ReAction_PetAction/ReAction_PetAction.lua @ 60:44649a10378d
Fixed options handling to create a separate table for each bar instead of a shared table with proxy handler.
Also simplified options registration and moved some options around.
| author | Flick <flickerstreak@gmail.com> |
|---|---|
| date | Sat, 10 May 2008 00:08:01 +0000 |
| parents | 7430a8dd4e90 |
| children | 768be7eb22a0 |
comparison
equal
deleted
inserted
replaced
| 59:7430a8dd4e90 | 60:44649a10378d |
|---|---|
| 25 buttons = { } | 25 buttons = { } |
| 26 } | 26 } |
| 27 } | 27 } |
| 28 ) | 28 ) |
| 29 self.buttons = { } | 29 self.buttons = { } |
| 30 | 30 self.options = setmetatable({},{__mode="k"}) |
| 31 ReAction:RegisterOptions("global", self, { | |
| 32 }) | |
| 33 | |
| 34 ReAction:RegisterOptions("bar", self, { | |
| 35 type = "group", | |
| 36 name = L["Pet Buttons"], | |
| 37 hidden = "BarOptionsHidden", | |
| 38 args = { | |
| 39 } | |
| 40 }) | |
| 41 end | 31 end |
| 42 | 32 |
| 43 function module:OnEnable() | 33 function module:OnEnable() |
| 44 ReAction:RegisterBarType(L["Pet Action Bar"], | 34 ReAction:RegisterBarType(L["Pet Action Bar"], |
| 45 { | 35 { |
| 131 for _, b in pairs(self.buttons[bar]) do | 121 for _, b in pairs(self.buttons[bar]) do |
| 132 if b then | 122 if b then |
| 133 if mode then | 123 if mode then |
| 134 self:showActionIDLabel(b) | 124 self:showActionIDLabel(b) |
| 135 else | 125 else |
| 136 ReAction:Print("Hiding action id "..b:GetActionID()) | |
| 137 self:hideActionIDLabel(b) | 126 self:hideActionIDLabel(b) |
| 138 end | 127 end |
| 139 end | 128 end |
| 140 end | 129 end |
| 141 local f = bar:GetFrame() | 130 local f = bar:GetFrame() |
| 164 end | 153 end |
| 165 | 154 |
| 166 function module:hideActionIDLabel(button) | 155 function module:hideActionIDLabel(button) |
| 167 if button:GetFrame().actionIDLabel then | 156 if button:GetFrame().actionIDLabel then |
| 168 button:GetFrame().actionIDLabel:Hide() | 157 button:GetFrame().actionIDLabel:Hide() |
| 169 else | 158 end |
| 170 ReAction:Print("actionIDLabel not found") | 159 end |
| 171 end | 160 |
| 172 end | 161 ---- Options ---- |
| 173 | 162 function module:GetBarOptions(bar) |
| 174 ---- Options handlers ---- | 163 if not self.options[bar] then |
| 175 function module:BarOptionsHidden(bar) | 164 self.options[bar] = { |
| 176 return bar.config.type ~= moduleID | 165 type = "group", |
| 166 name = L["Pet Buttons"], | |
| 167 hidden = function() return bar.config.type ~= moduleID end, | |
| 168 args = { | |
| 169 } | |
| 170 } | |
| 171 end | |
| 172 return self.options[bar] | |
| 177 end | 173 end |
| 178 | 174 |
| 179 | 175 |
| 180 | 176 |
| 181 -- use-count of action IDs | 177 -- use-count of action IDs |
