- added custom upper/lower text coloring to custom buff/debuff bars and custom cooldown bars since they don't have any dogtag support

- fixed lower text to be visible on custom buff/debuff bars and custom cooldown bars
- fixed upper/lower text blocks in the text settings page to not be multi-line if the module doesn't support dogtags so that everything is laid out more cleanly
This commit is contained in:
Parnic
2010-12-14 06:55:15 +00:00
parent f4c098565d
commit e3e3d01583
3 changed files with 115 additions and 4 deletions

View File

@ -632,7 +632,7 @@ do
disabled = function() disabled = function()
return not self.moduleSettings.enabled return not self.moduleSettings.enabled
end, end,
multiline = true, multiline = self.moduleSettings.usesDogTagStrings,
usage = "<upper text to display>", usage = "<upper text to display>",
order = 13.2, order = 13.2,
}, },
@ -661,7 +661,7 @@ do
disabled = function() disabled = function()
return not self.moduleSettings.enabled return not self.moduleSettings.enabled
end, end,
multiline = true, multiline = self.moduleSettings.usesDogTagStrings,
usage = "<lower text to display>", usage = "<lower text to display>",
order = 14.2, order = 14.2,
}, },
@ -1345,7 +1345,9 @@ function IceBarElement.prototype:SetBottomText1(text, color)
alpha = 1 alpha = 1
end end
self.frame.bottomUpperText:SetTextColor(self:GetColor(color, alpha)) if not self.textColorOverride then
self.frame.bottomUpperText:SetTextColor(self:GetColor(color, alpha))
end
self.frame.bottomUpperText:SetText(text) self.frame.bottomUpperText:SetText(text)
self.frame.bottomUpperText:SetWidth(0) self.frame.bottomUpperText:SetWidth(0)
end end
@ -1375,11 +1377,20 @@ function IceBarElement.prototype:SetBottomText2(text, color, alpha)
alpha = 1 alpha = 1
end end
self.frame.bottomLowerText:SetTextColor(self:GetColor(color, alpha)) if not self.textColorOverride then
self.frame.bottomLowerText:SetTextColor(self:GetColor(color, alpha))
end
self.frame.bottomLowerText:SetText(text) self.frame.bottomLowerText:SetText(text)
self.frame.bottomLowerText:SetWidth(0) self.frame.bottomLowerText:SetWidth(0)
end end
function IceBarElement.prototype:SetCustomTextColor(fontInstance, colorTable)
if not fontInstance or not colorTable or type(colorTable) ~= "table" then
return
end
fontInstance:SetTextColor(colorTable.r, colorTable.g, colorTable.b)
end
function IceBarElement.prototype:SetTextAlpha() function IceBarElement.prototype:SetTextAlpha()
if self.frame.bottomUpperText then if self.frame.bottomUpperText then

View File

@ -16,6 +16,7 @@ IceCustomBar.prototype.bIsAura = false
-- Constructor -- -- Constructor --
function IceCustomBar.prototype:init() function IceCustomBar.prototype:init()
IceCustomBar.super.prototype.init(self, "MyCustomBar", "player") IceCustomBar.super.prototype.init(self, "MyCustomBar", "player")
self.textColorOverride = true
end end
-- 'Public' methods ----------------------------------------------------------- -- 'Public' methods -----------------------------------------------------------
@ -49,6 +50,15 @@ function IceCustomBar.prototype:Enable(core)
if self.moduleSettings.auraIconYOffset == nil then if self.moduleSettings.auraIconYOffset == nil then
self.moduleSettings.auraIconYOffset = 0 self.moduleSettings.auraIconYOffset = 0
end end
if not self.moduleSettings.upperTextColor then
self.moduleSettings.upperTextColor = {r=1, g=1, b=1}
end
self:SetCustomTextColor(self.frame.bottomUpperText, self.moduleSettings.upperTextColor)
if not self.moduleSettings.lowerTextColor then
self.moduleSettings.lowerTextColor = {r=1, g=1, b=1}
end
self:SetCustomTextColor(self.frame.bottomLowerText, self.moduleSettings.lowerTextColor)
end end
function IceCustomBar.prototype:ConditionalSubscribe() function IceCustomBar.prototype:ConditionalSubscribe()
@ -111,6 +121,8 @@ function IceCustomBar.prototype:GetDefaultSettings()
settings["auraIconYOffset"] = 0 settings["auraIconYOffset"] = 0
settings["auraIconScale"] = 1 settings["auraIconScale"] = 1
settings["exactMatch"] = false settings["exactMatch"] = false
settings["lowerTextColor"] = {r=1, g=1, b=1}
settings["upperTextColor"] = {r=1, g=1, b=1}
return settings return settings
end end
@ -479,6 +491,42 @@ function IceCustomBar.prototype:GetOptions()
}, },
} }
opts.textSettings.args.upperTextColor = {
type = "color",
name = L["Upper Text Color"],
get = function()
return self.moduleSettings.upperTextColor.r, self.moduleSettings.upperTextColor.g, self.moduleSettings.upperTextColor.b, 1
end,
set = function(info, r,g,b)
self.moduleSettings.upperTextColor.r = r
self.moduleSettings.upperTextColor.g = g
self.moduleSettings.upperTextColor.b = b
self:SetCustomTextColor(self.frame.bottomUpperText, self.moduleSettings.upperTextColor)
end,
disabled = function()
return not self.moduleSettings.enabled
end,
order = 13.9,
}
opts.textSettings.args.lowerTextColor = {
type = "color",
name = L["Lower Text Color"],
get = function()
return self.moduleSettings.lowerTextColor.r, self.moduleSettings.lowerTextColor.g, self.moduleSettings.lowerTextColor.b, 1
end,
set = function(info, r,g,b)
self.moduleSettings.lowerTextColor.r = r
self.moduleSettings.lowerTextColor.g = g
self.moduleSettings.lowerTextColor.b = b
self:SetCustomTextColor(self.frame.bottomLowerText, self.moduleSettings.lowerTextColor)
end,
disabled = function()
return not self.moduleSettings.enabled
end,
order = 14.9,
}
return opts return opts
end end
@ -656,6 +704,8 @@ function IceCustomBar.prototype:UpdateCustomBar(unit, fromUpdate)
self:SetBottomText1(self.moduleSettings.upperText) self:SetBottomText1(self.moduleSettings.upperText)
end end
self:SetBottomText2(self.moduleSettings.lowerText)
self.barFrame.bar:SetVertexColor(self:GetBarColor()) self.barFrame.bar:SetVertexColor(self:GetBarColor())
if self.flashFrame and self.flashFrame.flash then if self.flashFrame and self.flashFrame.flash then
self.flashFrame.flash:SetVertexColor(self:GetBarColor()) self.flashFrame.flash:SetVertexColor(self:GetBarColor())

