@@ -19,5 +19,20 @@ | |||
<string>3.0.0</string> | |||
<key>CFBundleVersion</key> | |||
<string>3.0.0</string> | |||
<key>CFBundleDocumentTypes</key> | |||
<array> | |||
<dict> | |||
<key>CFBundleTypeExtensions</key> | |||
<array> | |||
<string>jucer</string> | |||
</array> | |||
<key>CFBundleTypeName</key> | |||
<string>jucer</string> | |||
<key>CFBundleTypeRole</key> | |||
<string>Editor</string> | |||
<key>NSPersistentStoreTypeKey</key> | |||
<string>XML</string> | |||
</dict> | |||
</array> | |||
</dict> | |||
</plist> |
@@ -12,7 +12,7 @@ | |||
pluginAUViewClass="TheJucerAU_V1" pluginRTASCategory="" bundleIdentifier="com.rawmaterialsoftware.thejucer"> | |||
<EXPORTFORMATS> | |||
<XCODE_MAC targetFolder="Builds/MacOSX" vstFolder="~/SDKs/vstsdk2.4" rtasFolder="~/SDKs/PT_80_SDK" | |||
juceFolder="../.."/> | |||
juceFolder="../.." documentExtensions=".jucer"/> | |||
<VS2005 targetFolder="Builds/VisualStudio2005" vstFolder="c:\SDKs\vstsdk2.4" | |||
rtasFolder="c:\SDKs\PT_80_SDK" juceFolder="../.."/> | |||
<VS2008 targetFolder="Builds/VisualStudio2008" vstFolder="c:\SDKs\vstsdk2.4" | |||
@@ -43,8 +43,50 @@ public: | |||
} | |||
//============================================================================== | |||
void resaveJucerFile (const File file) | |||
{ | |||
if (! file.exists()) | |||
{ | |||
std::cout << "The file doesn't exist!" << std::endl; | |||
return; | |||
} | |||
if (! file.hasFileExtension (Project::projectFileExtension)) | |||
{ | |||
std::cout << "Not a valid jucer project file!" << std::endl; | |||
return; | |||
} | |||
ScopedPointer <Project> newDoc (new Project (file)); | |||
if (! newDoc->loadFrom (file, true)) | |||
{ | |||
std::cout << "Failed to load the project file!" << std::endl; | |||
return; | |||
} | |||
String error (newDoc->saveDocument (file)); | |||
if (error.isNotEmpty()) | |||
{ | |||
std::cout << "Error when writing project: " << error << std::endl; | |||
return; | |||
} | |||
} | |||
void initialise (const String& commandLine) | |||
{ | |||
/* Running a command-line of the form "Jucer --resave foobar.jucer" will try to load that | |||
jucer file and re-export all of its projects. | |||
*/ | |||
if (commandLine.startsWithIgnoreCase (T("-resave ")) || commandLine.startsWithIgnoreCase (T("--resave "))) | |||
{ | |||
resaveJucerFile (File::getCurrentWorkingDirectory() | |||
.getChildFile (commandLine.fromFirstOccurrenceOf (T(" "), false, false).unquoted())); | |||
quit(); | |||
return; | |||
} | |||
commandManager = new ApplicationCommandManager(); | |||
theMainWindow = new MainWindow(); | |||
@@ -92,6 +92,12 @@ public: | |||
props.add (new TextPropertyComponent (getSetting ("objCExtraSuffix"), "Objective-C class name suffix", 64, false)); | |||
props.getLast()->setTooltip ("Because objective-C linkage is done by string-matching, you can get horrible linkage mix-ups when different modules containing the " | |||
"same class-names are loaded simultaneously. This setting lets you provide a unique string that will be used in naming the obj-C classes in your executable to avoid this."); | |||
if (! iPhone) | |||
{ | |||
props.add (new TextPropertyComponent (getSetting ("documentExtensions"), "Document file extensions", 128, false)); | |||
props.getLast()->setTooltip ("A comma-separated list of file extensions for documents that your app can open."); | |||
} | |||
} | |||
void launchProject() | |||
@@ -233,6 +239,30 @@ private: | |||
addPlistDictionaryKey (dict, "CFBundleShortVersionString", project.getVersion().toString()); | |||
addPlistDictionaryKey (dict, "CFBundleVersion", project.getVersion().toString()); | |||
StringArray documentExtensions; | |||
documentExtensions.addTokens (getSetting ("documentExtensions").toString(), ",", String::empty); | |||
documentExtensions.trim(); | |||
documentExtensions.removeEmptyStrings (true); | |||
if (documentExtensions.size() > 0) | |||
{ | |||
dict->createNewChildElement ("key")->addTextElement ("CFBundleDocumentTypes"); | |||
XmlElement* dict2 = dict->createNewChildElement ("array")->createNewChildElement ("dict"); | |||
for (int i = 0; i < documentExtensions.size(); ++i) | |||
{ | |||
String ex (documentExtensions[i]); | |||
if (ex.startsWithChar ('.')) | |||
ex = ex.substring (1); | |||
dict2->createNewChildElement ("key")->addTextElement ("CFBundleTypeExtensions"); | |||
dict2->createNewChildElement ("array")->createNewChildElement ("string")->addTextElement (ex); | |||
addPlistDictionaryKey (dict2, "CFBundleTypeName", ex); | |||
addPlistDictionaryKey (dict2, "CFBundleTypeRole", "Editor"); | |||
addPlistDictionaryKey (dict2, "NSPersistentStoreTypeKey", "XML"); | |||
} | |||
} | |||
MemoryOutputStream mo; | |||
plist.writeToStream (mo, "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">"); | |||
@@ -479,6 +479,7 @@ private: | |||
for (int i = project.getNumExporters(); --i >= 0;) | |||
{ | |||
ScopedPointer <ProjectExporter> exporter (project.createExporter (i)); | |||
std::cout << "Writing files for: " << exporter->getName() << std::endl; | |||
const File targetFolder (exporter->getTargetFolder()); | |||
@@ -37,7 +37,7 @@ StoredSettings::StoredSettings() | |||
StoredSettings::~StoredSettings() | |||
{ | |||
flush(); | |||
deleteAndZero (props); | |||
props = 0; | |||
clearSingletonInstance(); | |||
} | |||
@@ -47,6 +47,7 @@ juce_ImplementSingleton (StoredSettings); | |||
//============================================================================== | |||
PropertiesFile& StoredSettings::getProps() | |||
{ | |||
jassert (props != 0); | |||
return *props; | |||
} | |||
@@ -58,14 +59,16 @@ void StoredSettings::flush() | |||
props->removeValue ("keyMappings"); | |||
ScopedPointer <XmlElement> keys (commandManager->getKeyMappings()->createXml (true)); | |||
if (commandManager != 0) | |||
{ | |||
ScopedPointer <XmlElement> keys (commandManager->getKeyMappings()->createXml (true)); | |||
if (keys != 0) | |||
props->setValue ("keyMappings", (XmlElement*) keys); | |||
if (keys != 0) | |||
props->setValue ("keyMappings", (XmlElement*) keys); | |||
} | |||
} | |||
deleteAndZero (props); | |||
props = 0; | |||
props = PropertiesFile::createDefaultAppPropertiesFile ("Jucer2", | |||
"settings", | |||
String::empty, | |||
@@ -57,7 +57,7 @@ public: | |||
juce_UseDebuggingNewOperator | |||
private: | |||
PropertiesFile* props; | |||
ScopedPointer<PropertiesFile> props; | |||
}; | |||
@@ -12375,18 +12375,23 @@ StringArray::StringArray (const StringArray& other) | |||
{ | |||
} | |||
StringArray::StringArray (const String& firstValue) | |||
{ | |||
strings.add (firstValue); | |||
} | |||
StringArray::StringArray (const juce_wchar** const initialStrings, | |||
const int numberOfStrings) | |||
{ | |||
for (int i = 0; i < numberOfStrings; ++i) | |||
add (initialStrings [i]); | |||
strings.add (initialStrings [i]); | |||
} | |||
StringArray::StringArray (const char** const initialStrings, | |||
const int numberOfStrings) | |||
{ | |||
for (int i = 0; i < numberOfStrings; ++i) | |||
add (initialStrings [i]); | |||
strings.add (initialStrings [i]); | |||
} | |||
StringArray::StringArray (const juce_wchar** const initialStrings) | |||
@@ -12394,7 +12399,7 @@ StringArray::StringArray (const juce_wchar** const initialStrings) | |||
int i = 0; | |||
while (initialStrings[i] != 0) | |||
add (initialStrings [i++]); | |||
strings.add (initialStrings [i++]); | |||
} | |||
StringArray::StringArray (const char** const initialStrings) | |||
@@ -12402,7 +12407,7 @@ StringArray::StringArray (const char** const initialStrings) | |||
int i = 0; | |||
while (initialStrings[i] != 0) | |||
add (initialStrings [i++]); | |||
strings.add (initialStrings [i++]); | |||
} | |||
StringArray& StringArray::operator= (const StringArray& other) | |||
@@ -12415,7 +12420,7 @@ StringArray::~StringArray() | |||
{ | |||
} | |||
bool StringArray::operator== (const StringArray& other) const | |||
bool StringArray::operator== (const StringArray& other) const throw() | |||
{ | |||
if (other.size() != size()) | |||
return false; | |||
@@ -12427,7 +12432,7 @@ bool StringArray::operator== (const StringArray& other) const | |||
return true; | |||
} | |||
bool StringArray::operator!= (const StringArray& other) const | |||
bool StringArray::operator!= (const StringArray& other) const throw() | |||
{ | |||
return ! operator== (other); | |||
} | |||
@@ -12780,10 +12785,14 @@ void StringArray::removeDuplicates (const bool ignoreCase) | |||
void StringArray::appendNumbersToDuplicates (const bool ignoreCase, | |||
const bool appendNumberToFirstInstance, | |||
const juce_wchar* const preNumberString, | |||
const juce_wchar* const postNumberString) | |||
const juce_wchar* preNumberString, | |||
const juce_wchar* postNumberString) | |||
{ | |||
jassert (preNumberString != 0 && postNumberString != 0); // These strings can't be null pointers.. | |||
if (preNumberString == 0) | |||
preNumberString = T(" ("); | |||
if (postNumberString == 0) | |||
postNumberString = T(")"); | |||
for (int i = 0; i < size() - 1; ++i) | |||
{ | |||
@@ -3883,6 +3883,8 @@ public: | |||
StringArray (const StringArray& other); | |||
explicit StringArray (const String& firstValue); | |||
StringArray (const juce_wchar** strings, int numberOfStrings); | |||
StringArray (const char** strings, int numberOfStrings); | |||
@@ -3895,9 +3897,9 @@ public: | |||
StringArray& operator= (const StringArray& other); | |||
bool operator== (const StringArray& other) const; | |||
bool operator== (const StringArray& other) const throw(); | |||
bool operator!= (const StringArray& other) const; | |||
bool operator!= (const StringArray& other) const throw(); | |||
inline int size() const throw() { return strings.size(); }; | |||
@@ -3948,8 +3950,8 @@ public: | |||
void appendNumbersToDuplicates (bool ignoreCaseWhenComparing, | |||
bool appendNumberToFirstInstance, | |||
const juce_wchar* preNumberString = JUCE_T(" ("), | |||
const juce_wchar* postNumberString = JUCE_T(")")); | |||
const juce_wchar* preNumberString = 0, | |||
const juce_wchar* postNumberString = 0); | |||
const String joinIntoString (const String& separatorString, | |||
int startIndex = 0, | |||
@@ -41,18 +41,23 @@ StringArray::StringArray (const StringArray& other) | |||
{ | |||
} | |||
StringArray::StringArray (const String& firstValue) | |||
{ | |||
strings.add (firstValue); | |||
} | |||
StringArray::StringArray (const juce_wchar** const initialStrings, | |||
const int numberOfStrings) | |||
{ | |||
for (int i = 0; i < numberOfStrings; ++i) | |||
add (initialStrings [i]); | |||
strings.add (initialStrings [i]); | |||
} | |||
StringArray::StringArray (const char** const initialStrings, | |||
const int numberOfStrings) | |||
{ | |||
for (int i = 0; i < numberOfStrings; ++i) | |||
add (initialStrings [i]); | |||
strings.add (initialStrings [i]); | |||
} | |||
StringArray::StringArray (const juce_wchar** const initialStrings) | |||
@@ -60,7 +65,7 @@ StringArray::StringArray (const juce_wchar** const initialStrings) | |||
int i = 0; | |||
while (initialStrings[i] != 0) | |||
add (initialStrings [i++]); | |||
strings.add (initialStrings [i++]); | |||
} | |||
StringArray::StringArray (const char** const initialStrings) | |||
@@ -68,7 +73,7 @@ StringArray::StringArray (const char** const initialStrings) | |||
int i = 0; | |||
while (initialStrings[i] != 0) | |||
add (initialStrings [i++]); | |||
strings.add (initialStrings [i++]); | |||
} | |||
StringArray& StringArray::operator= (const StringArray& other) | |||
@@ -81,7 +86,7 @@ StringArray::~StringArray() | |||
{ | |||
} | |||
bool StringArray::operator== (const StringArray& other) const | |||
bool StringArray::operator== (const StringArray& other) const throw() | |||
{ | |||
if (other.size() != size()) | |||
return false; | |||
@@ -93,7 +98,7 @@ bool StringArray::operator== (const StringArray& other) const | |||
return true; | |||
} | |||
bool StringArray::operator!= (const StringArray& other) const | |||
bool StringArray::operator!= (const StringArray& other) const throw() | |||
{ | |||
return ! operator== (other); | |||
} | |||
@@ -46,8 +46,10 @@ public: | |||
/** Creates a copy of another string array */ | |||
StringArray (const StringArray& other); | |||
/** Creates a copy of an array of string literals. | |||
/** Creates an array containing a single string. */ | |||
explicit StringArray (const String& firstValue); | |||
/** Creates a copy of an array of string literals. | |||
@param strings an array of strings to add. Null pointers in the array will be | |||
treated as empty strings | |||
@param numberOfStrings how many items there are in the array | |||
@@ -55,7 +57,6 @@ public: | |||
StringArray (const juce_wchar** strings, int numberOfStrings); | |||
/** Creates a copy of an array of string literals. | |||
@param strings an array of strings to add. Null pointers in the array will be | |||
treated as empty strings | |||
@param numberOfStrings how many items there are in the array | |||
@@ -63,7 +64,6 @@ public: | |||
StringArray (const char** strings, int numberOfStrings); | |||
/** Creates a copy of a null-terminated array of string literals. | |||
Each item from the array passed-in is added, until it encounters a null pointer, | |||
at which point it stops. | |||
*/ | |||
@@ -84,20 +84,16 @@ public: | |||
//============================================================================== | |||
/** Compares two arrays. | |||
Comparisons are case-sensitive. | |||
@returns true only if the other array contains exactly the same strings in the same order | |||
*/ | |||
bool operator== (const StringArray& other) const; | |||
bool operator== (const StringArray& other) const throw(); | |||
/** Compares two arrays. | |||
Comparisons are case-sensitive. | |||
@returns false if the other array contains exactly the same strings in the same order | |||
*/ | |||
bool operator!= (const StringArray& other) const; | |||
bool operator!= (const StringArray& other) const throw(); | |||
//============================================================================== | |||
/** Returns the number of strings in the array */ | |||