From 8ff091dcbfd7397980acd10aca8be3883082d6c5 Mon Sep 17 00:00:00 2001 From: Xinhuan Date: Thu, 30 Oct 2008 12:09:51 +0800 Subject: [PATCH] Add Show/Hide Title bar option. --- Localization/deDE.lua | 2 ++ Localization/enUS.lua | 2 ++ Localization/frFR.lua | 2 ++ Localization/koKR.lua | 2 ++ Localization/zhCN.lua | 2 ++ Localization/zhTW.lua | 2 ++ Omen.lua | 39 ++++++++++++++++++++++++++++++++++++--- 7 files changed, 48 insertions(+), 3 deletions(-) diff --git a/Localization/deDE.lua b/Localization/deDE.lua index 91786dc..30f173f 100644 --- a/Localization/deDE.lua +++ b/Localization/deDE.lua @@ -62,6 +62,8 @@ L["Sets how far inside the frame the threat bars will display from the 4 borders -- Config strings, title bar section L["Title Bar Settings"] = "Optionen für die Titelleiste" L["Configure title bar settings."] = "Einstellungen für die Titelleiste ändern" +L["Show Title Bar"] = true +L["Show the Omen Title Bar"] = true L["Title Bar Height"] = "Höhe der Titelleisten" L["Height of the title bar. The minimum height allowed is twice the background border thickness."] = "Höhe der Titelleisten. Die minimal erlaubte Höhe ist doppelt so dick wie der Rand des Hintergrundfensters" L["Title Text Options"] = "Optionen für den Titeltext" diff --git a/Localization/enUS.lua b/Localization/enUS.lua index c89965a..edb97e1 100644 --- a/Localization/enUS.lua +++ b/Localization/enUS.lua @@ -62,6 +62,8 @@ L["Sets how far inside the frame the threat bars will display from the 4 borders -- Config strings, title bar section L["Title Bar Settings"] = true L["Configure title bar settings."] = true +L["Show Title Bar"] = true +L["Show the Omen Title Bar"] = true L["Title Bar Height"] = true L["Height of the title bar. The minimum height allowed is twice the background border thickness."] = true L["Title Text Options"] = true diff --git a/Localization/frFR.lua b/Localization/frFR.lua index ab051ab..813fdf8 100644 --- a/Localization/frFR.lua +++ b/Localization/frFR.lua @@ -62,6 +62,8 @@ L["Sets how far inside the frame the threat bars will display from the 4 borders -- Config strings, title bar section L["Title Bar Settings"] = "Param. du titre" L["Configure title bar settings."] = "Configure les paramètres de la barre du titre." +L["Show Title Bar"] = true +L["Show the Omen Title Bar"] = true L["Title Bar Height"] = "Hauteur de la barre-titre" L["Height of the title bar. The minimum height allowed is twice the background border thickness."] = "Hauteur de la barre du titre. La hauteur minimale autorisée est le double de l'épaisseur de la bordure de l'arrière-plan." L["Title Text Options"] = "Options du texte du titre" diff --git a/Localization/koKR.lua b/Localization/koKR.lua index 5aa3ef6..d682cbe 100644 --- a/Localization/koKR.lua +++ b/Localization/koKR.lua @@ -62,6 +62,8 @@ L["Sets how far inside the frame the threat bars will display from the 4 borders -- Config strings, title bar section L["Title Bar Settings"] = "제목 바 설정" L["Configure title bar settings."] = "제목 바를 설정합니다." +L["Show Title Bar"] = true +L["Show the Omen Title Bar"] = true L["Title Bar Height"] = "제목 바 높이" L["Height of the title bar. The minimum height allowed is twice the background border thickness."] = "제목 바의 높이를 설정합니다. 최소 허락된 높이는 배경 테두리 두께입니다." L["Title Text Options"] = "제목 문자 옵션" diff --git a/Localization/zhCN.lua b/Localization/zhCN.lua index 3b33919..bb5af3e 100644 --- a/Localization/zhCN.lua +++ b/Localization/zhCN.lua @@ -62,6 +62,8 @@ L["Sets how far inside the frame the threat bars will display from the 4 borders -- Config strings, title bar section L["Title Bar Settings"] = "标题栏设置" L["Configure title bar settings."] = "配置标题栏设置" +L["Show Title Bar"] = true +L["Show the Omen Title Bar"] = true L["Title Bar Height"] = "标题栏高度" L["Height of the title bar. The minimum height allowed is twice the background border thickness."] = "标题栏高度。最小厚度为背景边框厚度的一倍。" L["Title Text Options"] = "标题文本选项" diff --git a/Localization/zhTW.lua b/Localization/zhTW.lua index ab0e413..781500a 100644 --- a/Localization/zhTW.lua +++ b/Localization/zhTW.lua @@ -62,6 +62,8 @@ L["Sets how far inside the frame the threat bars will display from the 4 borders -- Config strings, title bar section L["Title Bar Settings"] = "標題條的設定" L["Configure title bar settings."] = "設定標題條" +L["Show Title Bar"] = true +L["Show the Omen Title Bar"] = true L["Title Bar Height"] = "標題條的高度" L["Height of the title bar. The minimum height allowed is twice the background border thickness."] = "標題條厚度. 厚度的最小值是背景邊緣厚度的一倍" L["Title Text Options"] = "標題設定" diff --git a/Omen.lua b/Omen.lua index 196aaec..158ab5a 100644 --- a/Omen.lua +++ b/Omen.lua @@ -90,6 +90,7 @@ local defaults = { FontOutline = "", FontColor = {r = 1, g = 1, b = 1, a = 1,}, FontSize = 10, + ShowTitleBar = true, }, Bar = { Texture = "Blizzard", @@ -645,7 +646,9 @@ function Omen:UpdateBackdrop() local h = db.Background.EdgeSize * 2 self.Anchor:SetMinResize(90, h) self.Title:SetMinResize(90, h) - if h > db.TitleBar.Height then + if not db.TitleBar.ShowTitleBar then + self.Title:SetHeight(0.0000000001) -- See comment in Omen:UpdateTitleBar() + elseif h > db.TitleBar.Height then self.Title:SetHeight(h) else self.Title:SetHeight(db.TitleBar.Height) @@ -654,6 +657,12 @@ function Omen:UpdateBackdrop() --self.FocusButton:SetPoint("TOPRIGHT", -inset, -inset) + self.BarList:ClearAllPoints() -- See comment in Omen:UpdateTitleBar() + self.BarList:SetPoint("TOPLEFT", self.Title, "BOTTOMLEFT") + self.BarList:SetPoint("TOPRIGHT", self.Title, "BOTTOMRIGHT") + self.BarList:SetPoint("BOTTOMLEFT", self.Anchor, "BOTTOMLEFT") + self.BarList:SetPoint("BOTTOMRIGHT", self.Anchor, "BOTTOMRIGHT") + self:ResizeBars() self:ReAnchorBars() self:UpdateBars() @@ -666,11 +675,24 @@ 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) - if db.Background.EdgeSize * 2 > db.TitleBar.Height then + 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:Hide() + elseif db.Background.EdgeSize * 2 > db.TitleBar.Height then self.Title:SetHeight(db.Background.EdgeSize * 2) + self.Title:Show() else self.Title:SetHeight(db.TitleBar.Height) + self.Title:Show() end + -- This forces the UI to redraw it, I couldn't find a better way. Although it is + -- anchored to the Title, it doesn't update automatically on the height change. + self.BarList:ClearAllPoints() + self.BarList:SetPoint("TOPLEFT", self.Title, "BOTTOMLEFT") + self.BarList:SetPoint("TOPRIGHT", self.Title, "BOTTOMRIGHT") + self.BarList:SetPoint("BOTTOMLEFT", self.Anchor, "BOTTOMLEFT") + self.BarList:SetPoint("BOTTOMRIGHT", self.Anchor, "BOTTOMRIGHT") end function Omen:UpdateFuBarSettings() @@ -1868,6 +1890,7 @@ local options = { set = function(info, value) db.TitleBar[ info[#info] ] = value Omen:UpdateTitleBar() + Omen:UpdateBars() end, args = { intro = { @@ -1875,9 +1898,15 @@ local options = { type = "description", name = L["Configure title bar settings."], }, + ShowTitleBar = { + type = "toggle", + order = 2, + name = L["Show Title Bar"], + desc = L["Show the Omen Title Bar"], + }, Height = { type = "range", - order = 2, + order = 5, 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, @@ -1887,6 +1916,10 @@ local options = { name = L["Title Text Options"], guiInline = true, order = 20, + set = function(info, value) + db.TitleBar[ info[#info] ] = value + Omen:UpdateTitleBar() + end, args = { Font = { type = "select", dialogControl = 'LSM30_Font',