Add "Invert Bar/Text Colors" option (default off) which swaps the bar background and text colors.

This commit is contained in:
Xinhuan
2009-04-02 05:28:06 +08:00
parent 3f0379ca14
commit a0a73b55af
2 changed files with 38 additions and 9 deletions
+2
View File
@@ -182,6 +182,8 @@ L["Bar BG Color"] = true
L["The background color for all threat bars"] = true
L["Always Show Self"] = true
L["Always show your threat bar on Omen (ignores class filter settings), showing your bar on the last row if necessary"] = true
L["Invert Bar/Text Colors"] = true
L["Switch the colors so that the bar background colors and the text colors are swapped."] = true
L["Bar Label Options"] = true
L["Font"] = true
L["The font that the labels will use"] = true
+36 -9
View File
@@ -150,6 +150,7 @@ local defaults = {
PetBarColor = {r = 0.77, g = 0, b = 1, a = 1},
FadeBarColor = {r = 0.5, g = 0.5, b = 0.5, a = 1},
UseCustomClassColors = true,
InvertColors = false,
},
ShowWith = {
UseShowWith = true,
@@ -658,7 +659,7 @@ function Omen:UpdateUsedMedia(event, mediatype, key)
if key == db.Bar.Texture then self:UpdateBarTextureSettings() end
elseif mediatype == "font" then
if key == db.TitleBar.Font then self:UpdateTitleBar() end
if key == db.Bar.Font then self:UpdateBarLabelSettings() end
if key == db.Bar.Font then self:UpdateBarLabelSettings() self:UpdateBars() end
elseif mediatype == "background" then
if key == db.Background.Texture then self:UpdateBackdrop() end
elseif mediatype == "border" then
@@ -1040,7 +1041,7 @@ do
local inset = db.Background.BarInset
local inset2 = db.Background.BarInset * 2
local color = db.Bar.FontColor
local color = db.Bar.InvertColors and db.Bar.BarColor or db.Bar.FontColor
bar:SetWidth(Omen.Anchor:GetWidth() - inset2)
bar:SetHeight(db.Bar.Height)
@@ -1100,7 +1101,7 @@ do
bar.Text2:SetText(L["Threat"])
end
bar.Text3:SetText(L["TPS"])
color = db.Bar.HeadingBGColor
color = db.Bar.InvertColors and db.Bar.FontColor or db.Bar.HeadingBGColor
bar.texture:SetVertexColor(color.r, color.g, color.b, color.a)
bar:Hide()
elseif barID == 1 then
@@ -1142,7 +1143,8 @@ function Omen:UpdateBarLabelSettings()
local font = LSM:Fetch("font", db.Bar.Font)
local size = db.Bar.FontSize
local flags = db.Bar.FontOutline
local color = db.Bar.FontColor
local color = db.Bar.InvertColors and db.Bar.BarColor or db.Bar.FontColor
local color2 = db.Bar.InvertColors and db.Bar.FontColor or db.Bar.BarColor
for i = 0, #bars do
bars[i].Text1:SetFont(font, size, flags)
bars[i].Text2:SetFont(font, size, flags)
@@ -1153,9 +1155,14 @@ function Omen:UpdateBarLabelSettings()
bars[i].Text1:SetHeight(size)
bars[i].Text2:SetHeight(size)
bars[i].Text3:SetHeight(size)
bars[i].texture:SetVertexColor(color2.r, color2.g, color2.b, color2.a)
end
color = db.Bar.HeadingBGColor
color = db.Bar.InvertColors and db.Bar.FontColor or db.Bar.HeadingBGColor
color2 = db.Bar.InvertColors and db.Bar.HeadingBGColor or db.Bar.FontColor
bars[0].texture:SetVertexColor(color.r, color.g, color.b, color.a)
bars[0].Text1:SetTextColor(color2.r, color2.g, color2.b, color2.a)
bars[0].Text2:SetTextColor(color2.r, color2.g, color2.b, color2.a)
bars[0].Text3:SetTextColor(color2.r, color2.g, color2.b, color2.a)
end
function Omen:ReAnchorLabels()
@@ -1597,7 +1604,13 @@ function Omen:UpdateBarsReal()
(guid == "AGGRO" and dbBar.AggroBarColor) or
(dbBar.UseClassColors and (RAID_CLASS_COLORS[class] or (class == "PET" and dbBar.PetBarColor))) or
dbBar.BarColor
bar.texture:SetVertexColor(c.r, c.g, c.b, c.a or 1)
if dbBar.InvertColors then
bar.Text1:SetTextColor(c.r, c.g, c.b, c.a or 1)
bar.Text2:SetTextColor(c.r, c.g, c.b, c.a or 1)
bar.Text3:SetTextColor(c.r, c.g, c.b, c.a or 1)
else
bar.texture:SetVertexColor(c.r, c.g, c.b, c.a or 1)
end
-- Update the width of the bar, and animate if necessary
local width = w * threat / topthreat
@@ -2663,6 +2676,7 @@ Omen.Options = {
local t = db.Bar.HeadingBGColor
t.r, t.g, t.b, t.a = r, g, b, a
Omen:UpdateBarLabelSettings()
Omen:UpdateBars()
end,
disabled = function() return not db.Bar.ShowHeadings end,
},
@@ -2771,7 +2785,7 @@ Omen.Options = {
},
FadeBarColor = {
type = "color",
order = 26,
order = 24,
name = L["Fade/MI Bar Color"],
desc = L["The background color for players under the effects of Fade and Mirror Image (they will be at negative 4 million threat)"],
hasAlpha = true,
@@ -2787,7 +2801,7 @@ Omen.Options = {
},
BarColor = {
type = "color",
order = 27,
order = 25,
name = L["Bar BG Color"],
desc = L["The background color for all threat bars"],
hasAlpha = true,
@@ -2804,10 +2818,21 @@ Omen.Options = {
},
AlwaysShowSelf = {
type = "toggle",
order = 28,
order = 26,
name = L["Always Show Self"],
desc = L["Always show your threat bar on Omen (ignores class filter settings), showing your bar on the last row if necessary"],
},
InvertColors = {
type = "toggle",
order = 27,
name = L["Invert Bar/Text Colors"],
desc = L["Switch the colors so that the bar background colors and the text colors are swapped."],
set = function(info, v)
db.Bar.InvertColors = v
Omen:UpdateBarLabelSettings()
Omen:UpdateBars()
end,
},
Texture = {
type = "select", dialogControl = 'LSM30_Statusbar',
order = 29,
@@ -2827,6 +2852,7 @@ Omen.Options = {
set = function(info, v)
db.Bar[ info[#info] ] = v
Omen:UpdateBarLabelSettings()
Omen:UpdateBars()
end,
args = {
Font = {
@@ -2857,6 +2883,7 @@ Omen.Options = {
local t = db.Bar.FontColor
t.r, t.g, t.b, t.a = r, g, b, a
Omen:UpdateBarLabelSettings()
Omen:UpdateBars()
end,
},
FontSize = {