diff --git a/Common/UI/UIScreen.cpp b/Common/UI/UIScreen.cpp index e0fa4b483f..97a9896d05 100644 --- a/Common/UI/UIScreen.cpp +++ b/Common/UI/UIScreen.cpp @@ -18,14 +18,14 @@ static const bool ClickDebug = false; UIScreen::UIScreen() : Screen() { - lastVertical_ = UseVerticalLayout(); + lastPortrait_ = UsePortraitLayout(); } UIScreen::~UIScreen() { delete root_; } -bool UIScreen::UseVerticalLayout() const { +bool UIScreen::UsePortraitLayout() const { return g_display.dp_yres > g_display.dp_xres * 1.1f; } @@ -140,10 +140,10 @@ bool UIScreen::UnsyncKey(const KeyInput &key) { } void UIScreen::update() { - bool vertical = UseVerticalLayout(); - if (vertical != lastVertical_) { + bool portrait = UsePortraitLayout(); + if (portrait != lastPortrait_) { RecreateViews(); - lastVertical_ = vertical; + lastPortrait_ = portrait; } DoRecreateViews(); diff --git a/Common/UI/UIScreen.h b/Common/UI/UIScreen.h index 288ec9504f..394b04012f 100644 --- a/Common/UI/UIScreen.h +++ b/Common/UI/UIScreen.h @@ -61,7 +61,7 @@ protected: virtual void CreateViews() = 0; void RecreateViews() override { recreateViews_ = true; } - bool UseVerticalLayout() const; + bool UsePortraitLayout() const; UI::ViewGroup *root_ = nullptr; Vec3 translation_ = Vec3(0.0f); @@ -78,7 +78,7 @@ protected: void DoRecreateViews(); bool recreateViews_ = true; - bool lastVertical_; + bool lastPortrait_; private: std::mutex eventQueueLock_; diff --git a/UI/ControlMappingScreen.cpp b/UI/ControlMappingScreen.cpp index df8320a746..4e4fbcd91e 100644 --- a/UI/ControlMappingScreen.cpp +++ b/UI/ControlMappingScreen.cpp @@ -559,6 +559,8 @@ void AnalogSetupScreen::CreateViews() { auto di = GetI18NCategory(I18NCat::DIALOG); + const bool portrait = UsePortraitLayout(); + root_ = new LinearLayout(ORIENT_HORIZONTAL); LinearLayout *leftColumn = root_->Add(new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(300.0f, FILL_PARENT, Margins(10, 0, 0, 10)))); diff --git a/UI/DisplayLayoutScreen.cpp b/UI/DisplayLayoutScreen.cpp index 89cda23fc7..c06c343269 100644 --- a/UI/DisplayLayoutScreen.cpp +++ b/UI/DisplayLayoutScreen.cpp @@ -200,14 +200,14 @@ void DisplayLayoutScreen::CreateViews() { root_ = new AnchorLayout(new LayoutParams(FILL_PARENT, FILL_PARENT)); - bool vertical = bounds.h > bounds.w; + const bool portrait = UsePortraitLayout(); // Make it so that a touch can only affect one view. Makes manipulating the background through the buttons // impossible. root_->SetExclusiveTouch(true); LinearLayout *leftColumn; - if (!vertical) { + if (!portrait) { ScrollView *leftScrollView = new ScrollView(ORIENT_VERTICAL, new AnchorLayoutParams(420.0f, FILL_PARENT, 0.f, 0.f, NONE, 0.f, false)); leftColumn = new LinearLayout(ORIENT_VERTICAL); leftColumn->padding.SetAll(8.0f); @@ -224,7 +224,7 @@ void DisplayLayoutScreen::CreateViews() { root_->Add(rightScrollView); LinearLayout *bottomControls; - if (vertical) { + if (portrait) { bottomControls = new LinearLayout(ORIENT_HORIZONTAL); rightColumn->Add(bottomControls); leftColumn = rightColumn; @@ -295,7 +295,7 @@ void DisplayLayoutScreen::CreateViews() { back->OnClick.Handle(this, &UIScreen::OnBack); rightColumn->Add(back); - if (vertical) { + if (portrait) { leftColumn->Add(new Spacer(24.0f)); } diff --git a/UI/IAPScreen.cpp b/UI/IAPScreen.cpp index 4f16074b50..86e9b56f4c 100644 --- a/UI/IAPScreen.cpp +++ b/UI/IAPScreen.cpp @@ -13,7 +13,7 @@ void IAPScreen::CreateViews() { auto di = GetI18NCategory(I18NCat::DIALOG); auto mm = GetI18NCategory(I18NCat::MAINMENU); - const bool vertical = UseVerticalLayout(); + const bool vertical = UsePortraitLayout(); root_ = new LinearLayout(vertical ? ORIENT_VERTICAL : ORIENT_HORIZONTAL, new LayoutParams(FILL_PARENT, FILL_PARENT)); diff --git a/UI/MainScreen.cpp b/UI/MainScreen.cpp index 118af2a515..2e649963df 100644 --- a/UI/MainScreen.cpp +++ b/UI/MainScreen.cpp @@ -1207,7 +1207,7 @@ void MainScreen::CreateViews() { // Scrolling action menu to the right. using namespace UI; - const bool vertical = UseVerticalLayout(); + const bool vertical = UsePortraitLayout(); auto mm = GetI18NCategory(I18NCat::MAINMENU); diff --git a/UI/MiscScreens.cpp b/UI/MiscScreens.cpp index 2596fb25e8..5be43fa1c0 100644 --- a/UI/MiscScreens.cpp +++ b/UI/MiscScreens.cpp @@ -626,7 +626,7 @@ void PromptScreen::CreateViews() { // Scrolling action menu to the right. using namespace UI; - const bool vertical = UseVerticalLayout(); + const bool vertical = UsePortraitLayout(); root_ = new AnchorLayout(); ViewGroup *rightColumnItems; diff --git a/UI/OnScreenDisplay.cpp b/UI/OnScreenDisplay.cpp index 0ed106378f..3b6521f0c1 100644 --- a/UI/OnScreenDisplay.cpp +++ b/UI/OnScreenDisplay.cpp @@ -561,10 +561,10 @@ void OSDOverlayScreen::DrawForeground(UIContext &ui) { void OSDOverlayScreen::update() { // Partial version of UIScreen::update() but doesn't do event processing to avoid duplicate event processing. - bool vertical = UseVerticalLayout(); - if (vertical != lastVertical_) { + bool portrait = UsePortraitLayout(); + if (portrait != lastPortrait_) { RecreateViews(); - lastVertical_ = vertical; + lastPortrait_ = portrait; } DoRecreateViews(); diff --git a/UI/PauseScreen.cpp b/UI/PauseScreen.cpp index 0088dfbebe..b0ace4335a 100644 --- a/UI/PauseScreen.cpp +++ b/UI/PauseScreen.cpp @@ -393,7 +393,7 @@ void GamePauseScreen::CreateSavestateControls(UI::LinearLayout *leftColumnItems, void GamePauseScreen::CreateViews() { using namespace UI; - bool vertical = UseVerticalLayout(); + bool portrait = UsePortraitLayout(); Margins scrollMargins(0, 10, 0, 0); Margins actionMenuMargins(0, 10, 15, 0); @@ -489,7 +489,7 @@ void GamePauseScreen::CreateViews() { leftColumnItems->Add(new Spacer(30.0f)); } - CreateSavestateControls(leftColumnItems, vertical); + CreateSavestateControls(leftColumnItems, portrait); } else { // Let's show the active challenges. std::set ids = Achievements::GetActiveChallengeIDs(); @@ -512,7 +512,7 @@ void GamePauseScreen::CreateViews() { LinearLayout *middleColumn = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(64, FILL_PARENT, Margins(0, 10, 0, 15))); root_->Add(middleColumn); middleColumn->SetSpacing(0.0f); - ViewGroup *rightColumnHolder = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(vertical ? 200 : 300, FILL_PARENT, actionMenuMargins)); + ViewGroup *rightColumnHolder = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(portrait ? 200 : 300, FILL_PARENT, actionMenuMargins)); ViewGroup *rightColumn = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(1.0f)); rightColumnHolder->Add(rightColumn); diff --git a/UI/RemoteISOScreen.cpp b/UI/RemoteISOScreen.cpp index 76a4fa84d2..0735ab70c4 100644 --- a/UI/RemoteISOScreen.cpp +++ b/UI/RemoteISOScreen.cpp @@ -591,7 +591,7 @@ void RemoteISOBrowseScreen::CreateViews() { auto di = GetI18NCategory(I18NCat::DIALOG); auto ri = GetI18NCategory(I18NCat::REMOTEISO); - bool vertical = UseVerticalLayout(); + bool portrait = UsePortraitLayout(); using namespace UI; @@ -624,7 +624,7 @@ void RemoteISOBrowseScreen::CreateViews() { rightColumnItems->Add(new Choice(di->T("Back"), "", false, new AnchorLayoutParams(150, WRAP_CONTENT, 10, NONE, NONE, 10)))->OnClick.Handle(this, &UIScreen::OnBack); - if (vertical) { + if (portrait) { root_ = new LinearLayout(ORIENT_VERTICAL); rightColumn->ReplaceLayoutParams(new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)); leftColumn->ReplaceLayoutParams(new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT, 1.0)); diff --git a/UI/TabbedDialogScreen.cpp b/UI/TabbedDialogScreen.cpp index 309fb93007..414daeddd3 100644 --- a/UI/TabbedDialogScreen.cpp +++ b/UI/TabbedDialogScreen.cpp @@ -31,7 +31,7 @@ void TabbedUIDialogScreenWithGameBackground::AddTab(const char *tag, std::string void TabbedUIDialogScreenWithGameBackground::CreateViews() { PreCreateViews(); - bool vertical = UseVerticalLayout() || ForceHorizontalTabs(); + bool portrait = UsePortraitLayout() || ForceHorizontalTabs(); // Information in the top left. // Back button to the bottom left. @@ -44,7 +44,7 @@ void TabbedUIDialogScreenWithGameBackground::CreateViews() { filterNotice_ = new TextView("(filter notice, you shouldn't see this text", new LinearLayoutParams(Margins(20, 5))); filterNotice_->SetVisibility(V_GONE); - if (vertical) { + if (portrait) { auto di = GetI18NCategory(I18NCat::DIALOG); LinearLayout *verticalLayout = new LinearLayout(ORIENT_VERTICAL, new LayoutParams(FILL_PARENT, FILL_PARENT)); tabHolder_ = new TabHolder(ORIENT_HORIZONTAL, 200, TabHolderFlags::BackButton, filterNotice_, new LinearLayoutParams(1.0f)); @@ -62,7 +62,7 @@ void TabbedUIDialogScreenWithGameBackground::CreateViews() { root_->SetDefaultFocusView(tabHolder_); float leftSide = 40.0f; - if (!vertical) { + if (!portrait) { leftSide += 200.0f; } settingInfo_ = new SettingInfoMessage(ALIGN_CENTER | FLAG_WRAP_TEXT, g_display.dp_yres - 200.0f, new AnchorLayoutParams( diff --git a/UI/TiltAnalogSettingsScreen.cpp b/UI/TiltAnalogSettingsScreen.cpp index 86c0e77697..ec41bbc03c 100644 --- a/UI/TiltAnalogSettingsScreen.cpp +++ b/UI/TiltAnalogSettingsScreen.cpp @@ -37,14 +37,14 @@ void TiltAnalogSettingsScreen::CreateViews() { auto co = GetI18NCategory(I18NCat::CONTROLS); auto di = GetI18NCategory(I18NCat::DIALOG); - bool vertical = UseVerticalLayout(); + bool portrait = UsePortraitLayout(); - root_ = new LinearLayout(vertical ? ORIENT_VERTICAL : ORIENT_HORIZONTAL); + root_ = new LinearLayout(portrait ? ORIENT_VERTICAL : ORIENT_HORIZONTAL); root_->SetTag("TiltAnalogSettings"); LinearLayout *settings = new LinearLayoutList(ORIENT_VERTICAL); - if (vertical) { + if (portrait) { // Don't need a scrollview, probably.. root_->Add(settings); } else {