- fixed up several "hide blizzard frame" options to re-display when the module is disabled and to call blizzard's OnLoad for the frame instead of manually entering every event to re-register

- fixed "show incoming heals" option to be properly toggleable on 4.0 (bad conditional on the 'disabled' option)
- hid "cooldown mode" option on the totems module since there was never more than one choice
This commit is contained in:
Parnic
2010-09-16 02:42:16 +00:00
parent 1f4a4491ea
commit fd6d570e0b
9 changed files with 77 additions and 71 deletions

View File

@ -147,7 +147,7 @@ function IceClassPowerCounter.prototype:GetOptions()
end, end,
order = 35 order = 35
} }
opts["inactiveDisplayMode"] = { opts["inactiveDisplayMode"] = {
type = 'select', type = 'select',
name = 'Inactive mode', name = 'Inactive mode',
@ -216,7 +216,7 @@ end
-- OVERRIDE -- OVERRIDE
function IceClassPowerCounter.prototype:Redraw() function IceClassPowerCounter.prototype:Redraw()
IceClassPowerCounter.super.prototype.Redraw(self) IceClassPowerCounter.super.prototype.Redraw(self)
self:CreateFrame() self:CreateFrame()
end end
@ -234,6 +234,14 @@ function IceClassPowerCounter.prototype:Enable(core)
end end
end end
function IceClassPowerCounter.prototype:Disable(core)
IceClassPowerCounter.super.prototype.Disable(self, core)
if self.moduleSettings.hideBlizz then
self:ShowBlizz()
end
end
function IceClassPowerCounter.prototype:UpdateRunePower() function IceClassPowerCounter.prototype:UpdateRunePower()
local numReady = UnitPower("player", self.unitPower) local numReady = UnitPower("player", self.unitPower)
@ -294,7 +302,7 @@ function IceClassPowerCounter.prototype:CreateFrame()
self.frame:SetPoint("TOP", self.parent, "BOTTOM", self.moduleSettings.hpos, self.moduleSettings.vpos) self.frame:SetPoint("TOP", self.parent, "BOTTOM", self.moduleSettings.hpos, self.moduleSettings.vpos)
self:CreateRuneFrame() self:CreateRuneFrame()
self:SetDisplayMode() self:SetDisplayMode()
end end

View File

@ -313,6 +313,10 @@ end
function FocusHealth.prototype:Disable(core) function FocusHealth.prototype:Disable(core)
FocusHealth.super.prototype.Disable(self, core) FocusHealth.super.prototype.Disable(self, core)
if self.moduleSettings.hideBlizz then
self:ShowBlizz()
end
end end
function FocusHealth.prototype:UpdateEvent(event, unit) function FocusHealth.prototype:UpdateEvent(event, unit)
@ -445,16 +449,7 @@ end
function FocusHealth.prototype:ShowBlizz() function FocusHealth.prototype:ShowBlizz()
FocusFrame:Show() FocusFrame:Show()
FocusFrame:RegisterEvent("PLAYER_ENTERING_WORLD"); FocusFrame:GetScript("OnLoad")(FocusFrame)
FocusFrame:RegisterEvent("PLAYER_FOCUS_CHANGED");
FocusFrame:RegisterEvent("UNIT_HEALTH");
FocusFrame:RegisterEvent("UNIT_LEVEL");
FocusFrame:RegisterEvent("UNIT_FACTION");
FocusFrame:RegisterEvent("UNIT_CLASSIFICATION_CHANGED");
FocusFrame:RegisterEvent("UNIT_AURA");
FocusFrame:RegisterEvent("PLAYER_FLAGS_CHANGED");
FocusFrame:RegisterEvent("PARTY_MEMBERS_CHANGED");
FocusFrame:RegisterEvent("RAID_TARGET_UPDATE");
end end

View File

@ -37,10 +37,7 @@ end
function HolyPower.prototype:ShowBlizz() function HolyPower.prototype:ShowBlizz()
PaladinPowerBar:Show() PaladinPowerBar:Show()
PaladinPowerBar:RegisterEvent("UNIT_POWER"); PaladinPowerBar:GetScript("OnLoad")(PaladinPowerBar)
PaladinPowerBar:RegisterEvent("PLAYER_ENTERING_WORLD");
PaladinPowerBar:RegisterEvent("UNIT_DISPLAYPOWER");
PaladinPowerBar:RegisterEvent("UNIT_AURA");
end end
function HolyPower.prototype:HideBlizz() function HolyPower.prototype:HideBlizz()

View File

@ -113,6 +113,14 @@ function PlayerHealth.prototype:Enable(core)
--self:Update(self.unit) --self:Update(self.unit)
end end
function PlayerHealth.prototype:Disable(core)
PlayerHealth.super.prototype.Disable(self, core)
if self.moduleSettings.hideBlizz then
self:ShowBlizz()
end
end
function PlayerHealth.prototype:HealComm_HealEvent(event, casterGUID, spellID, spellType, endTime, ...) function PlayerHealth.prototype:HealComm_HealEvent(event, casterGUID, spellID, spellType, endTime, ...)
local bFoundMe = false local bFoundMe = false
for i=1, select("#", ...) do for i=1, select("#", ...) do
@ -288,7 +296,7 @@ function PlayerHealth.prototype:GetOptions()
self:Update() self:Update()
end, end,
disabled = function() disabled = function()
return not self.moduleSettings.enabled or not HealComm return not (self.moduleSettings.enabled and (IceHUD.WowVer >= 40000 or HealComm))
end, end,
order = 43.6 order = 43.6
} }
@ -1303,22 +1311,7 @@ end
function PlayerHealth.prototype:ShowBlizz() function PlayerHealth.prototype:ShowBlizz()
PlayerFrame:Show() PlayerFrame:Show()
PlayerFrame:GetScript("OnLoad")(PlayerFrame)
PlayerFrame:RegisterEvent("UNIT_LEVEL")
PlayerFrame:RegisterEvent("UNIT_COMBAT")
PlayerFrame:RegisterEvent("UNIT_FACTION")
PlayerFrame:RegisterEvent("UNIT_MAXMANA")
PlayerFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
PlayerFrame:RegisterEvent("PLAYER_ENTER_COMBAT")
PlayerFrame:RegisterEvent("PLAYER_LEAVE_COMBAT")
PlayerFrame:RegisterEvent("PLAYER_REGEN_DISABLED")
PlayerFrame:RegisterEvent("PLAYER_REGEN_ENABLED")
PlayerFrame:RegisterEvent("PLAYER_UPDATE_RESTING")
PlayerFrame:RegisterEvent("PARTY_MEMBERS_CHANGED")
PlayerFrame:RegisterEvent("PARTY_LEADER_CHANGED")
PlayerFrame:RegisterEvent("PARTY_LOOT_METHOD_CHANGED")
PlayerFrame:RegisterEvent("RAID_ROSTER_UPDATE")
PlayerFrame:RegisterEvent("PLAYTIME_CHANGED")
end end
@ -1349,18 +1342,20 @@ end
function PlayerHealth.prototype:ShowBlizzardParty() function PlayerHealth.prototype:ShowBlizzardParty()
-- Both Pitbull 4 and Xperl use these exact code, so we use it too. -- Both Pitbull 4 and Xperl use these exact code, so we use it too.
for i = 1, 4 do for i = 1, MAX_PARTY_MEMBERS do
local frame = _G["PartyMemberFrame"..i] local frame = _G["PartyMemberFrame"..i]
frame.Show = nil if frame then
frame:GetScript("OnLoad")(frame) frame.Show = nil
frame:GetScript("OnEvent")(frame, "PARTY_MEMBERS_CHANGED") frame:GetScript("OnLoad")(frame)
frame:GetScript("OnEvent")(frame, "PARTY_MEMBERS_CHANGED")
PartyMemberFrame_UpdateMember(frame) PartyMemberFrame_UpdateMember(frame)
end
end end
UIParent:RegisterEvent("RAID_ROSTER_UPDATE")
end end
UIParent:RegisterEvent("RAID_ROSTER_UPDATE")
--function PlayerHealth.prototype:ShowBlizzParty() --function PlayerHealth.prototype:ShowBlizzParty()
-- This loop exists because we need to unregister for events in case the party composition changes. -- This loop exists because we need to unregister for events in case the party composition changes.
-- for i = 1, MAX_PARTY_MEMBERS do -- for i = 1, MAX_PARTY_MEMBERS do

