diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..d690713 --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -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 +} \ No newline at end of file diff --git a/src/Marbles.cpp b/src/Marbles.cpp index 1d8e2cf..90f416b 100644 --- a/src/Marbles.cpp +++ b/src/Marbles.cpp @@ -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 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 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(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(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("Gate length"); + glitem->module = module; + menu->addChild(glitem); + } };