Browse Source

Introjucer: added support for a user-code section to the AppConfig.h file.

tags/2021-05-28
jules 13 years ago
parent
commit
eb028b7c33
9 changed files with 126 additions and 24 deletions
  1. +10
    -2
      extras/Introjucer/JuceLibraryCode/AppConfig.h
  2. +46
    -8
      extras/Introjucer/Source/Project Saving/jucer_ProjectSaver.h
  3. +10
    -2
      extras/JuceDemo/JuceLibraryCode/AppConfig.h
  4. +10
    -2
      extras/audio plugin demo/JuceLibraryCode/AppConfig.h
  5. +10
    -2
      extras/audio plugin host/JuceLibraryCode/AppConfig.h
  6. +10
    -2
      extras/binarybuilder/JuceLibraryCode/AppConfig.h
  7. +10
    -2
      extras/example projects/JuceLibraryCode/AppConfig.h
  8. +10
    -2
      extras/static library/JuceLibraryCode/AppConfig.h
  9. +10
    -2
      extras/the jucer/JuceLibraryCode/AppConfig.h

+ 10
- 2
extras/Introjucer/JuceLibraryCode/AppConfig.h View File

@@ -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


+ 46
- 8
extras/Introjucer/Source/Project Saving/jucer_ProjectSaver.h View File

@@ -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<LibraryModule>& 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<LibraryModule>& 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<LibraryModule>& modules)
void writeAppConfigFile (const OwnedArray<LibraryModule>& modules, const String& userContent)
{
appConfigFile = generatedCodeFolder.getChildFile (project.getAppConfigFilename());
appConfigFile = getAppConfigFile();
MemoryOutputStream mem;
writeAppConfig (mem, modules);
writeAppConfig (mem, modules, userContent);
saveGeneratedFile (project.getAppConfigFilename(), mem);
}


+ 10
- 2
extras/JuceDemo/JuceLibraryCode/AppConfig.h View File

@@ -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


+ 10
- 2
extras/audio plugin demo/JuceLibraryCode/AppConfig.h View File

@@ -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


+ 10
- 2
extras/audio plugin host/JuceLibraryCode/AppConfig.h View File

@@ -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


+ 10
- 2
extras/binarybuilder/JuceLibraryCode/AppConfig.h View File

@@ -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


+ 10
- 2
extras/example projects/JuceLibraryCode/AppConfig.h View File

@@ -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


+ 10
- 2
extras/static library/JuceLibraryCode/AppConfig.h View File

@@ -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


+ 10
- 2
extras/the jucer/JuceLibraryCode/AppConfig.h View File

@@ -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


Loading…
Cancel
Save