View File

@ -45,7 +45,7 @@ function PlayerInfo.prototype:GetOptions()
disabled = function() disabled = function()
return not self.moduleSettings.enabled return not self.moduleSettings.enabled
end, end,
order = 41 order = 33.1,
} }
return opts return opts
@ -116,7 +116,7 @@ function PlayerInfo.prototype:ShowBlizz()
BuffFrame:Show() BuffFrame:Show()
TemporaryEnchantFrame:Show() TemporaryEnchantFrame:Show()
BuffFrame:RegisterEvent("UNIT_AURA"); BuffFrame:GetScript("OnLoad")(BuffFrame)
end end

View File

@ -184,7 +184,7 @@ end
-- OVERRIDE -- OVERRIDE
function Runes.prototype:Redraw() function Runes.prototype:Redraw()
Runes.super.prototype.Redraw(self) Runes.super.prototype.Redraw(self)
self:CreateFrame() self:CreateFrame()
end end
@ -202,6 +202,14 @@ function Runes.prototype:Enable(core)
end end
end end
function Runes.prototype:Disable(core)
Runes.super.prototype.Disable(self, core)
if self.moduleSettings.hideBlizz then
self:ShowBlizz()
end
end
function Runes.prototype:ResetRuneAvailability() function Runes.prototype:ResetRuneAvailability()
for i=1, self.numRunes do for i=1, self.numRunes do
self:UpdateRunePower(nil, i, true) self:UpdateRunePower(nil, i, true)
@ -381,10 +389,13 @@ end
function Runes.prototype:ShowBlizz() function Runes.prototype:ShowBlizz()
RuneFrame:Show() RuneFrame:Show()
RuneFrame:RegisterEvent("RUNE_POWER_UPDATE"); RuneFrame:GetScript("OnLoad")(RuneFrame)
RuneFrame:RegisterEvent("RUNE_TYPE_UPDATE"); for i=1, self.numRunes do
RuneFrame:RegisterEvent("RUNE_REGEN_UPDATE"); local frame = _G["RuneButtonIndividual"..i]
RuneFrame:RegisterEvent("PLAYER_ENTERING_WORLD"); if frame then
frame:GetScript("OnLoad")(frame)
end
end
end end

