Add Frame Strata and Clamp To Screen options.

This commit is contained in:
Xinhuan
2008-11-01 04:45:28 +08:00
parent e44f5c6f91
commit 10b3cf44a2
8 changed files with 83 additions and 19 deletions
+55 -19
View File
@@ -79,6 +79,8 @@ local defaults = {
VGrip2 = 115,
UseFocus = false,
IgnorePlayerPets = true,
FrameStrata = "3-MEDIUM",
ClampToScreen = true,
Background = {
Texture = "Blizzard Parchment",
BorderTexture = "Blizzard Dialog",
@@ -319,7 +321,6 @@ function Omen:CreateFrames()
self.Anchor:SetPoint("CENTER", UIParent, "CENTER")
self.Anchor:SetWidth(225)
self.Anchor:SetHeight(150)
self.Anchor:SetClampedToScreen(true)
self.Anchor:SetScript("OnHide", stopmoving)
-- Create Title
@@ -459,6 +460,8 @@ function Omen:PLAYER_LOGIN()
-- is loaded just before this event fires.
self:SetAnchors(true)
self.Anchor:SetAlpha(db.Alpha)
self.Anchor:SetFrameStrata(strsub(db.FrameStrata, 3))
self.Anchor:SetClampedToScreen(db.ClampToScreen)
self:UpdateBackdrop()
self:UpdateTitleBar()
self:UpdateGrips()
@@ -550,6 +553,8 @@ function Omen:OnProfileChanged(event, database, newProfileKey)
db = database.profile
self:SetAnchors(true)
self.Anchor:SetAlpha(db.Alpha)
self.Anchor:SetFrameStrata(strsub(db.FrameStrata, 3))
self.Anchor:SetClampedToScreen(db.ClampToScreen)
self:UpdateBackdrop()
self:UpdateTitleBar()
self:UpdateGrips()
@@ -1672,7 +1677,7 @@ local options = {
end,
},
Scale = {
order = 5,
order = 4,
name = L["Scale"],
desc = L["Controls the scaling of the main Omen window."],
type = "range",
@@ -1683,6 +1688,36 @@ local options = {
Omen:SetAnchors()
end,
},
FrameStrata = {
type = "select",
order = 5,
name = L["Frame Strata"],
desc = L["Controls the frame strata of the main Omen window. Default: MEDIUM"],
values = { -- A hack to sort them in the menu
["1-BACKGROUND"] = "BACKGROUND",
["2-LOW"] = "LOW",
["3-MEDIUM"] = "MEDIUM",
["4-HIGH"] = "HIGH",
["5-DIALOG"] = "DIALOG",
["6-FULLSCREEN"] = "FULLSCREEN",
["7-FULLSCREEN_DIALOG"] = "FULLSCREEN_DIALOG",
["8-TOOLTIP"] = "TOOLTIP",
},
set = function(info, value)
db.FrameStrata = value
Omen.Anchor:SetFrameStrata(strsub(value, 3))
end,
},
ClampToScreen = {
type = "toggle",
name = L["Clamp To Screen"],
desc = L["Controls whether the main Omen window can be dragged offscreen"],
order = 6,
set = function(info, value)
db.ClampToScreen = value
Omen.Anchor:SetFrameStrata(value)
end,
},
Locked = {
type = "toggle",
name = L["Lock Omen"],
@@ -1734,20 +1769,6 @@ local options = {
Omen:UpdateBars()
end,
},
Autocollapse = {
type = "toggle",
name = L["Autocollapse"],
desc = L["Collapse to show a minimum number of bars"],
order = 20,
set = function(info, value)
db.Autocollapse = value
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()
Omen:UpdateBars()
end,
},
AutocollapseGroup = {
type = "group",
name = L["Autocollapse Options"],
@@ -1760,8 +1781,23 @@ local options = {
Omen:UpdateBars()
end,
args = {
GrowUp = {
Autocollapse = {
type = "toggle",
name = L["Autocollapse"],
desc = L["Collapse to show a minimum number of bars"],
order = 1,
set = function(info, value)
db.Autocollapse = value
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()
Omen:UpdateBars()
end,
disabled = false,
},
GrowUp = {
order = 2,
type = "toggle",
name = L["Grow bars upwards"],
desc = L["Grow bars upwards"],
@@ -1771,13 +1807,13 @@ local options = {
end,
},
CollapseHide = {
order = 2,
order = 3,
type = "toggle",
name = L["Hide Omen on 0 bars"],
desc = L["Hide Omen entirely if it collapses to show 0 bars"],
},
NumBars = {
order = 3,
order = 4,
name = L["Max bars to show"],
desc = L["Max number of bars to show"],
type = "range",