MCPcopy Create free account
hub / github.com/DISTRHO/Cardinal / onAction

Method onAction

src/override/MenuBar.cpp:735–815  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

733#endif
734
735 void onAction(const ActionEvent& e) override {
736 ui::Menu* menu = createMenu();
737 menu->cornerFlags = BND_CORNER_TOP;
738 menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y));
739
740 std::string cpuMeterText = "F3";
741 if (settings::cpuMeter)
742 cpuMeterText += " " CHECKMARK_STRING;
743 menu->addChild(createMenuItem("Performance meters", cpuMeterText, [=]() {
744 settings::cpuMeter ^= true;
745 }));
746
747#ifdef HAVE_LIBLO
748 if (isStandalone()) {
749 CardinalPluginContext* const context = static_cast<CardinalPluginContext*>(APP);
750 CardinalBasePlugin* const plugin = static_cast<CardinalBasePlugin*>(context->plugin);
751
752 // const bool remoteServerStarted = this->remoteServerStarted;
753 const std::string remoteControlText = remoteServerStarted ? " " CHECKMARK_STRING : "";
754
755 menu->addChild(createMenuItem("Enable OSC remote control", remoteControlText, [=]() {
756 if (remoteServerStarted) {
757 remoteServerStarted = false;
758 plugin->stopRemoteServer();
759 return;
760 }
761
762 async_dialog_text_input("OSC network port", CARDINAL_DEFAULT_REMOTE_PORT, [=](char* const port) {
763 if (port == nullptr)
764 return;
765
766 if (plugin->startRemoteServer(port))
767 remoteServerStarted = true;
768
769 std::free(port);
770 });
771 }));
772 }
773#endif
774
775 if (isUsingNativeAudio()) {
776 if (supportsAudioInput()) {
777 const bool enabled = isAudioInputEnabled();
778 std::string rightText;
779 if (enabled)
780 rightText = CHECKMARK_STRING;
781 menu->addChild(createMenuItem("Enable Audio Input", rightText, [enabled]() {
782 if (!enabled)
783 requestAudioInput();
784 }));
785 }
786
787 if (supportsMIDI()) {
788 std::string rightText;
789 if (isMIDIEnabled())
790 rightText = CHECKMARK_STRING;
791 menu->addChild(createMenuItem("Enable/Reconnect MIDI", rightText, []() {
792 requestMIDI();

Callers

nothing calls this directly

Calls 15

createMenuFunction · 0.85
VecClass · 0.85
createMenuItemFunction · 0.85
isUsingNativeAudioFunction · 0.85
supportsAudioInputFunction · 0.85
isAudioInputEnabledFunction · 0.85
requestAudioInputFunction · 0.85
supportsMIDIFunction · 0.85
isMIDIEnabledFunction · 0.85
requestMIDIFunction · 0.85
getBufferSizeFunction · 0.85

Tested by

no test coverage detected