Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Factory Categories to the Category DropDown #5579

Merged
merged 1 commit into from
Dec 6, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion src/surge-xt/gui/overlays/PatchStoreDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ struct PatchStoreDialogCategoryProvider : public Surge::Widgets::TypeAheadDataPr
int idx = 0;
for (auto &c : storage->patch_category)
{
if (!c.isFactory)
if (!c.isFactory || (idx < storage->firstThirdPartyCategory &&
c.name.find("Tutorial") == std::string::npos))
{
auto it = std::search(
c.name.begin(), c.name.end(), s.begin(), s.end(),
Expand All @@ -54,6 +55,21 @@ struct PatchStoreDialogCategoryProvider : public Surge::Widgets::TypeAheadDataPr
idx++;
}
}
// Now sort that res
std::sort(res.begin(), res.end(), [this](const auto &a, const auto &b) {
const auto pa = storage->patch_category[a];
const auto pb = storage->patch_category[b];

if (pa.isFactory == pb.isFactory)
{
return pa.name < pb.name;
}
else
{
// putting b here puts the user patches first
return pb.isFactory;
}
});
return res;
}

Expand Down