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; }
// This method is used when something needs to find out the details about one of the commands // that this object can perform.. void HostFilterComponent::getCommandInfo (const CommandID commandID, ApplicationCommandInfo& result) { const int none = 0; const int cmd = ModifierKeys::commandModifier; // const int shift = ModifierKeys::shiftModifier; GraphComponent* graph = main->getGraph (); Transport* transport = getFilter()->getTransport(); switch (commandID) { //---------------------------------------------------------------------------------------------- case CommandIDs::pluginOpen: result.setInfo (T("Open Plugin..."), T("Open a plugin"), CommandCategories::file, 0); result.addDefaultKeypress (T('l'), cmd); result.setActive (true); break; case CommandIDs::pluginClose: { result.setInfo (T("Close Plugins"), T("Close selected plugins"), CommandCategories::file, 0); result.addDefaultKeypress (T('k'), cmd); // TODO - have to update this ! // GraphComponent* track = tracks.getUnchecked (0); // result.setActive ((track ? (track->getSelectedPlugin () != -1) : false)); result.setActive (false); break; } case CommandIDs::pluginClear: { result.setInfo (T("Clear Plugins"), T("Close all plugins"), CommandCategories::file, 0); result.addDefaultKeypress (T('j'), cmd); result.setActive ((graph ? (graph->getPluginsCount () > 2) : false)); break; } case CommandIDs::showPluginListEditor: { result.setInfo (T("Show Plugin List"), T("Show plugin list window"), CommandCategories::file, 0); result.addDefaultKeypress (T('p'), cmd); result.setActive (true); break; } //---------------------------------------------------------------------------------------------- #ifndef JOST_VST_PLUGIN case CommandIDs::audioOptions: { result.setInfo (T("Audio & MIDI Settings..."), T("Show device manager"), CommandCategories::audio, 0); // result.addDefaultKeypress (KeyPress::backspaceKey, none); result.setActive (true); break; } #endif case CommandIDs::audioPlay: { result.setInfo (T("Play"), T("Play sequencers"), CommandCategories::audio, 0); if (! transport->isPlaying()) result.addDefaultKeypress (KeyPress::spaceKey, none); result.setActive (! transport->isPlaying()); break; } case CommandIDs::audioPlayPause: { if (transport->isPlaying()) result.setInfo (T("Pause"), T("Pause sequencers"), CommandCategories::audio, 0); else result.setInfo (T("Play"), T("Play sequencers"), CommandCategories::audio, 0); result.addDefaultKeypress (KeyPress::spaceKey, none); break; } case CommandIDs::audioStop: { result.setInfo (T("Stop"), T("Stop sequencers"), CommandCategories::audio, 0); if (transport->isPlaying()) result.addDefaultKeypress (KeyPress::spaceKey, none); result.setActive (transport->isPlaying()); break; } case CommandIDs::audioRecord: { result.setInfo (T("Record"), T("Activate recording"), CommandCategories::audio, 0); result.addDefaultKeypress (T('r'), cmd); result.setTicked (transport->isRecording()); result.setActive (true); break; } case CommandIDs::audioRewind: { result.setInfo (T("Rewind"), T("Rewind sequencers"), CommandCategories::audio, 0); result.addDefaultKeypress (KeyPress::backspaceKey, none); result.setActive (transport->getPositionInFrames() != 0); break; } case CommandIDs::audioLoop: { result.setInfo (T("Looping"), T("Loop sequencers"), CommandCategories::audio, 0); result.addDefaultKeypress (T('l'), cmd); result.setTicked (transport->isLooping()); result.setActive (true); break; } //---------------------------------------------------------------------------------------------- case CommandIDs::audioStemsStartStop: { int renderNumber = 0; if (getHost()->isStemRenderingActive(renderNumber)) result.setInfo (T("Stop rendering stems (" + String(renderNumber) + String(")")), T("Stop rendering stems"), CommandCategories::audio, 0); else result.setInfo (T("Start rendering stems (" + String(renderNumber) + String(")")), T("Start rendering stems"), CommandCategories::audio, 0); result.setActive (true); break; } case CommandIDs::audioStemsSetup: { result.setInfo (T("Setup stem render..."), T("Stem Setup"), CommandCategories::audio, 0); result.setActive (true); break; } //---------------------------------------------------------------------------------------------- case CommandIDs::sessionNew: { result.setInfo (T("New Session"), T("New session"), CommandCategories::file, 0); result.addDefaultKeypress (T('n'), cmd); result.setActive (true); break; } case CommandIDs::sessionLoad: result.setInfo (T("Open Session..."), T("Open a session"), CommandCategories::file, 0); result.addDefaultKeypress (T('a'), cmd); result.setActive (true); break; case CommandIDs::sessionSave: { result.setInfo (T("Save Session As..."), T("Save a session to a specified file"), CommandCategories::file, 0); result.addDefaultKeypress (T('s'), ModifierKeys::commandModifier | ModifierKeys::shiftModifier); result.setActive ((graph ? (graph->getPluginsCount () > 0) : false)); break; } case CommandIDs::sessionSaveNoPrompt: { result.setInfo (T("Save Session"), T("Save session to existing file"), CommandCategories::file, 0); result.addDefaultKeypress (T('s'), cmd); result.setActive ((graph ? (graph->getPluginsCount () > 0) : false)); break; } //---------------------------------------------------------------------------------------------- case CommandIDs::appToolbar: result.setInfo (T("Edit toolbar"), T("Edit toolbar items"), CommandCategories::about, 0); result.setActive (toolbar != 0); break; case CommandIDs::appBrowser: result.setInfo (T("Show/Hide browser"), T("Show or hide the file browser"), CommandCategories::about, 0); result.setActive (true); break; case CommandIDs::appFullScreen: result.setInfo (T("Full Screen"), T("Set main window full screen"), CommandCategories::file, 0); result.addDefaultKeypress (T('t'), cmd); result.setActive (true); break; case CommandIDs::appExit: result.setInfo (T("Quit"), T("Quit Jive"), CommandCategories::file, 0); result.addDefaultKeypress (T('q'), cmd); result.setActive (true); break; case CommandIDs::appAbout: result.setInfo (T("About..."), T("About Jive"), CommandCategories::about, 0); result.setActive (true); break; //---------------------------------------------------------------------------------------------- default: break; } }