From d251a9c99f39f0a2b61f8188d28a65cf8bd4923c Mon Sep 17 00:00:00 2001 From: Xinhuan Date: Fri, 14 Nov 2008 03:43:31 +0800 Subject: [PATCH] Allow the user to have different background settings for the Title Bar than from the main Omen window. --- Localization/deDE.lua | 3 + Localization/enUS.lua | 3 + Localization/esES.lua | 3 + Localization/frFR.lua | 3 + Localization/koKR.lua | 3 + Localization/ruRU.lua | 3 + Localization/zhCN.lua | 3 + Localization/zhTW.lua | 3 + Omen.lua | 132 ++++++++++++++++++++++++++++++++++++++++-- 9 files changed, 151 insertions(+), 5 deletions(-) diff --git a/Localization/deDE.lua b/Localization/deDE.lua index f79a544..37ab527 100644 --- a/Localization/deDE.lua +++ b/Localization/deDE.lua @@ -91,6 +91,9 @@ L["The font that the title text will use"] = "Die Schriftart die der Titeltext v L["The outline that the title text will use"] = "Die Kontur die der Titeltext verwenden wird" L["The color of the title text"] = "Die Farbe die der Titeltext verwenden wird" L["Control the font size of the title text"] = "Die Schriftgröße des Titeltextes ändern" +L["Use Same Background"] = true +L["Use the same background settings for the title bar as the main window's background"] = true +L["Title Bar Background Options"] = true -- Config strings, show when... section L["Show When..."] = "Zeige wenn..." diff --git a/Localization/enUS.lua b/Localization/enUS.lua index a489d7b..e737528 100644 --- a/Localization/enUS.lua +++ b/Localization/enUS.lua @@ -91,6 +91,9 @@ L["The font that the title text will use"] = true L["The outline that the title text will use"] = true L["The color of the title text"] = true L["Control the font size of the title text"] = true +L["Use Same Background"] = true +L["Use the same background settings for the title bar as the main window's background"] = true +L["Title Bar Background Options"] = true -- Config strings, show when... section L["Show When..."] = true diff --git a/Localization/esES.lua b/Localization/esES.lua index b38610b..d01fa96 100644 --- a/Localization/esES.lua +++ b/Localization/esES.lua @@ -91,6 +91,9 @@ L["The font that the title text will use"] = "El fuente que el título usará" L["The outline that the title text will use"] = "La silueta que el texto del título usará" L["The color of the title text"] = "El color del texto del título" L["Control the font size of the title text"] = "Controla la talla del fuente del texto del título" +L["Use Same Background"] = true +L["Use the same background settings for the title bar as the main window's background"] = true +L["Title Bar Background Options"] = true -- Config strings, show when... section L["Show When..."] = "Mostrar cuándo..." diff --git a/Localization/frFR.lua b/Localization/frFR.lua index 9fca925..9952cb2 100644 --- a/Localization/frFR.lua +++ b/Localization/frFR.lua @@ -91,6 +91,9 @@ L["The font that the title text will use"] = "La police d'écriture que le texte L["The outline that the title text will use"] = "Le contour que le texte du titre utilisera." L["The color of the title text"] = "La couleur du texte du titre." L["Control the font size of the title text"] = "Contrôle la taille de la police du texte du titre." +L["Use Same Background"] = true +L["Use the same background settings for the title bar as the main window's background"] = true +L["Title Bar Background Options"] = true -- Config strings, show when... section L["Show When..."] = "Afficher quand…" diff --git a/Localization/koKR.lua b/Localization/koKR.lua index 4a2b819..ab20e63 100644 --- a/Localization/koKR.lua +++ b/Localization/koKR.lua @@ -91,6 +91,9 @@ L["The font that the title text will use"] = "제목 문자 사용 글꼴" L["The outline that the title text will use"] = "제목 문자 사용 외곽선" L["The color of the title text"] = "제목 문자 색상" L["Control the font size of the title text"] = "제목 문자 글꼴 크기" +L["Use Same Background"] = true +L["Use the same background settings for the title bar as the main window's background"] = true +L["Title Bar Background Options"] = true -- Config strings, show when... section L["Show When..."] = "표시 방법..." diff --git a/Localization/ruRU.lua b/Localization/ruRU.lua index a46f062..2353c94 100644 --- a/Localization/ruRU.lua +++ b/Localization/ruRU.lua @@ -91,6 +91,9 @@ L["The font that the title text will use"] = "Шрифт используемы L["The outline that the title text will use"] = "Контур текста заглавий" L["The color of the title text"] = "Цвет текста заглавий" L["Control the font size of the title text"] = "Настройка размера шрифта текста заглавий" +L["Use Same Background"] = true +L["Use the same background settings for the title bar as the main window's background"] = true +L["Title Bar Background Options"] = true -- Config strings, show when... section L["Show When..."] = "Показывать когда.." diff --git a/Localization/zhCN.lua b/Localization/zhCN.lua index fc11a2e..5b2bd61 100644 --- a/Localization/zhCN.lua +++ b/Localization/zhCN.lua @@ -91,6 +91,9 @@ L["The font that the title text will use"] = "标题文本字体" L["The outline that the title text will use"] = "标题文本字体轮廓" L["The color of the title text"] = "标题字体颜色" L["Control the font size of the title text"] = "标题文本字体大小" +L["Use Same Background"] = true +L["Use the same background settings for the title bar as the main window's background"] = true +L["Title Bar Background Options"] = true -- Config strings, show when... section L["Show When..."] = "当何时显示" diff --git a/Localization/zhTW.lua b/Localization/zhTW.lua index e50f023..448476a 100644 --- a/Localization/zhTW.lua +++ b/Localization/zhTW.lua @@ -91,6 +91,9 @@ L["The font that the title text will use"] = "標題文本字體" L["The outline that the title text will use"] = "標題文本字體輪廓" L["The color of the title text"] = "標題字體顏色" L["Control the font size of the title text"] = "標題文本字體大小" +L["Use Same Background"] = true +L["Use the same background settings for the title bar as the main window's background"] = true +L["Title Bar Background Options"] = true -- Config strings, show when... section L["Show When..."] = "當何時顯示" diff --git a/Omen.lua b/Omen.lua index f07699b..bb6510f 100644 --- a/Omen.lua +++ b/Omen.lua @@ -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 = {