1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-21 01:24:21 +00:00

Jucer VC6 support + misc VC6 compatibility hacks.

This commit is contained in:
Julian Storer 2010-03-17 14:46:03 +00:00
parent d9d1c4c995
commit d7108bb5ba
25 changed files with 966 additions and 523 deletions

View file

@ -8,12 +8,12 @@
#include "BinaryData.h"
const char* BinaryData::getNamedResource (const wchar_t* resourceName, int& numBytes) throw()
const char* BinaryData::getNamedResource (const char* resourceNameUTF8, int& numBytes) throw()
{
int hash = 0;
if (resourceName != 0)
while (*resourceName != 0)
hash = 31 * hash + *resourceName++;
if (resourceNameUTF8 != 0)
while (*resourceNameUTF8 != 0)
hash = 31 * hash + *resourceNameUTF8++;
switch (hash)
{

View file

@ -45,5 +45,5 @@ namespace BinaryData
// If you provide the name of one of the binary resource variables above, this function will
// return the corresponding data and its size (or a null pointer if the name isn't found).
const char* getNamedResource (const wchar_t* resourceName, int& dataSizeInBytes) throw();
const char* getNamedResource (const char* resourceNameUTF8, int& dataSizeInBytes) throw();
}

View file

@ -845,7 +845,7 @@ void Project::BuildConfiguration::createPropertyEditors (Array <PropertyComponen
const StringArray Project::BuildConfiguration::parsePreprocessorDefs() const
{
StringArray defines;
defines.addTokens (getPreprocessorDefs().toString(), T(" ,;"));
defines.addTokens (getPreprocessorDefs().toString(), T(" ,;"), String::empty);
defines.removeEmptyStrings (true);
return defines;
}
@ -853,7 +853,7 @@ const StringArray Project::BuildConfiguration::parsePreprocessorDefs() const
const StringArray Project::BuildConfiguration::getHeaderSearchPaths() const
{
StringArray s;
s.addTokens (getHeaderSearchPath().toString(), T(";"));
s.addTokens (getHeaderSearchPath().toString(), T(";"), String::empty);
return s;
}
@ -919,7 +919,7 @@ void Project::createDefaultExporters()
const String Project::getFileTemplate (const String& templateName)
{
int dataSize;
const char* data = BinaryData::getNamedResource (templateName, dataSize);
const char* data = BinaryData::getNamedResource (templateName.toUTF8(), dataSize);
if (data == 0)
{

View file

@ -36,10 +36,12 @@ public:
//==============================================================================
enum VisualStudioVersion
{
visualStudio6,
visualStudio2005,
visualStudio2008
};
static const char* getNameVC6() { return "Visual C++ 6.0"; }
static const char* getName2005() { return "Visual Studio 2005"; }
static const char* getName2008() { return "Visual Studio 2008"; }
@ -47,6 +49,7 @@ public:
{
switch (version)
{
case visualStudio6: return "MSVC6"; break;
case visualStudio2005: return "VS2005"; break;
case visualStudio2008: return "VS2008"; break;
default: jassertfalse; break;
@ -58,7 +61,9 @@ public:
//==============================================================================
static MSVCProjectExporter* createForSettings (Project& project, const ValueTree& settings)
{
if (settings.hasType (getValueTreeTypeName (visualStudio2005)))
if (settings.hasType (getValueTreeTypeName (visualStudio6)))
return new MSVCProjectExporter (project, settings, visualStudio6);
else if (settings.hasType (getValueTreeTypeName (visualStudio2005)))
return new MSVCProjectExporter (project, settings, visualStudio2005);
else if (settings.hasType (getValueTreeTypeName (visualStudio2008)))
return new MSVCProjectExporter (project, settings, visualStudio2008);
@ -74,6 +79,7 @@ public:
switch (version)
{
case visualStudio6: name = "Visual C++ 6.0"; subFolderName += "MSVC6"; break;
case visualStudio2005: name = "Visual Studio 2005"; subFolderName += "VisualStudio2005"; break;
case visualStudio2008: name = "Visual Studio 2008"; subFolderName += "VisualStudio2008"; break;
default: jassertfalse; break;
@ -118,25 +124,46 @@ public:
//==============================================================================
const String create()
{
projectGUID = createGUID (project.getProjectUID());
XmlElement masterXml ("VisualStudioProject");
fillInMasterXml (masterXml);
if (version == visualStudio6)
{
MemoryOutputStream mo;
masterXml.writeToStream (mo, String::empty, false, true, "UTF-8", 10);
{
MemoryOutputStream mo;
writeVC6Project (mo);
if (! overwriteFileWithNewDataIfDifferent (getVCProjFile(), mo))
return "Can't write to the VC project file: " + getVCProjFile().getFullPathName();
if (! overwriteFileWithNewDataIfDifferent (getDSPFile(), mo))
return "Can't write to the VC project file: " + getDSPFile().getFullPathName();
}
{
MemoryOutputStream mo;
writeDSWFile (mo);
if (! overwriteFileWithNewDataIfDifferent (getDSWFile(), mo))
return "Can't write to the VC solution file: " + getDSWFile().getFullPathName();
}
}
else
{
MemoryOutputStream mo;
writeSolutionFile (mo);
projectGUID = createGUID (project.getProjectUID());
if (! overwriteFileWithNewDataIfDifferent (getSLNFile(), mo))
return "Can't write to the VC solution file: " + getSLNFile().getFullPathName();
XmlElement masterXml ("VisualStudioProject");
fillInMasterXml (masterXml);
{
MemoryOutputStream mo;
masterXml.writeToStream (mo, String::empty, false, true, "UTF-8", 10);
if (! overwriteFileWithNewDataIfDifferent (getVCProjFile(), mo))
return "Can't write to the VC project file: " + getVCProjFile().getFullPathName();
}
{
MemoryOutputStream mo;
writeSolutionFile (mo);
if (! overwriteFileWithNewDataIfDifferent (getSLNFile(), mo))
return "Can't write to the VC solution file: " + getSLNFile().getFullPathName();
}
}
return String::empty;
@ -146,9 +173,12 @@ private:
String projectGUID;
const VisualStudioVersion version;
const File getVCProjFile() const { return getTargetFolder().getChildFile (project.getProjectFilenameRoot()).withFileExtension (".vcproj"); }
const File getSLNFile() const { return getVCProjFile().withFileExtension (".sln"); }
const File getProjectFile (const String& extension) const { return getTargetFolder().getChildFile (project.getProjectFilenameRoot()).withFileExtension (extension); }
const File getVCProjFile() const { return getProjectFile (".vcproj"); }
const File getSLNFile() const { return getProjectFile (".sln"); }
const File getDSPFile() const { return getProjectFile (".dsp"); }
const File getDSWFile() const { return getProjectFile (".dsw"); }
//==============================================================================
void fillInMasterXml (XmlElement& masterXml)
@ -306,7 +336,7 @@ private:
return ".exe";
}
const String getPreprocessorDefs (const Project::BuildConfiguration& config) const
const String getPreprocessorDefs (const Project::BuildConfiguration& config, const String& joinString) const
{
StringArray defines;
defines.add ("WIN32");
@ -327,7 +357,7 @@ private:
}
defines.addArray (config.parsePreprocessorDefs());
return defines.joinIntoString (";");
return defines.joinIntoString (joinString);
}
const StringArray getHeaderSearchPaths (const Project::BuildConfiguration& config) const
@ -449,7 +479,7 @@ private:
}
compiler->setAttribute ("AdditionalIncludeDirectories", getHeaderSearchPaths (config).joinIntoString (";"));
compiler->setAttribute ("PreprocessorDefinitions", getPreprocessorDefs (config));
compiler->setAttribute ("PreprocessorDefinitions", getPreprocessorDefs (config, ";"));
compiler->setAttribute ("RuntimeLibrary", isRTAS() ? (isDebug ? 3 : 2) // MT DLL
: (isDebug ? 1 : 0)); // MT static
compiler->setAttribute ("RuntimeTypeInfo", "true");
@ -559,12 +589,13 @@ private:
}
out << newLine << "Project(\"" << createGUID (project.getProjectName().toString() + "sln_guid") << "\") = \"" << project.getProjectName().toString() << "\", \""
<< getVCProjFile().getFileName() << "\", \"" << projectGUID << "\"" << newLine
<< getVCProjFile().getFileName() << "\", \"" << projectGUID << '"' << newLine
<< "EndProject" << newLine
<< "Global" << newLine
<< "\tGlobalSection(SolutionConfigurationPlatforms) = preSolution" << newLine;
for (int i = 0; i < project.getNumConfigurations(); ++i)
int i;
for (i = 0; i < project.getNumConfigurations(); ++i)
{
Project::BuildConfiguration config (project.getConfiguration (i));
out << "\t\t" << createConfigName (config) << " = " << createConfigName (config) << newLine;
@ -573,7 +604,7 @@ private:
out << "\tEndGlobalSection" << newLine
<< "\tGlobalSection(ProjectConfigurationPlatforms) = postSolution" << newLine;
for (int i = 0; i < project.getNumConfigurations(); ++i)
for (i = 0; i < project.getNumConfigurations(); ++i)
{
Project::BuildConfiguration config (project.getConfiguration (i));
out << "\t\t" << projectGUID << "." << createConfigName (config) << ".ActiveCfg = " << createConfigName (config) << newLine;
@ -586,6 +617,216 @@ private:
<< "\tEndGlobalSection" << newLine
<< "EndGlobal" << newLine;
}
//==============================================================================
const String createConfigNameVC6 (const Project::BuildConfiguration& config) const
{
return project.getProjectName().toString() + " - Win32 " + config.getName().toString();
}
void writeVC6Project (OutputStream& out)
{
String defaultConfig (createConfigNameVC6 (project.getConfiguration (0)));
const bool isDLL = project.isAudioPlugin() || project.isBrowserPlugin();
String targetType, targetCode;
if (isDLL) { targetType = "\"Win32 (x86) Dynamic-Link Library\""; targetCode = "0x0102"; }
else if (project.isLibrary()) { targetType = "\"Win32 (x86) Static Library\""; targetCode = "0x0104"; }
else if (project.isCommandLineApp()) { targetType = "\"Win32 (x86) Console Application\""; targetCode = "0x0103"; }
else { targetType = "\"Win32 (x86) Application\""; targetCode = "0x0101"; }
out << "# Microsoft Developer Studio Project File - Name=\"" << project.getProjectName()
<< "\" - Package Owner=<4>" << newLine
<< "# Microsoft Developer Studio Generated Build File, Format Version 6.00" << newLine
<< "# ** DO NOT EDIT **" << newLine
<< "# TARGTYPE " << targetType << " " << targetCode << newLine
<< "CFG=" << defaultConfig << newLine
<< "!MESSAGE This is not a valid makefile. To build this project using NMAKE," << newLine
<< "!MESSAGE use the Export Makefile command and run" << newLine
<< "!MESSAGE " << newLine
<< "!MESSAGE NMAKE /f \"" << project.getProjectName() << ".mak.\"" << newLine
<< "!MESSAGE " << newLine
<< "!MESSAGE You can specify a configuration when running NMAKE" << newLine
<< "!MESSAGE by defining the macro CFG on the command line. For example:" << newLine
<< "!MESSAGE " << newLine
<< "!MESSAGE NMAKE /f \"" << project.getProjectName() << ".mak\" CFG=\"" << defaultConfig << '"' << newLine
<< "!MESSAGE " << newLine
<< "!MESSAGE Possible choices for configuration are:" << newLine
<< "!MESSAGE " << newLine;
int i;
for (i = 0; i < project.getNumConfigurations(); ++i)
out << "!MESSAGE \"" << createConfigNameVC6 (project.getConfiguration (i)) << "\" (based on " << targetType << ")" << newLine;
out << "!MESSAGE " << newLine
<< "# Begin Project" << newLine
<< "# PROP AllowPerConfigDependencies 0" << newLine
<< "# PROP Scc_ProjName \"\"" << newLine
<< "# PROP Scc_LocalPath \"\"" << newLine
<< "CPP=cl.exe" << newLine
<< "MTL=midl.exe" << newLine
<< "RSC=rc.exe" << newLine;
String targetList;
for (i = 0; i < project.getNumConfigurations(); ++i)
{
const Project::BuildConfiguration config (project.getConfiguration (i));
const String configName (createConfigNameVC6 (config));
targetList << "# Name \"" << configName << '"' << newLine;
const String outFile (windowsStylePath (getConfigTargetPath(config) + "/" + config.getTargetBinaryName().toString() + getTargetBinarySuffix()));
const String optimisationFlag (((int) config.getOptimisationLevel().getValue() <= 1) ? "Od" : (config.getOptimisationLevel() == 2 ? "O2" : "O3"));
const String defines (getPreprocessorDefs (config, " /D "));
const bool isDebug = (bool) config.isDebug().getValue();
const String extraDebugFlags (isDebug ? "/Gm /ZI /GZ" : "");
const String includes (getHeaderSearchPaths (config).joinIntoString (" /I "));
out << (i == 0 ? "!IF" : "!ELSEIF") << " \"$(CFG)\" == \"" << configName << '"' << newLine
<< "# PROP BASE Use_MFC 0" << newLine
<< "# PROP BASE Use_Debug_Libraries " << (isDebug ? "1" : "0") << newLine
<< "# PROP BASE Output_Dir \"" << getConfigTargetPath (config) << '"' << newLine
<< "# PROP BASE Intermediate_Dir \"" << getIntermediatesPath (config) << '"' << newLine
<< "# PROP BASE Target_Dir \"\"" << newLine
<< "# PROP Use_MFC 0" << newLine
<< "# PROP Use_Debug_Libraries " << (isDebug ? "1" : "0") << newLine
<< "# PROP Output_Dir \"" << getConfigTargetPath (config) << '"' << newLine
<< "# PROP Intermediate_Dir \"" << getIntermediatesPath (config) << '"' << newLine
<< "# PROP Ignore_Export_Lib 0" << newLine
<< "# PROP Target_Dir \"\"" << newLine
<< "# ADD BASE CPP /nologo /W3 /GX /" << optimisationFlag << " /D " << defines
<< " /YX /FD /c " << extraDebugFlags << " /Zm1024" << newLine
<< "# ADD CPP /nologo " << (isDebug ? "/MTd" : "/MT") << " /W3 /GR /GX /" << optimisationFlag
<< " /I " << includes << " /D " << defines << " /D \"_UNICODE\" /D \"UNICODE\" /FD /c " << extraDebugFlags << " /Zm1024" << newLine;
if (! isDebug)
out << "# SUBTRACT CPP /YX" << newLine;
if (! project.isLibrary())
out << "# ADD BASE MTL /nologo /D " << defines << " /mktyplib203 /win32" << newLine
<< "# ADD MTL /nologo /D " << defines << " /mktyplib203 /win32" << newLine;
out << "# ADD BASE RSC /l 0x40c /d " << defines << newLine
<< "# ADD RSC /l 0x40c /d " << defines << newLine
<< "BSC32=bscmake.exe" << newLine
<< "# ADD BASE BSC32 /nologo" << newLine
<< "# ADD BSC32 /nologo" << newLine;
if (project.isLibrary())
{
out << "LIB32=link.exe -lib" << newLine
<< "# ADD BASE LIB32 /nologo" << newLine
<< "# ADD LIB32 /nologo /out:\"" << outFile << '"' << newLine;
}
else
{
out << "LINK32=link.exe" << newLine
<< "# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386" << newLine
<< "# ADD LINK32 \"C:\\Program Files\\Microsoft Visual Studio\\VC98\\LIB\\shell32.lib\" " // This is avoid debug information corruption when mixing Platform SDK
<< "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib "
<< (isDebug ? " /debug" : "")
<< " /nologo /machine:I386 /out:\"" << outFile << "\" "
<< (isDLL ? "/dll" : (project.isCommandLineApp() ? "/subsystem:console"
: "/subsystem:windows")) << newLine;
}
}
out << "!ENDIF" << newLine
<< "# Begin Target" << newLine
<< targetList;
writeFilesVC6 (out, project.getMainGroup());
writeGroupVC6 (out, project.getJuceCodeGroupName(), juceWrapperFiles);
writeGroupVC6 (out, "Juce VST Wrapper", getVSTFilesRequired());
out << "# End Target" << newLine
<< "# End Project" << newLine;
}
void writeFileVC6 (OutputStream& out, const RelativePath& file, const bool excludeFromBuild)
{
jassert (file.getRoot() == RelativePath::buildTargetFolder);
out << "# Begin Source File" << newLine
<< "SOURCE=" << file.toWindowsStyle().quoted() << newLine;
if (excludeFromBuild)
out << "# PROP Exclude_From_Build 1" << newLine;
out << "# End Source File" << newLine;
}
void writeFilesVC6 (OutputStream& out, const Project::Item& projectItem)
{
if (projectItem.isGroup())
{
out << "# Begin Group \"" << projectItem.getName() << '"' << newLine
<< "# PROP Default_Filter \"cpp;c;cxx;rc;def;r;odl;idl;hpj;bat\"" << newLine;
for (int i = 0; i < projectItem.getNumChildren(); ++i)
writeFilesVC6 (out, projectItem.getChild (i));
out << "# End Group" << newLine;
}
else if (projectItem.shouldBeAddedToTargetProject())
{
const RelativePath path (projectItem.getFile(), getTargetFolder(), RelativePath::buildTargetFolder);
writeFileVC6 (out, path, projectItem.shouldBeAddedToBinaryResources() || (shouldFileBeCompiledByDefault (path) && ! projectItem.shouldBeCompiled()));
}
}
void writeGroupVC6 (OutputStream& out, const String& groupName, const Array<RelativePath>& files)
{
if (files.size() > 0)
{
out << "# Begin Group \"" << groupName << '"' << newLine;
for (int i = 0; i < files.size(); ++i)
if (files.getReference(i).hasFileExtension ("cpp;c;h"))
writeFileVC6 (out, files.getReference(i), false);
out << "# End Group" << newLine;
}
}
void writeDSWFile (OutputStream& out)
{
out << "Microsoft Developer Studio Workspace File, Format Version 6.00 " << newLine;
if (! project.isUsingWrapperFiles())
{
out << "Project: \"JUCE\"= ..\\JUCE.dsp - Package Owner=<4>" << newLine
<< "Package=<5>" << newLine
<< "{{{" << newLine
<< "}}}" << newLine
<< "Package=<4>" << newLine
<< "{{{" << newLine
<< "}}}" << newLine;
}
out << "Project: \"" << project.getProjectName() << "\" = .\\" << getDSPFile().getFileName() << " - Package Owner=<4>" << newLine
<< "Package=<5>" << newLine
<< "{{{" << newLine
<< "}}}" << newLine
<< "Package=<4>" << newLine
<< "{{{" << newLine;
if (! project.isUsingWrapperFiles())
{
out << " Begin Project Dependency" << newLine
<< " Project_Dep_Name JUCE" << newLine
<< " End Project Dependency" << newLine;
}
out << "}}}" << newLine
<< "Global:" << newLine
<< "Package=<5>" << newLine
<< "{{{" << newLine
<< "}}}" << newLine
<< "Package=<3>" << newLine
<< "{{{" << newLine
<< "}}}" << newLine;
}
};

View file

@ -263,7 +263,8 @@ private:
<< "DEPFLAGS := $(if $(word 2, $(TARGET_ARCH)), , -MMD)" << newLine
<< newLine;
for (int i = 0; i < project.getNumConfigurations(); ++i)
int i;
for (i = 0; i < project.getNumConfigurations(); ++i)
writeConfig (out, project.getConfiguration(i));
writeObjects (out, files);
@ -272,7 +273,7 @@ private:
<< newLine;
out << "$(OUTDIR)/$(TARGET): $(OBJECTS) $(LDDEPS) $(RESOURCES)" << newLine
<< "\t@echo Linking " << project.getProjectName().toString() << newLine
<< "\t@echo Linking " << project.getProjectName() << newLine
<< "\t-@mkdir -p $(BINDIR)" << newLine
<< "\t-@mkdir -p $(LIBDIR)" << newLine
<< "\t-@mkdir -p $(OUTDIR)" << newLine
@ -280,13 +281,13 @@ private:
<< newLine;
out << "clean:" << newLine
<< "\t@echo Cleaning " << project.getProjectName().toString() << newLine
<< "\t@echo Cleaning " << project.getProjectName() << newLine
<< "\t-@rm -f $(OUTDIR)/$(TARGET)" << newLine
<< "\t-@rm -rf $(OBJDIR)/*" << newLine
<< "\t-@rm -rf $(OBJDIR)" << newLine
<< newLine;
for (int i = 0; i < files.size(); ++i)
for (i = 0; i < files.size(); ++i)
{
if (shouldFileBeCompiledByDefault (files.getReference(i)))
{

View file

@ -919,8 +919,8 @@ private:
const char* files[] = { "extras/audio plugins/wrapper/AU/juce_AU_Resources.r",
"extras/audio plugins/wrapper/AU/juce_AU_Wrapper.mm" };
for (int i = 0; i < numElementsInArray (files); ++i)
int i;
for (i = 0; i < numElementsInArray (files); ++i)
auWrappers.add (getJucePathFromTargetFolder().getChildFile (files[i]));
const char* appleAUFiles[] = { "Extras/CoreAudio/PublicUtility/CADebugMacros.h",
@ -976,7 +976,6 @@ private:
StringArray fileIDs, appleFileIDs;
int i;
for (i = 0; i < auWrappers.size(); ++i)
{
addFile (auWrappers.getReference(i), shouldFileBeCompiledByDefault (auWrappers.getReference(i)), false);

View file

@ -42,7 +42,7 @@ ProjectExporter::~ProjectExporter()
//==============================================================================
int ProjectExporter::getNumExporters()
{
return 5;
return 6;
}
const StringArray ProjectExporter::getExporterNames()
@ -50,6 +50,7 @@ const StringArray ProjectExporter::getExporterNames()
StringArray s;
s.add (XCodeProjectExporter::getNameMac());
s.add (XCodeProjectExporter::getNameiPhone());
s.add (MSVCProjectExporter::getNameVC6());
s.add (MSVCProjectExporter::getName2005());
s.add (MSVCProjectExporter::getName2008());
s.add (MakefileProjectExporter::getNameLinux());
@ -64,9 +65,10 @@ ProjectExporter* ProjectExporter::createNewExporter (Project& project, const int
{
case 0: exp = new XCodeProjectExporter (project, ValueTree (XCodeProjectExporter::getValueTreeTypeName (false)), false); break;
case 1: exp = new XCodeProjectExporter (project, ValueTree (XCodeProjectExporter::getValueTreeTypeName (true)), true); break;
case 2: exp = new MSVCProjectExporter (project, ValueTree (MSVCProjectExporter::getValueTreeTypeName (MSVCProjectExporter::visualStudio2005)), MSVCProjectExporter::visualStudio2005); break;
case 3: exp = new MSVCProjectExporter (project, ValueTree (MSVCProjectExporter::getValueTreeTypeName (MSVCProjectExporter::visualStudio2008)), MSVCProjectExporter::visualStudio2008); break;
case 4: exp = new MakefileProjectExporter (project, ValueTree (MakefileProjectExporter::getValueTreeTypeName())); break;
case 2: exp = new MSVCProjectExporter (project, ValueTree (MSVCProjectExporter::getValueTreeTypeName (MSVCProjectExporter::visualStudio6)), MSVCProjectExporter::visualStudio6); break;
case 3: exp = new MSVCProjectExporter (project, ValueTree (MSVCProjectExporter::getValueTreeTypeName (MSVCProjectExporter::visualStudio2005)), MSVCProjectExporter::visualStudio2005); break;
case 4: exp = new MSVCProjectExporter (project, ValueTree (MSVCProjectExporter::getValueTreeTypeName (MSVCProjectExporter::visualStudio2008)), MSVCProjectExporter::visualStudio2008); break;
case 5: exp = new MakefileProjectExporter (project, ValueTree (MakefileProjectExporter::getValueTreeTypeName())); break;
default: jassertfalse; return 0;
}

View file

@ -71,9 +71,9 @@ public:
Value getRTASFolder() const { return getSetting ("rtasFolder"); }
Value getAUFolder() const { return getSetting ("auFolder"); }
bool isVST() const { return project.isAudioPlugin() && project.shouldBuildVST().getValue(); }
bool isRTAS() const { return project.isAudioPlugin() && project.shouldBuildRTAS().getValue(); }
bool isAU() const { return project.isAudioPlugin() && project.shouldBuildAU().getValue(); }
bool isVST() const { return (bool) project.isAudioPlugin() && (bool) project.shouldBuildVST().getValue(); }
bool isRTAS() const { return (bool) project.isAudioPlugin() && (bool) project.shouldBuildRTAS().getValue(); }
bool isAU() const { return (bool) project.isAudioPlugin() && (bool) project.shouldBuildAU().getValue(); }
Array<RelativePath> juceWrapperFiles;

View file

@ -270,7 +270,8 @@ private:
}
else
{
for (int i = paths.size(); --i >= 0;)
int i = paths.size();
for (; --i >= 0;)
{
for (int j = i; --j >= 0;)
{
@ -282,7 +283,7 @@ private:
}
}
for (int i = 0; i < paths.size(); ++i)
for (i = 0; i < paths.size(); ++i)
{
out << (i == 0 ? "#if " : "#elif ") << guards[i] << newLine
<< " #include " << paths[i].quoted() << newLine;
@ -310,7 +311,7 @@ private:
static const String createVersionCode (const String& version)
{
StringArray configs;
configs.addTokens (version, T(",."));
configs.addTokens (version, T(",."), String::empty);
configs.trim();
configs.removeEmptyStrings();

View file

@ -177,6 +177,16 @@ static void writeCppData (InputStream& in, OutputStream& out)
}
}
static int calcResourceHashCode (const String& s)
{
const char* t = s.toUTF8();
int hash = 0;
while (*t != 0)
hash = 31 * hash + *t++;
return hash;
}
bool ResourceFile::write (const File& cppFile, OutputStream& cpp, OutputStream& header)
{
String comment;
@ -216,19 +226,19 @@ bool ResourceFile::write (const File& cppFile, OutputStream& cpp, OutputStream&
cpp << createIncludeStatement (cppFile.withFileExtension (".h"), cppFile) << newLine
<< newLine
<< newLine
<< "const char* " << namespaceName << "::getNamedResource (const wchar_t* resourceName, int& numBytes) throw()" << newLine
<< "const char* " << namespaceName << "::getNamedResource (const char* resourceNameUTF8, int& numBytes) throw()" << newLine
<< "{" << newLine
<< " int hash = 0;" << newLine
<< " if (resourceName != 0)" << newLine
<< " while (*resourceName != 0)" << newLine
<< " hash = 31 * hash + *resourceName++;" << newLine
<< " if (resourceNameUTF8 != 0)" << newLine
<< " while (*resourceNameUTF8 != 0)" << newLine
<< " hash = 31 * hash + *resourceNameUTF8++;" << newLine
<< newLine
<< " switch (hash)" << newLine
<< " {" << newLine;
for (i = 0; i < files.size(); ++i)
{
cpp << " case 0x" << hexString8Digits (variableNames[i].hashCode())
cpp << " case 0x" << hexString8Digits (calcResourceHashCode (variableNames[i]))
<< ": numBytes = " << namespaceName << "::" << variableNames[i] << "Size; return "
<< namespaceName << "::" << variableNames[i] << ";" << newLine;
}
@ -273,7 +283,7 @@ bool ResourceFile::write (const File& cppFile, OutputStream& cpp, OutputStream&
header << " // If you provide the name of one of the binary resource variables above, this function will" << newLine
<< " // return the corresponding data and its size (or a null pointer if the name isn't found)." << newLine
<< " const char* getNamedResource (const wchar_t* resourceName, int& dataSizeInBytes) throw();" << newLine
<< " const char* getNamedResource (const char* resourceNameUTF8, int& dataSizeInBytes) throw();" << newLine
<< "}" << newLine;
return true;

View file

@ -86,6 +86,7 @@ public:
juce_UseDebuggingNewOperator
private:
friend class Canvas;
Project* project;
DrawableDocument* drawableDocument;

View file

@ -246,7 +246,8 @@ public:
deleteAllChildren();
Rectangle<int> childBounds;
for (int i = 0; i < dc->getNumDrawables(); ++i)
int i;
for (i = 0; i < dc->getNumDrawables(); ++i)
{
Drawable* d = dc->getDrawable (i);
jassert (d != 0);
@ -271,12 +272,12 @@ public:
}
}
for (int i = dc->getNumDrawables(); --i >= 0;)
for (i = dc->getNumDrawables(); --i >= 0;)
dc->removeDrawable (i, false);
setBounds (childBounds);
for (int i = getNumChildComponents(); --i >= 0;)
for (i = getNumChildComponents(); --i >= 0;)
{
DrawableObjectComponent* dc = dynamic_cast <DrawableObjectComponent*> (getChildComponent (i));

View file

@ -147,7 +147,7 @@ private:
String lastTip;
int tabIndex;
const String findTip (Component* c) const
const String findTip (Component* c)
{
while (c != 0 && c != this)
{

View file

@ -288,7 +288,7 @@ void ProjectTreeViewBase::moveItems (OwnedArray <Project::Item>& selectedNodes,
}
// Remove and re-insert them one at a time..
for (int i = 0; i < selectedNodes.size(); ++i)
for (i = 0; i < selectedNodes.size(); ++i)
{
Project::Item* selectedNode = selectedNodes.getUnchecked(i);

View file

@ -132,8 +132,7 @@ const String randomHexString (Random& random, int numChars)
const String hexString8Digits (int value)
{
String s (String::toHexString (value));
return String::repeatedString (T("0"), 8 - s.length()) + s;
return String::toHexString (value).paddedLeft ('0', 8);
}

File diff suppressed because it is too large Load diff

View file

@ -197,7 +197,7 @@
#endif
#ifndef JUCE_ASIO
#define JUCE_ASIO 1
#define JUCE_ASIO 0
#endif
#ifndef JUCE_WASAPI
@ -217,7 +217,7 @@
#endif
#if ! (defined (JUCE_QUICKTIME) || JUCE_LINUX || JUCE_IPHONE || (JUCE_WINDOWS && ! JUCE_MSVC))
#define JUCE_QUICKTIME 1
#define JUCE_QUICKTIME 0
#endif
#ifndef JUCE_OPENGL
@ -233,7 +233,7 @@
#endif
#if (! defined (JUCE_USE_CDBURNER)) && ! (JUCE_WINDOWS && ! JUCE_MSVC)
#define JUCE_USE_CDBURNER 1
#define JUCE_USE_CDBURNER 0
#endif
#ifndef JUCE_USE_CDREADER
@ -273,7 +273,7 @@
#endif
#ifndef JUCE_WEB_BROWSER
#define JUCE_WEB_BROWSER 1
#define JUCE_WEB_BROWSER 0
#endif
#ifndef JUCE_SUPPORT_CARBON
@ -6314,6 +6314,8 @@ private:
Value& operator= (const Value& other);
};
OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const Value& value);
#endif // __JUCE_VALUE_JUCEHEADER__
/*** End of inlined file: juce_Value.h ***/
@ -6709,7 +6711,8 @@ private:
ReferenceCountedObjectPtr <SharedObject> object;
ListenerList <Listener> listeners;
ValueTree (SharedObject* const object_);
public:
ValueTree (SharedObject* const object_); // (can be made private when VC6 support is finally dropped)
};
#endif // __JUCE_VALUETREE_JUCEHEADER__
@ -9884,6 +9887,11 @@ public:
return Rectangle (x + deltaX, y + deltaY, w, h);
}
const Rectangle operator+ (const Point<ValueType>& deltaPosition) const throw()
{
return Rectangle (x + deltaPosition.getX(), y + deltaPosition.getY(), w, h);
}
void expand (const ValueType deltaX,
const ValueType deltaY) throw()
{
@ -9929,7 +9937,7 @@ public:
return xCoord >= x && yCoord >= y && xCoord < x + w && yCoord < y + h;
}
bool contains (const Point<ValueType> point) const throw()
bool contains (const Point<ValueType>& point) const throw()
{
return point.getX() >= x && point.getY() >= y && point.getX() < x + w && point.getY() < y + h;
}
@ -10341,13 +10349,13 @@ class JUCE_API Path
{
public:
Path() throw();
Path();
Path (const Path& other) throw();
Path (const Path& other);
~Path() throw();
~Path();
Path& operator= (const Path& other) throw();
Path& operator= (const Path& other);
bool isEmpty() const throw();
@ -10355,99 +10363,91 @@ public:
const Rectangle<float> getBoundsTransformed (const AffineTransform& transform) const throw();
bool contains (const float x,
const float y,
const float tolerence = 10.0f) const throw();
bool contains (float x, float y,
float tolerence = 10.0f) const;
bool intersectsLine (const float x1, const float y1,
const float x2, const float y2,
const float tolerence = 10.0f) throw();
bool intersectsLine (float x1, float y1,
float x2, float y2,
float tolerence = 10.0f);
void clear() throw();
void startNewSubPath (const float startX,
const float startY) throw();
void startNewSubPath (float startX, float startY);
void closeSubPath() throw();
void closeSubPath();
void lineTo (const float endX,
const float endY) throw();
void lineTo (float endX, float endY);
void quadraticTo (const float controlPointX,
const float controlPointY,
const float endPointX,
const float endPointY) throw();
void quadraticTo (float controlPointX,
float controlPointY,
float endPointX,
float endPointY);
void cubicTo (const float controlPoint1X,
const float controlPoint1Y,
const float controlPoint2X,
const float controlPoint2Y,
const float endPointX,
const float endPointY) throw();
void cubicTo (float controlPoint1X,
float controlPoint1Y,
float controlPoint2X,
float controlPoint2Y,
float endPointX,
float endPointY);
const Point<float> getCurrentPosition() const;
void addRectangle (const float x, const float y,
const float w, const float h) throw();
void addRectangle (float x, float y, float width, float height);
void addRectangle (const Rectangle<int>& rectangle) throw();
void addRectangle (const Rectangle<int>& rectangle);
void addRoundedRectangle (const float x, const float y,
const float w, const float h,
float cornerSize) throw();
void addRoundedRectangle (float x, float y, float width, float height,
float cornerSize);
void addRoundedRectangle (const float x, const float y,
const float w, const float h,
void addRoundedRectangle (float x, float y, float width, float height,
float cornerSizeX,
float cornerSizeY) throw();
float cornerSizeY);
void addTriangle (const float x1, const float y1,
const float x2, const float y2,
const float x3, const float y3) throw();
void addTriangle (float x1, float y1,
float x2, float y2,
float x3, float y3);
void addQuadrilateral (const float x1, const float y1,
const float x2, const float y2,
const float x3, const float y3,
const float x4, const float y4) throw();
void addQuadrilateral (float x1, float y1,
float x2, float y2,
float x3, float y3,
float x4, float y4);
void addEllipse (const float x, const float y,
const float width, const float height) throw();
void addEllipse (float x, float y, float width, float height);
void addArc (const float x, const float y,
const float width, const float height,
const float fromRadians,
const float toRadians,
const bool startAsNewSubPath = false) throw();
void addArc (float x, float y, float width, float height,
float fromRadians,
float toRadians,
bool startAsNewSubPath = false);
void addCentredArc (const float centreX, const float centreY,
const float radiusX, const float radiusY,
const float rotationOfEllipse,
const float fromRadians,
const float toRadians,
const bool startAsNewSubPath = false) throw();
void addCentredArc (float centreX, float centreY,
float radiusX, float radiusY,
float rotationOfEllipse,
float fromRadians,
float toRadians,
bool startAsNewSubPath = false);
void addPieSegment (const float x, const float y,
const float width, const float height,
const float fromRadians,
const float toRadians,
const float innerCircleProportionalSize);
void addPieSegment (float x, float y,
float width, float height,
float fromRadians,
float toRadians,
float innerCircleProportionalSize);
void addLineSegment (const float startX, const float startY,
const float endX, const float endY,
float lineThickness) throw();
void addLineSegment (float startX, float startY,
float endX, float endY,
float lineThickness);
void addArrow (const float startX, const float startY,
const float endX, const float endY,
void addArrow (float startX, float startY,
float endX, float endY,
float lineThickness,
float arrowheadWidth,
float arrowheadLength) throw();
float arrowheadLength);
void addStar (const float centreX,
const float centreY,
const int numberOfPoints,
const float innerRadius,
const float outerRadius,
const float startAngle = 0.0f);
void addStar (float centreX,
float centreY,
int numberOfPoints,
float innerRadius,
float outerRadius,
float startAngle = 0.0f);
void addBubble (float bodyX, float bodyY,
float bodyW, float bodyH,
@ -10458,27 +10458,25 @@ public:
float arrowPositionAlongEdgeProportional,
float arrowWidth);
void addPath (const Path& pathToAppend) throw();
void addPath (const Path& pathToAppend);
void addPath (const Path& pathToAppend,
const AffineTransform& transformToApply) throw();
const AffineTransform& transformToApply);
void swapWithPath (Path& other);
void applyTransform (const AffineTransform& transform) throw();
void scaleToFit (const float x, const float y,
const float width, const float height,
const bool preserveProportions) throw();
void scaleToFit (float x, float y, float width, float height,
bool preserveProportions) throw();
const AffineTransform getTransformToScaleToFit (const float x, const float y,
const float width, const float height,
const bool preserveProportions,
const Justification& justificationType = Justification::centred) const throw();
const AffineTransform getTransformToScaleToFit (float x, float y, float width, float height,
bool preserveProportions,
const Justification& justificationType = Justification::centred) const;
const Path createPathWithRoundedCorners (const float cornerRadius) const throw();
const Path createPathWithRoundedCorners (float cornerRadius) const;
void setUsingNonZeroWinding (const bool isNonZeroWinding) throw();
void setUsingNonZeroWinding (bool isNonZeroWinding) throw();
bool isUsingNonZeroWinding() const { return useNonZeroWinding; }
@ -10506,7 +10504,7 @@ public:
private:
const Path& path;
int index;
size_t index;
Iterator (const Iterator&);
Iterator& operator= (const Iterator&);
@ -10514,8 +10512,7 @@ public:
void loadPathFromStream (InputStream& source);
void loadPathFromData (const unsigned char* const data,
const int numberOfBytes) throw();
void loadPathFromData (const void* data, int numberOfBytes);
void writePathToStream (OutputStream& destination) const;
@ -10529,7 +10526,7 @@ private:
friend class PathFlatteningIterator;
friend class Path::Iterator;
ArrayAllocationBase <float, DummyCriticalSection> data;
int numElements;
size_t numElements;
float pathXMin, pathXMax, pathYMin, pathYMax;
bool useNonZeroWinding;
@ -13359,30 +13356,34 @@ public:
};
PropertiesFile (const File& file,
const int millisecondsBeforeSaving,
const int options);
int millisecondsBeforeSaving,
int optionFlags);
~PropertiesFile();
bool isValidFile() const throw() { return loadedOk; }
bool saveIfNeeded();
bool save();
bool needsToBeSaved() const;
void setNeedsToBeSaved (bool needsToBeSaved);
const File getFile() const { return file; }
static PropertiesFile* createDefaultAppPropertiesFile (const String& applicationName,
const String& fileNameSuffix,
const String& folderName,
const bool commonToAllUsers,
const int millisecondsBeforeSaving,
const int propertiesFileOptions);
bool commonToAllUsers,
int millisecondsBeforeSaving,
int propertiesFileOptions);
static const File getDefaultAppSettingsFile (const String& applicationName,
const String& fileNameSuffix,
const String& folderName,
const bool commonToAllUsers);
bool commonToAllUsers);
juce_UseDebuggingNewOperator
@ -13394,7 +13395,7 @@ private:
File file;
int timerInterval;
const int options;
bool needsWriting;
bool loadedOk, needsWriting;
void timerCallback();
@ -26668,7 +26669,11 @@ public:
OpenGLPixelFormat (const int bitsPerRGBComponent = 8,
const int alphaBits = 8,
const int depthBufferBits = 16,
const int stencilBufferBits = 0) throw();
const int stencilBufferBits = 0);
OpenGLPixelFormat (const OpenGLPixelFormat&);
OpenGLPixelFormat& operator= (const OpenGLPixelFormat&);
bool operator== (const OpenGLPixelFormat&) const;
int redBits; /**< The number of bits per pixel to use for the red channel. */
int greenBits; /**< The number of bits per pixel to use for the green channel. */
@ -26688,8 +26693,6 @@ public:
static void getAvailablePixelFormats (Component* component,
OwnedArray <OpenGLPixelFormat>& results);
bool operator== (const OpenGLPixelFormat&) const throw();
juce_UseDebuggingNewOperator
};
@ -27959,11 +27962,11 @@ public:
PathFlatteningIterator (const Path& path,
const AffineTransform& transform = AffineTransform::identity,
float tolerence = 6.0f) throw();
float tolerence = 6.0f);
~PathFlatteningIterator() throw();
~PathFlatteningIterator();
bool next() throw();
bool next();
float x1;
float y1;
@ -27985,11 +27988,11 @@ private:
const AffineTransform transform;
float* points;
float tolerence, subPathCloseX, subPathCloseY;
bool isIdentityTransform;
const bool isIdentityTransform;
HeapBlock <float> stackBase;
float* stackPos;
int index, stackSize;
size_t index, stackSize;
PathFlatteningIterator (const PathFlatteningIterator&);
PathFlatteningIterator& operator= (const PathFlatteningIterator&);

View file

@ -217,5 +217,9 @@ void Value::callListeners()
listeners.call (&Listener::valueChanged, v);
}
OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const Value& value)
{
return stream << value.toString();
}
END_JUCE_NAMESPACE

View file

@ -227,5 +227,8 @@ private:
Value& operator= (const Value& other);
};
/** Writes a Value to an OutputStream as a UTF8 string. */
OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const Value& value);
#endif // __JUCE_VALUE_JUCEHEADER__

View file

@ -443,7 +443,9 @@ private:
ReferenceCountedObjectPtr <SharedObject> object;
ListenerList <Listener> listeners;
ValueTree (SharedObject* const object_);
public:
/** @internal */
ValueTree (SharedObject* const object_); // (can be made private when VC6 support is finally dropped)
};

