Browse Source

Changed some obj-C literals to avoid cross-linkage problems in plugins. More introjucer work.

tags/2021-05-28
Julian Storer 14 years ago
parent
commit
cf4ecfacac
18 changed files with 235 additions and 214 deletions
  1. +2
    -39
      extras/Introjucer/Source/Project/jucer_Project.cpp
  2. +0
    -1
      extras/Introjucer/Source/Project/jucer_Project.h
  3. +7
    -7
      extras/Introjucer/Source/Project/jucer_ProjectExport_Android.h
  4. +64
    -67
      extras/Introjucer/Source/Project/jucer_ProjectExport_MSVC.h
  5. +12
    -12
      extras/Introjucer/Source/Project/jucer_ProjectExport_Make.h
  6. +34
    -34
      extras/Introjucer/Source/Project/jucer_ProjectExport_XCode.h
  7. +52
    -11
      extras/Introjucer/Source/Project/jucer_ProjectExporter.cpp
  8. +8
    -2
      extras/Introjucer/Source/Project/jucer_ProjectExporter.h
  9. +4
    -4
      src/native/mac/juce_mac_CameraDevice.mm
  10. +3
    -3
      src/native/mac/juce_mac_Files.mm
  11. +19
    -19
      src/native/mac/juce_mac_MainMenu.mm
  12. +2
    -2
      src/native/mac/juce_mac_MessageManager.mm
  13. +3
    -3
      src/native/mac/juce_mac_NSViewComponentPeer.mm
  14. +1
    -1
      src/native/mac/juce_mac_Network.mm
  15. +1
    -1
      src/native/mac/juce_mac_QuickTimeMovieComponent.mm
  16. +4
    -4
      src/native/mac/juce_mac_WebBrowserComponent.mm
  17. +9
    -4
      src/native/mac/juce_mac_Windowing.mm
  18. +10
    -0
      src/native/mac/juce_osx_ObjCHelpers.h

+ 2
- 39
extras/Introjucer/Source/Project/jucer_Project.cpp View File

