The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

642 lines
32KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2020 - Raw Material Software Limited
  5. JUCE is an open source library subject to commercial or open-source
  6. licensing.
  7. By using JUCE, you agree to the terms of both the JUCE 6 End-User License
  8. Agreement and JUCE Privacy Policy (both effective as of the 16th June 2020).
  9. End User License Agreement: www.juce.com/juce-6-licence
  10. Privacy Policy: www.juce.com/juce-privacy-policy
  11. Or: You may also use this code under the terms of the GPL v3 (see
  12. www.gnu.org/licenses).
  13. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  14. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  15. DISCLAIMED.
  16. ==============================================================================
  17. */
  18. #pragma once
  19. #include "../Application/UserAccount/jucer_LicenseController.h"
  20. #include "Modules/jucer_AvailableModulesList.h"
  21. class ProjectExporter;
  22. class LibraryModule;
  23. class EnabledModulesList;
  24. class ProjectSaver;
  25. namespace ProjectMessages
  26. {
  27. namespace Ids
  28. {
  29. #define DECLARE_ID(name) static const Identifier name (#name)
  30. DECLARE_ID (projectMessages);
  31. DECLARE_ID (incompatibleLicense);
  32. DECLARE_ID (cppStandard);
  33. DECLARE_ID (moduleNotFound);
  34. DECLARE_ID (jucePath);
  35. DECLARE_ID (jucerFileModified);
  36. DECLARE_ID (missingModuleDependencies);
  37. DECLARE_ID (oldProjucer);
  38. DECLARE_ID (cLion);
  39. DECLARE_ID (newVersionAvailable);
  40. DECLARE_ID (pluginCodeInvalid);
  41. DECLARE_ID (manufacturerCodeInvalid);
  42. DECLARE_ID (notification);
  43. DECLARE_ID (warning);
  44. DECLARE_ID (isVisible);
  45. #undef DECLARE_ID
  46. }
  47. inline Identifier getTypeForMessage (const Identifier& message)
  48. {
  49. static Identifier warnings[] = { Ids::incompatibleLicense, Ids::cppStandard, Ids::moduleNotFound,
  50. Ids::jucePath, Ids::jucerFileModified, Ids::missingModuleDependencies,
  51. Ids::oldProjucer, Ids::cLion, Ids::pluginCodeInvalid, Ids::manufacturerCodeInvalid };
  52. if (std::find (std::begin (warnings), std::end (warnings), message) != std::end (warnings))
  53. return Ids::warning;
  54. if (message == Ids::newVersionAvailable)
  55. return Ids::notification;
  56. jassertfalse;
  57. return {};
  58. }
  59. inline String getTitleForMessage (const Identifier& message)
  60. {
  61. if (message == Ids::incompatibleLicense) return "Incompatible License and Splash Screen Setting";
  62. if (message == Ids::cppStandard) return "C++ Standard";
  63. if (message == Ids::moduleNotFound) return "Module Not Found";
  64. if (message == Ids::jucePath) return "JUCE Path";
  65. if (message == Ids::jucerFileModified) return "Project File Modified";
  66. if (message == Ids::missingModuleDependencies) return "Missing Module Dependencies";
  67. if (message == Ids::oldProjucer) return "Projucer Out of Date";
  68. if (message == Ids::newVersionAvailable) return "New Version Available";
  69. if (message == Ids::cLion) return "Deprecated Exporter";
  70. if (message == Ids::pluginCodeInvalid) return "Invalid Plugin Code";
  71. if (message == Ids::manufacturerCodeInvalid) return "Invalid Manufacturer Code";
  72. jassertfalse;
  73. return {};
  74. }
  75. inline String getDescriptionForMessage (const Identifier& message)
  76. {
  77. if (message == Ids::incompatibleLicense) return "Save and export is disabled.";
  78. if (message == Ids::cppStandard) return "Module(s) have a higher C++ standard requirement than the project.";
  79. if (message == Ids::moduleNotFound) return "Module(s) could not be found at the specified paths.";
  80. if (message == Ids::jucePath) return "The path to your JUCE folder is incorrect.";
  81. if (message == Ids::jucerFileModified) return "The .jucer file has been modified since the last save.";
  82. if (message == Ids::missingModuleDependencies) return "Module(s) have missing dependencies.";
  83. if (message == Ids::oldProjucer) return "The version of the Projucer you are using is out of date.";
  84. if (message == Ids::newVersionAvailable) return "A new version of JUCE is available to download.";
  85. if (message == Ids::cLion) return "The CLion exporter is deprecated. Use JUCE's CMake support instead.";
  86. if (message == Ids::pluginCodeInvalid) return "The plugin code should be exactly four characters in length.";
  87. if (message == Ids::manufacturerCodeInvalid) return "The manufacturer code should be exactly four characters in length.";
  88. jassertfalse;
  89. return {};
  90. }
  91. using MessageAction = std::pair<String, std::function<void()>>;
  92. }
  93. enum class Async { no, yes };
  94. //==============================================================================
  95. class Project : public FileBasedDocument,
  96. private ValueTree::Listener,
  97. private LicenseController::LicenseStateListener,
  98. private ChangeListener,
  99. private AvailableModulesList::Listener
  100. {
  101. public:
  102. //==============================================================================
  103. Project (const File&);
  104. ~Project() override;
  105. //==============================================================================
  106. String getDocumentTitle() override;
  107. Result loadDocument (const File& file) override;
  108. Result saveDocument (const File& file) override;
  109. void saveDocumentAsync (const File& file, std::function<void (Result)> callback) override;
  110. void saveProject (Async, ProjectExporter* exporterToSave, std::function<void (Result)> onCompletion);
  111. void saveAndMoveTemporaryProject (bool openInIDE);
  112. Result saveResourcesOnly();
  113. void openProjectInIDE (ProjectExporter& exporterToOpen);
  114. File getLastDocumentOpened() override;
  115. void setLastDocumentOpened (const File& file) override;
  116. void setTitle (const String& newTitle);
  117. //==============================================================================
  118. File getProjectFolder() const { return getFile().getParentDirectory(); }
  119. File getGeneratedCodeFolder() const { return getFile().getSiblingFile ("JuceLibraryCode"); }
  120. File getSourceFilesFolder() const { return getProjectFolder().getChildFile ("Source"); }
  121. File getLocalModulesFolder() const { return getGeneratedCodeFolder().getChildFile ("modules"); }
  122. File getLocalModuleFolder (const String& moduleID) const { return getLocalModulesFolder().getChildFile (moduleID); }
  123. File getAppIncludeFile() const { return getGeneratedCodeFolder().getChildFile (getJuceSourceHFilename()); }
  124. File getBinaryDataCppFile (int index) const;
  125. File getBinaryDataHeaderFile() const { return getBinaryDataCppFile (0).withFileExtension (".h"); }
  126. static String getAppConfigFilename() { return "AppConfig.h"; }
  127. static String getPluginDefinesFilename() { return "JucePluginDefines.h"; }
  128. static String getJuceSourceHFilename() { return "JuceHeader.h"; }
  129. //==============================================================================
  130. template <class FileType>
  131. bool shouldBeAddedToBinaryResourcesByDefault (const FileType& file)
  132. {
  133. return ! file.hasFileExtension (sourceOrHeaderFileExtensions);
  134. }
  135. File resolveFilename (String filename) const;
  136. String getRelativePathForFile (const File& file) const;
  137. //==============================================================================
  138. // Creates editors for the project settings
  139. void createPropertyEditors (PropertyListBuilder&);
  140. //==============================================================================
  141. ValueTree getProjectRoot() const { return projectRoot; }
  142. Value getProjectValue (const Identifier& name) { return projectRoot.getPropertyAsValue (name, getUndoManagerFor (projectRoot)); }
  143. var getProjectVar (const Identifier& name) const { return projectRoot.getProperty (name); }
  144. const build_tools::ProjectType& getProjectType() const;
  145. String getProjectTypeString() const { return projectTypeValue.get(); }
  146. void setProjectType (const String& newProjectType) { projectTypeValue = newProjectType; }
  147. String getProjectNameString() const { return projectNameValue.get(); }
  148. String getProjectFilenameRootString() { return File::createLegalFileName (getDocumentTitle()); }
  149. String getProjectUIDString() const { return projectUIDValue.get(); }
  150. String getProjectLineFeed() const { return projectLineFeedValue.get(); }
  151. String getVersionString() const { return versionValue.get(); }
  152. String getVersionAsHex() const { return build_tools::getVersionAsHex (getVersionString()); }
  153. int getVersionAsHexInteger() const { return build_tools::getVersionAsHexInteger (getVersionString()); }
  154. void setProjectVersion (const String& newVersion) { versionValue = newVersion; }
  155. String getBundleIdentifierString() const { return bundleIdentifierValue.get(); }
  156. String getDefaultBundleIdentifierString() const;
  157. String getDefaultAAXIdentifierString() const { return getDefaultBundleIdentifierString(); }
  158. String getDefaultPluginManufacturerString() const;
  159. String getCompanyNameString() const { return companyNameValue.get(); }
  160. String getCompanyCopyrightString() const { return companyCopyrightValue.get(); }
  161. String getCompanyWebsiteString() const { return companyWebsiteValue.get(); }
  162. String getCompanyEmailString() const { return companyEmailValue.get(); }
  163. String getHeaderSearchPathsString() const { return headerSearchPathsValue.get(); }
  164. StringPairArray getPreprocessorDefs() const { return parsedPreprocessorDefs; }
  165. int getMaxBinaryFileSize() const { return maxBinaryFileSizeValue.get(); }
  166. bool shouldIncludeBinaryInJuceHeader() const { return includeBinaryDataInJuceHeaderValue.get(); }
  167. String getBinaryDataNamespaceString() const { return binaryDataNamespaceValue.get(); }
  168. bool shouldDisplaySplashScreen() const { return displaySplashScreenValue.get(); }
  169. String getSplashScreenColourString() const { return splashScreenColourValue.get(); }
  170. static StringArray getCppStandardStrings() { return { "C++14", "C++17", "C++20", "Use Latest" }; }
  171. static Array<var> getCppStandardVars() { return { "14", "17", "20", "latest" }; }
  172. static String getLatestNumberedCppStandardString()
  173. {
  174. auto cppStandardVars = getCppStandardVars();
  175. return cppStandardVars[cppStandardVars.size() - 2];
  176. }
  177. String getCppStandardString() const { return cppStandardValue.get(); }
  178. StringArray getCompilerFlagSchemes() const;
  179. void addCompilerFlagScheme (const String&);
  180. void removeCompilerFlagScheme (const String&);
  181. String getPostExportShellCommandPosixString() const { return postExportShellCommandPosixValue.get(); }
  182. String getPostExportShellCommandWinString() const { return postExportShellCommandWinValue.get(); }
  183. bool shouldUseAppConfig() const { return useAppConfigValue.get(); }
  184. bool shouldAddUsingNamespaceToJuceHeader() const { return addUsingNamespaceToJuceHeader.get(); }
  185. //==============================================================================
  186. String getPluginNameString() const { return pluginNameValue.get(); }
  187. String getPluginDescriptionString() const { return pluginDescriptionValue.get();}
  188. String getPluginManufacturerString() const { return pluginManufacturerValue.get(); }
  189. String getPluginManufacturerCodeString() const { return pluginManufacturerCodeValue.get(); }
  190. String getPluginCodeString() const { return pluginCodeValue.get(); }
  191. String getPluginChannelConfigsString() const { return pluginChannelConfigsValue.get(); }
  192. String getAAXIdentifierString() const { return pluginAAXIdentifierValue.get(); }
  193. String getPluginAUExportPrefixString() const { return pluginAUExportPrefixValue.get(); }
  194. String getVSTNumMIDIInputsString() const { return pluginVSTNumMidiInputsValue.get(); }
  195. String getVSTNumMIDIOutputsString() const { return pluginVSTNumMidiOutputsValue.get(); }
  196. static bool checkMultiChoiceVar (const ValueTreePropertyWithDefault& valueToCheck, Identifier idToCheck) noexcept
  197. {
  198. if (! valueToCheck.get().isArray())
  199. return false;
  200. auto v = valueToCheck.get();
  201. if (auto* varArray = v.getArray())
  202. return varArray->contains (idToCheck.toString());
  203. return false;
  204. }
  205. bool isAudioPluginProject() const { return getProjectType().isAudioPlugin(); }
  206. bool shouldBuildVST() const { return isAudioPluginProject() && checkMultiChoiceVar (pluginFormatsValue, Ids::buildVST); }
  207. bool shouldBuildVST3() const { return isAudioPluginProject() && checkMultiChoiceVar (pluginFormatsValue, Ids::buildVST3); }
  208. bool shouldBuildAU() const { return isAudioPluginProject() && checkMultiChoiceVar (pluginFormatsValue, Ids::buildAU); }
  209. bool shouldBuildAUv3() const { return isAudioPluginProject() && checkMultiChoiceVar (pluginFormatsValue, Ids::buildAUv3); }
  210. bool shouldBuildRTAS() const { return isAudioPluginProject() && checkMultiChoiceVar (pluginFormatsValue, Ids::buildRTAS); }
  211. bool shouldBuildAAX() const { return isAudioPluginProject() && checkMultiChoiceVar (pluginFormatsValue, Ids::buildAAX); }
  212. bool shouldBuildStandalonePlugin() const { return isAudioPluginProject() && checkMultiChoiceVar (pluginFormatsValue, Ids::buildStandalone); }
  213. bool shouldBuildUnityPlugin() const { return isAudioPluginProject() && checkMultiChoiceVar (pluginFormatsValue, Ids::buildUnity); }
  214. bool shouldEnableIAA() const { return isAudioPluginProject() && checkMultiChoiceVar (pluginFormatsValue, Ids::enableIAA); }
  215. bool isPluginSynth() const { return checkMultiChoiceVar (pluginCharacteristicsValue, Ids::pluginIsSynth); }
  216. bool pluginWantsMidiInput() const { return checkMultiChoiceVar (pluginCharacteristicsValue, Ids::pluginWantsMidiIn); }
  217. bool pluginProducesMidiOutput() const { return checkMultiChoiceVar (pluginCharacteristicsValue, Ids::pluginProducesMidiOut); }
  218. bool isPluginMidiEffect() const { return checkMultiChoiceVar (pluginCharacteristicsValue, Ids::pluginIsMidiEffectPlugin); }
  219. bool pluginEditorNeedsKeyFocus() const { return checkMultiChoiceVar (pluginCharacteristicsValue, Ids::pluginEditorRequiresKeys); }
  220. bool isPluginRTASBypassDisabled() const { return checkMultiChoiceVar (pluginCharacteristicsValue, Ids::pluginRTASDisableBypass); }
  221. bool isPluginRTASMultiMonoDisabled() const { return checkMultiChoiceVar (pluginCharacteristicsValue, Ids::pluginRTASDisableMultiMono); }
  222. bool isPluginAAXBypassDisabled() const { return checkMultiChoiceVar (pluginCharacteristicsValue, Ids::pluginAAXDisableBypass); }
  223. bool isPluginAAXMultiMonoDisabled() const { return checkMultiChoiceVar (pluginCharacteristicsValue, Ids::pluginAAXDisableMultiMono); }
  224. static StringArray getAllAUMainTypeStrings() noexcept;
  225. static Array<var> getAllAUMainTypeVars() noexcept;
  226. Array<var> getDefaultAUMainTypes() const noexcept;
  227. static StringArray getAllVSTCategoryStrings() noexcept;
  228. Array<var> getDefaultVSTCategories() const noexcept;
  229. static StringArray getAllVST3CategoryStrings() noexcept;
  230. Array<var> getDefaultVST3Categories() const noexcept;
  231. static StringArray getAllAAXCategoryStrings() noexcept;
  232. static Array<var> getAllAAXCategoryVars() noexcept;
  233. Array<var> getDefaultAAXCategories() const noexcept;
  234. static StringArray getAllRTASCategoryStrings() noexcept;
  235. static Array<var> getAllRTASCategoryVars() noexcept;
  236. Array<var> getDefaultRTASCategories() const noexcept;
  237. String getAUMainTypeString() const noexcept;
  238. bool isAUSandBoxSafe() const noexcept;
  239. String getVSTCategoryString() const noexcept;
  240. String getVST3CategoryString() const noexcept;
  241. int getAAXCategory() const noexcept;
  242. int getRTASCategory() const noexcept;
  243. String getIAATypeCode() const;
  244. String getIAAPluginName() const;
  245. String getUnityScriptName() const { return addUnityPluginPrefixIfNecessary (getProjectNameString()) + "_UnityScript.cs"; }
  246. static String addUnityPluginPrefixIfNecessary (const String& name)
  247. {
  248. if (! name.startsWithIgnoreCase ("audioplugin"))
  249. return "audioplugin_" + name;
  250. return name;
  251. }
  252. //==============================================================================
  253. bool isAUPluginHost();
  254. bool isVSTPluginHost();
  255. bool isVST3PluginHost();
  256. //==============================================================================
  257. bool shouldBuildTargetType (build_tools::ProjectType::Target::Type targetType) const noexcept;
  258. static build_tools::ProjectType::Target::Type getTargetTypeFromFilePath (const File& file, bool returnSharedTargetIfNoValidSuffix);
  259. //==============================================================================
  260. void updateDeprecatedProjectSettingsInteractively();
  261. StringPairArray getAppConfigDefs();
  262. StringPairArray getAudioPluginFlags() const;
  263. //==============================================================================
  264. class Item
  265. {
  266. public:
  267. //==============================================================================
  268. Item (Project& project, const ValueTree& itemNode, bool isModuleCode);
  269. Item (const Item& other);
  270. static Item createGroup (Project& project, const String& name, const String& uid, bool isModuleCode);
  271. void initialiseMissingProperties();
  272. //==============================================================================
  273. bool isValid() const { return state.isValid(); }
  274. bool operator== (const Item& other) const { return state == other.state && &project == &other.project; }
  275. bool operator!= (const Item& other) const { return ! operator== (other); }
  276. //==============================================================================
  277. bool isFile() const;
  278. bool isGroup() const;
  279. bool isMainGroup() const;
  280. bool isImageFile() const;
  281. bool isSourceFile() const;
  282. String getID() const;
  283. void setID (const String& newID);
  284. Item findItemWithID (const String& targetId) const; // (recursive search)
  285. String getImageFileID() const;
  286. std::unique_ptr<Drawable> loadAsImageFile() const;
  287. //==============================================================================
  288. Value getNameValue();
  289. String getName() const;
  290. File getFile() const;
  291. String getFilePath() const;
  292. void setFile (const File& file);
  293. void setFile (const build_tools::RelativePath& file);
  294. File determineGroupFolder() const;
  295. bool renameFile (const File& newFile);
  296. bool shouldBeAddedToTargetProject() const;
  297. bool shouldBeAddedToTargetExporter (const ProjectExporter&) const;
  298. bool shouldBeCompiled() const;
  299. Value getShouldCompileValue();
  300. bool shouldBeAddedToBinaryResources() const;
  301. Value getShouldAddToBinaryResourcesValue();
  302. bool shouldBeAddedToXcodeResources() const;
  303. Value getShouldAddToXcodeResourcesValue();
  304. Value getShouldInhibitWarningsValue();
  305. bool shouldInhibitWarnings() const;
  306. bool isModuleCode() const;
  307. Value getShouldSkipPCHValue();
  308. bool shouldSkipPCH() const;
  309. Value getCompilerFlagSchemeValue();
  310. String getCompilerFlagSchemeString() const;
  311. void setCompilerFlagScheme (const String&);
  312. void clearCurrentCompilerFlagScheme();
  313. //==============================================================================
  314. bool canContain (const Item& child) const;
  315. int getNumChildren() const { return state.getNumChildren(); }
  316. Item getChild (int index) const { return Item (project, state.getChild (index), belongsToModule); }
  317. Item addNewSubGroup (const String& name, int insertIndex);
  318. Item getOrCreateSubGroup (const String& name);
  319. void addChild (const Item& newChild, int insertIndex);
  320. bool addFileAtIndex (const File& file, int insertIndex, bool shouldCompile);
  321. bool addFileRetainingSortOrder (const File& file, bool shouldCompile);
  322. void addFileUnchecked (const File& file, int insertIndex, bool shouldCompile);
  323. bool addRelativeFile (const build_tools::RelativePath& file, int insertIndex, bool shouldCompile);
  324. void removeItemFromProject();
  325. void sortAlphabetically (bool keepGroupsAtStart, bool recursive);
  326. Item findItemForFile (const File& file) const;
  327. bool containsChildForFile (const build_tools::RelativePath& file) const;
  328. Item getParent() const;
  329. Item createCopy();
  330. UndoManager* getUndoManager() const { return project.getUndoManagerFor (state); }
  331. Icon getIcon (bool isOpen = false) const;
  332. bool isIconCrossedOut() const;
  333. bool needsSaving() const noexcept;
  334. Project& project;
  335. ValueTree state;
  336. private:
  337. Item& operator= (const Item&);
  338. bool belongsToModule;
  339. };
  340. Item getMainGroup();
  341. void findAllImageItems (OwnedArray<Item>& items);
  342. //==============================================================================
  343. ValueTree getExporters();
  344. int getNumExporters();
  345. std::unique_ptr<ProjectExporter> createExporter (int index);
  346. void addNewExporter (const Identifier& exporterIdentifier);
  347. void createExporterForCurrentPlatform();
  348. struct ExporterIterator
  349. {
  350. ExporterIterator (Project& project);
  351. bool next();
  352. ProjectExporter& operator*() const { return *exporter; }
  353. ProjectExporter* operator->() const { return exporter.get(); }
  354. std::unique_ptr<ProjectExporter> exporter;
  355. int index;
  356. private:
  357. Project& project;
  358. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ExporterIterator)
  359. };
  360. //==============================================================================
  361. struct ConfigFlag
  362. {
  363. String symbol, description, sourceModuleID;
  364. ValueTreePropertyWithDefault value;
  365. };
  366. ValueTreePropertyWithDefault getConfigFlag (const String& name);
  367. bool isConfigFlagEnabled (const String& name, bool defaultIsEnabled = false) const;
  368. //==============================================================================
  369. EnabledModulesList& getEnabledModules();
  370. AvailableModulesList& getExporterPathsModulesList() { return exporterPathsModulesList; }
  371. void rescanExporterPathModules (bool async = false);
  372. std::pair<String, File> getModuleWithID (const String&);
  373. //==============================================================================
  374. PropertiesFile& getStoredProperties() const;
  375. //==============================================================================
  376. UndoManager* getUndoManagerFor (const ValueTree&) const { return nullptr; }
  377. UndoManager* getUndoManager() const { return nullptr; }
  378. //==============================================================================
  379. static const char* projectFileExtension;
  380. //==============================================================================
  381. bool updateCachedFileState();
  382. String getCachedFileStateContent() const noexcept { return cachedFileState.second; }
  383. String serialiseProjectXml (std::unique_ptr<XmlElement>) const;
  384. //==============================================================================
  385. String getUniqueTargetFolderSuffixForExporter (const Identifier& exporterIdentifier, const String& baseTargetFolder);
  386. //==============================================================================
  387. bool isCurrentlySaving() const noexcept { return saver != nullptr; }
  388. bool isTemporaryProject() const noexcept { return tempDirectory != File(); }
  389. File getTemporaryDirectory() const noexcept { return tempDirectory; }
  390. void setTemporaryDirectory (const File&) noexcept;
  391. //==============================================================================
  392. ValueTree getProjectMessages() const { return projectMessages; }
  393. void addProjectMessage (const Identifier& messageToAdd, std::vector<ProjectMessages::MessageAction>&& messageActions);
  394. void removeProjectMessage (const Identifier& messageToRemove);
  395. std::vector<ProjectMessages::MessageAction> getMessageActions (const Identifier& message);
  396. //==============================================================================
  397. bool hasIncompatibleLicenseTypeAndSplashScreenSetting() const;
  398. bool isFileModificationCheckPending() const;
  399. bool isSaveAndExportDisabled() const;
  400. private:
  401. //==============================================================================
  402. void valueTreePropertyChanged (ValueTree&, const Identifier&) override;
  403. void valueTreeChildAdded (ValueTree&, ValueTree&) override;
  404. void valueTreeChildRemoved (ValueTree&, ValueTree&, int) override;
  405. void valueTreeChildOrderChanged (ValueTree&, int, int) override;
  406. //==============================================================================
  407. struct ProjectFileModificationPoller : private Timer
  408. {
  409. ProjectFileModificationPoller (Project& p);
  410. bool isCheckPending() const noexcept { return pending; }
  411. private:
  412. void timerCallback() override;
  413. void reset();
  414. void resaveProject();
  415. void reloadProjectFromDisk();
  416. Project& project;
  417. bool pending = false;
  418. };
  419. //==============================================================================
  420. ValueTree projectRoot { Ids::JUCERPROJECT };
  421. ValueTreePropertyWithDefault projectNameValue, projectUIDValue, projectLineFeedValue, projectTypeValue, versionValue, bundleIdentifierValue, companyNameValue,
  422. companyCopyrightValue, companyWebsiteValue, companyEmailValue, displaySplashScreenValue, splashScreenColourValue, cppStandardValue,
  423. headerSearchPathsValue, preprocessorDefsValue, userNotesValue, maxBinaryFileSizeValue, includeBinaryDataInJuceHeaderValue, binaryDataNamespaceValue,
  424. compilerFlagSchemesValue, postExportShellCommandPosixValue, postExportShellCommandWinValue, useAppConfigValue, addUsingNamespaceToJuceHeader;
  425. ValueTreePropertyWithDefault pluginFormatsValue, pluginNameValue, pluginDescriptionValue, pluginManufacturerValue, pluginManufacturerCodeValue,
  426. pluginCodeValue, pluginChannelConfigsValue, pluginCharacteristicsValue, pluginAUExportPrefixValue, pluginAAXIdentifierValue,
  427. pluginAUMainTypeValue, pluginAUSandboxSafeValue, pluginRTASCategoryValue, pluginVSTCategoryValue, pluginVST3CategoryValue, pluginAAXCategoryValue,
  428. pluginVSTNumMidiInputsValue, pluginVSTNumMidiOutputsValue;
  429. //==============================================================================
  430. std::unique_ptr<EnabledModulesList> enabledModulesList;
  431. AvailableModulesList exporterPathsModulesList;
  432. //==============================================================================
  433. void updateDeprecatedProjectSettings();
  434. //==============================================================================
  435. bool shouldWriteLegacyPluginFormatSettings = false;
  436. bool shouldWriteLegacyPluginCharacteristicsSettings = false;
  437. static Array<Identifier> getLegacyPluginFormatIdentifiers() noexcept;
  438. static Array<Identifier> getLegacyPluginCharacteristicsIdentifiers() noexcept;
  439. void writeLegacyPluginFormatSettings();
  440. void writeLegacyPluginCharacteristicsSettings();
  441. void coalescePluginFormatValues();
  442. void coalescePluginCharacteristicsValues();
  443. void updatePluginCategories();
  444. //==============================================================================
  445. File tempDirectory;
  446. std::pair<Time, String> cachedFileState;
  447. //==============================================================================
  448. friend class Item;
  449. StringPairArray parsedPreprocessorDefs;
  450. //==============================================================================
  451. void initialiseProjectValues();
  452. void initialiseMainGroup();
  453. void initialiseAudioPluginValues();
  454. bool setCppVersionFromOldExporterSettings();
  455. void createAudioPluginPropertyEditors (PropertyListBuilder& props);
  456. //==============================================================================
  457. void updateTitleDependencies();
  458. void updateCompanyNameDependencies();
  459. void updateProjectSettings();
  460. ValueTree getConfigurations() const;
  461. ValueTree getConfigNode();
  462. void updateOldStyleConfigList();
  463. void moveOldPropertyFromProjectToAllExporters (Identifier name);
  464. void removeDefunctExporters();
  465. void updateOldModulePaths();
  466. //==============================================================================
  467. void licenseStateChanged() override;
  468. void changeListenerCallback (ChangeBroadcaster*) override;
  469. void availableModulesChanged (AvailableModulesList*) override;
  470. void updateLicenseWarning();
  471. void updateJUCEPathWarning();
  472. void updateModuleWarnings();
  473. void updateExporterWarnings();
  474. void updateCppStandardWarning (bool showWarning);
  475. void updateMissingModuleDependenciesWarning (bool showWarning);
  476. void updateOldProjucerWarning (bool showWarning);
  477. void updateCLionWarning (bool showWarning);
  478. void updateModuleNotFoundWarning (bool showWarning);
  479. void updateCodeWarning (Identifier identifier, String value);
  480. ValueTree projectMessages { ProjectMessages::Ids::projectMessages, {},
  481. { { ProjectMessages::Ids::notification, {} }, { ProjectMessages::Ids::warning, {} } } };
  482. std::map<Identifier, std::vector<ProjectMessages::MessageAction>> messageActions;
  483. ProjectFileModificationPoller fileModificationPoller { *this };
  484. std::unique_ptr<FileChooser> chooser;
  485. std::unique_ptr<ProjectSaver> saver;
  486. //==============================================================================
  487. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Project)
  488. JUCE_DECLARE_WEAK_REFERENCEABLE (Project)
  489. };