Add Show Heading option. Move Show Classes config.

This commit is contained in:
Xinhuan
2008-10-14 14:32:28 +08:00
parent 12fa79546f
commit b7888cdaca
3 changed files with 363 additions and 311 deletions
+89 -49
View File
@@ -115,6 +115,7 @@ local defaults = {
},
ShowTPS = true,
TPSWindow = 10,
ShowHeadings = true,
},
ShowWith = {
Pet = true,
@@ -418,10 +419,6 @@ function Omen:OnInitialize()
self:CreateFrames()
self:SetupOptions()
self:UpdateBackdrop()
self:UpdateTitleBar()
self:UpdateGrips()
self:RegisterEvent("PLAYER_LOGIN")
end
@@ -432,6 +429,9 @@ function Omen:PLAYER_LOGIN()
-- It cannot be earlier than PLAYER_LOGIN because layout-cache.txt
-- is loaded just before this event fires.
self:SetAnchors(true)
self:UpdateBackdrop()
self:UpdateTitleBar()
self:UpdateGrips()
self:UnregisterEvent("PLAYER_LOGIN")
-- Optional launcher support for LDB-1.1 if present, this code is placed here so
@@ -814,9 +814,13 @@ do
local inset2 = db.Background.BarInset * 2
local color = db.Bar.FontColor
bar:SetWidth(Omen.BarList:GetWidth() - inset2)
bar:SetWidth(Omen.Anchor:GetWidth() - inset2)
bar:SetHeight(db.Bar.Height)
bar:SetPoint("TOPLEFT", Omen.BarList, "TOPLEFT", inset, -inset + (barID-1) * -(db.Bar.Height + db.Bar.Spacing))
if db.Bar.ShowHeadings then
bar:SetPoint("TOPLEFT", Omen.BarList, "TOPLEFT", inset, -inset + (barID) * -(db.Bar.Height + db.Bar.Spacing))
else
bar:SetPoint("TOPLEFT", Omen.BarList, "TOPLEFT", inset, -inset + (barID-1) * -(db.Bar.Height + db.Bar.Spacing))
end
bar.Text1 = bar:CreateFontString(nil, nil, "GameFontNormalSmall")
bar.Text1:SetPoint("LEFT", bar, "LEFT", 5, 1)
@@ -864,6 +868,7 @@ do
bar.Text1:SetText(L["Name"])
bar.Text2:SetText(L["Threat [%]"])
bar.Text3:SetText(L["TPS"])
bar.texture:SetVertexColor(0, 0, 0, 0)
elseif barID == 1 then
-- Parent our TPS update frame to the first bar, so that TPS updates
-- updates happen when at least 1 bar (the first bar) is shown.
@@ -878,8 +883,8 @@ end
function Omen:ResizeBars()
local inset = db.Background.BarInset * 2
local w = Omen.BarList:GetWidth() - inset
for i = 1, #bars do
local w = Omen.Anchor:GetWidth() - inset
for i = 0, #bars do
bars[i]:SetWidth(w)
bars[i]:SetHeight(db.Bar.Height)
end
@@ -887,8 +892,15 @@ end
function Omen:ReAnchorBars()
local inset = db.Background.BarInset
for i = 1, #bars do
bars[i]:SetPoint("TOPLEFT", self.BarList, "TOPLEFT", inset, -inset + (i-1) * -(db.Bar.Height + db.Bar.Spacing))
if db.Bar.ShowHeadings then
for i = 0, #bars do
bars[i]:SetPoint("TOPLEFT", self.BarList, "TOPLEFT", inset, -inset + (i) * -(db.Bar.Height + db.Bar.Spacing))
end
else
for i = 1, #bars do
bars[i]:SetPoint("TOPLEFT", self.BarList, "TOPLEFT", inset, -inset + (i-1) * -(db.Bar.Height + db.Bar.Spacing))
end
bars[0]:Hide()
end
end
@@ -897,7 +909,7 @@ function Omen:UpdateBarLabelSettings()
local size = db.Bar.FontSize
local flags = db.Bar.FontOutline
local color = db.Bar.FontColor
for i = 1, #bars do
for i = 0, #bars do
bars[i].Text1:SetFont(font, size, flags)
bars[i].Text2:SetFont(font, size, flags)
bars[i].Text3:SetFont(font, size, flags)
@@ -914,7 +926,7 @@ function Omen:ReAnchorLabels()
local w = db.VGrip1
local w2 = db.Bar.ShowTPS and Omen.BarList:GetWidth() - db.VGrip2 or Omen.BarList:GetWidth() - w
local w3 = db.VGrip2 - db.VGrip1
for i = 1, #bars do
for i = 0, #bars do
bars[i].Text1:SetWidth(w - 5)
bars[i].Text2:SetWidth(w2 - 5)
if db.Bar.ShowTPS then
@@ -952,12 +964,7 @@ function Omen:PLAYER_TARGET_CHANGED()
self:CancelTimer(timers.UpdateBars, true)
timers.UpdateBars = nil
end
if UnitExists("target") or testMode then
self:UpdateBars()
else
self:ClearAll()
end
self:UpdateBars()
end
local lastPartyUpdateTime = GetTime()
@@ -1190,6 +1197,15 @@ function Omen:UpdateBars()
local tankThreat = threatTable[tankGUID or mobTargetGUID or sortTable[1]]
local dbBar = db.Bar
i = 1
if db.Bar.ShowHeadings then
if db.Autocollapse and i <= db.NumBars or i*dbBar.Height + (i-1)*dbBar.Spacing <= h then
i = i + 1
bars[0].texture:SetWidth(w)
bars[0]:Show()
end
else
bars[0]:Hide()
end
for j = 1, #sortTable do
local guid = sortTable[j]
local class = guidClassLookup[guid]
@@ -1222,7 +1238,7 @@ function Omen:UpdateBars()
end
end
-- And hide the rest
for j = i, #bars do
for j = db.Bar.ShowHeadings and i-1 or i, #bars do
bars[j]:Hide()
end
if db.Autocollapse then
@@ -1263,7 +1279,7 @@ function Omen:UpdateBars()
end
function Omen:ClearAll()
for i = 1, #bars do
for i = 0, #bars do
bars[i]:Hide()
end
self.TitleText:SetText(self.defaultTitle)
@@ -1648,9 +1664,46 @@ local options = {
},
},
},
TitleBar = {
ShowClasses = {
order = 3,
type = "group",
name = L["Show Classes..."],
desc = L["Show Classes..."],
args = {
intro = {
order = 1,
type = "description",
name = L["SHOW_CLASSES_DESC"],
},
Classes = {
type = "multiselect",
order = 30,
name = L["Show bars for these classes"],
values = {
DEATHKNIGHT = L["DEATHKNIGHT"],
DRUID = L["DRUID"],
HUNTER = L["HUNTER"],
MAGE = L["MAGE"],
PALADIN = L["PALADIN"],
PET = L["PET"],
PRIEST = L["PRIEST"],
ROGUE = L["ROGUE"],
SHAMAN = L["SHAMAN"],
WARLOCK = L["WARLOCK"],
WARRIOR = L["WARRIOR"],
["*NOTINPARTY*"] = L["*Not in Party*"],
},
get = function(info, k) return db.Bar.Classes[k] end,
set = function(info, k, v)
db.Bar.Classes[k] = v
Omen:UpdateBars()
end,
},
},
},
TitleBar = {
order = 4,
type = "group",
name = L["Title Bar Settings"],
desc = L["Title Bar Settings"],
get = function(info) return db.TitleBar[ info[#info] ] end,
@@ -1719,7 +1772,7 @@ local options = {
},
},
Bars = {
order = 4,
order = 5,
type = "group",
name = L["Bar Settings"],
desc = L["Bar Settings"],
@@ -1798,6 +1851,17 @@ local options = {
min = 5, max = 15, step = 0.1,
disabled = function() return not db.Bar.ShowTPS end,
},
ShowHeadings = {
type = "toggle",
order = 6,
name = L["Show Headings"],
desc = L["Show column headings"],
set = function(info, value)
db.Bar.ShowHeadings = value
Omen:ReAnchorBars()
Omen:UpdateBars()
end,
},
Texture = {
type = "select", dialogControl = 'LSM30_Statusbar',
order = 10,
@@ -1807,7 +1871,7 @@ local options = {
set = function(info, v)
db.Bar.Texture = v
local texturepath = LSM:Fetch("statusbar", v)
for i = 1, #bars do
for i = 0, #bars do
bars[i].texture:SetTexture(texturepath)
end
end,
@@ -1861,35 +1925,10 @@ local options = {
},
},
},
Classes = {
type = "multiselect",
order = 30,
name = L["Show bars for these classes"],
desc = L["The classes here refer to those in your party/raid only."],
values = {
DEATHKNIGHT = L["DEATHKNIGHT"],
DRUID = L["DRUID"],
HUNTER = L["HUNTER"],
MAGE = L["MAGE"],
PALADIN = L["PALADIN"],
PET = L["PET"],
PRIEST = L["PRIEST"],
ROGUE = L["ROGUE"],
SHAMAN = L["SHAMAN"],
WARLOCK = L["WARLOCK"],
WARRIOR = L["WARRIOR"],
["*NOTINPARTY*"] = L["*Not in Party*"],
},
get = function(info, k) return db.Bar.Classes[k] end,
set = function(info, k, v)
db.Bar.Classes[k] = v
Omen:UpdateBars()
end,
},
},
},
Warnings = {
order = 5,
order = 6,
type = "group",
name = L["Warning Settings"],
desc = L["Warning Settings"],
@@ -2127,6 +2166,7 @@ function Omen:SetupOptions()
-- The ordering here matters, it determines the order in the Blizzard Interface Options
self.optionsFrames.Omen = ACD3:AddToBlizOptions("Omen", nil, nil, "General")
self.optionsFrames.ShowWhen = ACD3:AddToBlizOptions("Omen", L["Show When..."], "Omen", "ShowWhen")
self.optionsFrames.ShowClasses = ACD3:AddToBlizOptions("Omen", L["Show Classes..."], "Omen", "ShowClasses")
self.optionsFrames.TitleBar = ACD3:AddToBlizOptions("Omen", L["Title Bar Settings"], "Omen", "TitleBar")
self.optionsFrames.Bars = ACD3:AddToBlizOptions("Omen", L["Bar Settings"], "Omen", "Bars")
self.optionsFrames.Warnings = ACD3:AddToBlizOptions("Omen", L["Warning Settings"], "Omen", "Warnings")