MCPcopy Create free account
hub / github.com/VCVRack/Befaco / onButton

Method onButton

src/MidiThing.cpp:520–545  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

518 }
519
520 void onButton(const ButtonEvent& e) override {
521 if (e.button == GLFW_MOUSE_BUTTON_RIGHT && e.action == GLFW_PRESS) {
522 ui::Menu* menu = createMenu();
523
524 menu->addChild(createMenuLabel(string::f("Voltage mode port %d:", col + 3 * row + 1)));
525
526 const std::string labels[4] = {"0 to 10v", "-5 to 5v", "0 to 8v", "0 to 5v"};
527
528 for (int i = 0; i < 4; ++i) {
529 menu->addChild(createCheckMenuItem(labels[i], "",
530 [ = ]() {
531 return module->getVoltageMode(row, col) == i;
532 },
533 [ = ]() {
534 MidiThing::PORTMODE_t mode = (MidiThing::PORTMODE_t)(i + 1);
535 module->setVoltageModeOnHardware(row, col, mode);
536 }
537 ));
538 }
539
540 e.consume(this);
541 return;
542 }
543
544 LightWidget::onButton(e);
545 }
546
547};
548

Callers

nothing calls this directly

Calls 2

getVoltageModeMethod · 0.80

Tested by

no test coverage detected