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
+20 -14
View File
@@ -88,6 +88,24 @@ L["Show Omen when you are in a battleground or arena"] = true
L["You are in a dungeon"] = true L["You are in a dungeon"] = true
L["Show Omen when you are in a dungeon (5 man and raid)"] = true L["Show Omen when you are in a dungeon (5 man and raid)"] = true
-- Config strings, show classes... section
L["Show Classes..."] = true
L["SHOW_CLASSES_DESC"] = "Show Omen threat bars for the following classes. The classes here refer to those people in your party/raid only with the exception of the 'Not In Party' option."
L["Show bars for these classes"] = true
L["The classes here refer to those in your party/raid only."] = true
L["DEATHKNIGHT"] = "Death Knight"
L["DRUID"] = "Druid"
L["HUNTER"] = "Hunter"
L["MAGE"] = "Mage"
L["PALADIN"] = "Paladin"
L["PET"] = "Pet"
L["PRIEST"] = "Priest"
L["ROGUE"] = "Rogue"
L["SHAMAN"] = "Shaman"
L["WARLOCK"] = "Warlock"
L["WARRIOR"] = "Warrior"
L["*Not in Party*"] = true
-- Config strings, bar settings section -- Config strings, bar settings section
L["Bar Settings"] = true L["Bar Settings"] = true
L["Configure bar settings."] = true L["Configure bar settings."] = true
@@ -105,6 +123,8 @@ L["Show TPS"] = true
L["Show threat per second values"] = true L["Show threat per second values"] = true
L["TPS Window"] = true L["TPS Window"] = true
L["TPS_WINDOW_DESC"] = "The threat per second calculation is based on a real time sliding window of the last X seconds." L["TPS_WINDOW_DESC"] = "The threat per second calculation is based on a real time sliding window of the last X seconds."
L["Show Headings"] = true
L["Show column headings"] = true
L["Bar Label Options"] = true L["Bar Label Options"] = true
L["Font"] = true L["Font"] = true
L["The font that the labels will use"] = true L["The font that the labels will use"] = true
@@ -117,20 +137,6 @@ L["The outline that the labels will use"] = true
L["None"] = true L["None"] = true
L["Outline"] = true L["Outline"] = true
L["Thick Outline"] = true L["Thick Outline"] = true
L["Show bars for these classes"] = true
L["The classes here refer to those in your party/raid only."] = true
L["DEATHKNIGHT"] = "Death Knight"
L["DRUID"] = "Druid"
L["HUNTER"] = "Hunter"
L["MAGE"] = "Mage"
L["PALADIN"] = "Paladin"
L["PET"] = "Pet"
L["PRIEST"] = "Priest"
L["ROGUE"] = "Rogue"
L["SHAMAN"] = "Shaman"
L["WARLOCK"] = "Warlock"
L["WARRIOR"] = "Warrior"
L["*Not in Party*"] = true
-- Config strings, slash command section -- Config strings, slash command section
L["OMEN_SLASH_DESC"] = "These buttons execute the same functions as the ones in the slash command /omen" L["OMEN_SLASH_DESC"] = "These buttons execute the same functions as the ones in the slash command /omen"
+89 -49
View File
@@ -115,6 +115,7 @@ local defaults = {
}, },
ShowTPS = true, ShowTPS = true,
TPSWindow = 10, TPSWindow = 10,
ShowHeadings = true,
}, },
ShowWith = { ShowWith = {
Pet = true, Pet = true,
@@ -418,10 +419,6 @@ function Omen:OnInitialize()
self:CreateFrames() self:CreateFrames()
self:SetupOptions() self:SetupOptions()
self:UpdateBackdrop()
self:UpdateTitleBar()
self:UpdateGrips()
self:RegisterEvent("PLAYER_LOGIN") self:RegisterEvent("PLAYER_LOGIN")
end end
@@ -432,6 +429,9 @@ function Omen:PLAYER_LOGIN()
-- It cannot be earlier than PLAYER_LOGIN because layout-cache.txt -- It cannot be earlier than PLAYER_LOGIN because layout-cache.txt
-- is loaded just before this event fires. -- is loaded just before this event fires.
self:SetAnchors(true) self:SetAnchors(true)
self:UpdateBackdrop()
self:UpdateTitleBar()
self:UpdateGrips()
self:UnregisterEvent("PLAYER_LOGIN") self:UnregisterEvent("PLAYER_LOGIN")
-- Optional launcher support for LDB-1.1 if present, this code is placed here so -- 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 inset2 = db.Background.BarInset * 2
local color = db.Bar.FontColor local color = db.Bar.FontColor
bar:SetWidth(Omen.BarList:GetWidth() - inset2) bar:SetWidth(Omen.Anchor:GetWidth() - inset2)
bar:SetHeight(db.Bar.Height) 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 = bar:CreateFontString(nil, nil, "GameFontNormalSmall")
bar.Text1:SetPoint("LEFT", bar, "LEFT", 5, 1) bar.Text1:SetPoint("LEFT", bar, "LEFT", 5, 1)
@@ -864,6 +868,7 @@ do
bar.Text1:SetText(L["Name"]) bar.Text1:SetText(L["Name"])
bar.Text2:SetText(L["Threat [%]"]) bar.Text2:SetText(L["Threat [%]"])
bar.Text3:SetText(L["TPS"]) bar.Text3:SetText(L["TPS"])
bar.texture:SetVertexColor(0, 0, 0, 0)
elseif barID == 1 then elseif barID == 1 then
-- Parent our TPS update frame to the first bar, so that TPS updates -- 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. -- updates happen when at least 1 bar (the first bar) is shown.
@@ -878,8 +883,8 @@ end
function Omen:ResizeBars() function Omen:ResizeBars()
local inset = db.Background.BarInset * 2 local inset = db.Background.BarInset * 2
local w = Omen.BarList:GetWidth() - inset local w = Omen.Anchor:GetWidth() - inset
for i = 1, #bars do for i = 0, #bars do
bars[i]:SetWidth(w) bars[i]:SetWidth(w)
bars[i]:SetHeight(db.Bar.Height) bars[i]:SetHeight(db.Bar.Height)
end end
@@ -887,8 +892,15 @@ end
function Omen:ReAnchorBars() function Omen:ReAnchorBars()
local inset = db.Background.BarInset local inset = db.Background.BarInset
for i = 1, #bars do if db.Bar.ShowHeadings then
bars[i]:SetPoint("TOPLEFT", self.BarList, "TOPLEFT", inset, -inset + (i-1) * -(db.Bar.Height + db.Bar.Spacing)) 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
end end
@@ -897,7 +909,7 @@ function Omen:UpdateBarLabelSettings()
local size = db.Bar.FontSize local size = db.Bar.FontSize
local flags = db.Bar.FontOutline local flags = db.Bar.FontOutline
local color = db.Bar.FontColor local color = db.Bar.FontColor
for i = 1, #bars do for i = 0, #bars do
bars[i].Text1:SetFont(font, size, flags) bars[i].Text1:SetFont(font, size, flags)
bars[i].Text2:SetFont(font, size, flags) bars[i].Text2:SetFont(font, size, flags)
bars[i].Text3:SetFont(font, size, flags) bars[i].Text3:SetFont(font, size, flags)
@@ -914,7 +926,7 @@ function Omen:ReAnchorLabels()
local w = db.VGrip1 local w = db.VGrip1
local w2 = db.Bar.ShowTPS and Omen.BarList:GetWidth() - db.VGrip2 or Omen.BarList:GetWidth() - w local w2 = db.Bar.ShowTPS and Omen.BarList:GetWidth() - db.VGrip2 or Omen.BarList:GetWidth() - w
local w3 = db.VGrip2 - db.VGrip1 local w3 = db.VGrip2 - db.VGrip1
for i = 1, #bars do for i = 0, #bars do
bars[i].Text1:SetWidth(w - 5) bars[i].Text1:SetWidth(w - 5)
bars[i].Text2:SetWidth(w2 - 5) bars[i].Text2:SetWidth(w2 - 5)
if db.Bar.ShowTPS then if db.Bar.ShowTPS then
@@ -952,12 +964,7 @@ function Omen:PLAYER_TARGET_CHANGED()
self:CancelTimer(timers.UpdateBars, true) self:CancelTimer(timers.UpdateBars, true)
timers.UpdateBars = nil timers.UpdateBars = nil
end end
self:UpdateBars()
if UnitExists("target") or testMode then
self:UpdateBars()
else
self:ClearAll()
end
end end
local lastPartyUpdateTime = GetTime() local lastPartyUpdateTime = GetTime()
@@ -1190,6 +1197,15 @@ function Omen:UpdateBars()
local tankThreat = threatTable[tankGUID or mobTargetGUID or sortTable[1]] local tankThreat = threatTable[tankGUID or mobTargetGUID or sortTable[1]]
local dbBar = db.Bar local dbBar = db.Bar
i = 1 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 for j = 1, #sortTable do
local guid = sortTable[j] local guid = sortTable[j]
local class = guidClassLookup[guid] local class = guidClassLookup[guid]
@@ -1222,7 +1238,7 @@ function Omen:UpdateBars()
end end
end end
-- And hide the rest -- And hide the rest
for j = i, #bars do for j = db.Bar.ShowHeadings and i-1 or i, #bars do
bars[j]:Hide() bars[j]:Hide()
end end
if db.Autocollapse then if db.Autocollapse then
@@ -1263,7 +1279,7 @@ function Omen:UpdateBars()
end end
function Omen:ClearAll() function Omen:ClearAll()
for i = 1, #bars do for i = 0, #bars do
bars[i]:Hide() bars[i]:Hide()
end end
self.TitleText:SetText(self.defaultTitle) self.TitleText:SetText(self.defaultTitle)
@@ -1648,9 +1664,46 @@ local options = {
}, },
}, },
}, },
TitleBar = { ShowClasses = {
order = 3, order = 3,
type = "group", 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"], name = L["Title Bar Settings"],
desc = L["Title Bar Settings"], desc = L["Title Bar Settings"],
get = function(info) return db.TitleBar[ info[#info] ] end, get = function(info) return db.TitleBar[ info[#info] ] end,
@@ -1719,7 +1772,7 @@ local options = {
}, },
}, },
Bars = { Bars = {
order = 4, order = 5,
type = "group", type = "group",
name = L["Bar Settings"], name = L["Bar Settings"],
desc = L["Bar Settings"], desc = L["Bar Settings"],
@@ -1798,6 +1851,17 @@ local options = {
min = 5, max = 15, step = 0.1, min = 5, max = 15, step = 0.1,
disabled = function() return not db.Bar.ShowTPS end, 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 = { Texture = {
type = "select", dialogControl = 'LSM30_Statusbar', type = "select", dialogControl = 'LSM30_Statusbar',
order = 10, order = 10,
@@ -1807,7 +1871,7 @@ local options = {
set = function(info, v) set = function(info, v)
db.Bar.Texture = v db.Bar.Texture = v
local texturepath = LSM:Fetch("statusbar", v) local texturepath = LSM:Fetch("statusbar", v)
for i = 1, #bars do for i = 0, #bars do
bars[i].texture:SetTexture(texturepath) bars[i].texture:SetTexture(texturepath)
end end
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 = { Warnings = {
order = 5, order = 6,
type = "group", type = "group",
name = L["Warning Settings"], name = L["Warning Settings"],
desc = 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 -- The ordering here matters, it determines the order in the Blizzard Interface Options
self.optionsFrames.Omen = ACD3:AddToBlizOptions("Omen", nil, nil, "General") self.optionsFrames.Omen = ACD3:AddToBlizOptions("Omen", nil, nil, "General")
self.optionsFrames.ShowWhen = ACD3:AddToBlizOptions("Omen", L["Show When..."], "Omen", "ShowWhen") 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.TitleBar = ACD3:AddToBlizOptions("Omen", L["Title Bar Settings"], "Omen", "TitleBar")
self.optionsFrames.Bars = ACD3:AddToBlizOptions("Omen", L["Bar Settings"], "Omen", "Bars") self.optionsFrames.Bars = ACD3:AddToBlizOptions("Omen", L["Bar Settings"], "Omen", "Bars")
self.optionsFrames.Warnings = ACD3:AddToBlizOptions("Omen", L["Warning Settings"], "Omen", "Warnings") self.optionsFrames.Warnings = ACD3:AddToBlizOptions("Omen", L["Warning Settings"], "Omen", "Warnings")
+20 -14
View File
@@ -88,6 +88,24 @@ L["Show Omen when you are in a battleground or arena"] = "Zeige Omen wenn ich in
L["You are in a dungeon"] = "Ich in einer Instanz bin" L["You are in a dungeon"] = "Ich in einer Instanz bin"
L["Show Omen when you are in a dungeon (5 man and raid)"] = "Zeige Omen wenn ich in einer Instanz bin (5er oder Schlachtzug)" L["Show Omen when you are in a dungeon (5 man and raid)"] = "Zeige Omen wenn ich in einer Instanz bin (5er oder Schlachtzug)"
-- Config strings, show classes... section
--L["Show Classes..."] = true
--L["SHOW_CLASSES_DESC"] = "Show Omen threat bars for the following classes. The classes here refer to those people in your party/raid only with the exception of the 'Not In Party' option."
L["Show bars for these classes"] = "Zeige Balken für diese Klassen"
L["The classes here refer to those in your party/raid only."] = "Dies gilt nur für Klassen in Ihrer Gruppe/Schlachtzug"
L["DEATHKNIGHT"] = "Todesritter"
L["DRUID"] = "Druide"
L["HUNTER"] = "Jäger"
L["MAGE"] = "Magier"
L["PALADIN"] = "Paladin"
L["PET"] = "Begleiter"
L["PRIEST"] = "Priester"
L["ROGUE"] = "Schurke"
L["SHAMAN"] = "Schamane"
L["WARLOCK"] = "Hexer"
L["WARRIOR"] = "Krieger"
L["*Not in Party*"] = "*Nicht in der Gruppe"
-- Config strings, bar settings section -- Config strings, bar settings section
L["Bar Settings"] = "Optionen für die Balken" L["Bar Settings"] = "Optionen für die Balken"
L["Configure bar settings."] = "Einstellungen für die Balken ändern" L["Configure bar settings."] = "Einstellungen für die Balken ändern"
@@ -105,6 +123,8 @@ L["Spacing between each bar"] = "Abstand zwischen den Balken"
--L["Show threat per second values"] = true --L["Show threat per second values"] = true
--L["TPS Window"] = true --L["TPS Window"] = true
--L["TPS_WINDOW_DESC"] = "The threat per second calculation is based on a real time sliding window of the last X seconds." --L["TPS_WINDOW_DESC"] = "The threat per second calculation is based on a real time sliding window of the last X seconds."
--L["Show Headings"] = true
--L["Show column headings"] = true
L["Bar Label Options"] = "Optionen für die Beschriftung der Balken" L["Bar Label Options"] = "Optionen für die Beschriftung der Balken"
L["Font"] = "Schriftart" L["Font"] = "Schriftart"
L["The font that the labels will use"] = "Die Schriftart die die Balken benutzen" L["The font that the labels will use"] = "Die Schriftart die die Balken benutzen"
@@ -117,20 +137,6 @@ L["The outline that the labels will use"] = "Die Kontur der Beschriftungen"
L["None"] = "Keine" L["None"] = "Keine"
L["Outline"] = "Kontur" L["Outline"] = "Kontur"
L["Thick Outline"] = "Dicke Kontur" L["Thick Outline"] = "Dicke Kontur"
L["Show bars for these classes"] = "Zeige Balken für diese Klassen"
L["The classes here refer to those in your party/raid only."] = "Dies gilt nur für Klassen in Ihrer Gruppe/Schlachtzug"
L["DEATHKNIGHT"] = "Todesritter"
L["DRUID"] = "Druide"
L["HUNTER"] = "Jäger"
L["MAGE"] = "Magier"
L["PALADIN"] = "Paladin"
L["PET"] = "Begleiter"
L["PRIEST"] = "Priester"
L["ROGUE"] = "Schurke"
L["SHAMAN"] = "Schamane"
L["WARLOCK"] = "Hexer"
L["WARRIOR"] = "Krieger"
L["*Not in Party*"] = "*Nicht in der Gruppe"
-- Config strings, slash command section -- Config strings, slash command section
L["OMEN_SLASH_DESC"] = "Die Knöpfe machen das selbe wie die Slashkommandos beim Befehl /omen" L["OMEN_SLASH_DESC"] = "Die Knöpfe machen das selbe wie die Slashkommandos beim Befehl /omen"