void PluginListComponent::buttonClicked (Button* button) { if (button == &optionsButton) { PopupMenu menu; menu.addItem (1, TRANS("Clear list")); menu.addItem (5, TRANS("Remove selected plug-in from list"), listBox.getNumSelectedRows() > 0); menu.addItem (6, TRANS("Show folder containing selected plug-in"), canShowSelectedFolder()); menu.addItem (7, TRANS("Remove any plug-ins whose files no longer exist")); menu.addSeparator(); menu.addItem (2, TRANS("Sort alphabetically")); menu.addItem (3, TRANS("Sort by category")); menu.addItem (4, TRANS("Sort by manufacturer")); menu.addSeparator(); for (int i = 0; i < formatManager.getNumFormats(); ++i) { AudioPluginFormat* const format = formatManager.getFormat (i); if (format->canScanForPlugins()) menu.addItem (10 + i, "Scan for new or updated " + format->getName() + " plug-ins"); } menu.showMenuAsync (PopupMenu::Options().withTargetComponent (&optionsButton), ModalCallbackFunction::forComponent (optionsMenuStaticCallback, this)); } }
void CabbagePluginListComponent::showOptionsMenu() { PopupMenu menu; menu.setLookAndFeel(&getLookAndFeel()); menu.addItem (1, TRANS("Clear list")); menu.addItem (2, TRANS("Remove selected plug-in from list"), table.getNumSelectedRows() > 0); menu.addItem (3, TRANS("Show folder containing selected plug-in"), canShowSelectedFolder()); menu.addItem (4, TRANS("Remove any plug-ins whose files no longer exist")); menu.addSeparator(); for (int i = 0; i < formatManager.getNumFormats(); ++i) { auto* format = formatManager.getFormat (i); if (format->canScanForPlugins()) menu.addItem (10 + i, "Scan for new or updated " + format->getName() + " plug-ins"); } menu.showMenuAsync (PopupMenu::Options().withTargetComponent (&optionsButton), ModalCallbackFunction::forComponent (optionsMenuStaticCallback, this)); }
void PluginListComponent::showSelectedFolder() { if (canShowSelectedFolder()) if (const PluginDescription* const desc = list.getType (table.getSelectedRow())) File (desc->fileOrIdentifier).getParentDirectory().startAsProcess(); }