void GraphEditorPanel::mouseDown(const MouseEvent &e) { if (! e.mods.isPopupMenu()) { GraphEditorBase::mouseDown (e); return; } PopupMenu m; { m.addSectionHeader ("Plugins"); PluginManager& pm (graph.plugins()); KnownPluginList& plugs (graph.plugins().availablePlugins()); Internals* internals = pm.format<Internals>(); if (! internals) return; plugs.addToMenu (m, KnownPluginList::sortByManufacturer); m.addSectionHeader ("Internals"); m.addItem (3, "BTSP-1"); m.addItem (4, "Pattern"); m.addSeparator(); m.addItem (1, "Audio Input Device"); m.addItem (2, "Audio Output Device"); m.addItem (5, "MIDI Device"); int res = m.show(); if (res == 1) { createNewPlugin (internals->description (InternalFormat::audioInputDevice), e.x, e.y); } else if (res == 2) { createNewPlugin (internals->description (InternalFormat::audioOutputDevice), e.x, e.y); } else if (res == 3) { createNewPlugin (internals->description (InternalFormat::samplerProcessor), e.x, e.y); } else if (res == 4) { } else if (const PluginDescription* desc = plugs.getType (plugs.getIndexChosenByMenu (res))) { createNewPlugin (desc, e.x, e.y); } } }
void GraphEditorPanel::mouseDown (const MouseEvent& e) { if (e.mods.isPopupMenu()) { PopupMenu m; MainHostWindow* const mainWindow = findParentComponentOfClass ((MainHostWindow*) nullptr); if (mainWindow != nullptr) { mainWindow->addPluginsToMenu (m); const int r = m.show(); createNewPlugin (mainWindow->getChosenType (r), e.x, e.y); } } }