From d7d37e58d48e45f615e39981d13f04bac316aede Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 19 Jul 2024 09:55:22 +0200 Subject: [PATCH] Remove the title from the "Rotation" popup button. Fixes #17201 --- Common/UI/PopupScreens.cpp | 2 +- Common/UI/View.cpp | 2 +- Common/UI/View.h | 6 +++++- UI/DisplayLayoutScreen.cpp | 1 + 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Common/UI/PopupScreens.cpp b/Common/UI/PopupScreens.cpp index d29fbf044a..a8715591d1 100644 --- a/Common/UI/PopupScreens.cpp +++ b/Common/UI/PopupScreens.cpp @@ -635,7 +635,7 @@ void AbstractChoiceWithValueDisplay::Draw(UIContext &dc) { // If there is a label, assume we want at least 20% of the size for it, at a minimum. - if (!text_.empty()) { + if (!text_.empty() && !hideTitle_) { float availWidth = (bounds_.w - paddingX * 2) * 0.8f; float scale = CalculateValueScale(dc, valueText, availWidth); diff --git a/Common/UI/View.cpp b/Common/UI/View.cpp index d6f8e27490..0ee17eaa82 100644 --- a/Common/UI/View.cpp +++ b/Common/UI/View.cpp @@ -506,7 +506,7 @@ void Choice::Draw(UIContext &dc) { if (image_.isValid() && text_.empty()) { dc.Draw()->DrawImageRotated(image_, bounds_.centerX(), bounds_.centerY(), imgScale_, imgRot_, style.fgColor, imgFlipH_); - } else if (!text_.empty()) { + } else if (!text_.empty() && !hideTitle_) { dc.SetFontStyle(dc.theme->uiFont); int paddingX = 12; diff --git a/Common/UI/View.h b/Common/UI/View.h index 5648b064ce..c39cd4538a 100644 --- a/Common/UI/View.h +++ b/Common/UI/View.h @@ -732,6 +732,10 @@ public: rightIconFlipH_ = flipH; rightIconImage_ = iconImage; } + // Only useful for things that extend Choice. + void SetHideTitle(bool hide) { + hideTitle_ = hide; + } protected: // hackery @@ -751,6 +755,7 @@ protected: float imgRot_ = 0.0f; bool imgFlipH_ = false; u32 drawTextFlags_ = 0; + bool hideTitle_ = false; private: bool selected_ = false; @@ -822,7 +827,6 @@ public: void SetPasswordDisplay() { passwordDisplay_ = true; } - protected: virtual std::string ValueText() const = 0; diff --git a/UI/DisplayLayoutScreen.cpp b/UI/DisplayLayoutScreen.cpp index 93e09d6c2b..261bbe29b9 100644 --- a/UI/DisplayLayoutScreen.cpp +++ b/UI/DisplayLayoutScreen.cpp @@ -274,6 +274,7 @@ void DisplayLayoutScreen::CreateViews() { rotation->SetEnabledFunc([] { return !g_Config.bSkipBufferEffects || g_Config.bSoftwareRendering; }); + rotation->SetHideTitle(true); rightColumn->Add(rotation); Choice *center = new Choice(di->T("Reset"));