Browse Source

Use a submenu for the gate length

pull/83/head
xenakios 5 years ago
parent
commit
bbf63efcc1
2 changed files with 56 additions and 19 deletions
  1. +24
    -0
      .vscode/c_cpp_properties.json
  2. +32
    -19
      src/Marbles.cpp

+ 24
- 0
.vscode/c_cpp_properties.json View File

@@ -0,0 +1,24 @@
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**",
"C:\\msys64\\home\\Teemu\\Rack-SDK\\include",
"C:\\msys64\\home\\Teemu\\AudibleInstruments\\src",
"C:\\msys64\\home\\Teemu\\Rack-SDK\\dep\\include"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.17763.0",
"compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "msvc-x64"
}
],
"version": 4
}

+ 32
- 19
src/Marbles.cpp View File

@@ -677,31 +677,44 @@ struct MarblesWidget : ModuleWidget {
yDividerItem->module = module;
menu->addChild(yDividerItem);

struct GateLenMenuItem : MenuItem {
Marbles *module;
struct GateLenMenuIndexItem : MenuItem {
Marbles *module = nullptr;
float source=0.0f;
void onAction(const event::Action &e) override {
module->_gate_len = source;
}
};
menu->addChild(new MenuEntry);
menu->addChild(createMenuLabel("Gate length"));
const std::pair<std::string,float> gateLens[] = {
{"1%",0.01f},
{"10%",0.1f},
{"25%",0.25f},
{"50%",0.5f},
{"75%",0.75f},
{"90%",0.9f},
{"99%",0.99f}

struct GateLenMenuItem : MenuItem
{
Marbles* module = nullptr;
Menu *createChildMenu() override {
Menu *submenu = new Menu();
const std::pair<std::string,float> gateLens[] = {
{"1%",0.01f},
{"10%",0.1f},
{"25%",0.25f},
{"50%",0.5f},
{"75%",0.75f},
{"90%",0.9f},
{"99%",0.99f}
};
for (int i = 0; i < (int) LENGTHOF(gateLens); i++) {
GateLenMenuIndexItem *item = createMenuItem<GateLenMenuIndexItem>(gateLens[i].first,
CHECKMARK(gateLens[i].second==module->_gate_len));
item->module = module;
item->source = gateLens[i].second;
submenu->addChild(item);
}
return submenu;
}
};
for (int i = 0; i < (int) LENGTHOF(gateLens); i++) {
GateLenMenuItem *item = createMenuItem<GateLenMenuItem>(gateLens[i].first,
CHECKMARK(gateLens[i].second==module->_gate_len));
item->module = module;
item->source = gateLens[i].second;
menu->addChild(item);
}

menu->addChild(new MenuEntry);
GateLenMenuItem* glitem = createMenuItem<GateLenMenuItem>("Gate length");
glitem->module = module;
menu->addChild(glitem);
}
};



Loading…
Cancel
Save