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

Scraped a layer of crusty old code from some audio plugin host files

This commit is contained in:
jules 2017-06-01 11:34:36 +01:00
parent 4b114d89a7
commit c6da067ac3
8 changed files with 285 additions and 395 deletions

View file

@ -91,7 +91,7 @@ MainHostWindow::MainHostWindow()
setResizeLimits (500, 400, 10000, 10000);
centreWithSize (800, 600);
setContentOwned (new GraphDocumentComponent (formatManager, &deviceManager), false);
setContentOwned (new GraphDocumentComponent (formatManager, deviceManager), false);
restoreWindowStateFromString (getAppProperties().getUserSettings()->getValue ("mainWindowPos"));
@ -294,9 +294,10 @@ void MainHostWindow::menuItemSelected (int menuItemID, int /*topLevelMenuIndex*/
}
else
{
createPlugin (getChosenType (menuItemID),
proportionOfWidth (0.3f + Random::getSystemRandom().nextFloat() * 0.6f),
proportionOfHeight (0.3f + Random::getSystemRandom().nextFloat() * 0.6f));
if (auto* desc = getChosenType (menuItemID))
createPlugin (*desc,
{ proportionOfWidth (0.3f + Random::getSystemRandom().nextFloat() * 0.6f),
proportionOfHeight (0.3f + Random::getSystemRandom().nextFloat() * 0.6f) });
}
}
@ -307,10 +308,10 @@ void MainHostWindow::menuBarActivated (bool isActivated)
graphEditor->unfocusKeyboardComponent();
}
void MainHostWindow::createPlugin (const PluginDescription* desc, int x, int y)
void MainHostWindow::createPlugin (const PluginDescription& desc, Point<int> pos)
{
if (auto* graphEditor = getGraphEditor())
graphEditor->createNewPlugin (desc, x, y);
graphEditor->createNewPlugin (desc, pos);
}
void MainHostWindow::addPluginsToMenu (PopupMenu& m) const
@ -555,7 +556,8 @@ void MainHostWindow::filesDropped (const StringArray& files, int x, int y)
auto pos = graphEditor->getLocalPoint (this, Point<int> (x, y));
for (int i = 0; i < jmin (5, typesFound.size()); ++i)
createPlugin (typesFound.getUnchecked(i), pos.x, pos.y);
if (auto* desc = typesFound.getUnchecked(i))
createPlugin (*desc, pos);
}
}
}