View File

@ -39,9 +39,7 @@ end
function ShardCounter.prototype:ShowBlizz() function ShardCounter.prototype:ShowBlizz()
ShardBarFrame:Show() ShardBarFrame:Show()
ShardBarFrame:RegisterEvent("UNIT_POWER"); ShardBarFrame:GetScript("OnLoad")(ShardBarFrame)
ShardBarFrame:RegisterEvent("PLAYER_ENTERING_WORLD");
ShardBarFrame:RegisterEvent("UNIT_DISPLAYPOWER");
end end
function ShardCounter.prototype:HideBlizz() function ShardCounter.prototype:HideBlizz()

View File

@ -549,6 +549,10 @@ function IceTargetHealth.prototype:Disable(core)
IceTargetHealth.super.prototype.Disable(self, core) IceTargetHealth.super.prototype.Disable(self, core)
UnregisterUnitWatch(self.frame) UnregisterUnitWatch(self.frame)
if self.moduleSettings.hideBlizz then
self:ShowBlizz()
end
end end
@ -878,19 +882,10 @@ end
function IceTargetHealth.prototype:ShowBlizz() function IceTargetHealth.prototype:ShowBlizz()
TargetFrame:Show() TargetFrame:Show()
TargetFrame:RegisterEvent("PLAYER_TARGET_CHANGED") TargetFrame:GetScript("OnLoad")(TargetFrame)
TargetFrame:RegisterEvent("UNIT_HEALTH")
TargetFrame:RegisterEvent("UNIT_LEVEL")
TargetFrame:RegisterEvent("UNIT_FACTION")
TargetFrame:RegisterEvent("UNIT_CLASSIFICATION_CHANGED")
TargetFrame:RegisterEvent("UNIT_AURA")
TargetFrame:RegisterEvent("PLAYER_FLAGS_CHANGED")
TargetFrame:RegisterEvent("PARTY_MEMBERS_CHANGED")
TargetFrame:RegisterEvent("RAID_TARGET_UPDATE")
ComboFrame:Show() ComboFrame:Show()
ComboFrame:RegisterEvent("PLAYER_TARGET_CHANGED"); ComboFrame:GetScript("OnLoad")(ComboFrame)
ComboFrame:RegisterEvent("PLAYER_COMBO_POINTS");
end end

View File

