Browse Source

Generate range labels programmatically in createRangeItem().

tags/v2.6.0
Andrew Belt 1 year ago
parent
commit
2924dd4ac3
1 changed files with 6 additions and 8 deletions
  1. +6
    -8
      src/plugin.cpp

+ 6
- 8
src/plugin.cpp View File

@@ -66,14 +66,12 @@ MenuItem* createRangeItem(std::string label, float* gain, float* offset) {
{10.f, -5.f}, {10.f, -5.f},
{2.f, -1.f}, {2.f, -1.f},
}; };
static const std::vector<std::string> labels = {
"0V to 10V",
"0V to 5V",
"0V to 1V",
"-10V to 10V",
"-5V to 5V",
"-1V to 1V",
};
static std::vector<std::string> labels;
if (labels.empty()) {
for (const Range& range : ranges) {
labels.push_back(string::f("%gV to %gV", range.offset, range.offset + range.gain));
}
}


return createIndexSubmenuItem(label, labels, return createIndexSubmenuItem(label, labels,
[=]() { [=]() {


Loading…
Cancel
Save