Mercurial > wow > reaction
comparison modules/PetAction.lua @ 148:de1da46dadb3
moved unitwatch handling into bar
| author | Flick <flickerstreak@gmail.com> |
|---|---|
| date | Fri, 08 May 2009 00:06:53 +0000 |
| parents | 901c91dc1bf2 |
| children | 8cc187143acd |
comparison
equal
deleted
inserted
replaced
| 147:901c91dc1bf2 | 148:de1da46dadb3 |
|---|---|
| 50 ReAction.RegisterCallback(self, "OnCreateBar") | 50 ReAction.RegisterCallback(self, "OnCreateBar") |
| 51 ReAction.RegisterCallback(self, "OnDestroyBar") | 51 ReAction.RegisterCallback(self, "OnDestroyBar") |
| 52 ReAction.RegisterCallback(self, "OnRefreshBar") | 52 ReAction.RegisterCallback(self, "OnRefreshBar") |
| 53 ReAction.RegisterCallback(self, "OnEraseBar") | 53 ReAction.RegisterCallback(self, "OnEraseBar") |
| 54 ReAction.RegisterCallback(self, "OnRenameBar") | 54 ReAction.RegisterCallback(self, "OnRenameBar") |
| 55 ReAction.RegisterCallback(self, "OnConfigModeChanged") | |
| 56 end | 55 end |
| 57 | 56 |
| 58 function module:OnEnable() | 57 function module:OnEnable() |
| 59 ReAction:RegisterBarType(L["Pet Action Bar"], | 58 ReAction:RegisterBarType(L["Pet Action Bar"], |
| 60 { | 59 { |
| 71 end | 70 end |
| 72 | 71 |
| 73 function module:OnCreateBar(event, bar, name) | 72 function module:OnCreateBar(event, bar, name) |
| 74 if bar.config.type == moduleID then | 73 if bar.config.type == moduleID then |
| 75 -- auto show/hide when pet exists | 74 -- auto show/hide when pet exists |
| 76 bar:GetFrame():SetAttribute("unit","pet") | 75 bar:RegisterUnitWatch("pet",true) |
| 77 if not ReAction:GetConfigMode() then | |
| 78 RegisterUnitWatch(bar:GetFrame()) | |
| 79 end | |
| 80 self:OnRefreshBar(event, bar, name) | 76 self:OnRefreshBar(event, bar, name) |
| 81 end | 77 end |
| 82 end | 78 end |
| 83 | 79 |
| 84 function module:OnRefreshBar(event, bar, name) | 80 function module:OnRefreshBar(event, bar, name) |
| 144 function module:OnRenameBar(event, bar, oldname, newname) | 140 function module:OnRenameBar(event, bar, oldname, newname) |
| 145 local b = self.db.profile.buttons | 141 local b = self.db.profile.buttons |
| 146 b[newname], b[oldname] = b[oldname], nil | 142 b[newname], b[oldname] = b[oldname], nil |
| 147 end | 143 end |
| 148 | 144 |
| 149 | |
| 150 function module:OnConfigModeChanged(event, mode) | |
| 151 for _, bar in ReAction:IterateBars() do | |
| 152 if bar and self.buttons[bar] then | |
| 153 for b in bar:IterateButtons() do | |
| 154 b:UpdateActionIDLabel(mode) | |
| 155 end | |
| 156 local f = bar:GetFrame() | |
| 157 if mode then | |
| 158 UnregisterUnitWatch(f) | |
| 159 f:Show() | |
| 160 else | |
| 161 RegisterUnitWatch(f) | |
| 162 end | |
| 163 end | |
| 164 end | |
| 165 end | |
| 166 | 145 |
| 167 ---- Options ---- | 146 ---- Options ---- |
| 168 local Handler = { } | 147 local Handler = { } |
| 169 local meta = { __index = Handler } | 148 local meta = { __index = Handler } |
| 170 | 149 |