View file

@ -43,7 +43,7 @@ extern void juce_glViewport (const int w, const int h);
OpenGLPixelFormat::OpenGLPixelFormat (const int bitsPerRGBComponent,
const int alphaBits_,
const int depthBufferBits_,
const int stencilBufferBits_) throw()
const int stencilBufferBits_)
: redBits (bitsPerRGBComponent),
greenBits (bitsPerRGBComponent),
blueBits (bitsPerRGBComponent),
@ -58,9 +58,50 @@ OpenGLPixelFormat::OpenGLPixelFormat (const int bitsPerRGBComponent,
{
}
bool OpenGLPixelFormat::operator== (const OpenGLPixelFormat& other) const throw()
OpenGLPixelFormat::OpenGLPixelFormat (const OpenGLPixelFormat& other)
: redBits (other.redBits),
greenBits (other.greenBits),
blueBits (other.blueBits),
alphaBits (other.alphaBits),
depthBufferBits (other.depthBufferBits),
stencilBufferBits (other.stencilBufferBits),
accumulationBufferRedBits (other.accumulationBufferRedBits),
accumulationBufferGreenBits (other.accumulationBufferGreenBits),
accumulationBufferBlueBits (other.accumulationBufferBlueBits),
accumulationBufferAlphaBits (other.accumulationBufferAlphaBits),
fullSceneAntiAliasingNumSamples (other.fullSceneAntiAliasingNumSamples)
{
return memcmp (this, &other, sizeof (other)) == 0;
}
OpenGLPixelFormat& OpenGLPixelFormat::operator= (const OpenGLPixelFormat& other)
{
redBits = other.redBits;
greenBits = other.greenBits;
blueBits = other.blueBits;
alphaBits = other.alphaBits;
depthBufferBits = other.depthBufferBits;
stencilBufferBits = other.stencilBufferBits;
accumulationBufferRedBits = other.accumulationBufferRedBits;
accumulationBufferGreenBits = other.accumulationBufferGreenBits;
accumulationBufferBlueBits = other.accumulationBufferBlueBits;
accumulationBufferAlphaBits = other.accumulationBufferAlphaBits;
fullSceneAntiAliasingNumSamples = other.fullSceneAntiAliasingNumSamples;
return *this;
}
bool OpenGLPixelFormat::operator== (const OpenGLPixelFormat& other) const
{
return redBits == other.redBits
&& greenBits == other.greenBits
&& blueBits == other.blueBits
&& alphaBits == other.alphaBits
&& depthBufferBits == other.depthBufferBits
&& stencilBufferBits == other.stencilBufferBits
&& accumulationBufferRedBits == other.accumulationBufferRedBits
&& accumulationBufferGreenBits == other.accumulationBufferGreenBits
&& accumulationBufferBlueBits == other.accumulationBufferBlueBits
&& accumulationBufferAlphaBits == other.accumulationBufferAlphaBits
&& fullSceneAntiAliasingNumSamples == other.fullSceneAntiAliasingNumSamples;
}
//==============================================================================

View file

@ -50,7 +50,11 @@ public:
OpenGLPixelFormat (const int bitsPerRGBComponent = 8,
const int alphaBits = 8,
const int depthBufferBits = 16,
const int stencilBufferBits = 0) throw();
const int stencilBufferBits = 0);
OpenGLPixelFormat (const OpenGLPixelFormat&);
OpenGLPixelFormat& operator= (const OpenGLPixelFormat&);
bool operator== (const OpenGLPixelFormat&) const;
//==============================================================================
int redBits; /**< The number of bits per pixel to use for the red channel. */
@ -78,8 +82,6 @@ public:
OwnedArray <OpenGLPixelFormat>& results);
//==============================================================================
bool operator== (const OpenGLPixelFormat&) const throw();
juce_UseDebuggingNewOperator
};

