From 7b743071d212a2b45fbf4b976e4d3564440a4d60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 23 Oct 2025 12:46:07 +0200 Subject: [PATCH] Prepare for adding more sensible back buttons to TabbedDialogScreen portrait mode --- CMakeLists.txt | 2 + Common/UI/TabHolder.cpp | 2 +- Common/UI/TabHolder.h | 8 ++- UI/DevScreens.cpp | 4 +- UI/GPUDriverTestScreen.cpp | 2 +- UI/GameSettingsScreen.cpp | 2 +- UI/MainScreen.cpp | 4 +- UI/RemoteISOScreen.cpp | 2 +- UI/TabbedDialogScreen.cpp | 4 +- UI/TouchControlVisibilityScreen.cpp | 4 +- UI/UIAtlas.cpp | 3 + UWP/CommonUWP/CommonUWP.vcxproj | 2 + UWP/CommonUWP/CommonUWP.vcxproj.filters | 6 ++ android/jni/Android.mk | 1 + assets/ui_images/images.svg | 77 +++++++++++++++++-------- 15 files changed, 86 insertions(+), 37 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e4bd4a582a..7efddc6b3b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -884,6 +884,8 @@ add_library(Common STATIC Common/UI/ViewGroup.h Common/UI/ScrollView.cpp Common/UI/ScrollView.h + Common/UI/TabHolder.cpp + Common/UI/TabHolder.h Common/UI/PopupScreens.cpp Common/UI/PopupScreens.h Common/BitScan.h diff --git a/Common/UI/TabHolder.cpp b/Common/UI/TabHolder.cpp index 670c35debd..43605d99f2 100644 --- a/Common/UI/TabHolder.cpp +++ b/Common/UI/TabHolder.cpp @@ -8,7 +8,7 @@ namespace UI { -TabHolder::TabHolder(Orientation orientation, float stripSize, View *bannerView, LayoutParams *layoutParams) +TabHolder::TabHolder(Orientation orientation, float stripSize, TabHolderFlags flags, View *bannerView, LayoutParams *layoutParams) : LinearLayout(Opposite(orientation), layoutParams) { SetSpacing(0.0f); if (orientation == ORIENT_HORIZONTAL) { diff --git a/Common/UI/TabHolder.h b/Common/UI/TabHolder.h index 9f098c60ba..00c4e70120 100644 --- a/Common/UI/TabHolder.h +++ b/Common/UI/TabHolder.h @@ -11,9 +11,15 @@ namespace UI { class ChoiceStrip; class ScrollView; +enum class TabHolderFlags { + Default = 0, + BackButton = 1, +}; +ENUM_CLASS_BITOPS(TabHolderFlags); + class TabHolder : public LinearLayout { public: - TabHolder(Orientation orientation, float stripSize, View *bannerView, LayoutParams *layoutParams = 0); + TabHolder(Orientation orientation, float stripSize, TabHolderFlags flags, View *bannerView, LayoutParams *layoutParams); template T *AddTab(std::string_view title, T *tabContents) { diff --git a/UI/DevScreens.cpp b/UI/DevScreens.cpp index 6711f1c0a9..234562993d 100644 --- a/UI/DevScreens.cpp +++ b/UI/DevScreens.cpp @@ -474,7 +474,7 @@ void ShaderListScreen::CreateViews() { LinearLayout *layout = new LinearLayout(ORIENT_VERTICAL); root_ = layout; - tabs_ = new TabHolder(ORIENT_HORIZONTAL, 40, nullptr, new LinearLayoutParams(1.0)); + tabs_ = new TabHolder(ORIENT_HORIZONTAL, 40, TabHolderFlags::Default, nullptr, new LinearLayoutParams(1.0)); tabs_->SetTag("DevShaderList"); layout->Add(tabs_); layout->Add(new Button(di->T("Back")))->OnClick.Handle(this, &UIScreen::OnBack); @@ -549,7 +549,7 @@ void FrameDumpTestScreen::CreateViews() { auto di = GetI18NCategory(I18NCat::DIALOG); TabHolder *tabHolder; - tabHolder = new TabHolder(ORIENT_VERTICAL, 200, nullptr, new AnchorLayoutParams(10, 0, 10, 0, false)); + tabHolder = new TabHolder(ORIENT_VERTICAL, 200, TabHolderFlags::Default, nullptr, new AnchorLayoutParams(10, 0, 10, 0, false)); root_->Add(tabHolder); tabHolder->AddBack(this); tabHolder->SetTag("DumpTypes"); diff --git a/UI/GPUDriverTestScreen.cpp b/UI/GPUDriverTestScreen.cpp index 9277271dc3..b9993af4ea 100644 --- a/UI/GPUDriverTestScreen.cpp +++ b/UI/GPUDriverTestScreen.cpp @@ -301,7 +301,7 @@ void GPUDriverTestScreen::CreateViews() { AnchorLayout *anchor = new AnchorLayout(); root_ = anchor; - tabHolder_ = new TabHolder(ORIENT_HORIZONTAL, 30.0f, nullptr, new AnchorLayoutParams(FILL_PARENT, FILL_PARENT, false)); + tabHolder_ = new TabHolder(ORIENT_HORIZONTAL, 30.0f, TabHolderFlags::Default, nullptr, new AnchorLayoutParams(FILL_PARENT, FILL_PARENT, false)); anchor->Add(tabHolder_); tabHolder_->AddTab("Discard", new LinearLayout(ORIENT_VERTICAL)); tabHolder_->AddTab("Shader", new LinearLayout(ORIENT_VERTICAL)); diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 1a683133d6..8252943932 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -2043,7 +2043,7 @@ void GestureMappingScreen::CreateViews() { root_ = new AnchorLayout(new LayoutParams(FILL_PARENT, FILL_PARENT)); AddStandardBack(root_); - TabHolder *tabHolder = new TabHolder(ORIENT_VERTICAL, 200, nullptr, new AnchorLayoutParams(10, 0, 10, 0, false)); + TabHolder *tabHolder = new TabHolder(ORIENT_VERTICAL, 200, TabHolderFlags::Default, nullptr, new AnchorLayoutParams(10, 0, 10, 0, false)); root_->Add(tabHolder); ScrollView *rightPanel = new ScrollView(ORIENT_VERTICAL); tabHolder->AddTab(co->T("Gesture"), rightPanel); diff --git a/UI/MainScreen.cpp b/UI/MainScreen.cpp index e94295e0bf..ccb655f860 100644 --- a/UI/MainScreen.cpp +++ b/UI/MainScreen.cpp @@ -1131,7 +1131,7 @@ void MainScreen::CreateViews() { auto mm = GetI18NCategory(I18NCat::MAINMENU); - tabHolder_ = new TabHolder(ORIENT_HORIZONTAL, 64, nullptr, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT, 1.0f)); + tabHolder_ = new TabHolder(ORIENT_HORIZONTAL, 64, TabHolderFlags::Default, nullptr, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT, 1.0f)); ViewGroup *leftColumn = tabHolder_; tabHolder_->SetTag("MainScreenGames"); gameBrowsers_.clear(); @@ -1568,7 +1568,7 @@ void UmdReplaceScreen::CreateViews() { auto mm = GetI18NCategory(I18NCat::MAINMENU); auto di = GetI18NCategory(I18NCat::DIALOG); - TabHolder *leftColumn = new TabHolder(ORIENT_HORIZONTAL, 64, nullptr, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT, 1.0)); + TabHolder *leftColumn = new TabHolder(ORIENT_HORIZONTAL, 64, TabHolderFlags::Default, nullptr, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT, 1.0)); leftColumn->SetTag("UmdReplace"); leftColumn->SetClip(true); diff --git a/UI/RemoteISOScreen.cpp b/UI/RemoteISOScreen.cpp index 6ccf857118..76a4fa84d2 100644 --- a/UI/RemoteISOScreen.cpp +++ b/UI/RemoteISOScreen.cpp @@ -595,7 +595,7 @@ void RemoteISOBrowseScreen::CreateViews() { using namespace UI; - TabHolder *leftColumn = new TabHolder(ORIENT_HORIZONTAL, 64, nullptr, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)); + TabHolder *leftColumn = new TabHolder(ORIENT_HORIZONTAL, 64, TabHolderFlags::Default, nullptr, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)); tabHolder_ = leftColumn; tabHolder_->SetTag("RemoteGames"); gameBrowsers_.clear(); diff --git a/UI/TabbedDialogScreen.cpp b/UI/TabbedDialogScreen.cpp index 07346a2c78..09617ea8cc 100644 --- a/UI/TabbedDialogScreen.cpp +++ b/UI/TabbedDialogScreen.cpp @@ -40,13 +40,13 @@ void TabbedUIDialogScreenWithGameBackground::CreateViews() { if (vertical) { auto di = GetI18NCategory(I18NCat::DIALOG); LinearLayout *verticalLayout = new LinearLayout(ORIENT_VERTICAL, new LayoutParams(FILL_PARENT, FILL_PARENT)); - tabHolder_ = new TabHolder(ORIENT_HORIZONTAL, 200, filterNotice_, new LinearLayoutParams(1.0f)); + tabHolder_ = new TabHolder(ORIENT_HORIZONTAL, 200, TabHolderFlags::BackButton, filterNotice_, new LinearLayoutParams(1.0f)); verticalLayout->Add(tabHolder_); CreateExtraButtons(verticalLayout, 0); verticalLayout->Add(new Choice(di->T("Back"), "", false, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT, 0.0f, Margins(10, 0))))->OnClick.Handle(this, &UIScreen::OnBack); root_->Add(verticalLayout); } else { - tabHolder_ = new TabHolder(ORIENT_VERTICAL, 200, filterNotice_, new AnchorLayoutParams(10, 0, 10, 0, false)); + tabHolder_ = new TabHolder(ORIENT_VERTICAL, 200, TabHolderFlags::Default, filterNotice_, new AnchorLayoutParams(10, 0, 10, 0, false)); CreateExtraButtons(tabHolder_->Container(), 10); tabHolder_->AddBack(this); root_->Add(tabHolder_); diff --git a/UI/TouchControlVisibilityScreen.cpp b/UI/TouchControlVisibilityScreen.cpp index 4ad7c9a67a..161f287b5a 100644 --- a/UI/TouchControlVisibilityScreen.cpp +++ b/UI/TouchControlVisibilityScreen.cpp @@ -58,7 +58,7 @@ void TouchControlVisibilityScreen::CreateViews() { Choice *toggleAll = new Choice(di->T("Toggle All"), "", false, new AnchorLayoutParams(leftColumnWidth - 10, WRAP_CONTENT, 10, NONE, NONE, 84)); root_->Add(toggleAll)->OnClick.Handle(this, &TouchControlVisibilityScreen::OnToggleAll); - TabHolder *tabHolder = new TabHolder(ORIENT_VERTICAL, leftColumnWidth, nullptr, new AnchorLayoutParams(10, 0, 10, 0, false)); + TabHolder *tabHolder = new TabHolder(ORIENT_VERTICAL, leftColumnWidth, TabHolderFlags::Default, nullptr, new AnchorLayoutParams(10, 0, 10, 0, false)); tabHolder->SetTag("TouchControlVisibility"); root_->Add(tabHolder); ScrollView *rightPanel = new ScrollView(ORIENT_VERTICAL); @@ -143,7 +143,7 @@ void RightAnalogMappingScreen::CreateViews() { root_ = new AnchorLayout(new LayoutParams(FILL_PARENT, FILL_PARENT)); Choice *back = new Choice(di->T("Back"), "", false, new AnchorLayoutParams(leftColumnWidth - 10, WRAP_CONTENT, 10, NONE, NONE, 10)); root_->Add(back)->OnClick.Handle(this, &UIScreen::OnBack); - TabHolder *tabHolder = new TabHolder(ORIENT_VERTICAL, leftColumnWidth, nullptr, new AnchorLayoutParams(10, 0, 10, 0, false)); + TabHolder *tabHolder = new TabHolder(ORIENT_VERTICAL, leftColumnWidth, TabHolderFlags::Default, nullptr, new AnchorLayoutParams(10, 0, 10, 0, false)); root_->Add(tabHolder); ScrollView *rightPanel = new ScrollView(ORIENT_VERTICAL); tabHolder->AddTab(co->T("Binds"), rightPanel); diff --git a/UI/UIAtlas.cpp b/UI/UIAtlas.cpp index 854acafce5..1ddceec2fb 100644 --- a/UI/UIAtlas.cpp +++ b/UI/UIAtlas.cpp @@ -134,6 +134,9 @@ static const ImageMeta imageIDs[] = { {"I_FILLED_CIRCLE_3", false}, {"I_FILLED_CIRCLE_4", false}, {"I_FILLED_CIRCLE_5", false}, + {"I_SETTINGS_DISPLAY", false}, + {"I_NAVIGATE_BACK", false}, + {"I_NAVIGATE_FORWARD", false}, }; static std::string PNGNameFromID(std::string_view id) { diff --git a/UWP/CommonUWP/CommonUWP.vcxproj b/UWP/CommonUWP/CommonUWP.vcxproj index 7825745660..16413f3310 100644 --- a/UWP/CommonUWP/CommonUWP.vcxproj +++ b/UWP/CommonUWP/CommonUWP.vcxproj @@ -221,6 +221,7 @@ + @@ -384,6 +385,7 @@ + diff --git a/UWP/CommonUWP/CommonUWP.vcxproj.filters b/UWP/CommonUWP/CommonUWP.vcxproj.filters index a6315e5801..01e33d6961 100644 --- a/UWP/CommonUWP/CommonUWP.vcxproj.filters +++ b/UWP/CommonUWP/CommonUWP.vcxproj.filters @@ -523,6 +523,9 @@ Render + + UI + @@ -1005,6 +1008,9 @@ Render + + UI + diff --git a/android/jni/Android.mk b/android/jni/Android.mk index c74c4c410b..519895951a 100644 --- a/android/jni/Android.mk +++ b/android/jni/Android.mk @@ -365,6 +365,7 @@ EXEC_AND_LIB_FILES := \ $(SRC)/Common/UI/View.cpp \ $(SRC)/Common/UI/ViewGroup.cpp \ $(SRC)/Common/UI/ScrollView.cpp \ + $(SRC)/Common/UI/TabHolder.cpp \ $(SRC)/Common/UI/PopupScreens.cpp \ $(SRC)/Common/Serialize/Serializer.cpp \ $(SRC)/Common/ArmCPUDetect.cpp \ diff --git a/assets/ui_images/images.svg b/assets/ui_images/images.svg index 00ccb9713a..b119c3eb35 100644 --- a/assets/ui_images/images.svg +++ b/assets/ui_images/images.svg @@ -24,9 +24,9 @@ inkscape:pagecheckerboard="true" inkscape:deskcolor="#d1d1d1" inkscape:document-units="px" - inkscape:zoom="2.0000001" - inkscape:cx="467.24999" - inkscape:cy="319.24999" + inkscape:zoom="8.0000002" + inkscape:cx="328.24999" + inkscape:cy="324.43749" inkscape:window-width="3840" inkscape:window-height="2071" inkscape:window-x="-9" @@ -34,7 +34,39 @@ inkscape:window-maximized="1" inkscape:current-layer="layer1" showgrid="false" /> + id="I_SETTINGS_DISPLAY" + transform="matrix(1.7225478,0,0,1.7225478,-72.335968,31.982012)"> Layer 1 + id="title1">Layer 1