Add Use Focus Target and Test Mode checkboxes to the configuration panel. Update quick menu with newbie tooltips. Compensate for SetHeight's floating point inaccuracy.

This commit is contained in:
Xinhuan
2008-10-31 02:21:53 +08:00
parent e80209cae6
commit be80f5d513
7 changed files with 55 additions and 6 deletions
+37 -6
View File
@@ -645,7 +645,7 @@ function Omen:UpdateBackdrop()
self.Anchor:SetMinResize(90, h)
self.Title:SetMinResize(90, h)
if not db.TitleBar.ShowTitleBar then
self.Title:SetHeight(0.0000000001) -- See comment in Omen:UpdateTitleBar()
self.Title:SetHeight(1e-6) -- See comment in Omen:UpdateTitleBar()
elseif h > db.TitleBar.Height then
self.Title:SetHeight(h)
else
@@ -673,7 +673,7 @@ function Omen:UpdateTitleBar()
self.TitleText:SetTextColor(color.r, color.g, color.b, color.a)
if not db.TitleBar.ShowTitleBar then
-- Yes, its a hack, since it can't be set to 0
self.Title:SetHeight(0.0000000001)
self.Title:SetHeight(1e-6)
self.Title:Hide()
elseif db.Background.EdgeSize * 2 > db.TitleBar.Height then
self.Title:SetHeight(db.Background.EdgeSize * 2)
@@ -1301,7 +1301,7 @@ function Omen:UpdateBars()
end
-- Check how many bars of space we have
local numBars = db.Autocollapse and db.NumBars or floor((h - dbBar.Height) / (dbBar.Height + dbBar.Spacing) + 1)
local numBars = db.Autocollapse and db.NumBars or floor((h - dbBar.Height) / (dbBar.Height + dbBar.Spacing) + 1.01)
i = 1 -- Counts one higher than number of bars used
if dbBar.ShowHeadings then
@@ -1512,28 +1512,38 @@ do
LibStub("AceConfigRegistry-3.0"):NotifyChange("Omen")
end
info.checked = db.Locked
info.tooltipTitle = L["Lock Omen"]
info.tooltipText = L["Locks Omen in place and prevents it from being dragged or resized."]
UIDropDownMenu_AddButton(info, level)
info.text = "Use Focus Target"
info.text = L["Use Focus Target"]
info.func = function() Omen:ToggleFocus() end
info.checked = db.UseFocus
info.tooltipTitle = L["Use Focus Target"]
info.tooltipText = L["Tells Omen to additionally check your 'focus' and 'focustarget' before your 'target' and 'targettarget' in that order for threat display."]
UIDropDownMenu_AddButton(info, level)
info.text = "Test Mode"
info.text = L["Test Mode"]
info.func = function()
testMode = not testMode
Omen:UpdateBars()
end
info.checked = testMode
info.tooltipTitle = L["Test Mode"]
info.tooltipText = L["Tells Omen to enter Test Mode so that you can configure Omen's display much more easily."]
UIDropDownMenu_AddButton(info, level)
info.text = L["Open Config"]
info.func = function() Omen:ShowConfig() end
info.checked = nil
info.tooltipTitle = L["Open Config"]
info.tooltipText = L["Open Omen's configuration panel"]
UIDropDownMenu_AddButton(info, level)
info.text = L["Hide Omen"]
info.func = function() Omen:Toggle() end
info.tooltipTitle = L["Hide Omen"]
info.tooltipText = nil
UIDropDownMenu_AddButton(info, level)
-- Close menu item
@@ -1542,6 +1552,7 @@ do
info.checked = nil
info.arg1 = nil
info.notCheckable = 1
info.tooltipTitle = CLOSE
UIDropDownMenu_AddButton(info, level)
end
end
@@ -1613,6 +1624,26 @@ local options = {
Omen:UpdateGrips()
end,
},
UseFocus = {
type = "toggle",
name = L["Use Focus Target"],
desc = L["Tells Omen to additionally check your 'focus' and 'focustarget' before your 'target' and 'targettarget' in that order for threat display."],
order = 8,
set = function(info, value)
Omen:ToggleFocus()
end,
},
TestMode = {
type = "toggle",
name = L["Test Mode"],
desc = L["Tells Omen to enter Test Mode so that you can configure Omen's display much more easily."],
order = 9,
get = function(info) return testMode end,
set = function(info, value)
testMode = value
Omen:UpdateBars()
end,
},
Autocollapse = {
type = "toggle",
name = L["Autocollapse"],
@@ -1620,7 +1651,7 @@ local options = {
order = 10,
set = function(info, value)
db.Autocollapse = value
Omen.Anchor:SetHeight(5*db.Bar.Height + 4*db.Bar.Spacing + Omen.Title:GetHeight() + 2*db.Background.BarInset)
Omen.Anchor:SetHeight(6*db.Bar.Height + 5*db.Bar.Spacing + Omen.Title:GetHeight() + 2*db.Background.BarInset)
Omen:SetAnchors()
Omen.BarList:Show()
Omen:UpdateVisible()