From fdcdda34637ec0316cb41469b17b203ccca006cb Mon Sep 17 00:00:00 2001 From: ed Date: Fri, 10 Dec 2021 15:02:18 +0000 Subject: [PATCH] Projucer: Update to ValueTreePropertyWithDefault class --- .../StartPage/jucer_ContentComponents.h | 16 ++--- .../jucer_GlobalPathsWindowComponent.h | 5 +- .../Windows/jucer_PIPCreatorWindowComponent.h | 24 ++++---- .../UI/Sidebar/jucer_ModuleTreeItems.h | 60 +++++++++---------- .../Projucer/Source/Project/jucer_Project.cpp | 2 +- .../Projucer/Source/Project/jucer_Project.h | 22 +++---- .../jucer_ProjectExport_Android.h | 24 ++++---- .../jucer_ProjectExport_CodeBlocks.h | 4 +- .../ProjectSaving/jucer_ProjectExport_MSVC.h | 22 +++---- .../ProjectSaving/jucer_ProjectExport_Make.h | 5 +- .../ProjectSaving/jucer_ProjectExport_Xcode.h | 50 ++++++++-------- .../ProjectSaving/jucer_ProjectExporter.cpp | 16 ++--- .../ProjectSaving/jucer_ProjectExporter.h | 18 +++--- .../Source/Settings/jucer_StoredSettings.cpp | 8 ++- .../Source/Settings/jucer_StoredSettings.h | 8 ++- .../Utility/Helpers/jucer_MiscUtilities.h | 8 ++- ...cer_ValueTreePropertyWithDefaultWrapper.h} | 16 ++--- 17 files changed, 166 insertions(+), 142 deletions(-) rename extras/Projucer/Source/Utility/Helpers/{jucer_ValueWithDefaultWrapper.h => jucer_ValueTreePropertyWithDefaultWrapper.h} (73%) diff --git a/extras/Projucer/Source/Application/StartPage/jucer_ContentComponents.h b/extras/Projucer/Source/Application/StartPage/jucer_ContentComponents.h index 3c2ccfca9a..42134ba222 100644 --- a/extras/Projucer/Source/Application/StartPage/jucer_ContentComponents.h +++ b/extras/Projucer/Source/Application/StartPage/jucer_ContentComponents.h @@ -27,7 +27,7 @@ #include "../../ProjectSaving/jucer_ProjectExporter.h" #include "../../Utility/UI/PropertyComponents/jucer_FilePathPropertyComponent.h" -#include "../../Utility/Helpers/jucer_ValueWithDefaultWrapper.h" +#include "../../Utility/Helpers/jucer_ValueTreePropertyWithDefaultWrapper.h" #include "jucer_NewProjectWizard.h" @@ -117,7 +117,7 @@ public: exportersValue.get(), fileOptionsValue.get(), modulePathValue.getCurrentValue(), - modulePathValue.getWrappedValueWithDefault().isUsingDefault(), + modulePathValue.getWrappedValueTreePropertyWithDefault().isUsingDefault(), [safeThis, dir] (std::unique_ptr project) { if (safeThis == nullptr) @@ -167,12 +167,12 @@ private: ValueTree settingsTree { "NewProjectSettings" }; - ValueWithDefault projectNameValue { settingsTree, Ids::name, nullptr, "NewProject" }, - modulesValue { settingsTree, Ids::dependencies_, nullptr, projectTemplate.requiredModules, "," }, - exportersValue { settingsTree, Ids::exporters, nullptr, StringArray (ProjectExporter::getCurrentPlatformExporterTypeInfo().identifier.toString()), "," }, - fileOptionsValue { settingsTree, Ids::file, nullptr, NewProjectTemplates::getVarForFileOption (projectTemplate.defaultFileOption) }; + ValueTreePropertyWithDefault projectNameValue { settingsTree, Ids::name, nullptr, "NewProject" }, + modulesValue { settingsTree, Ids::dependencies_, nullptr, projectTemplate.requiredModules, "," }, + exportersValue { settingsTree, Ids::exporters, nullptr, StringArray (ProjectExporter::getCurrentPlatformExporterTypeInfo().identifier.toString()), "," }, + fileOptionsValue { settingsTree, Ids::file, nullptr, NewProjectTemplates::getVarForFileOption (projectTemplate.defaultFileOption) }; - ValueWithDefaultWrapper modulePathValue; + ValueTreePropertyWithDefaultWrapper modulePathValue; PropertyPanel panel; @@ -203,7 +203,7 @@ private: PropertyComponent* createModulePathPropertyComponent() { - return new FilePathPropertyComponent (modulePathValue.getWrappedValueWithDefault(), "Path to Modules", true); + return new FilePathPropertyComponent (modulePathValue.getWrappedValueTreePropertyWithDefault(), "Path to Modules", true); } PropertyComponent* createExportersPropertyValue() diff --git a/extras/Projucer/Source/Application/Windows/jucer_GlobalPathsWindowComponent.h b/extras/Projucer/Source/Application/Windows/jucer_GlobalPathsWindowComponent.h index e38e010465..a9be3411e2 100644 --- a/extras/Projucer/Source/Application/Windows/jucer_GlobalPathsWindowComponent.h +++ b/extras/Projucer/Source/Application/Windows/jucer_GlobalPathsWindowComponent.h @@ -296,8 +296,9 @@ private: //============================================================================== Value selectedOSValue; - ValueWithDefault jucePathValue, juceModulePathValue, userModulePathValue, - vstPathValue, rtasPathValue, aaxPathValue, androidSDKPathValue, clionExePathValue, androidStudioExePathValue; + ValueTreePropertyWithDefault jucePathValue, juceModulePathValue, userModulePathValue, + vstPathValue, rtasPathValue, aaxPathValue, androidSDKPathValue, + clionExePathValue, androidStudioExePathValue; Viewport propertyViewport; PropertyGroupComponent propertyGroup { "Global Paths", { getIcons().openFolder, Colours::transparentBlack } }; diff --git a/extras/Projucer/Source/Application/Windows/jucer_PIPCreatorWindowComponent.h b/extras/Projucer/Source/Application/Windows/jucer_PIPCreatorWindowComponent.h index 4ec2ff4989..8bd09eb4f0 100644 --- a/extras/Projucer/Source/Application/Windows/jucer_PIPCreatorWindowComponent.h +++ b/extras/Projucer/Source/Application/Windows/jucer_PIPCreatorWindowComponent.h @@ -320,18 +320,18 @@ private: //============================================================================== ValueTree pipTree { "PIPSettings" }; - ValueWithDefault nameValue { pipTree, Ids::name, nullptr, "MyComponentPIP" }, - versionValue { pipTree, Ids::version, nullptr }, - vendorValue { pipTree, Ids::vendor, nullptr }, - websiteValue { pipTree, Ids::website, nullptr }, - descriptionValue { pipTree, Ids::description, nullptr }, - dependenciesValue { pipTree, Ids::dependencies_, nullptr, getModulesRequiredForComponent(), "," }, - exportersValue { pipTree, Ids::exporters, nullptr, StringArray (ProjectExporter::getCurrentPlatformExporterTypeInfo().identifier.toString()), "," }, - moduleFlagsValue { pipTree, Ids::moduleFlags, nullptr, "JUCE_STRICT_REFCOUNTEDPOINTER=1" }, - definesValue { pipTree, Ids::defines, nullptr }, - typeValue { pipTree, Ids::type, nullptr, "Component" }, - mainClassValue { pipTree, Ids::mainClass, nullptr, "MyComponent" }, - useLocalCopyValue { pipTree, Ids::useLocalCopy, nullptr, false }; + ValueTreePropertyWithDefault nameValue { pipTree, Ids::name, nullptr, "MyComponentPIP" }, + versionValue { pipTree, Ids::version, nullptr }, + vendorValue { pipTree, Ids::vendor, nullptr }, + websiteValue { pipTree, Ids::website, nullptr }, + descriptionValue { pipTree, Ids::description, nullptr }, + dependenciesValue { pipTree, Ids::dependencies_, nullptr, getModulesRequiredForComponent(), "," }, + exportersValue { pipTree, Ids::exporters, nullptr, StringArray (ProjectExporter::getCurrentPlatformExporterTypeInfo().identifier.toString()), "," }, + moduleFlagsValue { pipTree, Ids::moduleFlags, nullptr, "JUCE_STRICT_REFCOUNTEDPOINTER=1" }, + definesValue { pipTree, Ids::defines, nullptr }, + typeValue { pipTree, Ids::type, nullptr, "Component" }, + mainClassValue { pipTree, Ids::mainClass, nullptr, "MyComponent" }, + useLocalCopyValue { pipTree, Ids::useLocalCopy, nullptr, false }; std::unique_ptr lf; diff --git a/extras/Projucer/Source/Project/UI/Sidebar/jucer_ModuleTreeItems.h b/extras/Projucer/Source/Project/UI/Sidebar/jucer_ModuleTreeItems.h index bf046082df..b25027ff6b 100644 --- a/extras/Projucer/Source/Project/UI/Sidebar/jucer_ModuleTreeItems.h +++ b/extras/Projucer/Source/Project/UI/Sidebar/jucer_ModuleTreeItems.h @@ -118,8 +118,8 @@ private: //============================================================================== class ModuleSettingsPanel : public Component, - private Value::Listener, - private Timer + private ValueTree::Listener, + private Value::Listener { public: ModuleSettingsPanel (Project& p, const String& modID, TreeView* tree) @@ -129,10 +129,21 @@ private: modulesTree (tree), moduleID (modID) { + auto& appSettings = getAppSettings(); + appSettings.addProjectDefaultsListener (*this); + appSettings.addFallbackPathsListener (*this); + addAndMakeVisible (group); refresh(); } + ~ModuleSettingsPanel() override + { + auto& appSettings = getAppSettings(); + appSettings.removeProjectDefaultsListener (*this); + appSettings.removeFallbackPathsListener (*this); + } + void refresh() { auto& modules = project.getEnabledModules(); @@ -150,21 +161,23 @@ private: props.add (new CppStandardWarningComponent()); group.clearProperties(); - exporterModulePathDefaultValues.clear(); exporterModulePathValues.clear(); - globalPathValues.clear(); for (Project::ExporterIterator exporter (project); exporter.next();) { if (exporter->isCLion()) continue; - exporterModulePathDefaultValues.add (exporter->getPathForModuleValue (moduleID)); - auto& defaultValue = exporterModulePathDefaultValues.getReference (exporterModulePathDefaultValues.size() - 1); + auto modulePathValue = exporter->getPathForModuleValue (moduleID); + const auto fallbackPath = getAppSettings().getStoredPath (isJUCEModule (moduleID) ? Ids::defaultJuceModulePath + : Ids::defaultUserModulePath, + exporter->getTargetOSForExporter()).get().toString(); - exporterModulePathValues.add (defaultValue.getPropertyAsValue()); + modulePathValue.setDefault (fallbackPath); + exporterModulePathValues.add (modulePathValue.getPropertyAsValue()); + exporterModulePathValues.getReference (exporterModulePathValues.size() - 1).addListener (this); - auto pathComponent = std::make_unique (defaultValue, + auto pathComponent = std::make_unique (modulePathValue, "Path for " + exporter->getUniqueName().quoted(), true, exporter->getTargetOSForExporter() == TargetOS::getThisOS(), @@ -179,21 +192,9 @@ private: "This can be an absolute path, or relative to the jucer project folder, but it " "must be valid on the filesystem of the target machine that will be performing this build. If this " "is empty then the global path will be used."); - - globalPathValues.add (getAppSettings().getStoredPath (isJUCEModule (moduleID) ? Ids::defaultJuceModulePath : Ids::defaultUserModulePath, - exporter->getTargetOSForExporter()).getPropertyAsValue()); - } - - for (int i = 0; i < exporterModulePathDefaultValues.size(); ++i) - { - exporterModulePathDefaultValues.getReference (i).onDefaultChange = [this] { startTimer (50); }; - - exporterModulePathValues.getReference (i).addListener (this); - globalPathValues.getReference (i).addListener (this); } - useGlobalPathValue.removeListener (this); - useGlobalPathValue.referTo (modules.shouldUseGlobalPathValue (moduleID)); + useGlobalPathValue = modules.shouldUseGlobalPathValue (moduleID); useGlobalPathValue.addListener (this); auto menuItemString = (TargetOS::getThisOS() == TargetOS::osx ? "\"Projucer->Global Paths...\"" @@ -242,9 +243,15 @@ private: String getModuleID() const noexcept { return moduleID; } private: + void valueTreePropertyChanged (ValueTree&, const Identifier& property) override + { + if (property == Ids::defaultJuceModulePath || property == Ids::defaultUserModulePath) + refresh(); + } + void valueChanged (Value& v) override { - auto isExporterPathValue = [&] + auto isExporterPathValue = [this, &v] { for (auto& exporterValue : exporterModulePathValues) if (exporterValue.refersToSameSourceAs (v)) @@ -256,18 +263,11 @@ private: if (isExporterPathValue) project.rescanExporterPathModules(); - startTimer (50); - } - - void timerCallback() override - { - stopTimer(); refresh(); } //============================================================================== - Array exporterModulePathDefaultValues; - Array exporterModulePathValues, globalPathValues; + Array exporterModulePathValues; Value useGlobalPathValue; OwnedArray configFlags; diff --git a/extras/Projucer/Source/Project/jucer_Project.cpp b/extras/Projucer/Source/Project/jucer_Project.cpp index 0eb38d2da4..3cc082ec5a 100644 --- a/extras/Projucer/Source/Project/jucer_Project.cpp +++ b/extras/Projucer/Source/Project/jucer_Project.cpp @@ -2001,7 +2001,7 @@ ValueTree Project::getConfigNode() return projectRoot.getOrCreateChildWithName (Ids::JUCEOPTIONS, nullptr); } -ValueWithDefault Project::getConfigFlag (const String& name) +ValueTreePropertyWithDefault Project::getConfigFlag (const String& name) { auto configNode = getConfigNode(); diff --git a/extras/Projucer/Source/Project/jucer_Project.h b/extras/Projucer/Source/Project/jucer_Project.h index 4db0662777..a02a01a45a 100644 --- a/extras/Projucer/Source/Project/jucer_Project.h +++ b/extras/Projucer/Source/Project/jucer_Project.h @@ -243,7 +243,7 @@ public: String getVSTNumMIDIInputsString() const { return pluginVSTNumMidiInputsValue.get(); } String getVSTNumMIDIOutputsString() const { return pluginVSTNumMidiOutputsValue.get(); } - static bool checkMultiChoiceVar (const ValueWithDefault& valueToCheck, Identifier idToCheck) noexcept + static bool checkMultiChoiceVar (const ValueTreePropertyWithDefault& valueToCheck, Identifier idToCheck) noexcept { if (! valueToCheck.get().isArray()) return false; @@ -462,10 +462,10 @@ public: struct ConfigFlag { String symbol, description, sourceModuleID; - ValueWithDefault value; + ValueTreePropertyWithDefault value; }; - ValueWithDefault getConfigFlag (const String& name); + ValueTreePropertyWithDefault getConfigFlag (const String& name); bool isConfigFlagEnabled (const String& name, bool defaultIsEnabled = false) const; //============================================================================== @@ -542,15 +542,15 @@ private: //============================================================================== ValueTree projectRoot { Ids::JUCERPROJECT }; - ValueWithDefault projectNameValue, projectUIDValue, projectLineFeedValue, projectTypeValue, versionValue, bundleIdentifierValue, companyNameValue, - companyCopyrightValue, companyWebsiteValue, companyEmailValue, displaySplashScreenValue, splashScreenColourValue, cppStandardValue, - headerSearchPathsValue, preprocessorDefsValue, userNotesValue, maxBinaryFileSizeValue, includeBinaryDataInJuceHeaderValue, binaryDataNamespaceValue, - compilerFlagSchemesValue, postExportShellCommandPosixValue, postExportShellCommandWinValue, useAppConfigValue, addUsingNamespaceToJuceHeader; + ValueTreePropertyWithDefault projectNameValue, projectUIDValue, projectLineFeedValue, projectTypeValue, versionValue, bundleIdentifierValue, companyNameValue, + companyCopyrightValue, companyWebsiteValue, companyEmailValue, displaySplashScreenValue, splashScreenColourValue, cppStandardValue, + headerSearchPathsValue, preprocessorDefsValue, userNotesValue, maxBinaryFileSizeValue, includeBinaryDataInJuceHeaderValue, binaryDataNamespaceValue, + compilerFlagSchemesValue, postExportShellCommandPosixValue, postExportShellCommandWinValue, useAppConfigValue, addUsingNamespaceToJuceHeader; - ValueWithDefault pluginFormatsValue, pluginNameValue, pluginDescriptionValue, pluginManufacturerValue, pluginManufacturerCodeValue, - pluginCodeValue, pluginChannelConfigsValue, pluginCharacteristicsValue, pluginAUExportPrefixValue, pluginAAXIdentifierValue, - pluginAUMainTypeValue, pluginAUSandboxSafeValue, pluginRTASCategoryValue, pluginVSTCategoryValue, pluginVST3CategoryValue, pluginAAXCategoryValue, - pluginVSTNumMidiInputsValue, pluginVSTNumMidiOutputsValue; + ValueTreePropertyWithDefault pluginFormatsValue, pluginNameValue, pluginDescriptionValue, pluginManufacturerValue, pluginManufacturerCodeValue, + pluginCodeValue, pluginChannelConfigsValue, pluginCharacteristicsValue, pluginAUExportPrefixValue, pluginAAXIdentifierValue, + pluginAUMainTypeValue, pluginAUSandboxSafeValue, pluginRTASCategoryValue, pluginVSTCategoryValue, pluginVST3CategoryValue, pluginAAXCategoryValue, + pluginVSTNumMidiInputsValue, pluginVSTNumMidiOutputsValue; //============================================================================== std::unique_ptr enabledModulesList; diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Android.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Android.h index ee3b5fda7d..a6c937c8ba 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Android.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Android.h @@ -90,15 +90,15 @@ public: } //============================================================================== - ValueWithDefault androidJavaLibs, androidAdditionalJavaFolders, androidAdditionalResourceFolders, androidProjectRepositories, - androidRepositories, androidDependencies, androidCustomAppBuildGradleContent, androidScreenOrientation, - androidCustomActivityClass, androidCustomApplicationClass, androidManifestCustomXmlElements, - androidGradleSettingsContent, androidVersionCode, androidMinimumSDK, androidTargetSDK, androidTheme, - androidExtraAssetsFolder, androidOboeRepositoryPath, androidInternetNeeded, androidMicNeeded, androidCameraNeeded, - androidBluetoothNeeded, androidExternalReadPermission, androidExternalWritePermission, - androidInAppBillingPermission, androidVibratePermission, androidOtherPermissions, androidPushNotifications, - androidEnableRemoteNotifications, androidRemoteNotificationsConfigFile, androidEnableContentSharing, androidKeyStore, - androidKeyStorePass, androidKeyAlias, androidKeyAliasPass, gradleVersion, gradleToolchain, androidPluginVersion; + ValueTreePropertyWithDefault androidJavaLibs, androidAdditionalJavaFolders, androidAdditionalResourceFolders, androidProjectRepositories, + androidRepositories, androidDependencies, androidCustomAppBuildGradleContent, androidScreenOrientation, + androidCustomActivityClass, androidCustomApplicationClass, androidManifestCustomXmlElements, + androidGradleSettingsContent, androidVersionCode, androidMinimumSDK, androidTargetSDK, androidTheme, + androidExtraAssetsFolder, androidOboeRepositoryPath, androidInternetNeeded, androidMicNeeded, androidCameraNeeded, + androidBluetoothNeeded, androidExternalReadPermission, androidExternalWritePermission, + androidInAppBillingPermission, androidVibratePermission, androidOtherPermissions, androidPushNotifications, + androidEnableRemoteNotifications, androidRemoteNotificationsConfigFile, androidEnableContentSharing, androidKeyStore, + androidKeyStorePass, androidKeyAlias, androidKeyAliasPass, gradleVersion, gradleToolchain, androidPluginVersion; //============================================================================== AndroidProjectExporter (Project& p, const ValueTree& t) @@ -335,9 +335,9 @@ protected: return "${ANDROID_ABI}"; } - ValueWithDefault androidArchitectures, androidBuildConfigRemoteNotifsConfigFile, - androidAdditionalXmlValueResources, androidAdditionalDrawableResources, - androidAdditionalRawValueResources, androidCustomStringXmlElements; + ValueTreePropertyWithDefault androidArchitectures, androidBuildConfigRemoteNotifsConfigFile, + androidAdditionalXmlValueResources, androidAdditionalDrawableResources, + androidAdditionalRawValueResources, androidCustomStringXmlElements; }; BuildConfiguration::Ptr createBuildConfig (const ValueTree& v) const override diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_CodeBlocks.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_CodeBlocks.h index 5c47df04d7..8a0794c57d 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_CodeBlocks.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_CodeBlocks.h @@ -188,7 +188,7 @@ public: } private: - ValueWithDefault targetPlatformValue; + ValueTreePropertyWithDefault targetPlatformValue; String getTargetPlatformString() const { return targetPlatformValue.get(); } @@ -235,7 +235,7 @@ private: String getArchitectureTypeString() const { return architectureTypeValue.get(); } //============================================================================== - ValueWithDefault architectureTypeValue; + ValueTreePropertyWithDefault architectureTypeValue; }; BuildConfiguration::Ptr createBuildConfig (const ValueTree& tree) const override diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h index 90319e499e..119eac8b00 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h @@ -310,12 +310,12 @@ public: } private: - ValueWithDefault warningLevelValue, warningsAreErrorsValue, prebuildCommandValue, postbuildCommandValue, generateDebugSymbolsValue, - generateManifestValue, enableIncrementalLinkingValue, useRuntimeLibDLLValue, multiProcessorCompilationValue, - intermediatesPathValue, characterSetValue, architectureTypeValue, fastMathValue, debugInformationFormatValue, - pluginBinaryCopyStepValue; + ValueTreePropertyWithDefault warningLevelValue, warningsAreErrorsValue, prebuildCommandValue, postbuildCommandValue, generateDebugSymbolsValue, + generateManifestValue, enableIncrementalLinkingValue, useRuntimeLibDLLValue, multiProcessorCompilationValue, + intermediatesPathValue, characterSetValue, architectureTypeValue, fastMathValue, debugInformationFormatValue, + pluginBinaryCopyStepValue; - ValueWithDefault vstBinaryLocation, vst3BinaryLocation, rtasBinaryLocation, aaxBinaryLocation, unityPluginBinaryLocation; + ValueTreePropertyWithDefault vstBinaryLocation, vst3BinaryLocation, rtasBinaryLocation, aaxBinaryLocation, unityPluginBinaryLocation; Value architectureValueToListenTo; @@ -1600,12 +1600,12 @@ protected: mutable File rcFile, iconFile, packagesConfigFile; OwnedArray targets; - ValueWithDefault IPPLibraryValue, - IPP1ALibraryValue, - MKL1ALibraryValue, - platformToolsetValue, - targetPlatformVersion, - manifestFileValue; + ValueTreePropertyWithDefault IPPLibraryValue, + IPP1ALibraryValue, + MKL1ALibraryValue, + platformToolsetValue, + targetPlatformVersion, + manifestFileValue; File getProjectFile (const String& extension, const String& target) const { diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Make.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Make.h index 58dcdb7d67..49f22ea5e2 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Make.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Make.h @@ -107,7 +107,8 @@ protected: private: //============================================================================== - ValueWithDefault architectureTypeValue, pluginBinaryCopyStepValue, vstBinaryLocation, vst3BinaryLocation, unityPluginBinaryLocation; + ValueTreePropertyWithDefault architectureTypeValue, pluginBinaryCopyStepValue, + vstBinaryLocation, vst3BinaryLocation, unityPluginBinaryLocation; }; BuildConfiguration::Ptr createBuildConfig (const ValueTree& tree) const override @@ -508,7 +509,7 @@ public: } private: - ValueWithDefault extraPkgConfigValue; + ValueTreePropertyWithDefault extraPkgConfigValue; //============================================================================== StringPairArray getDefines (const BuildConfiguration& config) const diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h index 27c42ac56b..fdc5ee8cd3 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h @@ -887,11 +887,11 @@ protected: //============================================================================== bool iOS; - ValueWithDefault macOSBaseSDK, macOSDeploymentTarget, macOSArchitecture, iosBaseSDK, iosDeploymentTarget, - customXcodeFlags, plistPreprocessorDefinitions, codeSignIdentity, - fastMathEnabled, stripLocalSymbolsEnabled, pluginBinaryCopyStepEnabled, - vstBinaryLocation, vst3BinaryLocation, auBinaryLocation, rtasBinaryLocation, - aaxBinaryLocation, unityPluginBinaryLocation; + ValueTreePropertyWithDefault macOSBaseSDK, macOSDeploymentTarget, macOSArchitecture, iosBaseSDK, iosDeploymentTarget, + customXcodeFlags, plistPreprocessorDefinitions, codeSignIdentity, + fastMathEnabled, stripLocalSymbolsEnabled, pluginBinaryCopyStepEnabled, + vstBinaryLocation, vst3BinaryLocation, auBinaryLocation, rtasBinaryLocation, + aaxBinaryLocation, unityPluginBinaryLocation; //============================================================================== void valueTreePropertyChanged (ValueTree&, const Identifier& property) override @@ -968,7 +968,9 @@ protected: if (macOSArchitecture.get() == "default") macOSArchitecture.resetToDefault(); - const auto updateSDKString = [this] (const Identifier& propertyName, ValueWithDefault& value, const String& suffix) + const auto updateSDKString = [this] (const Identifier& propertyName, + ValueTreePropertyWithDefault& value, + const String& suffix) { auto sdkString = config[propertyName].toString(); @@ -3561,24 +3563,24 @@ private: const bool iOS; - ValueWithDefault applicationCategoryValue, - customPListValue, pListPrefixHeaderValue, pListPreprocessValue, - subprojectsValue, - validArchsValue, - extraFrameworksValue, frameworkSearchPathsValue, extraCustomFrameworksValue, embeddedFrameworksValue, - postbuildCommandValue, prebuildCommandValue, - duplicateAppExResourcesFolderValue, iosDeviceFamilyValue, iPhoneScreenOrientationValue, - iPadScreenOrientationValue, customXcodeResourceFoldersValue, customXcassetsFolderValue, - appSandboxValue, appSandboxInheritanceValue, appSandboxOptionsValue, - hardenedRuntimeValue, hardenedRuntimeOptionsValue, - microphonePermissionNeededValue, microphonePermissionsTextValue, - cameraPermissionNeededValue, cameraPermissionTextValue, - bluetoothPermissionNeededValue, bluetoothPermissionTextValue, - sendAppleEventsPermissionNeededValue, sendAppleEventsPermissionTextValue, - uiFileSharingEnabledValue, uiSupportsDocumentBrowserValue, uiStatusBarHiddenValue, uiRequiresFullScreenValue, documentExtensionsValue, iosInAppPurchasesValue, - iosContentSharingValue, iosBackgroundAudioValue, iosBackgroundBleValue, iosPushNotificationsValue, iosAppGroupsValue, iCloudPermissionsValue, - networkingMulticastValue, iosDevelopmentTeamIDValue, iosAppGroupsIDValue, keepCustomXcodeSchemesValue, useHeaderMapValue, customLaunchStoryboardValue, - exporterBundleIdentifierValue, suppressPlistResourceUsageValue, useLegacyBuildSystemValue, buildNumber; + ValueTreePropertyWithDefault applicationCategoryValue, + customPListValue, pListPrefixHeaderValue, pListPreprocessValue, + subprojectsValue, + validArchsValue, + extraFrameworksValue, frameworkSearchPathsValue, extraCustomFrameworksValue, embeddedFrameworksValue, + postbuildCommandValue, prebuildCommandValue, + duplicateAppExResourcesFolderValue, iosDeviceFamilyValue, iPhoneScreenOrientationValue, + iPadScreenOrientationValue, customXcodeResourceFoldersValue, customXcassetsFolderValue, + appSandboxValue, appSandboxInheritanceValue, appSandboxOptionsValue, + hardenedRuntimeValue, hardenedRuntimeOptionsValue, + microphonePermissionNeededValue, microphonePermissionsTextValue, + cameraPermissionNeededValue, cameraPermissionTextValue, + bluetoothPermissionNeededValue, bluetoothPermissionTextValue, + sendAppleEventsPermissionNeededValue, sendAppleEventsPermissionTextValue, + uiFileSharingEnabledValue, uiSupportsDocumentBrowserValue, uiStatusBarHiddenValue, uiRequiresFullScreenValue, documentExtensionsValue, iosInAppPurchasesValue, + iosContentSharingValue, iosBackgroundAudioValue, iosBackgroundBleValue, iosPushNotificationsValue, iosAppGroupsValue, iCloudPermissionsValue, + networkingMulticastValue, iosDevelopmentTeamIDValue, iosAppGroupsIDValue, keepCustomXcodeSchemesValue, useHeaderMapValue, customLaunchStoryboardValue, + exporterBundleIdentifierValue, suppressPlistResourceUsageValue, useLegacyBuildSystemValue, buildNumber; JUCE_DECLARE_NON_COPYABLE (XcodeProjectExporter) }; diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.cpp b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.cpp index e1ec4dc0f5..4a2cd9d9d6 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.cpp +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.cpp @@ -267,7 +267,7 @@ void ProjectExporter::createPropertyEditors (PropertyListBuilder& props) if ((shouldBuildTargetType (build_tools::ProjectType::Target::VSTPlugIn) && project.shouldBuildVST()) || (project.isVSTPluginHost() && supportsTargetType (build_tools::ProjectType::Target::VSTPlugIn))) { - props.add (new FilePathPropertyComponent (vstLegacyPathValueWrapper.getWrappedValueWithDefault(), "VST (Legacy) SDK Folder", true, + props.add (new FilePathPropertyComponent (vstLegacyPathValueWrapper.getWrappedValueTreePropertyWithDefault(), "VST (Legacy) SDK Folder", true, getTargetOSForExporter() == TargetOS::getThisOS(), "*", project.getProjectFolder()), "If you're building a VST plug-in or host, you can use this field to override the global VST (Legacy) SDK path with a project-specific path. " "This can be an absolute path, or a path relative to the Projucer project file."); @@ -275,14 +275,14 @@ void ProjectExporter::createPropertyEditors (PropertyListBuilder& props) if (shouldBuildTargetType (build_tools::ProjectType::Target::AAXPlugIn) && project.shouldBuildAAX()) { - props.add (new FilePathPropertyComponent (aaxPathValueWrapper.getWrappedValueWithDefault(), "AAX SDK Folder", true, + props.add (new FilePathPropertyComponent (aaxPathValueWrapper.getWrappedValueTreePropertyWithDefault(), "AAX SDK Folder", true, getTargetOSForExporter() == TargetOS::getThisOS(), "*", project.getProjectFolder()), "If you're building an AAX plug-in, this must be the folder containing the AAX SDK. This can be an absolute path, or a path relative to the Projucer project file."); } if (shouldBuildTargetType (build_tools::ProjectType::Target::RTASPlugIn) && project.shouldBuildRTAS()) { - props.add (new FilePathPropertyComponent (rtasPathValueWrapper.getWrappedValueWithDefault(), "RTAS SDK Folder", true, + props.add (new FilePathPropertyComponent (rtasPathValueWrapper.getWrappedValueTreePropertyWithDefault(), "RTAS SDK Folder", true, getTargetOSForExporter() == TargetOS::getThisOS(), "*", project.getProjectFolder()), "If you're building an RTAS plug-in, this must be the folder containing the RTAS SDK. This can be an absolute path, or a path relative to the Projucer project file."); } @@ -295,7 +295,7 @@ void ProjectExporter::createPropertyEditors (PropertyListBuilder& props) "Extra command-line flags to be passed to the compiler. This string can contain references to preprocessor definitions in the " "form ${NAME_OF_DEFINITION}, which will be replaced with their values."); - for (HashMap::Iterator i (compilerFlagSchemesMap); i.next();) + for (HashMap::Iterator i (compilerFlagSchemesMap); i.next();) props.add (new TextPropertyComponent (compilerFlagSchemesMap.getReference (i.getKey()), "Compiler Flags for " + i.getKey().quoted(), 8192, false), "The exporter-specific compiler flags that will be added to files using this scheme."); @@ -560,7 +560,7 @@ static var getStoredPathForModule (const String& id, const ProjectExporter& exp) exp.getTargetOSForExporter()).get(); } -ValueWithDefault ProjectExporter::getPathForModuleValue (const String& moduleID) +ValueTreePropertyWithDefault ProjectExporter::getPathForModuleValue (const String& moduleID) { auto* um = getUndoManager(); @@ -909,20 +909,22 @@ void ProjectExporter::BuildConfiguration::addGCCOptimisationProperty (PropertyLi void ProjectExporter::BuildConfiguration::addRecommendedLinuxCompilerWarningsProperty (PropertyListBuilder& props) { + recommendedWarningsValue.setDefault (""); + props.add (new ChoicePropertyComponent (recommendedWarningsValue, "Add Recommended Compiler Warning Flags", { CompilerNames::gcc, CompilerNames::llvm, "Disabled" }, { CompilerNames::gcc, CompilerNames::llvm, "" }), "Enable this to add a set of recommended compiler warning flags."); - recommendedWarningsValue.setDefault (""); } void ProjectExporter::BuildConfiguration::addRecommendedLLVMCompilerWarningsProperty (PropertyListBuilder& props) { + recommendedWarningsValue.setDefault (""); + props.add (new ChoicePropertyComponent (recommendedWarningsValue, "Add Recommended Compiler Warning Flags", { "Enabled", "Disabled" }, { CompilerNames::llvm, "" }), "Enable this to add a set of recommended compiler warning flags."); - recommendedWarningsValue.setDefault (""); } ProjectExporter::BuildConfiguration::CompilerWarningFlags ProjectExporter::BuildConfiguration::getRecommendedCompilerWarningFlags() const diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.h index be0ad1e6ac..583e8d1625 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.h @@ -27,7 +27,7 @@ #include "../Project/jucer_Project.h" #include "../Utility/UI/PropertyComponents/jucer_PropertyComponentsWithEnablement.h" -#include "../Utility/Helpers/jucer_ValueWithDefaultWrapper.h" +#include "../Utility/Helpers/jucer_ValueTreePropertyWithDefaultWrapper.h" #include "../Project/Modules/jucer_Modules.h" class ProjectSaver; @@ -157,7 +157,7 @@ public: // NB: this is the path to the parent "modules" folder that contains the named module, not the // module folder itself. - ValueWithDefault getPathForModuleValue (const String& moduleID); + ValueTreePropertyWithDefault getPathForModuleValue (const String& moduleID); String getPathForModuleString (const String& moduleID) const; void removePathForModule (const String& moduleID); @@ -306,9 +306,9 @@ public: const ProjectExporter& exporter; protected: - ValueWithDefault isDebugValue, configNameValue, targetNameValue, targetBinaryPathValue, recommendedWarningsValue, optimisationLevelValue, - linkTimeOptimisationValue, ppDefinesValue, headerSearchPathValue, librarySearchPathValue, userNotesValue, - usePrecompiledHeaderFileValue, precompiledHeaderFileValue; + ValueTreePropertyWithDefault isDebugValue, configNameValue, targetNameValue, targetBinaryPathValue, recommendedWarningsValue, optimisationLevelValue, + linkTimeOptimisationValue, ppDefinesValue, headerSearchPathValue, librarySearchPathValue, userNotesValue, + usePrecompiledHeaderFileValue, precompiledHeaderFileValue; private: std::map recommendedCompilerWarningFlags; @@ -409,13 +409,13 @@ protected: const File projectFolder; //============================================================================== - ValueWithDefaultWrapper vstLegacyPathValueWrapper, rtasPathValueWrapper, aaxPathValueWrapper; + ValueTreePropertyWithDefaultWrapper vstLegacyPathValueWrapper, rtasPathValueWrapper, aaxPathValueWrapper; - ValueWithDefault targetLocationValue, extraCompilerFlagsValue, extraLinkerFlagsValue, externalLibrariesValue, - userNotesValue, gnuExtensionsValue, bigIconValue, smallIconValue, extraPPDefsValue; + ValueTreePropertyWithDefault targetLocationValue, extraCompilerFlagsValue, extraLinkerFlagsValue, externalLibrariesValue, + userNotesValue, gnuExtensionsValue, bigIconValue, smallIconValue, extraPPDefsValue; Value projectCompilerFlagSchemesValue; - HashMap compilerFlagSchemesMap; + HashMap compilerFlagSchemesMap; mutable Array itemGroups; Project::Item* modulesGroup = nullptr; diff --git a/extras/Projucer/Source/Settings/jucer_StoredSettings.cpp b/extras/Projucer/Source/Settings/jucer_StoredSettings.cpp index 9727c77575..0230bec6c5 100644 --- a/extras/Projucer/Source/Settings/jucer_StoredSettings.cpp +++ b/extras/Projucer/Source/Settings/jucer_StoredSettings.cpp @@ -454,10 +454,16 @@ static Identifier identifierForOS (DependencyPathOS os) noexcept return {}; } -ValueWithDefault StoredSettings::getStoredPath (const Identifier& key, DependencyPathOS os) +ValueTreePropertyWithDefault StoredSettings::getStoredPath (const Identifier& key, DependencyPathOS os) { auto tree = (os == TargetOS::getThisOS() ? projectDefaults : fallbackPaths.getOrCreateChildWithName (identifierForOS (os), nullptr)); return { tree, key, nullptr, getFallbackPathForOS (key, os) }; } + +void StoredSettings::addProjectDefaultsListener (ValueTree::Listener& l) { projectDefaults.addListener (&l); } +void StoredSettings::removeProjectDefaultsListener (ValueTree::Listener& l) { projectDefaults.removeListener (&l); } + +void StoredSettings::addFallbackPathsListener (ValueTree::Listener& l) { fallbackPaths.addListener (&l); } +void StoredSettings::removeFallbackPathsListener (ValueTree::Listener& l) { fallbackPaths.removeListener (&l); } diff --git a/extras/Projucer/Source/Settings/jucer_StoredSettings.h b/extras/Projucer/Source/Settings/jucer_StoredSettings.h index 16f69c12e8..b6413bbf61 100644 --- a/extras/Projucer/Source/Settings/jucer_StoredSettings.h +++ b/extras/Projucer/Source/Settings/jucer_StoredSettings.h @@ -61,7 +61,13 @@ public: }; //============================================================================== - ValueWithDefault getStoredPath (const Identifier& key, DependencyPathOS os); + void addProjectDefaultsListener (ValueTree::Listener&); + void removeProjectDefaultsListener (ValueTree::Listener&); + + void addFallbackPathsListener (ValueTree::Listener&); + void removeFallbackPathsListener (ValueTree::Listener&); + + ValueTreePropertyWithDefault getStoredPath (const Identifier& key, DependencyPathOS os); bool isJUCEPathIncorrect(); //============================================================================== diff --git a/extras/Projucer/Source/Utility/Helpers/jucer_MiscUtilities.h b/extras/Projucer/Source/Utility/Helpers/jucer_MiscUtilities.h index 40cb7fe289..e6e7a6c66c 100644 --- a/extras/Projucer/Source/Utility/Helpers/jucer_MiscUtilities.h +++ b/extras/Projucer/Source/Utility/Helpers/jucer_MiscUtilities.h @@ -91,13 +91,17 @@ struct PropertyListBuilder add (propertyComp); } - void addSearchPathProperty (const Value& value, const String& name, const String& mainHelpText) + void addSearchPathProperty (const Value& value, + const String& name, + const String& mainHelpText) { add (new TextPropertyComponent (value, name, 16384, true), mainHelpText + " Use semi-colons or new-lines to separate multiple paths."); } - void addSearchPathProperty (ValueWithDefault& value, const String& name, const String& mainHelpText) + void addSearchPathProperty (const ValueTreePropertyWithDefault& value, + const String& name, + const String& mainHelpText) { add (new TextPropertyComponent (value, name, 16384, true), mainHelpText + " Use semi-colons or new-lines to separate multiple paths."); diff --git a/extras/Projucer/Source/Utility/Helpers/jucer_ValueWithDefaultWrapper.h b/extras/Projucer/Source/Utility/Helpers/jucer_ValueTreePropertyWithDefaultWrapper.h similarity index 73% rename from extras/Projucer/Source/Utility/Helpers/jucer_ValueWithDefaultWrapper.h rename to extras/Projucer/Source/Utility/Helpers/jucer_ValueTreePropertyWithDefaultWrapper.h index 2419787823..fef47d8995 100644 --- a/extras/Projucer/Source/Utility/Helpers/jucer_ValueWithDefaultWrapper.h +++ b/extras/Projucer/Source/Utility/Helpers/jucer_ValueTreePropertyWithDefaultWrapper.h @@ -28,16 +28,18 @@ //============================================================================== /** - Wraps a ValueWithDefault object that has a default which depends on a global value. + Wraps a ValueTreePropertyWithDefault object that has a default which depends on a global value. */ -class ValueWithDefaultWrapper : private Value::Listener +class ValueTreePropertyWithDefaultWrapper : private Value::Listener { public: - ValueWithDefaultWrapper() = default; + ValueTreePropertyWithDefaultWrapper() = default; - void init (const ValueWithDefault& vwd, ValueWithDefault global, TargetOS::OS targetOS) + void init (const ValueTreePropertyWithDefault& v, + ValueTreePropertyWithDefault global, + TargetOS::OS targetOS) { - wrappedValue = vwd; + wrappedValue = v; globalValue = global.getPropertyAsValue(); globalIdentifier = global.getPropertyID(); os = targetOS; @@ -49,7 +51,7 @@ public: valueChanged (globalValue); } - ValueWithDefault& getWrappedValueWithDefault() + ValueTreePropertyWithDefault& getWrappedValueTreePropertyWithDefault() { return wrappedValue; } @@ -65,7 +67,7 @@ private: wrappedValue.setDefault (getAppSettings().getStoredPath (globalIdentifier, os).get()); } - ValueWithDefault wrappedValue; + ValueTreePropertyWithDefault wrappedValue; Value globalValue; Identifier globalIdentifier;