void PluginListComponent::removeSelectedPlugins()
{
    const SparseSet<int> selected (table.getSelectedRows());

    for (int i = table.getNumRows(); --i >= 0;)
        if (selected.contains (i))
            removePluginItem (i);
}
void PluginListComponent::removeSelected()
{
    const SparseSet <int> selected (listBox.getSelectedRows());

    for (int i = list.getNumTypes(); --i >= 0;)
        if (selected.contains (i))
            removePluginItem (list, i);
}
void PluginListComponent::optionsMenuCallback (int result)
{
    switch (result)
    {
        case 1:     list.clear(); break;

        case 2:     list.sort (KnownPluginList::sortAlphabetically); break;
        case 3:     list.sort (KnownPluginList::sortByCategory); break;
        case 4:     list.sort (KnownPluginList::sortByManufacturer); break;

        case 5:
        {
            const SparseSet <int> selected (listBox.getSelectedRows());

            for (int i = list.getNumTypes(); --i >= 0;)
                if (selected.contains (i))
                    list.removeType (i);

            break;
        }

        case 6:
        {
            const PluginDescription* const desc = list.getType (listBox.getSelectedRow());

            if (desc != nullptr && File (desc->fileOrIdentifier).existsAsFile())
                File (desc->fileOrIdentifier).getParentDirectory().startAsProcess();

            break;
        }

        case 7:
            for (int i = list.getNumTypes(); --i >= 0;)
                if (! AudioPluginFormatManager::getInstance()->doesPluginStillExist (*list.getType (i)))
                    list.removeType (i);

            break;

        default:
            if (result != 0)
            {
                typeToScan = result - 10;
                startTimer (1);
            }

            break;
    }
}
Exemple #4
0
    //==============================================================================
    void selectedRowsChanged (int) override
    {
        SparseSet<int> newSelectedItems = getSelectedRows();
        if (newSelectedItems != lastSelectedItems)
        {
            for (int i = 0; i < lastSelectedItems.size(); ++i)
            {
                if (! newSelectedItems.contains (lastSelectedItems[i]))
                    parent.closeDevice (isInput, lastSelectedItems[i]);
            }

            for (int i = 0; i < newSelectedItems.size(); ++i)
            {
                if (! lastSelectedItems.contains (newSelectedItems[i]))
                    parent.openDevice (isInput, newSelectedItems[i]);
            }

            lastSelectedItems = newSelectedItems;
        }
    }
void PluginListComponent::buttonClicked (Button* b)
{
    if (optionsButton == b)
    {
        PopupMenu menu;
        menu.addItem (1, TRANS("Clear list"));
        menu.addItem (5, TRANS("Remove selected plugin from list"), listBox->getNumSelectedRows() > 0);
        menu.addItem (6, TRANS("Show folder containing selected plugin"), listBox->getNumSelectedRows() > 0);
        menu.addItem (7, TRANS("Remove any plugins 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 < AudioPluginFormatManager::getInstance()->getNumFormats(); ++i)
        {
            AudioPluginFormat* const format = AudioPluginFormatManager::getInstance()->getFormat (i);

            if (format->getDefaultLocationsToSearch().getNumPaths() > 0)
                menu.addItem (10 + i, "Scan for new or updated " + format->getName() + " plugins...");
        }

        const int r = menu.showAt (optionsButton);

        if (r == 1)
        {
            list.clear();
        }
        else if (r == 2)
        {
            list.sort (KnownPluginList::sortAlphabetically);
        }
        else if (r == 3)
        {
            list.sort (KnownPluginList::sortByCategory);
        }
        else if (r == 4)
        {
            list.sort (KnownPluginList::sortByManufacturer);
        }
        else if (r == 5)
        {
            const SparseSet <int> selected (listBox->getSelectedRows());

            for (int i = list.getNumTypes(); --i >= 0;)
                if (selected.contains (i))
                    list.removeType (i);
        }
        else if (r == 6)
        {
            const PluginDescription* const desc = list.getType (listBox->getSelectedRow());

            if (desc != 0)
            {
                if (File (desc->fileOrIdentifier).existsAsFile())
                    File (desc->fileOrIdentifier).getParentDirectory().startAsProcess();
            }
        }
        else if (r == 7)
        {
            for (int i = list.getNumTypes(); --i >= 0;)
            {
                if (! AudioPluginFormatManager::getInstance()->doesPluginStillExist (*list.getType (i)))
                {
                    list.removeType (i);
                }
            }
        }
        else if (r != 0)
        {
            typeToScan = r - 10;
            startTimer (1);
        }
    }
}