@@ -459,7 +459,7 @@ Image Project::getBigIcon()
if (icon.isValid())
return ImageCache::getFromFile (icon.getFile());
return Image();
return Image::null;
}
Image Project::getSmallIcon()
@@ -469,46 +469,9 @@ Image Project::getSmallIcon()
if (icon.isValid())
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
{
return parsePreprocessorDefs (getProjectPreprocessorDefs().toString());


+ 0
- 1
extras/Introjucer/Source/Project/jucer_Project.h View File

@@ -105,7 +105,6 @@ public:
Value getSmallIconImageItemID() const { return getProjectValue ("smallIcon"); }
Image getBigIcon();
Image getSmallIcon();
Image getBestIconForSize (int size, bool returnNullIfNothingBigEnough);
Value shouldBuildVST() const { return getProjectValue ("buildVST"); }
Value shouldBuildRTAS() const { return getProjectValue ("buildRTAS"); }


+ 7
- 7
extras/Introjucer/Source/Project/jucer_ProjectExport_Android.h View File

@@ -74,7 +74,7 @@ public:
#endif
}
bool isPossibleForCurrentProject() { return project.getProjectType().isGUIApplication(); }
bool isPossibleForCurrentProject() { return projectType.isGUIApplication(); }
bool usesMMFiles() const { return false; }
void launchProject()
@@ -208,7 +208,7 @@ private:
void writeAndroidMk (const File& file)
{
Array<RelativePath> files;
findAllFilesToCompile (project.getMainGroup(), files);
findAllFilesToCompile (getMainGroup(), files);
for (int i = 0; i < generatedGroups.size(); ++i)
findAllFilesToCompile (generatedGroups.getReference(i), files);
@@ -265,9 +265,9 @@ private:
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)
{
@@ -285,7 +285,7 @@ private:
XmlElement* createAntBuildXML()
{
XmlElement* proj = new XmlElement ("project");
proj->setAttribute ("name", project.getProjectName().toString());
proj->setAttribute ("name", projectName);
proj->setAttribute ("default", "debug");
proj->createNewChildElement ("property")->setAttribute ("file", "local.properties");
@@ -376,7 +376,7 @@ private:
void writeIcon (const File& file, int size)
{
Image im (project.getBestIconForSize (size, false));
Image im (getBestIconForSize (size, false));
if (im.isValid())
{
@@ -395,7 +395,7 @@ private:
XmlElement strings ("resources");
XmlElement* name = strings.createNewChildElement ("string");
name->setAttribute ("name", "app_name");
name->addTextElement (project.getProjectName().toString());
name->addTextElement (projectName);
writeXmlOrThrow (strings, file, "utf-8", 100);
}


+ 64
- 67
extras/Introjucer/Source/Project/jucer_ProjectExport_MSVC.h View File

@@ -61,7 +61,7 @@ public:
{
ProjectExporter::createPropertyEditors (props);
if (project.getProjectType().isLibrary())
if (projectType.isLibrary())
{
const char* const libTypes[] = { "Static Library (.lib)", "Dynamic Library (.dll)", 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); }
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
@@ -98,17 +98,17 @@ protected:
return getIntermediatesPath (config);
return ".\\" + RelativePath (binaryPath, RelativePath::projectFolder)
.rebased (project.getFile().getParentDirectory(), getTargetFolder(), RelativePath::buildTargetFolder)
.rebased (projectFolder, getTargetFolder(), RelativePath::buildTargetFolder)
.toWindowsStyle();
}
String getTargetBinarySuffix() const
{
if (project.getProjectType().isLibrary())
if (projectType.isLibrary())
return ".lib";
else if (isRTAS())
return ".dpm";
else if (project.getProjectType().isAudioPlugin() || project.getProjectType().isBrowserPlugin())
else if (projectType.isAudioPlugin() || projectType.isBrowserPlugin())
return ".dll";
return ".exe";
@@ -130,10 +130,10 @@ protected:
defines.set ("NDEBUG", "");
}
if (project.getProjectType().isCommandLineApp())
if (projectType.isCommandLineApp())
defines.set ("_CONSOLE", "");
if (project.getProjectType().isLibrary())
if (projectType.isLibrary())
defines.set ("_LIB", "");
if (isRTAS())
@@ -188,25 +188,25 @@ protected:
void writeSolutionFile (OutputStream& out, const String& versionString, const File& vcProject)
{
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
<< "EndProject" << newLine
<< "Global" << newLine
<< "\tGlobalSection(SolutionConfigurationPlatforms) = preSolution" << newLine;
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 << "\tEndGlobalSection" << 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) << ".Build.0 = " << createConfigName (config) << newLine;
}
@@ -326,19 +326,19 @@ protected:
{
Array<Image> images;
Image im (project.getBestIconForSize (16, true));
Image im (getBestIconForSize (16, true));
if (im.isValid())
images.add (im);
im = project.getBestIconForSize (32, true);
im = getBestIconForSize (32, true);
if (im.isValid())
images.add (im);
im = project.getBestIconForSize (48, true);
im = getBestIconForSize (48, true);
if (im.isValid())
images.add (im);
im = project.getBestIconForSize (128, true);
im = getBestIconForSize (128, true);
if (im.isValid())
images.add (im);
@@ -433,7 +433,7 @@ protected:
{
projectXml.setAttribute ("ProjectType", "Visual C++");
projectXml.setAttribute ("Version", getProjectVersionString());
projectXml.setAttribute ("Name", project.getProjectName().toString());
projectXml.setAttribute ("Name", projectName);
projectXml.setAttribute ("ProjectGUID", projectGUID);
projectXml.setAttribute ("TargetFrameworkVersion", "131072");
@@ -460,9 +460,9 @@ protected:
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");
fileConfig->setAttribute ("Name", createConfigName (config));
@@ -522,7 +522,7 @@ protected:
void createFiles (XmlElement& files)
{
addFiles (project.getMainGroup(), files, false);
addFiles (getMainGroup(), files, false);
for (int i = 0; i < generatedGroups.size(); ++i)
if (generatedGroups.getReference(i).getNumChildren() > 0)
@@ -547,8 +547,8 @@ protected:
xml.setAttribute ("Name", createConfigName (config));
xml.setAttribute ("OutputDirectory", FileHelpers::windowsStylePath (binariesPath));
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 ("ATLMinimizesCRunTimeLibraryUsage", "false");
xml.setAttribute ("CharacterSet", "2");
@@ -571,7 +571,7 @@ protected:
createToolElement (xml, "VCXMLDataGeneratorTool");
createToolElement (xml, "VCWebServiceProxyGeneratorTool");
if (! project.getProjectType().isLibrary())
if (! projectType.isLibrary())
{
XmlElement* midl = createToolElement (xml, "VCMIDLTool");
midl->setAttribute ("PreprocessorDefinitions", isDebug ? "_DEBUG" : "NDEBUG");
@@ -591,7 +591,7 @@ protected:
if (isDebug)
{
compiler->setAttribute ("BufferSecurityCheck", "");
compiler->setAttribute ("DebugInformationFormat", project.getProjectType().isLibrary() ? "3" : "4");
compiler->setAttribute ("DebugInformationFormat", projectType.isLibrary() ? "3" : "4");
}
else
{
@@ -628,7 +628,7 @@ protected:
const String outputFileName (getBinaryFileForConfig (config));
if (! project.getProjectType().isLibrary())
if (! projectType.isLibrary())
{
XmlElement* linker = createToolElement (xml, "VCLinkerTool");
@@ -641,7 +641,7 @@ protected:
linker->setAttribute ("IgnoreDefaultLibraryNames", isDebug ? "libcmt.lib, msvcrt.lib" : "");
linker->setAttribute ("GenerateDebugInformation", isDebug ? "true" : "false");
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)
{
@@ -700,19 +700,16 @@ protected:
createToolElement (xml, "VCFxCopTool");
if (! project.getProjectType().isLibrary())
if (! projectType.isLibrary())
createToolElement (xml, "VCAppVerifierTool");
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
{
return project.getProjectName().toString() + " - Win32 " + config.getName().toString();
return projectName + " - Win32 " + config.getName().toString();
}
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;
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
<< "# Microsoft Developer Studio Generated Build File, Format Version 6.00" << 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 use the Export Makefile command and run" << newLine
<< "!MESSAGE " << newLine
<< "!MESSAGE NMAKE /f \"" << project.getProjectName() << ".mak.\"" << newLine
<< "!MESSAGE NMAKE /f \"" << projectName << ".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=\"" << defaultConfigName << '"' << newLine
<< "!MESSAGE NMAKE /f \"" << projectName << ".mak\" CFG=\"" << defaultConfigName << '"' << newLine
<< "!MESSAGE " << newLine
<< "!MESSAGE Possible choices for configuration are:" << newLine
<< "!MESSAGE " << newLine;
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
<< "# Begin Project" << newLine
@@ -863,9 +860,9 @@ private:
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));
targetList << "# Name \"" << configName << '"' << newLine;
@@ -898,7 +895,7 @@ private:
if (! isDebug)
out << "# SUBTRACT CPP /YX" << newLine;
if (! project.getProjectType().isLibrary())
if (! projectType.isLibrary())
out << "# ADD BASE 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 BSC32 /nologo" << newLine;
if (project.getProjectType().isLibrary())
if (projectType.isLibrary())
{
out << "LIB32=link.exe -lib" << 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 "
<< (isDebug ? " /debug" : "")
<< " /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;
}
}
@@ -932,7 +929,7 @@ private:
<< "# Begin Target" << newLine
<< targetList;
writeFiles (out, project.getMainGroup());
writeFiles (out, getMainGroup());
for (int i = 0; i < generatedGroups.size(); ++i)
if (generatedGroups.getReference(i).getNumChildren() > 0)
@@ -1002,7 +999,7 @@ private:
<< "}}}" << newLine;
}
out << "Project: \"" << project.getProjectName() << "\" = .\\" << getDSPFile().getFileName() << " - Package Owner=<4>" << newLine
out << "Project: \"" << projectName << "\" = .\\" << getDSPFile().getFileName() << " - Package Owner=<4>" << newLine
<< "Package=<5>" << newLine
<< "{{{" << newLine
<< "}}}" << newLine
@@ -1113,9 +1110,9 @@ protected:
XmlElement* configsGroup = projectXml.createNewChildElement ("ItemGroup");
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");
e->setAttribute ("Include", createConfigName (config));
@@ -1135,9 +1132,9 @@ protected:
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");
setConditionAttribute (*e, config);
@@ -1178,9 +1175,9 @@ protected:
XmlElement* props = projectXml.createNewChildElement ("PropertyGroup");
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");
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 intermediatesPath (getIntermediatesPath (config));
const bool isDebug = (bool) config.isDebug().getValue();
@@ -1259,7 +1256,7 @@ protected:
: "%(IgnoreSpecificDefaultLibraries)");
link->createNewChildElement ("GenerateDebugInformation")->addTextElement (isDebug ? "true" : "false");
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");
if (! isDebug)
@@ -1285,7 +1282,7 @@ protected:
XmlElement* cppFiles = 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)
if (generatedGroups.getReference(i).getNumChildren() > 0)
@@ -1320,9 +1317,9 @@ protected:
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;
return String::empty;
@@ -1440,7 +1437,7 @@ protected:
XmlElement* cpps = 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)
if (generatedGroups.getReference(i).getNumChildren() > 0)


+ 12
- 12
extras/Introjucer/Source/Project/jucer_ProjectExport_Make.h View File

@@ -87,7 +87,7 @@ public:
void create()
{
Array<RelativePath> files;
findAllFilesToCompile (project.getMainGroup(), files);
findAllFilesToCompile (getMainGroup(), files);
for (int i = 0; i < generatedGroups.size(); ++i)
findAllFilesToCompile (generatedGroups.getReference(i), files);
@@ -157,7 +157,7 @@ private:
{
out << " LDFLAGS += -L$(BINDIR) -L$(LIBDIR)";
if (project.getProjectType().isAudioPlugin())
if (projectType.isAudioPlugin())
out << " -shared";
{
@@ -191,7 +191,7 @@ private:
if (config.getTargetBinaryRelativePath().toString().isNotEmpty())
{
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;
@@ -207,7 +207,7 @@ private:
if (config.isDebug().getValue())
out << " -g -ggdb";
if (project.getProjectType().isAudioPlugin())
if (projectType.isAudioPlugin())
out << " -fPIC";
out << " -O" << config.getGCCOptimisationFlag() << newLine;
@@ -224,14 +224,14 @@ private:
String targetName (config.getTargetBinaryName().getValue().toString());
if (project.getProjectType().isLibrary())
if (projectType.isLibrary())
targetName = getLibbedFilename (targetName);
else if (isVST())
targetName = targetName.upToLastOccurrenceOf (".", false, false) + ".so";
out << " TARGET := " << escapeSpaces (targetName) << newLine;
if (project.getProjectType().isLibrary())
if (projectType.isLibrary())
out << " BLDCMD = ar -rcs $(OUTDIR)/$(TARGET) $(OBJECTS) $(TARGET_ARCH)" << newLine;
else
out << " BLDCMD = $(CXX) -o $(OUTDIR)/$(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(TARGET_ARCH)" << newLine;
@@ -257,11 +257,11 @@ private:
<< newLine;
out << "ifndef CONFIG" << newLine
<< " CONFIG=" << escapeSpaces (project.getConfiguration(0).getName().toString()) << newLine
<< " CONFIG=" << escapeSpaces (configs.getReference(0).getName().toString()) << newLine
<< "endif" << newLine
<< newLine;
if (! project.getProjectType().isLibrary())
if (! projectType.isLibrary())
out << "ifeq ($(TARGET_ARCH),)" << newLine
<< " TARGET_ARCH := -march=native" << newLine
<< "endif" << newLine << newLine;
@@ -271,8 +271,8 @@ private:
<< newLine;
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);
@@ -280,7 +280,7 @@ private:
<< 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 $(LIBDIR)" << newLine
<< "\t-@mkdir -p $(OUTDIR)" << newLine
@@ -288,7 +288,7 @@ private:
<< newLine;
out << "clean:" << newLine
<< "\t@echo Cleaning " << project.getProjectName() << newLine
<< "\t@echo Cleaning " << projectName << newLine
<< "\t-@rm -f $(OUTDIR)/$(TARGET)" << newLine
<< "\t-@rm -rf $(OBJDIR)/*" << newLine
<< "\t-@rm -rf $(OBJDIR)" << newLine


+ 34
- 34
extras/Introjucer/Source/Project/jucer_ProjectExport_XCode.h View File

@@ -91,7 +91,7 @@ public:
#endif
}
bool isPossibleForCurrentProject() { return project.getProjectType().isGUIApplication() || ! iPhone; }
bool isPossibleForCurrentProject() { return projectType.isGUIApplication() || ! iPhone; }
bool usesMMFiles() 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 "
"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.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"); }
bool hasPList() const { return ! (project.getProjectType().isLibrary() || project.getProjectType().isCommandLineApp()); }
bool hasPList() const { return ! (projectType.isLibrary() || projectType.isCommandLineApp()); }
String getAudioPluginBundleExtension() const { return "component"; }
//==============================================================================
void createObjects()
{
if (! project.getProjectType().isLibrary())
if (! projectType.isLibrary())
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());
if (hasPList())
@@ -197,20 +197,20 @@ private:
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));
addTargetConfig (config.getName().getValue(), getTargetSettings (config));
addTargetConfig (config.getName().getValue(), getTargetSettings (config));
}
addConfigList (projectConfigs, createID ("__projList"));
addConfigList (targetConfigs, createID ("__configList"));
if (! project.getProjectType().isLibrary())
if (! projectType.isLibrary())
addBuildPhase ("PBXResourcesBuildPhase", resourceIDs);
if (rezFileIDs.size() > 0)
@@ -218,10 +218,10 @@ private:
addBuildPhase ("PBXSourcesBuildPhase", sourceIDs);
if (! project.getProjectType().isLibrary())
if (! projectType.isLibrary())
addBuildPhase ("PBXFrameworksBuildPhase", frameworkIDs);
if (project.getProjectType().isAudioPlugin())
if (projectType.isAudioPlugin())
addPluginShellScriptPhase();
addTargetObject();
@@ -345,9 +345,9 @@ private:
addPlistDictionaryKey (dict, "CFBundleExecutable", "${EXECUTABLE_NAME}");
addPlistDictionaryKey (dict, "CFBundleIconFile", iconFile.exists() ? iconFile.getFileName() : String::empty);
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, "CFBundleSignature", "PTul");
@@ -423,7 +423,7 @@ private:
void getLinkerFlags (const Project::BuildConfiguration& config, StringArray& flags, StringArray& librarySearchPaths)
{
if (project.getProjectType().isAudioPlugin())
if (projectType.isAudioPlugin())
{
flags.add ("-bundle");
@@ -461,7 +461,7 @@ private:
s.add ("WARNING_CFLAGS = -Wreorder");
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_SYMBOLS_PRIVATE_EXTERN = NO");
@@ -506,11 +506,11 @@ private:
if (extraFlags.isNotEmpty())
s.add ("OTHER_CPLUSPLUSFLAGS = " + extraFlags);
if (project.getProjectType().isGUIApplication())
if (projectType.isGUIApplication())
{
s.add ("INSTALL_PATH = \"$(HOME)/Applications\"");
}
else if (project.getProjectType().isAudioPlugin())
else if (projectType.isAudioPlugin())
{
s.add ("LIBRARY_STYLE = Bundle");
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 \\\"$(DEVELOPER_DIR)/Extras/CoreAudio/AudioUnits/AUPublic/AUBase\\\"\"");
}
else if (project.getProjectType().isBrowserPlugin())
else if (projectType.isBrowserPlugin())
{
s.add ("LIBRARY_STYLE = Bundle");
s.add ("INSTALL_PATH = \"/Library/Internet Plug-Ins/\"");
}
else if (project.getProjectType().isLibrary())
else if (projectType.isLibrary())
{
if (config.getTargetBinaryRelativePath().toString().isNotEmpty())
{
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 ("SYMROOT = " + sanitisePath (binaryPath.toUnixStyle()));
@@ -539,7 +539,7 @@ private:
s.add ("CONFIGURATION_BUILD_DIR = \"$(BUILD_DIR)\"");
s.add ("DEPLOYMENT_LOCATION = YES");
}
else if (project.getProjectType().isCommandLineApp())
else if (projectType.isCommandLineApp())
{
}
else
@@ -960,26 +960,26 @@ private:
v->setProperty ("buildPhases", "(" + indentList (buildPhaseIDs, ",") + " )", 0);
v->setProperty ("buildRules", "( )", 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);
if (project.getProjectType().isGUIApplication())
if (projectType.isGUIApplication())
{
v->setProperty ("productInstallPath", "$(HOME)/Applications", 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 ("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 ("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);
}
@@ -996,7 +996,7 @@ private:
v->setProperty ("buildConfigurationList", createID ("__projList"), 0);
v->setProperty ("compatibilityVersion", "Xcode 3.1", 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 ("projectRoot", "\"\"", 0);
v->setProperty ("targets", "( " + createID ("__target") + " )", 0);


+ 52
- 11
extras/Introjucer/Source/Project/jucer_ProjectExporter.cpp View File

@@ -30,17 +30,6 @@
#include "jucer_ProjectExport_Android.h"
//==============================================================================
ProjectExporter::ProjectExporter (Project& project_, const ValueTree& settings_)
: project (project_),
settings (settings_)
{
}
ProjectExporter::~ProjectExporter()
{
}
//==============================================================================
int ProjectExporter::getNumExporters()
{
@@ -126,6 +115,22 @@ ProjectExporter* ProjectExporter::createPlatformDefaultExporter (Project& projec
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()
{
libraryModules.clear();
@@ -219,3 +224,39 @@ String ProjectExporter::replacePreprocessorTokens (const Project::BuildConfigura
{
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;
}

+ 8
- 2
extras/Introjucer/Source/Project/jucer_ProjectExporter.h View File

@@ -121,7 +121,7 @@ public:
String message;
};
Project::Item& getMainGroup();
Project::Item getMainGroup() { return project.getMainGroup(); }
RelativePath getJucePathFromTargetFolder() const;
RelativePath getJucePathFromProjectFolder() const;
@@ -133,9 +133,13 @@ public:
protected:
//==============================================================================
String name;
Project& project;
const ProjectType& projectType;
const String projectName;
const File projectFolder;
Array<Project::BuildConfiguration> configs;
ValueTree settings;
String name;
static String getDefaultBuildsRootFolder() { return "Builds/"; }
@@ -148,6 +152,8 @@ protected:
return name;
}
Image getBestIconForSize (int size, bool returnNullIfNothingBigEnough);
//==============================================================================
static void overwriteFileIfDifferentOrThrow (const File& file, const MemoryOutputStream& newData)
{


+ 4
- 4
src/native/mac/juce_mac_CameraDevice.mm View File

@@ -254,7 +254,7 @@ END_JUCE_NAMESPACE
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
NSNumber* hosttime = (NSNumber*) [sampleBuffer attributeForKey: QTSampleBufferHostTimeAttribute];
#else
NSNumber* hosttime = (NSNumber*) [sampleBuffer attributeForKey: @"hostTime"];
NSNumber* hosttime = (NSNumber*) [sampleBuffer attributeForKey: nsStringLiteral ("hostTime")];
#endif
int64 presentationTime = (hosttime != nil)
@@ -353,10 +353,10 @@ void CameraDevice::startRecordingToFile (const File& file, int quality)
if ([mediaType isEqualToString: QTMediaTypeVideo])
options = [QTCompressionOptions compressionOptionsWithIdentifier:
quality >= 1 ? @"QTCompressionOptionsSD480SizeH264Video"
: @"QTCompressionOptions240SizeH264Video"];
quality >= 1 ? nsStringLiteral ("QTCompressionOptionsSD480SizeH264Video")_
nsStringLiteral ("QTCompressionOptions240SizeH264Video")];
else if ([mediaType isEqualToString: QTMediaTypeSound])
options = [QTCompressionOptions compressionOptionsWithIdentifier: @"QTCompressionOptionsHighQualityAACAudio"];
options = [QTCompressionOptions compressionOptionsWithIdentifier: nsStringLiteral ("QTCompressionOptionsHighQualityAACAudio")];
[d->fileOutput setCompressionOptions: options forConnection: connection];
}


+ 3
- 3
src/native/mac/juce_mac_Files.mm View File

@@ -264,7 +264,7 @@ String File::getVersion() const
if (info != nil)
{
NSString* name = [info valueForKey: @"CFBundleShortVersionString"];
NSString* name = [info valueForKey: nsStringLiteral ("CFBundleShortVersionString")];
if (name != nil)
result = nsStringToJuce (name);
@@ -307,7 +307,7 @@ bool File::moveToTrash() const
return [[NSWorkspace sharedWorkspace]
performFileOperation: NSWorkspaceRecycleOperation
source: [p stringByDeletingLastPathComponent]
destination: @""
destination: nsEmptyString()
files: [NSArray arrayWithObject: [p lastPathComponent]]
tag: nil ];
#endif
@@ -433,7 +433,7 @@ void File::revealToUser() const
{
#if ! JUCE_IOS
if (exists())
[[NSWorkspace sharedWorkspace] selectFile: juceStringToNS (getFullPathName()) inFileViewerRootedAtPath: @""];
[[NSWorkspace sharedWorkspace] selectFile: juceStringToNS (getFullPathName()) inFileViewerRootedAtPath: nsEmptyString()];
else if (getParentDirectory().exists())
getParentDirectory().revealToUser();
#endif


+ 19
- 19
src/native/mac/juce_mac_MainMenu.mm View File

@@ -96,7 +96,7 @@ public:
{
NSMenuItem* item = [parent addItemWithTitle: juceStringToNS (name)
action: nil
keyEquivalent: @""];
keyEquivalent: nsEmptyString()];
[item setTag: tag];
NSMenu* sub = createMenu (child, name, menuId, tag);
@@ -200,7 +200,7 @@ public:
NSString* text = juceStringToNS (iter.itemName.upToFirstOccurrenceOf ("<end>", false, true));
if (text == nil)
text = @"";
text = nsEmptyString();
if (iter.isSeparator)
{
@@ -210,7 +210,7 @@ public:
{
NSMenuItem* item = [menuToAddTo addItemWithTitle: text
action: nil
keyEquivalent: @""];
keyEquivalent: nsEmptyString()];
[item setEnabled: false];
}
@@ -218,7 +218,7 @@ public:
{
NSMenuItem* item = [menuToAddTo addItemWithTitle: text
action: nil
keyEquivalent: @""];
keyEquivalent: nsEmptyString()];
[item setTag: iter.itemId];
[item setEnabled: iter.isEnabled];
@@ -232,7 +232,7 @@ public:
{
NSMenuItem* item = [menuToAddTo addItemWithTitle: text
action: @selector (menuItemInvoked:)
keyEquivalent: @""];
keyEquivalent: nsEmptyString()];
[item setTag: iter.itemId];
[item setEnabled: iter.isEnabled];
@@ -315,7 +315,7 @@ private:
static void flashMenuBar (NSMenu* menu)
{
if ([[menu title] isEqualToString: @"Apple"])
if ([[menu title] isEqualToString: nsStringLiteral ("Apple")])
return;
[menu retain];
@@ -323,7 +323,7 @@ private:
const unichar f35Key = NSF35FunctionKey;
NSString* f35String = [NSString stringWithCharacters: &f35Key length: 1];
NSMenuItem* item = [[NSMenuItem alloc] initWithTitle: @"x"
NSMenuItem* item = [[NSMenuItem alloc] initWithTitle: nsStringLiteral ("x")
action: nil
keyEquivalent: f35String];
[item setTarget: nil];
@@ -480,11 +480,11 @@ namespace MainMenuHelpers
NSMenuItem* item;
// 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];
[item release];
NSMenu* servicesMenu = [[NSMenu alloc] initWithTitle: @"Services"];
NSMenu* servicesMenu = [[NSMenu alloc] initWithTitle: nsStringLiteral ("Services")];
[menu setSubmenu: servicesMenu forItem: item];
[NSApp setServicesMenu: servicesMenu];
[servicesMenu release];
@@ -492,20 +492,20 @@ namespace MainMenuHelpers
// Hide + Show stuff...
item = [[NSMenuItem alloc] initWithTitle: juceStringToNS ("Hide " + appName)
action: @selector (hide:) keyEquivalent: @"h"];
action: @selector (hide:) keyEquivalent: nsStringLiteral ("h")];
[item setTarget: NSApp];
[menu addItem: item];
[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 setTarget: NSApp];
[menu addItem: item];
[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];
[menu addItem: item];
[item release];
@@ -514,7 +514,7 @@ namespace MainMenuHelpers
// Quit item....
item = [[NSMenuItem alloc] initWithTitle: juceStringToNS ("Quit " + appName)
action: @selector (terminate:) keyEquivalent: @"q"];
action: @selector (terminate:) keyEquivalent: nsStringLiteral ("q")];
[item setTarget: NSApp];
[menu addItem: item];
@@ -533,10 +533,10 @@ namespace MainMenuHelpers
{
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];
[mainMenu setSubmenu: appMenu forItem: item];


+ 2
- 2
src/native/mac/juce_mac_MessageManager.mm View File

@@ -285,7 +285,7 @@ using namespace JUCE_NAMESPACE;
- (void) broadcastMessageCallback: (NSNotification*) n
{
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);
}
@@ -406,7 +406,7 @@ bool MessageManager::postMessageToSystemQueue (Message* message)
void MessageManager::broadcastMessage (const String& message)
{
NSDictionary* info = [NSDictionary dictionaryWithObject: juceStringToNS (message)
forKey: @"message"];
forKey: nsStringLiteral ("message")];
[[NSDistributedNotificationCenter defaultCenter] postNotificationName: AppDelegateRedirector::getBroacastEventName()
object: nil


+ 3
- 3
src/native/mac/juce_mac_NSViewComponentPeer.mm View File

@@ -1543,7 +1543,7 @@ BOOL NSViewComponentPeer::sendDragCallback (const int type, id <NSDraggingInfo>
NSPasteboard* pasteBoard = [sender draggingPasteboard];
StringArray files;
NSString* iTunesPasteboardType = @"CorePasteboardFlavorType 0x6974756E"; // 'itun'
NSString* iTunesPasteboardType = nsStringLiteral ("CorePasteboardFlavorType 0x6974756E"); // 'itun'
if (bestType == NSFilesPromisePboardType
&& [[pasteBoard types] containsObject: iTunesPasteboardType])
@@ -1553,13 +1553,13 @@ BOOL NSViewComponentPeer::sendDragCallback (const int type, id <NSDraggingInfo>
if ([list isKindOfClass: [NSDictionary class]])
{
NSDictionary* iTunesDictionary = (NSDictionary*) list;
NSArray* tracks = [iTunesDictionary valueForKey: @"Tracks"];
NSArray* tracks = [iTunesDictionary valueForKey: nsStringLiteral ("Tracks")];
NSEnumerator* enumerator = [tracks objectEnumerator];
NSDictionary* track;
while ((track = [enumerator nextObject]) != nil)
{
NSURL* url = [NSURL URLWithString: [track valueForKey: @"Location"]];
NSURL* url = [NSURL URLWithString: [track valueForKey: nsStringLiteral ("Location")]];
if ([url isFileURL])
files.add (nsStringToJuce ([url path]));


+ 1
- 1
src/native/mac/juce_mac_Network.mm View File

@@ -429,7 +429,7 @@ private:
if (req == nil)
return nil;
[req setHTTPMethod: isPost ? @"POST" : @"GET"];
[req setHTTPMethod: nsStringLiteral (isPost ? "POST" : "GET")];
//[req setCachePolicy: NSURLRequestReloadIgnoringLocalAndRemoteCacheData];
StringArray headerLines;


+ 1
- 1
src/native/mac/juce_mac_QuickTimeMovieComponent.mm View File

@@ -123,7 +123,7 @@ static QTMovie* openMovieFromStream (InputStream* movieStream, File& movieFile)
movie = [QTMovie movieWithDataReference: [QTDataReference dataReferenceWithReferenceToData: [NSData dataWithBytes: temp.getData()
length: temp.getSize()]
name: [NSString stringWithUTF8String: suffixesToTry[i]]
MIMEType: @""]
MIMEType: nsEmptyString()]
error: nil];
if (movie != 0)


+ 4
- 4
src/native/mac/juce_mac_WebBrowserComponent.mm View File

@@ -67,7 +67,7 @@ END_JUCE_NAMESPACE
(void) request;
(void) frame;
NSURL* url = [actionInformation valueForKey: @"WebActionOriginalURLKey"];
NSURL* url = [actionInformation valueForKey: nsStringLiteral ("WebActionOriginalURLKey")];
if (ownerComponent->pageAboutToLoad (nsStringToJuce ([url absoluteString])))
[listener use];
@@ -86,8 +86,8 @@ public:
WebBrowserComponentInternal (WebBrowserComponent* owner)
{
webView = [[WebView alloc] initWithFrame: NSMakeRect (0, 0, 100.0f, 100.0f)
frameName: @""
groupName: @""];
frameName: nsEmptyString()
groupName: nsEmptyString()];
setView (webView);
clickListener = [[DownloadClickDetector alloc] initWithWebBrowserOwner: owner];
@@ -112,7 +112,7 @@ public:
if (postData != nullptr && postData->getSize() > 0)
{
[r setHTTPMethod: @"POST"];
[r setHTTPMethod: nsStringLiteral ("POST")];
[r setHTTPBody: [NSData dataWithBytes: postData->getData()
length: postData->getSize()]];
}


+ 9
- 4
src/native/mac/juce_mac_Windowing.mm View File

@@ -104,7 +104,7 @@ void JUCE_CALLTYPE NativeMessageBox::showMessageBox (AlertWindow::AlertIconType
const String& title, const String& message,
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();
}
@@ -112,7 +112,7 @@ void JUCE_CALLTYPE NativeMessageBox::showMessageBoxAsync (AlertWindow::AlertIcon
const String& title, const String& message,
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,
@@ -121,7 +121,9 @@ bool JUCE_CALLTYPE NativeMessageBox::showOkCancelBox (AlertWindow::AlertIconType
ModalComponentManager::Callback* callback)
{
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)
return mb->getResult() == 1;
@@ -135,7 +137,10 @@ int JUCE_CALLTYPE NativeMessageBox::showYesNoCancelBox (AlertWindow::AlertIconTy
ModalComponentManager::Callback* callback)
{
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)
return mb->getResult();


+ 10
- 0
src/native/mac/juce_osx_ObjCHelpers.h View File

@@ -42,6 +42,16 @@ namespace
{
return [NSString stringWithUTF8String: s.toUTF8()];
}
NSString* nsStringLiteral (const char* const s) noexcept
{
return [NSString stringWithUTF8String: s];
}
NSString* nsEmptyString() noexcept
{
return [NSString string];
}
}


Loading…
Cancel
Save