Fix/hack some color issues with the 1995 theme

This commit is contained in:
Henrik Rydgård 2024-10-22 21:26:29 +02:00
parent 834a0a3182
commit 85410305e6
5 changed files with 24 additions and 20 deletions

View File

@ -602,8 +602,10 @@ ItemHeader::ItemHeader(std::string_view text, LayoutParams *layoutParams)
void ItemHeader::Draw(UIContext &dc) {
dc.SetFontStyle(large_ ? dc.theme->uiFont : dc.theme->uiFontSmall);
dc.DrawText(text_, bounds_.x + 4, bounds_.centerY(), dc.theme->headerStyle.fgColor, ALIGN_LEFT | ALIGN_VCENTER);
dc.Draw()->DrawImageCenterTexel(dc.theme->whiteImage, bounds_.x, bounds_.y2()-2, bounds_.x2(), bounds_.y2(), dc.theme->headerStyle.fgColor);
const UI::Style &style = popupStyle_ ? dc.theme->popupStyle : dc.theme->headerStyle;
dc.DrawText(text_, bounds_.x + 4, bounds_.centerY(), style.fgColor, ALIGN_LEFT | ALIGN_VCENTER);
dc.Draw()->DrawImageCenterTexel(dc.theme->whiteImage, bounds_.x, bounds_.y2()-2, bounds_.x2(), bounds_.y2(), style.fgColor);
}
void ItemHeader::GetContentDimensionsBySpec(const UIContext &dc, MeasureSpec horiz, MeasureSpec vert, float &w, float &h) const {
@ -641,10 +643,10 @@ void CollapsibleHeader::Draw(UIContext &dc) {
float xoff = 37.0f;
dc.SetFontStyle(dc.theme->uiFontSmall);
dc.DrawText(text_, bounds_.x + 4 + xoff, bounds_.centerY(), dc.theme->headerStyle.fgColor, ALIGN_LEFT | ALIGN_VCENTER);
dc.Draw()->DrawImageCenterTexel(dc.theme->whiteImage, bounds_.x, bounds_.y2() - 2, bounds_.x2(), bounds_.y2(), dc.theme->headerStyle.fgColor);
dc.DrawText(text_, bounds_.x + 4 + xoff, bounds_.centerY(), style.fgColor, ALIGN_LEFT | ALIGN_VCENTER);
dc.Draw()->DrawImageCenterTexel(dc.theme->whiteImage, bounds_.x, bounds_.y2() - 2, bounds_.x2(), bounds_.y2(), style.fgColor);
if (hasSubItems_) {
dc.Draw()->DrawImageRotated(ImageID("I_ARROW"), bounds_.x + 20.0f, bounds_.y + 20.0f, 1.0f, *toggle_ ? -M_PI / 2 : M_PI);
dc.Draw()->DrawImageRotated(ImageID("I_ARROW"), bounds_.x + 20.0f, bounds_.y + 20.0f, 1.0f, *toggle_ ? -M_PI / 2 : M_PI, style.fgColor);
}
}

View File

@ -853,9 +853,11 @@ public:
std::string DescribeText() const override;
void GetContentDimensionsBySpec(const UIContext &dc, MeasureSpec horiz, MeasureSpec vert, float &w, float &h) const override;
void SetLarge(bool large) { large_ = large; }
void SetPopupStyle(bool popupStyle) { popupStyle_ = popupStyle; }
private:
std::string text_;
bool large_ = false;
bool popupStyle_ = false;
};
class PopupHeader : public Item {

View File

@ -1061,7 +1061,7 @@ UI::EventReturn GameBrowser::NavigateClick(UI::EventParams &e) {
UI::EventReturn GameBrowser::GridSettingsClick(UI::EventParams &e) {
auto sy = GetI18NCategory(I18NCat::SYSTEM);
auto gridSettings = new GridSettingsScreen(sy->T("Games list settings"));
auto gridSettings = new GridSettingsPopupScreen(sy->T("Games list settings"));
gridSettings->OnRecentChanged.Handle(this, &GameBrowser::OnRecentClear);
if (e.v)
gridSettings->SetPopupOrigin(e.v);
@ -1195,7 +1195,7 @@ void MainScreen::CreateViews() {
if (g_Config.HasRecentIsos()) {
tabHolder_->SetCurrentTab(0, true);
} else if (g_Config.iMaxRecent > 0) {
tabHolder_->SetCurrentTab(1, true);
tabHolder_->SetCurrentTab(1, true);
}
if (backFromStore_ || showHomebrewTab) {
@ -1721,7 +1721,7 @@ UI::EventReturn UmdReplaceScreen::OnGameSettings(UI::EventParams &e) {
return UI::EVENT_DONE;
}
void GridSettingsScreen::CreatePopupContents(UI::ViewGroup *parent) {
void GridSettingsPopupScreen::CreatePopupContents(UI::ViewGroup *parent) {
using namespace UI;
auto di = GetI18NCategory(I18NCat::DIALOG);
@ -1734,34 +1734,34 @@ void GridSettingsScreen::CreatePopupContents(UI::ViewGroup *parent) {
items->Add(new CheckBox(&g_Config.bGridView2, sy->T("Display Games on a grid")));
items->Add(new CheckBox(&g_Config.bGridView3, sy->T("Display Homebrew on a grid")));
items->Add(new ItemHeader(sy->T("Grid icon size")));
items->Add(new Choice(sy->T("Increase size")))->OnClick.Handle(this, &GridSettingsScreen::GridPlusClick);
items->Add(new Choice(sy->T("Decrease size")))->OnClick.Handle(this, &GridSettingsScreen::GridMinusClick);
items->Add(new ItemHeader(sy->T("Grid icon size")))->SetPopupStyle(true);
items->Add(new Choice(sy->T("Increase size")))->OnClick.Handle(this, &GridSettingsPopupScreen::GridPlusClick);
items->Add(new Choice(sy->T("Decrease size")))->OnClick.Handle(this, &GridSettingsPopupScreen::GridMinusClick);
items->Add(new ItemHeader(sy->T("Display Extra Info")));
items->Add(new ItemHeader(sy->T("Display Extra Info")))->SetPopupStyle(true);
items->Add(new CheckBox(&g_Config.bShowIDOnGameIcon, sy->T("Show ID")));
items->Add(new CheckBox(&g_Config.bShowRegionOnGameIcon, sy->T("Show region flag")));
if (g_Config.iMaxRecent > 0) {
items->Add(new ItemHeader(sy->T("Clear Recent")));
items->Add(new Choice(sy->T("Clear Recent Games List")))->OnClick.Handle(this, &GridSettingsScreen::OnRecentClearClick);
items->Add(new ItemHeader(sy->T("Clear Recent")))->SetPopupStyle(true);
items->Add(new Choice(sy->T("Clear Recent Games List")))->OnClick.Handle(this, &GridSettingsPopupScreen::OnRecentClearClick);
}
scroll->Add(items);
parent->Add(scroll);
}
UI::EventReturn GridSettingsScreen::GridPlusClick(UI::EventParams &e) {
UI::EventReturn GridSettingsPopupScreen::GridPlusClick(UI::EventParams &e) {
g_Config.fGameGridScale = std::min(g_Config.fGameGridScale*1.25f, MAX_GAME_GRID_SCALE);
return UI::EVENT_DONE;
}
UI::EventReturn GridSettingsScreen::GridMinusClick(UI::EventParams &e) {
UI::EventReturn GridSettingsPopupScreen::GridMinusClick(UI::EventParams &e) {
g_Config.fGameGridScale = std::max(g_Config.fGameGridScale/1.25f, MIN_GAME_GRID_SCALE);
return UI::EVENT_DONE;
}
UI::EventReturn GridSettingsScreen::OnRecentClearClick(UI::EventParams &e) {
UI::EventReturn GridSettingsPopupScreen::OnRecentClearClick(UI::EventParams &e) {
g_Config.ClearRecentIsos();
OnRecentChanged.Trigger(e);
return UI::EVENT_DONE;

View File

@ -193,9 +193,9 @@ private:
UI::EventReturn OnGameSettings(UI::EventParams &e);
};
class GridSettingsScreen : public PopupScreen {
class GridSettingsPopupScreen : public PopupScreen {
public:
GridSettingsScreen(std::string_view label) : PopupScreen(label) {}
GridSettingsPopupScreen(std::string_view label) : PopupScreen(label) {}
void CreatePopupContents(UI::ViewGroup *parent) override;
UI::Event OnRecentChanged;

View File

@ -22,7 +22,7 @@ ItemDisabledStyleFg = "#808080FF"
ItemDisabledStyleBg = "#C0C0C0FF"
HeaderStyleFg = "#FFFFFFFF"
InfoStyleFg = "#FFFFFFFF"
InfoStyleBg = "#800080FF"
InfoStyleBg = "#00000000"
PopupStyleBg = "#FFFFAAFF"
BackgroundColor = "#008080FF"
UIAtlas = "../ui_atlas"