- added a configuration mode to show all bars temporarily so they can be placed

- changed how frames are shown and hidden so we don't call show/hide unnecessarily
- widened the min/max offset numbers to allow greater placement flexibility
This commit is contained in:
Parnic
2008-04-17 02:38:54 +00:00
parent 9555a3db77
commit 3dc2f7f80f
13 changed files with 107 additions and 51 deletions

View File

@ -126,8 +126,8 @@ function IceBarElement.prototype:GetOptions()
type = 'range',
name = '|c' .. self.configColor .. 'Offset|r',
desc = 'Offset of the bar',
min = -1,
max = 10,
min = -10,
max = 15,
step = 1,
get = function()
return self.moduleSettings.offset

View File

@ -54,7 +54,7 @@ function IceCastBar.prototype:Enable(core)
self:RegisterEvent("UNIT_SPELLCAST_CHANNEL_UPDATE", "SpellCastChannelUpdate") -- unit
self:RegisterEvent("UNIT_SPELLCAST_CHANNEL_STOP", "SpellCastChannelStop") -- unit
self.frame:Hide()
self:Show(false)
end
@ -179,7 +179,7 @@ function IceCastBar.prototype:StartBar(action, message)
self.actionMessage = spell .. self:GetShortRank(rank)
end
self.frame:Show()
self:Show(true)
self.frame:SetScript("OnUpdate", function() self:OnUpdate() end)
end
@ -189,7 +189,7 @@ function IceCastBar.prototype:StopBar()
self.actionStartTime = nil
self.actionDuration = nil
self.frame:Hide()
self:Show(false)
self.frame:SetScript("OnUpdate", nil)
end

View File

@ -18,6 +18,7 @@ IceCore.prototype.elements = {}
IceCore.prototype.enabled = nil
IceCore.prototype.presets = {}
IceCore.prototype.settingsHash = nil
IceCore.prototype.bConfigMode = false
-- Constructor --
function IceCore.prototype:init()
@ -96,6 +97,8 @@ end
function IceCore.prototype:Disable()
self:ConfigModeToggle(false)
for i = 1, table.getn(self.elements) do
if (self.elements[i]:IsEnabled()) then
self.elements[i]:Disable(true)
@ -387,6 +390,26 @@ function IceCore.prototype:SetColor(color, r, g, b)
end
function IceCore.prototype:IsInConfigMode()
return self.bConfigMode
end
function IceCore.prototype:ConfigModeToggle(bWantConfig)
self.bConfigMode = bWantConfig
if bWantConfig then
for i = 1, table.getn(self.elements) do
self.elements[i].frame:Show()
end
else
for i = 1, table.getn(self.elements) do
if not self.elements[i]:IsVisible() then
self.elements[i].frame:Hide()
end
end
end
end
-------------------------------------------------------------------------------
-- Presets --

View File

@ -20,6 +20,8 @@ IceElement.moduleSettings = nil
IceElement.prototype.configColor = "ff8888ff"
IceElement.prototype.scalingEnabled = nil
IceElement.prototype.bIsVisible = true
-- Constructor --
-- IceElements are to be instantiated before IceCore is loaded.
-- Therefore we can wait for IceCore to load and then register our
@ -57,7 +59,7 @@ function IceElement.prototype:Create(parent)
self.parent = parent
self:CreateFrame()
self.frame:Hide()
self:Show(false)
end
@ -76,7 +78,7 @@ function IceElement.prototype:Enable(core)
if (not core) then
self.moduleSettings.enabled = true
end
self.frame:Show()
self:Show(true)
end
@ -84,7 +86,7 @@ function IceElement.prototype:Disable(core)
if (not core) then
self.moduleSettings.enabled = false
end
self.frame:Hide()
self:Show(false)
self:UnregisterAllEvents()
end
@ -262,6 +264,25 @@ function IceElement.prototype:FontFactory(size, frame, font, flags)
end
function IceElement.prototype:IsVisible()
return self.bIsVisible
end
function IceElement.prototype:Show(bShouldShow)
if self.bIsVisible == bShouldShow then
return
end
self.bIsVisible = bShouldShow
if not bShouldShow then
self.frame:Hide()
else
self.frame:Show()
end
end
-- Event Handlers -------------------------------------------------------------

