- Most modules now support a new bar filling mode: Expanding outwards from the middle.

This commit is contained in:
rokiyo
2010-10-30 15:08:05 +00:00
parent 7abe2276fb
commit 52a0e26759
6 changed files with 694 additions and 649 deletions

View File

@ -54,18 +54,35 @@ function IceBarElement.prototype:Enable()
self.moduleSettings.myTagVersion = IceHUD.CurrTagVersion
end
-- fixup for the new 'invert' option
-- fixup for the old new 'invert' option. (This was here before I got here - Andre)
if not self.moduleSettings.updatedReverseInverse then
self.moduleSettings.updatedReverseInverse = true
if self.moduleSettings.reverse then
self.moduleSettings.reverse = false
self.moduleSettings.inverse = true
self.moduleSettings.inverse = "NORMAL"
self:SetBarFramePoints(self.barFrame)
end
end
-- fixup for the new new 'invert' option
-- This is the new fixup code... Not sure if I'm doin' it right, or if the old and the new fixups can be merged.
-- The way I figure it, someone who hasn't updated in like forever might not have had either fixup occur, and yet
-- people who have been updating frequently will have already had the old fixup occur... DUN DUN DUN.
-- Also... Setting the module default for moduleSettings.inverse seemed to automatically set all my characters
-- to that default... So I'm not I can test whether or not my fixup does what I think it does. o.O
if not self.moduleSettings.updatedInverseExpand then
self.moduleSettings.updatedInverseExpand = true
if self.moduleSettings.inverse == true then
self.moduleSettings.inverse = "INVERSE"
else
self.moduleSettings.inverse = "NORMAL"
end
self:SetBarFramePoints(self.barFrame)
end
self:RegisterFontStrings()
-- allows frames that show/hide via RegisterUnitWatch to not show text when they shouldn't
@ -124,7 +141,7 @@ function IceBarElement.prototype:GetDefaultSettings()
settings["side"] = IceCore.Side.Left
settings["offset"] = 1
settings["scale"] = 1
settings["inverse"] = false
settings["inverse"] = "NORMAL"
settings["reverse"] = false
settings["barFontSize"] = 12
settings["lockUpperTextAlpha"] = true
@ -146,13 +163,26 @@ function IceBarElement.prototype:GetDefaultSettings()
settings["shouldUseOverride"] = false
settings["rotateBar"] = false
settings["markers"] = {}
settings["bAllowExpand"] = true
return settings
end
do
local function getFillOptions(self)
local values = {
["NORMAL"] = "Normal",
["INVERSE"] = "Inverse",
}
if self.moduleSettings.bAllowExpand then
values["EXPAND"] = "Expanding"
end
-- OVERRIDE
function IceBarElement.prototype:GetOptions()
return values
end
-- OVERRIDE
function IceBarElement.prototype:GetOptions()
local opts = IceBarElement.super.prototype.GetOptions(self)
opts["headerLookAndFeel"] = {
@ -232,9 +262,10 @@ function IceBarElement.prototype:GetOptions()
opts["inverse"] =
{
type = 'toggle',
type = 'select',
name = L["Invert bar"],
desc = L["Controls which direction the bar fills up. With this checked, the bar will fill opposite from normal (e.g. for health: 0% at the top, 100% at the bottom)."],
desc = L["Controls what it means for the bar to be filled. A normal bar will grow larger as the value grows from 0% to 100%. A reversed bar will shrink as the value grows from 0% to 100%."],
values = getFillOptions(self),
get = function()
return self.moduleSettings.inverse
end,
@ -305,7 +336,7 @@ function IceBarElement.prototype:GetOptions()
end,
order = 29
}
if not self.moduleSettings.hideAnimationSettings then
if not self.moduleSettings.hideAnimationSettings then
opts["headerAnimation"] = {
type = 'header',
name = L["Animation Settings"],
@ -348,7 +379,7 @@ if not self.moduleSettings.hideAnimationSettings then
end,
order = 112
}
end
end
opts["widthModifier"] =
{
@ -453,7 +484,7 @@ end
values = IceHUD.validBarList,
order = 30.08
}
if not self.moduleSettings.shouldHideBarRotation then
if not self.moduleSettings.shouldHideBarRotation then
opts["barRotate"] =
{
type = 'toggle',
@ -475,7 +506,7 @@ if not self.moduleSettings.shouldHideBarRotation then
end,
order = 30.09
}
end
end
opts["textSettings"] =
{
type = 'group',
@ -683,7 +714,7 @@ end
}
}
}
if not self.moduleSettings.bHideMarkerSettings then
if not self.moduleSettings.bHideMarkerSettings then
opts["markerSettings"] =
{
type = 'group',
@ -814,8 +845,9 @@ if not self.moduleSettings.bHideMarkerSettings then
},
}
}
end
end
return opts
end
end
function IceBarElement.prototype:SetBarVisibility(visible)
@ -828,8 +860,10 @@ end
function IceBarElement.prototype:SetBarFramePoints(frame)
frame:ClearAllPoints()
if (self.moduleSettings.inverse) then
if self.moduleSettings.inverse == "INVERSE" then
frame:SetPoint("TOPLEFT", self.frame, "TOPLEFT")
elseif self.moduleSettings.inverse == "EXPAND" then
frame:SetPoint("LEFT", self.frame, "LEFT")
else
frame:SetPoint("BOTTOMLEFT", self.frame, "BOTTOMLEFT")
end
@ -1071,12 +1105,15 @@ function IceBarElement.prototype:SetScale(inScale, force)
if force or oldScale ~= self.CurrScale then
local scale = self.CurrScale
if (self.moduleSettings.reverse) then
if self.moduleSettings.reverse then
scale = 1 - scale
end
if (self.moduleSettings.inverse) then
if self.moduleSettings.inverse == "INVERSE" then
min_y = 0;
max_y = scale;
elseif self.moduleSettings.inverse == "EXPAND" then
min_y = 0.5 - (scale * 0.5);
max_y = 0.5 + (scale * 0.5);
else
min_y = 1-scale;
max_y = 1;
@ -1349,8 +1386,10 @@ function IceBarElement.prototype:RotateFrame(frame)
end
local anchorPoint
if self.moduleSettings.inverse then
if self.moduleSettings.inverse == "INVERSE" then
anchorPoint = "TOPLEFT"
elseif self.moduleSettings.inverse == "EXPAND" then
anchorPoint = "LEFT"
else
anchorPoint = "BOTTOMLEFT"
end

