mirror of
https://codeberg.org/armin/chromaflock.git
synced 2026-09-01 04:10:47 +02:00
Sort preset categories and names alphabetically
This commit is contained in:
parent
b8b0624a80
commit
c6415cb28d
1 changed files with 4 additions and 0 deletions
|
|
@ -2,6 +2,7 @@
|
|||
#include <juce_audio_processors/juce_audio_processors.h>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
|
||||
struct Preset {
|
||||
juce::String name;
|
||||
|
|
@ -23,6 +24,7 @@ public:
|
|||
if (c == p.category) { found = true; break; }
|
||||
if (!found) cats.push_back(p.category);
|
||||
}
|
||||
std::sort(cats.begin(), cats.end());
|
||||
return cats;
|
||||
}
|
||||
|
||||
|
|
@ -31,6 +33,8 @@ public:
|
|||
for (auto& p : presets)
|
||||
if (p.category == cat)
|
||||
result.push_back(p);
|
||||
std::sort(result.begin(), result.end(),
|
||||
[](const Preset& a, const Preset& b) { return a.name < b.name; });
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue