@@ -459,7 +459,7 @@ Image Project::getBigIcon() | |||||
if (icon.isValid()) | if (icon.isValid()) | ||||
return ImageCache::getFromFile (icon.getFile()); | return ImageCache::getFromFile (icon.getFile()); | ||||
return Image(); | |||||
return Image::null; | |||||
} | } | ||||
Image Project::getSmallIcon() | Image Project::getSmallIcon() | ||||
@@ -469,46 +469,9 @@ Image Project::getSmallIcon() | |||||
if (icon.isValid()) | if (icon.isValid()) | ||||
return ImageCache::getFromFile (icon.getFile()); | return ImageCache::getFromFile (icon.getFile()); | ||||
return Image(); | |||||
return Image::null; | |||||
} | } | ||||
Image Project::getBestIconForSize (int size, bool returnNullIfNothingBigEnough) | |||||
{ | |||||
Image im; | |||||
const Image im1 (getSmallIcon()); | |||||
const Image im2 (getBigIcon()); | |||||
if (im1.isValid() && im2.isValid()) | |||||
{ | |||||
if (im1.getWidth() >= size && im2.getWidth() >= size) | |||||
im = im1.getWidth() < im2.getWidth() ? im1 : im2; | |||||
else if (im1.getWidth() >= size) | |||||
im = im1; | |||||
else if (im2.getWidth() >= size) | |||||
im = im2; | |||||
else | |||||
return Image(); | |||||
} | |||||
else | |||||
{ | |||||
im = im1.isValid() ? im1 : im2; | |||||
} | |||||
if (size == im.getWidth() && size == im.getHeight()) | |||||
return im; | |||||
if (returnNullIfNothingBigEnough && im.getWidth() < size && im.getHeight() < size) | |||||
return Image::null; | |||||
Image newIm (Image::ARGB, size, size, true, Image::SoftwareImage); | |||||
Graphics g (newIm); | |||||
g.drawImageWithin (im, 0, 0, size, size, | |||||
RectanglePlacement::centred | RectanglePlacement::onlyReduceInSize, false); | |||||
return newIm; | |||||
} | |||||
StringPairArray Project::getPreprocessorDefs() const | StringPairArray Project::getPreprocessorDefs() const | ||||
{ | { | ||||
return parsePreprocessorDefs (getProjectPreprocessorDefs().toString()); | return parsePreprocessorDefs (getProjectPreprocessorDefs().toString()); | ||||
@@ -105,7 +105,6 @@ public: | |||||
Value getSmallIconImageItemID() const { return getProjectValue ("smallIcon"); } | Value getSmallIconImageItemID() const { return getProjectValue ("smallIcon"); } | ||||
Image getBigIcon(); | Image getBigIcon(); | ||||
Image getSmallIcon(); | Image getSmallIcon(); | ||||
Image getBestIconForSize (int size, bool returnNullIfNothingBigEnough); | |||||
Value shouldBuildVST() const { return getProjectValue ("buildVST"); } | Value shouldBuildVST() const { return getProjectValue ("buildVST"); } | ||||
Value shouldBuildRTAS() const { return getProjectValue ("buildRTAS"); } | Value shouldBuildRTAS() const { return getProjectValue ("buildRTAS"); } | ||||
@@ -74,7 +74,7 @@ public: | |||||
#endif | #endif | ||||
} | } | ||||
bool isPossibleForCurrentProject() { return project.getProjectType().isGUIApplication(); } | |||||
bool isPossibleForCurrentProject() { return projectType.isGUIApplication(); } | |||||
bool usesMMFiles() const { return false; } | bool usesMMFiles() const { return false; } | ||||
void launchProject() | void launchProject() | ||||
@@ -208,7 +208,7 @@ private: | |||||
void writeAndroidMk (const File& file) | void writeAndroidMk (const File& file) | ||||
{ | { | ||||
Array<RelativePath> files; | Array<RelativePath> files; | ||||
findAllFilesToCompile (project.getMainGroup(), files); | |||||
findAllFilesToCompile (getMainGroup(), files); | |||||
for (int i = 0; i < generatedGroups.size(); ++i) | for (int i = 0; i < generatedGroups.size(); ++i) | ||||
findAllFilesToCompile (generatedGroups.getReference(i), files); | findAllFilesToCompile (generatedGroups.getReference(i), files); | ||||
@@ -265,9 +265,9 @@ private: | |||||
defines.set ("NDEBUG", "1"); | defines.set ("NDEBUG", "1"); | ||||
} | } | ||||
for (int i = 0; i < project.getNumConfigurations(); ++i) | |||||
for (int i = 0; i < configs.size(); ++i) | |||||
{ | { | ||||
Project::BuildConfiguration config (project.getConfiguration(i)); | |||||
const Project::BuildConfiguration& config = configs.getReference(i); | |||||
if (config.isDebug() == forDebug) | if (config.isDebug() == forDebug) | ||||
{ | { | ||||
@@ -285,7 +285,7 @@ private: | |||||
XmlElement* createAntBuildXML() | XmlElement* createAntBuildXML() | ||||
{ | { | ||||
XmlElement* proj = new XmlElement ("project"); | XmlElement* proj = new XmlElement ("project"); | ||||
proj->setAttribute ("name", project.getProjectName().toString()); | |||||
proj->setAttribute ("name", projectName); | |||||
proj->setAttribute ("default", "debug"); | proj->setAttribute ("default", "debug"); | ||||
proj->createNewChildElement ("property")->setAttribute ("file", "local.properties"); | proj->createNewChildElement ("property")->setAttribute ("file", "local.properties"); | ||||
@@ -376,7 +376,7 @@ private: | |||||
void writeIcon (const File& file, int size) | void writeIcon (const File& file, int size) | ||||
{ | { | ||||
Image im (project.getBestIconForSize (size, false)); | |||||
Image im (getBestIconForSize (size, false)); | |||||
if (im.isValid()) | if (im.isValid()) | ||||
{ | { | ||||
@@ -395,7 +395,7 @@ private: | |||||
XmlElement strings ("resources"); | XmlElement strings ("resources"); | ||||
XmlElement* name = strings.createNewChildElement ("string"); | XmlElement* name = strings.createNewChildElement ("string"); | ||||
name->setAttribute ("name", "app_name"); | name->setAttribute ("name", "app_name"); | ||||
name->addTextElement (project.getProjectName().toString()); | |||||
name->addTextElement (projectName); | |||||
writeXmlOrThrow (strings, file, "utf-8", 100); | writeXmlOrThrow (strings, file, "utf-8", 100); | ||||
} | } | ||||
@@ -61,7 +61,7 @@ public: | |||||
{ | { | ||||
ProjectExporter::createPropertyEditors (props); | ProjectExporter::createPropertyEditors (props); | ||||
if (project.getProjectType().isLibrary()) | |||||
if (projectType.isLibrary()) | |||||
{ | { | ||||
const char* const libTypes[] = { "Static Library (.lib)", "Dynamic Library (.dll)", 0 }; | const char* const libTypes[] = { "Static Library (.lib)", "Dynamic Library (.dll)", 0 }; | ||||
const int libTypeValues[] = { 1, 2, 0 }; | const int libTypeValues[] = { 1, 2, 0 }; | ||||
@@ -83,7 +83,7 @@ protected: | |||||
File getProjectFile (const String& extension) const { return getTargetFolder().getChildFile (project.getProjectFilenameRoot()).withFileExtension (extension); } | File getProjectFile (const String& extension) const { return getTargetFolder().getChildFile (project.getProjectFilenameRoot()).withFileExtension (extension); } | ||||
Value getLibraryType() const { return getSetting (Ids::libraryType); } | Value getLibraryType() const { return getSetting (Ids::libraryType); } | ||||
bool isLibraryDLL() const { return project.getProjectType().isLibrary() && getLibraryType() == 2; } | |||||
bool isLibraryDLL() const { return projectType.isLibrary() && getLibraryType() == 2; } | |||||
//============================================================================== | //============================================================================== | ||||
String getIntermediatesPath (const Project::BuildConfiguration& config) const | String getIntermediatesPath (const Project::BuildConfiguration& config) const | ||||
@@ -98,17 +98,17 @@ protected: | |||||
return getIntermediatesPath (config); | return getIntermediatesPath (config); | ||||
return ".\\" + RelativePath (binaryPath, RelativePath::projectFolder) | return ".\\" + RelativePath (binaryPath, RelativePath::projectFolder) | ||||
.rebased (project.getFile().getParentDirectory(), getTargetFolder(), RelativePath::buildTargetFolder) | |||||
.rebased (projectFolder, getTargetFolder(), RelativePath::buildTargetFolder) | |||||
.toWindowsStyle(); | .toWindowsStyle(); | ||||
} | } | ||||
String getTargetBinarySuffix() const | String getTargetBinarySuffix() const | ||||
{ | { | ||||
if (project.getProjectType().isLibrary()) | |||||
if (projectType.isLibrary()) | |||||
return ".lib"; | return ".lib"; | ||||
else if (isRTAS()) | else if (isRTAS()) | ||||
return ".dpm"; | return ".dpm"; | ||||
else if (project.getProjectType().isAudioPlugin() || project.getProjectType().isBrowserPlugin()) | |||||
else if (projectType.isAudioPlugin() || projectType.isBrowserPlugin()) | |||||
return ".dll"; | return ".dll"; | ||||
return ".exe"; | return ".exe"; | ||||
@@ -130,10 +130,10 @@ protected: | |||||
defines.set ("NDEBUG", ""); | defines.set ("NDEBUG", ""); | ||||
} | } | ||||
if (project.getProjectType().isCommandLineApp()) | |||||
if (projectType.isCommandLineApp()) | |||||
defines.set ("_CONSOLE", ""); | defines.set ("_CONSOLE", ""); | ||||
if (project.getProjectType().isLibrary()) | |||||
if (projectType.isLibrary()) | |||||
defines.set ("_LIB", ""); | defines.set ("_LIB", ""); | ||||
if (isRTAS()) | if (isRTAS()) | ||||
@@ -188,25 +188,25 @@ protected: | |||||
void writeSolutionFile (OutputStream& out, const String& versionString, const File& vcProject) | void writeSolutionFile (OutputStream& out, const String& versionString, const File& vcProject) | ||||
{ | { | ||||
out << "Microsoft Visual Studio Solution File, Format Version " << versionString << newLine | out << "Microsoft Visual Studio Solution File, Format Version " << versionString << newLine | ||||
<< "Project(\"" << createGUID (project.getProjectName().toString() + "sln_guid") << "\") = \"" << project.getProjectName().toString() << "\", \"" | |||||
<< "Project(\"" << createGUID (projectName + "sln_guid") << "\") = \"" << projectName << "\", \"" | |||||
<< vcProject.getFileName() << "\", \"" << projectGUID << '"' << newLine | << vcProject.getFileName() << "\", \"" << projectGUID << '"' << newLine | ||||
<< "EndProject" << newLine | << "EndProject" << newLine | ||||
<< "Global" << newLine | << "Global" << newLine | ||||
<< "\tGlobalSection(SolutionConfigurationPlatforms) = preSolution" << newLine; | << "\tGlobalSection(SolutionConfigurationPlatforms) = preSolution" << newLine; | ||||
int i; | int i; | ||||
for (i = 0; i < project.getNumConfigurations(); ++i) | |||||
for (i = 0; i < configs.size(); ++i) | |||||
{ | { | ||||
Project::BuildConfiguration config (project.getConfiguration (i)); | |||||
const Project::BuildConfiguration& config = configs.getReference(i); | |||||
out << "\t\t" << createConfigName (config) << " = " << createConfigName (config) << newLine; | out << "\t\t" << createConfigName (config) << " = " << createConfigName (config) << newLine; | ||||
} | } | ||||
out << "\tEndGlobalSection" << newLine | out << "\tEndGlobalSection" << newLine | ||||
<< "\tGlobalSection(ProjectConfigurationPlatforms) = postSolution" << newLine; | << "\tGlobalSection(ProjectConfigurationPlatforms) = postSolution" << newLine; | ||||
for (i = 0; i < project.getNumConfigurations(); ++i) | |||||
for (i = 0; i < configs.size(); ++i) | |||||
{ | { | ||||
Project::BuildConfiguration config (project.getConfiguration (i)); | |||||
const Project::BuildConfiguration& config = configs.getReference(i); | |||||
out << "\t\t" << projectGUID << "." << createConfigName (config) << ".ActiveCfg = " << createConfigName (config) << newLine; | out << "\t\t" << projectGUID << "." << createConfigName (config) << ".ActiveCfg = " << createConfigName (config) << newLine; | ||||
out << "\t\t" << projectGUID << "." << createConfigName (config) << ".Build.0 = " << createConfigName (config) << newLine; | out << "\t\t" << projectGUID << "." << createConfigName (config) << ".Build.0 = " << createConfigName (config) << newLine; | ||||
} | } | ||||
@@ -326,19 +326,19 @@ protected: | |||||
{ | { | ||||
Array<Image> images; | Array<Image> images; | ||||
Image im (project.getBestIconForSize (16, true)); | |||||
Image im (getBestIconForSize (16, true)); | |||||
if (im.isValid()) | if (im.isValid()) | ||||
images.add (im); | images.add (im); | ||||
im = project.getBestIconForSize (32, true); | |||||
im = getBestIconForSize (32, true); | |||||
if (im.isValid()) | if (im.isValid()) | ||||
images.add (im); | images.add (im); | ||||
im = project.getBestIconForSize (48, true); | |||||
im = getBestIconForSize (48, true); | |||||
if (im.isValid()) | if (im.isValid()) | ||||
images.add (im); | images.add (im); | ||||
im = project.getBestIconForSize (128, true); | |||||
im = getBestIconForSize (128, true); | |||||
if (im.isValid()) | if (im.isValid()) | ||||
images.add (im); | images.add (im); | ||||
@@ -433,7 +433,7 @@ protected: | |||||
{ | { | ||||
projectXml.setAttribute ("ProjectType", "Visual C++"); | projectXml.setAttribute ("ProjectType", "Visual C++"); | ||||
projectXml.setAttribute ("Version", getProjectVersionString()); | projectXml.setAttribute ("Version", getProjectVersionString()); | ||||
projectXml.setAttribute ("Name", project.getProjectName().toString()); | |||||
projectXml.setAttribute ("Name", projectName); | |||||
projectXml.setAttribute ("ProjectGUID", projectGUID); | projectXml.setAttribute ("ProjectGUID", projectGUID); | ||||
projectXml.setAttribute ("TargetFrameworkVersion", "131072"); | projectXml.setAttribute ("TargetFrameworkVersion", "131072"); | ||||
@@ -460,9 +460,9 @@ protected: | |||||
if (excludeFromBuild || useStdcall) | if (excludeFromBuild || useStdcall) | ||||
{ | { | ||||
for (int i = 0; i < project.getNumConfigurations(); ++i) | |||||
for (int i = 0; i < configs.size(); ++i) | |||||
{ | { | ||||
Project::BuildConfiguration config (project.getConfiguration (i)); | |||||
const Project::BuildConfiguration& config = configs.getReference(i); | |||||
XmlElement* fileConfig = fileXml->createNewChildElement ("FileConfiguration"); | XmlElement* fileConfig = fileXml->createNewChildElement ("FileConfiguration"); | ||||
fileConfig->setAttribute ("Name", createConfigName (config)); | fileConfig->setAttribute ("Name", createConfigName (config)); | ||||
@@ -522,7 +522,7 @@ protected: | |||||
void createFiles (XmlElement& files) | void createFiles (XmlElement& files) | ||||
{ | { | ||||
addFiles (project.getMainGroup(), files, false); | |||||
addFiles (getMainGroup(), files, false); | |||||
for (int i = 0; i < generatedGroups.size(); ++i) | for (int i = 0; i < generatedGroups.size(); ++i) | ||||
if (generatedGroups.getReference(i).getNumChildren() > 0) | if (generatedGroups.getReference(i).getNumChildren() > 0) | ||||
@@ -547,8 +547,8 @@ protected: | |||||
xml.setAttribute ("Name", createConfigName (config)); | xml.setAttribute ("Name", createConfigName (config)); | ||||
xml.setAttribute ("OutputDirectory", FileHelpers::windowsStylePath (binariesPath)); | xml.setAttribute ("OutputDirectory", FileHelpers::windowsStylePath (binariesPath)); | ||||
xml.setAttribute ("IntermediateDirectory", FileHelpers::windowsStylePath (intermediatesPath)); | xml.setAttribute ("IntermediateDirectory", FileHelpers::windowsStylePath (intermediatesPath)); | ||||
xml.setAttribute ("ConfigurationType", (project.getProjectType().isAudioPlugin() || project.getProjectType().isBrowserPlugin() || isLibraryDLL()) | |||||
? "2" : (project.getProjectType().isLibrary() ? "4" : "1")); | |||||
xml.setAttribute ("ConfigurationType", (projectType.isAudioPlugin() || projectType.isBrowserPlugin() || isLibraryDLL()) | |||||
? "2" : (projectType.isLibrary() ? "4" : "1")); | |||||
xml.setAttribute ("UseOfMFC", "0"); | xml.setAttribute ("UseOfMFC", "0"); | ||||
xml.setAttribute ("ATLMinimizesCRunTimeLibraryUsage", "false"); | xml.setAttribute ("ATLMinimizesCRunTimeLibraryUsage", "false"); | ||||
xml.setAttribute ("CharacterSet", "2"); | xml.setAttribute ("CharacterSet", "2"); | ||||
@@ -571,7 +571,7 @@ protected: | |||||
createToolElement (xml, "VCXMLDataGeneratorTool"); | createToolElement (xml, "VCXMLDataGeneratorTool"); | ||||
createToolElement (xml, "VCWebServiceProxyGeneratorTool"); | createToolElement (xml, "VCWebServiceProxyGeneratorTool"); | ||||
if (! project.getProjectType().isLibrary()) | |||||
if (! projectType.isLibrary()) | |||||
{ | { | ||||
XmlElement* midl = createToolElement (xml, "VCMIDLTool"); | XmlElement* midl = createToolElement (xml, "VCMIDLTool"); | ||||
midl->setAttribute ("PreprocessorDefinitions", isDebug ? "_DEBUG" : "NDEBUG"); | midl->setAttribute ("PreprocessorDefinitions", isDebug ? "_DEBUG" : "NDEBUG"); | ||||
@@ -591,7 +591,7 @@ protected: | |||||
if (isDebug) | if (isDebug) | ||||
{ | { | ||||
compiler->setAttribute ("BufferSecurityCheck", ""); | compiler->setAttribute ("BufferSecurityCheck", ""); | ||||
compiler->setAttribute ("DebugInformationFormat", project.getProjectType().isLibrary() ? "3" : "4"); | |||||
compiler->setAttribute ("DebugInformationFormat", projectType.isLibrary() ? "3" : "4"); | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
@@ -628,7 +628,7 @@ protected: | |||||
const String outputFileName (getBinaryFileForConfig (config)); | const String outputFileName (getBinaryFileForConfig (config)); | ||||
if (! project.getProjectType().isLibrary()) | |||||
if (! projectType.isLibrary()) | |||||
{ | { | ||||
XmlElement* linker = createToolElement (xml, "VCLinkerTool"); | XmlElement* linker = createToolElement (xml, "VCLinkerTool"); | ||||
@@ -641,7 +641,7 @@ protected: | |||||
linker->setAttribute ("IgnoreDefaultLibraryNames", isDebug ? "libcmt.lib, msvcrt.lib" : ""); | linker->setAttribute ("IgnoreDefaultLibraryNames", isDebug ? "libcmt.lib, msvcrt.lib" : ""); | ||||
linker->setAttribute ("GenerateDebugInformation", isDebug ? "true" : "false"); | linker->setAttribute ("GenerateDebugInformation", isDebug ? "true" : "false"); | ||||
linker->setAttribute ("ProgramDatabaseFile", FileHelpers::windowsStylePath (intermediatesPath + "/" + binaryName + ".pdb")); | linker->setAttribute ("ProgramDatabaseFile", FileHelpers::windowsStylePath (intermediatesPath + "/" + binaryName + ".pdb")); | ||||
linker->setAttribute ("SubSystem", project.getProjectType().isCommandLineApp() ? "1" : "2"); | |||||
linker->setAttribute ("SubSystem", projectType.isCommandLineApp() ? "1" : "2"); | |||||
if (! isDebug) | if (! isDebug) | ||||
{ | { | ||||
@@ -700,19 +700,16 @@ protected: | |||||
createToolElement (xml, "VCFxCopTool"); | createToolElement (xml, "VCFxCopTool"); | ||||
if (! project.getProjectType().isLibrary()) | |||||
if (! projectType.isLibrary()) | |||||
createToolElement (xml, "VCAppVerifierTool"); | createToolElement (xml, "VCAppVerifierTool"); | ||||
createToolElement (xml, "VCPostBuildEventTool"); | createToolElement (xml, "VCPostBuildEventTool"); | ||||
} | } | ||||
void createConfigs (XmlElement& configs) | |||||
void createConfigs (XmlElement& xml) | |||||
{ | { | ||||
for (int i = 0; i < project.getNumConfigurations(); ++i) | |||||
{ | |||||
Project::BuildConfiguration config (project.getConfiguration (i)); | |||||
createConfig (*configs.createNewChildElement ("Configuration"), config); | |||||
} | |||||
for (int i = 0; i < configs.size(); ++i) | |||||
createConfig (*xml.createNewChildElement ("Configuration"), configs.getReference(i)); | |||||
} | } | ||||
//============================================================================== | //============================================================================== | ||||
@@ -814,22 +811,22 @@ private: | |||||
//============================================================================== | //============================================================================== | ||||
String createConfigName (const Project::BuildConfiguration& config) const | String createConfigName (const Project::BuildConfiguration& config) const | ||||
{ | { | ||||
return project.getProjectName().toString() + " - Win32 " + config.getName().toString(); | |||||
return projectName + " - Win32 " + config.getName().toString(); | |||||
} | } | ||||
void writeProject (OutputStream& out) | void writeProject (OutputStream& out) | ||||
{ | { | ||||
const String defaultConfigName (createConfigName (project.getConfiguration (0))); | |||||
const String defaultConfigName (createConfigName (configs.getReference(0))); | |||||
const bool isDLL = project.getProjectType().isAudioPlugin() || project.getProjectType().isBrowserPlugin(); | |||||
const bool isDLL = projectType.isAudioPlugin() || projectType.isBrowserPlugin(); | |||||
String targetType, targetCode; | String targetType, targetCode; | ||||
if (isDLL) { targetType = "\"Win32 (x86) Dynamic-Link Library\""; targetCode = "0x0102"; } | |||||
else if (project.getProjectType().isLibrary()) { targetType = "\"Win32 (x86) Static Library\""; targetCode = "0x0104"; } | |||||
else if (project.getProjectType().isCommandLineApp()) { targetType = "\"Win32 (x86) Console Application\""; targetCode = "0x0103"; } | |||||
else { targetType = "\"Win32 (x86) Application\""; targetCode = "0x0101"; } | |||||
if (isDLL) { targetType = "\"Win32 (x86) Dynamic-Link Library\""; targetCode = "0x0102"; } | |||||
else if (projectType.isLibrary()) { targetType = "\"Win32 (x86) Static Library\""; targetCode = "0x0104"; } | |||||
else if (projectType.isCommandLineApp()) { targetType = "\"Win32 (x86) Console Application\""; targetCode = "0x0103"; } | |||||
else { targetType = "\"Win32 (x86) Application\""; targetCode = "0x0101"; } | |||||
out << "# Microsoft Developer Studio Project File - Name=\"" << project.getProjectName() | |||||
out << "# Microsoft Developer Studio Project File - Name=\"" << projectName | |||||
<< "\" - Package Owner=<4>" << newLine | << "\" - Package Owner=<4>" << newLine | ||||
<< "# Microsoft Developer Studio Generated Build File, Format Version 6.00" << newLine | << "# Microsoft Developer Studio Generated Build File, Format Version 6.00" << newLine | ||||
<< "# ** DO NOT EDIT **" << newLine | << "# ** DO NOT EDIT **" << newLine | ||||
@@ -838,19 +835,19 @@ private: | |||||
<< "!MESSAGE This is not a valid makefile. To build this project using NMAKE," << 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 use the Export Makefile command and run" << newLine | ||||
<< "!MESSAGE " << newLine | << "!MESSAGE " << newLine | ||||
<< "!MESSAGE NMAKE /f \"" << project.getProjectName() << ".mak.\"" << newLine | |||||
<< "!MESSAGE NMAKE /f \"" << projectName << ".mak.\"" << newLine | |||||
<< "!MESSAGE " << newLine | << "!MESSAGE " << newLine | ||||
<< "!MESSAGE You can specify a configuration when running NMAKE" << 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 by defining the macro CFG on the command line. For example:" << newLine | ||||
<< "!MESSAGE " << newLine | << "!MESSAGE " << newLine | ||||
<< "!MESSAGE NMAKE /f \"" << project.getProjectName() << ".mak\" CFG=\"" << defaultConfigName << '"' << newLine | |||||
<< "!MESSAGE NMAKE /f \"" << projectName << ".mak\" CFG=\"" << defaultConfigName << '"' << newLine | |||||
<< "!MESSAGE " << newLine | << "!MESSAGE " << newLine | ||||
<< "!MESSAGE Possible choices for configuration are:" << newLine | << "!MESSAGE Possible choices for configuration are:" << newLine | ||||
<< "!MESSAGE " << newLine; | << "!MESSAGE " << newLine; | ||||
int i; | int i; | ||||
for (i = 0; i < project.getNumConfigurations(); ++i) | |||||
out << "!MESSAGE \"" << createConfigName (project.getConfiguration (i)) << "\" (based on " << targetType << ")" << newLine; | |||||
for (i = 0; i < configs.size(); ++i) | |||||
out << "!MESSAGE \"" << createConfigName (configs.getReference (i)) << "\" (based on " << targetType << ")" << newLine; | |||||
out << "!MESSAGE " << newLine | out << "!MESSAGE " << newLine | ||||
<< "# Begin Project" << newLine | << "# Begin Project" << newLine | ||||
@@ -863,9 +860,9 @@ private: | |||||
String targetList; | String targetList; | ||||
for (i = 0; i < project.getNumConfigurations(); ++i) | |||||
for (i = 0; i < configs.size(); ++i) | |||||
{ | { | ||||
const Project::BuildConfiguration config (project.getConfiguration (i)); | |||||
const Project::BuildConfiguration& config = configs.getReference(i); | |||||
const String configName (createConfigName (config)); | const String configName (createConfigName (config)); | ||||
targetList << "# Name \"" << configName << '"' << newLine; | targetList << "# Name \"" << configName << '"' << newLine; | ||||
@@ -898,7 +895,7 @@ private: | |||||
if (! isDebug) | if (! isDebug) | ||||
out << "# SUBTRACT CPP /YX" << newLine; | out << "# SUBTRACT CPP /YX" << newLine; | ||||
if (! project.getProjectType().isLibrary()) | |||||
if (! projectType.isLibrary()) | |||||
out << "# ADD BASE MTL /nologo /D " << defines << " /mktyplib203 /win32" << newLine | out << "# ADD BASE MTL /nologo /D " << defines << " /mktyplib203 /win32" << newLine | ||||
<< "# ADD MTL /nologo /D " << defines << " /mktyplib203 /win32" << newLine; | << "# ADD MTL /nologo /D " << defines << " /mktyplib203 /win32" << newLine; | ||||
@@ -908,7 +905,7 @@ private: | |||||
<< "# ADD BASE BSC32 /nologo" << newLine | << "# ADD BASE BSC32 /nologo" << newLine | ||||
<< "# ADD BSC32 /nologo" << newLine; | << "# ADD BSC32 /nologo" << newLine; | ||||
if (project.getProjectType().isLibrary()) | |||||
if (projectType.isLibrary()) | |||||
{ | { | ||||
out << "LIB32=link.exe -lib" << newLine | out << "LIB32=link.exe -lib" << newLine | ||||
<< "# ADD BASE LIB32 /nologo" << newLine | << "# ADD BASE LIB32 /nologo" << newLine | ||||
@@ -922,8 +919,8 @@ private: | |||||
<< "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib " | << "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" : "") | << (isDebug ? " /debug" : "") | ||||
<< " /nologo /machine:I386 /out:\"" << targetBinary << "\" " | << " /nologo /machine:I386 /out:\"" << targetBinary << "\" " | ||||
<< (isDLL ? "/dll" : (project.getProjectType().isCommandLineApp() ? "/subsystem:console " | |||||
: "/subsystem:windows ")) | |||||
<< (isDLL ? "/dll" : (projectType.isCommandLineApp() ? "/subsystem:console " | |||||
: "/subsystem:windows ")) | |||||
<< replacePreprocessorTokens (config, getExtraLinkerFlags().toString()).trim() << newLine; | << replacePreprocessorTokens (config, getExtraLinkerFlags().toString()).trim() << newLine; | ||||
} | } | ||||
} | } | ||||
@@ -932,7 +929,7 @@ private: | |||||
<< "# Begin Target" << newLine | << "# Begin Target" << newLine | ||||
<< targetList; | << targetList; | ||||
writeFiles (out, project.getMainGroup()); | |||||
writeFiles (out, getMainGroup()); | |||||
for (int i = 0; i < generatedGroups.size(); ++i) | for (int i = 0; i < generatedGroups.size(); ++i) | ||||
if (generatedGroups.getReference(i).getNumChildren() > 0) | if (generatedGroups.getReference(i).getNumChildren() > 0) | ||||
@@ -1002,7 +999,7 @@ private: | |||||
<< "}}}" << newLine; | << "}}}" << newLine; | ||||
} | } | ||||
out << "Project: \"" << project.getProjectName() << "\" = .\\" << getDSPFile().getFileName() << " - Package Owner=<4>" << newLine | |||||
out << "Project: \"" << projectName << "\" = .\\" << getDSPFile().getFileName() << " - Package Owner=<4>" << newLine | |||||
<< "Package=<5>" << newLine | << "Package=<5>" << newLine | ||||
<< "{{{" << newLine | << "{{{" << newLine | ||||
<< "}}}" << newLine | << "}}}" << newLine | ||||
@@ -1113,9 +1110,9 @@ protected: | |||||
XmlElement* configsGroup = projectXml.createNewChildElement ("ItemGroup"); | XmlElement* configsGroup = projectXml.createNewChildElement ("ItemGroup"); | ||||
configsGroup->setAttribute ("Label", "ProjectConfigurations"); | configsGroup->setAttribute ("Label", "ProjectConfigurations"); | ||||
for (int i = 0; i < project.getNumConfigurations(); ++i) | |||||
for (int i = 0; i < configs.size(); ++i) | |||||
{ | { | ||||
Project::BuildConfiguration config (project.getConfiguration (i)); | |||||
const Project::BuildConfiguration& config = configs.getReference(i); | |||||
XmlElement* e = configsGroup->createNewChildElement ("ProjectConfiguration"); | XmlElement* e = configsGroup->createNewChildElement ("ProjectConfiguration"); | ||||
e->setAttribute ("Include", createConfigName (config)); | e->setAttribute ("Include", createConfigName (config)); | ||||
@@ -1135,9 +1132,9 @@ protected: | |||||
imports->setAttribute ("Project", "$(VCTargetsPath)\\Microsoft.Cpp.Default.props"); | imports->setAttribute ("Project", "$(VCTargetsPath)\\Microsoft.Cpp.Default.props"); | ||||
} | } | ||||
for (int i = 0; i < project.getNumConfigurations(); ++i) | |||||
for (int i = 0; i < configs.size(); ++i) | |||||
{ | { | ||||
Project::BuildConfiguration config (project.getConfiguration (i)); | |||||
const Project::BuildConfiguration& config = configs.getReference(i); | |||||
XmlElement* e = projectXml.createNewChildElement ("PropertyGroup"); | XmlElement* e = projectXml.createNewChildElement ("PropertyGroup"); | ||||
setConditionAttribute (*e, config); | setConditionAttribute (*e, config); | ||||
@@ -1178,9 +1175,9 @@ protected: | |||||
XmlElement* props = projectXml.createNewChildElement ("PropertyGroup"); | XmlElement* props = projectXml.createNewChildElement ("PropertyGroup"); | ||||
props->createNewChildElement ("_ProjectFileVersion")->addTextElement ("10.0.30319.1"); | props->createNewChildElement ("_ProjectFileVersion")->addTextElement ("10.0.30319.1"); | ||||
for (int i = 0; i < project.getNumConfigurations(); ++i) | |||||
for (int i = 0; i < configs.size(); ++i) | |||||
{ | { | ||||
Project::BuildConfiguration config (project.getConfiguration (i)); | |||||
const Project::BuildConfiguration& config = configs.getReference(i); | |||||
XmlElement* outdir = props->createNewChildElement ("OutDir"); | XmlElement* outdir = props->createNewChildElement ("OutDir"); | ||||
setConditionAttribute (*outdir, config); | setConditionAttribute (*outdir, config); | ||||
@@ -1196,9 +1193,9 @@ protected: | |||||
} | } | ||||
} | } | ||||
for (int i = 0; i < project.getNumConfigurations(); ++i) | |||||
for (int i = 0; i < configs.size(); ++i) | |||||
{ | { | ||||
Project::BuildConfiguration config (project.getConfiguration (i)); | |||||
const Project::BuildConfiguration& config = configs.getReference(i); | |||||
String binariesPath (getConfigTargetPath (config)); | String binariesPath (getConfigTargetPath (config)); | ||||
String intermediatesPath (getIntermediatesPath (config)); | String intermediatesPath (getIntermediatesPath (config)); | ||||
const bool isDebug = (bool) config.isDebug().getValue(); | const bool isDebug = (bool) config.isDebug().getValue(); | ||||
@@ -1259,7 +1256,7 @@ protected: | |||||
: "%(IgnoreSpecificDefaultLibraries)"); | : "%(IgnoreSpecificDefaultLibraries)"); | ||||
link->createNewChildElement ("GenerateDebugInformation")->addTextElement (isDebug ? "true" : "false"); | link->createNewChildElement ("GenerateDebugInformation")->addTextElement (isDebug ? "true" : "false"); | ||||
link->createNewChildElement ("ProgramDatabaseFile")->addTextElement (FileHelpers::windowsStylePath (intermediatesPath + "/" + binaryName + ".pdb")); | link->createNewChildElement ("ProgramDatabaseFile")->addTextElement (FileHelpers::windowsStylePath (intermediatesPath + "/" + binaryName + ".pdb")); | ||||
link->createNewChildElement ("SubSystem")->addTextElement (project.getProjectType().isCommandLineApp() ? "Console" : "Windows"); | |||||
link->createNewChildElement ("SubSystem")->addTextElement (projectType.isCommandLineApp() ? "Console" : "Windows"); | |||||
link->createNewChildElement ("TargetMachine")->addTextElement ("MachineX86"); | link->createNewChildElement ("TargetMachine")->addTextElement ("MachineX86"); | ||||
if (! isDebug) | if (! isDebug) | ||||
@@ -1285,7 +1282,7 @@ protected: | |||||
XmlElement* cppFiles = projectXml.createNewChildElement ("ItemGroup"); | XmlElement* cppFiles = projectXml.createNewChildElement ("ItemGroup"); | ||||
XmlElement* headerFiles = projectXml.createNewChildElement ("ItemGroup"); | XmlElement* headerFiles = projectXml.createNewChildElement ("ItemGroup"); | ||||
addFilesToCompile (project.getMainGroup(), *cppFiles, *headerFiles, false); | |||||
addFilesToCompile (getMainGroup(), *cppFiles, *headerFiles, false); | |||||
for (int i = 0; i < generatedGroups.size(); ++i) | for (int i = 0; i < generatedGroups.size(); ++i) | ||||
if (generatedGroups.getReference(i).getNumChildren() > 0) | if (generatedGroups.getReference(i).getNumChildren() > 0) | ||||
@@ -1320,9 +1317,9 @@ protected: | |||||
String getProjectType() const | String getProjectType() const | ||||
{ | { | ||||
if (project.getProjectType().isGUIApplication() || project.getProjectType().isCommandLineApp()) return "Application"; | |||||
else if (project.getProjectType().isAudioPlugin() || project.getProjectType().isBrowserPlugin()) return "DynamicLibrary"; | |||||
else if (project.getProjectType().isLibrary()) return "StaticLibrary"; | |||||
if (projectType.isGUIApplication() || projectType.isCommandLineApp()) return "Application"; | |||||
else if (projectType.isAudioPlugin() || projectType.isBrowserPlugin()) return "DynamicLibrary"; | |||||
else if (projectType.isLibrary()) return "StaticLibrary"; | |||||
jassertfalse; | jassertfalse; | ||||
return String::empty; | return String::empty; | ||||
@@ -1440,7 +1437,7 @@ protected: | |||||
XmlElement* cpps = filterXml.createNewChildElement ("ItemGroup"); | XmlElement* cpps = filterXml.createNewChildElement ("ItemGroup"); | ||||
XmlElement* headers = filterXml.createNewChildElement ("ItemGroup"); | XmlElement* headers = filterXml.createNewChildElement ("ItemGroup"); | ||||
addFilesToFilter (project.getMainGroup(), project.getProjectName().toString(), *cpps, *headers, *groups); | |||||
addFilesToFilter (getMainGroup(), projectName, *cpps, *headers, *groups); | |||||
for (int i = 0; i < generatedGroups.size(); ++i) | for (int i = 0; i < generatedGroups.size(); ++i) | ||||
if (generatedGroups.getReference(i).getNumChildren() > 0) | if (generatedGroups.getReference(i).getNumChildren() > 0) | ||||
@@ -87,7 +87,7 @@ public: | |||||
void create() | void create() | ||||
{ | { | ||||
Array<RelativePath> files; | Array<RelativePath> files; | ||||
findAllFilesToCompile (project.getMainGroup(), files); | |||||
findAllFilesToCompile (getMainGroup(), files); | |||||
for (int i = 0; i < generatedGroups.size(); ++i) | for (int i = 0; i < generatedGroups.size(); ++i) | ||||
findAllFilesToCompile (generatedGroups.getReference(i), files); | findAllFilesToCompile (generatedGroups.getReference(i), files); | ||||
@@ -157,7 +157,7 @@ private: | |||||
{ | { | ||||
out << " LDFLAGS += -L$(BINDIR) -L$(LIBDIR)"; | out << " LDFLAGS += -L$(BINDIR) -L$(LIBDIR)"; | ||||
if (project.getProjectType().isAudioPlugin()) | |||||
if (projectType.isAudioPlugin()) | |||||
out << " -shared"; | out << " -shared"; | ||||
{ | { | ||||
@@ -191,7 +191,7 @@ private: | |||||
if (config.getTargetBinaryRelativePath().toString().isNotEmpty()) | if (config.getTargetBinaryRelativePath().toString().isNotEmpty()) | ||||
{ | { | ||||
RelativePath binaryPath (config.getTargetBinaryRelativePath().toString(), RelativePath::projectFolder); | RelativePath binaryPath (config.getTargetBinaryRelativePath().toString(), RelativePath::projectFolder); | ||||
outputDir = binaryPath.rebased (project.getFile().getParentDirectory(), getTargetFolder(), RelativePath::buildTargetFolder).toUnixStyle(); | |||||
outputDir = binaryPath.rebased (projectFolder, getTargetFolder(), RelativePath::buildTargetFolder).toUnixStyle(); | |||||
} | } | ||||
out << "ifeq ($(CONFIG)," << escapeSpaces (config.getName().toString()) << ")" << newLine; | out << "ifeq ($(CONFIG)," << escapeSpaces (config.getName().toString()) << ")" << newLine; | ||||
@@ -207,7 +207,7 @@ private: | |||||
if (config.isDebug().getValue()) | if (config.isDebug().getValue()) | ||||
out << " -g -ggdb"; | out << " -g -ggdb"; | ||||
if (project.getProjectType().isAudioPlugin()) | |||||
if (projectType.isAudioPlugin()) | |||||
out << " -fPIC"; | out << " -fPIC"; | ||||
out << " -O" << config.getGCCOptimisationFlag() << newLine; | out << " -O" << config.getGCCOptimisationFlag() << newLine; | ||||
@@ -224,14 +224,14 @@ private: | |||||
String targetName (config.getTargetBinaryName().getValue().toString()); | String targetName (config.getTargetBinaryName().getValue().toString()); | ||||
if (project.getProjectType().isLibrary()) | |||||
if (projectType.isLibrary()) | |||||
targetName = getLibbedFilename (targetName); | targetName = getLibbedFilename (targetName); | ||||
else if (isVST()) | else if (isVST()) | ||||
targetName = targetName.upToLastOccurrenceOf (".", false, false) + ".so"; | targetName = targetName.upToLastOccurrenceOf (".", false, false) + ".so"; | ||||
out << " TARGET := " << escapeSpaces (targetName) << newLine; | out << " TARGET := " << escapeSpaces (targetName) << newLine; | ||||
if (project.getProjectType().isLibrary()) | |||||
if (projectType.isLibrary()) | |||||
out << " BLDCMD = ar -rcs $(OUTDIR)/$(TARGET) $(OBJECTS) $(TARGET_ARCH)" << newLine; | out << " BLDCMD = ar -rcs $(OUTDIR)/$(TARGET) $(OBJECTS) $(TARGET_ARCH)" << newLine; | ||||
else | else | ||||
out << " BLDCMD = $(CXX) -o $(OUTDIR)/$(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(TARGET_ARCH)" << newLine; | out << " BLDCMD = $(CXX) -o $(OUTDIR)/$(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(TARGET_ARCH)" << newLine; | ||||
@@ -257,11 +257,11 @@ private: | |||||
<< newLine; | << newLine; | ||||
out << "ifndef CONFIG" << newLine | out << "ifndef CONFIG" << newLine | ||||
<< " CONFIG=" << escapeSpaces (project.getConfiguration(0).getName().toString()) << newLine | |||||
<< " CONFIG=" << escapeSpaces (configs.getReference(0).getName().toString()) << newLine | |||||
<< "endif" << newLine | << "endif" << newLine | ||||
<< newLine; | << newLine; | ||||
if (! project.getProjectType().isLibrary()) | |||||
if (! projectType.isLibrary()) | |||||
out << "ifeq ($(TARGET_ARCH),)" << newLine | out << "ifeq ($(TARGET_ARCH),)" << newLine | ||||
<< " TARGET_ARCH := -march=native" << newLine | << " TARGET_ARCH := -march=native" << newLine | ||||
<< "endif" << newLine << newLine; | << "endif" << newLine << newLine; | ||||
@@ -271,8 +271,8 @@ private: | |||||
<< newLine; | << newLine; | ||||
int i; | int i; | ||||
for (i = 0; i < project.getNumConfigurations(); ++i) | |||||
writeConfig (out, project.getConfiguration(i)); | |||||
for (i = 0; i < configs.size(); ++i) | |||||
writeConfig (out, configs.getReference(i)); | |||||
writeObjects (out, files); | writeObjects (out, files); | ||||
@@ -280,7 +280,7 @@ private: | |||||
<< newLine; | << newLine; | ||||
out << "$(OUTDIR)/$(TARGET): $(OBJECTS) $(LDDEPS) $(RESOURCES)" << newLine | out << "$(OUTDIR)/$(TARGET): $(OBJECTS) $(LDDEPS) $(RESOURCES)" << newLine | ||||
<< "\t@echo Linking " << project.getProjectName() << newLine | |||||
<< "\t@echo Linking " << projectName << newLine | |||||
<< "\t-@mkdir -p $(BINDIR)" << newLine | << "\t-@mkdir -p $(BINDIR)" << newLine | ||||
<< "\t-@mkdir -p $(LIBDIR)" << newLine | << "\t-@mkdir -p $(LIBDIR)" << newLine | ||||
<< "\t-@mkdir -p $(OUTDIR)" << newLine | << "\t-@mkdir -p $(OUTDIR)" << newLine | ||||
@@ -288,7 +288,7 @@ private: | |||||
<< newLine; | << newLine; | ||||
out << "clean:" << newLine | out << "clean:" << newLine | ||||
<< "\t@echo Cleaning " << project.getProjectName() << newLine | |||||
<< "\t@echo Cleaning " << projectName << newLine | |||||
<< "\t-@rm -f $(OUTDIR)/$(TARGET)" << newLine | << "\t-@rm -f $(OUTDIR)/$(TARGET)" << newLine | ||||
<< "\t-@rm -rf $(OBJDIR)/*" << newLine | << "\t-@rm -rf $(OBJDIR)/*" << newLine | ||||
<< "\t-@rm -rf $(OBJDIR)" << newLine | << "\t-@rm -rf $(OBJDIR)" << newLine | ||||
@@ -91,7 +91,7 @@ public: | |||||
#endif | #endif | ||||
} | } | ||||
bool isPossibleForCurrentProject() { return project.getProjectType().isGUIApplication() || ! iPhone; } | |||||
bool isPossibleForCurrentProject() { return projectType.isGUIApplication() || ! iPhone; } | |||||
bool usesMMFiles() const { return true; } | bool usesMMFiles() const { return true; } | ||||
bool isXcode() const { return true; } | bool isXcode() const { return true; } | ||||
@@ -103,7 +103,7 @@ public: | |||||
props.getLast()->setTooltip ("Because objective-C linkage is done by string-matching, you can get horrible linkage mix-ups when different modules containing the " | 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."); | "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 (project.getProjectType().isGUIApplication() && ! iPhone) | |||||
if (projectType.isGUIApplication() && ! iPhone) | |||||
{ | { | ||||
props.add (new TextPropertyComponent (getSetting ("documentExtensions"), "Document file extensions", 128, false)); | 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."); | props.getLast()->setTooltip ("A comma-separated list of file extensions for documents that your app can open."); | ||||
@@ -164,22 +164,22 @@ private: | |||||
File getProjectBundle() const { return getTargetFolder().getChildFile (project.getProjectFilenameRoot()).withFileExtension (".xcodeproj"); } | File getProjectBundle() const { return getTargetFolder().getChildFile (project.getProjectFilenameRoot()).withFileExtension (".xcodeproj"); } | ||||
bool hasPList() const { return ! (project.getProjectType().isLibrary() || project.getProjectType().isCommandLineApp()); } | |||||
bool hasPList() const { return ! (projectType.isLibrary() || projectType.isCommandLineApp()); } | |||||
String getAudioPluginBundleExtension() const { return "component"; } | String getAudioPluginBundleExtension() const { return "component"; } | ||||
//============================================================================== | //============================================================================== | ||||
void createObjects() | void createObjects() | ||||
{ | { | ||||
if (! project.getProjectType().isLibrary()) | |||||
if (! projectType.isLibrary()) | |||||
addFrameworks(); | addFrameworks(); | ||||
const String productName (project.getConfiguration (0).getTargetBinaryName().toString()); | |||||
const String productName (configs.getReference(0).getTargetBinaryName().toString()); | |||||
if (project.getProjectType().isGUIApplication()) addBuildProduct ("wrapper.application", productName + ".app"); | |||||
else if (project.getProjectType().isCommandLineApp()) addBuildProduct ("compiled.mach-o.executable", productName); | |||||
else if (project.getProjectType().isLibrary()) addBuildProduct ("archive.ar", getLibbedFilename (productName)); | |||||
else if (project.getProjectType().isAudioPlugin()) addBuildProduct ("wrapper.cfbundle", productName + "." + getAudioPluginBundleExtension()); | |||||
else if (project.getProjectType().isBrowserPlugin()) addBuildProduct ("wrapper.cfbundle", productName + ".plugin"); | |||||
if (projectType.isGUIApplication()) addBuildProduct ("wrapper.application", productName + ".app"); | |||||
else if (projectType.isCommandLineApp()) addBuildProduct ("compiled.mach-o.executable", productName); | |||||
else if (projectType.isLibrary()) addBuildProduct ("archive.ar", getLibbedFilename (productName)); | |||||
else if (projectType.isAudioPlugin()) addBuildProduct ("wrapper.cfbundle", productName + "." + getAudioPluginBundleExtension()); | |||||
else if (projectType.isBrowserPlugin()) addBuildProduct ("wrapper.cfbundle", productName + ".plugin"); | |||||
else jassert (productName.isEmpty()); | else jassert (productName.isEmpty()); | ||||
if (hasPList()) | if (hasPList()) | ||||
@@ -197,20 +197,20 @@ private: | |||||
resourceFileRefs.add (createID (iconPath)); | resourceFileRefs.add (createID (iconPath)); | ||||
} | } | ||||
addProjectItem (project.getMainGroup()); | |||||
addProjectItem (getMainGroup()); | |||||
for (int i = 0; i < project.getNumConfigurations(); ++i) | |||||
for (int i = 0; i < configs.size(); ++i) | |||||
{ | { | ||||
Project::BuildConfiguration config (project.getConfiguration (i)); | |||||
const Project::BuildConfiguration& config = configs.getReference(i); | |||||
addProjectConfig (config.getName().getValue(), getProjectSettings (config)); | addProjectConfig (config.getName().getValue(), getProjectSettings (config)); | ||||
addTargetConfig (config.getName().getValue(), getTargetSettings (config)); | |||||
addTargetConfig (config.getName().getValue(), getTargetSettings (config)); | |||||
} | } | ||||
addConfigList (projectConfigs, createID ("__projList")); | addConfigList (projectConfigs, createID ("__projList")); | ||||
addConfigList (targetConfigs, createID ("__configList")); | addConfigList (targetConfigs, createID ("__configList")); | ||||
if (! project.getProjectType().isLibrary()) | |||||
if (! projectType.isLibrary()) | |||||
addBuildPhase ("PBXResourcesBuildPhase", resourceIDs); | addBuildPhase ("PBXResourcesBuildPhase", resourceIDs); | ||||
if (rezFileIDs.size() > 0) | if (rezFileIDs.size() > 0) | ||||
@@ -218,10 +218,10 @@ private: | |||||
addBuildPhase ("PBXSourcesBuildPhase", sourceIDs); | addBuildPhase ("PBXSourcesBuildPhase", sourceIDs); | ||||
if (! project.getProjectType().isLibrary()) | |||||
if (! projectType.isLibrary()) | |||||
addBuildPhase ("PBXFrameworksBuildPhase", frameworkIDs); | addBuildPhase ("PBXFrameworksBuildPhase", frameworkIDs); | ||||
if (project.getProjectType().isAudioPlugin()) | |||||
if (projectType.isAudioPlugin()) | |||||
addPluginShellScriptPhase(); | addPluginShellScriptPhase(); | ||||
addTargetObject(); | addTargetObject(); | ||||
@@ -345,9 +345,9 @@ private: | |||||
addPlistDictionaryKey (dict, "CFBundleExecutable", "${EXECUTABLE_NAME}"); | addPlistDictionaryKey (dict, "CFBundleExecutable", "${EXECUTABLE_NAME}"); | ||||
addPlistDictionaryKey (dict, "CFBundleIconFile", iconFile.exists() ? iconFile.getFileName() : String::empty); | addPlistDictionaryKey (dict, "CFBundleIconFile", iconFile.exists() ? iconFile.getFileName() : String::empty); | ||||
addPlistDictionaryKey (dict, "CFBundleIdentifier", project.getBundleIdentifier().toString()); | addPlistDictionaryKey (dict, "CFBundleIdentifier", project.getBundleIdentifier().toString()); | ||||
addPlistDictionaryKey (dict, "CFBundleName", project.getProjectName().toString()); | |||||
addPlistDictionaryKey (dict, "CFBundleName", projectName); | |||||
if (project.getProjectType().isAudioPlugin()) | |||||
if (projectType.isAudioPlugin()) | |||||
{ | { | ||||
addPlistDictionaryKey (dict, "CFBundlePackageType", "TDMw"); | addPlistDictionaryKey (dict, "CFBundlePackageType", "TDMw"); | ||||
addPlistDictionaryKey (dict, "CFBundleSignature", "PTul"); | addPlistDictionaryKey (dict, "CFBundleSignature", "PTul"); | ||||
@@ -423,7 +423,7 @@ private: | |||||
void getLinkerFlags (const Project::BuildConfiguration& config, StringArray& flags, StringArray& librarySearchPaths) | void getLinkerFlags (const Project::BuildConfiguration& config, StringArray& flags, StringArray& librarySearchPaths) | ||||
{ | { | ||||
if (project.getProjectType().isAudioPlugin()) | |||||
if (projectType.isAudioPlugin()) | |||||
{ | { | ||||
flags.add ("-bundle"); | flags.add ("-bundle"); | ||||
@@ -461,7 +461,7 @@ private: | |||||
s.add ("WARNING_CFLAGS = -Wreorder"); | s.add ("WARNING_CFLAGS = -Wreorder"); | ||||
s.add ("GCC_MODEL_TUNING = G5"); | s.add ("GCC_MODEL_TUNING = G5"); | ||||
if (project.getProjectType().isLibrary() || project.getJuceLinkageMode() == Project::useLinkedJuce) | |||||
if (projectType.isLibrary() || project.getJuceLinkageMode() == Project::useLinkedJuce) | |||||
{ | { | ||||
s.add ("GCC_INLINES_ARE_PRIVATE_EXTERN = NO"); | s.add ("GCC_INLINES_ARE_PRIVATE_EXTERN = NO"); | ||||
s.add ("GCC_SYMBOLS_PRIVATE_EXTERN = NO"); | s.add ("GCC_SYMBOLS_PRIVATE_EXTERN = NO"); | ||||
@@ -506,11 +506,11 @@ private: | |||||
if (extraFlags.isNotEmpty()) | if (extraFlags.isNotEmpty()) | ||||
s.add ("OTHER_CPLUSPLUSFLAGS = " + extraFlags); | s.add ("OTHER_CPLUSPLUSFLAGS = " + extraFlags); | ||||
if (project.getProjectType().isGUIApplication()) | |||||
if (projectType.isGUIApplication()) | |||||
{ | { | ||||
s.add ("INSTALL_PATH = \"$(HOME)/Applications\""); | s.add ("INSTALL_PATH = \"$(HOME)/Applications\""); | ||||
} | } | ||||
else if (project.getProjectType().isAudioPlugin()) | |||||
else if (projectType.isAudioPlugin()) | |||||
{ | { | ||||
s.add ("LIBRARY_STYLE = Bundle"); | s.add ("LIBRARY_STYLE = Bundle"); | ||||
s.add ("INSTALL_PATH = \"$(HOME)/Library/Audio/Plug-Ins/Components/\""); | s.add ("INSTALL_PATH = \"$(HOME)/Library/Audio/Plug-Ins/Components/\""); | ||||
@@ -520,17 +520,17 @@ private: | |||||
" -I /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Versions/A/Headers" | " -I /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Versions/A/Headers" | ||||
" -I \\\"$(DEVELOPER_DIR)/Extras/CoreAudio/AudioUnits/AUPublic/AUBase\\\"\""); | " -I \\\"$(DEVELOPER_DIR)/Extras/CoreAudio/AudioUnits/AUPublic/AUBase\\\"\""); | ||||
} | } | ||||
else if (project.getProjectType().isBrowserPlugin()) | |||||
else if (projectType.isBrowserPlugin()) | |||||
{ | { | ||||
s.add ("LIBRARY_STYLE = Bundle"); | s.add ("LIBRARY_STYLE = Bundle"); | ||||
s.add ("INSTALL_PATH = \"/Library/Internet Plug-Ins/\""); | s.add ("INSTALL_PATH = \"/Library/Internet Plug-Ins/\""); | ||||
} | } | ||||
else if (project.getProjectType().isLibrary()) | |||||
else if (projectType.isLibrary()) | |||||
{ | { | ||||
if (config.getTargetBinaryRelativePath().toString().isNotEmpty()) | if (config.getTargetBinaryRelativePath().toString().isNotEmpty()) | ||||
{ | { | ||||
RelativePath binaryPath (config.getTargetBinaryRelativePath().toString(), RelativePath::projectFolder); | RelativePath binaryPath (config.getTargetBinaryRelativePath().toString(), RelativePath::projectFolder); | ||||
binaryPath = binaryPath.rebased (project.getFile().getParentDirectory(), getTargetFolder(), RelativePath::buildTargetFolder); | |||||
binaryPath = binaryPath.rebased (projectFolder, getTargetFolder(), RelativePath::buildTargetFolder); | |||||
s.add ("DSTROOT = " + sanitisePath (binaryPath.toUnixStyle())); | s.add ("DSTROOT = " + sanitisePath (binaryPath.toUnixStyle())); | ||||
s.add ("SYMROOT = " + sanitisePath (binaryPath.toUnixStyle())); | s.add ("SYMROOT = " + sanitisePath (binaryPath.toUnixStyle())); | ||||
@@ -539,7 +539,7 @@ private: | |||||
s.add ("CONFIGURATION_BUILD_DIR = \"$(BUILD_DIR)\""); | s.add ("CONFIGURATION_BUILD_DIR = \"$(BUILD_DIR)\""); | ||||
s.add ("DEPLOYMENT_LOCATION = YES"); | s.add ("DEPLOYMENT_LOCATION = YES"); | ||||
} | } | ||||
else if (project.getProjectType().isCommandLineApp()) | |||||
else if (projectType.isCommandLineApp()) | |||||
{ | { | ||||
} | } | ||||
else | else | ||||
@@ -960,26 +960,26 @@ private: | |||||
v->setProperty ("buildPhases", "(" + indentList (buildPhaseIDs, ",") + " )", 0); | v->setProperty ("buildPhases", "(" + indentList (buildPhaseIDs, ",") + " )", 0); | ||||
v->setProperty ("buildRules", "( )", 0); | v->setProperty ("buildRules", "( )", 0); | ||||
v->setProperty ("dependencies", "( )", 0); | v->setProperty ("dependencies", "( )", 0); | ||||
v->setProperty (Ids::name, project.getDocumentTitle(), 0); | |||||
v->setProperty ("productName", project.getDocumentTitle(), 0); | |||||
v->setProperty (Ids::name, projectName, 0); | |||||
v->setProperty ("productName", projectName, 0); | |||||
v->setProperty ("productReference", createID ("__productFileID"), 0); | v->setProperty ("productReference", createID ("__productFileID"), 0); | ||||
if (project.getProjectType().isGUIApplication()) | |||||
if (projectType.isGUIApplication()) | |||||
{ | { | ||||
v->setProperty ("productInstallPath", "$(HOME)/Applications", 0); | v->setProperty ("productInstallPath", "$(HOME)/Applications", 0); | ||||
v->setProperty ("productType", "com.apple.product-type.application", 0); | v->setProperty ("productType", "com.apple.product-type.application", 0); | ||||
} | } | ||||
else if (project.getProjectType().isCommandLineApp()) | |||||
else if (projectType.isCommandLineApp()) | |||||
{ | { | ||||
v->setProperty ("productInstallPath", "/usr/bin", 0); | v->setProperty ("productInstallPath", "/usr/bin", 0); | ||||
v->setProperty ("productType", "com.apple.product-type.tool", 0); | v->setProperty ("productType", "com.apple.product-type.tool", 0); | ||||
} | } | ||||
else if (project.getProjectType().isAudioPlugin() || project.getProjectType().isBrowserPlugin()) | |||||
else if (projectType.isAudioPlugin() || projectType.isBrowserPlugin()) | |||||
{ | { | ||||
v->setProperty ("productInstallPath", "$(HOME)/Library/Audio/Plug-Ins/Components/", 0); | v->setProperty ("productInstallPath", "$(HOME)/Library/Audio/Plug-Ins/Components/", 0); | ||||
v->setProperty ("productType", "com.apple.product-type.bundle", 0); | v->setProperty ("productType", "com.apple.product-type.bundle", 0); | ||||
} | } | ||||
else if (project.getProjectType().isLibrary()) | |||||
else if (projectType.isLibrary()) | |||||
{ | { | ||||
v->setProperty ("productType", "com.apple.product-type.library.static", 0); | v->setProperty ("productType", "com.apple.product-type.library.static", 0); | ||||
} | } | ||||
@@ -996,7 +996,7 @@ private: | |||||
v->setProperty ("buildConfigurationList", createID ("__projList"), 0); | v->setProperty ("buildConfigurationList", createID ("__projList"), 0); | ||||
v->setProperty ("compatibilityVersion", "Xcode 3.1", 0); | v->setProperty ("compatibilityVersion", "Xcode 3.1", 0); | ||||
v->setProperty ("hasScannedForEncodings", (int) 0, 0); | v->setProperty ("hasScannedForEncodings", (int) 0, 0); | ||||
v->setProperty ("mainGroup", getIDForGroup (project.getMainGroup()), 0); | |||||
v->setProperty ("mainGroup", getIDForGroup (getMainGroup()), 0); | |||||
v->setProperty ("projectDirPath", "\"\"", 0); | v->setProperty ("projectDirPath", "\"\"", 0); | ||||
v->setProperty ("projectRoot", "\"\"", 0); | v->setProperty ("projectRoot", "\"\"", 0); | ||||
v->setProperty ("targets", "( " + createID ("__target") + " )", 0); | v->setProperty ("targets", "( " + createID ("__target") + " )", 0); | ||||
@@ -30,17 +30,6 @@ | |||||
#include "jucer_ProjectExport_Android.h" | #include "jucer_ProjectExport_Android.h" | ||||
//============================================================================== | |||||
ProjectExporter::ProjectExporter (Project& project_, const ValueTree& settings_) | |||||
: project (project_), | |||||
settings (settings_) | |||||
{ | |||||
} | |||||
ProjectExporter::~ProjectExporter() | |||||
{ | |||||
} | |||||
//============================================================================== | //============================================================================== | ||||
int ProjectExporter::getNumExporters() | int ProjectExporter::getNumExporters() | ||||
{ | { | ||||
@@ -126,6 +115,22 @@ ProjectExporter* ProjectExporter::createPlatformDefaultExporter (Project& projec | |||||
return best.release(); | return best.release(); | ||||
} | } | ||||
//============================================================================== | |||||
ProjectExporter::ProjectExporter (Project& project_, const ValueTree& settings_) | |||||
: project (project_), | |||||
projectType (project_.getProjectType()), | |||||
projectName (project_.getProjectName().toString()), | |||||
projectFolder (project_.getFile().getParentDirectory()), | |||||
settings (settings_) | |||||
{ | |||||
for (int i = 0; i < jmax (1, project.getNumConfigurations()); ++i) | |||||
configs.add (project.getConfiguration (i)); | |||||
} | |||||
ProjectExporter::~ProjectExporter() | |||||
{ | |||||
} | |||||
void ProjectExporter::createLibraryModules() | void ProjectExporter::createLibraryModules() | ||||
{ | { | ||||
libraryModules.clear(); | libraryModules.clear(); | ||||
@@ -219,3 +224,39 @@ String ProjectExporter::replacePreprocessorTokens (const Project::BuildConfigura | |||||
{ | { | ||||
return replacePreprocessorDefs (getAllPreprocessorDefs (config), sourceString); | return replacePreprocessorDefs (getAllPreprocessorDefs (config), sourceString); | ||||
} | } | ||||
Image ProjectExporter::getBestIconForSize (int size, bool returnNullIfNothingBigEnough) | |||||
{ | |||||
Image im; | |||||
const Image im1 (project.getSmallIcon()); | |||||
const Image im2 (project.getBigIcon()); | |||||
if (im1.isValid() && im2.isValid()) | |||||
{ | |||||
if (im1.getWidth() >= size && im2.getWidth() >= size) | |||||
im = im1.getWidth() < im2.getWidth() ? im1 : im2; | |||||
else if (im1.getWidth() >= size) | |||||
im = im1; | |||||
else if (im2.getWidth() >= size) | |||||
im = im2; | |||||
else | |||||
return Image::null; | |||||
} | |||||
else | |||||
{ | |||||
im = im1.isValid() ? im1 : im2; | |||||
} | |||||
if (size == im.getWidth() && size == im.getHeight()) | |||||
return im; | |||||
if (returnNullIfNothingBigEnough && im.getWidth() < size && im.getHeight() < size) | |||||
return Image::null; | |||||
Image newIm (Image::ARGB, size, size, true, Image::SoftwareImage); | |||||
Graphics g (newIm); | |||||
g.drawImageWithin (im, 0, 0, size, size, | |||||
RectanglePlacement::centred | RectanglePlacement::onlyReduceInSize, false); | |||||
return newIm; | |||||
} |
@@ -121,7 +121,7 @@ public: | |||||
String message; | String message; | ||||
}; | }; | ||||
Project::Item& getMainGroup(); | |||||
Project::Item getMainGroup() { return project.getMainGroup(); } | |||||
RelativePath getJucePathFromTargetFolder() const; | RelativePath getJucePathFromTargetFolder() const; | ||||
RelativePath getJucePathFromProjectFolder() const; | RelativePath getJucePathFromProjectFolder() const; | ||||
@@ -133,9 +133,13 @@ public: | |||||
protected: | protected: | ||||
//============================================================================== | //============================================================================== | ||||
String name; | |||||
Project& project; | Project& project; | ||||
const ProjectType& projectType; | |||||
const String projectName; | |||||
const File projectFolder; | |||||
Array<Project::BuildConfiguration> configs; | |||||
ValueTree settings; | ValueTree settings; | ||||
String name; | |||||
static String getDefaultBuildsRootFolder() { return "Builds/"; } | static String getDefaultBuildsRootFolder() { return "Builds/"; } | ||||
@@ -148,6 +152,8 @@ protected: | |||||
return name; | return name; | ||||
} | } | ||||
Image getBestIconForSize (int size, bool returnNullIfNothingBigEnough); | |||||
//============================================================================== | //============================================================================== | ||||
static void overwriteFileIfDifferentOrThrow (const File& file, const MemoryOutputStream& newData) | static void overwriteFileIfDifferentOrThrow (const File& file, const MemoryOutputStream& newData) | ||||
{ | { | ||||
@@ -254,7 +254,7 @@ END_JUCE_NAMESPACE | |||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 | #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 | ||||
NSNumber* hosttime = (NSNumber*) [sampleBuffer attributeForKey: QTSampleBufferHostTimeAttribute]; | NSNumber* hosttime = (NSNumber*) [sampleBuffer attributeForKey: QTSampleBufferHostTimeAttribute]; | ||||
#else | #else | ||||
NSNumber* hosttime = (NSNumber*) [sampleBuffer attributeForKey: @"hostTime"]; | |||||
NSNumber* hosttime = (NSNumber*) [sampleBuffer attributeForKey: nsStringLiteral ("hostTime")]; | |||||
#endif | #endif | ||||
int64 presentationTime = (hosttime != nil) | int64 presentationTime = (hosttime != nil) | ||||
@@ -353,10 +353,10 @@ void CameraDevice::startRecordingToFile (const File& file, int quality) | |||||
if ([mediaType isEqualToString: QTMediaTypeVideo]) | if ([mediaType isEqualToString: QTMediaTypeVideo]) | ||||
options = [QTCompressionOptions compressionOptionsWithIdentifier: | options = [QTCompressionOptions compressionOptionsWithIdentifier: | ||||
quality >= 1 ? @"QTCompressionOptionsSD480SizeH264Video" | |||||
: @"QTCompressionOptions240SizeH264Video"]; | |||||
quality >= 1 ? nsStringLiteral ("QTCompressionOptionsSD480SizeH264Video")_ | |||||
nsStringLiteral ("QTCompressionOptions240SizeH264Video")]; | |||||
else if ([mediaType isEqualToString: QTMediaTypeSound]) | else if ([mediaType isEqualToString: QTMediaTypeSound]) | ||||
options = [QTCompressionOptions compressionOptionsWithIdentifier: @"QTCompressionOptionsHighQualityAACAudio"]; | |||||
options = [QTCompressionOptions compressionOptionsWithIdentifier: nsStringLiteral ("QTCompressionOptionsHighQualityAACAudio")]; | |||||
[d->fileOutput setCompressionOptions: options forConnection: connection]; | [d->fileOutput setCompressionOptions: options forConnection: connection]; | ||||
} | } | ||||
@@ -264,7 +264,7 @@ String File::getVersion() const | |||||
if (info != nil) | if (info != nil) | ||||
{ | { | ||||
NSString* name = [info valueForKey: @"CFBundleShortVersionString"]; | |||||
NSString* name = [info valueForKey: nsStringLiteral ("CFBundleShortVersionString")]; | |||||
if (name != nil) | if (name != nil) | ||||
result = nsStringToJuce (name); | result = nsStringToJuce (name); | ||||
@@ -307,7 +307,7 @@ bool File::moveToTrash() const | |||||
return [[NSWorkspace sharedWorkspace] | return [[NSWorkspace sharedWorkspace] | ||||
performFileOperation: NSWorkspaceRecycleOperation | performFileOperation: NSWorkspaceRecycleOperation | ||||
source: [p stringByDeletingLastPathComponent] | source: [p stringByDeletingLastPathComponent] | ||||
destination: @"" | |||||
destination: nsEmptyString() | |||||
files: [NSArray arrayWithObject: [p lastPathComponent]] | files: [NSArray arrayWithObject: [p lastPathComponent]] | ||||
tag: nil ]; | tag: nil ]; | ||||
#endif | #endif | ||||
@@ -433,7 +433,7 @@ void File::revealToUser() const | |||||
{ | { | ||||
#if ! JUCE_IOS | #if ! JUCE_IOS | ||||
if (exists()) | if (exists()) | ||||
[[NSWorkspace sharedWorkspace] selectFile: juceStringToNS (getFullPathName()) inFileViewerRootedAtPath: @""]; | |||||
[[NSWorkspace sharedWorkspace] selectFile: juceStringToNS (getFullPathName()) inFileViewerRootedAtPath: nsEmptyString()]; | |||||
else if (getParentDirectory().exists()) | else if (getParentDirectory().exists()) | ||||
getParentDirectory().revealToUser(); | getParentDirectory().revealToUser(); | ||||
#endif | #endif | ||||
@@ -96,7 +96,7 @@ public: | |||||
{ | { | ||||
NSMenuItem* item = [parent addItemWithTitle: juceStringToNS (name) | NSMenuItem* item = [parent addItemWithTitle: juceStringToNS (name) | ||||
action: nil | action: nil | ||||
keyEquivalent: @""]; | |||||
keyEquivalent: nsEmptyString()]; | |||||
[item setTag: tag]; | [item setTag: tag]; | ||||
NSMenu* sub = createMenu (child, name, menuId, tag); | NSMenu* sub = createMenu (child, name, menuId, tag); | ||||
@@ -200,7 +200,7 @@ public: | |||||
NSString* text = juceStringToNS (iter.itemName.upToFirstOccurrenceOf ("<end>", false, true)); | NSString* text = juceStringToNS (iter.itemName.upToFirstOccurrenceOf ("<end>", false, true)); | ||||
if (text == nil) | if (text == nil) | ||||
text = @""; | |||||
text = nsEmptyString(); | |||||
if (iter.isSeparator) | if (iter.isSeparator) | ||||
{ | { | ||||
@@ -210,7 +210,7 @@ public: | |||||
{ | { | ||||
NSMenuItem* item = [menuToAddTo addItemWithTitle: text | NSMenuItem* item = [menuToAddTo addItemWithTitle: text | ||||
action: nil | action: nil | ||||
keyEquivalent: @""]; | |||||
keyEquivalent: nsEmptyString()]; | |||||
[item setEnabled: false]; | [item setEnabled: false]; | ||||
} | } | ||||
@@ -218,7 +218,7 @@ public: | |||||
{ | { | ||||
NSMenuItem* item = [menuToAddTo addItemWithTitle: text | NSMenuItem* item = [menuToAddTo addItemWithTitle: text | ||||
action: nil | action: nil | ||||
keyEquivalent: @""]; | |||||
keyEquivalent: nsEmptyString()]; | |||||
[item setTag: iter.itemId]; | [item setTag: iter.itemId]; | ||||
[item setEnabled: iter.isEnabled]; | [item setEnabled: iter.isEnabled]; | ||||
@@ -232,7 +232,7 @@ public: | |||||
{ | { | ||||
NSMenuItem* item = [menuToAddTo addItemWithTitle: text | NSMenuItem* item = [menuToAddTo addItemWithTitle: text | ||||
action: @selector (menuItemInvoked:) | action: @selector (menuItemInvoked:) | ||||
keyEquivalent: @""]; | |||||
keyEquivalent: nsEmptyString()]; | |||||
[item setTag: iter.itemId]; | [item setTag: iter.itemId]; | ||||
[item setEnabled: iter.isEnabled]; | [item setEnabled: iter.isEnabled]; | ||||
@@ -315,7 +315,7 @@ private: | |||||
static void flashMenuBar (NSMenu* menu) | static void flashMenuBar (NSMenu* menu) | ||||
{ | { | ||||
if ([[menu title] isEqualToString: @"Apple"]) | |||||
if ([[menu title] isEqualToString: nsStringLiteral ("Apple")]) | |||||
return; | return; | ||||
[menu retain]; | [menu retain]; | ||||
@@ -323,7 +323,7 @@ private: | |||||
const unichar f35Key = NSF35FunctionKey; | const unichar f35Key = NSF35FunctionKey; | ||||
NSString* f35String = [NSString stringWithCharacters: &f35Key length: 1]; | NSString* f35String = [NSString stringWithCharacters: &f35Key length: 1]; | ||||
NSMenuItem* item = [[NSMenuItem alloc] initWithTitle: @"x" | |||||
NSMenuItem* item = [[NSMenuItem alloc] initWithTitle: nsStringLiteral ("x") | |||||
action: nil | action: nil | ||||
keyEquivalent: f35String]; | keyEquivalent: f35String]; | ||||
[item setTarget: nil]; | [item setTarget: nil]; | ||||
@@ -480,11 +480,11 @@ namespace MainMenuHelpers | |||||
NSMenuItem* item; | NSMenuItem* item; | ||||
// Services... | // Services... | ||||
item = [[NSMenuItem alloc] initWithTitle: NSLocalizedString (@"Services", nil) | |||||
action: nil keyEquivalent: @""]; | |||||
item = [[NSMenuItem alloc] initWithTitle: NSLocalizedString (nsStringLiteral ("Services"), nil) | |||||
action: nil keyEquivalent: nsEmptyString()]; | |||||
[menu addItem: item]; | [menu addItem: item]; | ||||
[item release]; | [item release]; | ||||
NSMenu* servicesMenu = [[NSMenu alloc] initWithTitle: @"Services"]; | |||||
NSMenu* servicesMenu = [[NSMenu alloc] initWithTitle: nsStringLiteral ("Services")]; | |||||
[menu setSubmenu: servicesMenu forItem: item]; | [menu setSubmenu: servicesMenu forItem: item]; | ||||
[NSApp setServicesMenu: servicesMenu]; | [NSApp setServicesMenu: servicesMenu]; | ||||
[servicesMenu release]; | [servicesMenu release]; | ||||
@@ -492,20 +492,20 @@ namespace MainMenuHelpers | |||||
// Hide + Show stuff... | // Hide + Show stuff... | ||||
item = [[NSMenuItem alloc] initWithTitle: juceStringToNS ("Hide " + appName) | item = [[NSMenuItem alloc] initWithTitle: juceStringToNS ("Hide " + appName) | ||||
action: @selector (hide:) keyEquivalent: @"h"]; | |||||
action: @selector (hide:) keyEquivalent: nsStringLiteral ("h")]; | |||||
[item setTarget: NSApp]; | [item setTarget: NSApp]; | ||||
[menu addItem: item]; | [menu addItem: item]; | ||||
[item release]; | [item release]; | ||||
item = [[NSMenuItem alloc] initWithTitle: NSLocalizedString (@"Hide Others", nil) | |||||
action: @selector (hideOtherApplications:) keyEquivalent: @"h"]; | |||||
item = [[NSMenuItem alloc] initWithTitle: NSLocalizedString (nsStringLiteral ("Hide Others"), nil) | |||||
action: @selector (hideOtherApplications:) keyEquivalent: nsStringLiteral ("h")]; | |||||
[item setKeyEquivalentModifierMask: NSCommandKeyMask | NSAlternateKeyMask]; | [item setKeyEquivalentModifierMask: NSCommandKeyMask | NSAlternateKeyMask]; | ||||
[item setTarget: NSApp]; | [item setTarget: NSApp]; | ||||
[menu addItem: item]; | [menu addItem: item]; | ||||
[item release]; | [item release]; | ||||
item = [[NSMenuItem alloc] initWithTitle: NSLocalizedString (@"Show All", nil) | |||||
action: @selector (unhideAllApplications:) keyEquivalent: @""]; | |||||
item = [[NSMenuItem alloc] initWithTitle: NSLocalizedString (nsStringLiteral ("Show All"), nil) | |||||
action: @selector (unhideAllApplications:) keyEquivalent: nsEmptyString()]; | |||||
[item setTarget: NSApp]; | [item setTarget: NSApp]; | ||||
[menu addItem: item]; | [menu addItem: item]; | ||||
[item release]; | [item release]; | ||||
@@ -514,7 +514,7 @@ namespace MainMenuHelpers | |||||
// Quit item.... | // Quit item.... | ||||
item = [[NSMenuItem alloc] initWithTitle: juceStringToNS ("Quit " + appName) | item = [[NSMenuItem alloc] initWithTitle: juceStringToNS ("Quit " + appName) | ||||
action: @selector (terminate:) keyEquivalent: @"q"]; | |||||
action: @selector (terminate:) keyEquivalent: nsStringLiteral ("q")]; | |||||
[item setTarget: NSApp]; | [item setTarget: NSApp]; | ||||
[menu addItem: item]; | [menu addItem: item]; | ||||
@@ -533,10 +533,10 @@ namespace MainMenuHelpers | |||||
{ | { | ||||
JUCE_AUTORELEASEPOOL | JUCE_AUTORELEASEPOOL | ||||
NSMenu* mainMenu = [[NSMenu alloc] initWithTitle: @"MainMenu"]; | |||||
NSMenuItem* item = [mainMenu addItemWithTitle: @"Apple" action: nil keyEquivalent: @""]; | |||||
NSMenu* mainMenu = [[NSMenu alloc] initWithTitle: nsStringLiteral ("MainMenu")]; | |||||
NSMenuItem* item = [mainMenu addItemWithTitle: nsStringLiteral ("Apple") action: nil keyEquivalent: nsEmptyString()]; | |||||
NSMenu* appMenu = [[NSMenu alloc] initWithTitle: @"Apple"]; | |||||
NSMenu* appMenu = [[NSMenu alloc] initWithTitle: nsStringLiteral ("Apple")]; | |||||
[NSApp performSelector: @selector (setAppleMenu:) withObject: appMenu]; | [NSApp performSelector: @selector (setAppleMenu:) withObject: appMenu]; | ||||
[mainMenu setSubmenu: appMenu forItem: item]; | [mainMenu setSubmenu: appMenu forItem: item]; | ||||
@@ -285,7 +285,7 @@ using namespace JUCE_NAMESPACE; | |||||
- (void) broadcastMessageCallback: (NSNotification*) n | - (void) broadcastMessageCallback: (NSNotification*) n | ||||
{ | { | ||||
NSDictionary* dict = (NSDictionary*) [n userInfo]; | NSDictionary* dict = (NSDictionary*) [n userInfo]; | ||||
const String messageString (nsStringToJuce ((NSString*) [dict valueForKey: @"message"])); | |||||
const String messageString (nsStringToJuce ((NSString*) [dict valueForKey: nsStringLiteral ("message")])); | |||||
MessageManager::getInstance()->deliverBroadcastMessage (messageString); | MessageManager::getInstance()->deliverBroadcastMessage (messageString); | ||||
} | } | ||||
@@ -406,7 +406,7 @@ bool MessageManager::postMessageToSystemQueue (Message* message) | |||||
void MessageManager::broadcastMessage (const String& message) | void MessageManager::broadcastMessage (const String& message) | ||||
{ | { | ||||
NSDictionary* info = [NSDictionary dictionaryWithObject: juceStringToNS (message) | NSDictionary* info = [NSDictionary dictionaryWithObject: juceStringToNS (message) | ||||
forKey: @"message"]; | |||||
forKey: nsStringLiteral ("message")]; | |||||
[[NSDistributedNotificationCenter defaultCenter] postNotificationName: AppDelegateRedirector::getBroacastEventName() | [[NSDistributedNotificationCenter defaultCenter] postNotificationName: AppDelegateRedirector::getBroacastEventName() | ||||
object: nil | object: nil | ||||
@@ -1543,7 +1543,7 @@ BOOL NSViewComponentPeer::sendDragCallback (const int type, id <NSDraggingInfo> | |||||
NSPasteboard* pasteBoard = [sender draggingPasteboard]; | NSPasteboard* pasteBoard = [sender draggingPasteboard]; | ||||
StringArray files; | StringArray files; | ||||
NSString* iTunesPasteboardType = @"CorePasteboardFlavorType 0x6974756E"; // 'itun' | |||||
NSString* iTunesPasteboardType = nsStringLiteral ("CorePasteboardFlavorType 0x6974756E"); // 'itun' | |||||
if (bestType == NSFilesPromisePboardType | if (bestType == NSFilesPromisePboardType | ||||
&& [[pasteBoard types] containsObject: iTunesPasteboardType]) | && [[pasteBoard types] containsObject: iTunesPasteboardType]) | ||||
@@ -1553,13 +1553,13 @@ BOOL NSViewComponentPeer::sendDragCallback (const int type, id <NSDraggingInfo> | |||||
if ([list isKindOfClass: [NSDictionary class]]) | if ([list isKindOfClass: [NSDictionary class]]) | ||||
{ | { | ||||
NSDictionary* iTunesDictionary = (NSDictionary*) list; | NSDictionary* iTunesDictionary = (NSDictionary*) list; | ||||
NSArray* tracks = [iTunesDictionary valueForKey: @"Tracks"]; | |||||
NSArray* tracks = [iTunesDictionary valueForKey: nsStringLiteral ("Tracks")]; | |||||
NSEnumerator* enumerator = [tracks objectEnumerator]; | NSEnumerator* enumerator = [tracks objectEnumerator]; | ||||
NSDictionary* track; | NSDictionary* track; | ||||
while ((track = [enumerator nextObject]) != nil) | while ((track = [enumerator nextObject]) != nil) | ||||
{ | { | ||||
NSURL* url = [NSURL URLWithString: [track valueForKey: @"Location"]]; | |||||
NSURL* url = [NSURL URLWithString: [track valueForKey: nsStringLiteral ("Location")]]; | |||||
if ([url isFileURL]) | if ([url isFileURL]) | ||||
files.add (nsStringToJuce ([url path])); | files.add (nsStringToJuce ([url path])); | ||||
@@ -429,7 +429,7 @@ private: | |||||
if (req == nil) | if (req == nil) | ||||
return nil; | return nil; | ||||
[req setHTTPMethod: isPost ? @"POST" : @"GET"]; | |||||
[req setHTTPMethod: nsStringLiteral (isPost ? "POST" : "GET")]; | |||||
//[req setCachePolicy: NSURLRequestReloadIgnoringLocalAndRemoteCacheData]; | //[req setCachePolicy: NSURLRequestReloadIgnoringLocalAndRemoteCacheData]; | ||||
StringArray headerLines; | StringArray headerLines; | ||||
@@ -123,7 +123,7 @@ static QTMovie* openMovieFromStream (InputStream* movieStream, File& movieFile) | |||||
movie = [QTMovie movieWithDataReference: [QTDataReference dataReferenceWithReferenceToData: [NSData dataWithBytes: temp.getData() | movie = [QTMovie movieWithDataReference: [QTDataReference dataReferenceWithReferenceToData: [NSData dataWithBytes: temp.getData() | ||||
length: temp.getSize()] | length: temp.getSize()] | ||||
name: [NSString stringWithUTF8String: suffixesToTry[i]] | name: [NSString stringWithUTF8String: suffixesToTry[i]] | ||||
MIMEType: @""] | |||||
MIMEType: nsEmptyString()] | |||||
error: nil]; | error: nil]; | ||||
if (movie != 0) | if (movie != 0) | ||||
@@ -67,7 +67,7 @@ END_JUCE_NAMESPACE | |||||
(void) request; | (void) request; | ||||
(void) frame; | (void) frame; | ||||
NSURL* url = [actionInformation valueForKey: @"WebActionOriginalURLKey"]; | |||||
NSURL* url = [actionInformation valueForKey: nsStringLiteral ("WebActionOriginalURLKey")]; | |||||
if (ownerComponent->pageAboutToLoad (nsStringToJuce ([url absoluteString]))) | if (ownerComponent->pageAboutToLoad (nsStringToJuce ([url absoluteString]))) | ||||
[listener use]; | [listener use]; | ||||
@@ -86,8 +86,8 @@ public: | |||||
WebBrowserComponentInternal (WebBrowserComponent* owner) | WebBrowserComponentInternal (WebBrowserComponent* owner) | ||||
{ | { | ||||
webView = [[WebView alloc] initWithFrame: NSMakeRect (0, 0, 100.0f, 100.0f) | webView = [[WebView alloc] initWithFrame: NSMakeRect (0, 0, 100.0f, 100.0f) | ||||
frameName: @"" | |||||
groupName: @""]; | |||||
frameName: nsEmptyString() | |||||
groupName: nsEmptyString()]; | |||||
setView (webView); | setView (webView); | ||||
clickListener = [[DownloadClickDetector alloc] initWithWebBrowserOwner: owner]; | clickListener = [[DownloadClickDetector alloc] initWithWebBrowserOwner: owner]; | ||||
@@ -112,7 +112,7 @@ public: | |||||
if (postData != nullptr && postData->getSize() > 0) | if (postData != nullptr && postData->getSize() > 0) | ||||
{ | { | ||||
[r setHTTPMethod: @"POST"]; | |||||
[r setHTTPMethod: nsStringLiteral ("POST")]; | |||||
[r setHTTPBody: [NSData dataWithBytes: postData->getData() | [r setHTTPBody: [NSData dataWithBytes: postData->getData() | ||||
length: postData->getSize()]]; | length: postData->getSize()]]; | ||||
} | } | ||||
@@ -104,7 +104,7 @@ void JUCE_CALLTYPE NativeMessageBox::showMessageBox (AlertWindow::AlertIconType | |||||
const String& title, const String& message, | const String& title, const String& message, | ||||
Component* associatedComponent) | Component* associatedComponent) | ||||
{ | { | ||||
OSXMessageBox box (iconType, title, message, @"OK", nil, nil, 0, false); | |||||
OSXMessageBox box (iconType, title, message, nsStringLiteral ("OK"), nil, nil, 0, false); | |||||
(void) box.getResult(); | (void) box.getResult(); | ||||
} | } | ||||
@@ -112,7 +112,7 @@ void JUCE_CALLTYPE NativeMessageBox::showMessageBoxAsync (AlertWindow::AlertIcon | |||||
const String& title, const String& message, | const String& title, const String& message, | ||||
Component* associatedComponent) | Component* associatedComponent) | ||||
{ | { | ||||
new OSXMessageBox (iconType, title, message, @"OK", nil, nil, 0, true); | |||||
new OSXMessageBox (iconType, title, message, nsStringLiteral ("OK"), nil, nil, 0, true); | |||||
} | } | ||||
bool JUCE_CALLTYPE NativeMessageBox::showOkCancelBox (AlertWindow::AlertIconType iconType, | bool JUCE_CALLTYPE NativeMessageBox::showOkCancelBox (AlertWindow::AlertIconType iconType, | ||||
@@ -121,7 +121,9 @@ bool JUCE_CALLTYPE NativeMessageBox::showOkCancelBox (AlertWindow::AlertIconType | |||||
ModalComponentManager::Callback* callback) | ModalComponentManager::Callback* callback) | ||||
{ | { | ||||
ScopedPointer<OSXMessageBox> mb (new OSXMessageBox (iconType, title, message, | ScopedPointer<OSXMessageBox> mb (new OSXMessageBox (iconType, title, message, | ||||
@"OK", @"Cancel", nil, callback, callback != nullptr)); | |||||
nsStringLiteral ("OK"), | |||||
nsStringLiteral ("Cancel"), | |||||
nil, callback, callback != nullptr)); | |||||
if (callback == nullptr) | if (callback == nullptr) | ||||
return mb->getResult() == 1; | return mb->getResult() == 1; | ||||
@@ -135,7 +137,10 @@ int JUCE_CALLTYPE NativeMessageBox::showYesNoCancelBox (AlertWindow::AlertIconTy | |||||
ModalComponentManager::Callback* callback) | ModalComponentManager::Callback* callback) | ||||
{ | { | ||||
ScopedPointer<OSXMessageBox> mb (new OSXMessageBox (iconType, title, message, | ScopedPointer<OSXMessageBox> mb (new OSXMessageBox (iconType, title, message, | ||||
@"Yes", @"Cancel", @"No", callback, callback != nullptr)); | |||||
nsStringLiteral ("Yes"), | |||||
nsStringLiteral ("Cancel"), | |||||
nsStringLiteral ("No"), | |||||
callback, callback != nullptr)); | |||||
if (callback == nullptr) | if (callback == nullptr) | ||||
return mb->getResult(); | return mb->getResult(); | ||||
@@ -42,6 +42,16 @@ namespace | |||||
{ | { | ||||
return [NSString stringWithUTF8String: s.toUTF8()]; | return [NSString stringWithUTF8String: s.toUTF8()]; | ||||
} | } | ||||
NSString* nsStringLiteral (const char* const s) noexcept | |||||
{ | |||||
return [NSString stringWithUTF8String: s]; | |||||
} | |||||
NSString* nsEmptyString() noexcept | |||||
{ | |||||
return [NSString string]; | |||||
} | |||||
} | } | ||||