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

Sub-folder sorting #490

Merged
merged 1 commit into from
Feb 4, 2019
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: 18 additions & 0 deletions src/common/SurgeStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ void SurgeStorage::refreshPatchlistAddDir(bool userDir, string subdir)
** scanning for names; setting the 'root' to everything without a slash
** and finding the parent in the name map for everything with a slash
*/

std::map<std::string,int> nameToLocalIndex;
int idx=0;
for (auto &pc : local_patch_category)
Expand All @@ -368,6 +369,23 @@ void SurgeStorage::refreshPatchlistAddDir(bool userDir, string subdir)
}
}

/*
** We need to sort the local patch category child to make sure subfolders remain
** sorted when displayed using the child data structure in the menu view.
*/

auto catCompare =
[this](const PatchCategory &c1, const PatchCategory &c2) -> bool
{
return _stricmp(c1.name.c_str(),c2.name.c_str()) < 0;
};
for (auto &pc : local_patch_category)
{
std::sort(pc.children.begin(), pc.children.end(), catCompare);
}
baconpaul marked this conversation as resolved.
Show resolved Hide resolved



/*
** Then copy our local patch category onto the member and be done
*/
Expand Down