View file

@ -53,6 +53,12 @@ BEGIN_JUCE_NAMESPACE
class StringHolder
{
public:
StringHolder()
: refCount (0x3fffffff), allocatedNumChars (0)
{
text[0] = 0;
}
//==============================================================================
static juce_wchar* create (const size_t numChars)
{
@ -134,11 +140,13 @@ public:
private:
static inline StringHolder* bufferFromText (juce_wchar* const text) throw()
{
return reinterpret_cast <StringHolder*> (reinterpret_cast <char*> (text) - offsetof (StringHolder, StringHolder::text));
// (Can't use offsetof() here because of warnings about this not being a POD)
return reinterpret_cast <StringHolder*> (reinterpret_cast <char*> (text)
- (reinterpret_cast <size_t> (reinterpret_cast <StringHolder*> (1)->text) - 1));
}
};
StringHolder StringHolder::empty = { 0x3fffffff, 0, { 0 } };
StringHolder StringHolder::empty;
const String String::empty;
//==============================================================================
@ -353,7 +361,11 @@ namespace NumberToStringConverters
static juce_wchar getDecimalPoint()
{
#if JUCE_WINDOWS && _MSC_VER < 1400
static juce_wchar dp = std::_USE (std::locale(), std::numpunct <wchar_t>).decimal_point();
#else
static juce_wchar dp = std::use_facet <std::numpunct <wchar_t> > (std::locale()).decimal_point();
#endif
return dp;
}
@ -1092,6 +1104,7 @@ const String String::repeatedString (const juce_wchar* const stringToRepeat, int
const int len = CharacterFunctions::length (stringToRepeat);
String result ((size_t) (len * numberOfTimesToRepeat + 1), (int) 0);
juce_wchar* n = result.text;
*n = 0;
while (--numberOfTimesToRepeat >= 0)
{

View file

@ -187,7 +187,7 @@ bool PropertiesFile::save()
if (childElement != 0)
e->addChildElement (childElement);
else
e->setAttribute (PropertyFileConstants::valueAttribute,
e->setAttribute (PropertyFileConstants::valueAttribute,
getAllProperties().getAllValues() [i]);
}

View file

@ -120,7 +120,7 @@ public:
explicitly set this flag with setNeedsToBeSaved().
*/
bool needsToBeSaved() const;
/** Explicitly sets the flag to indicate whether the file needs saving or not.
@see needsToBeSaved
*/