diff --git a/Common/StringUtils.cpp b/Common/StringUtils.cpp index e812bad1b6..ee4478a5b4 100644 --- a/Common/StringUtils.cpp +++ b/Common/StringUtils.cpp @@ -154,6 +154,23 @@ std::string LineNumberString(const std::string &str) { return output.str(); } +std::string IndentString(const std::string &str, const std::string &sep, bool skipFirst) { + std::stringstream input(str); + std::stringstream output; + std::string line; + + bool doIndent = !skipFirst; + while (std::getline(input, line)) { + if (doIndent) { + output << sep; + } + doIndent = true; + output << line << "\n"; + } + + return output.str(); +} + void SkipSpace(const char **ptr) { while (**ptr && isspace(**ptr)) { (*ptr)++; diff --git a/Common/StringUtils.h b/Common/StringUtils.h index e19d98f879..7a3e879dca 100644 --- a/Common/StringUtils.h +++ b/Common/StringUtils.h @@ -31,6 +31,7 @@ // Useful for shaders with error messages.. std::string LineNumberString(const std::string &str); +std::string IndentString(const std::string &str, const std::string &sep, bool skipFirst = false); // Other simple string utilities. diff --git a/Common/UI/ViewGroup.cpp b/Common/UI/ViewGroup.cpp index 44d4d90b2d..1f8ebd0436 100644 --- a/Common/UI/ViewGroup.cpp +++ b/Common/UI/ViewGroup.cpp @@ -1,9 +1,12 @@ #include +#include #include +#include #include #include #include +#include "Common/Data/Text/I18n.h" #include "Common/Input/KeyCodes.h" #include "Common/Math/curves.h" #include "Common/UI/Context.h" @@ -157,16 +160,58 @@ void ViewGroup::Draw(UIContext &dc) { std::string ViewGroup::DescribeText() const { std::stringstream ss; - // TODO: In some cases, might be nice to define as a list explicitly. - bool first = true; + bool needNewline = false; for (View *view : views_) { if (view->GetVisibility() != V_VISIBLE) continue; - if (!first) { + std::string s = view->DescribeText(); + if (s.empty()) + continue; + + if (needNewline) { ss << "\n"; } - first = false; - ss << view->DescribeText(); + ss << s; + needNewline = s[s.length() - 1] != '\n'; + } + return ss.str(); +} + +std::string ViewGroup::DescribeListUnordered(const char *heading) const { + std::stringstream ss; + ss << heading << "\n"; + + bool needNewline = false; + for (View *view : views_) { + if (view->GetVisibility() != V_VISIBLE) + continue; + std::string s = view->DescribeText(); + if (s.empty()) + continue; + + ss << " - " << IndentString(s, " ", true); + } + return ss.str(); +} + +std::string ViewGroup::DescribeListOrdered(const char *heading) const { + std::stringstream ss; + ss << heading << "\n"; + + // This is how much space we need for the highest number. + int sz = (int)floorf(log10f((float)views_.size())) + 1; + std::string indent = " " + std::string(sz, ' '); + + bool needNewline = false; + int n = 1; + for (View *view : views_) { + if (view->GetVisibility() != V_VISIBLE) + continue; + std::string s = view->DescribeText(); + if (s.empty()) + continue; + + ss << std::setw(sz) << n++ << ". " << IndentString(s, indent, true); } return ss.str(); } @@ -599,6 +644,11 @@ void LinearLayout::Layout() { } } +std::string LinearLayoutList::DescribeText() const { + auto u = GetI18NCategory("UI Elements"); + return DescribeListOrdered(u->T("List:")); +} + void FrameLayout::Measure(const UIContext &dc, MeasureSpec horiz, MeasureSpec vert) { if (views_.empty()) { MeasureBySpec(layoutParams_->width, 0.0f, horiz, &measuredWidth_); @@ -1151,6 +1201,11 @@ void GridLayout::Layout() { } } +std::string GridLayoutList::DescribeText() const { + auto u = GetI18NCategory("UI Elements"); + return DescribeListOrdered(u->T("List:")); +} + TabHolder::TabHolder(Orientation orientation, float stripSize, LayoutParams *layoutParams) : LinearLayout(Opposite(orientation), layoutParams), stripSize_(stripSize) { SetSpacing(0.0f); @@ -1371,6 +1426,11 @@ void ChoiceStrip::Draw(UIContext &dc) { } } +std::string ChoiceStrip::DescribeText() const { + auto u = GetI18NCategory("UI Elements"); + return DescribeListUnordered(u->T("Choices:")); +} + StickyChoice *ChoiceStrip::Choice(int index) { if ((size_t)index < views_.size()) return static_cast(views_[index]); @@ -1403,6 +1463,11 @@ void ListView::Measure(const UIContext &dc, MeasureSpec horiz, MeasureSpec vert) } } +std::string ListView::DescribeText() const { + auto u = GetI18NCategory("UI Elements"); + return DescribeListOrdered(u->T("List:")); +} + EventReturn ListView::OnItemCallback(int num, EventParams &e) { EventParams ev{}; ev.v = nullptr; diff --git a/Common/UI/ViewGroup.h b/Common/UI/ViewGroup.h index 8261eeb7a6..dfedc175d8 100644 --- a/Common/UI/ViewGroup.h +++ b/Common/UI/ViewGroup.h @@ -84,6 +84,9 @@ public: std::string DescribeText() const override; protected: + std::string DescribeListUnordered(const char *heading) const; + std::string DescribeListOrdered(const char *heading) const; + std::mutex modifyLock_; // Hold this when changing the subviews. std::vector views_; View *defaultFocusView_ = nullptr; @@ -192,6 +195,15 @@ private: float spacing_; }; +class LinearLayoutList : public LinearLayout { +public: + LinearLayoutList(Orientation orientation, LayoutParams *layoutParams = nullptr) + : LinearLayout(orientation, layoutParams) { + } + + std::string DescribeText() const override; +}; + // GridLayout is a little different from the Android layout. This one has fixed size // rows and columns. Items are not allowed to deviate from the set sizes. // Initially, only horizontal layout is supported. @@ -220,6 +232,15 @@ private: int numColumns_; }; +class GridLayoutList : public GridLayout { +public: + GridLayoutList(GridLayoutSettings settings, LayoutParams *layoutParams = nullptr) + : GridLayout(settings, layoutParams) { + } + + std::string DescribeText() const override; +}; + // A scrollview usually contains just a single child - a linear layout or similar. class ScrollView : public ViewGroup { public: @@ -289,6 +310,7 @@ public: void Draw(UIContext &dc) override; std::string DescribeLog() const override { return "ChoiceStrip: " + View::DescribeLog(); } + std::string DescribeText() const override; Event OnChoice; @@ -385,6 +407,7 @@ public: virtual void SetMaxHeight(float mh) { maxHeight_ = mh; } Event OnChoice; std::string DescribeLog() const override { return "ListView: " + View::DescribeLog(); } + std::string DescribeText() const override; private: void CreateAllItems(); diff --git a/UI/ControlMappingScreen.cpp b/UI/ControlMappingScreen.cpp index a3129d7c93..0ef83bcf2b 100644 --- a/UI/ControlMappingScreen.cpp +++ b/UI/ControlMappingScreen.cpp @@ -243,7 +243,7 @@ void ControlMappingScreen::CreateViews() { rightScroll_ = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(1.0f)); rightScroll_->SetTag("ControlMapping"); rightScroll_->SetScrollToTop(false); - LinearLayout *rightColumn = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(1.0f)); + LinearLayout *rightColumn = new LinearLayoutList(ORIENT_VERTICAL, new LinearLayoutParams(1.0f)); rightScroll_->Add(rightColumn); root_->Add(leftColumn); diff --git a/UI/CwCheatScreen.cpp b/UI/CwCheatScreen.cpp index 57f0a2ad61..6d95c6a18e 100644 --- a/UI/CwCheatScreen.cpp +++ b/UI/CwCheatScreen.cpp @@ -97,7 +97,7 @@ void CwCheatScreen::CreateViews() { rightScroll_->SetTag("CwCheats"); rightScroll_->SetScrollToTop(false); rightScroll_->ScrollTo(g_Config.fCwCheatScrollPosition); - LinearLayout *rightColumn = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(200, FILL_PARENT, actionMenuMargins)); + LinearLayout *rightColumn = new LinearLayoutList(ORIENT_VERTICAL, new LinearLayoutParams(200, FILL_PARENT, actionMenuMargins)); rightScroll_->Add(rightColumn); rightColumn->Add(new ItemHeader(cw->T("Cheats"))); diff --git a/UI/DevScreens.cpp b/UI/DevScreens.cpp index b6b524dd35..3fd8e7af04 100644 --- a/UI/DevScreens.cpp +++ b/UI/DevScreens.cpp @@ -258,7 +258,7 @@ void LogConfigScreen::CreateViews() { UI::GridLayoutSettings gridsettings(cellSize, 64, 5); gridsettings.fillCells = true; - GridLayout *grid = vert->Add(new GridLayout(gridsettings, new LayoutParams(FILL_PARENT, WRAP_CONTENT))); + GridLayout *grid = vert->Add(new GridLayoutList(gridsettings, new LayoutParams(FILL_PARENT, WRAP_CONTENT))); for (int i = 0; i < LogManager::GetNumChannels(); i++) { LogTypes::LOG_TYPE type = (LogTypes::LOG_TYPE)i; @@ -443,7 +443,7 @@ void SystemInfoScreen::CreateViews() { root_->Add(tabHolder); ViewGroup *deviceSpecsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT)); deviceSpecsScroll->SetTag("DevSystemInfoDeviceSpecs"); - LinearLayout *deviceSpecs = new LinearLayout(ORIENT_VERTICAL); + LinearLayout *deviceSpecs = new LinearLayoutList(ORIENT_VERTICAL); deviceSpecs->SetSpacing(0); deviceSpecsScroll->Add(deviceSpecs); tabHolder->AddTab(si->T("Device Info"), deviceSpecsScroll); @@ -573,7 +573,7 @@ void SystemInfoScreen::CreateViews() { ViewGroup *buildConfigScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT)); buildConfigScroll->SetTag("DevSystemInfoBuildConfig"); - LinearLayout *buildConfig = new LinearLayout(ORIENT_VERTICAL); + LinearLayout *buildConfig = new LinearLayoutList(ORIENT_VERTICAL); buildConfig->SetSpacing(0); buildConfigScroll->Add(buildConfig); tabHolder->AddTab(si->T("Build Config"), buildConfigScroll); @@ -611,7 +611,7 @@ void SystemInfoScreen::CreateViews() { ViewGroup *cpuExtensionsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT)); cpuExtensionsScroll->SetTag("DevSystemInfoCPUExt"); - LinearLayout *cpuExtensions = new LinearLayout(ORIENT_VERTICAL); + LinearLayout *cpuExtensions = new LinearLayoutList(ORIENT_VERTICAL); cpuExtensions->SetSpacing(0); cpuExtensionsScroll->Add(cpuExtensions); @@ -626,7 +626,7 @@ void SystemInfoScreen::CreateViews() { ViewGroup *gpuExtensionsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT)); gpuExtensionsScroll->SetTag("DevSystemInfoOGLExt"); - LinearLayout *gpuExtensions = new LinearLayout(ORIENT_VERTICAL); + LinearLayout *gpuExtensions = new LinearLayoutList(ORIENT_VERTICAL); gpuExtensions->SetSpacing(0); gpuExtensionsScroll->Add(gpuExtensions); @@ -655,7 +655,7 @@ void SystemInfoScreen::CreateViews() { if (exts.size() > 0) { ViewGroup *eglExtensionsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT)); eglExtensionsScroll->SetTag("DevSystemInfoEGLExt"); - LinearLayout *eglExtensions = new LinearLayout(ORIENT_VERTICAL); + LinearLayout *eglExtensions = new LinearLayoutList(ORIENT_VERTICAL); eglExtensions->SetSpacing(0); eglExtensionsScroll->Add(eglExtensions); @@ -1065,7 +1065,7 @@ void ShaderListScreen::CreateViews() { layout->Add(new Button(di->T("Back")))->OnClick.Handle(this, &UIScreen::OnBack); for (size_t i = 0; i < ARRAY_SIZE(shaderTypes); i++) { ScrollView *scroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(1.0)); - LinearLayout *shaderList = new LinearLayout(ORIENT_VERTICAL, new LayoutParams(FILL_PARENT, WRAP_CONTENT)); + LinearLayout *shaderList = new LinearLayoutList(ORIENT_VERTICAL, new LayoutParams(FILL_PARENT, WRAP_CONTENT)); int count = ListShaders(shaderTypes[i].type, shaderList); scroll->Add(shaderList); tabs_->AddTab(StringFromFormat("%s (%d)", shaderTypes[i].name, count), scroll); @@ -1094,7 +1094,7 @@ void ShaderViewScreen::CreateViews() { scroll->SetTag("DevShaderView"); layout->Add(scroll); - LinearLayout *lineLayout = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)); + LinearLayout *lineLayout = new LinearLayoutList(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)); lineLayout->SetSpacing(0.0); scroll->Add(lineLayout); @@ -1133,7 +1133,7 @@ void FrameDumpTestScreen::CreateViews() { ViewGroup *dumpsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT)); dumpsScroll->SetTag("GameSettingsGraphics"); - LinearLayout *dumps = new LinearLayout(ORIENT_VERTICAL); + LinearLayout *dumps = new LinearLayoutList(ORIENT_VERTICAL); dumps->SetSpacing(0); dumpsScroll->Add(dumps); tabHolder->AddTab("Dumps", dumps); diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index a3c1698eaa..8c64a2ce9a 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -216,7 +216,7 @@ void GameSettingsScreen::CreateViews() { // Graphics ViewGroup *graphicsSettingsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT)); graphicsSettingsScroll->SetTag("GameSettingsGraphics"); - LinearLayout *graphicsSettings = new LinearLayout(ORIENT_VERTICAL); + LinearLayout *graphicsSettings = new LinearLayoutList(ORIENT_VERTICAL); graphicsSettings->SetSpacing(0); graphicsSettingsScroll->Add(graphicsSettings); tabHolder->AddTab(ms->T("Graphics"), graphicsSettingsScroll); @@ -589,7 +589,7 @@ void GameSettingsScreen::CreateViews() { // Audio ViewGroup *audioSettingsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT)); audioSettingsScroll->SetTag("GameSettingsAudio"); - LinearLayout *audioSettings = new LinearLayout(ORIENT_VERTICAL); + LinearLayout *audioSettings = new LinearLayoutList(ORIENT_VERTICAL); audioSettings->SetSpacing(0); audioSettingsScroll->Add(audioSettings); tabHolder->AddTab(ms->T("Audio"), audioSettingsScroll); @@ -641,7 +641,7 @@ void GameSettingsScreen::CreateViews() { // Control ViewGroup *controlsSettingsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT)); controlsSettingsScroll->SetTag("GameSettingsControls"); - LinearLayout *controlsSettings = new LinearLayout(ORIENT_VERTICAL); + LinearLayout *controlsSettings = new LinearLayoutList(ORIENT_VERTICAL); controlsSettings->SetSpacing(0); controlsSettingsScroll->Add(controlsSettings); tabHolder->AddTab(ms->T("Controls"), controlsSettingsScroll); @@ -752,7 +752,7 @@ void GameSettingsScreen::CreateViews() { ViewGroup *networkingSettingsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT)); networkingSettingsScroll->SetTag("GameSettingsNetworking"); - LinearLayout *networkingSettings = new LinearLayout(ORIENT_VERTICAL); + LinearLayout *networkingSettings = new LinearLayoutList(ORIENT_VERTICAL); networkingSettings->SetSpacing(0); networkingSettingsScroll->Add(networkingSettings); tabHolder->AddTab(ms->T("Networking"), networkingSettingsScroll); @@ -840,7 +840,7 @@ void GameSettingsScreen::CreateViews() { ViewGroup *toolsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT)); toolsScroll->SetTag("GameSettingsTools"); - LinearLayout *tools = new LinearLayout(ORIENT_VERTICAL); + LinearLayout *tools = new LinearLayoutList(ORIENT_VERTICAL); tools->SetSpacing(0); toolsScroll->Add(tools); tabHolder->AddTab(ms->T("Tools"), toolsScroll); @@ -855,7 +855,7 @@ void GameSettingsScreen::CreateViews() { // System ViewGroup *systemSettingsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT)); systemSettingsScroll->SetTag("GameSettingsSystem"); - LinearLayout *systemSettings = new LinearLayout(ORIENT_VERTICAL); + LinearLayout *systemSettings = new LinearLayoutList(ORIENT_VERTICAL); systemSettings->SetSpacing(0); systemSettingsScroll->Add(systemSettings); tabHolder->AddTab(ms->T("System"), systemSettingsScroll); @@ -1604,7 +1604,7 @@ void DeveloperToolsScreen::CreateViews() { AddStandardBack(root_); - LinearLayout *list = settingsScroll->Add(new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(1.0f))); + LinearLayout *list = settingsScroll->Add(new LinearLayoutList(ORIENT_VERTICAL, new LinearLayoutParams(1.0f))); list->SetSpacing(0); list->Add(new ItemHeader(sy->T("General"))); diff --git a/UI/MainScreen.cpp b/UI/MainScreen.cpp index f420506484..35c1b425eb 100644 --- a/UI/MainScreen.cpp +++ b/UI/MainScreen.cpp @@ -670,17 +670,17 @@ void GameBrowser::Refresh() { Add(topBar); if (*gridStyle_) { - gameList_ = new UI::GridLayout(UI::GridLayoutSettings(150*g_Config.fGameGridScale, 85*g_Config.fGameGridScale), new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)); + gameList_ = new UI::GridLayoutList(UI::GridLayoutSettings(150*g_Config.fGameGridScale, 85*g_Config.fGameGridScale), new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)); Add(gameList_); } else { - UI::LinearLayout *gl = new UI::LinearLayout(UI::ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)); + UI::LinearLayout *gl = new UI::LinearLayoutList(UI::ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)); gl->SetSpacing(4.0f); gameList_ = gl; Add(gameList_); } } else { if (*gridStyle_) { - gameList_ = new UI::GridLayout(UI::GridLayoutSettings(150*g_Config.fGameGridScale, 85*g_Config.fGameGridScale), new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)); + gameList_ = new UI::GridLayoutList(UI::GridLayoutSettings(150*g_Config.fGameGridScale, 85*g_Config.fGameGridScale), new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)); } else { UI::LinearLayout *gl = new UI::LinearLayout(UI::ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)); gl->SetSpacing(4.0f); @@ -740,7 +740,7 @@ void GameBrowser::Refresh() { fileInfo.clear(); path_.GetListing(fileInfo, "zip:rar:r01:7z:"); if (!fileInfo.empty()) { - UI::LinearLayout *zl = new UI::LinearLayout(UI::ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)); + UI::LinearLayout *zl = new UI::LinearLayoutList(UI::ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)); zl->SetSpacing(4.0f); Add(zl); for (size_t i = 0; i < fileInfo.size(); i++) { @@ -1542,7 +1542,7 @@ void GridSettingsScreen::CreatePopupContents(UI::ViewGroup *parent) { auto sy = GetI18NCategory("System"); ScrollView *scroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, 50, 1.0f)); - LinearLayout *items = new LinearLayout(ORIENT_VERTICAL); + LinearLayout *items = new LinearLayoutList(ORIENT_VERTICAL); items->Add(new CheckBox(&g_Config.bGridView1, sy->T("Display Recent on a grid"))); items->Add(new CheckBox(&g_Config.bGridView2, sy->T("Display Games on a grid"))); diff --git a/UI/PauseScreen.cpp b/UI/PauseScreen.cpp index db826278e3..f94559acb3 100644 --- a/UI/PauseScreen.cpp +++ b/UI/PauseScreen.cpp @@ -333,7 +333,7 @@ void GamePauseScreen::CreateViews() { ViewGroup *leftColumn = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(1.0, scrollMargins)); root_->Add(leftColumn); - LinearLayout *leftColumnItems = new LinearLayout(ORIENT_VERTICAL, new LayoutParams(FILL_PARENT, WRAP_CONTENT)); + LinearLayout *leftColumnItems = new LinearLayoutList(ORIENT_VERTICAL, new LayoutParams(FILL_PARENT, WRAP_CONTENT)); leftColumn->Add(leftColumnItems); leftColumnItems->Add(new Spacer(0.0)); diff --git a/UI/RemoteISOScreen.cpp b/UI/RemoteISOScreen.cpp index 8dfabde16a..6ce5950fda 100644 --- a/UI/RemoteISOScreen.cpp +++ b/UI/RemoteISOScreen.cpp @@ -593,7 +593,7 @@ void RemoteISOSettingsScreen::CreateViews() { ViewGroup *remoteisoSettingsScroll = new ScrollView(ORIENT_VERTICAL, new LayoutParams(FILL_PARENT, FILL_PARENT)); remoteisoSettingsScroll->SetTag("RemoteISOSettings"); - LinearLayout *remoteisoSettings = new LinearLayout(ORIENT_VERTICAL); + LinearLayout *remoteisoSettings = new LinearLayoutList(ORIENT_VERTICAL); remoteisoSettings->SetSpacing(0); remoteisoSettingsScroll->Add(remoteisoSettings); diff --git a/UI/ReportScreen.cpp b/UI/ReportScreen.cpp index d9bc939df9..a5cf54e098 100644 --- a/UI/ReportScreen.cpp +++ b/UI/ReportScreen.cpp @@ -298,7 +298,7 @@ void ReportScreen::CreateViews() { overallDescription_->SetShadow(true); UI::Orientation ratingsOrient = leftColumnWidth >= 750.0f ? ORIENT_HORIZONTAL : ORIENT_VERTICAL; - UI::LinearLayout *ratingsHolder = new LinearLayout(ratingsOrient, new LinearLayoutParams(WRAP_CONTENT, WRAP_CONTENT)); + UI::LinearLayout *ratingsHolder = new LinearLayoutList(ratingsOrient, new LinearLayoutParams(WRAP_CONTENT, WRAP_CONTENT)); leftColumnItems->Add(ratingsHolder); ratingsHolder->Add(new RatingChoice("Graphics", &graphics_))->SetEnabledPtr(&ratingEnabled_)->OnChoice.Handle(this, &ReportScreen::HandleChoice); ratingsHolder->Add(new RatingChoice("Speed", &speed_))->SetEnabledPtr(&ratingEnabled_)->OnChoice.Handle(this, &ReportScreen::HandleChoice); diff --git a/UI/SavedataScreen.cpp b/UI/SavedataScreen.cpp index e7daf9f59c..72972da1d8 100644 --- a/UI/SavedataScreen.cpp +++ b/UI/SavedataScreen.cpp @@ -135,13 +135,13 @@ private: std::string savePath_; }; -class SortedLinearLayout : public UI::LinearLayout { +class SortedLinearLayout : public UI::LinearLayoutList { public: typedef std::function CompareFunc; typedef std::function DoneFunc; SortedLinearLayout(UI::Orientation orientation, UI::LayoutParams *layoutParams = nullptr) - : UI::LinearLayout(orientation, layoutParams) { + : UI::LinearLayoutList(orientation, layoutParams) { } void SetCompare(CompareFunc lessFunc, DoneFunc doneFunc) { diff --git a/UI/Store.cpp b/UI/Store.cpp index 791164ddd4..2ccf72c6a7 100644 --- a/UI/Store.cpp +++ b/UI/Store.cpp @@ -457,7 +457,7 @@ void StoreScreen::CreateViews() { ScrollView *leftScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(WRAP_CONTENT, FILL_PARENT, 0.4f)); leftScroll->SetTag("StoreMainList"); content->Add(leftScroll); - scrollItemView_ = new LinearLayout(ORIENT_VERTICAL, new LayoutParams(FILL_PARENT, WRAP_CONTENT)); + scrollItemView_ = new LinearLayoutList(ORIENT_VERTICAL, new LayoutParams(FILL_PARENT, WRAP_CONTENT)); leftScroll->Add(scrollItemView_); std::vector entries = FilterEntries(); diff --git a/UI/TiltAnalogSettingsScreen.cpp b/UI/TiltAnalogSettingsScreen.cpp index e4379606e7..99e2a7a4f6 100644 --- a/UI/TiltAnalogSettingsScreen.cpp +++ b/UI/TiltAnalogSettingsScreen.cpp @@ -29,7 +29,7 @@ void TiltAnalogSettingsScreen::CreateViews() { root_ = new ScrollView(ORIENT_VERTICAL); root_->SetTag("TiltAnalogSettings"); - LinearLayout *settings = new LinearLayout(ORIENT_VERTICAL); + LinearLayout *settings = new LinearLayoutList(ORIENT_VERTICAL); settings->SetSpacing(0); settings->Add(new ItemHeader(co->T("Invert Axes"))); diff --git a/UI/TouchControlVisibilityScreen.cpp b/UI/TouchControlVisibilityScreen.cpp index dab63b2940..9a6bf19a49 100644 --- a/UI/TouchControlVisibilityScreen.cpp +++ b/UI/TouchControlVisibilityScreen.cpp @@ -68,7 +68,7 @@ void TouchControlVisibilityScreen::CreateViews() { UI::GridLayoutSettings gridsettings(cellSize, 64, 5); gridsettings.fillCells = true; - GridLayout *grid = vert->Add(new GridLayout(gridsettings, new LayoutParams(FILL_PARENT, WRAP_CONTENT))); + GridLayout *grid = vert->Add(new GridLayoutList(gridsettings, new LayoutParams(FILL_PARENT, WRAP_CONTENT))); static const char* rightAnalogKey = "Right Analog Stick (tap to customize)"; toggles_.clear();