MCPcopy Create free account
hub / github.com/VCVRack/Rack / onAction

Method onAction

src/app/MenuBar.cpp:685–715  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

683
684struct EngineButton : MenuButton {
685 void onAction(const ActionEvent& e) override {
686 ui::Menu* menu = createMenu();
687 menu->cornerFlags = BND_CORNER_TOP;
688 menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y));
689
690 std::string cpuMeterText = widget::getKeyCommandName(GLFW_KEY_F3, 0);
691 if (settings::cpuMeter)
692 cpuMeterText += " " CHECKMARK_STRING;
693 menu->addChild(createMenuItem(string::translate("MenuBar.engine.cpuMeter"), cpuMeterText, [=]() {
694 settings::cpuMeter ^= true;
695 }));
696
697 menu->addChild(createMenuItem<SampleRateItem>(string::translate("MenuBar.engine.sampleRate"), RIGHT_ARROW));
698
699 menu->addChild(createSubmenuItem(string::translate("MenuBar.engine.threads"), string::f("%d", settings::threadCount), [=](ui::Menu* menu) {
700 // BUG This assumes SMT is enabled.
701 int cores = system::getLogicalCoreCount() / 2;
702
703 for (int i = 1; i <= 2 * cores; i++) {
704 std::string rightText;
705 if (i == cores)
706 rightText += string::translate("MenuBar.engine.threads.most");
707 else if (i == 1)
708 rightText += string::translate("MenuBar.engine.threads.lowest");
709 menu->addChild(createCheckMenuItem(string::f("%d", i), rightText,
710 [=]() {return settings::threadCount == i;},
711 [=]() {settings::threadCount = i;}
712 ));
713 }
714 }));
715 }
716};
717
718

Callers

nothing calls this directly

Calls 10

createMenuFunction · 0.85
VecClass · 0.85
getKeyCommandNameFunction · 0.85
createMenuItemFunction · 0.85
translateFunction · 0.85
createSubmenuItemFunction · 0.85
getLogicalCoreCountFunction · 0.85
createCheckMenuItemFunction · 0.85
addChildMethod · 0.80
fFunction · 0.50

Tested by

no test coverage detected