Allow the user to have different background settings for the Title Bar than from the main Omen window.
This commit is contained in:
@@ -99,6 +99,14 @@ local defaults = {
|
||||
FontColor = {r = 1, g = 1, b = 1, a = 1,},
|
||||
FontSize = 10,
|
||||
ShowTitleBar = true,
|
||||
UseSameBG = true,
|
||||
Texture = "Blizzard Parchment",
|
||||
BorderTexture = "Blizzard Dialog",
|
||||
Color = {r = 1, g = 1, b = 1, a = 1,},
|
||||
BorderColor = {r = 0.8, g = 0.6, b = 0, a = 1,},
|
||||
Tile = false,
|
||||
TileSize = 32,
|
||||
EdgeSize = 8,
|
||||
},
|
||||
Bar = {
|
||||
Texture = "Blizzard",
|
||||
@@ -715,17 +723,34 @@ function Omen:UpdateBackdrop()
|
||||
bgFrame.insets.right = inset
|
||||
bgFrame.insets.top = inset
|
||||
bgFrame.insets.bottom = inset
|
||||
self.Title:SetBackdrop(bgFrame)
|
||||
self.BarList:SetBackdrop(bgFrame)
|
||||
if not db.TitleBar.UseSameBG then
|
||||
bgFrame.bgFile = LSM:Fetch("background", db.TitleBar.Texture)
|
||||
bgFrame.edgeFile = LSM:Fetch("border", db.TitleBar.BorderTexture)
|
||||
bgFrame.tile = db.TitleBar.Tile
|
||||
bgFrame.tileSize = db.TitleBar.TileSize
|
||||
bgFrame.edgeSize = db.TitleBar.EdgeSize
|
||||
local inset = floor(db.TitleBar.EdgeSize / 4)
|
||||
bgFrame.insets.left = inset
|
||||
bgFrame.insets.right = inset
|
||||
bgFrame.insets.top = inset
|
||||
bgFrame.insets.bottom = inset
|
||||
|
||||
end
|
||||
self.Title:SetBackdrop(bgFrame)
|
||||
|
||||
local c = db.Background.Color
|
||||
self.Title:SetBackdropColor(c.r, c.g, c.b, c.a)
|
||||
self.BarList:SetBackdropColor(c.r, c.g, c.b, c.a)
|
||||
if not db.TitleBar.UseSameBG then c = db.TitleBar.Color end
|
||||
self.Title:SetBackdropColor(c.r, c.g, c.b, c.a)
|
||||
|
||||
c = db.Background.BorderColor
|
||||
self.Title:SetBackdropBorderColor(c.r, c.g, c.b, c.a)
|
||||
self.BarList:SetBackdropBorderColor(c.r, c.g, c.b, c.a)
|
||||
if not db.TitleBar.UseSameBG then c = db.TitleBar.BorderColor end
|
||||
self.Title:SetBackdropBorderColor(c.r, c.g, c.b, c.a)
|
||||
|
||||
local h = db.Background.EdgeSize * 2
|
||||
if not db.TitleBar.UseSameBG then h = db.TitleBar.EdgeSize * 2 end
|
||||
self.Anchor:SetMinResize(90, h)
|
||||
self.Title:SetMinResize(90, h)
|
||||
if not db.TitleBar.ShowTitleBar then
|
||||
@@ -755,12 +780,14 @@ function Omen:UpdateTitleBar()
|
||||
local color = db.TitleBar.FontColor
|
||||
self.TitleText:SetFont(font, size, flags)
|
||||
self.TitleText:SetTextColor(color.r, color.g, color.b, color.a)
|
||||
local h = db.Background.EdgeSize * 2
|
||||
if not db.TitleBar.UseSameBG then h = db.TitleBar.EdgeSize * 2 end
|
||||
if not db.TitleBar.ShowTitleBar then
|
||||
-- Yes, its a hack, since it can't be set to 0
|
||||
self.Title:SetHeight(1e-6)
|
||||
self.Title:Hide()
|
||||
elseif db.Background.EdgeSize * 2 > db.TitleBar.Height then
|
||||
self.Title:SetHeight(db.Background.EdgeSize * 2)
|
||||
elseif h > db.TitleBar.Height then
|
||||
self.Title:SetHeight(h)
|
||||
self.Title:Show()
|
||||
else
|
||||
self.Title:SetHeight(db.TitleBar.Height)
|
||||
@@ -2164,6 +2191,7 @@ local options = {
|
||||
name = L["Title Bar Height"],
|
||||
desc = L["Height of the title bar. The minimum height allowed is twice the background border thickness."],
|
||||
min = 2, max = 32, step = 1,
|
||||
disabled = function() return not db.TitleBar.ShowTitleBar end,
|
||||
},
|
||||
TitleText = {
|
||||
type = "group",
|
||||
@@ -2174,6 +2202,7 @@ local options = {
|
||||
db.TitleBar[ info[#info] ] = value
|
||||
Omen:UpdateTitleBar()
|
||||
end,
|
||||
disabled = function() return not db.TitleBar.ShowTitleBar end,
|
||||
args = {
|
||||
Font = {
|
||||
type = "select", dialogControl = 'LSM30_Font',
|
||||
@@ -2214,6 +2243,99 @@ local options = {
|
||||
},
|
||||
},
|
||||
},
|
||||
UseSameBG = {
|
||||
type = "toggle",
|
||||
order = 30,
|
||||
width = "double",
|
||||
name = L["Use Same Background"],
|
||||
desc = L["Use the same background settings for the title bar as the main window's background"],
|
||||
set = function(info, value)
|
||||
db.TitleBar.UseSameBG = value
|
||||
Omen:UpdateBackdrop()
|
||||
end,
|
||||
disabled = function() return not db.TitleBar.ShowTitleBar end,
|
||||
},
|
||||
Background = {
|
||||
type = "group",
|
||||
name = L["Title Bar Background Options"],
|
||||
guiInline = true,
|
||||
order = 31,
|
||||
get = function(info) return db.TitleBar[ info[#info] ] end,
|
||||
set = function(info, value)
|
||||
db.TitleBar[ info[#info] ] = value
|
||||
Omen:UpdateBackdrop()
|
||||
end,
|
||||
disabled = function() return not db.TitleBar.ShowTitleBar or db.TitleBar.UseSameBG end,
|
||||
args = {
|
||||
Texture = {
|
||||
type = "select", dialogControl = 'LSM30_Background',
|
||||
order = 1,
|
||||
name = L["Background Texture"],
|
||||
desc = L["Texture to use for the frame's background"],
|
||||
values = AceGUIWidgetLSMlists.background,
|
||||
},
|
||||
BorderTexture = {
|
||||
type = "select", dialogControl = 'LSM30_Border',
|
||||
order = 2,
|
||||
name = L["Border Texture"],
|
||||
desc = L["Texture to use for the frame's border"],
|
||||
values = AceGUIWidgetLSMlists.border,
|
||||
},
|
||||
Color = {
|
||||
type = "color",
|
||||
order = 3,
|
||||
name = L["Background Color"],
|
||||
desc = L["Frame's background color"],
|
||||
hasAlpha = true,
|
||||
get = function(info)
|
||||
local t = db.TitleBar.Color
|
||||
return t.r, t.g, t.b, t.a
|
||||
end,
|
||||
set = function(info, r, g, b, a)
|
||||
local t = db.TitleBar.Color
|
||||
t.r, t.g, t.b, t.a = r, g, b, a
|
||||
Omen:UpdateBackdrop()
|
||||
end,
|
||||
},
|
||||
BorderColor = {
|
||||
type = "color",
|
||||
order = 4,
|
||||
name = L["Border Color"],
|
||||
desc = L["Frame's border color"],
|
||||
hasAlpha = true,
|
||||
get = function(info)
|
||||
local t = db.TitleBar.BorderColor
|
||||
return t.r, t.g, t.b, t.a
|
||||
end,
|
||||
set = function(info, r, g, b, a)
|
||||
local t = db.TitleBar.BorderColor
|
||||
t.r, t.g, t.b, t.a = r, g, b, a
|
||||
Omen:UpdateBackdrop()
|
||||
end,
|
||||
},
|
||||
Tile = {
|
||||
type = "toggle",
|
||||
order = 5,
|
||||
name = L["Tile Background"],
|
||||
desc = L["Tile the background texture"],
|
||||
},
|
||||
TileSize = {
|
||||
type = "range",
|
||||
order = 6,
|
||||
name = L["Background Tile Size"],
|
||||
desc = L["The size used to tile the background texture"],
|
||||
min = 16, max = 256, step = 1,
|
||||
disabled = function() return not db.TitleBar.ShowTitleBar or db.TitleBar.UseSameBG or not db.TitleBar.Tile end,
|
||||
},
|
||||
EdgeSize = {
|
||||
type = "range",
|
||||
order = 7,
|
||||
name = L["Border Thickness"],
|
||||
desc = L["The thickness of the border"],
|
||||
min = 1, max = 16, step = 1,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Bars = {
|
||||
|
||||
Reference in New Issue
Block a user