diff --git a/extras/audio plugins/wrapper/RTAS/juce_RTAS_DigiCode_Header.h b/extras/audio plugins/wrapper/RTAS/juce_RTAS_DigiCode_Header.h index 809bea67ab..ea97b43214 100644 --- a/extras/audio plugins/wrapper/RTAS/juce_RTAS_DigiCode_Header.h +++ b/extras/audio plugins/wrapper/RTAS/juce_RTAS_DigiCode_Header.h @@ -47,7 +47,7 @@ // the Digidesign projects all use a struct alignment of 2.. #pragma pack (2) - #pragma warning (disable: 4267 4996 4311 4312 4103) + #pragma warning (disable: 4267 4996 4311 4312 4103 4121 4100 4127 4189 4245 4389 4512 4701) #include diff --git a/extras/audio plugins/wrapper/RTAS/juce_RTAS_Wrapper.cpp b/extras/audio plugins/wrapper/RTAS/juce_RTAS_Wrapper.cpp index dec9bf1ef5..363850240d 100644 --- a/extras/audio plugins/wrapper/RTAS/juce_RTAS_Wrapper.cpp +++ b/extras/audio plugins/wrapper/RTAS/juce_RTAS_Wrapper.cpp @@ -92,7 +92,7 @@ #ifdef _MSC_VER #pragma pack (pop) - #if JUCE_DEBUG + #if JUCE_DEBUGxxx // (the debug lib in the 8.0 SDK fails to link, so we'll stick to the release one...) #define PT_LIB_PATH JucePlugin_WinBag_path "\\Debug\\lib\\" #else #define PT_LIB_PATH JucePlugin_WinBag_path "\\Release\\lib\\" @@ -102,7 +102,6 @@ #pragma comment(lib, PT_LIB_PATH "DigiExt.lib") #pragma comment(lib, PT_LIB_PATH "DSI.lib") #pragma comment(lib, PT_LIB_PATH "PluginLib.lib") - #endif #undef Component diff --git a/juce_amalgamated.cpp b/juce_amalgamated.cpp index 54e0af5387..fb4eecc9ed 100644 --- a/juce_amalgamated.cpp +++ b/juce_amalgamated.cpp @@ -548,7 +548,7 @@ #undef PACKED #if JUCE_ASIO && JUCE_BUILD_NATIVE -/* + /* This is very frustrating - we only need to use a handful of definitions from a couple of the header files in Steinberg's ASIO SDK, and it'd be easy to copy about 30 lines of code into this cpp file to create a fully stand-alone ASIO @@ -562,16 +562,11 @@ 1) Agree to Steinberg's licensing terms and download the ASIO SDK (see www.steinberg.net/Steinberg/Developers.asp). - 2) Rebuild the whole of JUCE, setting the global definition JUCE_ASIO (you - can un-comment the "#define JUCE_ASIO" line in juce_Config.h - if you prefer). Make sure that your header search path will find the - iasiodrv.h file that comes with the SDK. (Only about 2-3 of the SDK header - files are actually needed - so to simplify things, you could just copy - these into your JUCE directory). + 2) Enable this code with a global definition #define JUCE_ASIO 1. - If you're compiling and you get an error here because you don't have the - ASIO SDK installed, you can disable ASIO support by commenting-out the - "#define JUCE_ASIO" line in juce_Config.h, and rebuild your Juce library. + 3) Make sure that your header search path contains the iasiodrv.h file that + comes with the SDK. (Only about a handful of the SDK header files are actually + needed - so to simplify things, you could just copy these into your JUCE directory). */ #include #endif @@ -2095,16 +2090,12 @@ const String Time::getTimeZone() const throw() _tzset(); #ifdef USE_NEW_SECURE_TIME_FNS + for (int i = 0; i < 2; ++i) { - char name [128]; + char name[128] = { 0 }; size_t length; - - for (int i = 0; i < 2; ++i) - { - zeromem (name, sizeof (name)); - _get_tzname (&length, name, 127, i); - zone[i] = name; - } + _get_tzname (&length, name, 127, i); + zone[i] = name; } #else const char** const zonePtr = (const char**) _tzname; @@ -2801,7 +2792,7 @@ void BigInteger::clear() } else { - zeromem (values, sizeof (uint32) * (numValues + 1)); + values.clear (numValues + 1); } highestBit = -1; @@ -6469,9 +6460,7 @@ void MD5::ProcessContext::finish (void* const result) const int paddingLength = (index < 56) ? (56 - index) : (120 - index); - uint8 paddingBuffer [64]; - zeromem (paddingBuffer, paddingLength); - paddingBuffer [0] = 0x80; + uint8 paddingBuffer[64] = { 0x80 }; // first byte is 0x80, remaining bytes are zero. processBlock (paddingBuffer, paddingLength); processBlock (encodedLength, 8); @@ -7833,7 +7822,7 @@ bool File::isAChildOf (const File& potentialParent) const bool File::isAbsolutePath (const String& path) { - return path.startsWithChar ('/') || path.startsWithChar ('\\') + return path.startsWithChar (separator) #if JUCE_WINDOWS || (path.isNotEmpty() && path[1] == ':'); #else @@ -10505,7 +10494,8 @@ int MemoryOutputStream::writeFromInputStream (InputStream& source, int64 maxNumB const String MemoryOutputStream::toUTF8() const { - return String::fromUTF8 (static_cast (getData()), (int) getDataSize()); + const char* const d = static_cast (getData()); + return String (CharPointer_UTF8 (d), CharPointer_UTF8 (d + getDataSize())); } const String MemoryOutputStream::toString() const @@ -11074,8 +11064,7 @@ int ZipFile::findEndOfZipEntryTable (InputStream& input, int& numEntries) int64 pos = in.getPosition(); const int64 lowestPos = jmax ((int64) 0, pos - 1024); - char buffer [32]; - zeromem (buffer, sizeof (buffer)); + char buffer [32] = { 0 }; while (pos > lowestPos) { @@ -13482,13 +13471,17 @@ const String String::createStringFromData (const void* const data_, const int si } else { + const uint8* start = data; + const uint8* end = data + size; + if (size >= 3 && data[0] == (uint8) CharPointer_UTF8::byteOrderMark1 && data[1] == (uint8) CharPointer_UTF8::byteOrderMark2 && data[2] == (uint8) CharPointer_UTF8::byteOrderMark3) - return String::fromUTF8 ((const char*) data + 3, size - 3); + start += 3; - return String::fromUTF8 ((const char*) data, size); + return String (CharPointer_UTF8 ((const char*) start), + CharPointer_UTF8 ((const char*) end)); } } @@ -13595,18 +13588,13 @@ int String::getNumBytesAsUTF8() const throw() const String String::fromUTF8 (const char* const buffer, int bufferSizeBytes) { - if (buffer == 0) - return empty; - - CharPointer_UTF8 b (buffer); - - if (bufferSizeBytes < 0) - return String (b); - - const size_t numChars = b.lengthUpTo (CharPointer_UTF8 (buffer + bufferSizeBytes)); - - if (numChars > 0) - return String (b, numChars); + if (buffer != 0) + { + if (bufferSizeBytes < 0) + return String (CharPointer_UTF8 (buffer)); + else if (bufferSizeBytes > 0) + return String (CharPointer_UTF8 (buffer), CharPointer_UTF8 (buffer + bufferSizeBytes)); + } return String::empty; } @@ -18177,6 +18165,9 @@ void Value::ValueSource::sendChangeMessage (const bool synchronous) { if (synchronous) { + // (hold a local reference to this object in case it's freed during the callbacks) + const ReferenceCountedObjectPtr localRef (this); + for (int i = valuesWithListeners.size(); --i >= 0;) { Value* const v = valuesWithListeners[i]; @@ -20675,8 +20666,7 @@ private: output->writeIntBigEndian (lengthInSamples); output->writeShortBigEndian ((short) bitsPerSample); - uint8 sampleRateBytes[10]; - zeromem (sampleRateBytes, 10); + uint8 sampleRateBytes[10] = { 0 }; if (sampleRate <= 1) { @@ -25112,7 +25102,7 @@ void ResamplingAudioSource::setFilterCoefficients (double c1, double c2, double void ResamplingAudioSource::resetFilters() { - zeromem (filterStates, sizeof (FilterState) * numChannels); + filterStates.clear (numChannels); } void ResamplingAudioSource::applyFilter (float* samples, int num, FilterState& fs) @@ -27105,7 +27095,7 @@ void AudioSampleBuffer::setSize (const int newNumChannels, if (avoidReallocating && allocatedBytes >= newTotalBytes) { if (clearExtraSpace) - zeromem (allocatedData, newTotalBytes); + allocatedData.clear (newTotalBytes); } else { @@ -60778,18 +60768,18 @@ const String KeyPress::getTextDescription() const if (mods.isShiftDown()) desc << "shift + "; -#if JUCE_MAC - // only do this on the mac, because on Windows ctrl and command are the same, - // and this would get confusing - if (mods.isCommandDown()) - desc << "command + "; - + #if JUCE_MAC if (mods.isAltDown()) desc << "option + "; -#else + + // only do this on the mac, because on Windows ctrl and command are the same, + // and this would get confusing + if (mods.isCommandDown()) + desc << "command + "; + #else if (mods.isAltDown()) desc << "alt + "; -#endif + #endif for (int i = 0; i < numElementsInArray (KeyPressHelpers::translations); ++i) if (keyCode == KeyPressHelpers::translations[i].code) @@ -60822,6 +60812,17 @@ const String KeyPress::getTextDescription() const return desc; } +const String KeyPress::getTextDescriptionWithIcons() const +{ + #if JUCE_MAC + return getTextDescription().replace ("shift + ", String::charToString (0x21e7)) + .replace ("command + ", String::charToString (0x2318)) + .replace ("option + ", String::charToString (0x2325)); + #else + return getTextDescription(); + #endif +} + END_JUCE_NAMESPACE /*** End of inlined file: juce_KeyPress.cpp ***/ @@ -69234,7 +69235,7 @@ public: for (int i = 0; i < keyPresses.size(); ++i) { - const String key (keyPresses.getReference(i).getTextDescription()); + const String key (keyPresses.getReference(i).getTextDescriptionWithIcons()); if (shortcutKey.isNotEmpty()) shortcutKey << ", "; @@ -87618,10 +87619,9 @@ const Rectangle DrawableImage::getDrawableBounds() const return image.getBounds().toFloat(); } -bool DrawableImage::hitTest (int x, int y) const +bool DrawableImage::hitTest (int x, int y) { - return (! image.isNull()) - && image.getPixelAt (x, y).getAlpha() >= 127; + return image.isValid() && image.getPixelAt (x, y).getAlpha() >= 127; } Drawable* DrawableImage::createCopy() const @@ -89810,8 +89810,7 @@ private: { if (s [index] == '#') { - uint32 hex [6]; - zeromem (hex, sizeof (hex)); + uint32 hex[6] = { 0 }; int numChars = 0; for (int i = 6; --i >= 0;) @@ -242250,8 +242249,7 @@ const String SystemStats::getCpuVendor() static void juce_getCpuVendor (char* const v) { - int vendor[4]; - zeromem (vendor, 16); + int vendor[4] = { 0 }; #ifdef JUCE_64BIT #else @@ -250756,8 +250754,7 @@ private: if (availableExtensions.contains ("WGL_ARB_multisample")) attributes[numAttributes++] = WGL_SAMPLES_ARB; - int values[32]; - zeromem (values, sizeof (values)); + int values[32] = { 0 }; if (wglGetPixelFormatAttribivARB (dc, pixelFormatIndex, 0, numAttributes, attributes, values)) { @@ -251151,8 +251148,7 @@ void findCDDevices (Array& list) if (h != INVALID_HANDLE_VALUE) { - char buffer[100]; - zeromem (buffer, sizeof (buffer)); + char buffer[100] = { 0 }; SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER p; zerostruct (p); @@ -252497,7 +252493,7 @@ bool AudioCDBurner::addAudioTrack (AudioSource* audioSource, int numSamples) source->getNextAudioBlock (info); } - zeromem (buffer, bytesPerBlock); + buffer.clear (bytesPerBlock); typedef AudioData::Pointer CDSampleFormat; @@ -253091,7 +253087,7 @@ namespace ASIODebugging } class ASIOAudioIODevice; -static ASIOAudioIODevice* volatile currentASIODev[3] = { 0, 0, 0 }; +static ASIOAudioIODevice* volatile currentASIODev[3] = { 0 }; static const int maxASIOChannels = 160; @@ -253261,9 +253257,8 @@ public: if (sampleRate == 0) sampleRate = 44100; - long numSources = 32; - ASIOClockSource clocks[32]; - zeromem (clocks, sizeof (clocks)); + ASIOClockSource clocks[32] = { 0 }; + long numSources = numElementsInArray (clocks); asioObject->getClockSources (clocks, &numSources); bool isSourceSet = false; @@ -253857,8 +253852,7 @@ private: { if (asioObject != 0) { - char buffer [256]; - zeromem (buffer, sizeof (buffer)); + char buffer [256] = { 0 }; if (! asioObject->init (windowHandle)) { @@ -254666,10 +254660,6 @@ public: CoInitialize (0); } - ~ASIOAudioIODeviceType() - { - } - void scanForDevices() { hasScanned = true; @@ -254680,21 +254670,12 @@ public: HKEY hk = 0; int index = 0; - if (RegOpenKeyA (HKEY_LOCAL_MACHINE, "software\\asio", &hk) == ERROR_SUCCESS) + if (RegOpenKey (HKEY_LOCAL_MACHINE, _T("software\\asio"), &hk) == ERROR_SUCCESS) { - for (;;) - { - char name [256]; + TCHAR name [256]; - if (RegEnumKeyA (hk, index++, name, 256) == ERROR_SUCCESS) - { - addDriverInfo (name, hk); - } - else - { - break; - } - } + while (RegEnumKey (hk, index++, name, numElementsInArray (name)) == ERROR_SUCCESS) + addDriverInfo (name, hk); RegCloseKey (hk); } @@ -254779,39 +254760,31 @@ private: if (RegOpenKey (HKEY_CLASSES_ROOT, _T("clsid"), &hk) == ERROR_SUCCESS) { int index = 0; + TCHAR name [512]; - for (;;) + while (RegEnumKey (hk, index++, name, numElementsInArray (name)) == ERROR_SUCCESS) { - WCHAR buf [512]; - - if (RegEnumKey (hk, index++, buf, 512) == ERROR_SUCCESS) + if (classId.equalsIgnoreCase (name)) { - if (classId.equalsIgnoreCase (buf)) - { - HKEY subKey, pathKey; + HKEY subKey, pathKey; - if (RegOpenKeyEx (hk, buf, 0, KEY_READ, &subKey) == ERROR_SUCCESS) + if (RegOpenKeyEx (hk, name, 0, KEY_READ, &subKey) == ERROR_SUCCESS) + { + if (RegOpenKeyEx (subKey, _T("InprocServer32"), 0, KEY_READ, &pathKey) == ERROR_SUCCESS) { - if (RegOpenKeyEx (subKey, _T("InprocServer32"), 0, KEY_READ, &pathKey) == ERROR_SUCCESS) - { - WCHAR pathName [1024]; - DWORD dtype = REG_SZ; - DWORD dsize = sizeof (pathName); - - if (RegQueryValueEx (pathKey, 0, 0, &dtype, (LPBYTE) pathName, &dsize) == ERROR_SUCCESS) - ok = File (pathName).exists(); + TCHAR pathName [1024]; + DWORD dtype = REG_SZ; + DWORD dsize = sizeof (pathName); - RegCloseKey (pathKey); - } + if (RegQueryValueEx (pathKey, 0, 0, &dtype, (LPBYTE) pathName, &dsize) == ERROR_SUCCESS) + ok = File (pathName).exists(); - RegCloseKey (subKey); + RegCloseKey (pathKey); } - break; + RegCloseKey (subKey); } - } - else - { + break; } } @@ -254828,7 +254801,7 @@ private: if (RegOpenKeyEx (hk, keyName.toUTF16(), 0, KEY_READ, &subKey) == ERROR_SUCCESS) { - WCHAR buf [256]; + TCHAR buf [256]; zerostruct (buf); DWORD dtype = REG_SZ; DWORD dsize = sizeof (buf); @@ -258374,7 +258347,7 @@ const File File::getCurrentWorkingDirectory() bufferSize += 1024; } - return File (String::fromUTF8 (cwd)); + return File (CharPointer_UTF8 (cwd)); } bool File::setAsCurrentWorkingDirectory() const @@ -258645,7 +258618,7 @@ const File juce_getExecutableFile() #else Dl_info exeInfo; dladdr ((void*) juce_getExecutableFile, &exeInfo); // (can't be a const void* on android) - return File::getCurrentWorkingDirectory().getChildFile (String::fromUTF8 (exeInfo.dli_fname)); + return File::getCurrentWorkingDirectory().getChildFile (CharPointer_UTF8 (exeInfo.dli_fname)); #endif } @@ -259099,7 +259072,7 @@ const File File::getSpecialLocation (const SpecialLocationType type) homeDir = pw->pw_dir; } - return File (String::fromUTF8 (homeDir)); + return File (CharPointer_UTF8 (homeDir)); } case userDocumentsDirectory: @@ -259134,7 +259107,7 @@ const File File::getSpecialLocation (const SpecialLocationType type) case invokedExecutableFile: if (juce_Argv0 != 0) - return File (String::fromUTF8 (juce_Argv0)); + return File (CharPointer_UTF8 (juce_Argv0)); // deliberate fall-through... case currentExecutableFile: @@ -259206,7 +259179,7 @@ public: if (fnmatch (wildcardUTF8, de->d_name, FNM_CASEFOLD) == 0) { - filenameFound = String::fromUTF8 (de->d_name); + filenameFound = CharPointer_UTF8 (de->d_name); updateStatInfoForFile (parentDir + filenameFound, isDir, fileSize, modTime, creationTime, isReadOnly); @@ -259783,7 +259756,7 @@ private: numConsecutiveLFs = 0; } - const String header (String::fromUTF8 ((const char*) buffer.getData())); + const String header (CharPointer_UTF8 ((const char*) buffer.getData())); if (header.startsWithIgnoreCase ("HTTP/")) return header.trimEnd(); @@ -259991,7 +259964,7 @@ const String SystemStats::getLogonName() user = pw->pw_name; } - return String::fromUTF8 (user); + return CharPointer_UTF8 (user); } const String SystemStats::getFullUserName() @@ -260896,7 +260869,7 @@ public: } StringArray fontDirs; - fontDirs.addTokens (String::fromUTF8 (getenv ("JUCE_FONT_PATH")), ";,", String::empty); + fontDirs.addTokens (CharPointer_UTF8 (getenv ("JUCE_FONT_PATH")), ";,", String::empty); fontDirs.removeEmptyStrings (true); if (fontDirs.size() == 0) @@ -261838,12 +261811,9 @@ public: if (! usingXShm) #endif { - imageDataAllocated.malloc (lineStride * h); + imageDataAllocated.allocate (lineStride * h, format_ == Image::ARGB && clearImage); imageData = imageDataAllocated; - if (format_ == Image::ARGB && clearImage) - zeromem (imageData, h * lineStride); - xImage = (XImage*) juce_calloc (sizeof (XImage)); xImage->width = w; @@ -267097,7 +267067,7 @@ namespace { const String nsStringToJuce (NSString* s) { - return String::fromUTF8 ([s UTF8String]); + return CharPointer_UTF8 ([s UTF8String]); } NSString* juceStringToNS (const String& s) @@ -268271,7 +268241,7 @@ const File File::getCurrentWorkingDirectory() bufferSize += 1024; } - return File (String::fromUTF8 (cwd)); + return File (CharPointer_UTF8 (cwd)); } bool File::setAsCurrentWorkingDirectory() const @@ -268542,7 +268512,7 @@ const File juce_getExecutableFile() #else Dl_info exeInfo; dladdr ((void*) juce_getExecutableFile, &exeInfo); // (can't be a const void* on android) - return File::getCurrentWorkingDirectory().getChildFile (String::fromUTF8 (exeInfo.dli_fname)); + return File::getCurrentWorkingDirectory().getChildFile (CharPointer_UTF8 (exeInfo.dli_fname)); #endif } @@ -269058,7 +269028,7 @@ const File File::getSpecialLocation (const SpecialLocationType type) case invokedExecutableFile: if (juce_Argv0 != 0) - return File (String::fromUTF8 (juce_Argv0)); + return File (CharPointer_UTF8 (juce_Argv0)); // deliberate fall-through... case currentExecutableFile: @@ -269288,11 +269258,10 @@ bool PlatformUtilities::makeFSRefFromPath (FSRef* destFSRef, const String& path) const String PlatformUtilities::makePathFromFSRef (FSRef* file) { - char path [2048]; - zerostruct (path); + char path [2048] = { 0 }; if (FSRefMakePath (file, (UInt8*) path, sizeof (path) - 1) == noErr) - return PlatformUtilities::convertToPrecomposedUnicode (String::fromUTF8 (path)); + return PlatformUtilities::convertToPrecomposedUnicode (CharPointer_UTF8 (path)); return String::empty; } @@ -279877,7 +279846,7 @@ END_JUCE_NAMESPACE if ([err length] > 0) { - *error = JUCE_NAMESPACE::String::fromUTF8 ([err UTF8String]); + *error = JUCE_NAMESPACE::CharPointer_UTF8 ([err UTF8String]); break; } } @@ -280182,7 +280151,7 @@ const StringArray AudioCDBurner::findAvailableDevices() StringArray s; for (unsigned int i = 0; i < [names count]; ++i) - s.add (String::fromUTF8 ([[names objectAtIndex: i] UTF8String])); + s.add (CharPointer_UTF8 ([[names objectAtIndex: i] UTF8String])); return s; } @@ -281423,8 +281392,7 @@ public: String name; { - char channelName [256]; - zerostruct (channelName); + char channelName [256] = { 0 }; UInt32 nameSize = sizeof (channelName); UInt32 channelNum = chanNum + 1; pa.mSelector = kAudioDevicePropertyChannelName; @@ -284173,7 +284141,7 @@ const String SystemStats::getLogonName() user = pw->pw_name; } - return String::fromUTF8 (user); + return CharPointer_UTF8 (user); } const String SystemStats::getFullUserName() @@ -284420,7 +284388,7 @@ const File File::getCurrentWorkingDirectory() bufferSize += 1024; } - return File (String::fromUTF8 (cwd)); + return File (CharPointer_UTF8 (cwd)); } bool File::setAsCurrentWorkingDirectory() const @@ -284691,7 +284659,7 @@ const File juce_getExecutableFile() #else Dl_info exeInfo; dladdr ((void*) juce_getExecutableFile, &exeInfo); // (can't be a const void* on android) - return File::getCurrentWorkingDirectory().getChildFile (String::fromUTF8 (exeInfo.dli_fname)); + return File::getCurrentWorkingDirectory().getChildFile (CharPointer_UTF8 (exeInfo.dli_fname)); #endif } @@ -285186,7 +285154,7 @@ public: if (fnmatch (wildcardUTF8, de->d_name, FNM_CASEFOLD) == 0) { - filenameFound = String::fromUTF8 (de->d_name); + filenameFound = CharPointer_UTF8 (de->d_name); updateStatInfoForFile (parentDir + filenameFound, isDir, fileSize, modTime, creationTime, isReadOnly); diff --git a/juce_amalgamated.h b/juce_amalgamated.h index e6d26c958a..42989f1ff0 100644 --- a/juce_amalgamated.h +++ b/juce_amalgamated.h @@ -73,7 +73,7 @@ namespace JuceDummyNamespace {} */ #define JUCE_MAJOR_VERSION 1 #define JUCE_MINOR_VERSION 53 -#define JUCE_BUILDNUMBER 37 +#define JUCE_BUILDNUMBER 38 /** Current Juce version number. @@ -6080,6 +6080,15 @@ public: swapVariables (data, other.data); } + /** This fills the block with zeros, up to the number of elements specified. + Since the block has no way of knowing its own size, you must make sure that the number of + elements you specify doesn't exceed the allocated size. + */ + void clear (size_t numElements) throw() + { + zeromem (data, sizeof (ElementType) * numElements); + } + private: ElementType* data; @@ -9043,12 +9052,16 @@ private: }; /** - Used to point to an object of type ReferenceCountedObject. + A smart-pointer class which points to a reference-counted object. - It's wise to use a typedef instead of typing out the templated name - each time - e.g. + The template parameter specifies the class of the object you want to point to - the easiest + way to make a class reference-countable is to simply make it inherit from ReferenceCountedObject, + but if you need to, you could roll your own reference-countable class by implementing a pair of + mathods called incReferenceCount() and decReferenceCount(). - typedef ReferenceCountedObjectPtr MyClassPtr; + When using this class, you'll probably want to create a typedef to abbreviate the full + templated name - e.g. + @code typedef ReferenceCountedObjectPtr MyClassPtr;@endcode @see ReferenceCountedObject, ReferenceCountedObjectArray */ @@ -23793,6 +23806,13 @@ public: */ const String getTextDescription() const; + /** Creates a textual description of the key combination, using unicode icon symbols if possible. + + On OSX, this uses the Apple symbols for command, option, shift, etc, instead of the textual + modifier key descriptions that are returned by getTextDescription() + */ + const String getTextDescriptionWithIcons() const; + /** Checks whether the user is currently holding down the keys that make up this KeyPress. @@ -65103,7 +65123,7 @@ public: /** @internal */ void paint (Graphics& g); /** @internal */ - bool hitTest (int x, int y) const; + bool hitTest (int x, int y); /** @internal */ Drawable* createCopy() const; /** @internal */ diff --git a/src/containers/juce_Value.cpp b/src/containers/juce_Value.cpp index d46cf33ad5..8fcb5584df 100644 --- a/src/containers/juce_Value.cpp +++ b/src/containers/juce_Value.cpp @@ -42,6 +42,9 @@ void Value::ValueSource::sendChangeMessage (const bool synchronous) { if (synchronous) { + // (hold a local reference to this object in case it's freed during the callbacks) + const ReferenceCountedObjectPtr localRef (this); + for (int i = valuesWithListeners.size(); --i >= 0;) { Value* const v = valuesWithListeners[i]; diff --git a/src/core/juce_StandardHeader.h b/src/core/juce_StandardHeader.h index 01496a10cd..90605d5f7b 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 53 -#define JUCE_BUILDNUMBER 37 +#define JUCE_BUILDNUMBER 38 /** Current Juce version number. diff --git a/src/gui/graphics/drawables/juce_DrawableImage.cpp b/src/gui/graphics/drawables/juce_DrawableImage.cpp index cef4dacdda..9fad805049 100644 --- a/src/gui/graphics/drawables/juce_DrawableImage.cpp +++ b/src/gui/graphics/drawables/juce_DrawableImage.cpp @@ -151,10 +151,9 @@ const Rectangle DrawableImage::getDrawableBounds() const return image.getBounds().toFloat(); } -bool DrawableImage::hitTest (int x, int y) const +bool DrawableImage::hitTest (int x, int y) { - return (! image.isNull()) - && image.getPixelAt (x, y).getAlpha() >= 127; + return image.isValid() && image.getPixelAt (x, y).getAlpha() >= 127; } Drawable* DrawableImage::createCopy() const diff --git a/src/gui/graphics/drawables/juce_DrawableImage.h b/src/gui/graphics/drawables/juce_DrawableImage.h index 32251c772e..d2254221d8 100644 --- a/src/gui/graphics/drawables/juce_DrawableImage.h +++ b/src/gui/graphics/drawables/juce_DrawableImage.h @@ -87,7 +87,7 @@ public: /** @internal */ void paint (Graphics& g); /** @internal */ - bool hitTest (int x, int y) const; + bool hitTest (int x, int y); /** @internal */ Drawable* createCopy() const; /** @internal */ diff --git a/src/native/windows/juce_win32_ASIO.cpp b/src/native/windows/juce_win32_ASIO.cpp index 1a588186c4..24fc72c5d0 100644 --- a/src/native/windows/juce_win32_ASIO.cpp +++ b/src/native/windows/juce_win32_ASIO.cpp @@ -73,7 +73,7 @@ namespace ASIODebugging //============================================================================== class ASIOAudioIODevice; -static ASIOAudioIODevice* volatile currentASIODev[3] = { 0, 0, 0 }; +static ASIOAudioIODevice* volatile currentASIODev[3] = { 0 }; static const int maxASIOChannels = 160; @@ -1656,10 +1656,6 @@ public: CoInitialize (0); } - ~ASIOAudioIODeviceType() - { - } - //============================================================================== void scanForDevices() { @@ -1671,21 +1667,12 @@ public: HKEY hk = 0; int index = 0; - if (RegOpenKeyA (HKEY_LOCAL_MACHINE, "software\\asio", &hk) == ERROR_SUCCESS) + if (RegOpenKey (HKEY_LOCAL_MACHINE, _T("software\\asio"), &hk) == ERROR_SUCCESS) { - for (;;) - { - char name [256]; + TCHAR name [256]; - if (RegEnumKeyA (hk, index++, name, 256) == ERROR_SUCCESS) - { - addDriverInfo (name, hk); - } - else - { - break; - } - } + while (RegEnumKey (hk, index++, name, numElementsInArray (name)) == ERROR_SUCCESS) + addDriverInfo (name, hk); RegCloseKey (hk); } @@ -1772,39 +1759,31 @@ private: if (RegOpenKey (HKEY_CLASSES_ROOT, _T("clsid"), &hk) == ERROR_SUCCESS) { int index = 0; + TCHAR name [512]; - for (;;) + while (RegEnumKey (hk, index++, name, numElementsInArray (name)) == ERROR_SUCCESS) { - WCHAR buf [512]; - - if (RegEnumKey (hk, index++, buf, 512) == ERROR_SUCCESS) + if (classId.equalsIgnoreCase (name)) { - if (classId.equalsIgnoreCase (buf)) - { - HKEY subKey, pathKey; + HKEY subKey, pathKey; - if (RegOpenKeyEx (hk, buf, 0, KEY_READ, &subKey) == ERROR_SUCCESS) + if (RegOpenKeyEx (hk, name, 0, KEY_READ, &subKey) == ERROR_SUCCESS) + { + if (RegOpenKeyEx (subKey, _T("InprocServer32"), 0, KEY_READ, &pathKey) == ERROR_SUCCESS) { - if (RegOpenKeyEx (subKey, _T("InprocServer32"), 0, KEY_READ, &pathKey) == ERROR_SUCCESS) - { - WCHAR pathName [1024]; - DWORD dtype = REG_SZ; - DWORD dsize = sizeof (pathName); - - if (RegQueryValueEx (pathKey, 0, 0, &dtype, (LPBYTE) pathName, &dsize) == ERROR_SUCCESS) - ok = File (pathName).exists(); + TCHAR pathName [1024]; + DWORD dtype = REG_SZ; + DWORD dsize = sizeof (pathName); - RegCloseKey (pathKey); - } + if (RegQueryValueEx (pathKey, 0, 0, &dtype, (LPBYTE) pathName, &dsize) == ERROR_SUCCESS) + ok = File (pathName).exists(); - RegCloseKey (subKey); + RegCloseKey (pathKey); } - break; + RegCloseKey (subKey); } - } - else - { + break; } } @@ -1822,7 +1801,7 @@ private: if (RegOpenKeyEx (hk, keyName.toUTF16(), 0, KEY_READ, &subKey) == ERROR_SUCCESS) { - WCHAR buf [256]; + TCHAR buf [256]; zerostruct (buf); DWORD dtype = REG_SZ; DWORD dsize = sizeof (buf); diff --git a/src/native/windows/juce_win32_NativeIncludes.h b/src/native/windows/juce_win32_NativeIncludes.h index 331327391c..697b2ad9f7 100644 --- a/src/native/windows/juce_win32_NativeIncludes.h +++ b/src/native/windows/juce_win32_NativeIncludes.h @@ -84,7 +84,7 @@ //============================================================================== #if JUCE_ASIO && JUCE_BUILD_NATIVE -/* + /* This is very frustrating - we only need to use a handful of definitions from a couple of the header files in Steinberg's ASIO SDK, and it'd be easy to copy about 30 lines of code into this cpp file to create a fully stand-alone ASIO @@ -98,16 +98,11 @@ 1) Agree to Steinberg's licensing terms and download the ASIO SDK (see www.steinberg.net/Steinberg/Developers.asp). - 2) Rebuild the whole of JUCE, setting the global definition JUCE_ASIO (you - can un-comment the "#define JUCE_ASIO" line in juce_Config.h - if you prefer). Make sure that your header search path will find the - iasiodrv.h file that comes with the SDK. (Only about 2-3 of the SDK header - files are actually needed - so to simplify things, you could just copy - these into your JUCE directory). + 2) Enable this code with a global definition #define JUCE_ASIO 1. - If you're compiling and you get an error here because you don't have the - ASIO SDK installed, you can disable ASIO support by commenting-out the - "#define JUCE_ASIO" line in juce_Config.h, and rebuild your Juce library. + 3) Make sure that your header search path contains the iasiodrv.h file that + comes with the SDK. (Only about a handful of the SDK header files are actually + needed - so to simplify things, you could just copy these into your JUCE directory). */ #include #endif