View File

@ -35,6 +35,7 @@ function CastBar.prototype:GetDefaultSettings()
settings["usesDogTagStrings"] = false
settings["rangeColor"] = true
settings["shouldHideBarRotation"] = true
settings["bAllowExpand"] = false
return settings
end

View File

@ -46,6 +46,7 @@ function EclipseBar.prototype:GetDefaultSettings()
height = 6,
}
defaults.shouldHideBarRotation = true
defaults.bAllowExpand = false
return defaults
end

View File

@ -56,6 +56,8 @@ function PlayerHealth.prototype:GetDefaultSettings()
settings["PartyRoleIconOffset"] = {x=90, y=-59}
settings["PartyRoleIconScale"] = 0.9
settings["bAllowExpand"] = false
return settings
end

View File

@ -83,6 +83,7 @@ function SliceAndDice.prototype:GetDefaultSettings()
settings["lowerTextString"] = ""
settings["lowerTextVisible"] = false
settings["hideAnimationSettings"] = true
settings["bAllowExpand"] = false
return settings
end

View File

@ -48,6 +48,7 @@ function IceThreat.prototype:GetDefaultSettings()
settings["showScaledThreat"] = false
settings["displaySecondPlaceThreat"] = true
settings["secondPlaceThreatAlpha"] = 0.75
settings["bAllowExpand"] = false
return settings
end