Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Common/UI/View.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion Common/UI/View.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ struct FontStyle {
int flags = 0;
};


// To use with an UI atlas.
struct Theme {
FontStyle uiFont;
Expand All @@ -110,6 +109,7 @@ struct Theme {
Style infoStyle;

Style popupStyle;
Style popupHeaderStyle;

uint32_t backgroundColor;
};
Expand Down
9 changes: 8 additions & 1 deletion UI/Theme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ struct ThemeInfo {
uint32_t uHeaderStyleFg = 0xFFFFFFFF;
uint32_t uInfoStyleFg = 0xFFFFFFFF;
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";
Expand Down Expand Up @@ -134,7 +137,10 @@ static void LoadThemeInfo(const std::vector<Path> &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.uPopupStyleFg, info.uItemStyleFg); // Backwards compat
section.Get("PopupStyleBg", &info.uPopupStyleBg, info.uPopupStyleBg);
section.Get("PopupHeaderStyleFg", &info.uPopupHeaderStyleFg, info.uItemStyleFg); // Backwards compat
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment mentions backwards compatibility but in that case these should be called PopupTitle* not PopupHeader*. Please clarify whether the new naming is intended or a mistake.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reference 9547deb

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well it means backwards compatibility to what was before this change. I like PopupHeader better, and there are not a lot of old themes floating around really.

section.Get("PopupHeaderStyleBg", &info.uPopupHeaderStyleBg, info.uPopupHeaderStyleBg);
section.Get("BackgroundColor", &info.uBackgroundColor, info.uBackgroundColor);

std::string tmpPath;
Expand Down Expand Up @@ -225,7 +231,8 @@ void UpdateTheme(UIContext *ctx) {
ui_theme.headerStyle.fgColor = themeInfos[i].uHeaderStyleFg;
ui_theme.infoStyle = MakeStyle(themeInfos[i].uInfoStyleFg, themeInfos[i].uInfoStyleBg);

ui_theme.popupStyle = MakeStyle(themeInfos[i].uItemStyleFg, themeInfos[i].uPopupStyleBg);
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).
Expand Down
3 changes: 3 additions & 0 deletions assets/themes/1995.ini
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ ItemDisabledStyleBg = "#C0C0C0FF"
HeaderStyleFg = "#FFFFFFFF"
InfoStyleFg = "#FFFFFFFF"
InfoStyleBg = "#00000000"
PopupStyleFg = "#000000FF"
PopupStyleBg = "#FFFFAAFF"
PopupHeaderStyleFg = "#c0c0c0FF"
PopupHeaderStyleBg = "#000080FF"
BackgroundColor = "#008080FF"
UIAtlas = "../ui_atlas"
6 changes: 6 additions & 0 deletions assets/themes/defaultthemes.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ ItemDisabledStyleBg = "#00000055"
HeaderStyleFg = "#FFFFFFFF"
InfoStyleFg = "#FFFFFFFF"
InfoStyleBg = "#00000000"
PopupStyleFg = "#FFFFFFFF"
PopupStyleBg = "#1f4d5eFF"
PopupHeaderStyleFg = "#FFFFFFFF"
PopupHeaderStyleBg = "#00000000"
BackgroundColor = "#244D75FF"
UIAtlas = "../ui_atlas"

Expand All @@ -32,6 +35,9 @@ ItemDisabledStyleBg = "#1b1c1c55"
HeaderStyleFg = "#FFFFFFFF"
InfoStyleFg = "#FFFFFFFF"
InfoStyleBg = "#00000000"
PopupStyleFg = "#FFFFFFFF"
PopupStyleBg = "#0c1d24FF"
PopupHeaderStyleFg = "#FFFFFFFF"
PopupHeaderStyleBg = "#00000000"
BackgroundColor = "#000000FF"
UIAtlas = "../ui_atlas"
3 changes: 3 additions & 0 deletions assets/themes/slateforest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ ItemDisabledStyleBg = "#00000055"
HeaderStyleFg = "#FFFFFFFF"
InfoStyleFg = "#FFFFFFFF"
InfoStyleBg = "#00000000"
PopupStyleFg = "#FFFFFFFF"
PopupStyleBg = "#9498A1FF"
PopupHeaderStyleFg = "#FFFFFFFF"
PopupHeaderStyleBg = "#00000000"
BackgroundColor = "#122537FF"
UIAtlas = "../ui_atlas"
3 changes: 3 additions & 0 deletions assets/themes/vinewood.ini
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ ItemDisabledStyleBg = "#000000FF"
HeaderStyleFg = "#FFFFFFFF"
InfoStyleFg = "#FFFFFFFF"
InfoStyleBg = "#00000000"
PopupStyleFg = "#C3D7A4FF"
PopupStyleBg = "#94B185FF"
PopupHeaderStyleFg = "#FFFFFFFF"
PopupHeaderStyleBg = "#00000000"
BackgroundColor = "#62865AFF"
UIAtlas = "../ui_atlas"