@ -124,7 +124,7 @@ function Totems.prototype:GetOptions()
end, end,
order = 35 order = 35
} }
--[[
opts["cooldownMode"] = { opts["cooldownMode"] = {
type = 'select', type = 'select',
name = 'Totem cooldown mode', name = 'Totem cooldown mode',
@ -142,7 +142,7 @@ function Totems.prototype:GetOptions()
end, end,
order = 36 order = 36
} }
]]--
opts["totemGap"] = { opts["totemGap"] = {
type = 'range', type = 'range',
name = 'Totem gap', name = 'Totem gap',
@ -187,7 +187,7 @@ end
-- OVERRIDE -- OVERRIDE
function Totems.prototype:Redraw() function Totems.prototype:Redraw()
Totems.super.prototype.Redraw(self) Totems.super.prototype.Redraw(self)
self:CreateFrame() self:CreateFrame()
end end
@ -198,11 +198,19 @@ function Totems.prototype:Enable(core)
self:RegisterEvent("PLAYER_TOTEM_UPDATE", "UpdateTotem"); self:RegisterEvent("PLAYER_TOTEM_UPDATE", "UpdateTotem");
self:RegisterEvent("PLAYER_ENTERING_WORLD", "ResetTotemAvailability"); self:RegisterEvent("PLAYER_ENTERING_WORLD", "ResetTotemAvailability");
if (self.moduleSettings.hideBlizz) then if self.moduleSettings.hideBlizz then
self:HideBlizz() self:HideBlizz()
end end
end end
function Totems.prototype:Disable(core)
Totems.super.prototype.Disable(self, core)
if self.moduleSettings.hideBlizz then
self:ShowBlizz()
end
end
function Totems.prototype:ResetTotemAvailability() function Totems.prototype:ResetTotemAvailability()
for i=1, self.numTotems do for i=1, self.numTotems do
self:UpdateTotem(nil, totem) self:UpdateTotem(nil, totem)
@ -220,7 +228,7 @@ function Totems.prototype:UpdateTotem(event, totem, ...)
self.frame.graphical[totem].cd:SetCooldown(startTime, duration) self.frame.graphical[totem].cd:SetCooldown(startTime, duration)
self.frame.graphical[totem].cd:Show() self.frame.graphical[totem].cd:Show()
self.frame.graphical[totem]:Show() self.frame.graphical[totem]:Show()
else else
self.frame.graphical[totem].cd:Hide() self.frame.graphical[totem].cd:Hide()
self.frame.graphical[totem]:Hide() self.frame.graphical[totem]:Hide()
end end
@ -267,8 +275,7 @@ end
function Totems.prototype:ShowBlizz() function Totems.prototype:ShowBlizz()
TotemFrame:Show() TotemFrame:Show()
TotemFrame:RegisterEvent("PLAYER_TOTEM_UPDATE"); TotemFrame:GetScript("OnLoad")(TotemFrame)
TotemFrame:RegisterEvent("PLAYER_ENTERING_WORLD");
end end
@ -327,7 +334,7 @@ function Totems.prototype:CreateTotem(i, name)
self.frame.graphical[i]:SetPoint("TOPLEFT", 0, -1 * ((i-1) * (self.totemSize-(MAX_TOTEMS - 1)) + (i-1) + ((i-1) * self.moduleSettings.totemGap))) self.frame.graphical[i]:SetPoint("TOPLEFT", 0, -1 * ((i-1) * (self.totemSize-(MAX_TOTEMS - 1)) + (i-1) + ((i-1) * self.moduleSettings.totemGap)))
end end
self.frame.graphical[i].cd:SetFrameStrata("BACKGROUND") self.frame.graphical[i].cd:SetFrameStrata("BACKGROUND")
self.frame.graphical[i].cd:SetFrameLevel(self.frame.graphical[i]:GetFrameLevel()+1) self.frame.graphical[i].cd:SetFrameLevel(self.frame.graphical[i]:GetFrameLevel()+1)
@ -338,7 +345,7 @@ function Totems.prototype:CreateTotem(i, name)
self.frame.graphical[i].cd:Show() self.frame.graphical[i].cd:Show()
self.frame.graphical[i]:Show() self.frame.graphical[i]:Show()
end end
self.frame.graphical[i].shine:SetTexture("Interface\\ComboFrame\\ComboPoint") self.frame.graphical[i].shine:SetTexture("Interface\\ComboFrame\\ComboPoint")
self.frame.graphical[i].shine:SetBlendMode("ADD") self.frame.graphical[i].shine:SetBlendMode("ADD")
self.frame.graphical[i].shine:SetTexCoord(0.5625, 1, 0, 1) self.frame.graphical[i].shine:SetTexCoord(0.5625, 1, 0, 1)
@ -347,7 +354,7 @@ function Totems.prototype:CreateTotem(i, name)
self.frame.graphical[i].shine:SetWidth(self.totemSize + 25) self.frame.graphical[i].shine:SetWidth(self.totemSize + 25)
self.frame.graphical[i].shine:SetHeight(self.totemSize + 10) self.frame.graphical[i].shine:SetHeight(self.totemSize + 10)
self.frame.graphical[i].shine:Hide() self.frame.graphical[i].shine:Hide()
self.frame.graphical[i]:EnableMouse(true) self.frame.graphical[i]:EnableMouse(true)
self.frame.graphical[i].slot = i; self.frame.graphical[i].slot = i;
self.frame.graphical[i]:SetScript("OnEnter", function(button) GameTooltip:SetOwner(button); GameTooltip:SetTotem(button.slot) end) self.frame.graphical[i]:SetScript("OnEnter", function(button) GameTooltip:SetOwner(button); GameTooltip:SetTotem(button.slot) end)