From 8de537e52ca099e7c8f509053c7eedfa2bf3f70d Mon Sep 17 00:00:00 2001 From: Julian Storer Date: Tue, 30 Mar 2010 12:27:57 +0100 Subject: [PATCH] Minor Jucer updates. Fix for strange PNG problem. ICC and VC6 compilation changes. --- .../Builds/Linux/Makefile | 6 + .../The Jucer.xcodeproj/project.pbxproj | 8 +- .../Builds/VisualStudio2005/The Jucer.vcproj | 5 +- .../Builds/VisualStudio2008/The Jucer.vcproj | 5 +- extras/Jucer (experimental)/Jucer.jucer | 7 +- .../Source/jucer_Main.cpp | 4 +- .../Source/model/jucer_ComponentDocument.cpp | 2 +- .../Source/model/jucer_NewFileWizard.cpp | 8 +- .../Source/model/jucer_Project.cpp | 10 +- .../Source/model/jucer_ProjectExport_Make.h | 2 +- .../Source/model/jucer_ProjectExport_XCode.h | 12 +- .../Source/model/jucer_ProjectExporter.h | 4 +- .../Source/model/jucer_ProjectWizard.cpp | 64 +++++----- .../Source/model/jucer_ResourceFile.cpp | 6 +- .../jucer_ComponentEditor.cpp | 54 +++++++++ .../Component Editor/jucer_ComponentEditor.h | 59 ++++++++++ .../Source/ui/jucer_CommandIDs.h | 8 +- .../Source/ui/jucer_MainWindow.cpp | 6 +- .../ui/jucer_ProjectInformationComponent.cpp | 6 +- .../utility/jucer_ColourEditorComponent.h | 2 +- .../Source/utility/jucer_RelativePath.h | 4 +- .../Source/utility/jucer_UtilityFunctions.cpp | 18 +-- juce_amalgamated.cpp | 6 +- juce_amalgamated.h | 110 +++++++++--------- src/containers/juce_Array.h | 29 +++-- src/core/juce_MathsFunctions.h | 20 +++- src/core/juce_StandardHeader.h | 2 +- src/events/juce_ListenerList.h | 73 +++++------- .../image_file_formats/juce_PNGLoader.cpp | 6 +- 29 files changed, 345 insertions(+), 201 deletions(-) create mode 100644 extras/Jucer (experimental)/Source/ui/Component Editor/jucer_ComponentEditor.cpp create mode 100644 extras/Jucer (experimental)/Source/ui/Component Editor/jucer_ComponentEditor.h diff --git a/extras/Jucer (experimental)/Builds/Linux/Makefile b/extras/Jucer (experimental)/Builds/Linux/Makefile index 583912c39b..dd941d0490 100644 --- a/extras/Jucer (experimental)/Builds/Linux/Makefile +++ b/extras/Jucer (experimental)/Builds/Linux/Makefile @@ -50,6 +50,7 @@ OBJECTS := \ $(OBJDIR)/jucer_ProjectExporter.o \ $(OBJDIR)/jucer_ProjectWizard.o \ $(OBJDIR)/jucer_ResourceFile.o \ + $(OBJDIR)/jucer_ComponentEditor.o \ $(OBJDIR)/jucer_DrawableEditor.o \ $(OBJDIR)/jucer_DocumentEditorComponent.o \ $(OBJDIR)/jucer_GroupInformationComponent.o \ @@ -121,6 +122,11 @@ $(OBJDIR)/jucer_ResourceFile.o: ../../Source/model/jucer_ResourceFile.cpp @echo $(notdir $<) @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" +$(OBJDIR)/jucer_ComponentEditor.o: ../../Source/ui/Component\ Editor/jucer_ComponentEditor.cpp + -@mkdir -p $(OBJDIR) + @echo $(notdir $<) + @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" + $(OBJDIR)/jucer_DrawableEditor.o: ../../Source/ui/Drawable\ Editor/jucer_DrawableEditor.cpp -@mkdir -p $(OBJDIR) @echo $(notdir $<) diff --git a/extras/Jucer (experimental)/Builds/MacOSX/The Jucer.xcodeproj/project.pbxproj b/extras/Jucer (experimental)/Builds/MacOSX/The Jucer.xcodeproj/project.pbxproj index cb011e257d..32ff2496fd 100644 --- a/extras/Jucer (experimental)/Builds/MacOSX/The Jucer.xcodeproj/project.pbxproj +++ b/extras/Jucer (experimental)/Builds/MacOSX/The Jucer.xcodeproj/project.pbxproj @@ -24,6 +24,7 @@ 60CDC1358E84801B6526E434 = { isa = PBXBuildFile; fileRef = FE9A53032395E717F54AE85B; }; EEC6FC8E546C88C825411DB2 = { isa = PBXBuildFile; fileRef = 0AD266A3E698D40DCD88A432; }; B2B821DE12F1679A3ADA597A = { isa = PBXBuildFile; fileRef = DBE9A3BB502125C5D3433AE7; }; + D706C3B5016318D85FE452C2 = { isa = PBXBuildFile; fileRef = 3263F4099F45D6FACD28F08D; }; E43D00B370F289420379B759 = { isa = PBXBuildFile; fileRef = 82F91CF84A296665177CB79A; }; 944CE0EADAD951F48EC77071 = { isa = PBXBuildFile; fileRef = 3B2C45064E85B3B631D4F921; }; 4E8860E0F8680956A6F5B493 = { isa = PBXBuildFile; fileRef = 8F731296532276CBF2B6190D; }; @@ -75,6 +76,8 @@ 91C67387B525014760F514C2 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_ProjectWizard.h; path = ../../Source/model/jucer_ProjectWizard.h; sourceTree = SOURCE_ROOT; }; DBE9A3BB502125C5D3433AE7 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = jucer_ResourceFile.cpp; path = ../../Source/model/jucer_ResourceFile.cpp; sourceTree = SOURCE_ROOT; }; 2DEE6D9FE17874DAB301648C = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_ResourceFile.h; path = ../../Source/model/jucer_ResourceFile.h; sourceTree = SOURCE_ROOT; }; + 3263F4099F45D6FACD28F08D = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = jucer_ComponentEditor.cpp; path = "../../Source/ui/Component Editor/jucer_ComponentEditor.cpp"; sourceTree = SOURCE_ROOT; }; + 16328135EAE8536A5E2AB454 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_ComponentEditor.h; path = "../../Source/ui/Component Editor/jucer_ComponentEditor.h"; sourceTree = SOURCE_ROOT; }; 82F91CF84A296665177CB79A = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = jucer_DrawableEditor.cpp; path = "../../Source/ui/Drawable Editor/jucer_DrawableEditor.cpp"; sourceTree = SOURCE_ROOT; }; D1776C5F3E6BB7E8C698BAD6 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_DrawableEditor.h; path = "../../Source/ui/Drawable Editor/jucer_DrawableEditor.h"; sourceTree = SOURCE_ROOT; }; F9EAFD5BC3E676BC59B326E0 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_DrawableObjectComponent.h; path = "../../Source/ui/Drawable Editor/jucer_DrawableObjectComponent.h"; sourceTree = SOURCE_ROOT; }; @@ -151,7 +154,9 @@ 91C67387B525014760F514C2, DBE9A3BB502125C5D3433AE7, 2DEE6D9FE17874DAB301648C ); name = Model; sourceTree = ""; }; - 3A0BE83502CB509D623C2C07 = { isa = PBXGroup; children = ( ); name = "Component Editor"; sourceTree = ""; }; + 3A0BE83502CB509D623C2C07 = { isa = PBXGroup; children = ( + 3263F4099F45D6FACD28F08D, + 16328135EAE8536A5E2AB454 ); name = "Component Editor"; sourceTree = ""; }; E6053BD673F80E900DDA3593 = { isa = PBXGroup; children = ( 82F91CF84A296665177CB79A, D1776C5F3E6BB7E8C698BAD6, @@ -314,6 +319,7 @@ 60CDC1358E84801B6526E434, EEC6FC8E546C88C825411DB2, B2B821DE12F1679A3ADA597A, + D706C3B5016318D85FE452C2, E43D00B370F289420379B759, 944CE0EADAD951F48EC77071, 4E8860E0F8680956A6F5B493, diff --git a/extras/Jucer (experimental)/Builds/VisualStudio2005/The Jucer.vcproj b/extras/Jucer (experimental)/Builds/VisualStudio2005/The Jucer.vcproj index 3b1ddf04b1..e9870f4880 100644 --- a/extras/Jucer (experimental)/Builds/VisualStudio2005/The Jucer.vcproj +++ b/extras/Jucer (experimental)/Builds/VisualStudio2005/The Jucer.vcproj @@ -153,7 +153,10 @@ - + + + + diff --git a/extras/Jucer (experimental)/Builds/VisualStudio2008/The Jucer.vcproj b/extras/Jucer (experimental)/Builds/VisualStudio2008/The Jucer.vcproj index 9ae6139cec..485ffd4ff4 100644 --- a/extras/Jucer (experimental)/Builds/VisualStudio2008/The Jucer.vcproj +++ b/extras/Jucer (experimental)/Builds/VisualStudio2008/The Jucer.vcproj @@ -153,7 +153,10 @@ - + + + + diff --git a/extras/Jucer (experimental)/Jucer.jucer b/extras/Jucer (experimental)/Jucer.jucer index e28d73ca93..8e68e4c530 100644 --- a/extras/Jucer (experimental)/Jucer.jucer +++ b/extras/Jucer (experimental)/Jucer.jucer @@ -65,7 +65,12 @@ file="Source/model/jucer_ResourceFile.h"/> - + + + + diff --git a/extras/Jucer (experimental)/Source/jucer_Main.cpp b/extras/Jucer (experimental)/Source/jucer_Main.cpp index f5dfb07384..685468d1eb 100644 --- a/extras/Jucer (experimental)/Source/jucer_Main.cpp +++ b/extras/Jucer (experimental)/Source/jucer_Main.cpp @@ -48,10 +48,10 @@ public: /* Running a command-line of the form "Jucer --resave foobar.jucer" will try to load that jucer file and re-export all of its projects. */ - if (commandLine.startsWithIgnoreCase (T("-resave ")) || commandLine.startsWithIgnoreCase (T("--resave "))) + if (commandLine.startsWithIgnoreCase ("-resave ") || commandLine.startsWithIgnoreCase ("--resave ")) { resaveJucerFile (File::getCurrentWorkingDirectory() - .getChildFile (commandLine.fromFirstOccurrenceOf (T(" "), false, false).unquoted())); + .getChildFile (commandLine.fromFirstOccurrenceOf (" ", false, false).unquoted())); quit(); return; } diff --git a/extras/Jucer (experimental)/Source/model/jucer_ComponentDocument.cpp b/extras/Jucer (experimental)/Source/model/jucer_ComponentDocument.cpp index 9b3bc1775e..325382c06e 100644 --- a/extras/Jucer (experimental)/Source/model/jucer_ComponentDocument.cpp +++ b/extras/Jucer (experimental)/Source/model/jucer_ComponentDocument.cpp @@ -56,7 +56,7 @@ bool ComponentDocument::isComponentFile (const File& file) in->read (initialData, amountToRead); return String::createStringFromData (initialData, amountToRead) - .contains (String ("JUCER_" "COMPONENT")); // written like this to avoid thinking this file is a component! + .contains ("JUCER_" "COMPONENT"); // written like this to avoid thinking this file is a component! } bool ComponentDocument::save() diff --git a/extras/Jucer (experimental)/Source/model/jucer_NewFileWizard.cpp b/extras/Jucer (experimental)/Source/model/jucer_NewFileWizard.cpp index aed4f45f0d..84126cefdc 100644 --- a/extras/Jucer (experimental)/Source/model/jucer_NewFileWizard.cpp +++ b/extras/Jucer (experimental)/Source/model/jucer_NewFileWizard.cpp @@ -32,10 +32,10 @@ static bool fillInNewCppFileTemplate (const File& file, const Project::Item& item, const char* templateName) { String s = item.getProject().getFileTemplate (templateName) - .replace (T("FILENAME"), file.getFileName(), false) - .replace (T("DATE"), Time::getCurrentTime().toString (true, true, true), false) - .replace (T("AUTHOR"), SystemStats::getFullUserName(), false) - .replace (T("HEADERGUARD"), makeHeaderGuardName (file), false); + .replace ("FILENAME", file.getFileName(), false) + .replace ("DATE", Time::getCurrentTime().toString (true, true, true), false) + .replace ("AUTHOR", SystemStats::getFullUserName(), false) + .replace ("HEADERGUARD", makeHeaderGuardName (file), false); return overwriteFileWithNewDataIfDifferent (file, s); } diff --git a/extras/Jucer (experimental)/Source/model/jucer_Project.cpp b/extras/Jucer (experimental)/Source/model/jucer_Project.cpp index 5f1a581bc7..aa8841aef0 100644 --- a/extras/Jucer (experimental)/Source/model/jucer_Project.cpp +++ b/extras/Jucer (experimental)/Source/model/jucer_Project.cpp @@ -644,16 +644,16 @@ void Project::getJuceConfigFlags (OwnedArray & flags) { String line (lines[i].trim()); - if (line.startsWith (T("/** ")) && line.containsChar (':')) + if (line.startsWith ("/** ") && line.containsChar (':')) { ScopedPointer config (new JuceConfigFlag()); - config->symbol = line.substring (4).upToFirstOccurrenceOf (T(":"), false, false).trim(); + config->symbol = line.substring (4).upToFirstOccurrenceOf (":", false, false).trim(); if (config->symbol.length() > 4) { - config->description = line.fromFirstOccurrenceOf (T(":"), false, false).trimStart(); + config->description = line.fromFirstOccurrenceOf (":", false, false).trimStart(); ++i; - while (! (lines[i].contains (T("*/")) || lines[i].contains (T("@see")))) + while (! (lines[i].contains ("*/") || lines[i].contains ("@see"))) { if (lines[i].trim().isNotEmpty()) config->description = config->description.trim() + " " + lines[i].trim(); @@ -661,7 +661,7 @@ void Project::getJuceConfigFlags (OwnedArray & flags) ++i; } - config->description = config->description.upToFirstOccurrenceOf (T("*/"), false, false); + config->description = config->description.upToFirstOccurrenceOf ("*/", false, false); config->value.referTo (getJuceConfigFlag (config->symbol)); flags.add (config.release()); } diff --git a/extras/Jucer (experimental)/Source/model/jucer_ProjectExport_Make.h b/extras/Jucer (experimental)/Source/model/jucer_ProjectExport_Make.h index 340fe3e8a5..94609091ac 100644 --- a/extras/Jucer (experimental)/Source/model/jucer_ProjectExport_Make.h +++ b/extras/Jucer (experimental)/Source/model/jucer_ProjectExport_Make.h @@ -308,7 +308,7 @@ private: static const String escapeSpaces (const String& s) { - return s.replace (T(" "), T("\\ ")); + return s.replace (" ", "\\ "); } const String getObjectFileFor (const RelativePath& file) const diff --git a/extras/Jucer (experimental)/Source/model/jucer_ProjectExport_XCode.h b/extras/Jucer (experimental)/Source/model/jucer_ProjectExport_XCode.h index 0d85312b2c..57b262326e 100644 --- a/extras/Jucer (experimental)/Source/model/jucer_ProjectExport_XCode.h +++ b/extras/Jucer (experimental)/Source/model/jucer_ProjectExport_XCode.h @@ -337,7 +337,7 @@ private: flags.add ("-l" + library.getFileNameWithoutExtension().substring (3)); - String searchPath (library.toUnixStyle().upToLastOccurrenceOf (T("/"), false, false)); + String searchPath (library.toUnixStyle().upToLastOccurrenceOf ("/", false, false)); if (! library.isAbsolute()) searchPath = "$(SRCROOT)/" + searchPath; @@ -571,7 +571,7 @@ private: const var::identifier name (o.getPropertyName(j)); String val (o.getProperty (name).toString()); - if (val.isEmpty() || (val.containsAnyOf (T(" \t;<>()=,-\r\n")) + if (val.isEmpty() || (val.containsAnyOf (" \t;<>()=,-\r\n") && ! (val.trimStart().startsWithChar ('(') || val.trimStart().startsWithChar ('{')))) val = val.quoted(); @@ -892,10 +892,10 @@ private: v->setProperty ("name", "Copy to the different plugin folders", 0); v->setProperty ("shellPath", "/bin/sh", 0); v->setProperty ("shellScript", String::fromUTF8 (BinaryData::AudioPluginXCodeScript_txt, BinaryData::AudioPluginXCodeScript_txtSize) - .replace (T("\\"), T("\\\\")) - .replace (T("\""), T("\\\"")) - .replace (T("\r\n"), T("\\n")) - .replace (T("\n"), T("\\n")), 0); + .replace ("\\", "\\\\") + .replace ("\"", "\\\"") + .replace ("\r\n", "\\n") + .replace ("\n", "\\n"), 0); } //============================================================================== diff --git a/extras/Jucer (experimental)/Source/model/jucer_ProjectExporter.h b/extras/Jucer (experimental)/Source/model/jucer_ProjectExporter.h index ba9328c516..a0b4955c6f 100644 --- a/extras/Jucer (experimental)/Source/model/jucer_ProjectExporter.h +++ b/extras/Jucer (experimental)/Source/model/jucer_ProjectExporter.h @@ -93,9 +93,9 @@ protected: const String getLibbedFilename (String name) const { - if (! name.startsWith (T("lib"))) + if (! name.startsWith ("lib")) name = "lib" + name; - if (! name.endsWithIgnoreCase (T(".a"))) + if (! name.endsWithIgnoreCase (".a")) name = name + ".a"; return name; } diff --git a/extras/Jucer (experimental)/Source/model/jucer_ProjectWizard.cpp b/extras/Jucer (experimental)/Source/model/jucer_ProjectWizard.cpp index 927adaed63..8acba7c374 100644 --- a/extras/Jucer (experimental)/Source/model/jucer_ProjectWizard.cpp +++ b/extras/Jucer (experimental)/Source/model/jucer_ProjectWizard.cpp @@ -49,7 +49,7 @@ public: { createMainCpp = createWindow = false; - switch (aw.getComboBoxComponent("files")->getSelectedItemIndex()) + switch (aw.getComboBoxComponent ("files")->getSelectedItemIndex()) { case 0: createMainCpp = true; break; case 1: createMainCpp = createWindow = true; break; @@ -91,13 +91,13 @@ public: privateMembers = windowClassName + "* mainWindow;"; String windowH = project.getFileTemplate ("jucer_WindowTemplate_h") - .replace (T("INCLUDES"), createIncludeStatement (project.getAppIncludeFile(), mainWindowH), false) - .replace (T("WINDOWCLASS"), windowClassName, false) - .replace (T("HEADERGUARD"), makeHeaderGuardName (mainWindowH), false); + .replace ("INCLUDES", createIncludeStatement (project.getAppIncludeFile(), mainWindowH), false) + .replace ("WINDOWCLASS", windowClassName, false) + .replace ("HEADERGUARD", makeHeaderGuardName (mainWindowH), false); String windowCpp = project.getFileTemplate ("jucer_WindowTemplate_cpp") - .replace (T("INCLUDES"), createIncludeStatement (mainWindowH, mainWindowCpp), false) - .replace (T("WINDOWCLASS"), windowClassName, false); + .replace ("INCLUDES", createIncludeStatement (mainWindowH, mainWindowCpp), false) + .replace ("WINDOWCLASS", windowClassName, false); if (! overwriteFileWithNewDataIfDifferent (mainWindowH, windowH)) failedFiles.add (mainWindowH.getFullPathName()); @@ -112,16 +112,16 @@ public: if (createMainCpp) { String mainCpp = project.getFileTemplate ("jucer_MainTemplate_cpp") - .replace (T("APPHEADERS"), appHeaders, false) - .replace (T("APPCLASSNAME"), makeValidCppIdentifier (appTitle + "Application", false, true, false), false) - .replace (T("MEMBERINITIALISERS"), memberInitialisers, false) - .replace (T("APPINITCODE"), initCode, false) - .replace (T("APPSHUTDOWNCODE"), shutdownCode, false) - .replace (T("APPNAME"), replaceCEscapeChars (appTitle), false) - .replace (T("APPVERSION"), T("1.0"), false) - .replace (T("ALLOWMORETHANONEINSTANCE"), T("true"), false) - .replace (T("ANOTHERINSTANCECODE"), anotherInstanceStartedCode, false) - .replace (T("PRIVATEMEMBERS"), privateMembers, false); + .replace ("APPHEADERS", appHeaders, false) + .replace ("APPCLASSNAME", makeValidCppIdentifier (appTitle + "Application", false, true, false), false) + .replace ("MEMBERINITIALISERS", memberInitialisers, false) + .replace ("APPINITCODE", initCode, false) + .replace ("APPSHUTDOWNCODE", shutdownCode, false) + .replace ("APPNAME", replaceCEscapeChars (appTitle), false) + .replace ("APPVERSION", "1.0", false) + .replace ("ALLOWMORETHANONEINSTANCE", "true", false) + .replace ("ANOTHERINSTANCECODE", anotherInstanceStartedCode, false) + .replace ("PRIVATEMEMBERS", privateMembers, false); if (! overwriteFileWithNewDataIfDifferent (mainCppFile, mainCpp)) failedFiles.add (mainCppFile.getFullPathName()); @@ -158,7 +158,7 @@ public: { createMainCpp = false; - switch (aw.getComboBoxComponent("files")->getSelectedItemIndex()) + switch (aw.getComboBoxComponent ("files")->getSelectedItemIndex()) { case 0: createMainCpp = true; break; case 1: break; @@ -189,7 +189,7 @@ public: String appHeaders (createIncludeStatement (project.getAppIncludeFile(), mainCppFile)); String mainCpp = project.getFileTemplate ("jucer_MainConsoleAppTemplate_cpp") - .replace (T("APPHEADERS"), appHeaders, false); + .replace ("APPHEADERS", appHeaders, false); if (! overwriteFileWithNewDataIfDifferent (mainCppFile, mainCpp)) failedFiles.add (mainCppFile.getFullPathName()); @@ -251,27 +251,27 @@ public: appHeaders << newLine << createIncludeStatement (project.getPluginCharacteristicsFile(), filterCppFile); String filterCpp = project.getFileTemplate ("jucer_AudioPluginFilterTemplate_cpp") - .replace (T("FILTERHEADERS"), createIncludeStatement (filterHFile, filterCppFile) + .replace ("FILTERHEADERS", createIncludeStatement (filterHFile, filterCppFile) + newLine + createIncludeStatement (editorHFile, filterCppFile), false) - .replace (T("FILTERCLASSNAME"), filterClassName, false) - .replace (T("EDITORCLASSNAME"), editorClassName, false); + .replace ("FILTERCLASSNAME", filterClassName, false) + .replace ("EDITORCLASSNAME", editorClassName, false); String filterH = project.getFileTemplate ("jucer_AudioPluginFilterTemplate_h") - .replace (T("APPHEADERS"), appHeaders, false) - .replace (T("FILTERCLASSNAME"), filterClassName, false) - .replace (T("HEADERGUARD"), makeHeaderGuardName (filterHFile), false); + .replace ("APPHEADERS", appHeaders, false) + .replace ("FILTERCLASSNAME", filterClassName, false) + .replace ("HEADERGUARD", makeHeaderGuardName (filterHFile), false); String editorCpp = project.getFileTemplate ("jucer_AudioPluginEditorTemplate_cpp") - .replace (T("EDITORCPPHEADERS"), createIncludeStatement (filterHFile, filterCppFile) + .replace ("EDITORCPPHEADERS", createIncludeStatement (filterHFile, filterCppFile) + newLine + createIncludeStatement (editorHFile, filterCppFile), false) - .replace (T("FILTERCLASSNAME"), filterClassName, false) - .replace (T("EDITORCLASSNAME"), editorClassName, false); + .replace ("FILTERCLASSNAME", filterClassName, false) + .replace ("EDITORCLASSNAME", editorClassName, false); String editorH = project.getFileTemplate ("jucer_AudioPluginEditorTemplate_h") - .replace (T("EDITORHEADERS"), appHeaders + newLine + createIncludeStatement (filterHFile, filterCppFile), false) - .replace (T("FILTERCLASSNAME"), filterClassName, false) - .replace (T("EDITORCLASSNAME"), editorClassName, false) - .replace (T("HEADERGUARD"), makeHeaderGuardName (editorHFile), false); + .replace ("EDITORHEADERS", appHeaders + newLine + createIncludeStatement (filterHFile, filterCppFile), false) + .replace ("FILTERCLASSNAME", filterClassName, false) + .replace ("EDITORCLASSNAME", editorClassName, false) + .replace ("HEADERGUARD", makeHeaderGuardName (editorHFile), false); if (! overwriteFileWithNewDataIfDifferent (filterCppFile, filterCpp)) failedFiles.add (filterCppFile.getFullPathName()); @@ -482,7 +482,7 @@ Project* ProjectWizard::runNewProjectWizard (Component* ownerWindow) if (isJuceFolder (juceFolderSelector.getCurrentFile())) { - wizard = createWizard (aw.getComboBoxComponent("type")->getSelectedItemIndex()); + wizard = createWizard (aw.getComboBoxComponent ("type")->getSelectedItemIndex()); break; } diff --git a/extras/Jucer (experimental)/Source/model/jucer_ResourceFile.cpp b/extras/Jucer (experimental)/Source/model/jucer_ResourceFile.cpp index 69c521c5ad..6b00cae13e 100644 --- a/extras/Jucer (experimental)/Source/model/jucer_ResourceFile.cpp +++ b/extras/Jucer (experimental)/Source/model/jucer_ResourceFile.cpp @@ -27,7 +27,7 @@ #include "../ui/jucer_ProjectTreeViewBase.h" #include "../ui/jucer_OpenDocumentManager.h" -static const tchar* resourceFileIdentifierString = T("JUCER_BINARY_RESOURCE"); +static const char* resourceFileIdentifierString = "JUCER_BINARY_RESOURCE"; //============================================================================== @@ -211,8 +211,8 @@ bool ResourceFile::write (const File& cppFile, OutputStream& cpp, OutputStream& for (i = 0; i < files.size(); ++i) { String variableNameRoot (makeValidCppIdentifier (files.getUnchecked(i)->getFileName() - .replaceCharacters (T(" ."), T("__")) - .retainCharacters (T("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_0123456789")), + .replaceCharacters (" .", "__") + .retainCharacters ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_0123456789"), false, true, false)); String variableName (variableNameRoot); diff --git a/extras/Jucer (experimental)/Source/ui/Component Editor/jucer_ComponentEditor.cpp b/extras/Jucer (experimental)/Source/ui/Component Editor/jucer_ComponentEditor.cpp new file mode 100644 index 0000000000..9b203d4a85 --- /dev/null +++ b/extras/Jucer (experimental)/Source/ui/Component Editor/jucer_ComponentEditor.cpp @@ -0,0 +1,54 @@ +/* + ============================================================================== + + This file is part of the JUCE library - "Jules' Utility Class Extensions" + Copyright 2004-9 by Raw Material Software Ltd. + + ------------------------------------------------------------------------------ + + JUCE can be redistributed and/or modified under the terms of the GNU General + Public License (Version 2), as published by the Free Software Foundation. + A copy of the license is included in the JUCE distribution, or can be found + online at www.gnu.org/licenses. + + JUCE is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + ------------------------------------------------------------------------------ + + To release a closed-source product which uses JUCE, commercial licenses are + available: visit www.rawmaterialsoftware.com/juce for more information. + + ============================================================================== +*/ + +#include "../../jucer_Headers.h" +#include "jucer_ComponentEditor.h" + + +//============================================================================== +ComponentEditor::ComponentEditor (OpenDocumentManager::Document* document, + Project* project_, ComponentDocument* componentDocument_) + : DocumentEditorComponent (document), + project (project_), + componentDocument (componentDocument_) +{ + jassert (componentDocument != 0); + + setOpaque (true); +} + +ComponentEditor::~ComponentEditor() +{ + deleteAllChildren(); +} + +void ComponentEditor::paint (Graphics& g) +{ + g.fillAll (Colours::white); +} + +void ComponentEditor::resized() +{ +} diff --git a/extras/Jucer (experimental)/Source/ui/Component Editor/jucer_ComponentEditor.h b/extras/Jucer (experimental)/Source/ui/Component Editor/jucer_ComponentEditor.h new file mode 100644 index 0000000000..07f6e914cd --- /dev/null +++ b/extras/Jucer (experimental)/Source/ui/Component Editor/jucer_ComponentEditor.h @@ -0,0 +1,59 @@ +/* + ============================================================================== + + This file is part of the JUCE library - "Jules' Utility Class Extensions" + Copyright 2004-9 by Raw Material Software Ltd. + + ------------------------------------------------------------------------------ + + JUCE can be redistributed and/or modified under the terms of the GNU General + Public License (Version 2), as published by the Free Software Foundation. + A copy of the license is included in the JUCE distribution, or can be found + online at www.gnu.org/licenses. + + JUCE is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + ------------------------------------------------------------------------------ + + To release a closed-source product which uses JUCE, commercial licenses are + available: visit www.rawmaterialsoftware.com/juce for more information. + + ============================================================================== +*/ + +#ifndef __JUCE_COMPONENTEDITOR_H_6CAE6B7E__ +#define __JUCE_COMPONENTEDITOR_H_6CAE6B7E__ + +#include "../../model/jucer_ComponentDocument.h" +#include "../jucer_DocumentEditorComponent.h" + + +//============================================================================== +/** +*/ +class ComponentEditor : public DocumentEditorComponent +{ +public: + //============================================================================== + ComponentEditor (OpenDocumentManager::Document* document, + Project* project, + ComponentDocument* componentDocument); + + ~ComponentEditor(); + + //============================================================================== + void paint (Graphics& g); + void resized(); + + ComponentDocument& getDocument() const { return *componentDocument; } + +private: + Project* project; + ComponentDocument* componentDocument; +}; + + + +#endif // __JUCE_COMPONENTEDITOR_H_6CAE6B7E__ diff --git a/extras/Jucer (experimental)/Source/ui/jucer_CommandIDs.h b/extras/Jucer (experimental)/Source/ui/jucer_CommandIDs.h index b087cd880a..50ed171d8d 100644 --- a/extras/Jucer (experimental)/Source/ui/jucer_CommandIDs.h +++ b/extras/Jucer (experimental)/Source/ui/jucer_CommandIDs.h @@ -81,8 +81,8 @@ namespace CommandIDs namespace CommandCategories { - static const tchar* const general = T("General"); - static const tchar* const editing = T("Editing"); - static const tchar* const view = T("View"); - static const tchar* const windows = T("Windows"); + static const char* const general = "General"; + static const char* const editing = "Editing"; + static const char* const view = "View"; + static const char* const windows = "Windows"; } diff --git a/extras/Jucer (experimental)/Source/ui/jucer_MainWindow.cpp b/extras/Jucer (experimental)/Source/ui/jucer_MainWindow.cpp index aa8f62458a..d0cba35df6 100644 --- a/extras/Jucer (experimental)/Source/ui/jucer_MainWindow.cpp +++ b/extras/Jucer (experimental)/Source/ui/jucer_MainWindow.cpp @@ -329,9 +329,9 @@ const PopupMenu MainWindow::getMenuForIndex (int topLevelMenuIndex, PopupMenu m; for (int i = 0; i < numElementsInArray (snapSizes); ++i) - m.addItem (300 + i, String (snapSizes[i]) + T(" pixels"), true, snapSizes[i] == currentSnapSize); + m.addItem (300 + i, String (snapSizes[i]) + " pixels", true, snapSizes[i] == currentSnapSize); - menu.addSubMenu (T("Grid size"), m, getActiveDocument() != 0);*/ + menu.addSubMenu ("Grid size", m, getActiveDocument() != 0);*/ menu.addSeparator(); menu.addCommandItem (commandManager, CommandIDs::zoomIn); @@ -344,7 +344,7 @@ const PopupMenu MainWindow::getMenuForIndex (int topLevelMenuIndex, overlays.addCommandItem (commandManager, CommandIDs::compOverlay33); overlays.addCommandItem (commandManager, CommandIDs::compOverlay66); overlays.addCommandItem (commandManager, CommandIDs::compOverlay100); - menu.addSubMenu (T("Component Overlay"), overlays, + menu.addSubMenu ("Component Overlay", overlays, getActiveDocument() != 0 && getActiveDocument()->getComponentLayout() != 0);*/ menu.addSeparator(); diff --git a/extras/Jucer (experimental)/Source/ui/jucer_ProjectInformationComponent.cpp b/extras/Jucer (experimental)/Source/ui/jucer_ProjectInformationComponent.cpp index 7e7089be3f..e4450ada74 100644 --- a/extras/Jucer (experimental)/Source/ui/jucer_ProjectInformationComponent.cpp +++ b/extras/Jucer (experimental)/Source/ui/jucer_ProjectInformationComponent.cpp @@ -182,15 +182,15 @@ ProjectInformationComponent::ProjectInformationComponent (Project& project_) configTabBox->setCurrentTabIndex (-1); addAndMakeVisible (editConfigsButton = new TextButton (String::empty)); - editConfigsButton->setButtonText (T("Add/Remove Configurations...")); + editConfigsButton->setButtonText ("Add/Remove Configurations..."); editConfigsButton->addButtonListener (this); addAndMakeVisible (openProjectButton = new TextButton (String::empty)); - openProjectButton->setButtonText (T("Open Project in ")); + openProjectButton->setButtonText ("Open Project in "); openProjectButton->addButtonListener (this); addAndMakeVisible (editExportersButton = new TextButton (String::empty)); - editExportersButton->setButtonText (T("Add/Remove Exporters...")); + editExportersButton->setButtonText ("Add/Remove Exporters..."); editExportersButton->addButtonListener (this); diff --git a/extras/Jucer (experimental)/Source/utility/jucer_ColourEditorComponent.h b/extras/Jucer (experimental)/Source/utility/jucer_ColourEditorComponent.h index 463f911cdf..563df2467f 100644 --- a/extras/Jucer (experimental)/Source/utility/jucer_ColourEditorComponent.h +++ b/extras/Jucer (experimental)/Source/utility/jucer_ColourEditorComponent.h @@ -109,7 +109,7 @@ private: defaultButton (0) { addAndMakeVisible (selector = new ColourSelectorWithSwatches()); - selector->setName (T("Colour")); + selector->setName ("Colour"); selector->setCurrentColour (owner->getColour()); selector->addChangeListener (owner); diff --git a/extras/Jucer (experimental)/Source/utility/jucer_RelativePath.h b/extras/Jucer (experimental)/Source/utility/jucer_RelativePath.h index 5a3057d502..2b015fe95a 100644 --- a/extras/Jucer (experimental)/Source/utility/jucer_RelativePath.h +++ b/extras/Jucer (experimental)/Source/utility/jucer_RelativePath.h @@ -71,7 +71,7 @@ public: const RelativePath withFileExtension (const String& extension) const { - return RelativePath (path.upToLastOccurrenceOf (T("."), ! extension.startsWithChar ('.'), false) + extension, root); + return RelativePath (path.upToLastOccurrenceOf (".", ! extension.startsWithChar ('.'), false) + extension, root); } const RelativePath getParentDirectory() const @@ -80,7 +80,7 @@ public: if (path.endsWithChar ('/')) p = p.dropLastCharacters (1); - return RelativePath (p.upToLastOccurrenceOf (T("/"), false, false), root); + return RelativePath (p.upToLastOccurrenceOf ("/", false, false), root); } const RelativePath getChildFile (const String& subpath) const diff --git a/extras/Jucer (experimental)/Source/utility/jucer_UtilityFunctions.cpp b/extras/Jucer (experimental)/Source/utility/jucer_UtilityFunctions.cpp index 4396c4a676..0ff0a54821 100644 --- a/extras/Jucer (experimental)/Source/utility/jucer_UtilityFunctions.cpp +++ b/extras/Jucer (experimental)/Source/utility/jucer_UtilityFunctions.cpp @@ -189,7 +189,7 @@ bool shouldPathsBeRelative (String path1, String path2) ++commonBitLength; } - return path1.substring (0, commonBitLength).removeCharacters (T("/:")).isNotEmpty(); + return path1.substring (0, commonBitLength).removeCharacters ("/:").isNotEmpty(); } const String createIncludeStatement (const File& includeFile, const File& targetFile) @@ -201,8 +201,8 @@ const String createIncludeStatement (const File& includeFile, const File& target const String makeHeaderGuardName (const File& file) { return "__" + file.getFileName().toUpperCase() - .replaceCharacters (T(" ."), T("__")) - .retainCharacters (T("_ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")) + .replaceCharacters (" .", "__") + .retainCharacters ("_ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789") + "_" + String::toHexString (file.hashCode()).toUpperCase() + "__"; @@ -211,7 +211,7 @@ const String makeHeaderGuardName (const File& file) //============================================================================== bool isJuceFolder (const File& folder) { - return folder.getFileName().containsIgnoreCase (T("juce")) + return folder.getFileName().containsIgnoreCase ("juce") && folder.getChildFile ("juce.h").exists() && folder.getChildFile ("juce_Config.h").exists(); } @@ -327,9 +327,9 @@ const String makeValidCppIdentifier (String s, const bool allowTemplates) { if (removeColons) - s = s.replaceCharacters (T(".,;:/@"), T("______")); + s = s.replaceCharacters (".,;:/@", "______"); else - s = s.replaceCharacters (T(".,;/@"), T("_____")); + s = s.replaceCharacters (".,;/@", "_____"); int i; for (i = s.length(); --i > 0;) @@ -337,7 +337,7 @@ const String makeValidCppIdentifier (String s, && CharacterFunctions::isLetter (s[i - 1]) && CharacterFunctions::isUpperCase (s[i]) && ! CharacterFunctions::isUpperCase (s[i - 1])) - s = s.substring (0, i) + T(" ") + s.substring (i); + s = s.substring (0, i) + " " + s.substring (i); String allowedChars ("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_ 0123456789"); if (allowTemplates) @@ -474,7 +474,7 @@ const String justificationToCode (const Justification& justification) const String castToFloat (const String& expression) { - if (expression.containsOnly (T("0123456789.f"))) + if (expression.containsOnly ("0123456789.f")) { String s (expression.getFloatValue()); @@ -492,7 +492,7 @@ const String indentCode (const String& code, const int numSpaces) if (numSpaces == 0) return code; - const String space (String::repeatedString (T(" "), numSpaces)); + const String space (String::repeatedString (" ", numSpaces)); StringArray lines; lines.addLines (code); diff --git a/juce_amalgamated.cpp b/juce_amalgamated.cpp index dcb488a752..1234ceae1c 100644 --- a/juce_amalgamated.cpp +++ b/juce_amalgamated.cpp @@ -210833,14 +210833,12 @@ namespace PNGHelpers static void readCallback (png_structp png, png_bytep data, png_size_t length) { - if (png != 0 && png->io_ptr != 0) - static_cast (png->io_ptr)->read (data, (int) length); + static_cast (png_get_io_ptr (png))->read (data, (int) length); } static void writeDataCallback (png_structp png, png_bytep data, png_size_t length) { - if (png != 0 && png->io_ptr != 0) - static_cast (png->io_ptr)->write (data, (int) length); + static_cast (png_get_io_ptr (png))->write (data, (int) length); } struct PNGErrorStruct {}; diff --git a/juce_amalgamated.h b/juce_amalgamated.h index 284b9ac920..3585448a3b 100644 --- a/juce_amalgamated.h +++ b/juce_amalgamated.h @@ -43,7 +43,7 @@ #define JUCE_MAJOR_VERSION 1 #define JUCE_MINOR_VERSION 51 -#define JUCE_BUILDNUMBER 12 +#define JUCE_BUILDNUMBER 13 #define JUCE_VERSION ((JUCE_MAJOR_VERSION << 16) + (JUCE_MINOR_VERSION << 8) + JUCE_BUILDNUMBER) @@ -842,6 +842,9 @@ inline int roundFloatToInt (const float value) throw() namespace TypeHelpers { +#if defined (_MSC_VER) && _MSC_VER <= 1400 + #define PARAMETER_TYPE(a) a +#else template struct ParameterType { typedef const Type& type; }; template struct ParameterType { typedef Type& type; }; template struct ParameterType { typedef Type* type; }; @@ -858,6 +861,9 @@ namespace TypeHelpers template <> struct ParameterType { typedef bool type; }; template <> struct ParameterType { typedef float type; }; template <> struct ParameterType { typedef double type; }; + + #define PARAMETER_TYPE(a) typename TypeHelpers::ParameterType::type +#endif } #endif // __JUCE_MATHSFUNCTIONS_JUCEHEADER__ @@ -1953,6 +1959,13 @@ template class Array { +private: + #if defined (_MSC_VER) && _MSC_VER <= 1400 + typedef const ElementType& ParameterType; + #else + typedef PARAMETER_TYPE (ElementType) ParameterType; + #endif + public: Array() throw() @@ -2085,7 +2098,7 @@ public: : ElementType(); } - int indexOf (typename TypeHelpers::ParameterType::type elementToLookFor) const + int indexOf (ParameterType elementToLookFor) const { const ScopedLockType lock (getLock()); const ElementType* e = data.elements.getData(); @@ -2102,7 +2115,7 @@ public: return -1; } - bool contains (typename TypeHelpers::ParameterType::type elementToLookFor) const + bool contains (ParameterType elementToLookFor) const { const ScopedLockType lock (getLock()); const ElementType* e = data.elements.getData(); @@ -2119,14 +2132,14 @@ public: return false; } - void add (typename TypeHelpers::ParameterType::type newElement) + void add (ParameterType newElement) { const ScopedLockType lock (getLock()); data.ensureAllocatedSize (numUsed + 1); new (data.elements + numUsed++) ElementType (newElement); } - void insert (int indexToInsertAt, typename TypeHelpers::ParameterType::type newElement) + void insert (int indexToInsertAt, ParameterType newElement) { const ScopedLockType lock (getLock()); data.ensureAllocatedSize (numUsed + 1); @@ -2148,7 +2161,7 @@ public: } } - void insertMultiple (int indexToInsertAt, typename TypeHelpers::ParameterType::type newElement, + void insertMultiple (int indexToInsertAt, ParameterType newElement, int numberOfTimesToInsertIt) { if (numberOfTimesToInsertIt > 0) @@ -2203,7 +2216,7 @@ public: } } - void addIfNotAlreadyThere (typename TypeHelpers::ParameterType::type newElement) + void addIfNotAlreadyThere (ParameterType newElement) { const ScopedLockType lock (getLock()); @@ -2211,7 +2224,7 @@ public: add (newElement); } - void set (const int indexToChange, typename TypeHelpers::ParameterType::type newValue) + void set (const int indexToChange, ParameterType newValue) { jassert (indexToChange >= 0); const ScopedLockType lock (getLock()); @@ -2227,7 +2240,7 @@ public: } } - void setUnchecked (const int indexToChange, typename TypeHelpers::ParameterType::type newValue) + void setUnchecked (const int indexToChange, ParameterType newValue) { const ScopedLockType lock (getLock()); jassert (((unsigned int) indexToChange) < (unsigned int) numUsed); @@ -2278,14 +2291,14 @@ public: } template - void addSorted (ElementComparator& comparator, typename TypeHelpers::ParameterType::type newElement) + void addSorted (ElementComparator& comparator, ParameterType newElement) { const ScopedLockType lock (getLock()); insert (findInsertIndexInSortedArray (comparator, data.elements.getData(), newElement, 0, numUsed), newElement); } template - int indexOfSorted (ElementComparator& comparator, typename TypeHelpers::ParameterType::type elementToLookFor) const + int indexOfSorted (ElementComparator& comparator, ParameterType elementToLookFor) const { (void) comparator; // if you pass in an object with a static compareElements() method, this // avoids getting warning messages about the parameter being unused @@ -2345,7 +2358,7 @@ public: } } - void removeValue (typename TypeHelpers::ParameterType::type valueToRemove) + void removeValue (ParameterType valueToRemove) { const ScopedLockType lock (getLock()); ElementType* e = data.elements; @@ -6110,6 +6123,15 @@ template > class ListenerList { + // Horrible macros required to support VC6/7.. + #if defined (_MSC_VER) && _MSC_VER <= 1400 + #define LL_TEMPLATE(a) typename P##a, typename Q##a + #define LL_PARAM(a) Q##a& param##a + #else + #define LL_TEMPLATE(a) typename P##a + #define LL_PARAM(a) PARAMETER_TYPE(P##a) param##a + #endif + public: ListenerList() @@ -6165,106 +6187,85 @@ public: (iter.getListener()->*callbackFunction) (); } - template - void call (void (ListenerClass::*callbackFunction) (P1), - typename TypeHelpers::ParameterType::type param1) + template + void call (void (ListenerClass::*callbackFunction) (P1), LL_PARAM(1)) { for (Iterator iter (*this, DummyBailOutChecker()); iter.next();) (iter.getListener()->*callbackFunction) (param1); } - template + template void callChecked (const BailOutCheckerType& bailOutChecker, void (ListenerClass::*callbackFunction) (P1), - typename TypeHelpers::ParameterType::type param1) + LL_PARAM(1)) { for (Iterator iter (*this, bailOutChecker); iter.next();) (iter.getListener()->*callbackFunction) (param1); } - template + template void call (void (ListenerClass::*callbackFunction) (P1, P2), - typename TypeHelpers::ParameterType::type param1, - typename TypeHelpers::ParameterType::type param2) + LL_PARAM(1), LL_PARAM(2)) { for (Iterator iter (*this, DummyBailOutChecker()); iter.next();) (iter.getListener()->*callbackFunction) (param1, param2); } - template + template void callChecked (const BailOutCheckerType& bailOutChecker, void (ListenerClass::*callbackFunction) (P1, P2), - typename TypeHelpers::ParameterType::type param1, - typename TypeHelpers::ParameterType::type param2) + LL_PARAM(1), LL_PARAM(2)) { for (Iterator iter (*this, bailOutChecker); iter.next();) (iter.getListener()->*callbackFunction) (param1, param2); } - template + template void call (void (ListenerClass::*callbackFunction) (P1, P2, P3), - typename TypeHelpers::ParameterType::type param1, - typename TypeHelpers::ParameterType::type param2, - typename TypeHelpers::ParameterType::type param3) + LL_PARAM(1), LL_PARAM(2), LL_PARAM(3)) { for (Iterator iter (*this, DummyBailOutChecker()); iter.next();) (iter.getListener()->*callbackFunction) (param1, param2, param3); } - template + template void callChecked (const BailOutCheckerType& bailOutChecker, void (ListenerClass::*callbackFunction) (P1, P2, P3), - typename TypeHelpers::ParameterType::type param1, - typename TypeHelpers::ParameterType::type param2, - typename TypeHelpers::ParameterType::type param3) + LL_PARAM(1), LL_PARAM(2), LL_PARAM(3)) { for (Iterator iter (*this, bailOutChecker); iter.next();) (iter.getListener()->*callbackFunction) (param1, param2, param3); } - template + template void call (void (ListenerClass::*callbackFunction) (P1, P2, P3, P4), - typename TypeHelpers::ParameterType::type param1, - typename TypeHelpers::ParameterType::type param2, - typename TypeHelpers::ParameterType::type param3, - typename TypeHelpers::ParameterType::type param4) + LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4)) { for (Iterator iter (*this, DummyBailOutChecker()); iter.next();) (iter.getListener()->*callbackFunction) (param1, param2, param3, param4); } - template + template void callChecked (const BailOutCheckerType& bailOutChecker, void (ListenerClass::*callbackFunction) (P1, P2, P3, P4), - typename TypeHelpers::ParameterType::type param1, - typename TypeHelpers::ParameterType::type param2, - typename TypeHelpers::ParameterType::type param3, - typename TypeHelpers::ParameterType::type param4) + LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4)) { for (Iterator iter (*this, bailOutChecker); iter.next();) (iter.getListener()->*callbackFunction) (param1, param2, param3, param4); } - template + template void call (void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5), - typename TypeHelpers::ParameterType::type param1, - typename TypeHelpers::ParameterType::type param2, - typename TypeHelpers::ParameterType::type param3, - typename TypeHelpers::ParameterType::type param4, - typename TypeHelpers::ParameterType::type param5) + LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4), LL_PARAM(5)) { for (Iterator iter (*this, DummyBailOutChecker()); iter.next();) (iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5); } - template + template void callChecked (const BailOutCheckerType& bailOutChecker, void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5), - typename TypeHelpers::ParameterType::type param1, - typename TypeHelpers::ParameterType::type param2, - typename TypeHelpers::ParameterType::type param3, - typename TypeHelpers::ParameterType::type param4, - typename TypeHelpers::ParameterType::type param5) + LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4), LL_PARAM(5)) { for (Iterator iter (*this, bailOutChecker); iter.next();) (iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5); @@ -6326,6 +6327,9 @@ private: ListenerList (const ListenerList&); ListenerList& operator= (const ListenerList&); + + #undef LL_TEMPLATE + #undef LL_PARAM }; #endif // __JUCE_LISTENERLIST_JUCEHEADER__ diff --git a/src/containers/juce_Array.h b/src/containers/juce_Array.h index 0feb99fab7..c8b8e494ca 100644 --- a/src/containers/juce_Array.h +++ b/src/containers/juce_Array.h @@ -59,6 +59,13 @@ template class Array { +private: + #if defined (_MSC_VER) && _MSC_VER <= 1400 + typedef const ElementType& ParameterType; + #else + typedef PARAMETER_TYPE (ElementType) ParameterType; + #endif + public: //============================================================================== /** Creates an empty array. */ @@ -279,7 +286,7 @@ public: @param elementToLookFor the value or object to look for @returns the index of the object, or -1 if it's not found */ - int indexOf (typename TypeHelpers::ParameterType::type elementToLookFor) const + int indexOf (ParameterType elementToLookFor) const { const ScopedLockType lock (getLock()); const ElementType* e = data.elements.getData(); @@ -301,7 +308,7 @@ public: @param elementToLookFor the value or object to look for @returns true if the item is found */ - bool contains (typename TypeHelpers::ParameterType::type elementToLookFor) const + bool contains (ParameterType elementToLookFor) const { const ScopedLockType lock (getLock()); const ElementType* e = data.elements.getData(); @@ -324,7 +331,7 @@ public: @param newElement the new object to add to the array @see set, insert, addIfNotAlreadyThere, addSorted, addArray */ - void add (typename TypeHelpers::ParameterType::type newElement) + void add (ParameterType newElement) { const ScopedLockType lock (getLock()); data.ensureAllocatedSize (numUsed + 1); @@ -343,7 +350,7 @@ public: @param newElement the new object to add to the array @see add, addSorted, set */ - void insert (int indexToInsertAt, typename TypeHelpers::ParameterType::type newElement) + void insert (int indexToInsertAt, ParameterType newElement) { const ScopedLockType lock (getLock()); data.ensureAllocatedSize (numUsed + 1); @@ -377,7 +384,7 @@ public: @param numberOfTimesToInsertIt how many copies of the value to insert @see insert, add, addSorted, set */ - void insertMultiple (int indexToInsertAt, typename TypeHelpers::ParameterType::type newElement, + void insertMultiple (int indexToInsertAt, ParameterType newElement, int numberOfTimesToInsertIt) { if (numberOfTimesToInsertIt > 0) @@ -452,7 +459,7 @@ public: @param newElement the new object to add to the array */ - void addIfNotAlreadyThere (typename TypeHelpers::ParameterType::type newElement) + void addIfNotAlreadyThere (ParameterType newElement) { const ScopedLockType lock (getLock()); @@ -469,7 +476,7 @@ public: @param newValue the new value to set for this index. @see add, insert */ - void set (const int indexToChange, typename TypeHelpers::ParameterType::type newValue) + void set (const int indexToChange, ParameterType newValue) { jassert (indexToChange >= 0); const ScopedLockType lock (getLock()); @@ -494,7 +501,7 @@ public: @param newValue the new value to set for this index. @see set, getUnchecked */ - void setUnchecked (const int indexToChange, typename TypeHelpers::ParameterType::type newValue) + void setUnchecked (const int indexToChange, ParameterType newValue) { const ScopedLockType lock (getLock()); jassert (((unsigned int) indexToChange) < (unsigned int) numUsed); @@ -576,7 +583,7 @@ public: @see add, sort */ template - void addSorted (ElementComparator& comparator, typename TypeHelpers::ParameterType::type newElement) + void addSorted (ElementComparator& comparator, ParameterType newElement) { const ScopedLockType lock (getLock()); insert (findInsertIndexInSortedArray (comparator, data.elements.getData(), newElement, 0, numUsed), newElement); @@ -595,7 +602,7 @@ public: @see addSorted, sort */ template - int indexOfSorted (ElementComparator& comparator, typename TypeHelpers::ParameterType::type elementToLookFor) const + int indexOfSorted (ElementComparator& comparator, ParameterType elementToLookFor) const { (void) comparator; // if you pass in an object with a static compareElements() method, this // avoids getting warning messages about the parameter being unused @@ -674,7 +681,7 @@ public: @param valueToRemove the object to try to remove @see remove, removeRange */ - void removeValue (typename TypeHelpers::ParameterType::type valueToRemove) + void removeValue (ParameterType valueToRemove) { const ScopedLockType lock (getLock()); ElementType* e = data.elements; diff --git a/src/core/juce_MathsFunctions.h b/src/core/juce_MathsFunctions.h index 71b3c65020..151c28dd25 100644 --- a/src/core/juce_MathsFunctions.h +++ b/src/core/juce_MathsFunctions.h @@ -301,18 +301,25 @@ inline int roundFloatToInt (const float value) throw() } //============================================================================== -/** The namespace contains a few template classes for helping work out class type variations. +/** This namespace contains a few template classes for helping work out class type variations. */ namespace TypeHelpers { /** The ParameterType struct is used to find the best type to use when passing some kind of object as a parameter. - E.g. "myFunction (typename TypeHelpers::ParameterType::type, typename TypeHelpers::ParameterType::type)" - would evaluate to "myfunction (int, const MyObject&)", keeping primitive types passed-by-value, but passing - objects as a const reference, to avoid copying. Of course, this is only useful in certain esoteric - template situations. + Of course, this is only likely to be useful in certain esoteric template situations. + + Because "typename TypeHelpers::ParameterType::type" is a bit of a mouthful, there's + a PARAMETER_TYPE(SomeClass) macro that you can use to get the same effect. + + E.g. "myFunction (PARAMETER_TYPE (int), PARAMETER_TYPE (MyObject))" + would evaluate to "myfunction (int, const MyObject&)", keeping any primitive types as + pass-by-value, but passing objects as a const reference, to avoid copying. */ +#if defined (_MSC_VER) && _MSC_VER <= 1400 + #define PARAMETER_TYPE(a) a +#else template struct ParameterType { typedef const Type& type; }; template struct ParameterType { typedef Type& type; }; template struct ParameterType { typedef Type* type; }; @@ -329,6 +336,9 @@ namespace TypeHelpers template <> struct ParameterType { typedef bool type; }; template <> struct ParameterType { typedef float type; }; template <> struct ParameterType { typedef double type; }; + + #define PARAMETER_TYPE(a) typename TypeHelpers::ParameterType::type +#endif } diff --git a/src/core/juce_StandardHeader.h b/src/core/juce_StandardHeader.h index c2b45fe692..c18cefd292 100644 --- a/src/core/juce_StandardHeader.h +++ b/src/core/juce_StandardHeader.h @@ -33,7 +33,7 @@ */ #define JUCE_MAJOR_VERSION 1 #define JUCE_MINOR_VERSION 51 -#define JUCE_BUILDNUMBER 12 +#define JUCE_BUILDNUMBER 13 /** Current Juce version number. diff --git a/src/events/juce_ListenerList.h b/src/events/juce_ListenerList.h index 1c04e7bc2c..f7b2bf7e24 100644 --- a/src/events/juce_ListenerList.h +++ b/src/events/juce_ListenerList.h @@ -71,6 +71,15 @@ template > class ListenerList { + // Horrible macros required to support VC6/7.. + #if defined (_MSC_VER) && _MSC_VER <= 1400 + #define LL_TEMPLATE(a) typename P##a, typename Q##a + #define LL_PARAM(a) Q##a& param##a + #else + #define LL_TEMPLATE(a) typename P##a + #define LL_PARAM(a) PARAMETER_TYPE(P##a) param##a + #endif + public: //============================================================================== /** Creates an empty list. */ @@ -146,9 +155,8 @@ public: //============================================================================== /** Calls a member function on each listener in the list, with 1 parameter. */ - template - void call (void (ListenerClass::*callbackFunction) (P1), - typename TypeHelpers::ParameterType::type param1) + template + void call (void (ListenerClass::*callbackFunction) (P1), LL_PARAM(1)) { for (Iterator iter (*this, DummyBailOutChecker()); iter.next();) (iter.getListener()->*callbackFunction) (param1); @@ -156,10 +164,10 @@ public: /** Calls a member function on each listener in the list, with one parameter and a bail-out-checker. See the class description for info about writing a bail-out checker. */ - template + template void callChecked (const BailOutCheckerType& bailOutChecker, void (ListenerClass::*callbackFunction) (P1), - typename TypeHelpers::ParameterType::type param1) + LL_PARAM(1)) { for (Iterator iter (*this, bailOutChecker); iter.next();) (iter.getListener()->*callbackFunction) (param1); @@ -167,10 +175,9 @@ public: //============================================================================== /** Calls a member function on each listener in the list, with 2 parameters. */ - template + template void call (void (ListenerClass::*callbackFunction) (P1, P2), - typename TypeHelpers::ParameterType::type param1, - typename TypeHelpers::ParameterType::type param2) + LL_PARAM(1), LL_PARAM(2)) { for (Iterator iter (*this, DummyBailOutChecker()); iter.next();) (iter.getListener()->*callbackFunction) (param1, param2); @@ -178,11 +185,10 @@ public: /** Calls a member function on each listener in the list, with 2 parameters and a bail-out-checker. See the class description for info about writing a bail-out checker. */ - template + template void callChecked (const BailOutCheckerType& bailOutChecker, void (ListenerClass::*callbackFunction) (P1, P2), - typename TypeHelpers::ParameterType::type param1, - typename TypeHelpers::ParameterType::type param2) + LL_PARAM(1), LL_PARAM(2)) { for (Iterator iter (*this, bailOutChecker); iter.next();) (iter.getListener()->*callbackFunction) (param1, param2); @@ -190,11 +196,9 @@ public: //============================================================================== /** Calls a member function on each listener in the list, with 3 parameters. */ - template + template void call (void (ListenerClass::*callbackFunction) (P1, P2, P3), - typename TypeHelpers::ParameterType::type param1, - typename TypeHelpers::ParameterType::type param2, - typename TypeHelpers::ParameterType::type param3) + LL_PARAM(1), LL_PARAM(2), LL_PARAM(3)) { for (Iterator iter (*this, DummyBailOutChecker()); iter.next();) (iter.getListener()->*callbackFunction) (param1, param2, param3); @@ -202,12 +206,10 @@ public: /** Calls a member function on each listener in the list, with 3 parameters and a bail-out-checker. See the class description for info about writing a bail-out checker. */ - template + template void callChecked (const BailOutCheckerType& bailOutChecker, void (ListenerClass::*callbackFunction) (P1, P2, P3), - typename TypeHelpers::ParameterType::type param1, - typename TypeHelpers::ParameterType::type param2, - typename TypeHelpers::ParameterType::type param3) + LL_PARAM(1), LL_PARAM(2), LL_PARAM(3)) { for (Iterator iter (*this, bailOutChecker); iter.next();) (iter.getListener()->*callbackFunction) (param1, param2, param3); @@ -215,12 +217,9 @@ public: //============================================================================== /** Calls a member function on each listener in the list, with 4 parameters. */ - template + template void call (void (ListenerClass::*callbackFunction) (P1, P2, P3, P4), - typename TypeHelpers::ParameterType::type param1, - typename TypeHelpers::ParameterType::type param2, - typename TypeHelpers::ParameterType::type param3, - typename TypeHelpers::ParameterType::type param4) + LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4)) { for (Iterator iter (*this, DummyBailOutChecker()); iter.next();) (iter.getListener()->*callbackFunction) (param1, param2, param3, param4); @@ -228,13 +227,10 @@ public: /** Calls a member function on each listener in the list, with 4 parameters and a bail-out-checker. See the class description for info about writing a bail-out checker. */ - template + template void callChecked (const BailOutCheckerType& bailOutChecker, void (ListenerClass::*callbackFunction) (P1, P2, P3, P4), - typename TypeHelpers::ParameterType::type param1, - typename TypeHelpers::ParameterType::type param2, - typename TypeHelpers::ParameterType::type param3, - typename TypeHelpers::ParameterType::type param4) + LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4)) { for (Iterator iter (*this, bailOutChecker); iter.next();) (iter.getListener()->*callbackFunction) (param1, param2, param3, param4); @@ -242,13 +238,9 @@ public: //============================================================================== /** Calls a member function on each listener in the list, with 5 parameters. */ - template + template void call (void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5), - typename TypeHelpers::ParameterType::type param1, - typename TypeHelpers::ParameterType::type param2, - typename TypeHelpers::ParameterType::type param3, - typename TypeHelpers::ParameterType::type param4, - typename TypeHelpers::ParameterType::type param5) + LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4), LL_PARAM(5)) { for (Iterator iter (*this, DummyBailOutChecker()); iter.next();) (iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5); @@ -256,14 +248,10 @@ public: /** Calls a member function on each listener in the list, with 5 parameters and a bail-out-checker. See the class description for info about writing a bail-out checker. */ - template + template void callChecked (const BailOutCheckerType& bailOutChecker, void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5), - typename TypeHelpers::ParameterType::type param1, - typename TypeHelpers::ParameterType::type param2, - typename TypeHelpers::ParameterType::type param3, - typename TypeHelpers::ParameterType::type param4, - typename TypeHelpers::ParameterType::type param5) + LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4), LL_PARAM(5)) { for (Iterator iter (*this, bailOutChecker); iter.next();) (iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5); @@ -334,6 +322,9 @@ private: ListenerList (const ListenerList&); ListenerList& operator= (const ListenerList&); + + #undef LL_TEMPLATE + #undef LL_PARAM }; diff --git a/src/gui/graphics/imaging/image_file_formats/juce_PNGLoader.cpp b/src/gui/graphics/imaging/image_file_formats/juce_PNGLoader.cpp index 694a27e0f6..d39f469709 100644 --- a/src/gui/graphics/imaging/image_file_formats/juce_PNGLoader.cpp +++ b/src/gui/graphics/imaging/image_file_formats/juce_PNGLoader.cpp @@ -115,14 +115,12 @@ namespace PNGHelpers static void readCallback (png_structp png, png_bytep data, png_size_t length) { - if (png != 0 && png->io_ptr != 0) - static_cast (png->io_ptr)->read (data, (int) length); + static_cast (png_get_io_ptr (png))->read (data, (int) length); } static void writeDataCallback (png_structp png, png_bytep data, png_size_t length) { - if (png != 0 && png->io_ptr != 0) - static_cast (png->io_ptr)->write (data, (int) length); + static_cast (png_get_io_ptr (png))->write (data, (int) length); } struct PNGErrorStruct {};