From f719f1c7fdc2c1b8c8cd3186cedd8525846d4373 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 14 Feb 2025 13:15:13 -0600 Subject: [PATCH] Themes: Reintroduce PopupHeaderStyleFg/Bg --- Common/UI/View.cpp | 8 ++++++-- Common/UI/View.h | 1 + UI/Theme.cpp | 7 ++++++- assets/themes/1995.ini | 2 ++ assets/themes/defaultthemes.ini | 4 ++++ assets/themes/slateforest.ini | 2 ++ assets/themes/vinewood.ini | 2 ++ 7 files changed, 23 insertions(+), 3 deletions(-) diff --git a/Common/UI/View.cpp b/Common/UI/View.cpp index fc59cbbd83..d62f582d37 100644 --- a/Common/UI/View.cpp +++ b/Common/UI/View.cpp @@ -727,8 +727,12 @@ void PopupHeader::Draw(UIContext &dc) { dc.PushScissor(tb); } - dc.DrawText(text_, bounds_.x + tx, bounds_.centerY(), dc.theme->itemStyle.fgColor, ALIGN_LEFT | ALIGN_VCENTER); - dc.Draw()->DrawImageCenterTexel(dc.theme->whiteImage, bounds_.x, bounds_.y2()-2, bounds_.x2(), bounds_.y2(), dc.theme->itemStyle.fgColor); + // Header background + dc.FillRect(dc.theme->popupHeaderStyle.background, bounds_); + // Header title text + dc.DrawText(text_, bounds_.x + tx, bounds_.centerY(), dc.theme->popupHeaderStyle.fgColor, ALIGN_LEFT | ALIGN_VCENTER); + // Underline + dc.Draw()->DrawImageCenterTexel(dc.theme->whiteImage, bounds_.x, bounds_.y2()-2, bounds_.x2(), bounds_.y2(), dc.theme->popupHeaderStyle.fgColor); if (availableWidth < tw) { dc.PopScissor(); diff --git a/Common/UI/View.h b/Common/UI/View.h index 65a7f55270..f25684f8ae 100644 --- a/Common/UI/View.h +++ b/Common/UI/View.h @@ -109,6 +109,7 @@ struct Theme { Style infoStyle; Style popupStyle; + Style popupHeaderStyle; uint32_t backgroundColor; }; diff --git a/UI/Theme.cpp b/UI/Theme.cpp index 4ed0e6cbd3..463be9856f 100644 --- a/UI/Theme.cpp +++ b/UI/Theme.cpp @@ -50,6 +50,8 @@ struct ThemeInfo { uint32_t uInfoStyleBg = 0x00000000; uint32_t uPopupStyleFg = 0xFFFFFFFF; uint32_t uPopupStyleBg = 0xFF303030; + uint32_t uPopupHeaderStyleFg = 0xFFFFFFFF; + uint32_t uPopupHeaderStyleBg = 0x00000000; // default to invisible uint32_t uBackgroundColor = 0xFF754D24; std::string sUIAtlas = "ui_atlas"; @@ -135,8 +137,10 @@ static void LoadThemeInfo(const std::vector &directories) { section.Get("HeaderStyleFg", &info.uHeaderStyleFg, info.uHeaderStyleFg); section.Get("InfoStyleFg", &info.uInfoStyleFg, info.uInfoStyleFg); section.Get("InfoStyleBg", &info.uInfoStyleBg, info.uInfoStyleBg); - section.Get("PopupStyleFg", &info.uPopupStyleBg, info.uItemStyleFg); // Backwards compat + section.Get("PopupStyleFg", &info.uPopupStyleFg, info.uItemStyleFg); // Backwards compat section.Get("PopupStyleBg", &info.uPopupStyleBg, info.uPopupStyleBg); + section.Get("PopupHeaderStyleFg", &info.uPopupHeaderStyleFg, info.uItemStyleFg); // Backwards compat + section.Get("PopupHeaderStyleBg", &info.uPopupHeaderStyleBg, info.uPopupHeaderStyleBg); section.Get("BackgroundColor", &info.uBackgroundColor, info.uBackgroundColor); std::string tmpPath; @@ -228,6 +232,7 @@ void UpdateTheme(UIContext *ctx) { ui_theme.infoStyle = MakeStyle(themeInfos[i].uInfoStyleFg, themeInfos[i].uInfoStyleBg); ui_theme.popupStyle = MakeStyle(themeInfos[i].uPopupStyleFg, themeInfos[i].uPopupStyleBg); + ui_theme.popupHeaderStyle = MakeStyle(themeInfos[i].uPopupHeaderStyleFg, themeInfos[i].uPopupHeaderStyleBg); ui_theme.backgroundColor = themeInfos[i].uBackgroundColor; // Load any missing atlas metadata (the images are loaded from UIContext). diff --git a/assets/themes/1995.ini b/assets/themes/1995.ini index 992222a4a8..ba463e7847 100644 --- a/assets/themes/1995.ini +++ b/assets/themes/1995.ini @@ -25,5 +25,7 @@ InfoStyleFg = "#FFFFFFFF" InfoStyleBg = "#00000000" PopupStyleFg = "#000000FF" PopupStyleBg = "#FFFFAAFF" +PopupHeaderStyleFg = "#c0c0c0FF" +PopupHeaderStyleBg = "#000080FF" BackgroundColor = "#008080FF" UIAtlas = "../ui_atlas" diff --git a/assets/themes/defaultthemes.ini b/assets/themes/defaultthemes.ini index 0ed74b3f3d..86834b5083 100644 --- a/assets/themes/defaultthemes.ini +++ b/assets/themes/defaultthemes.ini @@ -13,6 +13,8 @@ InfoStyleFg = "#FFFFFFFF" InfoStyleBg = "#00000000" PopupStyleFg = "#FFFFFFFF" PopupStyleBg = "#1f4d5eFF" +PopupHeaderStyleFg = "#FFFFFFFF" +PopupHeaderStyleBg = "#00000000" BackgroundColor = "#244D75FF" UIAtlas = "../ui_atlas" @@ -35,5 +37,7 @@ InfoStyleFg = "#FFFFFFFF" InfoStyleBg = "#00000000" PopupStyleFg = "#FFFFFFFF" PopupStyleBg = "#0c1d24FF" +PopupHeaderStyleFg = "#FFFFFFFF" +PopupHeaderStyleBg = "#00000000" BackgroundColor = "#000000FF" UIAtlas = "../ui_atlas" diff --git a/assets/themes/slateforest.ini b/assets/themes/slateforest.ini index a9421801e5..ad7193fe99 100644 --- a/assets/themes/slateforest.ini +++ b/assets/themes/slateforest.ini @@ -23,5 +23,7 @@ InfoStyleFg = "#FFFFFFFF" InfoStyleBg = "#00000000" PopupStyleFg = "#FFFFFFFF" PopupStyleBg = "#9498A1FF" +PopupHeaderStyleFg = "#FFFFFFFF" +PopupHeaderStyleBg = "#00000000" BackgroundColor = "#122537FF" UIAtlas = "../ui_atlas" diff --git a/assets/themes/vinewood.ini b/assets/themes/vinewood.ini index 7600b6039c..b2805f6650 100644 --- a/assets/themes/vinewood.ini +++ b/assets/themes/vinewood.ini @@ -24,5 +24,7 @@ InfoStyleFg = "#FFFFFFFF" InfoStyleBg = "#00000000" PopupStyleFg = "#C3D7A4FF" PopupStyleBg = "#94B185FF" +PopupHeaderStyleFg = "#FFFFFFFF" +PopupHeaderStyleBg = "#00000000" BackgroundColor = "#62865AFF" UIAtlas = "../ui_atlas"