Mercurial > wow > reaction
diff classes/Bar.lua @ 156:611e6ce08717
Use state-unitexists for unitwatch
author | Flick <flickerstreak@gmail.com> |
---|---|
date | Mon, 18 May 2009 23:08:34 +0000 |
parents | 806a61b331a0 |
children | e77f716af1b7 |
line wrap: on
line diff
--- a/classes/Bar.lua Fri May 15 22:38:19 2009 +0000 +++ b/classes/Bar.lua Mon May 18 23:08:34 2009 +0000 @@ -18,6 +18,7 @@ state = nil set_state = nil state_override = nil + unit_exists = nil showAll = false hidden = false @@ -36,19 +37,12 @@ local oldState = state state = state_override or set_state or state + local hide = nil if state then local settings = settings[state] if settings then -- show/hide - local h = settings.hide and not showAll - if h ~= hidden then - if h then - self:Hide() - else - self:Show() - end - hidden = h - end + hide = settings.hide -- re-anchor local old_anchor = activeStates.anchor activeStates.anchor = settings.anchorEnable and state @@ -82,6 +76,17 @@ end end + -- hide if state or unit_exists says to + hide = not showAll and (hide or unithide) + if hide ~= hidden then + hidden = hide + if hide then + self:Hide() + else + self:Show() + end + end + for _, attr in pairs(extensions) do control:RunAttribute(attr) end @@ -110,7 +115,7 @@ local _onstate_unitexists = -- function( self, stateid, newstate ) [[ - + unithide = not newstate ]] .. _reaction_refresh local _onclick = -- function( self, button, down ) @@ -343,7 +348,6 @@ function Bar:SetConfigMode(mode) self:SetSecureData("showAll",mode) - self:UpdateUnitWatch() self:ShowControls(mode) for b in self:IterateButtons() do b:ShowGridTemp(mode) @@ -353,7 +357,6 @@ function Bar:SetKeybindMode(mode) self:SetSecureData("showAll",mode) - self:UpdateUnitWatch() for b in self:IterateButtons() do b:SetKeybindMode(mode) end @@ -441,19 +444,6 @@ end end -function Bar:UpdateUnitWatch() - if self.unitwatch then - if self.unitwatchActive and (ReAction:GetConfigMode() or ReAction:GetKeybindMode()) then - UnregisterUnitWatch(self:GetFrame()) - self.unitwatchActive = false - elseif not self.unitwatchActive then - RegisterUnitWatch(self:GetFrame()) - self.unitwatchActive = true - end - self:RefreshSecureState() - end -end - function Bar:ShowControls(show) if show then if not self.overlay then @@ -590,8 +580,13 @@ if unit then f:SetAttribute("unit",unit) end + if enable then + RegisterUnitWatch(self:GetFrame(),true) + elseif self.unitwatch then + UnregisterUnitWatch(self:GetFrame()) + end self.unitwatch = enable - self:UpdateUnitWatch() + self:RefreshSecureState() end -- set a keybind to push a value into "state-reaction" attribute