diff --git a/extras/Introjucer/JuceLibraryCode/AppConfig.h b/extras/Introjucer/JuceLibraryCode/AppConfig.h index 1a37c9571c..a0118bb8c8 100644 --- a/extras/Introjucer/JuceLibraryCode/AppConfig.h +++ b/extras/Introjucer/JuceLibraryCode/AppConfig.h @@ -3,8 +3,9 @@ IMPORTANT! This file is auto-generated each time you save your project - if you alter its contents, your changes may be overwritten! - If you want to change any of these values, use the Introjucer to do so, - rather than editing this file directly! + There's a section below where you can add your own custom code safely, and the + Introjucer will preserve the contents of that block, but the best way to change + any of these definitions is by using the Introjucer's project settings. Any commented-out settings will assume their default values. @@ -13,6 +14,13 @@ #ifndef __JUCE_APPCONFIG_M70QFTRRK__ #define __JUCE_APPCONFIG_M70QFTRRK__ +//============================================================================== +// [BEGIN_USER_CODE_SECTION] + +// (You can add your own code in this section, and the Introjucer will not overwrite it) + +// [END_USER_CODE_SECTION] + //============================================================================== #define JUCE_MODULE_AVAILABLE_juce_core 1 #define JUCE_MODULE_AVAILABLE_juce_cryptography 1 diff --git a/extras/Introjucer/Source/Project Saving/jucer_ProjectSaver.h b/extras/Introjucer/Source/Project Saving/jucer_ProjectSaver.h index 8ab80d4f73..e543063558 100644 --- a/extras/Introjucer/Source/Project Saving/jucer_ProjectSaver.h +++ b/extras/Introjucer/Source/Project Saving/jucer_ProjectSaver.h @@ -74,6 +74,8 @@ public: return thread.result; } + const String appConfigUserContent (loadUserContentFromAppConfig()); + if (generatedCodeFolder.exists()) deleteNonHiddenFilesIn (generatedCodeFolder); @@ -91,7 +93,7 @@ public: } if (errors.size() == 0) - writeAppConfigFile (modules); + writeAppConfigFile (modules, appConfigUserContent); if (errors.size() == 0) writeBinaryDataFiles(); @@ -103,7 +105,7 @@ public: writeProjects (modules); if (errors.size() == 0) - writeAppConfigFile (modules); // (this is repeated in case the projects added anything to it) + writeAppConfigFile (modules, appConfigUserContent); // (this is repeated in case the projects added anything to it) if (generatedCodeFolder.exists() && errors.size() == 0) writeReadmeFile(); @@ -258,11 +260,42 @@ private: return longest; } - void writeAppConfig (OutputStream& out, const OwnedArray& modules) + File getAppConfigFile() const { return generatedCodeFolder.getChildFile (project.getAppConfigFilename()); } + + String loadUserContentFromAppConfig() const + { + StringArray lines, userContent; + lines.addLines (getAppConfigFile().loadFileAsString()); + bool foundCodeSection = false; + + for (int i = 0; i < lines.size(); ++i) + { + if (lines[i].contains ("[BEGIN_USER_CODE_SECTION]")) + { + for (int j = i + 1; j < lines.size() && ! lines[j].contains ("[END_USER_CODE_SECTION]"); ++j) + userContent.add (lines[j]); + + foundCodeSection = true; + break; + } + } + + if (! foundCodeSection) + { + userContent.add (String::empty); + userContent.add ("// (You can add your own code in this section, and the Introjucer will not overwrite it)"); + userContent.add (String::empty); + } + + return userContent.joinIntoString (newLine) + newLine; + } + + void writeAppConfig (OutputStream& out, const OwnedArray& modules, const String& userContent) { writeAutoGenWarningComment (out); - out << " If you want to change any of these values, use the Introjucer to do so," << newLine - << " rather than editing this file directly!" << newLine + out << " There's a section below where you can add your own custom code safely, and the" << newLine + << " Introjucer will preserve the contents of that block, but the best way to change" << newLine + << " any of these definitions is by using the Introjucer's project settings." << newLine << newLine << " Any commented-out settings will assume their default values." << newLine << newLine @@ -273,6 +306,11 @@ private: out << "#ifndef " << headerGuard << newLine << "#define " << headerGuard << newLine << newLine + << "//==============================================================================" << newLine + << "// [BEGIN_USER_CODE_SECTION]" << newLine + << userContent + << "// [END_USER_CODE_SECTION]" << newLine + << newLine << "//==============================================================================" << newLine; const int longestName = findLongestModuleName (modules); @@ -328,12 +366,12 @@ private: << "#endif // " << headerGuard << newLine; } - void writeAppConfigFile (const OwnedArray& modules) + void writeAppConfigFile (const OwnedArray& modules, const String& userContent) { - appConfigFile = generatedCodeFolder.getChildFile (project.getAppConfigFilename()); + appConfigFile = getAppConfigFile(); MemoryOutputStream mem; - writeAppConfig (mem, modules); + writeAppConfig (mem, modules, userContent); saveGeneratedFile (project.getAppConfigFilename(), mem); } diff --git a/extras/JuceDemo/JuceLibraryCode/AppConfig.h b/extras/JuceDemo/JuceLibraryCode/AppConfig.h index 04252d2a19..4d484ea1bb 100644 --- a/extras/JuceDemo/JuceLibraryCode/AppConfig.h +++ b/extras/JuceDemo/JuceLibraryCode/AppConfig.h @@ -3,8 +3,9 @@ IMPORTANT! This file is auto-generated each time you save your project - if you alter its contents, your changes may be overwritten! - If you want to change any of these values, use the Introjucer to do so, - rather than editing this file directly! + There's a section below where you can add your own custom code safely, and the + Introjucer will preserve the contents of that block, but the best way to change + any of these definitions is by using the Introjucer's project settings. Any commented-out settings will assume their default values. @@ -13,6 +14,13 @@ #ifndef __JUCE_APPCONFIG_SLVVV6J__ #define __JUCE_APPCONFIG_SLVVV6J__ +//============================================================================== +// [BEGIN_USER_CODE_SECTION] + +// (You can add your own code in this section, and the Introjucer will not overwrite it) + +// [END_USER_CODE_SECTION] + //============================================================================== #define JUCE_MODULE_AVAILABLE_juce_audio_basics 1 #define JUCE_MODULE_AVAILABLE_juce_audio_devices 1 diff --git a/extras/audio plugin demo/JuceLibraryCode/AppConfig.h b/extras/audio plugin demo/JuceLibraryCode/AppConfig.h index 4ea4c74dcd..98045563f0 100644 --- a/extras/audio plugin demo/JuceLibraryCode/AppConfig.h +++ b/extras/audio plugin demo/JuceLibraryCode/AppConfig.h @@ -3,8 +3,9 @@ IMPORTANT! This file is auto-generated each time you save your project - if you alter its contents, your changes may be overwritten! - If you want to change any of these values, use the Introjucer to do so, - rather than editing this file directly! + There's a section below where you can add your own custom code safely, and the + Introjucer will preserve the contents of that block, but the best way to change + any of these definitions is by using the Introjucer's project settings. Any commented-out settings will assume their default values. @@ -13,6 +14,13 @@ #ifndef __JUCE_APPCONFIG_0NRD9LLGO__ #define __JUCE_APPCONFIG_0NRD9LLGO__ +//============================================================================== +// [BEGIN_USER_CODE_SECTION] + +// (You can add your own code in this section, and the Introjucer will not overwrite it) + +// [END_USER_CODE_SECTION] + //============================================================================== #define JUCE_MODULE_AVAILABLE_juce_audio_basics 1 #define JUCE_MODULE_AVAILABLE_juce_audio_devices 1 diff --git a/extras/audio plugin host/JuceLibraryCode/AppConfig.h b/extras/audio plugin host/JuceLibraryCode/AppConfig.h index cf0cff18b7..ff03f52c01 100644 --- a/extras/audio plugin host/JuceLibraryCode/AppConfig.h +++ b/extras/audio plugin host/JuceLibraryCode/AppConfig.h @@ -3,8 +3,9 @@ IMPORTANT! This file is auto-generated each time you save your project - if you alter its contents, your changes may be overwritten! - If you want to change any of these values, use the Introjucer to do so, - rather than editing this file directly! + There's a section below where you can add your own custom code safely, and the + Introjucer will preserve the contents of that block, but the best way to change + any of these definitions is by using the Introjucer's project settings. Any commented-out settings will assume their default values. @@ -13,6 +14,13 @@ #ifndef __JUCE_APPCONFIG_NTE0XB0IJ__ #define __JUCE_APPCONFIG_NTE0XB0IJ__ +//============================================================================== +// [BEGIN_USER_CODE_SECTION] + +// (You can add your own code in this section, and the Introjucer will not overwrite it) + +// [END_USER_CODE_SECTION] + //============================================================================== #define JUCE_MODULE_AVAILABLE_juce_audio_basics 1 #define JUCE_MODULE_AVAILABLE_juce_audio_devices 1 diff --git a/extras/binarybuilder/JuceLibraryCode/AppConfig.h b/extras/binarybuilder/JuceLibraryCode/AppConfig.h index e5bee9ea8d..468554b3be 100644 --- a/extras/binarybuilder/JuceLibraryCode/AppConfig.h +++ b/extras/binarybuilder/JuceLibraryCode/AppConfig.h @@ -3,8 +3,9 @@ IMPORTANT! This file is auto-generated each time you save your project - if you alter its contents, your changes may be overwritten! - If you want to change any of these values, use the Introjucer to do so, - rather than editing this file directly! + There's a section below where you can add your own custom code safely, and the + Introjucer will preserve the contents of that block, but the best way to change + any of these definitions is by using the Introjucer's project settings. Any commented-out settings will assume their default values. @@ -13,6 +14,13 @@ #ifndef __JUCE_APPCONFIG_3T6YQETY1__ #define __JUCE_APPCONFIG_3T6YQETY1__ +//============================================================================== +// [BEGIN_USER_CODE_SECTION] + +// (You can add your own code in this section, and the Introjucer will not overwrite it) + +// [END_USER_CODE_SECTION] + //============================================================================== #define JUCE_MODULE_AVAILABLE_juce_core 1 diff --git a/extras/example projects/JuceLibraryCode/AppConfig.h b/extras/example projects/JuceLibraryCode/AppConfig.h index 9ae8c91838..6c9f205a49 100644 --- a/extras/example projects/JuceLibraryCode/AppConfig.h +++ b/extras/example projects/JuceLibraryCode/AppConfig.h @@ -3,8 +3,9 @@ IMPORTANT! This file is auto-generated each time you save your project - if you alter its contents, your changes may be overwritten! - If you want to change any of these values, use the Introjucer to do so, - rather than editing this file directly! + There's a section below where you can add your own custom code safely, and the + Introjucer will preserve the contents of that block, but the best way to change + any of these definitions is by using the Introjucer's project settings. Any commented-out settings will assume their default values. @@ -13,6 +14,13 @@ #ifndef __JUCE_APPCONFIG_TTAKTK1S__ #define __JUCE_APPCONFIG_TTAKTK1S__ +//============================================================================== +// [BEGIN_USER_CODE_SECTION] + +// (You can add your own code in this section, and the Introjucer will not overwrite it) + +// [END_USER_CODE_SECTION] + //============================================================================== #define JUCE_MODULE_AVAILABLE_juce_core 1 #define JUCE_MODULE_AVAILABLE_juce_data_structures 1 diff --git a/extras/static library/JuceLibraryCode/AppConfig.h b/extras/static library/JuceLibraryCode/AppConfig.h index 57695f97e1..2c725e6a40 100644 --- a/extras/static library/JuceLibraryCode/AppConfig.h +++ b/extras/static library/JuceLibraryCode/AppConfig.h @@ -3,8 +3,9 @@ IMPORTANT! This file is auto-generated each time you save your project - if you alter its contents, your changes may be overwritten! - If you want to change any of these values, use the Introjucer to do so, - rather than editing this file directly! + There's a section below where you can add your own custom code safely, and the + Introjucer will preserve the contents of that block, but the best way to change + any of these definitions is by using the Introjucer's project settings. Any commented-out settings will assume their default values. @@ -13,6 +14,13 @@ #ifndef __JUCE_APPCONFIG_IVABE4__ #define __JUCE_APPCONFIG_IVABE4__ +//============================================================================== +// [BEGIN_USER_CODE_SECTION] + +// (You can add your own code in this section, and the Introjucer will not overwrite it) + +// [END_USER_CODE_SECTION] + //============================================================================== #define JUCE_MODULE_AVAILABLE_juce_audio_basics 1 #define JUCE_MODULE_AVAILABLE_juce_audio_devices 1 diff --git a/extras/the jucer/JuceLibraryCode/AppConfig.h b/extras/the jucer/JuceLibraryCode/AppConfig.h index 458aa0809d..00daeb9856 100644 --- a/extras/the jucer/JuceLibraryCode/AppConfig.h +++ b/extras/the jucer/JuceLibraryCode/AppConfig.h @@ -3,8 +3,9 @@ IMPORTANT! This file is auto-generated each time you save your project - if you alter its contents, your changes may be overwritten! - If you want to change any of these values, use the Introjucer to do so, - rather than editing this file directly! + There's a section below where you can add your own custom code safely, and the + Introjucer will preserve the contents of that block, but the best way to change + any of these definitions is by using the Introjucer's project settings. Any commented-out settings will assume their default values. @@ -13,6 +14,13 @@ #ifndef __JUCE_APPCONFIG_UY86NK__ #define __JUCE_APPCONFIG_UY86NK__ +//============================================================================== +// [BEGIN_USER_CODE_SECTION] + +// (You can add your own code in this section, and the Introjucer will not overwrite it) + +// [END_USER_CODE_SECTION] + //============================================================================== #define JUCE_MODULE_AVAILABLE_juce_core 1 #define JUCE_MODULE_AVAILABLE_juce_data_structures 1