1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Deprecated some thread unsafe methods in KnownPluginList and modernised the interface a bit

This commit is contained in:
ed 2019-05-23 14:01:01 +01:00
parent ab9656f6fb
commit 92a9c37bac
10 changed files with 180 additions and 199 deletions

View file

@ -111,8 +111,8 @@ MainHostWindow::MainHostWindow()
if (auto savedPluginList = getAppProperties().getUserSettings()->getXmlValue ("pluginList"))
knownPluginList.recreateFromXml (*savedPluginList);
for (auto* t : internalTypes)
knownPluginList.addType (*t);
for (auto& t : internalTypes)
knownPluginList.addType (t);
pluginSortMethod = (KnownPluginList::SortMethod) getAppProperties().getUserSettings()
->getIntValue ("pluginSortMethod", KnownPluginList::sortByManufacturer);
@ -346,10 +346,9 @@ void MainHostWindow::menuItemSelected (int menuItemID, int /*topLevelMenuIndex*/
}
else
{
if (auto* desc = getChosenType (menuItemID))
createPlugin (*desc,
{ proportionOfWidth (0.3f + Random::getSystemRandom().nextFloat() * 0.6f),
proportionOfHeight (0.3f + Random::getSystemRandom().nextFloat() * 0.6f) });
if (knownPluginList.getIndexChosenByMenu (menuItemID) >= 0)
createPlugin (getChosenType (menuItemID), { proportionOfWidth (0.3f + Random::getSystemRandom().nextFloat() * 0.6f),
proportionOfHeight (0.3f + Random::getSystemRandom().nextFloat() * 0.6f) });
}
}
@ -371,9 +370,9 @@ void MainHostWindow::addPluginsToMenu (PopupMenu& m) const
{
int i = 0;
for (auto* t : internalTypes)
m.addItem (++i, t->name + " (" + t->pluginFormatName + ")",
graphHolder->graph->getNodeForName (t->name) == nullptr);
for (auto& t : internalTypes)
m.addItem (++i, t.name + " (" + t.pluginFormatName + ")",
graphHolder->graph->getNodeForName (t.name) == nullptr);
}
m.addSeparator();
@ -381,12 +380,12 @@ void MainHostWindow::addPluginsToMenu (PopupMenu& m) const
knownPluginList.addToMenu (m, pluginSortMethod);
}
const PluginDescription* MainHostWindow::getChosenType (const int menuID) const
PluginDescription MainHostWindow::getChosenType (const int menuID) const
{
if (menuID >= 1 && menuID < 1 + internalTypes.size())
return internalTypes [menuID - 1];
return knownPluginList.getType (knownPluginList.getIndexChosenByMenu (menuID));
return knownPluginList.getTypes()[knownPluginList.getIndexChosenByMenu (menuID)];
}
//==============================================================================