#include "../JuceLibraryCode/JuceHeader.h" #include "IconMenu.hpp" #if ! (JUCE_PLUGINHOST_VST || JUCE_PLUGINHOST_VST3 || JUCE_PLUGINHOST_AU) #error "If you're building the audio plugin host, you probably want to enable VST and/or AU support" #endif class PluginHostApp : public JUCEApplication { public: PluginHostApp() {} void initialise (const String&) override { PropertiesFile::Options options; options.applicationName = getApplicationName(); options.filenameSuffix = "settings"; options.osxLibrarySubFolder = "Preferences"; appProperties = new ApplicationProperties(); appProperties->setStorageParameters (options); LookAndFeel::setDefaultLookAndFeel (&lookAndFeel); mainWindow = new IconMenu(); #if JUCE_MAC Process::setDockIconVisible(false); #endif File fileToOpen; for (int i = 0; i < getCommandLineParameterArray().size(); ++i) { fileToOpen = File::getCurrentWorkingDirectory().getChildFile (getCommandLineParameterArray()[i]); if (fileToOpen.existsAsFile()) break; } } void shutdown() override { mainWindow = nullptr; appProperties = nullptr; LookAndFeel::setDefaultLookAndFeel (nullptr); } void systemRequestedQuit() override { JUCEApplicationBase::quit(); } const String getApplicationName() override { return "Light Host"; } const String getApplicationVersion() override { return ProjectInfo::versionString; } bool moreThanOneInstanceAllowed() override { return false; } ApplicationCommandManager commandManager; ScopedPointer appProperties; LookAndFeel_V3 lookAndFeel; private: ScopedPointer mainWindow; }; static PluginHostApp& getApp() { return *dynamic_cast(JUCEApplication::getInstance()); } ApplicationCommandManager& getCommandManager() { return getApp().commandManager; } ApplicationProperties& getAppProperties() { return *getApp().appProperties; } START_JUCE_APPLICATION (PluginHostApp)