//============================================================================== void HostFilterComponent::loadPluginFromFile (const File& file) { DBG ("HostFilterComponent::loadPluginFromFile"); GraphComponent* graph = main->getGraph (); if (graph) graph->loadAndAppendPlugin (file, 100, 100); }
void HostFilterComponent::menuItemSelected (int menuItemID, int topLevelMenuIndex) { Config* config = Config::getInstance(); GraphComponent* graph = main->getGraph (); switch (topLevelMenuIndex) { case 0: // CommandCategories::file { // handle recent plugins selection int fileID = menuItemID - CommandIDs::recentPlugins; if (fileID >= 0 && fileID < config->recentPlugins.getNumFiles()) { File fileToLoad = config->recentPlugins.getFile (fileID); if (graph) graph->loadAndAppendPlugin (config->recentPlugins.getFile (fileID), 100, 100); break; } // handle recent session selection fileID = menuItemID - CommandIDs::recentSessions; if (fileID >= 0 && fileID < config->recentSessions.getNumFiles()) { MemoryBlock fileData; File fileToLoad = config->recentSessions.getFile (fileID); if (fileToLoad.existsAsFile() && fileToLoad.loadFileAsData (fileData)) { getFilter ()->setStateInformation (fileData.getData (), fileData.getSize()); Config::getInstance()->addRecentSession (fileToLoad); Config::getInstance()->lastSessionFile = fileToLoad; } } break; } } toFront (true); }
bool HostFilterComponent::perform (const InvocationInfo& info) { Config* config = Config::getInstance(); GraphComponent* graph = main->getGraph (); Transport* transport = getFilter()->getTransport(); switch (info.commandID) { //---------------------------------------------------------------------------------------------- case CommandIDs::pluginOpen: { graph->loadAndAppendPlugin (); break; } case CommandIDs::pluginClose: { graph->closeSelectedPlugins (); break; } case CommandIDs::pluginClear: { graph->closeAllPlugins (); break; } case CommandIDs::showPluginListEditor: { if (PluginListWindow::currentPluginListWindow == 0) PluginListWindow::currentPluginListWindow = new PluginListWindow (knownPluginList); PluginListWindow::currentPluginListWindow->toFront (true); break; } //---------------------------------------------------------------------------------------------- #ifndef JOST_VST_PLUGIN case CommandIDs::audioOptions: { StandaloneFilterWindow* window = findParentComponentOfClass ((StandaloneFilterWindow*) 0); if (window) window->showAudioSettingsDialog (); break; } #endif case CommandIDs::audioPlay: { transport->play (); break; } case CommandIDs::audioPlayPause: { transport->togglePlay (); break; } case CommandIDs::audioStop: { transport->stop (); break; } case CommandIDs::audioRecord: { transport->record (); break; } case CommandIDs::audioRewind: { transport->rewind (); break; } case CommandIDs::audioLoop: { transport->setLooping (! transport->isLooping()); break; } //---------------------------------------------------------------------------------------------- case CommandIDs::sessionNew: { bool retValue = AlertWindow::showYesNoCancelBox (AlertWindow::WarningIcon, T("Unsaved Changes"), T("Are you sure you want to close the current session? You may lose any unsaved changes.")); if (retValue) { closePluginEditorWindows (); getFilter()->getHost ()->closeAllPlugins (true); clearComponents (); Config::getInstance()->lastSessionFile = File::nonexistent; rebuildComponents (); } break; } case CommandIDs::sessionLoad: { FileChooser myChooser (T("Load a session file..."), Config::getInstance ()->lastSessionDirectory, JOST_SESSION_WILDCARD, JOST_USE_NATIVE_FILE_CHOOSER); if (myChooser.browseForFileToOpen()) { bool retValue = AlertWindow::showYesNoCancelBox (AlertWindow::WarningIcon, T("Unsaved Changes"), T("Are you sure you want to close the current session? You may lose any unsaved changes.")); if (retValue) { MemoryBlock fileData; File fileToLoad = myChooser.getResult(); if (fileToLoad.existsAsFile() && fileToLoad.loadFileAsData (fileData)) { getFilter ()->setStateInformation (fileData.getData (), fileData.getSize()); Config::getInstance()->addRecentSession (fileToLoad); Config::getInstance()->lastSessionFile = fileToLoad; } } } break; } case CommandIDs::sessionSave: { handleSaveCommand(); break; } case CommandIDs::sessionSaveNoPrompt: { handleSaveCommand(true); break; } case CommandIDs::audioStemsStartStop: { getHost()->toggleStemRendering(); break; } case CommandIDs::audioStemsSetup: { FileChooser myChooser (T("Save Rendered Stem Files To..."), Config::getInstance ()->lastStemsDirectory); if (myChooser.browseForDirectory ()) { Config::getInstance ()->lastStemsDirectory = myChooser.getResult(); } break; } //---------------------------------------------------------------------------------------------- case CommandIDs::appToolbar: { toolbar->showCustomisationDialog (*factory, Toolbar::allCustomisationOptionsEnabled); // (Toolbar::allowIconsOnlyChoice | Toolbar::showResetToDefaultsButton)); break; } case CommandIDs::appBrowser: { setBrowserVisible (! config->showBrowser, config->browserLeft); break; } case CommandIDs::appFullScreen: { DocumentWindow* window = findParentComponentOfClass <DocumentWindow> (); if (window) { window->setFullScreen (! window->isFullScreen ()); window->setMenuBar (window->isFullScreen () ? 0 : this); } break; } case CommandIDs::appExit: { deleteAndZero(PluginListWindow::currentPluginListWindow); JUCEApplication::getInstance()->systemRequestedQuit(); break; } case CommandIDs::appAbout: { // Image* splashImage = ImageCache::getFromMemory (Resource::jost_about, // Resource::jost_about_size); // todo: move appResourcesFolder() to somewhere everyone can use it #if JUCE_MAC File appResourcesFolder(File::getSpecialLocation(File::currentApplicationFile).getChildFile("./Contents/Resources")); #else File appResourcesFolder(File::getSpecialLocation(File::currentApplicationFile).getParentDirectory()); #endif File splashImageFile(appResourcesFolder.getChildFile("JiveAbout.png")); Image* splashImage = ImageFileFormat::loadFrom(splashImageFile); SplashScreen* splash = new SplashScreen(); splash->show (T(JucePlugin_Name), splashImage, 3500, false); break; } //---------------------------------------------------------------------------------------------- default: return false; } return true; }