View File

@ -19,6 +19,7 @@ table.insert(brokenSpellsNameToId, {"Holy Word: Aspire",88682})
-- Constructor -- -- Constructor --
function IceCustomCDBar.prototype:init() function IceCustomCDBar.prototype:init()
IceCustomCDBar.super.prototype.init(self, "MyCustomCDBar") IceCustomCDBar.super.prototype.init(self, "MyCustomCDBar")
self.textColorOverride = true
end end
-- 'Public' methods ----------------------------------------------------------- -- 'Public' methods -----------------------------------------------------------
@ -55,6 +56,15 @@ function IceCustomCDBar.prototype:Enable(core)
end end
self.moduleSettings.displayWhenEmpty = nil self.moduleSettings.displayWhenEmpty = nil
end end
if not self.moduleSettings.upperTextColor then
self.moduleSettings.upperTextColor = {r=1, g=1, b=1}
end
self:SetCustomTextColor(self.frame.bottomUpperText, self.moduleSettings.upperTextColor)
if not self.moduleSettings.lowerTextColor then
self.moduleSettings.lowerTextColor = {r=1, g=1, b=1}
end
self:SetCustomTextColor(self.frame.bottomLowerText, self.moduleSettings.lowerTextColor)
end end
@ -90,6 +100,8 @@ function IceCustomCDBar.prototype:GetDefaultSettings()
settings["auraIconXOffset"] = 40 settings["auraIconXOffset"] = 40
settings["auraIconYOffset"] = 0 settings["auraIconYOffset"] = 0
settings["auraIconScale"] = 1 settings["auraIconScale"] = 1
settings["lowerTextColor"] = {r=1, g=1, b=1}
settings["upperTextColor"] = {r=1, g=1, b=1}
return settings return settings
end end
@ -376,6 +388,42 @@ function IceCustomCDBar.prototype:GetOptions()
}, },
} }
opts.textSettings.args.upperTextColor = {
type = "color",
name = L["Upper Text Color"],
get = function()
return self.moduleSettings.upperTextColor.r, self.moduleSettings.upperTextColor.g, self.moduleSettings.upperTextColor.b, 1
end,
set = function(info, r,g,b)
self.moduleSettings.upperTextColor.r = r
self.moduleSettings.upperTextColor.g = g
self.moduleSettings.upperTextColor.b = b
self:SetCustomTextColor(self.frame.bottomUpperText, self.moduleSettings.upperTextColor)
end,
disabled = function()
return not self.moduleSettings.enabled
end,
order = 13.9,
}
opts.textSettings.args.lowerTextColor = {
type = "color",
name = L["Lower Text Color"],
get = function()
return self.moduleSettings.lowerTextColor.r, self.moduleSettings.lowerTextColor.g, self.moduleSettings.lowerTextColor.b, 1
end,
set = function(info, r,g,b)
self.moduleSettings.lowerTextColor.r = r
self.moduleSettings.lowerTextColor.g = g
self.moduleSettings.lowerTextColor.b = b
self:SetCustomTextColor(self.frame.bottomLowerText, self.moduleSettings.lowerTextColor)
end,
disabled = function()
return not self.moduleSettings.enabled
end,
order = 14.9,
}
return opts return opts
end end
@ -536,6 +584,8 @@ function IceCustomCDBar.prototype:UpdateCustomBar(fromUpdate)
self:SetBottomText1(self.moduleSettings.upperText) self:SetBottomText1(self.moduleSettings.upperText)
end end
self:SetBottomText2(self.moduleSettings.lowerText)
self:UpdateAlpha() self:UpdateAlpha()
self.barFrame.bar:SetVertexColor(self:GetBarColor()) self.barFrame.bar:SetVertexColor(self:GetBarColor())