View File

@ -451,6 +451,18 @@ IceHUD.options =
order = 94
},
configMode = {
type = 'toggle',
name = '|cffff0000Configuration Mode|r',
desc = 'Puts IceHUD into configuration mode so bars can be placed more easily',
get = function()
return IceHUD.IceCore:IsInConfigMode()
end,
set = function(value)
IceHUD.IceCore:ConfigModeToggle(value)
end,
order = 95
},
}
}

View File

@ -142,7 +142,7 @@ function ComboPoints.prototype:CreateFrame()
self.frame:ClearAllPoints()
self.frame:SetPoint("TOP", self.parent, "BOTTOM", 0, self.moduleSettings.vpos)
self.frame:Show()
self:Show(true)
self:CreateComboFrame()
end

View File

@ -150,10 +150,10 @@ function DruidMana.prototype:Update()
local forms = (UnitPowerType(self.unit) ~= 0)
if (not self.alive or not forms or not self.druidMana or not self.druidManaMax) then
self.frame:Hide()
self:Show(false)
return
else
self.frame:Show()
self:Show(true)
end
self:UpdateBar(self.druidMana / self.druidManaMax, "DruidMana")

View File

@ -46,7 +46,7 @@ function MirrorBar.prototype:Enable(core)
self.frame.bottomUpperText:SetWidth(200)
self.frame.bottomLowerText:SetWidth(200)
self.frame:Hide()
self:Show(false)
end
@ -55,7 +55,7 @@ function MirrorBar.prototype:Create(parent)
MirrorBar.super.prototype.Create(self, parent)
if (self.timer) then
self.frame:Show()
self:Show(true)
end
end
@ -114,14 +114,14 @@ function MirrorBar.prototype:MirrorStart(timer, value, maxValue, scale, paused,
self.startTime = GetTime()
self:Update()
self.frame:Show()
self:Show(true)
self.frame:SetScript("OnUpdate", function() self:OnUpdate(arg1) end)
end
function MirrorBar.prototype:MirrorStop()
self:CleanUp()
self.frame:Hide()
self:Show(false)
self.frame:SetScript("OnUpdate", nil)
end

View File

@ -78,11 +78,11 @@ end
function PetHealth.prototype:CheckPet()
if (UnitExists(self.unit)) then
self.frame:Show()
self:Show(true)
self:PetHappiness(self.unit)
self:Update(self.unit)
else
self.frame:Hide()
self:Show(false)
end
end

View File

@ -73,10 +73,10 @@ end
function PetMana.prototype:CheckPet()
if (UnitExists(self.unit)) then
self.frame:Show()
self:Show(true)
self:Update(self.unit)
else
self.frame:Hide()
self:Show(false)
end
end
@ -98,10 +98,10 @@ function PetMana.prototype:Update(unit)
end
if ((not UnitExists(unit)) or (self.maxMana == 0)) then
self.frame:Hide()
self:Show(false)
return
else
self.frame:Show()
self:Show(true)
end
local color = "PetMana"

View File

@ -143,7 +143,7 @@ function SunderCount.prototype:CreateFrame()
self.frame:ClearAllPoints()
self.frame:SetPoint("TOP", self.parent, "BOTTOM", 0, self.moduleSettings.vpos)
self.frame:Show()
self:Show(true)
self:CreateSunderFrame()
end

View File

@ -260,10 +260,10 @@ function TargetHealth.prototype:Update(unit)
end
if not (UnitExists(unit)) then
self.frame:Hide()
self:Show(false)
return
else
self.frame:Show()
self:Show(true)
end
self:UpdateRaidTargetIcon()

View File

@ -52,10 +52,10 @@ function TargetMana.prototype:Update(unit)
end
if ((not UnitExists(unit)) or (self.maxMana == 0)) then
self.frame:Hide()
self:Show(false)
return
else
self.frame:Show()
self:Show(true)
end