diff --git a/Builds/Linux/Makefile b/Builds/Linux/Makefile index b78d5fabec..8104ece745 100644 --- a/Builds/Linux/Makefile +++ b/Builds/Linux/Makefile @@ -101,6 +101,7 @@ OBJECTS := \ $(OBJDIR)/juce_ValueTree_f822be84.o \ $(OBJDIR)/juce_Variant_4f31c35a.o \ $(OBJDIR)/juce_FileLogger_7858478e.o \ + $(OBJDIR)/juce_Initialisation_fec765a9.o \ $(OBJDIR)/juce_Logger_4f4f7f72.o \ $(OBJDIR)/juce_PerformanceCounter_6422080e.o \ $(OBJDIR)/juce_Random_36899d25.o \ @@ -664,6 +665,11 @@ $(OBJDIR)/juce_FileLogger_7858478e.o: ../../src/core/juce_FileLogger.cpp @echo "Compiling juce_FileLogger.cpp" @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" +$(OBJDIR)/juce_Initialisation_fec765a9.o: ../../src/core/juce_Initialisation.cpp + -@mkdir -p $(OBJDIR) + @echo "Compiling juce_Initialisation.cpp" + @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" + $(OBJDIR)/juce_Logger_4f4f7f72.o: ../../src/core/juce_Logger.cpp -@mkdir -p $(OBJDIR) @echo "Compiling juce_Logger.cpp" diff --git a/Builds/MacOSX/Juce.xcodeproj/project.pbxproj b/Builds/MacOSX/Juce.xcodeproj/project.pbxproj index 67e233ff64..a6bea333ea 100644 --- a/Builds/MacOSX/Juce.xcodeproj/project.pbxproj +++ b/Builds/MacOSX/Juce.xcodeproj/project.pbxproj @@ -70,6 +70,7 @@ A230949FF8848D5E923F9083 = { isa = PBXBuildFile; fileRef = 5D27EE211D9BFF6A58C4DC42; }; 11162E9812CFB0E738A7E2E6 = { isa = PBXBuildFile; fileRef = 4DF9D333038A442870668D31; }; C682BEA7DB70FDC7C6BA2D6E = { isa = PBXBuildFile; fileRef = D66C00E06B06EAD3B5257DD6; }; + 77104E86801B6CAD01F963F4 = { isa = PBXBuildFile; fileRef = 5B789AAC295BA4BB6D5AD4A3; }; 6A53DA58B55E2DE7241BF2C8 = { isa = PBXBuildFile; fileRef = 4555F03DBD059EEDECEF9F85; }; 0FF71870483AC46D5B7AC5B0 = { isa = PBXBuildFile; fileRef = DF6CAC67C0F2D379BDA03062; }; 029702B3954F6968AE804B21 = { isa = PBXBuildFile; fileRef = 2C6C4AB5D82221AB303FBB34; }; @@ -416,6 +417,23 @@ A22A0F77C15B1E4A8F2EB42A = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_MidiMessageCollector.h; path = ../../src/audio/midi/juce_MidiMessageCollector.h; sourceTree = SOURCE_ROOT; }; 78D29BB5C76CCF7C21EC0DAF = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_MidiMessageSequence.cpp; path = ../../src/audio/midi/juce_MidiMessageSequence.cpp; sourceTree = SOURCE_ROOT; }; DD3886D45B5988B4DAC2D049 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_MidiMessageSequence.h; path = ../../src/audio/midi/juce_MidiMessageSequence.h; sourceTree = SOURCE_ROOT; }; + 1D420B75C62607886A571698 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = juce_AU_Wrapper.mm; path = "../../extras/audio plugins/wrapper/AU/juce_AU_Wrapper.mm"; sourceTree = SOURCE_ROOT; }; + 451684777825E63BCAD84F80 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_RTAS_DigiCode_Header.h; path = "../../extras/audio plugins/wrapper/RTAS/juce_RTAS_DigiCode_Header.h"; sourceTree = SOURCE_ROOT; }; + 34AB1C83D6D5BB468415EF9F = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_RTAS_DigiCode1.cpp; path = "../../extras/audio plugins/wrapper/RTAS/juce_RTAS_DigiCode1.cpp"; sourceTree = SOURCE_ROOT; }; + 1DF9F1811D91207E3399ED73 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_RTAS_DigiCode2.cpp; path = "../../extras/audio plugins/wrapper/RTAS/juce_RTAS_DigiCode2.cpp"; sourceTree = SOURCE_ROOT; }; + 0756D78F534D94A6D21DEB66 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_RTAS_DigiCode3.cpp; path = "../../extras/audio plugins/wrapper/RTAS/juce_RTAS_DigiCode3.cpp"; sourceTree = SOURCE_ROOT; }; + 7AA357732543414F6B93B193 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = juce_RTAS_MacUtilities.mm; path = "../../extras/audio plugins/wrapper/RTAS/juce_RTAS_MacUtilities.mm"; sourceTree = SOURCE_ROOT; }; + E99897FE7C6D6BF9FFDEBC08 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_RTAS_WinUtilities.cpp; path = "../../extras/audio plugins/wrapper/RTAS/juce_RTAS_WinUtilities.cpp"; sourceTree = SOURCE_ROOT; }; + 84BB474B771F9ED7E2267589 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_RTAS_Wrapper.cpp; path = "../../extras/audio plugins/wrapper/RTAS/juce_RTAS_Wrapper.cpp"; sourceTree = SOURCE_ROOT; }; + 8B169373A9223571680BFB71 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_VST_Wrapper.cpp; path = "../../extras/audio plugins/wrapper/VST/juce_VST_Wrapper.cpp"; sourceTree = SOURCE_ROOT; }; + 4238044BB69E2FAEC7B16982 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = juce_VST_Wrapper.mm; path = "../../extras/audio plugins/wrapper/VST/juce_VST_Wrapper.mm"; sourceTree = SOURCE_ROOT; }; + 6C5940264E5E38729E74EFD8 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_AudioFilterStreamer.cpp; path = "../../extras/audio plugins/wrapper/Standalone/juce_AudioFilterStreamer.cpp"; sourceTree = SOURCE_ROOT; }; + 955532BC480632ECF12F0481 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_AudioFilterStreamer.h; path = "../../extras/audio plugins/wrapper/Standalone/juce_AudioFilterStreamer.h"; sourceTree = SOURCE_ROOT; }; + 235F9F5E2A3113B6B774869C = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_StandaloneFilterWindow.cpp; path = "../../extras/audio plugins/wrapper/Standalone/juce_StandaloneFilterWindow.cpp"; sourceTree = SOURCE_ROOT; }; + 014FB7F784D205EC810AAA52 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_StandaloneFilterWindow.h; path = "../../extras/audio plugins/wrapper/Standalone/juce_StandaloneFilterWindow.h"; sourceTree = SOURCE_ROOT; }; + 6B3896A2CB1BB379BCDD9575 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_IncludeCharacteristics.h; path = "../../extras/audio plugins/wrapper/juce_IncludeCharacteristics.h"; sourceTree = SOURCE_ROOT; }; + 6F4941C73B96CE8028AD7999 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_PluginHeaders.h; path = "../../extras/audio plugins/wrapper/juce_PluginHeaders.h"; sourceTree = SOURCE_ROOT; }; + 21EAF73E1E8D839ABDF6B1CF = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_PluginHostType.h; path = "../../extras/audio plugins/wrapper/juce_PluginHostType.h"; sourceTree = SOURCE_ROOT; }; AA6DF2B7514484F0A2B06DAA = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_AudioUnitPluginFormat.h; path = ../../src/audio/plugins/formats/juce_AudioUnitPluginFormat.h; sourceTree = SOURCE_ROOT; }; 68D759C0812F1B2D8B1F0288 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = juce_AudioUnitPluginFormat.mm; path = ../../src/audio/plugins/formats/juce_AudioUnitPluginFormat.mm; sourceTree = SOURCE_ROOT; }; 6125D4A328E474BE7A48EF59 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_DirectXPluginFormat.h; path = ../../src/audio/plugins/formats/juce_DirectXPluginFormat.h; sourceTree = SOURCE_ROOT; }; @@ -487,6 +505,7 @@ 45AFA4791D59FBB1B548FB2C = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_ByteOrder.h; path = ../../src/core/juce_ByteOrder.h; sourceTree = SOURCE_ROOT; }; D66C00E06B06EAD3B5257DD6 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_FileLogger.cpp; path = ../../src/core/juce_FileLogger.cpp; sourceTree = SOURCE_ROOT; }; C8441B7B3E4CCD4A257B4BFE = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_FileLogger.h; path = ../../src/core/juce_FileLogger.h; sourceTree = SOURCE_ROOT; }; + 5B789AAC295BA4BB6D5AD4A3 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_Initialisation.cpp; path = ../../src/core/juce_Initialisation.cpp; sourceTree = SOURCE_ROOT; }; 92ACFFCCCD1C85A0F8C6F80F = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_Initialisation.h; path = ../../src/core/juce_Initialisation.h; sourceTree = SOURCE_ROOT; }; 4555F03DBD059EEDECEF9F85 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_Logger.cpp; path = ../../src/core/juce_Logger.cpp; sourceTree = SOURCE_ROOT; }; 63F44EC0485FCA050814967E = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_Logger.h; path = ../../src/core/juce_Logger.h; sourceTree = SOURCE_ROOT; }; @@ -1087,6 +1106,32 @@ A22A0F77C15B1E4A8F2EB42A, 78D29BB5C76CCF7C21EC0DAF, DD3886D45B5988B4DAC2D049 ); name = midi; sourceTree = ""; }; + 844109733F09B5915AF75797 = { isa = PBXGroup; children = ( + 1D420B75C62607886A571698 ); name = AU; sourceTree = ""; }; + FAA6189E385BD13EFEFE2E08 = { isa = PBXGroup; children = ( + 451684777825E63BCAD84F80, + 34AB1C83D6D5BB468415EF9F, + 1DF9F1811D91207E3399ED73, + 0756D78F534D94A6D21DEB66, + 7AA357732543414F6B93B193, + E99897FE7C6D6BF9FFDEBC08, + 84BB474B771F9ED7E2267589 ); name = RTAS; sourceTree = ""; }; + EBF4EE8E84A562DE2EBAE6BB = { isa = PBXGroup; children = ( + 8B169373A9223571680BFB71, + 4238044BB69E2FAEC7B16982 ); name = VST; sourceTree = ""; }; + 0F0D49D13522C94A0F37D4AB = { isa = PBXGroup; children = ( + 6C5940264E5E38729E74EFD8, + 955532BC480632ECF12F0481, + 235F9F5E2A3113B6B774869C, + 014FB7F784D205EC810AAA52 ); name = Standalone; sourceTree = ""; }; + 2805C9C796CD7D77C2D662BF = { isa = PBXGroup; children = ( + 844109733F09B5915AF75797, + FAA6189E385BD13EFEFE2E08, + EBF4EE8E84A562DE2EBAE6BB, + 0F0D49D13522C94A0F37D4AB, + 6B3896A2CB1BB379BCDD9575, + 6F4941C73B96CE8028AD7999, + 21EAF73E1E8D839ABDF6B1CF ); name = "wrapper code"; sourceTree = ""; }; 6FDCF1A0063FC0ABA27273A0 = { isa = PBXGroup; children = ( AA6DF2B7514484F0A2B06DAA, 68D759C0812F1B2D8B1F0288, @@ -1097,6 +1142,7 @@ BE58578E96493E70D76E080F, F13BFC8AE68ECB6E063BD8D4 ); name = formats; sourceTree = ""; }; 7AA82894558E047D7D5111E1 = { isa = PBXGroup; children = ( + 2805C9C796CD7D77C2D662BF, 6FDCF1A0063FC0ABA27273A0, 2CC1A8309CB8301FF9A22371, C4C9911456CA7EADB36E53E3, @@ -1174,6 +1220,7 @@ 45AFA4791D59FBB1B548FB2C, D66C00E06B06EAD3B5257DD6, C8441B7B3E4CCD4A257B4BFE, + 5B789AAC295BA4BB6D5AD4A3, 92ACFFCCCD1C85A0F8C6F80F, 4555F03DBD059EEDECEF9F85, 63F44EC0485FCA050814967E, @@ -1911,6 +1958,7 @@ A230949FF8848D5E923F9083, 11162E9812CFB0E738A7E2E6, C682BEA7DB70FDC7C6BA2D6E, + 77104E86801B6CAD01F963F4, 6A53DA58B55E2DE7241BF2C8, 0FF71870483AC46D5B7AC5B0, 029702B3954F6968AE804B21, diff --git a/Builds/VisualStudio2005/Juce.vcproj b/Builds/VisualStudio2005/Juce.vcproj index 91d3cc3947..b46de99df4 100644 --- a/Builds/VisualStudio2005/Juce.vcproj +++ b/Builds/VisualStudio2005/Juce.vcproj @@ -196,6 +196,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -278,6 +377,7 @@ + diff --git a/Builds/VisualStudio2008/Juce.vcproj b/Builds/VisualStudio2008/Juce.vcproj index 0246a9ae70..ae066b98ad 100644 --- a/Builds/VisualStudio2008/Juce.vcproj +++ b/Builds/VisualStudio2008/Juce.vcproj @@ -196,6 +196,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -278,6 +377,7 @@ + diff --git a/Builds/VisualStudio2008_DLL/Juce.vcproj b/Builds/VisualStudio2008_DLL/Juce.vcproj index c98fc80379..ab65a18e8d 100644 --- a/Builds/VisualStudio2008_DLL/Juce.vcproj +++ b/Builds/VisualStudio2008_DLL/Juce.vcproj @@ -198,6 +198,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -280,6 +379,7 @@ + diff --git a/Builds/VisualStudio2010/Juce.vcxproj b/Builds/VisualStudio2010/Juce.vcxproj index 598a1b5746..fa11c6305f 100644 --- a/Builds/VisualStudio2010/Juce.vcxproj +++ b/Builds/VisualStudio2010/Juce.vcxproj @@ -184,6 +184,7 @@ + @@ -468,6 +469,12 @@ + + + + + + diff --git a/Builds/VisualStudio2010/Juce.vcxproj.filters b/Builds/VisualStudio2010/Juce.vcxproj.filters index 55a432946b..4c4d1939b8 100644 --- a/Builds/VisualStudio2010/Juce.vcxproj.filters +++ b/Builds/VisualStudio2010/Juce.vcxproj.filters @@ -32,6 +32,21 @@ {726F1543-3280-C554-0844-B5AF99C2392D} + + {9C8B462A-0783-D028-ACCC-B099F374113E} + + + {7576D1E4-5D21-3FA6-7AB5-DCA6983C448C} + + + {2CF49E64-7F33-4B2A-255E-A9CD74998334} + + + {9958BD40-C957-0509-6285-D04460D9AA99} + + + {6936CA53-77BA-C4D2-1DB8-7BE972C31D08} + {46220919-DA8A-82C3-B033-1939CFCB5579} @@ -271,6 +286,39 @@ Juce\Source\audio\midi + + Juce\Source\audio\plugins\wrapper code\AU + + + Juce\Source\audio\plugins\wrapper code\RTAS + + + Juce\Source\audio\plugins\wrapper code\RTAS + + + Juce\Source\audio\plugins\wrapper code\RTAS + + + Juce\Source\audio\plugins\wrapper code\RTAS + + + Juce\Source\audio\plugins\wrapper code\RTAS + + + Juce\Source\audio\plugins\wrapper code\RTAS + + + Juce\Source\audio\plugins\wrapper code\VST + + + Juce\Source\audio\plugins\wrapper code\VST + + + Juce\Source\audio\plugins\wrapper code\Standalone + + + Juce\Source\audio\plugins\wrapper code\Standalone + Juce\Source\audio\plugins\formats @@ -352,6 +400,9 @@ Juce\Source\core + + Juce\Source\core + Juce\Source\core @@ -1278,6 +1329,24 @@ Juce\Source\audio\midi + + Juce\Source\audio\plugins\wrapper code\RTAS + + + Juce\Source\audio\plugins\wrapper code\Standalone + + + Juce\Source\audio\plugins\wrapper code\Standalone + + + Juce\Source\audio\plugins\wrapper code + + + Juce\Source\audio\plugins\wrapper code + + + Juce\Source\audio\plugins\wrapper code + Juce\Source\audio\plugins\formats diff --git a/Builds/iPhone/Juce.xcodeproj/project.pbxproj b/Builds/iPhone/Juce.xcodeproj/project.pbxproj index f15e457e0b..b8fd890b31 100644 --- a/Builds/iPhone/Juce.xcodeproj/project.pbxproj +++ b/Builds/iPhone/Juce.xcodeproj/project.pbxproj @@ -70,6 +70,7 @@ A230949FF8848D5E923F9083 = { isa = PBXBuildFile; fileRef = 5D27EE211D9BFF6A58C4DC42; }; 11162E9812CFB0E738A7E2E6 = { isa = PBXBuildFile; fileRef = 4DF9D333038A442870668D31; }; C682BEA7DB70FDC7C6BA2D6E = { isa = PBXBuildFile; fileRef = D66C00E06B06EAD3B5257DD6; }; + 77104E86801B6CAD01F963F4 = { isa = PBXBuildFile; fileRef = 5B789AAC295BA4BB6D5AD4A3; }; 6A53DA58B55E2DE7241BF2C8 = { isa = PBXBuildFile; fileRef = 4555F03DBD059EEDECEF9F85; }; 0FF71870483AC46D5B7AC5B0 = { isa = PBXBuildFile; fileRef = DF6CAC67C0F2D379BDA03062; }; 029702B3954F6968AE804B21 = { isa = PBXBuildFile; fileRef = 2C6C4AB5D82221AB303FBB34; }; @@ -416,6 +417,23 @@ A22A0F77C15B1E4A8F2EB42A = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_MidiMessageCollector.h; path = ../../src/audio/midi/juce_MidiMessageCollector.h; sourceTree = SOURCE_ROOT; }; 78D29BB5C76CCF7C21EC0DAF = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_MidiMessageSequence.cpp; path = ../../src/audio/midi/juce_MidiMessageSequence.cpp; sourceTree = SOURCE_ROOT; }; DD3886D45B5988B4DAC2D049 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_MidiMessageSequence.h; path = ../../src/audio/midi/juce_MidiMessageSequence.h; sourceTree = SOURCE_ROOT; }; + 1D420B75C62607886A571698 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = juce_AU_Wrapper.mm; path = "../../extras/audio plugins/wrapper/AU/juce_AU_Wrapper.mm"; sourceTree = SOURCE_ROOT; }; + 451684777825E63BCAD84F80 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_RTAS_DigiCode_Header.h; path = "../../extras/audio plugins/wrapper/RTAS/juce_RTAS_DigiCode_Header.h"; sourceTree = SOURCE_ROOT; }; + 34AB1C83D6D5BB468415EF9F = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_RTAS_DigiCode1.cpp; path = "../../extras/audio plugins/wrapper/RTAS/juce_RTAS_DigiCode1.cpp"; sourceTree = SOURCE_ROOT; }; + 1DF9F1811D91207E3399ED73 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_RTAS_DigiCode2.cpp; path = "../../extras/audio plugins/wrapper/RTAS/juce_RTAS_DigiCode2.cpp"; sourceTree = SOURCE_ROOT; }; + 0756D78F534D94A6D21DEB66 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_RTAS_DigiCode3.cpp; path = "../../extras/audio plugins/wrapper/RTAS/juce_RTAS_DigiCode3.cpp"; sourceTree = SOURCE_ROOT; }; + 7AA357732543414F6B93B193 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = juce_RTAS_MacUtilities.mm; path = "../../extras/audio plugins/wrapper/RTAS/juce_RTAS_MacUtilities.mm"; sourceTree = SOURCE_ROOT; }; + E99897FE7C6D6BF9FFDEBC08 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_RTAS_WinUtilities.cpp; path = "../../extras/audio plugins/wrapper/RTAS/juce_RTAS_WinUtilities.cpp"; sourceTree = SOURCE_ROOT; }; + 84BB474B771F9ED7E2267589 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_RTAS_Wrapper.cpp; path = "../../extras/audio plugins/wrapper/RTAS/juce_RTAS_Wrapper.cpp"; sourceTree = SOURCE_ROOT; }; + 8B169373A9223571680BFB71 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_VST_Wrapper.cpp; path = "../../extras/audio plugins/wrapper/VST/juce_VST_Wrapper.cpp"; sourceTree = SOURCE_ROOT; }; + 4238044BB69E2FAEC7B16982 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = juce_VST_Wrapper.mm; path = "../../extras/audio plugins/wrapper/VST/juce_VST_Wrapper.mm"; sourceTree = SOURCE_ROOT; }; + 6C5940264E5E38729E74EFD8 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_AudioFilterStreamer.cpp; path = "../../extras/audio plugins/wrapper/Standalone/juce_AudioFilterStreamer.cpp"; sourceTree = SOURCE_ROOT; }; + 955532BC480632ECF12F0481 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_AudioFilterStreamer.h; path = "../../extras/audio plugins/wrapper/Standalone/juce_AudioFilterStreamer.h"; sourceTree = SOURCE_ROOT; }; + 235F9F5E2A3113B6B774869C = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_StandaloneFilterWindow.cpp; path = "../../extras/audio plugins/wrapper/Standalone/juce_StandaloneFilterWindow.cpp"; sourceTree = SOURCE_ROOT; }; + 014FB7F784D205EC810AAA52 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_StandaloneFilterWindow.h; path = "../../extras/audio plugins/wrapper/Standalone/juce_StandaloneFilterWindow.h"; sourceTree = SOURCE_ROOT; }; + 6B3896A2CB1BB379BCDD9575 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_IncludeCharacteristics.h; path = "../../extras/audio plugins/wrapper/juce_IncludeCharacteristics.h"; sourceTree = SOURCE_ROOT; }; + 6F4941C73B96CE8028AD7999 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_PluginHeaders.h; path = "../../extras/audio plugins/wrapper/juce_PluginHeaders.h"; sourceTree = SOURCE_ROOT; }; + 21EAF73E1E8D839ABDF6B1CF = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_PluginHostType.h; path = "../../extras/audio plugins/wrapper/juce_PluginHostType.h"; sourceTree = SOURCE_ROOT; }; AA6DF2B7514484F0A2B06DAA = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_AudioUnitPluginFormat.h; path = ../../src/audio/plugins/formats/juce_AudioUnitPluginFormat.h; sourceTree = SOURCE_ROOT; }; 68D759C0812F1B2D8B1F0288 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = juce_AudioUnitPluginFormat.mm; path = ../../src/audio/plugins/formats/juce_AudioUnitPluginFormat.mm; sourceTree = SOURCE_ROOT; }; 6125D4A328E474BE7A48EF59 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_DirectXPluginFormat.h; path = ../../src/audio/plugins/formats/juce_DirectXPluginFormat.h; sourceTree = SOURCE_ROOT; }; @@ -487,6 +505,7 @@ 45AFA4791D59FBB1B548FB2C = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_ByteOrder.h; path = ../../src/core/juce_ByteOrder.h; sourceTree = SOURCE_ROOT; }; D66C00E06B06EAD3B5257DD6 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_FileLogger.cpp; path = ../../src/core/juce_FileLogger.cpp; sourceTree = SOURCE_ROOT; }; C8441B7B3E4CCD4A257B4BFE = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_FileLogger.h; path = ../../src/core/juce_FileLogger.h; sourceTree = SOURCE_ROOT; }; + 5B789AAC295BA4BB6D5AD4A3 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_Initialisation.cpp; path = ../../src/core/juce_Initialisation.cpp; sourceTree = SOURCE_ROOT; }; 92ACFFCCCD1C85A0F8C6F80F = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_Initialisation.h; path = ../../src/core/juce_Initialisation.h; sourceTree = SOURCE_ROOT; }; 4555F03DBD059EEDECEF9F85 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_Logger.cpp; path = ../../src/core/juce_Logger.cpp; sourceTree = SOURCE_ROOT; }; 63F44EC0485FCA050814967E = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_Logger.h; path = ../../src/core/juce_Logger.h; sourceTree = SOURCE_ROOT; }; @@ -1087,6 +1106,32 @@ A22A0F77C15B1E4A8F2EB42A, 78D29BB5C76CCF7C21EC0DAF, DD3886D45B5988B4DAC2D049 ); name = midi; sourceTree = ""; }; + 844109733F09B5915AF75797 = { isa = PBXGroup; children = ( + 1D420B75C62607886A571698 ); name = AU; sourceTree = ""; }; + FAA6189E385BD13EFEFE2E08 = { isa = PBXGroup; children = ( + 451684777825E63BCAD84F80, + 34AB1C83D6D5BB468415EF9F, + 1DF9F1811D91207E3399ED73, + 0756D78F534D94A6D21DEB66, + 7AA357732543414F6B93B193, + E99897FE7C6D6BF9FFDEBC08, + 84BB474B771F9ED7E2267589 ); name = RTAS; sourceTree = ""; }; + EBF4EE8E84A562DE2EBAE6BB = { isa = PBXGroup; children = ( + 8B169373A9223571680BFB71, + 4238044BB69E2FAEC7B16982 ); name = VST; sourceTree = ""; }; + 0F0D49D13522C94A0F37D4AB = { isa = PBXGroup; children = ( + 6C5940264E5E38729E74EFD8, + 955532BC480632ECF12F0481, + 235F9F5E2A3113B6B774869C, + 014FB7F784D205EC810AAA52 ); name = Standalone; sourceTree = ""; }; + 2805C9C796CD7D77C2D662BF = { isa = PBXGroup; children = ( + 844109733F09B5915AF75797, + FAA6189E385BD13EFEFE2E08, + EBF4EE8E84A562DE2EBAE6BB, + 0F0D49D13522C94A0F37D4AB, + 6B3896A2CB1BB379BCDD9575, + 6F4941C73B96CE8028AD7999, + 21EAF73E1E8D839ABDF6B1CF ); name = "wrapper code"; sourceTree = ""; }; 6FDCF1A0063FC0ABA27273A0 = { isa = PBXGroup; children = ( AA6DF2B7514484F0A2B06DAA, 68D759C0812F1B2D8B1F0288, @@ -1097,6 +1142,7 @@ BE58578E96493E70D76E080F, F13BFC8AE68ECB6E063BD8D4 ); name = formats; sourceTree = ""; }; 7AA82894558E047D7D5111E1 = { isa = PBXGroup; children = ( + 2805C9C796CD7D77C2D662BF, 6FDCF1A0063FC0ABA27273A0, 2CC1A8309CB8301FF9A22371, C4C9911456CA7EADB36E53E3, @@ -1174,6 +1220,7 @@ 45AFA4791D59FBB1B548FB2C, D66C00E06B06EAD3B5257DD6, C8441B7B3E4CCD4A257B4BFE, + 5B789AAC295BA4BB6D5AD4A3, 92ACFFCCCD1C85A0F8C6F80F, 4555F03DBD059EEDECEF9F85, 63F44EC0485FCA050814967E, @@ -1784,7 +1831,7 @@ SYMROOT = ../../bin; CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)"; DEPLOYMENT_LOCATION = YES; - SDKROOT = iphonesimulator3.0; + SDKROOT = iphonesimulator3.2; ONLY_ACTIVE_ARCH = YES; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; @@ -1803,7 +1850,7 @@ SYMROOT = ../../bin; CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)"; DEPLOYMENT_LOCATION = YES; - SDKROOT = iphonesimulator3.0; + SDKROOT = iphonesimulator3.2; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_SYMBOLS_PRIVATE_EXTERN = YES; GCC_PREPROCESSOR_DEFINITIONS = ( @@ -1911,6 +1958,7 @@ A230949FF8848D5E923F9083, 11162E9812CFB0E738A7E2E6, C682BEA7DB70FDC7C6BA2D6E, + 77104E86801B6CAD01F963F4, 6A53DA58B55E2DE7241BF2C8, 0FF71870483AC46D5B7AC5B0, 029702B3954F6968AE804B21, diff --git a/Juce.jucer b/Juce.jucer index f2ea35a8c9..38f98e70ba 100644 --- a/Juce.jucer +++ b/Juce.jucer @@ -215,6 +215,50 @@ resource="0" file="src/audio/midi/juce_MidiMessageSequence.h"/> + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -365,6 +409,8 @@ file="src/core/juce_FileLogger.cpp"/> + #import #import @@ -1693,182 +1694,6 @@ const StringArray SystemStats::getMACAddressStrings() return s; } -static bool juceInitialisedNonGUI = false; - -#if JUCE_DEBUG -template -class AtomicTester -{ -public: - AtomicTester() {} - - static void testInteger() - { - Atomic a, b; - a.set ((Type) 10); - a += (Type) 15; - - a.memoryBarrier(); - a -= (Type) 5; - ++a; - ++a; - --a; - a.memoryBarrier(); - - testFloat(); - } - - static void testFloat() - { - Atomic a, b; - a = (Type) 21; - a.memoryBarrier(); - - /* These are some simple test cases to check the atomics - let me know - if any of these assertions fail on your system! - */ - jassert (a.get() == (Type) 21); - jassert (a.compareAndSetValue ((Type) 100, (Type) 50) == (Type) 21); - jassert (a.get() == (Type) 21); - jassert (a.compareAndSetValue ((Type) 101, a.get()) == (Type) 21); - jassert (a.get() == (Type) 101); - jassert (! a.compareAndSetBool ((Type) 300, (Type) 200)); - jassert (a.get() == (Type) 101); - jassert (a.compareAndSetBool ((Type) 200, a.get())); - jassert (a.get() == (Type) 200); - - jassert (a.exchange ((Type) 300) == (Type) 200); - jassert (a.get() == (Type) 300); - - b = a; - jassert (b.get() == a.get()); - } -}; - -static void juce_testAtomics() -{ - AtomicTester ::testInteger(); - AtomicTester ::testInteger(); - AtomicTester ::testInteger(); - AtomicTester ::testInteger(); - AtomicTester ::testInteger(); - AtomicTester ::testInteger(); - AtomicTester ::testInteger(); - AtomicTester ::testFloat(); - #if ! JUCE_64BIT_ATOMICS_UNAVAILABLE // 64-bit intrinsics aren't available on some old platforms - AtomicTester ::testInteger(); - AtomicTester ::testInteger(); - AtomicTester ::testFloat(); - #endif - -} -#endif - -void JUCE_PUBLIC_FUNCTION initialiseJuce_NonGUI() -{ - if (! juceInitialisedNonGUI) - { -#if JUCE_MAC || JUCE_IPHONE - const ScopedAutoReleasePool pool; -#endif - -#if JUCE_DEBUG - { - // Some simple test code to keep an eye on things and make sure these functions - // work ok on all platforms. Let me know if any of these assertions fail! - - static_jassert (sizeof (pointer_sized_int) == sizeof (void*)); - - static_jassert (sizeof (int8) == 1); - static_jassert (sizeof (uint8) == 1); - static_jassert (sizeof (int16) == 2); - static_jassert (sizeof (uint16) == 2); - static_jassert (sizeof (int32) == 4); - static_jassert (sizeof (uint32) == 4); - static_jassert (sizeof (int64) == 8); - static_jassert (sizeof (uint64) == 8); - - char a1[7]; - jassert (numElementsInArray(a1) == 7); - int a2[3]; - jassert (numElementsInArray(a2) == 3); - - juce_testAtomics(); - - jassert (ByteOrder::swap ((uint16) 0x1122) == 0x2211); - jassert (ByteOrder::swap ((uint32) 0x11223344) == 0x44332211); - - // Some quick stream tests.. - int randomInt = Random::getSystemRandom().nextInt(); - int64 randomInt64 = Random::getSystemRandom().nextInt64(); - double randomDouble = Random::getSystemRandom().nextDouble(); - String randomString; - for (int i = 50; --i >= 0;) - randomString << (juce_wchar) (Random::getSystemRandom().nextInt() & 0xffff); - - MemoryOutputStream mo; - mo.writeInt (randomInt); - mo.writeIntBigEndian (randomInt); - mo.writeCompressedInt (randomInt); - mo.writeString (randomString); - mo.writeInt64 (randomInt64); - mo.writeInt64BigEndian (randomInt64); - mo.writeDouble (randomDouble); - mo.writeDoubleBigEndian (randomDouble); - - MemoryInputStream mi (mo.getData(), mo.getDataSize(), false); - jassert (mi.readInt() == randomInt); - jassert (mi.readIntBigEndian() == randomInt); - jassert (mi.readCompressedInt() == randomInt); - jassert (mi.readString() == randomString); - jassert (mi.readInt64() == randomInt64); - jassert (mi.readInt64BigEndian() == randomInt64); - jassert (mi.readDouble() == randomDouble); - jassert (mi.readDoubleBigEndian() == randomDouble); - } -#endif - // Now the real initialisation.. - - juceInitialisedNonGUI = true; - - DBG (SystemStats::getJUCEVersion()); - SystemStats::initialiseStats(); - Random::getSystemRandom().setSeedRandomly(); // (mustn't call this before initialiseStats() because it relies on the time being set up) - } -} - -#if JUCE_WINDOWS - extern void juce_shutdownWin32Sockets(); // (defined in the sockets code) -#endif - -#if JUCE_DEBUG - extern void juce_CheckForDanglingStreams(); -#endif - -void JUCE_PUBLIC_FUNCTION shutdownJuce_NonGUI() -{ - if (juceInitialisedNonGUI) - { - #if JUCE_MAC || JUCE_IPHONE - const ScopedAutoReleasePool pool; - #endif - - #if JUCE_WINDOWS - // need to shut down sockets if they were used.. - juce_shutdownWin32Sockets(); - #endif - - LocalisedStrings::setCurrentMappings (0); - Thread::stopAllThreads (3000); - - #if JUCE_DEBUG - juce_CheckForDanglingStreams(); - #endif - - juceInitialisedNonGUI = false; - } -} - #ifdef JUCE_DLL void* juce_Malloc (const int size) @@ -2382,6 +2207,241 @@ END_JUCE_NAMESPACE /*** End of inlined file: juce_Time.cpp ***/ +/*** Start of inlined file: juce_Initialisation.cpp ***/ +BEGIN_JUCE_NAMESPACE + +#if ! JUCE_ONLY_BUILD_CORE_LIBRARY + +#endif + +#if JUCE_WINDOWS + extern void juce_shutdownWin32Sockets(); // (defined in the sockets code) +#endif + +#if JUCE_DEBUG + extern void juce_CheckForDanglingStreams(); // (in juce_OutputStream.cpp) +#endif + +#if JUCE_DEBUG + +namespace SimpleUnitTests +{ + template + class AtomicTester + { + public: + AtomicTester() {} + + static void testInteger() + { + Atomic a, b; + a.set ((Type) 10); + a += (Type) 15; + a.memoryBarrier(); + a -= (Type) 5; + ++a; ++a; --a; + a.memoryBarrier(); + + testFloat(); + } + + static void testFloat() + { + Atomic a, b; + a = (Type) 21; + a.memoryBarrier(); + + /* These are some simple test cases to check the atomics - let me know + if any of these assertions fail on your system! + */ + jassert (a.get() == (Type) 21); + jassert (a.compareAndSetValue ((Type) 100, (Type) 50) == (Type) 21); + jassert (a.get() == (Type) 21); + jassert (a.compareAndSetValue ((Type) 101, a.get()) == (Type) 21); + jassert (a.get() == (Type) 101); + jassert (! a.compareAndSetBool ((Type) 300, (Type) 200)); + jassert (a.get() == (Type) 101); + jassert (a.compareAndSetBool ((Type) 200, a.get())); + jassert (a.get() == (Type) 200); + + jassert (a.exchange ((Type) 300) == (Type) 200); + jassert (a.get() == (Type) 300); + + b = a; + jassert (b.get() == a.get()); + } + }; + + static void runBasicTests() + { + // Some simple test code, to keep an eye on things and make sure these functions + // work ok on all platforms. Let me know if any of these assertions fail on your system! + + static_jassert (sizeof (pointer_sized_int) == sizeof (void*)); + static_jassert (sizeof (int8) == 1); + static_jassert (sizeof (uint8) == 1); + static_jassert (sizeof (int16) == 2); + static_jassert (sizeof (uint16) == 2); + static_jassert (sizeof (int32) == 4); + static_jassert (sizeof (uint32) == 4); + static_jassert (sizeof (int64) == 8); + static_jassert (sizeof (uint64) == 8); + + char a1[7]; + jassert (numElementsInArray(a1) == 7); + int a2[3]; + jassert (numElementsInArray(a2) == 3); + + jassert (ByteOrder::swap ((uint16) 0x1122) == 0x2211); + jassert (ByteOrder::swap ((uint32) 0x11223344) == 0x44332211); + jassert (ByteOrder::swap ((uint64) literal64bit (0x1122334455667788)) == literal64bit (0x8877665544332211)); + + // Some quick stream tests.. + int randomInt = Random::getSystemRandom().nextInt(); + int64 randomInt64 = Random::getSystemRandom().nextInt64(); + double randomDouble = Random::getSystemRandom().nextDouble(); + String randomString; + for (int i = 50; --i >= 0;) + randomString << (juce_wchar) (Random::getSystemRandom().nextInt() & 0xffff); + + MemoryOutputStream mo; + mo.writeInt (randomInt); + mo.writeIntBigEndian (randomInt); + mo.writeCompressedInt (randomInt); + mo.writeString (randomString); + mo.writeInt64 (randomInt64); + mo.writeInt64BigEndian (randomInt64); + mo.writeDouble (randomDouble); + mo.writeDoubleBigEndian (randomDouble); + + MemoryInputStream mi (mo.getData(), mo.getDataSize(), false); + jassert (mi.readInt() == randomInt); + jassert (mi.readIntBigEndian() == randomInt); + jassert (mi.readCompressedInt() == randomInt); + jassert (mi.readString() == randomString); + jassert (mi.readInt64() == randomInt64); + jassert (mi.readInt64BigEndian() == randomInt64); + jassert (mi.readDouble() == randomDouble); + jassert (mi.readDoubleBigEndian() == randomDouble); + + AtomicTester ::testInteger(); + AtomicTester ::testInteger(); + AtomicTester ::testInteger(); + AtomicTester ::testInteger(); + AtomicTester ::testInteger(); + AtomicTester ::testInteger(); + AtomicTester ::testInteger(); + AtomicTester ::testFloat(); + #if ! JUCE_64BIT_ATOMICS_UNAVAILABLE // 64-bit intrinsics aren't available on some old platforms + AtomicTester ::testInteger(); + AtomicTester ::testInteger(); + AtomicTester ::testFloat(); + #endif + } +} +#endif + +static bool juceInitialisedNonGUI = false; + +void JUCE_PUBLIC_FUNCTION initialiseJuce_NonGUI() +{ + if (! juceInitialisedNonGUI) + { + juceInitialisedNonGUI = true; + + JUCE_AUTORELEASEPOOL + + #if JUCE_DEBUG + SimpleUnitTests::runBasicTests(); + #endif + + DBG (SystemStats::getJUCEVersion()); + SystemStats::initialiseStats(); + Random::getSystemRandom().setSeedRandomly(); // (mustn't call this before initialiseStats() because it relies on the time being set up) + } +} + +void JUCE_PUBLIC_FUNCTION shutdownJuce_NonGUI() +{ + if (juceInitialisedNonGUI) + { + juceInitialisedNonGUI = false; + + JUCE_AUTORELEASEPOOL + + LocalisedStrings::setCurrentMappings (0); + Thread::stopAllThreads (3000); + + #if JUCE_WINDOWS + juce_shutdownWin32Sockets(); + #endif + + #if JUCE_DEBUG + juce_CheckForDanglingStreams(); + #endif + } +} + +#if ! JUCE_ONLY_BUILD_CORE_LIBRARY + +void juce_setCurrentThreadName (const String& name); + +static bool juceInitialisedGUI = false; + +void JUCE_PUBLIC_FUNCTION initialiseJuce_GUI() +{ + if (! juceInitialisedGUI) + { + juceInitialisedGUI = true; + + JUCE_AUTORELEASEPOOL + initialiseJuce_NonGUI(); + + MessageManager::getInstance(); + LookAndFeel::setDefaultLookAndFeel (0); + juce_setCurrentThreadName ("Juce Message Thread"); + + #if JUCE_DEBUG + // This section is just for catching people who mess up their project settings and + // turn RTTI off.. + try + { + TextButton tb (String::empty); + Component* c = &tb; + + // Got an exception here? Then TURN ON RTTI in your compiler settings!! + c = dynamic_cast (c); + } + catch (...) + { + // Ended up here? If so, TURN ON RTTI in your compiler settings!! + jassertfalse; + } + #endif + } +} + +void JUCE_PUBLIC_FUNCTION shutdownJuce_GUI() +{ + if (juceInitialisedGUI) + { + juceInitialisedGUI = false; + + JUCE_AUTORELEASEPOOL + DeletedAtShutdown::deleteAll(); + LookAndFeel::clearDefaultLookAndFeel(); + delete MessageManager::getInstance(); + + shutdownJuce_NonGUI(); + } +} + +#endif + +END_JUCE_NAMESPACE +/*** End of inlined file: juce_Initialisation.cpp ***/ + + /*** Start of inlined file: juce_BigInteger.cpp ***/ BEGIN_JUCE_NAMESPACE @@ -7388,7 +7448,7 @@ END_JUCE_NAMESPACE #include #include #include - #elif (MACOSX_DEPLOYMENT_TARGET <= MAC_OS_X_VERSION_10_4) && ! JUCE_IPHONE + #elif (MACOSX_DEPLOYMENT_TARGET <= MAC_OS_X_VERSION_10_4) && ! JUCE_IOS #include #endif @@ -7400,7 +7460,7 @@ END_JUCE_NAMESPACE BEGIN_JUCE_NAMESPACE -#if defined (JUCE_LINUX) || defined (JUCE_MAC) || defined (JUCE_IPHONE) +#if defined (JUCE_LINUX) || defined (JUCE_MAC) || defined (JUCE_IOS) typedef socklen_t juce_socklen_t; #else typedef int juce_socklen_t; @@ -17209,23 +17269,14 @@ END_JUCE_NAMESPACE /*** Start of inlined file: juce_Application.cpp ***/ -#if JUCE_MSVC - #pragma warning (push) - #pragma warning (disable: 4245 4514 4100) - #include - #pragma warning (pop) -#endif - BEGIN_JUCE_NAMESPACE -void juce_setCurrentThreadName (const String& name); - -static JUCEApplication* appInstance = 0; - JUCEApplication::JUCEApplication() : appReturnValue (0), stillInitialising (true) { + jassert (appInstance == 0); + appInstance = this; } JUCEApplication::~JUCEApplication() @@ -17235,8 +17286,13 @@ JUCEApplication::~JUCEApplication() appLock->exit(); appLock = 0; } + + jassert (appInstance == this); + appInstance = 0; } +JUCEApplication* JUCEApplication::appInstance = 0; + JUCEApplication* JUCEApplication::getInstance() throw() { return appInstance; @@ -17276,6 +17332,12 @@ void JUCEApplication::setApplicationReturnValue (const int newReturnValue) throw appReturnValue = newReturnValue; } +void JUCEApplication::actionListenerCallback (const String& message) +{ + if (message.startsWith (getApplicationName() + "/")) + anotherInstanceStarted (message.substring (getApplicationName().length() + 1)); +} + void JUCEApplication::unhandledException (const std::exception*, const String&, const int) @@ -17325,41 +17387,11 @@ bool JUCEApplication::perform (const InvocationInfo& info) return false; } -int JUCEApplication::main (String& commandLine, JUCEApplication* const app) +bool JUCEApplication::initialiseApp (const String& commandLine) { - if (! app->initialiseApp (commandLine)) - return 0; - - // now loop until a quit message is received.. - JUCE_TRY - { - MessageManager::getInstance()->runDispatchLoop(); - } -#if JUCE_CATCH_UNHANDLED_EXCEPTIONS - catch (const std::exception& e) - { - app->unhandledException (&e, __FILE__, __LINE__); - } - catch (...) - { - app->unhandledException (0, __FILE__, __LINE__); - } -#endif - - return shutdownAppAndClearUp(); -} - -bool JUCEApplication::initialiseApp (String& commandLine) -{ - jassert (appInstance == 0); - appInstance = this; - commandLineParameters = commandLine.trim(); - commandLine = String::empty; - initialiseJuce_GUI(); - -#if ! JUCE_IPHONE +#if ! JUCE_IOS jassert (appLock == 0); // initialiseApp must only be called once! if (! moreThanOneInstanceAllowed()) @@ -17371,9 +17403,6 @@ bool JUCEApplication::initialiseApp (String& commandLine) appLock = 0; MessageManager::broadcastMessage (getApplicationName() + "/" + commandLineParameters); - delete appInstance; - appInstance = 0; - DBG ("Another instance is running - quitting..."); return false; } @@ -17390,149 +17419,65 @@ bool JUCEApplication::initialiseApp (String& commandLine) return true; } -int JUCEApplication::shutdownAppAndClearUp() +int JUCEApplication::shutdownApp() { - jassert (appInstance != 0); - ScopedPointer app (appInstance); - int returnValue = 0; + jassert (appInstance == this); - MessageManager::getInstance()->deregisterBroadcastListener (static_cast (app)); + MessageManager::getInstance()->deregisterBroadcastListener (this); - static bool reentrancyCheck = false; - - if (! reentrancyCheck) + JUCE_TRY { - reentrancyCheck = true; - - JUCE_TRY - { - // give the app a chance to clean up.. - app->shutdown(); - } -#if JUCE_CATCH_UNHANDLED_EXCEPTIONS - catch (const std::exception& e) - { - app->unhandledException (&e, __FILE__, __LINE__); - } - catch (...) - { - app->unhandledException (0, __FILE__, __LINE__); - } -#endif - - JUCE_TRY - { - app->releaseMessageListener(); - - shutdownJuce_GUI(); - - returnValue = app->getApplicationReturnValue(); - - appInstance = 0; - app = 0; - } - JUCE_CATCH_ALL_ASSERT - - reentrancyCheck = false; + // give the app a chance to clean up.. + shutdown(); } + JUCE_CATCH_EXCEPTION - return returnValue; + return getApplicationReturnValue(); } -#if JUCE_IPHONE - extern int juce_IPhoneMain (int argc, const char* argv[], JUCEApplication* app); +int JUCEApplication::main (const String& commandLine, JUCEApplication* const app) +{ + const ScopedPointer appDeleter (app); + + if (! app->initialiseApp (commandLine)) + return 0; + + JUCE_TRY + { + // loop until a quit message is received.. + MessageManager::getInstance()->runDispatchLoop(); + } + JUCE_CATCH_EXCEPTION + + return app->shutdownApp(); +} + +#if JUCE_IOS + extern int juce_iOSMain (int argc, const char* argv[]); #endif #if ! JUCE_WINDOWS -extern const char* juce_Argv0; + extern const char* juce_Argv0; #endif int JUCEApplication::main (int argc, const char* argv[], JUCEApplication* const newApp) { -#if ! JUCE_WINDOWS + JUCE_AUTORELEASEPOOL + + #if ! JUCE_WINDOWS juce_Argv0 = argv[0]; -#endif - -#if JUCE_IPHONE - const ScopedAutoReleasePool pool; - return juce_IPhoneMain (argc, argv, newApp); -#else - - #if JUCE_MAC - const ScopedAutoReleasePool pool; #endif + #if JUCE_IOS + const ScopedPointer appDeleter (newApp); + return juce_iOSMain (argc, argv); + #else String cmd; for (int i = 1; i < argc; ++i) cmd << argv[i] << ' '; return JUCEApplication::main (cmd, newApp); -#endif -} - -void JUCEApplication::actionListenerCallback (const String& message) -{ - if (message.startsWith (getApplicationName() + "/")) - anotherInstanceStarted (message.substring (getApplicationName().length() + 1)); -} - -static bool juceInitialisedGUI = false; - -void JUCE_PUBLIC_FUNCTION initialiseJuce_GUI() -{ - if (! juceInitialisedGUI) - { -#if JUCE_MAC || JUCE_IPHONE - const ScopedAutoReleasePool pool; -#endif - juceInitialisedGUI = true; - - initialiseJuce_NonGUI(); - MessageManager::getInstance(); - LookAndFeel::setDefaultLookAndFeel (0); - juce_setCurrentThreadName ("Juce Message Thread"); - -#if JUCE_WINDOWS && JUCE_DEBUG - // This section is just for catching people who mess up their project settings and - // turn RTTI off.. - try - { - TextButton tb (String::empty); - Component* c = &tb; - - // Got an exception here? Then TURN ON RTTI in your compiler settings!! - c = dynamic_cast (c); - } - catch (...) - { - // Ended up here? If so, TURN ON RTTI in your compiler settings!! And if you - // got as far as this catch statement, then why haven't you got exception catching - // turned on in the debugger??? - jassertfalse; - } -#endif - } -} - -void JUCE_PUBLIC_FUNCTION shutdownJuce_GUI() -{ - if (juceInitialisedGUI) - { -#if JUCE_MAC - const ScopedAutoReleasePool pool; -#endif - { - DeletedAtShutdown::deleteAll(); - - LookAndFeel::clearDefaultLookAndFeel(); - } - - delete MessageManager::getInstance(); - - shutdownJuce_NonGUI(); - - juceInitialisedGUI = false; - } + #endif } END_JUCE_NAMESPACE @@ -17883,11 +17828,6 @@ ApplicationCommandTarget::ApplicationCommandTarget() } ApplicationCommandTarget::~ApplicationCommandTarget() -{ - releaseMessageListener(); -} - -void ApplicationCommandTarget::releaseMessageListener() { messageInvoker = 0; } @@ -18426,7 +18366,7 @@ const File PropertiesFile::getDefaultAppSettingsFile (const String& applicationN // mustn't have illegal characters in this name.. jassert (applicationName == File::createLegalFileName (applicationName)); -#if JUCE_MAC || JUCE_IPHONE +#if JUCE_MAC || JUCE_IOS File dir (commonToAllUsers ? "/Library/Preferences" : "~/Library/Preferences"); @@ -21265,7 +21205,7 @@ END_JUCE_NAMESPACE /*** Start of inlined file: juce_QuickTimeAudioFormat.cpp ***/ -#if JUCE_QUICKTIME && ! (JUCE_64BIT || JUCE_IPHONE) +#if JUCE_QUICKTIME && ! (JUCE_64BIT || JUCE_IOS) #if ! JUCE_WINDOWS #include @@ -24166,7 +24106,7 @@ void AudioDeviceManager::createAudioDeviceTypes (OwnedArray & list.add (juce_createAudioIODeviceType_CoreAudio()); #endif - #if JUCE_IPHONE + #if JUCE_IOS list.add (juce_createAudioIODeviceType_iPhoneAudio()); #endif @@ -37892,7 +37832,7 @@ void MessageManager::deliverMessage (Message* const message) JUCE_CATCH_EXCEPTION } -#if ! (JUCE_MAC || JUCE_IPHONE) +#if ! (JUCE_MAC || JUCE_IOS) void MessageManager::runDispatchLoop() { jassert (isThisTheMessageThread()); // must only be called by the message thread @@ -70136,7 +70076,7 @@ public: { const ScopedLock sl (getLock()); - for (int i = getCursors().size(); --i >= 0;) + for (int i = 0; i < getCursors().size(); ++i) { SharedCursorHandle* const sc = getCursors().getUnchecked(i); @@ -94329,6 +94269,9 @@ public: private: const ReferenceCountedObjectPtr image; const Rectangle area; + + SubsectionSharedImage (const SubsectionSharedImage&); + SubsectionSharedImage& operator= (const SubsectionSharedImage&); }; const Image Image::getClippedImage (const Rectangle& area) const @@ -239146,7 +239089,7 @@ bool juce_dispatchNextMessageOnSystemQueue (const bool returnIfNoPendingMessages } else if (m.message == WM_QUIT) { - if (JUCEApplication::getInstance()) + if (JUCEApplication::getInstance() != 0) JUCEApplication::getInstance()->systemRequestedQuit(); } else if (! isEventBlockedByModalComps (m)) @@ -261648,7 +261591,7 @@ END_JUCE_NAMESPACE the rest of the codebase. */ -#if JUCE_MAC || JUCE_IPHONE +#if JUCE_MAC || JUCE_IOS BEGIN_JUCE_NAMESPACE @@ -261737,7 +261680,7 @@ CFStringRef PlatformUtilities::juceStringToCFString (const String& s) const String PlatformUtilities::convertToPrecomposedUnicode (const String& s) { -#if JUCE_IPHONE +#if JUCE_IOS const ScopedAutoReleasePool pool; return nsStringToJuce ([juceStringToNS (s) precomposedStringWithCanonicalMapping]); #else @@ -261799,7 +261742,7 @@ const String PlatformUtilities::convertToPrecomposedUnicode (const String& s) void SystemClipboard::copyTextToClipboard (const String& text) { -#if JUCE_IPHONE +#if JUCE_IOS [[UIPasteboard generalPasteboard] setValue: juceStringToNS (text) forPasteboardType: @"public.text"]; #else @@ -261813,7 +261756,7 @@ void SystemClipboard::copyTextToClipboard (const String& text) const String SystemClipboard::getTextFromClipboard() { -#if JUCE_IPHONE +#if JUCE_IOS NSString* text = [[UIPasteboard generalPasteboard] valueForPasteboardType: @"public.text"]; #else NSString* text = [[NSPasteboard generalPasteboard] stringForType: NSStringPboardType]; @@ -261907,7 +261850,7 @@ void SystemStats::initialiseStats() cpuFlags.has3DNow = false; #endif - #if JUCE_IPHONE || (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5) + #if JUCE_IOS || (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5) cpuFlags.numCpus = (int) [[NSProcessInfo processInfo] activeProcessorCount]; #else cpuFlags.numCpus = (int) MPProcessors(); @@ -262082,7 +262025,7 @@ bool PlatformUtilities::launchEmailWithAttachments (const String& targetEmailAdd const String& bodyText, const StringArray& filesToAttach) { -#if JUCE_IPHONE +#if JUCE_IOS //xxx probably need to use MFMailComposeViewController jassertfalse; return false; @@ -263400,7 +263343,7 @@ bool File::isOnHardDisk() const bool File::isOnRemovableDrive() const { -#if JUCE_IPHONE +#if JUCE_IOS return false; // xxx is this possible? #else const ScopedAutoReleasePool pool; @@ -263420,7 +263363,7 @@ bool File::isOnRemovableDrive() const static bool juce_isHiddenFile (const String& path) { -#if JUCE_IPHONE +#if JUCE_IOS return File (path).getFileName().startsWithChar ('.'); #else FSRef ref; @@ -263546,7 +263489,7 @@ const String File::getVersion() const const File File::getLinkedTarget() const { -#if JUCE_IPHONE || (defined (MAC_OS_X_VERSION_10_5) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) +#if JUCE_IOS || (defined (MAC_OS_X_VERSION_10_5) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) NSString* dest = [[NSFileManager defaultManager] destinationOfSymbolicLinkAtPath: juceStringToNS (getFullPathName()) error: nil]; #else @@ -263564,7 +263507,7 @@ bool File::moveToTrash() const if (! exists()) return true; -#if JUCE_IPHONE +#if JUCE_IOS return deleteFile(); //xxx is there a trashcan on the iPhone? #else const ScopedAutoReleasePool pool; @@ -263689,7 +263632,7 @@ bool juce_launchExecutable (const String& pathAndArguments) bool PlatformUtilities::openDocument (const String& fileName, const String& parameters) { -#if JUCE_IPHONE +#if JUCE_IOS return [[UIApplication sharedApplication] openURL: [NSURL fileURLWithPath: juceStringToNS (fileName)]]; #else const ScopedAutoReleasePool pool; @@ -263732,7 +263675,7 @@ bool PlatformUtilities::openDocument (const String& fileName, const String& para void File::revealToUser() const { -#if ! JUCE_IPHONE +#if ! JUCE_IOS if (exists()) [[NSWorkspace sharedWorkspace] selectFile: juceStringToNS (getFullPathName()) inFileViewerRootedAtPath: @""]; else if (getParentDirectory().exists()) @@ -263740,7 +263683,7 @@ void File::revealToUser() const #endif } -#if ! JUCE_IPHONE +#if ! JUCE_IOS bool PlatformUtilities::makeFSRefFromPath (FSRef* destFSRef, const String& path) { return FSPathMakeRef ((const UInt8*) path.toUTF8(), destFSRef, 0) == noErr; @@ -263762,7 +263705,7 @@ OSType PlatformUtilities::getTypeOfFile (const String& filename) { const ScopedAutoReleasePool pool; -#if JUCE_IPHONE || (defined (MAC_OS_X_VERSION_10_5) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) +#if JUCE_IOS || (defined (MAC_OS_X_VERSION_10_5) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) NSDictionary* fileDict = [[NSFileManager defaultManager] attributesOfItemAtPath: juceStringToNS (filename) error: nil]; #else NSDictionary* fileDict = [[NSFileManager defaultManager] fileAttributesAtPath: juceStringToNS (filename) traverseLink: NO]; @@ -263773,7 +263716,7 @@ OSType PlatformUtilities::getTypeOfFile (const String& filename) bool PlatformUtilities::isBundle (const String& filename) { -#if JUCE_IPHONE +#if JUCE_IOS return false; // xxx can't find a sensible way to do this without trying to open the bundle.. #else const ScopedAutoReleasePool pool; @@ -263784,15 +263727,13 @@ bool PlatformUtilities::isBundle (const String& filename) #endif /*** End of inlined file: juce_mac_Files.mm ***/ -#if JUCE_IPHONE +#if JUCE_IOS /*** Start of inlined file: juce_iphone_MiscUtilities.mm ***/ // (This file gets included by juce_mac_NativeCode.mm, rather than being // compiled on its own). #if JUCE_INCLUDED_FILE -static JUCEApplication* juce_intialisingApp; - END_JUCE_NAMESPACE @interface JuceAppStartupDelegate : NSObject @@ -263800,7 +263741,7 @@ END_JUCE_NAMESPACE } - (void) applicationDidFinishLaunching: (UIApplication*) application; -- (void) applicationWillResignActive: (UIApplication*) application; +- (void) applicationWillTerminate: (UIApplication*) application; @end @@ -263810,22 +263751,25 @@ END_JUCE_NAMESPACE { String dummy; - if (! juce_intialisingApp->initialiseApp (dummy)) + if (! JUCEApplication::getInstance()->initialiseApp (dummy)) exit (0); } -- (void) applicationWillResignActive: (UIApplication*) application +- (void) applicationWillTerminate: (UIApplication*) application { - JUCEApplication::shutdownAppAndClearUp(); + JUCEApplication::getInstance()->shutdownApp(); + + // need to do this stuff because the OS kills the process before our scope-based cleanup code gets executed.. + delete JUCEApplication::getInstance(); + shutdownJuce_GUI(); } @end BEGIN_JUCE_NAMESPACE -int juce_IPhoneMain (int argc, const char* argv[], JUCEApplication* app) +int juce_iOSMain (int argc, const char* argv[]) { - juce_intialisingApp = app; return UIApplicationMain (argc, const_cast (argv), nil, @"JuceAppStartupDelegate"); } @@ -264232,7 +264176,7 @@ bool JUCE_CALLTYPE Process::isRunningUnderDebugger() /*** End of inlined file: juce_mac_Debugging.mm ***/ #if ! JUCE_ONLY_BUILD_CORE_LIBRARY - #if JUCE_IPHONE + #if JUCE_IOS /*** Start of inlined file: juce_mac_Fonts.mm ***/ // (This file gets included by juce_mac_NativeCode.mm, rather than being @@ -264266,7 +264210,7 @@ public: bool needsItalicTransform = false; -#if JUCE_IPHONE +#if JUCE_IOS NSString* fontName = juceStringToNS (font.getTypefaceName()); if (font.isItalic() || font.isBold()) @@ -264382,7 +264326,7 @@ public: ~MacTypeface() { -#if ! JUCE_IPHONE +#if ! JUCE_IOS [nsFont release]; #endif if (fontRef != 0) @@ -264500,7 +264444,7 @@ public: bool getOutlineForGlyph (int glyphNumber, Path& path) { -#if JUCE_IPHONE +#if JUCE_IOS return false; #else if (nsFont == 0) @@ -264553,7 +264497,7 @@ public: private: float ascent, unitsToHeightScaleFactor; -#if JUCE_IPHONE +#if JUCE_IOS #else NSFont* nsFont; @@ -264704,7 +264648,7 @@ const StringArray Font::findAllTypefaceNames() const ScopedAutoReleasePool pool; -#if JUCE_IPHONE +#if JUCE_IOS NSArray* fonts = [UIFont familyNames]; #else NSArray* fonts = [[NSFontManager sharedFontManager] availableFontFamilies]; @@ -264719,7 +264663,7 @@ const StringArray Font::findAllTypefaceNames() void Font::getPlatformDefaultFontNames (String& defaultSans, String& defaultSerif, String& defaultFixed) { -#if JUCE_IPHONE +#if JUCE_IOS defaultSans = "Helvetica"; defaultSerif = "Times New Roman"; defaultFixed = "Courier New"; @@ -265134,7 +265078,7 @@ public: if (fillEntireClipAsTiles) { -#if JUCE_IPHONE +#if JUCE_IOS CGContextDrawTiledImage (context, imageRect, image); #else #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 @@ -267048,13 +266992,20 @@ public: ~GLESContext() { - makeInactive(); - [context release]; + deleteContext(); + [view removeFromSuperview]; [view release]; freeGLBuffers(); } + void deleteContext() + { + makeInactive(); + [context release]; + context = nil; + } + bool makeActive() const throw() { jassert (context != 0); @@ -268894,7 +268845,7 @@ public: bool needsItalicTransform = false; -#if JUCE_IPHONE +#if JUCE_IOS NSString* fontName = juceStringToNS (font.getTypefaceName()); if (font.isItalic() || font.isBold()) @@ -269010,7 +268961,7 @@ public: ~MacTypeface() { -#if ! JUCE_IPHONE +#if ! JUCE_IOS [nsFont release]; #endif if (fontRef != 0) @@ -269128,7 +269079,7 @@ public: bool getOutlineForGlyph (int glyphNumber, Path& path) { -#if JUCE_IPHONE +#if JUCE_IOS return false; #else if (nsFont == 0) @@ -269181,7 +269132,7 @@ public: private: float ascent, unitsToHeightScaleFactor; -#if JUCE_IPHONE +#if JUCE_IOS #else NSFont* nsFont; @@ -269332,7 +269283,7 @@ const StringArray Font::findAllTypefaceNames() const ScopedAutoReleasePool pool; -#if JUCE_IPHONE +#if JUCE_IOS NSArray* fonts = [UIFont familyNames]; #else NSArray* fonts = [[NSFontManager sharedFontManager] availableFontFamilies]; @@ -269347,7 +269298,7 @@ const StringArray Font::findAllTypefaceNames() void Font::getPlatformDefaultFontNames (String& defaultSans, String& defaultSerif, String& defaultFixed) { -#if JUCE_IPHONE +#if JUCE_IOS defaultSans = "Helvetica"; defaultSerif = "Times New Roman"; defaultFixed = "Courier New"; @@ -269762,7 +269713,7 @@ public: if (fillEntireClipAsTiles) { -#if JUCE_IPHONE +#if JUCE_IOS CGContextDrawTiledImage (context, imageRect, image); #else #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 @@ -272621,13 +272572,20 @@ public: ~GLESContext() { - makeInactive(); - [context release]; + deleteContext(); + [view removeFromSuperview]; [view release]; freeGLBuffers(); } + void deleteContext() + { + makeInactive(); + [context release]; + context = nil; + } + bool makeActive() const throw() { jassert (context != 0); @@ -274924,14 +274882,13 @@ static bool isEventBlockedByModalComps (NSEvent* e) bool MessageManager::runDispatchLoopUntil (int millisecondsToRunFor) { - const ScopedAutoReleasePool pool; jassert (isThisTheMessageThread()); // must only be called by the message thread uint32 endTime = Time::getMillisecondCounter() + millisecondsToRunFor; while (! quitMessagePosted) { - const ScopedAutoReleasePool pool2; + const ScopedAutoReleasePool pool; CFRunLoopRunInMode (kCFRunLoopDefaultMode, 0.001, true); diff --git a/juce_amalgamated.h b/juce_amalgamated.h index 3d73a6169f..ee3a09110a 100644 --- a/juce_amalgamated.h +++ b/juce_amalgamated.h @@ -64,7 +64,7 @@ */ #define JUCE_MAJOR_VERSION 1 #define JUCE_MINOR_VERSION 52 -#define JUCE_BUILDNUMBER 40 +#define JUCE_BUILDNUMBER 41 /** Current Juce version number. @@ -103,6 +103,7 @@ #if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR #define JUCE_IPHONE 1 + #define JUCE_IOS 1 #else #define JUCE_MAC 1 #endif @@ -167,7 +168,7 @@ #endif -#if JUCE_IPHONE +#if JUCE_IOS #ifndef NDEBUG #define JUCE_DEBUG 1 @@ -293,11 +294,11 @@ If you're building on Windows, you'll need to have the Apple QuickTime SDK installed, and its header files will need to be on your include path. */ -#if ! (defined (JUCE_QUICKTIME) || JUCE_LINUX || JUCE_IPHONE || (JUCE_WINDOWS && ! JUCE_MSVC)) +#if ! (defined (JUCE_QUICKTIME) || JUCE_LINUX || JUCE_IOS || (JUCE_WINDOWS && ! JUCE_MSVC)) #define JUCE_QUICKTIME 0 #endif -#if (JUCE_IPHONE || JUCE_LINUX) && JUCE_QUICKTIME +#if (JUCE_IOS || JUCE_LINUX) && JUCE_QUICKTIME #undef JUCE_QUICKTIME #endif @@ -562,7 +563,7 @@ #endif #elif JUCE_MAC #define juce_breakDebugger Debugger(); - #elif JUCE_IPHONE + #elif JUCE_IOS #define juce_breakDebugger kill (0, SIGTRAP); #elif JUCE_LINUX #define juce_breakDebugger kill (0, SIGTRAP); @@ -712,7 +713,7 @@ #include #endif -#if JUCE_MAC || JUCE_IPHONE +#if JUCE_MAC || JUCE_IOS #include #endif @@ -1385,7 +1386,7 @@ inline uint16 ByteOrder::swap (uint16 n) inline uint32 ByteOrder::swap (uint32 n) { -#if JUCE_MAC || JUCE_IPHONE +#if JUCE_MAC || JUCE_IOS return OSSwapInt32 (n); #elif JUCE_GCC asm("bswap %%eax" : "=a"(n) : "a"(n)); @@ -1404,7 +1405,7 @@ inline uint32 ByteOrder::swap (uint32 n) inline uint64 ByteOrder::swap (uint64 value) { -#if JUCE_MAC || JUCE_IPHONE +#if JUCE_MAC || JUCE_IOS return OSSwapInt64 (value); #elif JUCE_USE_INTRINSICS return _byteswap_uint64 (value); @@ -5858,11 +5859,11 @@ private: /* The following code is in the header so that the atomics can be inlined where possible... */ -#if (JUCE_IPHONE && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_2 || ! defined (__IPHONE_3_2))) \ +#if (JUCE_IOS && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_2 || ! defined (__IPHONE_3_2))) \ || (JUCE_MAC && (JUCE_PPC || __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 2))) #define JUCE_ATOMICS_MAC 1 // Older OSX builds using gcc4.1 or earlier - #if JUCE_PPC || JUCE_IPHONE + #if JUCE_PPC || JUCE_IOS // None of these atomics are available for PPC or for iPhoneOS 3.1 or earlier!! template static Type OSAtomicAdd64Barrier (Type b, volatile Type* a) throw() { jassertfalse; return *a += b; } template static Type OSAtomicIncrement64Barrier (volatile Type* a) throw() { jassertfalse; return ++*a; } @@ -5875,7 +5876,7 @@ private: #elif JUCE_GCC #define JUCE_ATOMICS_GCC 1 // GCC with intrinsics - #if JUCE_IPHONE + #if JUCE_IOS #define JUCE_64BIT_ATOMICS_UNAVAILABLE 1 // (on the iphone, the 64-bit ops will compile but not link) #endif @@ -13729,6 +13730,51 @@ public: ~ScopedJuceInitialiser_GUI() { shutdownJuce_GUI(); } }; +/* + To start a JUCE app, use this macro: START_JUCE_APPLICATION (AppSubClass) where + AppSubClass is the name of a class derived from JUCEApplication. + + See the JUCEApplication class documentation (juce_Application.h) for more details. + +*/ +#if defined (JUCE_GCC) || defined (__MWERKS__) + + #define START_JUCE_APPLICATION(AppClass) \ + int main (int argc, char* argv[]) \ + { \ + JUCE_NAMESPACE::ScopedJuceInitialiser_GUI libraryInitialiser; \ + return JUCE_NAMESPACE::JUCEApplication::main (argc, (const char**) argv, new AppClass()); \ + } + +#elif JUCE_WINDOWS + + #ifdef _CONSOLE + #define START_JUCE_APPLICATION(AppClass) \ + int main (int, char* argv[]) \ + { \ + JUCE_NAMESPACE::ScopedJuceInitialiser_GUI libraryInitialiser; \ + return JUCE_NAMESPACE::JUCEApplication::main (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams(), new AppClass()); \ + } + #elif ! defined (_AFXDLL) + #ifdef _WINDOWS_ + #define START_JUCE_APPLICATION(AppClass) \ + int WINAPI WinMain (HINSTANCE, HINSTANCE, LPSTR, int) \ + { \ + JUCE_NAMESPACE::ScopedJuceInitialiser_GUI libraryInitialiser; \ + return JUCE_NAMESPACE::JUCEApplication::main (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams(), new AppClass()); \ + } + #else + #define START_JUCE_APPLICATION(AppClass) \ + int __stdcall WinMain (int, int, const char*, int) \ + { \ + JUCE_NAMESPACE::ScopedJuceInitialiser_GUI libraryInitialiser; \ + return JUCE_NAMESPACE::JUCEApplication::main (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams(), new AppClass()); \ + } + #endif + #endif + +#endif + #endif // __JUCE_INITIALISATION_JUCEHEADER__ /*** End of inlined file: juce_Initialisation.h ***/ @@ -13857,7 +13903,7 @@ public: const String& bodyText, const StringArray& filesToAttach); -#if JUCE_MAC || JUCE_IPHONE || DOXYGEN +#if JUCE_MAC || JUCE_IOS || DOXYGEN /** MAC ONLY - Turns a Core CF String into a juce one. */ static const String cfStringToJuceString (CFStringRef cfString); @@ -14008,7 +14054,7 @@ private: PlatformUtilities& operator= (const PlatformUtilities&); }; -#if JUCE_MAC || JUCE_IPHONE +#if JUCE_MAC || JUCE_IOS /** A handy C++ wrapper that creates and deletes an NSAutoreleasePool object using RAII. @@ -14026,6 +14072,12 @@ private: ScopedAutoReleasePool& operator= (const ScopedAutoReleasePool&); }; +#define JUCE_AUTORELEASEPOOL const ScopedAutoReleasePool pool; + +#else + +#define JUCE_AUTORELEASEPOOL + #endif #if JUCE_LINUX @@ -19652,10 +19704,12 @@ public: /** Called when the component is in the process of being deleted. This callback is made from inside the destructor, so be very, very cautious - about what you do inside the callback. + about what you do in here. - It will be called before the component has been removed from its parent, and - before any child components have been removed. + In particular, bear in mind that it's the Component base class's destructor that calls + this - so if the object that's being deleted is a subclass of Component, then the + subclass layers of the object will already have been destructed when it gets to this + point! */ virtual void componentBeingDeleted (Component& component); }; @@ -20539,6 +20593,12 @@ public: x = newX; y = newY; w = newWidth; h = newHeight; } + /** Changes the rectangle's X coordinate */ + void setX (const ValueType newX) throw() { x = newX; } + + /** Changes the rectangle's Y coordinate */ + void setY (const ValueType newY) throw() { y = newY; } + /** Changes the rectangle's width */ void setWidth (const ValueType newWidth) throw() { w = newWidth; } @@ -25362,8 +25422,15 @@ public: /** Destructor. - Note that when a component is deleted, any child components it might - contain are NOT deleted unless you explicitly call deleteAllChildren() first. + Note that when a component is deleted, any child components it contain are NOT + automatically deleted. It's your responsibilty to manage their lifespan - you + may want to use helper methods like deleteAllChildren(), or less haphazard + approaches like using ScopedPointers or normal object aggregation to manage them. + + If the component being deleted is currently the child of another one, then during + deletion, it will be removed from its parent, and the parent will receive a childrenChanged() + callback. Any ComponentListener objects that have registered with it will also have their + ComponentListener::componentBeingDeleted() methods called. */ virtual ~Component(); @@ -25829,29 +25896,37 @@ public: /** Adds a child component to this one. - @param child the new component to add. If the component passed-in is already - the child of another component, it'll first be removed from that. + Adding a child component does not mean that the component will own or delete the child - it's + your responsibility to delete the component. Note that it's safe to delete a component + without first removing it from its parent - doing so will automatically remove it and + send out the appropriate notifications before the deletion completes. + If the child is already a child of this component, then no action will be taken, and its + z-order will be left unchanged. + + @param child the new component to add. If the component passed-in is already + the child of another component, it'll first be removed from it current parent. @param zOrder The index in the child-list at which this component should be inserted. A value of -1 will insert it in front of the others, 0 is the back. - @see removeChildComponent, addAndMakeVisible, getChild, - ComponentListener::componentChildrenChanged + @see removeChildComponent, addAndMakeVisible, getChild, ComponentListener::componentChildrenChanged */ void addChildComponent (Component* child, int zOrder = -1); /** Adds a child component to this one, and also makes the child visible if it isn't. Quite a useful function, this is just the same as calling addChildComponent() - followed by setVisible (true) on the child. + followed by setVisible (true) on the child. See addChildComponent() for more details. */ void addAndMakeVisible (Component* child, int zOrder = -1); /** Removes one of this component's child-components. If the child passed-in isn't actually a child of this component (either because - it's invalid or is the child of a different parent), then nothing is done. + it's invalid or is the child of a different parent), then no action is taken. - Note that removing a child will not delete it! + Note that removing a child will not delete it! But it's ok to delete a component + without first removing it - doing so will automatically remove it and send out the + appropriate notifications before the deletion completes. @see addChildComponent, ComponentListener::componentChildrenChanged */ @@ -25862,7 +25937,9 @@ public: This will return a pointer to the component that was removed, or null if the index was out-of-range. - Note that removing a child will not delete it! + Note that removing a child will not delete it! But it's ok to delete a component + without first removing it - doing so will automatically remove it and send out the + appropriate notifications before the deletion completes. @see addChildComponent, ComponentListener::componentChildrenChanged */ @@ -27785,9 +27862,6 @@ public: juce_UseDebuggingNewOperator - /** @internal */ - void releaseMessageListener(); - private: // (for async invocation of commands) class CommandTargetMessageInvoker : public MessageListener @@ -28073,7 +28147,7 @@ public: // These are used by the START_JUCE_APPLICATION() macro and aren't for public use. /** @internal */ - static int main (String& commandLine, JUCEApplication* newApp); + static int main (const String& commandLine, JUCEApplication* newApp); /** @internal */ static int main (int argc, const char* argv[], JUCEApplication* newApp); @@ -28092,6 +28166,10 @@ public: bool perform (const InvocationInfo& info); /** @internal */ void actionListenerCallback (const String& message); + /** @internal */ + bool initialiseApp (const String& commandLine); + /** @internal */ + int shutdownApp(); private: @@ -28099,15 +28177,10 @@ private: int appReturnValue; bool stillInitialising; ScopedPointer appLock; + static JUCEApplication* appInstance; JUCEApplication (const JUCEApplication&); JUCEApplication& operator= (const JUCEApplication&); - -public: - /** @internal */ - bool initialiseApp (String& commandLine); - /** @internal */ - static int shutdownAppAndClearUp(); }; #endif // __JUCE_APPLICATION_JUCEHEADER__ @@ -56932,7 +57005,7 @@ public: { openGLDefault = 0, -#if JUCE_IPHONE +#if JUCE_IOS openGLES1, /**< On the iPhone, this selects openGL ES 1.0 */ openGLES2 /**< On the iPhone, this selects openGL ES 2.0 */ #endif @@ -61174,7 +61247,7 @@ END_JUCE_NAMESPACE of 3rd party header files, you may need to use the juce_WithoutMacros.h file - see the comments in that file for more information. */ - #if (JUCE_MAC || JUCE_IPHONE) && ! JUCE_DONT_DEFINE_MACROS + #if (JUCE_MAC || JUCE_IOS) && ! JUCE_DONT_DEFINE_MACROS #define Component JUCE_NAMESPACE::Component #define MemoryBlock JUCE_NAMESPACE::MemoryBlock #define Point JUCE_NAMESPACE::Point @@ -61277,50 +61350,6 @@ END_JUCE_NAMESPACE #endif -/* - To start a JUCE app, use this macro: START_JUCE_APPLICATION (AppSubClass) where - AppSubClass is the name of a class derived from JUCEApplication. - - See the JUCEApplication class documentation (juce_Application.h) for more details. - -*/ -#if defined (JUCE_GCC) || defined (__MWERKS__) - - #define START_JUCE_APPLICATION(AppClass) \ - int main (int argc, char* argv[]) \ - { \ - return JUCE_NAMESPACE::JUCEApplication::main (argc, (const char**) argv, new AppClass()); \ - } - -#elif JUCE_WINDOWS - - #ifdef _CONSOLE - #define START_JUCE_APPLICATION(AppClass) \ - int main (int, char* argv[]) \ - { \ - JUCE_NAMESPACE::String commandLineString (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \ - return JUCE_NAMESPACE::JUCEApplication::main (commandLineString, new AppClass()); \ - } - #elif ! defined (_AFXDLL) - #ifdef _WINDOWS_ - #define START_JUCE_APPLICATION(AppClass) \ - int WINAPI WinMain (HINSTANCE, HINSTANCE, LPSTR, int) \ - { \ - JUCE_NAMESPACE::String commandLineString (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \ - return JUCE_NAMESPACE::JUCEApplication::main (commandLineString, new AppClass()); \ - } - #else - #define START_JUCE_APPLICATION(AppClass) \ - int __stdcall WinMain (int, int, const char*, int) \ - { \ - JUCE_NAMESPACE::String commandLineString (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \ - return JUCE_NAMESPACE::JUCEApplication::main (commandLineString, new AppClass()); \ - } - #endif - #endif - -#endif - #endif // __JUCE_JUCEHEADER__ /*** End of inlined file: juce.h ***/ diff --git a/src/application/juce_Application.cpp b/src/application/juce_Application.cpp index c0106aab94..b1d2802e91 100644 --- a/src/application/juce_Application.cpp +++ b/src/application/juce_Application.cpp @@ -25,38 +25,25 @@ #include "../core/juce_StandardHeader.h" -#if JUCE_MSVC - #pragma warning (push) - #pragma warning (disable: 4245 4514 4100) - #include - #pragma warning (pop) -#endif - BEGIN_JUCE_NAMESPACE #include "juce_Application.h" #include "../utilities/juce_DeletedAtShutdown.h" #include "../events/juce_MessageManager.h" -#include "../gui/graphics/contexts/juce_Graphics.h" -#include "../gui/components/windows/juce_AlertWindow.h" -#include "../gui/components/buttons/juce_TextButton.h" -#include "../gui/components/lookandfeel/juce_LookAndFeel.h" #include "../core/juce_Time.h" #include "../core/juce_Initialisation.h" #include "../threads/juce_Process.h" #include "../core/juce_PlatformUtilities.h" #include "../text/juce_LocalisedStrings.h" -void juce_setCurrentThreadName (const String& name); - -static JUCEApplication* appInstance = 0; - //============================================================================== JUCEApplication::JUCEApplication() : appReturnValue (0), stillInitialising (true) { + jassert (appInstance == 0); + appInstance = this; } JUCEApplication::~JUCEApplication() @@ -66,8 +53,13 @@ JUCEApplication::~JUCEApplication() appLock->exit(); appLock = 0; } + + jassert (appInstance == this); + appInstance = 0; } +JUCEApplication* JUCEApplication::appInstance = 0; + JUCEApplication* JUCEApplication::getInstance() throw() { return appInstance; @@ -108,6 +100,12 @@ void JUCEApplication::setApplicationReturnValue (const int newReturnValue) throw appReturnValue = newReturnValue; } +void JUCEApplication::actionListenerCallback (const String& message) +{ + if (message.startsWith (getApplicationName() + "/")) + anotherInstanceStarted (message.substring (getApplicationName().length() + 1)); +} + //============================================================================== void JUCEApplication::unhandledException (const std::exception*, const String&, @@ -160,41 +158,11 @@ bool JUCEApplication::perform (const InvocationInfo& info) } //============================================================================== -int JUCEApplication::main (String& commandLine, JUCEApplication* const app) +bool JUCEApplication::initialiseApp (const String& commandLine) { - if (! app->initialiseApp (commandLine)) - return 0; - - // now loop until a quit message is received.. - JUCE_TRY - { - MessageManager::getInstance()->runDispatchLoop(); - } -#if JUCE_CATCH_UNHANDLED_EXCEPTIONS - catch (const std::exception& e) - { - app->unhandledException (&e, __FILE__, __LINE__); - } - catch (...) - { - app->unhandledException (0, __FILE__, __LINE__); - } -#endif - - return shutdownAppAndClearUp(); -} - -bool JUCEApplication::initialiseApp (String& commandLine) -{ - jassert (appInstance == 0); - appInstance = this; - commandLineParameters = commandLine.trim(); - commandLine = String::empty; - initialiseJuce_GUI(); - -#if ! JUCE_IPHONE +#if ! JUCE_IOS jassert (appLock == 0); // initialiseApp must only be called once! if (! moreThanOneInstanceAllowed()) @@ -206,9 +174,6 @@ bool JUCEApplication::initialiseApp (String& commandLine) appLock = 0; MessageManager::broadcastMessage (getApplicationName() + "/" + commandLineParameters); - delete appInstance; - appInstance = 0; - DBG ("Another instance is running - quitting..."); return false; } @@ -225,151 +190,66 @@ bool JUCEApplication::initialiseApp (String& commandLine) return true; } -int JUCEApplication::shutdownAppAndClearUp() +int JUCEApplication::shutdownApp() { - jassert (appInstance != 0); - ScopedPointer app (appInstance); - int returnValue = 0; + jassert (appInstance == this); - MessageManager::getInstance()->deregisterBroadcastListener (static_cast (app)); + MessageManager::getInstance()->deregisterBroadcastListener (this); - static bool reentrancyCheck = false; - - if (! reentrancyCheck) + JUCE_TRY { - reentrancyCheck = true; - - JUCE_TRY - { - // give the app a chance to clean up.. - app->shutdown(); - } -#if JUCE_CATCH_UNHANDLED_EXCEPTIONS - catch (const std::exception& e) - { - app->unhandledException (&e, __FILE__, __LINE__); - } - catch (...) - { - app->unhandledException (0, __FILE__, __LINE__); - } -#endif - - JUCE_TRY - { - app->releaseMessageListener(); - - shutdownJuce_GUI(); - - returnValue = app->getApplicationReturnValue(); - - appInstance = 0; - app = 0; - } - JUCE_CATCH_ALL_ASSERT - - reentrancyCheck = false; + // give the app a chance to clean up.. + shutdown(); } + JUCE_CATCH_EXCEPTION - return returnValue; + return getApplicationReturnValue(); } -#if JUCE_IPHONE - extern int juce_IPhoneMain (int argc, const char* argv[], JUCEApplication* app); +//============================================================================== +int JUCEApplication::main (const String& commandLine, JUCEApplication* const app) +{ + const ScopedPointer appDeleter (app); + + if (! app->initialiseApp (commandLine)) + return 0; + + JUCE_TRY + { + // loop until a quit message is received.. + MessageManager::getInstance()->runDispatchLoop(); + } + JUCE_CATCH_EXCEPTION + + return app->shutdownApp(); +} + +#if JUCE_IOS + extern int juce_iOSMain (int argc, const char* argv[]); #endif #if ! JUCE_WINDOWS -extern const char* juce_Argv0; + extern const char* juce_Argv0; #endif int JUCEApplication::main (int argc, const char* argv[], JUCEApplication* const newApp) { -#if ! JUCE_WINDOWS + JUCE_AUTORELEASEPOOL + + #if ! JUCE_WINDOWS juce_Argv0 = argv[0]; -#endif - -#if JUCE_IPHONE - const ScopedAutoReleasePool pool; - return juce_IPhoneMain (argc, argv, newApp); -#else - - #if JUCE_MAC - const ScopedAutoReleasePool pool; #endif + #if JUCE_IOS + const ScopedPointer appDeleter (newApp); + return juce_iOSMain (argc, argv); + #else String cmd; for (int i = 1; i < argc; ++i) cmd << argv[i] << ' '; return JUCEApplication::main (cmd, newApp); -#endif -} - -void JUCEApplication::actionListenerCallback (const String& message) -{ - if (message.startsWith (getApplicationName() + "/")) - anotherInstanceStarted (message.substring (getApplicationName().length() + 1)); -} - -//============================================================================== -static bool juceInitialisedGUI = false; - - -void JUCE_PUBLIC_FUNCTION initialiseJuce_GUI() -{ - if (! juceInitialisedGUI) - { -#if JUCE_MAC || JUCE_IPHONE - const ScopedAutoReleasePool pool; -#endif - juceInitialisedGUI = true; - - initialiseJuce_NonGUI(); - MessageManager::getInstance(); - LookAndFeel::setDefaultLookAndFeel (0); - juce_setCurrentThreadName ("Juce Message Thread"); - -#if JUCE_WINDOWS && JUCE_DEBUG - // This section is just for catching people who mess up their project settings and - // turn RTTI off.. - try - { - TextButton tb (String::empty); - Component* c = &tb; - - // Got an exception here? Then TURN ON RTTI in your compiler settings!! - c = dynamic_cast (c); - } - catch (...) - { - // Ended up here? If so, TURN ON RTTI in your compiler settings!! And if you - // got as far as this catch statement, then why haven't you got exception catching - // turned on in the debugger??? - jassertfalse; - } -#endif - } -} - -void JUCE_PUBLIC_FUNCTION shutdownJuce_GUI() -{ - if (juceInitialisedGUI) - { -#if JUCE_MAC - const ScopedAutoReleasePool pool; -#endif - { - DeletedAtShutdown::deleteAll(); - - LookAndFeel::clearDefaultLookAndFeel(); - } - - delete MessageManager::getInstance(); - - shutdownJuce_NonGUI(); - - juceInitialisedGUI = false; - } + #endif } END_JUCE_NAMESPACE diff --git a/src/application/juce_Application.h b/src/application/juce_Application.h index 4dcccd78d7..345f5c8fbc 100644 --- a/src/application/juce_Application.h +++ b/src/application/juce_Application.h @@ -263,7 +263,7 @@ public: // These are used by the START_JUCE_APPLICATION() macro and aren't for public use. /** @internal */ - static int main (String& commandLine, JUCEApplication* newApp); + static int main (const String& commandLine, JUCEApplication* newApp); /** @internal */ static int main (int argc, const char* argv[], JUCEApplication* newApp); @@ -283,6 +283,10 @@ public: bool perform (const InvocationInfo& info); /** @internal */ void actionListenerCallback (const String& message); + /** @internal */ + bool initialiseApp (const String& commandLine); + /** @internal */ + int shutdownApp(); private: //============================================================================== @@ -290,15 +294,10 @@ private: int appReturnValue; bool stillInitialising; ScopedPointer appLock; + static JUCEApplication* appInstance; JUCEApplication (const JUCEApplication&); JUCEApplication& operator= (const JUCEApplication&); - -public: - /** @internal */ - bool initialiseApp (String& commandLine); - /** @internal */ - static int shutdownAppAndClearUp(); }; diff --git a/src/application/juce_ApplicationCommandTarget.cpp b/src/application/juce_ApplicationCommandTarget.cpp index 962ff9fd0f..ca046910f4 100644 --- a/src/application/juce_ApplicationCommandTarget.cpp +++ b/src/application/juce_ApplicationCommandTarget.cpp @@ -37,11 +37,6 @@ ApplicationCommandTarget::ApplicationCommandTarget() } ApplicationCommandTarget::~ApplicationCommandTarget() -{ - releaseMessageListener(); -} - -void ApplicationCommandTarget::releaseMessageListener() { messageInvoker = 0; } diff --git a/src/application/juce_ApplicationCommandTarget.h b/src/application/juce_ApplicationCommandTarget.h index 2f3b5c4516..055ffecdf8 100644 --- a/src/application/juce_ApplicationCommandTarget.h +++ b/src/application/juce_ApplicationCommandTarget.h @@ -235,9 +235,6 @@ public: //============================================================================== juce_UseDebuggingNewOperator - /** @internal */ - void releaseMessageListener(); - private: // (for async invocation of commands) class CommandTargetMessageInvoker : public MessageListener diff --git a/src/audio/audio_file_formats/juce_QuickTimeAudioFormat.cpp b/src/audio/audio_file_formats/juce_QuickTimeAudioFormat.cpp index 161ff1961d..892b5d4ed3 100644 --- a/src/audio/audio_file_formats/juce_QuickTimeAudioFormat.cpp +++ b/src/audio/audio_file_formats/juce_QuickTimeAudioFormat.cpp @@ -26,7 +26,7 @@ #include "../../core/juce_TargetPlatform.h" #include "../../../juce_Config.h" -#if JUCE_QUICKTIME && ! (JUCE_64BIT || JUCE_IPHONE) +#if JUCE_QUICKTIME && ! (JUCE_64BIT || JUCE_IOS) #if ! JUCE_WINDOWS #include diff --git a/src/audio/devices/juce_AudioDeviceManager.cpp b/src/audio/devices/juce_AudioDeviceManager.cpp index 400d77fb7a..b15edd3d69 100644 --- a/src/audio/devices/juce_AudioDeviceManager.cpp +++ b/src/audio/devices/juce_AudioDeviceManager.cpp @@ -131,7 +131,7 @@ void AudioDeviceManager::createAudioDeviceTypes (OwnedArray & list.add (juce_createAudioIODeviceType_CoreAudio()); #endif - #if JUCE_IPHONE + #if JUCE_IOS list.add (juce_createAudioIODeviceType_iPhoneAudio()); #endif diff --git a/src/core/juce_Atomic.h b/src/core/juce_Atomic.h index 9930679339..70c0df83ab 100644 --- a/src/core/juce_Atomic.h +++ b/src/core/juce_Atomic.h @@ -157,11 +157,11 @@ private: /* The following code is in the header so that the atomics can be inlined where possible... */ -#if (JUCE_IPHONE && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_2 || ! defined (__IPHONE_3_2))) \ +#if (JUCE_IOS && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_2 || ! defined (__IPHONE_3_2))) \ || (JUCE_MAC && (JUCE_PPC || __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 2))) #define JUCE_ATOMICS_MAC 1 // Older OSX builds using gcc4.1 or earlier - #if JUCE_PPC || JUCE_IPHONE + #if JUCE_PPC || JUCE_IOS // None of these atomics are available for PPC or for iPhoneOS 3.1 or earlier!! template static Type OSAtomicAdd64Barrier (Type b, volatile Type* a) throw() { jassertfalse; return *a += b; } template static Type OSAtomicIncrement64Barrier (volatile Type* a) throw() { jassertfalse; return ++*a; } @@ -175,7 +175,7 @@ private: #elif JUCE_GCC #define JUCE_ATOMICS_GCC 1 // GCC with intrinsics - #if JUCE_IPHONE + #if JUCE_IOS #define JUCE_64BIT_ATOMICS_UNAVAILABLE 1 // (on the iphone, the 64-bit ops will compile but not link) #endif diff --git a/src/core/juce_ByteOrder.h b/src/core/juce_ByteOrder.h index a2a614c7da..b7f8108aaf 100644 --- a/src/core/juce_ByteOrder.h +++ b/src/core/juce_ByteOrder.h @@ -116,7 +116,7 @@ inline uint16 ByteOrder::swap (uint16 n) inline uint32 ByteOrder::swap (uint32 n) { -#if JUCE_MAC || JUCE_IPHONE +#if JUCE_MAC || JUCE_IOS return OSSwapInt32 (n); #elif JUCE_GCC asm("bswap %%eax" : "=a"(n) : "a"(n)); @@ -135,7 +135,7 @@ inline uint32 ByteOrder::swap (uint32 n) inline uint64 ByteOrder::swap (uint64 value) { -#if JUCE_MAC || JUCE_IPHONE +#if JUCE_MAC || JUCE_IOS return OSSwapInt64 (value); #elif JUCE_USE_INTRINSICS return _byteswap_uint64 (value); diff --git a/src/core/juce_Initialisation.cpp b/src/core/juce_Initialisation.cpp new file mode 100644 index 0000000000..de7d04979e --- /dev/null +++ b/src/core/juce_Initialisation.cpp @@ -0,0 +1,272 @@ +/* + ============================================================================== + + This file is part of the JUCE library - "Jules' Utility Class Extensions" + Copyright 2004-10 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 "juce_StandardHeader.h" + +BEGIN_JUCE_NAMESPACE + +#include "juce_Atomic.h" +#include "juce_Random.h" +#include "juce_PlatformUtilities.h" +#include "juce_SystemStats.h" +#include "../text/juce_LocalisedStrings.h" +#include "../io/streams/juce_MemoryOutputStream.h" +#include "../io/streams/juce_MemoryInputStream.h" +#include "../threads/juce_Thread.h" + +#if ! JUCE_ONLY_BUILD_CORE_LIBRARY + #include "../events/juce_MessageManager.h" + #include "../gui/components/buttons/juce_TextButton.h" + #include "../gui/components/lookandfeel/juce_LookAndFeel.h" +#endif + +#if JUCE_WINDOWS + extern void juce_shutdownWin32Sockets(); // (defined in the sockets code) +#endif + +#if JUCE_DEBUG + extern void juce_CheckForDanglingStreams(); // (in juce_OutputStream.cpp) +#endif + +//============================================================================== +#if JUCE_DEBUG + +namespace SimpleUnitTests +{ + template + class AtomicTester + { + public: + AtomicTester() {} + + static void testInteger() + { + Atomic a, b; + a.set ((Type) 10); + a += (Type) 15; + a.memoryBarrier(); + a -= (Type) 5; + ++a; ++a; --a; + a.memoryBarrier(); + + testFloat(); + } + + static void testFloat() + { + Atomic a, b; + a = (Type) 21; + a.memoryBarrier(); + + /* These are some simple test cases to check the atomics - let me know + if any of these assertions fail on your system! + */ + jassert (a.get() == (Type) 21); + jassert (a.compareAndSetValue ((Type) 100, (Type) 50) == (Type) 21); + jassert (a.get() == (Type) 21); + jassert (a.compareAndSetValue ((Type) 101, a.get()) == (Type) 21); + jassert (a.get() == (Type) 101); + jassert (! a.compareAndSetBool ((Type) 300, (Type) 200)); + jassert (a.get() == (Type) 101); + jassert (a.compareAndSetBool ((Type) 200, a.get())); + jassert (a.get() == (Type) 200); + + jassert (a.exchange ((Type) 300) == (Type) 200); + jassert (a.get() == (Type) 300); + + b = a; + jassert (b.get() == a.get()); + } + }; + + static void runBasicTests() + { + // Some simple test code, to keep an eye on things and make sure these functions + // work ok on all platforms. Let me know if any of these assertions fail on your system! + + static_jassert (sizeof (pointer_sized_int) == sizeof (void*)); + static_jassert (sizeof (int8) == 1); + static_jassert (sizeof (uint8) == 1); + static_jassert (sizeof (int16) == 2); + static_jassert (sizeof (uint16) == 2); + static_jassert (sizeof (int32) == 4); + static_jassert (sizeof (uint32) == 4); + static_jassert (sizeof (int64) == 8); + static_jassert (sizeof (uint64) == 8); + + char a1[7]; + jassert (numElementsInArray(a1) == 7); + int a2[3]; + jassert (numElementsInArray(a2) == 3); + + jassert (ByteOrder::swap ((uint16) 0x1122) == 0x2211); + jassert (ByteOrder::swap ((uint32) 0x11223344) == 0x44332211); + jassert (ByteOrder::swap ((uint64) literal64bit (0x1122334455667788)) == literal64bit (0x8877665544332211)); + + // Some quick stream tests.. + int randomInt = Random::getSystemRandom().nextInt(); + int64 randomInt64 = Random::getSystemRandom().nextInt64(); + double randomDouble = Random::getSystemRandom().nextDouble(); + String randomString; + for (int i = 50; --i >= 0;) + randomString << (juce_wchar) (Random::getSystemRandom().nextInt() & 0xffff); + + MemoryOutputStream mo; + mo.writeInt (randomInt); + mo.writeIntBigEndian (randomInt); + mo.writeCompressedInt (randomInt); + mo.writeString (randomString); + mo.writeInt64 (randomInt64); + mo.writeInt64BigEndian (randomInt64); + mo.writeDouble (randomDouble); + mo.writeDoubleBigEndian (randomDouble); + + MemoryInputStream mi (mo.getData(), mo.getDataSize(), false); + jassert (mi.readInt() == randomInt); + jassert (mi.readIntBigEndian() == randomInt); + jassert (mi.readCompressedInt() == randomInt); + jassert (mi.readString() == randomString); + jassert (mi.readInt64() == randomInt64); + jassert (mi.readInt64BigEndian() == randomInt64); + jassert (mi.readDouble() == randomDouble); + jassert (mi.readDoubleBigEndian() == randomDouble); + + AtomicTester ::testInteger(); + AtomicTester ::testInteger(); + AtomicTester ::testInteger(); + AtomicTester ::testInteger(); + AtomicTester ::testInteger(); + AtomicTester ::testInteger(); + AtomicTester ::testInteger(); + AtomicTester ::testFloat(); + #if ! JUCE_64BIT_ATOMICS_UNAVAILABLE // 64-bit intrinsics aren't available on some old platforms + AtomicTester ::testInteger(); + AtomicTester ::testInteger(); + AtomicTester ::testFloat(); + #endif + } +} +#endif + +//============================================================================== +static bool juceInitialisedNonGUI = false; + +void JUCE_PUBLIC_FUNCTION initialiseJuce_NonGUI() +{ + if (! juceInitialisedNonGUI) + { + juceInitialisedNonGUI = true; + + JUCE_AUTORELEASEPOOL + + #if JUCE_DEBUG + SimpleUnitTests::runBasicTests(); + #endif + + DBG (SystemStats::getJUCEVersion()); + SystemStats::initialiseStats(); + Random::getSystemRandom().setSeedRandomly(); // (mustn't call this before initialiseStats() because it relies on the time being set up) + } +} + +void JUCE_PUBLIC_FUNCTION shutdownJuce_NonGUI() +{ + if (juceInitialisedNonGUI) + { + juceInitialisedNonGUI = false; + + JUCE_AUTORELEASEPOOL + + LocalisedStrings::setCurrentMappings (0); + Thread::stopAllThreads (3000); + + #if JUCE_WINDOWS + juce_shutdownWin32Sockets(); + #endif + + #if JUCE_DEBUG + juce_CheckForDanglingStreams(); + #endif + } +} + +//============================================================================== +#if ! JUCE_ONLY_BUILD_CORE_LIBRARY + +void juce_setCurrentThreadName (const String& name); + +static bool juceInitialisedGUI = false; + +void JUCE_PUBLIC_FUNCTION initialiseJuce_GUI() +{ + if (! juceInitialisedGUI) + { + juceInitialisedGUI = true; + + JUCE_AUTORELEASEPOOL + initialiseJuce_NonGUI(); + + MessageManager::getInstance(); + LookAndFeel::setDefaultLookAndFeel (0); + juce_setCurrentThreadName ("Juce Message Thread"); + + #if JUCE_DEBUG + // This section is just for catching people who mess up their project settings and + // turn RTTI off.. + try + { + TextButton tb (String::empty); + Component* c = &tb; + + // Got an exception here? Then TURN ON RTTI in your compiler settings!! + c = dynamic_cast (c); + } + catch (...) + { + // Ended up here? If so, TURN ON RTTI in your compiler settings!! + jassertfalse; + } + #endif + } +} + +void JUCE_PUBLIC_FUNCTION shutdownJuce_GUI() +{ + if (juceInitialisedGUI) + { + juceInitialisedGUI = false; + + JUCE_AUTORELEASEPOOL + DeletedAtShutdown::deleteAll(); + LookAndFeel::clearDefaultLookAndFeel(); + delete MessageManager::getInstance(); + + shutdownJuce_NonGUI(); + } +} + +#endif + +END_JUCE_NAMESPACE diff --git a/src/core/juce_Initialisation.h b/src/core/juce_Initialisation.h index ddef17e276..17c9930b52 100644 --- a/src/core/juce_Initialisation.h +++ b/src/core/juce_Initialisation.h @@ -126,5 +126,51 @@ public: }; +//============================================================================== +/* + To start a JUCE app, use this macro: START_JUCE_APPLICATION (AppSubClass) where + AppSubClass is the name of a class derived from JUCEApplication. + + See the JUCEApplication class documentation (juce_Application.h) for more details. + +*/ +#if defined (JUCE_GCC) || defined (__MWERKS__) + + #define START_JUCE_APPLICATION(AppClass) \ + int main (int argc, char* argv[]) \ + { \ + JUCE_NAMESPACE::ScopedJuceInitialiser_GUI libraryInitialiser; \ + return JUCE_NAMESPACE::JUCEApplication::main (argc, (const char**) argv, new AppClass()); \ + } + +#elif JUCE_WINDOWS + + #ifdef _CONSOLE + #define START_JUCE_APPLICATION(AppClass) \ + int main (int, char* argv[]) \ + { \ + JUCE_NAMESPACE::ScopedJuceInitialiser_GUI libraryInitialiser; \ + return JUCE_NAMESPACE::JUCEApplication::main (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams(), new AppClass()); \ + } + #elif ! defined (_AFXDLL) + #ifdef _WINDOWS_ + #define START_JUCE_APPLICATION(AppClass) \ + int WINAPI WinMain (HINSTANCE, HINSTANCE, LPSTR, int) \ + { \ + JUCE_NAMESPACE::ScopedJuceInitialiser_GUI libraryInitialiser; \ + return JUCE_NAMESPACE::JUCEApplication::main (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams(), new AppClass()); \ + } + #else + #define START_JUCE_APPLICATION(AppClass) \ + int __stdcall WinMain (int, int, const char*, int) \ + { \ + JUCE_NAMESPACE::ScopedJuceInitialiser_GUI libraryInitialiser; \ + return JUCE_NAMESPACE::JUCEApplication::main (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams(), new AppClass()); \ + } + #endif + #endif + +#endif + #endif // __JUCE_INITIALISATION_JUCEHEADER__ diff --git a/src/core/juce_PlatformDefs.h b/src/core/juce_PlatformDefs.h index 6d4df460e7..6cfd1e4e31 100644 --- a/src/core/juce_PlatformDefs.h +++ b/src/core/juce_PlatformDefs.h @@ -96,7 +96,7 @@ #endif #elif JUCE_MAC #define juce_breakDebugger Debugger(); - #elif JUCE_IPHONE + #elif JUCE_IOS #define juce_breakDebugger kill (0, SIGTRAP); #elif JUCE_LINUX #define juce_breakDebugger kill (0, SIGTRAP); diff --git a/src/core/juce_PlatformUtilities.h b/src/core/juce_PlatformUtilities.h index a0754b683e..118442e7b7 100644 --- a/src/core/juce_PlatformUtilities.h +++ b/src/core/juce_PlatformUtilities.h @@ -52,7 +52,7 @@ public: const String& bodyText, const StringArray& filesToAttach); -#if JUCE_MAC || JUCE_IPHONE || DOXYGEN +#if JUCE_MAC || JUCE_IOS || DOXYGEN //============================================================================== /** MAC ONLY - Turns a Core CF String into a juce one. */ static const String cfStringToJuceString (CFStringRef cfString); @@ -208,7 +208,7 @@ private: //============================================================================== -#if JUCE_MAC || JUCE_IPHONE +#if JUCE_MAC || JUCE_IOS /** A handy C++ wrapper that creates and deletes an NSAutoreleasePool object using RAII. @@ -226,6 +226,12 @@ private: ScopedAutoReleasePool& operator= (const ScopedAutoReleasePool&); }; +#define JUCE_AUTORELEASEPOOL const ScopedAutoReleasePool pool; + +#else + +#define JUCE_AUTORELEASEPOOL + #endif diff --git a/src/core/juce_StandardHeader.h b/src/core/juce_StandardHeader.h index fcd6ec1eed..443d66bdd3 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 52 -#define JUCE_BUILDNUMBER 40 +#define JUCE_BUILDNUMBER 41 /** Current Juce version number. @@ -89,7 +89,7 @@ #include #endif -#if JUCE_MAC || JUCE_IPHONE +#if JUCE_MAC || JUCE_IOS #include #endif diff --git a/src/core/juce_SystemStats.cpp b/src/core/juce_SystemStats.cpp index b1b156d9be..aca7bcd13d 100644 --- a/src/core/juce_SystemStats.cpp +++ b/src/core/juce_SystemStats.cpp @@ -29,14 +29,8 @@ BEGIN_JUCE_NAMESPACE #include "../text/juce_String.h" #include "juce_SystemStats.h" -#include "juce_Random.h" #include "juce_Time.h" -#include "juce_Atomic.h" -#include "../threads/juce_Thread.h" -#include "../text/juce_LocalisedStrings.h" #include "juce_PlatformUtilities.h" -#include "../io/streams/juce_MemoryOutputStream.h" -#include "../io/streams/juce_MemoryInputStream.h" //============================================================================== @@ -69,186 +63,6 @@ const StringArray SystemStats::getMACAddressStrings() return s; } -//============================================================================== -static bool juceInitialisedNonGUI = false; - -#if JUCE_DEBUG -template -class AtomicTester -{ -public: - AtomicTester() {} - - static void testInteger() - { - Atomic a, b; - a.set ((Type) 10); - a += (Type) 15; - - a.memoryBarrier(); - a -= (Type) 5; - ++a; - ++a; - --a; - a.memoryBarrier(); - - testFloat(); - } - - static void testFloat() - { - Atomic a, b; - a = (Type) 21; - a.memoryBarrier(); - - /* These are some simple test cases to check the atomics - let me know - if any of these assertions fail on your system! - */ - jassert (a.get() == (Type) 21); - jassert (a.compareAndSetValue ((Type) 100, (Type) 50) == (Type) 21); - jassert (a.get() == (Type) 21); - jassert (a.compareAndSetValue ((Type) 101, a.get()) == (Type) 21); - jassert (a.get() == (Type) 101); - jassert (! a.compareAndSetBool ((Type) 300, (Type) 200)); - jassert (a.get() == (Type) 101); - jassert (a.compareAndSetBool ((Type) 200, a.get())); - jassert (a.get() == (Type) 200); - - jassert (a.exchange ((Type) 300) == (Type) 200); - jassert (a.get() == (Type) 300); - - b = a; - jassert (b.get() == a.get()); - } -}; - -static void juce_testAtomics() -{ - AtomicTester ::testInteger(); - AtomicTester ::testInteger(); - AtomicTester ::testInteger(); - AtomicTester ::testInteger(); - AtomicTester ::testInteger(); - AtomicTester ::testInteger(); - AtomicTester ::testInteger(); - AtomicTester ::testFloat(); - #if ! JUCE_64BIT_ATOMICS_UNAVAILABLE // 64-bit intrinsics aren't available on some old platforms - AtomicTester ::testInteger(); - AtomicTester ::testInteger(); - AtomicTester ::testFloat(); - #endif - -} -#endif - -//============================================================================== -void JUCE_PUBLIC_FUNCTION initialiseJuce_NonGUI() -{ - if (! juceInitialisedNonGUI) - { -#if JUCE_MAC || JUCE_IPHONE - const ScopedAutoReleasePool pool; -#endif - -#if JUCE_DEBUG - { - // Some simple test code to keep an eye on things and make sure these functions - // work ok on all platforms. Let me know if any of these assertions fail! - - static_jassert (sizeof (pointer_sized_int) == sizeof (void*)); - - static_jassert (sizeof (int8) == 1); - static_jassert (sizeof (uint8) == 1); - static_jassert (sizeof (int16) == 2); - static_jassert (sizeof (uint16) == 2); - static_jassert (sizeof (int32) == 4); - static_jassert (sizeof (uint32) == 4); - static_jassert (sizeof (int64) == 8); - static_jassert (sizeof (uint64) == 8); - - char a1[7]; - jassert (numElementsInArray(a1) == 7); - int a2[3]; - jassert (numElementsInArray(a2) == 3); - - juce_testAtomics(); - - jassert (ByteOrder::swap ((uint16) 0x1122) == 0x2211); - jassert (ByteOrder::swap ((uint32) 0x11223344) == 0x44332211); - - // Some quick stream tests.. - int randomInt = Random::getSystemRandom().nextInt(); - int64 randomInt64 = Random::getSystemRandom().nextInt64(); - double randomDouble = Random::getSystemRandom().nextDouble(); - String randomString; - for (int i = 50; --i >= 0;) - randomString << (juce_wchar) (Random::getSystemRandom().nextInt() & 0xffff); - - MemoryOutputStream mo; - mo.writeInt (randomInt); - mo.writeIntBigEndian (randomInt); - mo.writeCompressedInt (randomInt); - mo.writeString (randomString); - mo.writeInt64 (randomInt64); - mo.writeInt64BigEndian (randomInt64); - mo.writeDouble (randomDouble); - mo.writeDoubleBigEndian (randomDouble); - - MemoryInputStream mi (mo.getData(), mo.getDataSize(), false); - jassert (mi.readInt() == randomInt); - jassert (mi.readIntBigEndian() == randomInt); - jassert (mi.readCompressedInt() == randomInt); - jassert (mi.readString() == randomString); - jassert (mi.readInt64() == randomInt64); - jassert (mi.readInt64BigEndian() == randomInt64); - jassert (mi.readDouble() == randomDouble); - jassert (mi.readDoubleBigEndian() == randomDouble); - } -#endif - // Now the real initialisation.. - - juceInitialisedNonGUI = true; - - DBG (SystemStats::getJUCEVersion()); - SystemStats::initialiseStats(); - Random::getSystemRandom().setSeedRandomly(); // (mustn't call this before initialiseStats() because it relies on the time being set up) - } -} - -//============================================================================== -#if JUCE_WINDOWS - extern void juce_shutdownWin32Sockets(); // (defined in the sockets code) -#endif - -#if JUCE_DEBUG - extern void juce_CheckForDanglingStreams(); -#endif - -//============================================================================== -void JUCE_PUBLIC_FUNCTION shutdownJuce_NonGUI() -{ - if (juceInitialisedNonGUI) - { - #if JUCE_MAC || JUCE_IPHONE - const ScopedAutoReleasePool pool; - #endif - - #if JUCE_WINDOWS - // need to shut down sockets if they were used.. - juce_shutdownWin32Sockets(); - #endif - - LocalisedStrings::setCurrentMappings (0); - Thread::stopAllThreads (3000); - - #if JUCE_DEBUG - juce_CheckForDanglingStreams(); - #endif - - juceInitialisedNonGUI = false; - } -} - //============================================================================== #ifdef JUCE_DLL diff --git a/src/core/juce_TargetPlatform.h b/src/core/juce_TargetPlatform.h index d126bb9ab3..2892f06313 100644 --- a/src/core/juce_TargetPlatform.h +++ b/src/core/juce_TargetPlatform.h @@ -50,6 +50,7 @@ #if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR #define JUCE_IPHONE 1 + #define JUCE_IOS 1 #else #define JUCE_MAC 1 #endif @@ -117,7 +118,7 @@ #endif //============================================================================== -#if JUCE_IPHONE +#if JUCE_IOS #ifndef NDEBUG #define JUCE_DEBUG 1 diff --git a/src/events/juce_MessageManager.cpp b/src/events/juce_MessageManager.cpp index 96b58de9cb..28bdeeda4c 100644 --- a/src/events/juce_MessageManager.cpp +++ b/src/events/juce_MessageManager.cpp @@ -133,7 +133,7 @@ void MessageManager::deliverMessage (Message* const message) } //============================================================================== -#if ! (JUCE_MAC || JUCE_IPHONE) +#if ! (JUCE_MAC || JUCE_IOS) void MessageManager::runDispatchLoop() { jassert (isThisTheMessageThread()); // must only be called by the message thread diff --git a/src/gui/components/juce_Component.h b/src/gui/components/juce_Component.h index 5850a252e8..b66f075e52 100644 --- a/src/gui/components/juce_Component.h +++ b/src/gui/components/juce_Component.h @@ -75,8 +75,15 @@ public: /** Destructor. - Note that when a component is deleted, any child components it might - contain are NOT deleted unless you explicitly call deleteAllChildren() first. + Note that when a component is deleted, any child components it contain are NOT + automatically deleted. It's your responsibilty to manage their lifespan - you + may want to use helper methods like deleteAllChildren(), or less haphazard + approaches like using ScopedPointers or normal object aggregation to manage them. + + If the component being deleted is currently the child of another one, then during + deletion, it will be removed from its parent, and the parent will receive a childrenChanged() + callback. Any ComponentListener objects that have registered with it will also have their + ComponentListener::componentBeingDeleted() methods called. */ virtual ~Component(); @@ -552,29 +559,37 @@ public: /** Adds a child component to this one. - @param child the new component to add. If the component passed-in is already - the child of another component, it'll first be removed from that. + Adding a child component does not mean that the component will own or delete the child - it's + your responsibility to delete the component. Note that it's safe to delete a component + without first removing it from its parent - doing so will automatically remove it and + send out the appropriate notifications before the deletion completes. + If the child is already a child of this component, then no action will be taken, and its + z-order will be left unchanged. + + @param child the new component to add. If the component passed-in is already + the child of another component, it'll first be removed from it current parent. @param zOrder The index in the child-list at which this component should be inserted. A value of -1 will insert it in front of the others, 0 is the back. - @see removeChildComponent, addAndMakeVisible, getChild, - ComponentListener::componentChildrenChanged + @see removeChildComponent, addAndMakeVisible, getChild, ComponentListener::componentChildrenChanged */ void addChildComponent (Component* child, int zOrder = -1); /** Adds a child component to this one, and also makes the child visible if it isn't. Quite a useful function, this is just the same as calling addChildComponent() - followed by setVisible (true) on the child. + followed by setVisible (true) on the child. See addChildComponent() for more details. */ void addAndMakeVisible (Component* child, int zOrder = -1); /** Removes one of this component's child-components. If the child passed-in isn't actually a child of this component (either because - it's invalid or is the child of a different parent), then nothing is done. + it's invalid or is the child of a different parent), then no action is taken. - Note that removing a child will not delete it! + Note that removing a child will not delete it! But it's ok to delete a component + without first removing it - doing so will automatically remove it and send out the + appropriate notifications before the deletion completes. @see addChildComponent, ComponentListener::componentChildrenChanged */ @@ -585,7 +600,9 @@ public: This will return a pointer to the component that was removed, or null if the index was out-of-range. - Note that removing a child will not delete it! + Note that removing a child will not delete it! But it's ok to delete a component + without first removing it - doing so will automatically remove it and send out the + appropriate notifications before the deletion completes. @see addChildComponent, ComponentListener::componentChildrenChanged */ diff --git a/src/gui/components/juce_ComponentListener.h b/src/gui/components/juce_ComponentListener.h index 99cb8cc117..4fdb469f1c 100644 --- a/src/gui/components/juce_ComponentListener.h +++ b/src/gui/components/juce_ComponentListener.h @@ -99,10 +99,12 @@ public: /** Called when the component is in the process of being deleted. This callback is made from inside the destructor, so be very, very cautious - about what you do inside the callback. + about what you do in here. - It will be called before the component has been removed from its parent, and - before any child components have been removed. + In particular, bear in mind that it's the Component base class's destructor that calls + this - so if the object that's being deleted is a subclass of Component, then the + subclass layers of the object will already have been destructed when it gets to this + point! */ virtual void componentBeingDeleted (Component& component); }; diff --git a/src/gui/components/mouse/juce_MouseCursor.cpp b/src/gui/components/mouse/juce_MouseCursor.cpp index 15234134ae..7fa009b550 100644 --- a/src/gui/components/mouse/juce_MouseCursor.cpp +++ b/src/gui/components/mouse/juce_MouseCursor.cpp @@ -58,7 +58,7 @@ public: { const ScopedLock sl (getLock()); - for (int i = getCursors().size(); --i >= 0;) + for (int i = 0; i < getCursors().size(); ++i) { SharedCursorHandle* const sc = getCursors().getUnchecked(i); diff --git a/src/gui/components/special/juce_OpenGLComponent.h b/src/gui/components/special/juce_OpenGLComponent.h index 5b2bad250f..3ce956b724 100644 --- a/src/gui/components/special/juce_OpenGLComponent.h +++ b/src/gui/components/special/juce_OpenGLComponent.h @@ -190,7 +190,7 @@ public: { openGLDefault = 0, -#if JUCE_IPHONE +#if JUCE_IOS openGLES1, /**< On the iPhone, this selects openGL ES 1.0 */ openGLES2 /**< On the iPhone, this selects openGL ES 2.0 */ #endif diff --git a/src/gui/graphics/geometry/juce_Rectangle.h b/src/gui/graphics/geometry/juce_Rectangle.h index 2552f7e6f5..7a5820e8ec 100644 --- a/src/gui/graphics/geometry/juce_Rectangle.h +++ b/src/gui/graphics/geometry/juce_Rectangle.h @@ -167,6 +167,12 @@ public: x = newX; y = newY; w = newWidth; h = newHeight; } + /** Changes the rectangle's X coordinate */ + void setX (const ValueType newX) throw() { x = newX; } + + /** Changes the rectangle's Y coordinate */ + void setY (const ValueType newY) throw() { y = newY; } + /** Changes the rectangle's width */ void setWidth (const ValueType newWidth) throw() { w = newWidth; } diff --git a/src/gui/graphics/imaging/juce_Image.cpp b/src/gui/graphics/imaging/juce_Image.cpp index fd659b0da4..3905efc4a6 100644 --- a/src/gui/graphics/imaging/juce_Image.cpp +++ b/src/gui/graphics/imaging/juce_Image.cpp @@ -131,6 +131,9 @@ public: private: const ReferenceCountedObjectPtr image; const Rectangle area; + + SubsectionSharedImage (const SubsectionSharedImage&); + SubsectionSharedImage& operator= (const SubsectionSharedImage&); }; const Image Image::getClippedImage (const Rectangle& area) const diff --git a/src/io/network/juce_Socket.cpp b/src/io/network/juce_Socket.cpp index 45abe249c0..10c6e67f77 100644 --- a/src/io/network/juce_Socket.cpp +++ b/src/io/network/juce_Socket.cpp @@ -40,7 +40,7 @@ #include #include #include - #elif (MACOSX_DEPLOYMENT_TARGET <= MAC_OS_X_VERSION_10_4) && ! JUCE_IPHONE + #elif (MACOSX_DEPLOYMENT_TARGET <= MAC_OS_X_VERSION_10_4) && ! JUCE_IOS #include #endif @@ -58,7 +58,7 @@ BEGIN_JUCE_NAMESPACE #include "../../threads/juce_ScopedLock.h" #include "../../threads/juce_Thread.h" -#if defined (JUCE_LINUX) || defined (JUCE_MAC) || defined (JUCE_IPHONE) +#if defined (JUCE_LINUX) || defined (JUCE_MAC) || defined (JUCE_IOS) typedef socklen_t juce_socklen_t; #else typedef int juce_socklen_t; diff --git a/src/native/juce_mac_NativeCode.mm b/src/native/juce_mac_NativeCode.mm index 08b8235575..f21dbf8431 100644 --- a/src/native/juce_mac_NativeCode.mm +++ b/src/native/juce_mac_NativeCode.mm @@ -32,7 +32,7 @@ #include "../core/juce_TargetPlatform.h" -#if JUCE_MAC || JUCE_IPHONE +#if JUCE_MAC || JUCE_IOS #include "mac/juce_mac_NativeIncludes.h" @@ -98,7 +98,7 @@ BEGIN_JUCE_NAMESPACE #include "common/juce_posix_SharedCode.h" #include "mac/juce_mac_Files.mm" -#if JUCE_IPHONE +#if JUCE_IOS #include "mac/juce_iphone_MiscUtilities.mm" #else #include "mac/juce_mac_MiscUtilities.mm" @@ -107,7 +107,7 @@ BEGIN_JUCE_NAMESPACE #include "mac/juce_mac_Debugging.mm" #if ! JUCE_ONLY_BUILD_CORE_LIBRARY - #if JUCE_IPHONE + #if JUCE_IOS #include "mac/juce_mac_Fonts.mm" #include "mac/juce_mac_CoreGraphicsContext.mm" #include "mac/juce_iphone_UIViewComponentPeer.mm" diff --git a/src/native/mac/juce_iphone_MiscUtilities.mm b/src/native/mac/juce_iphone_MiscUtilities.mm index 764f797bc4..7dda6ea9df 100644 --- a/src/native/mac/juce_iphone_MiscUtilities.mm +++ b/src/native/mac/juce_iphone_MiscUtilities.mm @@ -29,8 +29,6 @@ //============================================================================== -static JUCEApplication* juce_intialisingApp; - END_JUCE_NAMESPACE @interface JuceAppStartupDelegate : NSObject @@ -38,7 +36,7 @@ END_JUCE_NAMESPACE } - (void) applicationDidFinishLaunching: (UIApplication*) application; -- (void) applicationWillResignActive: (UIApplication*) application; +- (void) applicationWillTerminate: (UIApplication*) application; @end @@ -48,22 +46,25 @@ END_JUCE_NAMESPACE { String dummy; - if (! juce_intialisingApp->initialiseApp (dummy)) + if (! JUCEApplication::getInstance()->initialiseApp (dummy)) exit (0); } -- (void) applicationWillResignActive: (UIApplication*) application +- (void) applicationWillTerminate: (UIApplication*) application { - JUCEApplication::shutdownAppAndClearUp(); + JUCEApplication::getInstance()->shutdownApp(); + + // need to do this stuff because the OS kills the process before our scope-based cleanup code gets executed.. + delete JUCEApplication::getInstance(); + shutdownJuce_GUI(); } @end BEGIN_JUCE_NAMESPACE -int juce_IPhoneMain (int argc, const char* argv[], JUCEApplication* app) +int juce_iOSMain (int argc, const char* argv[]) { - juce_intialisingApp = app; return UIApplicationMain (argc, const_cast (argv), nil, @"JuceAppStartupDelegate"); } diff --git a/src/native/mac/juce_mac_CoreGraphicsContext.mm b/src/native/mac/juce_mac_CoreGraphicsContext.mm index ddd43c90fc..3fd485a3b6 100644 --- a/src/native/mac/juce_mac_CoreGraphicsContext.mm +++ b/src/native/mac/juce_mac_CoreGraphicsContext.mm @@ -429,7 +429,7 @@ public: if (fillEntireClipAsTiles) { -#if JUCE_IPHONE +#if JUCE_IOS CGContextDrawTiledImage (context, imageRect, image); #else #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 diff --git a/src/native/mac/juce_mac_Files.mm b/src/native/mac/juce_mac_Files.mm index 9c3f6b270f..6e01f2b25a 100644 --- a/src/native/mac/juce_mac_Files.mm +++ b/src/native/mac/juce_mac_Files.mm @@ -89,7 +89,7 @@ bool File::isOnHardDisk() const bool File::isOnRemovableDrive() const { -#if JUCE_IPHONE +#if JUCE_IOS return false; // xxx is this possible? #else const ScopedAutoReleasePool pool; @@ -109,7 +109,7 @@ bool File::isOnRemovableDrive() const static bool juce_isHiddenFile (const String& path) { -#if JUCE_IPHONE +#if JUCE_IOS return File (path).getFileName().startsWithChar ('.'); #else FSRef ref; @@ -238,7 +238,7 @@ const String File::getVersion() const //============================================================================== const File File::getLinkedTarget() const { -#if JUCE_IPHONE || (defined (MAC_OS_X_VERSION_10_5) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) +#if JUCE_IOS || (defined (MAC_OS_X_VERSION_10_5) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) NSString* dest = [[NSFileManager defaultManager] destinationOfSymbolicLinkAtPath: juceStringToNS (getFullPathName()) error: nil]; #else @@ -257,7 +257,7 @@ bool File::moveToTrash() const if (! exists()) return true; -#if JUCE_IPHONE +#if JUCE_IOS return deleteFile(); //xxx is there a trashcan on the iPhone? #else const ScopedAutoReleasePool pool; @@ -385,7 +385,7 @@ bool juce_launchExecutable (const String& pathAndArguments) bool PlatformUtilities::openDocument (const String& fileName, const String& parameters) { -#if JUCE_IPHONE +#if JUCE_IOS return [[UIApplication sharedApplication] openURL: [NSURL fileURLWithPath: juceStringToNS (fileName)]]; #else const ScopedAutoReleasePool pool; @@ -428,7 +428,7 @@ bool PlatformUtilities::openDocument (const String& fileName, const String& para void File::revealToUser() const { -#if ! JUCE_IPHONE +#if ! JUCE_IOS if (exists()) [[NSWorkspace sharedWorkspace] selectFile: juceStringToNS (getFullPathName()) inFileViewerRootedAtPath: @""]; else if (getParentDirectory().exists()) @@ -437,7 +437,7 @@ void File::revealToUser() const } //============================================================================== -#if ! JUCE_IPHONE +#if ! JUCE_IOS bool PlatformUtilities::makeFSRefFromPath (FSRef* destFSRef, const String& path) { return FSPathMakeRef ((const UInt8*) path.toUTF8(), destFSRef, 0) == noErr; @@ -460,7 +460,7 @@ OSType PlatformUtilities::getTypeOfFile (const String& filename) { const ScopedAutoReleasePool pool; -#if JUCE_IPHONE || (defined (MAC_OS_X_VERSION_10_5) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) +#if JUCE_IOS || (defined (MAC_OS_X_VERSION_10_5) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) NSDictionary* fileDict = [[NSFileManager defaultManager] attributesOfItemAtPath: juceStringToNS (filename) error: nil]; #else NSDictionary* fileDict = [[NSFileManager defaultManager] fileAttributesAtPath: juceStringToNS (filename) traverseLink: NO]; @@ -471,7 +471,7 @@ OSType PlatformUtilities::getTypeOfFile (const String& filename) bool PlatformUtilities::isBundle (const String& filename) { -#if JUCE_IPHONE +#if JUCE_IOS return false; // xxx can't find a sensible way to do this without trying to open the bundle.. #else const ScopedAutoReleasePool pool; diff --git a/src/native/mac/juce_mac_Fonts.mm b/src/native/mac/juce_mac_Fonts.mm index 1f43b7cf74..8afbd7c90b 100644 --- a/src/native/mac/juce_mac_Fonts.mm +++ b/src/native/mac/juce_mac_Fonts.mm @@ -55,7 +55,7 @@ public: bool needsItalicTransform = false; -#if JUCE_IPHONE +#if JUCE_IOS NSString* fontName = juceStringToNS (font.getTypefaceName()); if (font.isItalic() || font.isBold()) @@ -171,7 +171,7 @@ public: ~MacTypeface() { -#if ! JUCE_IPHONE +#if ! JUCE_IOS [nsFont release]; #endif if (fontRef != 0) @@ -289,7 +289,7 @@ public: bool getOutlineForGlyph (int glyphNumber, Path& path) { -#if JUCE_IPHONE +#if JUCE_IOS return false; #else if (nsFont == 0) @@ -343,7 +343,7 @@ public: private: float ascent, unitsToHeightScaleFactor; -#if JUCE_IPHONE +#if JUCE_IOS #else NSFont* nsFont; @@ -495,7 +495,7 @@ const StringArray Font::findAllTypefaceNames() const ScopedAutoReleasePool pool; -#if JUCE_IPHONE +#if JUCE_IOS NSArray* fonts = [UIFont familyNames]; #else NSArray* fonts = [[NSFontManager sharedFontManager] availableFontFamilies]; @@ -510,7 +510,7 @@ const StringArray Font::findAllTypefaceNames() void Font::getPlatformDefaultFontNames (String& defaultSans, String& defaultSerif, String& defaultFixed) { -#if JUCE_IPHONE +#if JUCE_IOS defaultSans = "Helvetica"; defaultSerif = "Times New Roman"; defaultFixed = "Courier New"; diff --git a/src/native/mac/juce_mac_MessageManager.mm b/src/native/mac/juce_mac_MessageManager.mm index 92d3a3f6e3..77c1ddfcd9 100644 --- a/src/native/mac/juce_mac_MessageManager.mm +++ b/src/native/mac/juce_mac_MessageManager.mm @@ -411,14 +411,13 @@ static bool isEventBlockedByModalComps (NSEvent* e) bool MessageManager::runDispatchLoopUntil (int millisecondsToRunFor) { - const ScopedAutoReleasePool pool; jassert (isThisTheMessageThread()); // must only be called by the message thread uint32 endTime = Time::getMillisecondCounter() + millisecondsToRunFor; while (! quitMessagePosted) { - const ScopedAutoReleasePool pool2; + const ScopedAutoReleasePool pool; CFRunLoopRunInMode (kCFRunLoopDefaultMode, 0.001, true); diff --git a/src/native/mac/juce_mac_NativeIncludes.h b/src/native/mac/juce_mac_NativeIncludes.h index e3c8ed80c1..fe21b3f2f2 100644 --- a/src/native/mac/juce_mac_NativeIncludes.h +++ b/src/native/mac/juce_mac_NativeIncludes.h @@ -37,7 +37,7 @@ #define USE_COREGRAPHICS_RENDERING 1 -#if JUCE_IPHONE +#if JUCE_IOS #import #import #import diff --git a/src/native/mac/juce_mac_Network.mm b/src/native/mac/juce_mac_Network.mm index d7b69fbd85..6405933562 100644 --- a/src/native/mac/juce_mac_Network.mm +++ b/src/native/mac/juce_mac_Network.mm @@ -76,7 +76,7 @@ bool PlatformUtilities::launchEmailWithAttachments (const String& targetEmailAdd const String& bodyText, const StringArray& filesToAttach) { -#if JUCE_IPHONE +#if JUCE_IOS //xxx probably need to use MFMailComposeViewController jassertfalse; return false; diff --git a/src/native/mac/juce_mac_OpenGLComponent.mm b/src/native/mac/juce_mac_OpenGLComponent.mm index 3a300665f9..0e8448db83 100644 --- a/src/native/mac/juce_mac_OpenGLComponent.mm +++ b/src/native/mac/juce_mac_OpenGLComponent.mm @@ -373,13 +373,20 @@ public: ~GLESContext() { - makeInactive(); - [context release]; + deleteContext(); + [view removeFromSuperview]; [view release]; freeGLBuffers(); } + void deleteContext() + { + makeInactive(); + [context release]; + context = nil; + } + bool makeActive() const throw() { jassert (context != 0); diff --git a/src/native/mac/juce_mac_Strings.mm b/src/native/mac/juce_mac_Strings.mm index 584a28343c..c910ae4071 100644 --- a/src/native/mac/juce_mac_Strings.mm +++ b/src/native/mac/juce_mac_Strings.mm @@ -79,7 +79,7 @@ CFStringRef PlatformUtilities::juceStringToCFString (const String& s) const String PlatformUtilities::convertToPrecomposedUnicode (const String& s) { -#if JUCE_IPHONE +#if JUCE_IOS const ScopedAutoReleasePool pool; return nsStringToJuce ([juceStringToNS (s) precomposedStringWithCanonicalMapping]); #else @@ -142,7 +142,7 @@ const String PlatformUtilities::convertToPrecomposedUnicode (const String& s) void SystemClipboard::copyTextToClipboard (const String& text) { -#if JUCE_IPHONE +#if JUCE_IOS [[UIPasteboard generalPasteboard] setValue: juceStringToNS (text) forPasteboardType: @"public.text"]; #else @@ -156,7 +156,7 @@ void SystemClipboard::copyTextToClipboard (const String& text) const String SystemClipboard::getTextFromClipboard() { -#if JUCE_IPHONE +#if JUCE_IOS NSString* text = [[UIPasteboard generalPasteboard] valueForPasteboardType: @"public.text"]; #else NSString* text = [[NSPasteboard generalPasteboard] stringForType: NSStringPboardType]; diff --git a/src/native/mac/juce_mac_SystemStats.mm b/src/native/mac/juce_mac_SystemStats.mm index 1805c52909..868d915087 100644 --- a/src/native/mac/juce_mac_SystemStats.mm +++ b/src/native/mac/juce_mac_SystemStats.mm @@ -101,7 +101,7 @@ void SystemStats::initialiseStats() cpuFlags.has3DNow = false; #endif - #if JUCE_IPHONE || (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5) + #if JUCE_IOS || (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5) cpuFlags.numCpus = (int) [[NSProcessInfo processInfo] activeProcessorCount]; #else cpuFlags.numCpus = (int) MPProcessors(); diff --git a/src/native/windows/juce_win32_Messaging.cpp b/src/native/windows/juce_win32_Messaging.cpp index eb16a9ded6..c5068cf976 100644 --- a/src/native/windows/juce_win32_Messaging.cpp +++ b/src/native/windows/juce_win32_Messaging.cpp @@ -157,7 +157,7 @@ bool juce_dispatchNextMessageOnSystemQueue (const bool returnIfNoPendingMessages } else if (m.message == WM_QUIT) { - if (JUCEApplication::getInstance()) + if (JUCEApplication::getInstance() != 0) JUCEApplication::getInstance()->systemRequestedQuit(); } else if (! isEventBlockedByModalComps (m)) diff --git a/src/utilities/juce_PropertiesFile.cpp b/src/utilities/juce_PropertiesFile.cpp index 4f6fa81f5d..2e6a006eac 100644 --- a/src/utilities/juce_PropertiesFile.cpp +++ b/src/utilities/juce_PropertiesFile.cpp @@ -295,7 +295,7 @@ const File PropertiesFile::getDefaultAppSettingsFile (const String& applicationN // mustn't have illegal characters in this name.. jassert (applicationName == File::createLegalFileName (applicationName)); -#if JUCE_MAC || JUCE_IPHONE +#if JUCE_MAC || JUCE_IOS File dir (commonToAllUsers ? "/Library/Preferences" : "~/Library/Preferences");