diff --git a/build/macosx/platform_specific_code/juce_mac_MessageManager.mm b/build/macosx/platform_specific_code/juce_mac_MessageManager.mm index 1853ab9fc2..c2753aca2e 100644 --- a/build/macosx/platform_specific_code/juce_mac_MessageManager.mm +++ b/build/macosx/platform_specific_code/juce_mac_MessageManager.mm @@ -62,9 +62,7 @@ public: if (JUCEApplication::getInstance() != 0) { JUCEApplication::getInstance()->systemRequestedQuit(); - - if (! MessageManager::getInstance()->hasStopMessageBeenSent()) - return NSTerminateCancel; + return NSTerminateCancel; } return NSTerminateNow; diff --git a/build/win32/vc8/JUCE.vcproj b/build/win32/vc8/JUCE.vcproj index 6f6e4a35c5..2dbf114c5d 100644 --- a/build/win32/vc8/JUCE.vcproj +++ b/build/win32/vc8/JUCE.vcproj @@ -1,10 +1,11 @@ - @@ -289,6 +289,8 @@ - diff --git a/extras/audio plugin host/src/juce_AppConfig.h b/extras/audio plugin host/src/juce_AppConfig.h index 9987a3f8b8..721978f1ab 100644 --- a/extras/audio plugin host/src/juce_AppConfig.h +++ b/extras/audio plugin host/src/juce_AppConfig.h @@ -39,6 +39,7 @@ #define JUCE_PLUGINHOST_VST 1 #define JUCE_PLUGINHOST_AU 1 +#define JUCE_SUPPORT_CARBON 1 //#define JUCE_ONLY_BUILD_CORE_LIBRARY 1 //#define JUCE_FORCE_DEBUG 1 //#define JUCE_LOG_ASSERTIONS 1 diff --git a/extras/juce demo/build/win32_vc8/jucedemo.sln b/extras/juce demo/build/win32_vc8/jucedemo.sln index a08814acc5..197f8550c5 100644 --- a/extras/juce demo/build/win32_vc8/jucedemo.sln +++ b/extras/juce demo/build/win32_vc8/jucedemo.sln @@ -2,6 +2,9 @@ Microsoft Visual Studio Solution File, Format Version 9.00 # Visual Studio 2005 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jucedemo", "jucedemo.vcproj", "{050D65C2-17C4-4EE1-ABCE-BEA9DA83D77A}" + ProjectSection(ProjectDependencies) = postProject + {AE232C11-D91C-4CA1-B24E-8B11A52EFF26} = {AE232C11-D91C-4CA1-B24E-8B11A52EFF26} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "JUCE", "..\..\..\..\build\win32\vc8\JUCE.vcproj", "{AE232C11-D91C-4CA1-B24E-8B11A52EFF26}" EndProject diff --git a/juce_Config.h b/juce_Config.h index e1b01552ce..d98e8599e7 100644 --- a/juce_Config.h +++ b/juce_Config.h @@ -185,6 +185,16 @@ #define JUCE_WEB_BROWSER 1 #endif + +//============================================================================= +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + //============================================================================= /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries diff --git a/juce_amalgamated.cpp b/juce_amalgamated.cpp index db2495922f..f75ef7643c 100644 --- a/juce_amalgamated.cpp +++ b/juce_amalgamated.cpp @@ -187,6 +187,14 @@ #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -389,6 +397,14 @@ #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -615,7 +631,7 @@ #pragma warning (disable: 4309 4305) #endif -#if JUCE_MAC && JUCE_SUPPORT_CARBON +#if JUCE_MAC && JUCE_32BIT && JUCE_SUPPORT_CARBON BEGIN_JUCE_NAMESPACE /********* Start of inlined file: juce_mac_CarbonViewWrapperComponent.h *********/ @@ -11775,8 +11791,10 @@ const char* String::toUTF8() const throw() } } -int String::copyToUTF8 (uint8* const buffer) const throw() +int String::copyToUTF8 (uint8* const buffer, const int maxBufferSizeBytes) const throw() { + jassert (maxBufferSizeBytes >= 0); // keep this value positive, or no characters will be copied! + #if JUCE_STRINGS_ARE_UNICODE int num = 0, index = 0; @@ -11808,10 +11826,18 @@ int String::copyToUTF8 (uint8* const buffer) const throw() if (buffer != 0) { - buffer [num++] = (uint8) ((0xff << (7 - numExtraBytes)) | (c >> (numExtraBytes * 6))); + if (num + numExtraBytes >= maxBufferSizeBytes) + { + buffer [num++] = 0; + break; + } + else + { + buffer [num++] = (uint8) ((0xff << (7 - numExtraBytes)) | (c >> (numExtraBytes * 6))); - while (--numExtraBytes >= 0) - buffer [num++] = (uint8) (0x80 | (0x3f & (c >> (numExtraBytes * 6)))); + while (--numExtraBytes >= 0) + buffer [num++] = (uint8) (0x80 | (0x3f & (c >> (numExtraBytes * 6)))); + } } else { @@ -11821,7 +11847,15 @@ int String::copyToUTF8 (uint8* const buffer) const throw() else { if (buffer != 0) + { + if (num + 1 >= maxBufferSizeBytes) + { + buffer [num++] = 0; + break; + } + buffer [num] = (uint8) c; + } ++num; } @@ -11833,10 +11867,10 @@ int String::copyToUTF8 (uint8* const buffer) const throw() return num; #else - const int numBytes = length() + 1; + const int numBytes = jmin (maxBufferSizeBytes, length() + 1); if (buffer != 0) - copyToBuffer ((char*) buffer, numBytes); + copyToBuffer ((char*) buffer, maxBufferSizeBytes); return numBytes; #endif @@ -18048,7 +18082,7 @@ AudioFormatWriter::~AudioFormatWriter() bool AudioFormatWriter::writeFromAudioReader (AudioFormatReader& reader, int64 startSample, - int numSamplesToRead) + int64 numSamplesToRead) { const int bufferSize = 16384; const int maxChans = 128; @@ -18058,9 +18092,12 @@ bool AudioFormatWriter::writeFromAudioReader (AudioFormatReader& reader, for (int i = maxChans; --i >= 0;) buffers[i] = 0; + if (numSamplesToRead < 0) + numSamplesToRead = reader.lengthInSamples; + while (numSamplesToRead > 0) { - const int numToDo = jmin (numSamplesToRead, bufferSize); + const int numToDo = (int) jmin (numSamplesToRead, (int64) bufferSize); for (int i = tempBuffer.getNumChannels(); --i >= 0;) buffers[i] = (int*) tempBuffer.getSampleData (i, 0); @@ -19231,6 +19268,14 @@ END_JUCE_NAMESPACE #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -19702,55 +19747,55 @@ const StringPairArray WavAudioFormat::createBWAVMetadata (const String& descript struct BWAVChunk { - char description [256]; - char originator [32]; - char originatorRef [32]; - char originationDate [10]; - char originationTime [8]; + uint8 description [256]; + uint8 originator [32]; + uint8 originatorRef [32]; + uint8 originationDate [10]; + uint8 originationTime [8]; uint32 timeRefLow; uint32 timeRefHigh; uint16 version; uint8 umid[64]; uint8 reserved[190]; - char codingHistory[1]; + uint8 codingHistory[1]; void copyTo (StringPairArray& values) const { - values.set (WavAudioFormat::bwavDescription, String (description, 256)); - values.set (WavAudioFormat::bwavOriginator, String (originator, 32)); - values.set (WavAudioFormat::bwavOriginatorRef, String (originatorRef, 32)); - values.set (WavAudioFormat::bwavOriginationDate, String (originationDate, 10)); - values.set (WavAudioFormat::bwavOriginationTime, String (originationTime, 8)); + values.set (WavAudioFormat::bwavDescription, String::fromUTF8 (description, 256)); + values.set (WavAudioFormat::bwavOriginator, String::fromUTF8 (originator, 32)); + values.set (WavAudioFormat::bwavOriginatorRef, String::fromUTF8 (originatorRef, 32)); + values.set (WavAudioFormat::bwavOriginationDate, String::fromUTF8 (originationDate, 10)); + values.set (WavAudioFormat::bwavOriginationTime, String::fromUTF8 (originationTime, 8)); const uint32 timeLow = swapIfBigEndian (timeRefLow); const uint32 timeHigh = swapIfBigEndian (timeRefHigh); const int64 time = (((int64)timeHigh) << 32) + timeLow; values.set (WavAudioFormat::bwavTimeReference, String (time)); - values.set (WavAudioFormat::bwavCodingHistory, String (codingHistory)); + values.set (WavAudioFormat::bwavCodingHistory, String::fromUTF8 (codingHistory)); } static MemoryBlock createFrom (const StringPairArray& values) { - const int sizeNeeded = sizeof (BWAVChunk) + values [WavAudioFormat::bwavCodingHistory].length(); + const int sizeNeeded = sizeof (BWAVChunk) + values [WavAudioFormat::bwavCodingHistory].copyToUTF8 (0) - 1; MemoryBlock data ((sizeNeeded + 3) & ~3); data.fillWith (0); BWAVChunk* b = (BWAVChunk*) data.getData(); - // although copyToBuffer may overrun by one byte, that's ok as long as these - // operations get done in the right order - values [WavAudioFormat::bwavDescription].copyToBuffer (b->description, 256); - values [WavAudioFormat::bwavOriginator].copyToBuffer (b->originator, 32); - values [WavAudioFormat::bwavOriginatorRef].copyToBuffer (b->originatorRef, 32); - values [WavAudioFormat::bwavOriginationDate].copyToBuffer (b->originationDate, 10); - values [WavAudioFormat::bwavOriginationTime].copyToBuffer (b->originationTime, 8); + // Allow these calls to overwrite an extra byte at the end, which is fine as long + // as they get called in the right order.. + values [WavAudioFormat::bwavDescription].copyToUTF8 (b->description, 257); + values [WavAudioFormat::bwavOriginator].copyToUTF8 (b->originator, 33); + values [WavAudioFormat::bwavOriginatorRef].copyToUTF8 (b->originatorRef, 33); + values [WavAudioFormat::bwavOriginationDate].copyToUTF8 (b->originationDate, 11); + values [WavAudioFormat::bwavOriginationTime].copyToUTF8 (b->originationTime, 9); const int64 time = values [WavAudioFormat::bwavTimeReference].getLargeIntValue(); b->timeRefLow = swapIfBigEndian ((uint32) (time & 0xffffffff)); b->timeRefHigh = swapIfBigEndian ((uint32) (time >> 32)); - values [WavAudioFormat::bwavCodingHistory].copyToBuffer (b->codingHistory, 256 * 1024); + values [WavAudioFormat::bwavCodingHistory].copyToUTF8 (b->codingHistory); if (b->description[0] != 0 || b->originator[0] != 0 @@ -19785,10 +19830,13 @@ class WavAudioFormatReader : public AudioFormatReader const WavAudioFormatReader& operator= (const WavAudioFormatReader&); public: + int64 bwavChunkStart, bwavSize; WavAudioFormatReader (InputStream* const in) : AudioFormatReader (in, wavFormatName), - dataLength (0) + dataLength (0), + bwavChunkStart (0), + bwavSize (0) { if (input->readInt() == chunkName ("RIFF")) { @@ -19836,6 +19884,9 @@ public: } else if (chunkType == chunkName ("bext")) { + bwavChunkStart = input->getPosition(); + bwavSize = length; + // Broadcast-wav extension chunk.. BWAVChunk* const bwav = (BWAVChunk*) juce_calloc (jmax (length + 1, (int) sizeof (BWAVChunk))); @@ -20364,6 +20415,83 @@ AudioFormatWriter* WavAudioFormat::createWriterFor (OutputStream* out, return 0; } +static bool juce_slowCopyOfWavFileWithNewMetadata (const File& file, const StringPairArray& metadata) +{ + bool ok = false; + WavAudioFormat wav; + + const File dest (file.getNonexistentSibling()); + + OutputStream* outStream = dest.createOutputStream(); + + if (outStream != 0) + { + AudioFormatReader* reader = wav.createReaderFor (file.createInputStream(), true); + + if (reader != 0) + { + AudioFormatWriter* writer = wav.createWriterFor (outStream, reader->sampleRate, + reader->numChannels, reader->bitsPerSample, + metadata, 0); + + if (writer != 0) + { + ok = writer->writeFromAudioReader (*reader, 0, -1); + + outStream = 0; + delete writer; + } + + delete reader; + } + + delete outStream; + } + + if (ok) + ok = dest.moveFileTo (file); + + if (! ok) + dest.deleteFile(); + + return ok; +} + +bool WavAudioFormat::replaceMetadataInFile (const File& wavFile, const StringPairArray& newMetadata) +{ + WavAudioFormatReader* reader = (WavAudioFormatReader*) createReaderFor (wavFile.createInputStream(), true); + + if (reader != 0) + { + const int64 bwavPos = reader->bwavChunkStart; + const int64 bwavSize = reader->bwavSize; + delete reader; + + if (bwavSize > 0) + { + MemoryBlock chunk = BWAVChunk::createFrom (newMetadata); + + if (chunk.getSize() <= bwavSize) + { + // the new one will fit in the space available, so write it directly.. + const int64 oldSize = wavFile.getSize(); + + FileOutputStream* out = wavFile.createOutputStream(); + out->setPosition (bwavPos); + out->write (chunk.getData(), chunk.getSize()); + out->setPosition (oldSize); + delete out; + + jassert (wavFile.getSize() == oldSize); + + return true; + } + } + } + + return juce_slowCopyOfWavFileWithNewMetadata (wavFile, newMetadata); +} + END_JUCE_NAMESPACE /********* End of inlined file: juce_WavAudioFormat.cpp *********/ @@ -27884,6 +28012,14 @@ END_JUCE_NAMESPACE #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -27941,10 +28077,6 @@ END_JUCE_NAMESPACE #include #include -#if JUCE_MAC && JUCE_32BIT - #define JUCE_SUPPORT_CARBON 1 -#endif - #if JUCE_SUPPORT_CARBON #include #include @@ -27952,6 +28084,10 @@ END_JUCE_NAMESPACE BEGIN_JUCE_NAMESPACE +#if JUCE_MAC && JUCE_SUPPORT_CARBON + +#endif + #if JUCE_MAC #if MACOS_10_3_OR_EARLIER @@ -29534,6 +29670,14 @@ END_JUCE_NAMESPACE #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -29619,6 +29763,10 @@ END_JUCE_NAMESPACE BEGIN_JUCE_NAMESPACE +#if JUCE_MAC && JUCE_SUPPORT_CARBON + +#endif + #undef PRAGMA_ALIGN_SUPPORTED #define VST_FORCE_DEPRECATED 0 @@ -51688,6 +51836,9 @@ void TreeView::resized() void TreeView::moveSelectedRow (int delta) { + if (delta == 0) + return; + int rowSelected = 0; TreeViewItem* const firstSelected = getSelectedItem (0); @@ -51696,13 +51847,36 @@ void TreeView::moveSelectedRow (int delta) rowSelected = jlimit (0, getNumRowsInTree() - 1, rowSelected + delta); - TreeViewItem* item = getItemOnRow (rowSelected); - - if (item != 0) + for (;;) { - item->setSelected (true, true); + TreeViewItem* item = getItemOnRow (rowSelected); - scrollToKeepItemVisible (item); + if (item != 0) + { + if (! item->canBeSelected()) + { + // if the row we want to highlight doesn't allow it, try skipping + // to the next item.. + const int nextRowToTry = jlimit (0, getNumRowsInTree() - 1, + rowSelected + (delta < 0 ? -1 : 1)); + + if (rowSelected != nextRowToTry) + { + rowSelected = nextRowToTry; + continue; + } + else + { + break; + } + } + + item->setSelected (true, true); + + scrollToKeepItemVisible (item); + } + + break; } } @@ -52019,6 +52193,9 @@ void TreeViewItem::deselectAllRecursively() void TreeViewItem::setSelected (const bool shouldBeSelected, const bool deselectOtherItemsFirst) { + if (shouldBeSelected && ! canBeSelected()) + return; + if (deselectOtherItemsFirst) getTopLevelItem()->deselectAllRecursively(); @@ -74829,7 +75006,7 @@ PixelARGB* ColourGradient::createLookupTable (int& numEntries) const throw() for (int j = 2; j < colours.size(); j += 2) { - const int numToDo = ((colours.getUnchecked (j) * numEntries) >> 16) - index; + const int numToDo = ((colours.getUnchecked (j) * (numEntries - 1)) >> 16) - index; const PixelARGB pix2 (colours.getUnchecked (j + 1)); for (int i = 0; i < numToDo; ++i) @@ -99589,6 +99766,14 @@ END_JUCE_NAMESPACE #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -106801,6 +106986,14 @@ done1: #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -107147,6 +107340,14 @@ unsigned FLAC__bitmath_silog2_wide(FLAC__int64 v) #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -108838,6 +109039,14 @@ FLAC__bool FLAC__bitreader_read_utf8_uint64(FLAC__BitReader *br, FLAC__uint64 *v #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -110172,6 +110381,14 @@ FLAC__bool FLAC__bitwriter_zero_pad_to_byte_boundary(FLAC__BitWriter *bw) #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -110775,6 +110992,14 @@ void FLAC__cpu_info(FLAC__CPUInfo *info) #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -111102,6 +111327,14 @@ unsigned FLAC__crc16(const FLAC__byte *data, unsigned len) #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -111869,6 +112102,14 @@ void FLAC__fixed_restore_signal(const FLAC__int32 residual[], unsigned data_len, #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -112361,6 +112602,14 @@ FLAC__uint32 FLAC__fixedpoint_log2(FLAC__uint32 x, unsigned fracbits, unsigned p #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -113141,6 +113390,14 @@ FLAC__bool FLAC__format_entropy_coding_method_partitioned_rice_contents_ensure_s #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -114885,6 +115142,14 @@ unsigned FLAC__lpc_compute_best_order(const FLAC__double lpc_error[], unsigned m #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -115570,6 +115835,14 @@ FLAC__bool FLAC__MD5Accumulate(FLAC__MD5Context *ctx, const FLAC__int32 * const #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -116000,6 +116273,14 @@ FLAC__bool FLAC__memory_alloc_aligned_real_array(unsigned elements, FLAC__real * #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -119590,6 +119871,14 @@ FLAC__bool file_eof_callback_(const FLAC__StreamDecoder *decoder, void *client_d #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -124253,6 +124542,14 @@ FILE *get_binary_stdout_(void) #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -124991,6 +125288,14 @@ FLAC__bool add_residual_partitioned_rice_(FLAC__BitWriter *bw, const FLAC__int32 #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -125897,6 +126202,14 @@ END_JUCE_NAMESPACE #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -126861,6 +127174,14 @@ extern int ov_halfrate_p(OggVorbis_File *vf); #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -127834,6 +128155,14 @@ int main(void){ #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -129809,6 +130138,14 @@ int main(void){ #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -131156,6 +131493,14 @@ void _analysis_output(char *base,int i,float *v,int n,int bark,int dB, #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -131595,6 +131940,14 @@ int vorbis_bitrate_flushpacket(vorbis_dsp_state *vd,ogg_packet *op){ #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -132775,6 +133128,14 @@ float *vorbis_window(vorbis_dsp_state *v,int W){ #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -133570,6 +133931,14 @@ int main(){ #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -134130,6 +134499,14 @@ void _ve_envelope_shift(envelope_lookup *e,long shift){ #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -134545,6 +134922,14 @@ vorbis_func_floor floor0_exportbundle={ #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -135796,6 +136181,14 @@ vorbis_func_floor floor1_exportbundle={ #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -136604,6 +136997,14 @@ Carsten Bormann #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -136918,6 +137319,14 @@ void vorbis_lpc_predict(float *coeff,float *prime,int m, #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -137163,6 +137572,14 @@ extern float vorbis_fromdBlook_i(long a); #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -137700,6 +138117,14 @@ void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m, #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -138516,6 +138941,14 @@ int vorbis_lpc_to_lsp(float *lpc,float *lsp,int m){ #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -139538,6 +139971,14 @@ vorbis_func_mapping mapping0_exportbundle={ #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -140268,6 +140709,14 @@ void mdct_forward(mdct_lookup *init, DATA_TYPE *in, DATA_TYPE *out){ #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -142440,6 +142889,14 @@ void hf_reduction(vorbis_info_psy_global *g, #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -142679,6 +143136,14 @@ vorbis_func_mapping *_mapping_P[]={ #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -143753,6 +144218,14 @@ vorbis_func_residue residue2_exportbundle={ #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -144678,6 +145151,14 @@ int main(){ #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -146110,6 +146591,14 @@ void drft_clear(drft_lookup *l){ #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -146466,6 +146955,14 @@ int vorbis_synthesis_halfrate_p(vorbis_info *vi){ #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -185013,6 +185510,14 @@ int vorbis_encode_ctl(vorbis_info *vi,int number,void *arg){ #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -187180,6 +187685,14 @@ int ov_time_seek_page_lap(OggVorbis_File *vf,double pos){ #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -253912,6 +254425,14 @@ END_JUCE_NAMESPACE #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -256104,6 +256625,14 @@ END_JUCE_NAMESPACE #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -257351,6 +257880,14 @@ END_JUCE_NAMESPACE #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -257566,6 +258103,14 @@ END_JUCE_NAMESPACE #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -258353,6 +258898,14 @@ END_JUCE_NAMESPACE #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -258930,6 +259483,14 @@ END_JUCE_NAMESPACE #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -259658,6 +260219,14 @@ END_JUCE_NAMESPACE #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -269094,9 +269663,7 @@ public: if (JUCEApplication::getInstance() != 0) { JUCEApplication::getInstance()->systemRequestedQuit(); - - if (! MessageManager::getInstance()->hasStopMessageBeenSent()) - return NSTerminateCancel; + return NSTerminateCancel; } return NSTerminateNow; diff --git a/juce_amalgamated.h b/juce_amalgamated.h index 6e7f00d31d..8f1acd1c57 100644 --- a/juce_amalgamated.h +++ b/juce_amalgamated.h @@ -221,6 +221,14 @@ #define JUCE_WEB_BROWSER 1 #endif +/** Setting this allows the build to use old Carbon libraries that will be + deprecated in newer versions of OSX. This is handy for some backwards-compatibility + reasons. +*/ +#ifndef JUCE_SUPPORT_CARBON + #define JUCE_SUPPORT_CARBON 1 +#endif + /* These flags let you avoid the direct inclusion of some 3rd-party libs in the codebase - you might need to use this if you're linking to some of these libraries yourself. @@ -2347,8 +2355,13 @@ public: @param destBuffer the place to copy it to; if this is a null pointer, the method just returns the number of bytes required (including the terminating null character). + @param maxBufferSizeBytes the size of the destination buffer, in bytes. If the + string won't fit, it'll put in as many as it can while + still allowing for a terminating null char at the end, + and will return the number of bytes that were actually + used. If this value is < 0, no limit is used. */ - int copyToUTF8 (uint8* const destBuffer) const throw(); + int copyToUTF8 (uint8* const destBuffer, const int maxBufferSizeBytes = 0x7fffffff) const throw(); /** Returns a pointer to a UTF-8 version of this string. @@ -36083,11 +36096,13 @@ public: This will take care of any floating-point conversion that's required to convert between the two formats. It won't deal with sample-rate conversion, though. + If numSamplesToRead < 0, it will write the entire length of the reader. + @returns false if it can't read or write properly during the operation */ bool writeFromAudioReader (AudioFormatReader& reader, int64 startSample, - int numSamplesToRead); + int64 numSamplesToRead); /** Reads some samples from an AudioSource, and writes these to the output. @@ -37229,6 +37244,13 @@ public: const StringPairArray& metadataValues, int qualityOptionIndex); + /** Utility function to replace the metadata in a wav file with a new set of values. + + If possible, this cheats by overwriting just the metadata region of the file, rather + than by copying the whole file again. + */ + bool replaceMetadataInFile (const File& wavFile, const StringPairArray& newMetadata); + juce_UseDebuggingNewOperator }; @@ -43050,6 +43072,11 @@ public: */ virtual int getItemHeight() const { return 20; } + /** You can override this method to return false if you don't want to allow the + user to select this item. + */ + virtual bool canBeSelected() const { return true; } + /** Creates a component that will be used to represent this item. You don't have to implement this method - if it returns 0 then no component diff --git a/src/juce_amalgamated_template.cpp b/src/juce_amalgamated_template.cpp index 9bbe47bc52..ac35c6060f 100644 --- a/src/juce_amalgamated_template.cpp +++ b/src/juce_amalgamated_template.cpp @@ -66,7 +66,7 @@ #pragma warning (disable: 4309 4305) #endif -#if JUCE_MAC && JUCE_SUPPORT_CARBON +#if JUCE_MAC && JUCE_32BIT && JUCE_SUPPORT_CARBON BEGIN_JUCE_NAMESPACE #include "../build/macosx/platform_specific_code/juce_mac_CarbonViewWrapperComponent.h" END_JUCE_NAMESPACE diff --git a/src/juce_appframework/audio/audio_file_formats/juce_AudioFormat.cpp b/src/juce_appframework/audio/audio_file_formats/juce_AudioFormat.cpp index 1e094f2168..13332b63c8 100644 --- a/src/juce_appframework/audio/audio_file_formats/juce_AudioFormat.cpp +++ b/src/juce_appframework/audio/audio_file_formats/juce_AudioFormat.cpp @@ -330,7 +330,7 @@ AudioFormatWriter::~AudioFormatWriter() bool AudioFormatWriter::writeFromAudioReader (AudioFormatReader& reader, int64 startSample, - int numSamplesToRead) + int64 numSamplesToRead) { const int bufferSize = 16384; const int maxChans = 128; @@ -340,9 +340,12 @@ bool AudioFormatWriter::writeFromAudioReader (AudioFormatReader& reader, for (int i = maxChans; --i >= 0;) buffers[i] = 0; + if (numSamplesToRead < 0) + numSamplesToRead = reader.lengthInSamples; + while (numSamplesToRead > 0) { - const int numToDo = jmin (numSamplesToRead, bufferSize); + const int numToDo = (int) jmin (numSamplesToRead, (int64) bufferSize); for (int i = tempBuffer.getNumChannels(); --i >= 0;) buffers[i] = (int*) tempBuffer.getSampleData (i, 0); diff --git a/src/juce_appframework/audio/audio_file_formats/juce_AudioFormatWriter.h b/src/juce_appframework/audio/audio_file_formats/juce_AudioFormatWriter.h index 0ada965fdd..a5fdf156e5 100644 --- a/src/juce_appframework/audio/audio_file_formats/juce_AudioFormatWriter.h +++ b/src/juce_appframework/audio/audio_file_formats/juce_AudioFormatWriter.h @@ -112,11 +112,13 @@ public: This will take care of any floating-point conversion that's required to convert between the two formats. It won't deal with sample-rate conversion, though. + If numSamplesToRead < 0, it will write the entire length of the reader. + @returns false if it can't read or write properly during the operation */ bool writeFromAudioReader (AudioFormatReader& reader, int64 startSample, - int numSamplesToRead); + int64 numSamplesToRead); /** Reads some samples from an AudioSource, and writes these to the output. diff --git a/src/juce_appframework/audio/audio_file_formats/juce_WavAudioFormat.cpp b/src/juce_appframework/audio/audio_file_formats/juce_WavAudioFormat.cpp index 82b5a14539..b4a72efee3 100644 --- a/src/juce_appframework/audio/audio_file_formats/juce_WavAudioFormat.cpp +++ b/src/juce_appframework/audio/audio_file_formats/juce_WavAudioFormat.cpp @@ -36,6 +36,8 @@ BEGIN_JUCE_NAMESPACE #include "juce_WavAudioFormat.h" #include "../../../juce_core/io/streams/juce_BufferedInputStream.h" #include "../../../juce_core/text/juce_LocalisedStrings.h" +#include "../../../juce_core/io/files/juce_FileInputStream.h" +#include "../../../juce_core/io/files/juce_FileOutputStream.h" //============================================================================== @@ -85,55 +87,55 @@ const StringPairArray WavAudioFormat::createBWAVMetadata (const String& descript struct BWAVChunk { - char description [256]; - char originator [32]; - char originatorRef [32]; - char originationDate [10]; - char originationTime [8]; + uint8 description [256]; + uint8 originator [32]; + uint8 originatorRef [32]; + uint8 originationDate [10]; + uint8 originationTime [8]; uint32 timeRefLow; uint32 timeRefHigh; uint16 version; uint8 umid[64]; uint8 reserved[190]; - char codingHistory[1]; + uint8 codingHistory[1]; void copyTo (StringPairArray& values) const { - values.set (WavAudioFormat::bwavDescription, String (description, 256)); - values.set (WavAudioFormat::bwavOriginator, String (originator, 32)); - values.set (WavAudioFormat::bwavOriginatorRef, String (originatorRef, 32)); - values.set (WavAudioFormat::bwavOriginationDate, String (originationDate, 10)); - values.set (WavAudioFormat::bwavOriginationTime, String (originationTime, 8)); + values.set (WavAudioFormat::bwavDescription, String::fromUTF8 (description, 256)); + values.set (WavAudioFormat::bwavOriginator, String::fromUTF8 (originator, 32)); + values.set (WavAudioFormat::bwavOriginatorRef, String::fromUTF8 (originatorRef, 32)); + values.set (WavAudioFormat::bwavOriginationDate, String::fromUTF8 (originationDate, 10)); + values.set (WavAudioFormat::bwavOriginationTime, String::fromUTF8 (originationTime, 8)); const uint32 timeLow = swapIfBigEndian (timeRefLow); const uint32 timeHigh = swapIfBigEndian (timeRefHigh); const int64 time = (((int64)timeHigh) << 32) + timeLow; values.set (WavAudioFormat::bwavTimeReference, String (time)); - values.set (WavAudioFormat::bwavCodingHistory, String (codingHistory)); + values.set (WavAudioFormat::bwavCodingHistory, String::fromUTF8 (codingHistory)); } static MemoryBlock createFrom (const StringPairArray& values) { - const int sizeNeeded = sizeof (BWAVChunk) + values [WavAudioFormat::bwavCodingHistory].length(); + const int sizeNeeded = sizeof (BWAVChunk) + values [WavAudioFormat::bwavCodingHistory].copyToUTF8 (0) - 1; MemoryBlock data ((sizeNeeded + 3) & ~3); data.fillWith (0); BWAVChunk* b = (BWAVChunk*) data.getData(); - // although copyToBuffer may overrun by one byte, that's ok as long as these - // operations get done in the right order - values [WavAudioFormat::bwavDescription].copyToBuffer (b->description, 256); - values [WavAudioFormat::bwavOriginator].copyToBuffer (b->originator, 32); - values [WavAudioFormat::bwavOriginatorRef].copyToBuffer (b->originatorRef, 32); - values [WavAudioFormat::bwavOriginationDate].copyToBuffer (b->originationDate, 10); - values [WavAudioFormat::bwavOriginationTime].copyToBuffer (b->originationTime, 8); + // Allow these calls to overwrite an extra byte at the end, which is fine as long + // as they get called in the right order.. + values [WavAudioFormat::bwavDescription].copyToUTF8 (b->description, 257); + values [WavAudioFormat::bwavOriginator].copyToUTF8 (b->originator, 33); + values [WavAudioFormat::bwavOriginatorRef].copyToUTF8 (b->originatorRef, 33); + values [WavAudioFormat::bwavOriginationDate].copyToUTF8 (b->originationDate, 11); + values [WavAudioFormat::bwavOriginationTime].copyToUTF8 (b->originationTime, 9); const int64 time = values [WavAudioFormat::bwavTimeReference].getLargeIntValue(); b->timeRefLow = swapIfBigEndian ((uint32) (time & 0xffffffff)); b->timeRefHigh = swapIfBigEndian ((uint32) (time >> 32)); - values [WavAudioFormat::bwavCodingHistory].copyToBuffer (b->codingHistory, 256 * 1024); + values [WavAudioFormat::bwavCodingHistory].copyToUTF8 (b->codingHistory); if (b->description[0] != 0 || b->originator[0] != 0 @@ -169,10 +171,14 @@ class WavAudioFormatReader : public AudioFormatReader const WavAudioFormatReader& operator= (const WavAudioFormatReader&); public: + int64 bwavChunkStart, bwavSize; + //============================================================================== WavAudioFormatReader (InputStream* const in) : AudioFormatReader (in, wavFormatName), - dataLength (0) + dataLength (0), + bwavChunkStart (0), + bwavSize (0) { if (input->readInt() == chunkName ("RIFF")) { @@ -220,6 +226,9 @@ public: } else if (chunkType == chunkName ("bext")) { + bwavChunkStart = input->getPosition(); + bwavSize = length; + // Broadcast-wav extension chunk.. BWAVChunk* const bwav = (BWAVChunk*) juce_calloc (jmax (length + 1, (int) sizeof (BWAVChunk))); @@ -752,4 +761,82 @@ AudioFormatWriter* WavAudioFormat::createWriterFor (OutputStream* out, return 0; } +static bool juce_slowCopyOfWavFileWithNewMetadata (const File& file, const StringPairArray& metadata) +{ + bool ok = false; + WavAudioFormat wav; + + const File dest (file.getNonexistentSibling()); + + OutputStream* outStream = dest.createOutputStream(); + + if (outStream != 0) + { + AudioFormatReader* reader = wav.createReaderFor (file.createInputStream(), true); + + if (reader != 0) + { + AudioFormatWriter* writer = wav.createWriterFor (outStream, reader->sampleRate, + reader->numChannels, reader->bitsPerSample, + metadata, 0); + + if (writer != 0) + { + ok = writer->writeFromAudioReader (*reader, 0, -1); + + outStream = 0; + delete writer; + } + + delete reader; + } + + delete outStream; + } + + if (ok) + ok = dest.moveFileTo (file); + + if (! ok) + dest.deleteFile(); + + return ok; +} + +bool WavAudioFormat::replaceMetadataInFile (const File& wavFile, const StringPairArray& newMetadata) +{ + WavAudioFormatReader* reader = (WavAudioFormatReader*) createReaderFor (wavFile.createInputStream(), true); + + if (reader != 0) + { + const int64 bwavPos = reader->bwavChunkStart; + const int64 bwavSize = reader->bwavSize; + delete reader; + + if (bwavSize > 0) + { + MemoryBlock chunk = BWAVChunk::createFrom (newMetadata); + + if (chunk.getSize() <= bwavSize) + { + // the new one will fit in the space available, so write it directly.. + const int64 oldSize = wavFile.getSize(); + + FileOutputStream* out = wavFile.createOutputStream(); + out->setPosition (bwavPos); + out->write (chunk.getData(), chunk.getSize()); + out->setPosition (oldSize); + delete out; + + jassert (wavFile.getSize() == oldSize); + + return true; + } + } + } + + return juce_slowCopyOfWavFileWithNewMetadata (wavFile, newMetadata); +} + + END_JUCE_NAMESPACE diff --git a/src/juce_appframework/audio/audio_file_formats/juce_WavAudioFormat.h b/src/juce_appframework/audio/audio_file_formats/juce_WavAudioFormat.h index 43322e8325..df089e09c7 100644 --- a/src/juce_appframework/audio/audio_file_formats/juce_WavAudioFormat.h +++ b/src/juce_appframework/audio/audio_file_formats/juce_WavAudioFormat.h @@ -141,6 +141,13 @@ public: const StringPairArray& metadataValues, int qualityOptionIndex); + //============================================================================== + /** Utility function to replace the metadata in a wav file with a new set of values. + + If possible, this cheats by overwriting just the metadata region of the file, rather + than by copying the whole file again. + */ + bool replaceMetadataInFile (const File& wavFile, const StringPairArray& newMetadata); //============================================================================== juce_UseDebuggingNewOperator diff --git a/src/juce_appframework/audio/plugins/formats/juce_AudioUnitPluginFormat.mm b/src/juce_appframework/audio/plugins/formats/juce_AudioUnitPluginFormat.mm index 17c4398e84..1f4f572602 100644 --- a/src/juce_appframework/audio/plugins/formats/juce_AudioUnitPluginFormat.mm +++ b/src/juce_appframework/audio/plugins/formats/juce_AudioUnitPluginFormat.mm @@ -37,10 +37,6 @@ #include #include -#if JUCE_MAC && JUCE_32BIT - #define JUCE_SUPPORT_CARBON 1 -#endif - #if JUCE_SUPPORT_CARBON #include #include @@ -57,6 +53,9 @@ BEGIN_JUCE_NAMESPACE #include "../../../../juce_core/misc/juce_PlatformUtilities.h" #include "../../../../juce_appframework/gui/components/layout/juce_ComponentMovementWatcher.h" #include "../../../../juce_appframework/gui/components/special/juce_NSViewComponent.h" +#if JUCE_MAC && JUCE_SUPPORT_CARBON + #include "../../../../../build/macosx/platform_specific_code/juce_mac_CarbonViewWrapperComponent.h" +#endif #if JUCE_MAC diff --git a/src/juce_appframework/audio/plugins/formats/juce_VSTPluginFormat.cpp b/src/juce_appframework/audio/plugins/formats/juce_VSTPluginFormat.cpp index 71f356e4bd..231cd2503e 100644 --- a/src/juce_appframework/audio/plugins/formats/juce_VSTPluginFormat.cpp +++ b/src/juce_appframework/audio/plugins/formats/juce_VSTPluginFormat.cpp @@ -79,8 +79,10 @@ BEGIN_JUCE_NAMESPACE #include "../../../gui/components/layout/juce_ComponentMovementWatcher.h" #include "../../../application/juce_Application.h" #include "../../../../juce_core/misc/juce_PlatformUtilities.h" -#include "../../../../../build/macosx/platform_specific_code/juce_mac_CarbonViewWrapperComponent.h" +#if JUCE_MAC && JUCE_SUPPORT_CARBON + #include "../../../../../build/macosx/platform_specific_code/juce_mac_CarbonViewWrapperComponent.h" +#endif //============================================================================== #undef PRAGMA_ALIGN_SUPPORTED diff --git a/src/juce_appframework/gui/components/controls/juce_TreeView.cpp b/src/juce_appframework/gui/components/controls/juce_TreeView.cpp index b95966d3bd..bca320722f 100644 --- a/src/juce_appframework/gui/components/controls/juce_TreeView.cpp +++ b/src/juce_appframework/gui/components/controls/juce_TreeView.cpp @@ -572,6 +572,9 @@ void TreeView::resized() void TreeView::moveSelectedRow (int delta) { + if (delta == 0) + return; + int rowSelected = 0; TreeViewItem* const firstSelected = getSelectedItem (0); @@ -580,13 +583,36 @@ void TreeView::moveSelectedRow (int delta) rowSelected = jlimit (0, getNumRowsInTree() - 1, rowSelected + delta); - TreeViewItem* item = getItemOnRow (rowSelected); - - if (item != 0) + for (;;) { - item->setSelected (true, true); + TreeViewItem* item = getItemOnRow (rowSelected); + + if (item != 0) + { + if (! item->canBeSelected()) + { + // if the row we want to highlight doesn't allow it, try skipping + // to the next item.. + const int nextRowToTry = jlimit (0, getNumRowsInTree() - 1, + rowSelected + (delta < 0 ? -1 : 1)); - scrollToKeepItemVisible (item); + if (rowSelected != nextRowToTry) + { + rowSelected = nextRowToTry; + continue; + } + else + { + break; + } + } + + item->setSelected (true, true); + + scrollToKeepItemVisible (item); + } + + break; } } @@ -906,6 +932,9 @@ void TreeViewItem::deselectAllRecursively() void TreeViewItem::setSelected (const bool shouldBeSelected, const bool deselectOtherItemsFirst) { + if (shouldBeSelected && ! canBeSelected()) + return; + if (deselectOtherItemsFirst) getTopLevelItem()->deselectAllRecursively(); diff --git a/src/juce_appframework/gui/components/controls/juce_TreeView.h b/src/juce_appframework/gui/components/controls/juce_TreeView.h index ed0451d678..2d6a162c34 100644 --- a/src/juce_appframework/gui/components/controls/juce_TreeView.h +++ b/src/juce_appframework/gui/components/controls/juce_TreeView.h @@ -238,6 +238,11 @@ public: */ virtual int getItemHeight() const { return 20; } + /** You can override this method to return false if you don't want to allow the + user to select this item. + */ + virtual bool canBeSelected() const { return true; } + /** Creates a component that will be used to represent this item. You don't have to implement this method - if it returns 0 then no component diff --git a/src/juce_appframework/gui/graphics/colour/juce_ColourGradient.cpp b/src/juce_appframework/gui/graphics/colour/juce_ColourGradient.cpp index bada7812e9..c315361f75 100644 --- a/src/juce_appframework/gui/graphics/colour/juce_ColourGradient.cpp +++ b/src/juce_appframework/gui/graphics/colour/juce_ColourGradient.cpp @@ -150,7 +150,7 @@ PixelARGB* ColourGradient::createLookupTable (int& numEntries) const throw() for (int j = 2; j < colours.size(); j += 2) { - const int numToDo = ((colours.getUnchecked (j) * numEntries) >> 16) - index; + const int numToDo = ((colours.getUnchecked (j) * (numEntries - 1)) >> 16) - index; const PixelARGB pix2 (colours.getUnchecked (j + 1)); for (int i = 0; i < numToDo; ++i) diff --git a/src/juce_core/text/juce_String.cpp b/src/juce_core/text/juce_String.cpp index e456495bbd..a6f435ae6f 100644 --- a/src/juce_core/text/juce_String.cpp +++ b/src/juce_core/text/juce_String.cpp @@ -2086,8 +2086,10 @@ const char* String::toUTF8() const throw() } } -int String::copyToUTF8 (uint8* const buffer) const throw() +int String::copyToUTF8 (uint8* const buffer, const int maxBufferSizeBytes) const throw() { + jassert (maxBufferSizeBytes >= 0); // keep this value positive, or no characters will be copied! + #if JUCE_STRINGS_ARE_UNICODE int num = 0, index = 0; @@ -2119,10 +2121,18 @@ int String::copyToUTF8 (uint8* const buffer) const throw() if (buffer != 0) { - buffer [num++] = (uint8) ((0xff << (7 - numExtraBytes)) | (c >> (numExtraBytes * 6))); + if (num + numExtraBytes >= maxBufferSizeBytes) + { + buffer [num++] = 0; + break; + } + else + { + buffer [num++] = (uint8) ((0xff << (7 - numExtraBytes)) | (c >> (numExtraBytes * 6))); - while (--numExtraBytes >= 0) - buffer [num++] = (uint8) (0x80 | (0x3f & (c >> (numExtraBytes * 6)))); + while (--numExtraBytes >= 0) + buffer [num++] = (uint8) (0x80 | (0x3f & (c >> (numExtraBytes * 6)))); + } } else { @@ -2132,7 +2142,15 @@ int String::copyToUTF8 (uint8* const buffer) const throw() else { if (buffer != 0) + { + if (num + 1 >= maxBufferSizeBytes) + { + buffer [num++] = 0; + break; + } + buffer [num] = (uint8) c; + } ++num; } @@ -2144,10 +2162,10 @@ int String::copyToUTF8 (uint8* const buffer) const throw() return num; #else - const int numBytes = length() + 1; + const int numBytes = jmin (maxBufferSizeBytes, length() + 1); if (buffer != 0) - copyToBuffer ((char*) buffer, numBytes); + copyToBuffer ((char*) buffer, maxBufferSizeBytes); return numBytes; #endif diff --git a/src/juce_core/text/juce_String.h b/src/juce_core/text/juce_String.h index db2f3f6a9f..646b32ab89 100644 --- a/src/juce_core/text/juce_String.h +++ b/src/juce_core/text/juce_String.h @@ -1003,8 +1003,13 @@ public: @param destBuffer the place to copy it to; if this is a null pointer, the method just returns the number of bytes required (including the terminating null character). + @param maxBufferSizeBytes the size of the destination buffer, in bytes. If the + string won't fit, it'll put in as many as it can while + still allowing for a terminating null char at the end, + and will return the number of bytes that were actually + used. If this value is < 0, no limit is used. */ - int copyToUTF8 (uint8* const destBuffer) const throw(); + int copyToUTF8 (uint8* const destBuffer, const int maxBufferSizeBytes = 0x7fffffff) const throw(); /** Returns a pointer to a UTF-8 version of this string.