@@ -206,7 +206,7 @@ bool File::isOnRemovableDrive() const throw() | |||||
{ | { | ||||
const ScopedAutoReleasePool pool; | const ScopedAutoReleasePool pool; | ||||
BOOL removable = false; | BOOL removable = false; | ||||
[[NSWorkspace sharedWorkspace] | [[NSWorkspace sharedWorkspace] | ||||
getFileSystemInfoForPath: juceStringToNS (getFullPathName()) | getFileSystemInfoForPath: juceStringToNS (getFullPathName()) | ||||
isRemovable: &removable | isRemovable: &removable | ||||
@@ -347,11 +347,11 @@ const String File::getVersion() const throw() | |||||
String result; | String result; | ||||
NSBundle* bundle = [NSBundle bundleWithPath: juceStringToNS (getFullPathName())]; | NSBundle* bundle = [NSBundle bundleWithPath: juceStringToNS (getFullPathName())]; | ||||
if (bundle != 0) | if (bundle != 0) | ||||
{ | { | ||||
NSDictionary* info = [bundle infoDictionary]; | NSDictionary* info = [bundle infoDictionary]; | ||||
if (info != 0) | if (info != 0) | ||||
{ | { | ||||
NSString* name = [info valueForKey: @"CFBundleShortVersionString"]; | NSString* name = [info valueForKey: @"CFBundleShortVersionString"]; | ||||
@@ -147,7 +147,7 @@ public: | |||||
{ | { | ||||
[webView stopLoading: nil]; | [webView stopLoading: nil]; | ||||
} | } | ||||
void refresh() | void refresh() | ||||
{ | { | ||||
[webView reload: nil]; | [webView reload: nil]; | ||||
@@ -602,7 +602,6 @@ | |||||
#import <IOKit/network/IONetworkInterface.h> | #import <IOKit/network/IONetworkInterface.h> | ||||
#import <IOKit/network/IOEthernetController.h> | #import <IOKit/network/IOEthernetController.h> | ||||
#import <IOKit/pwr_mgt/IOPMLib.h> | #import <IOKit/pwr_mgt/IOPMLib.h> | ||||
#import <SystemConfiguration/SCDynamicStore.h> | |||||
#include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
#include <sys/stat.h> | #include <sys/stat.h> | ||||
@@ -2640,32 +2639,49 @@ void BitArray::shiftBits (int bits, const int startBit) throw() | |||||
} | } | ||||
} | } | ||||
const BitArray BitArray::getBitRange (int startBit, int numBits) const throw() | |||||
{ | |||||
BitArray r; | |||||
numBits = jmin (numBits, getHighestBit() + 1 - startBit); | |||||
r.ensureSize (numBits >> 5); | |||||
r.highestBit = numBits; | |||||
int i = 0; | |||||
while (numBits > 0) | |||||
{ | |||||
r.values[i++] = getBitRangeAsInt (startBit, jmin (32, numBits)); | |||||
numBits -= 32; | |||||
startBit += 32; | |||||
} | |||||
r.highestBit = r.getHighestBit(); | |||||
return r; | |||||
} | |||||
int BitArray::getBitRangeAsInt (const int startBit, int numBits) const throw() | int BitArray::getBitRangeAsInt (const int startBit, int numBits) const throw() | ||||
{ | { | ||||
if (numBits > 32) | if (numBits > 32) | ||||
{ | { | ||||
jassertfalse | |||||
jassertfalse // use getBitRange() if you need more than 32 bits.. | |||||
numBits = 32; | numBits = 32; | ||||
} | } | ||||
if (startBit == 0) | |||||
{ | |||||
if (numBits < 32) | |||||
return values[0] & ((1 << numBits) - 1); | |||||
numBits = jmin (numBits, highestBit + 1 - startBit); | |||||
return values[0]; | |||||
} | |||||
if (numBits <= 0) | |||||
return 0; | |||||
int n = 0; | |||||
for (int i = numBits; --i >= 0;) | |||||
{ | |||||
n <<= 1; | |||||
const int pos = startBit >> 5; | |||||
const int offset = startBit & 31; | |||||
const int endSpace = 32 - numBits; | |||||
if (operator[] (startBit + i)) | |||||
n |= 1; | |||||
} | |||||
uint32 n = ((uint32) values [pos]) >> offset; | |||||
return n; | |||||
if (offset > endSpace) | |||||
n |= ((uint32) values [pos + 1]) << (32 - offset); | |||||
return (int) (n & (((uint32) 0xffffffff) >> endSpace)); | |||||
} | } | ||||
void BitArray::setBitRangeAsInt (const int startBit, int numBits, unsigned int valueToSet) throw() | void BitArray::setBitRangeAsInt (const int startBit, int numBits, unsigned int valueToSet) throw() | ||||
@@ -36725,11 +36741,12 @@ MessageManager::MessageManager() throw() | |||||
MessageManager::~MessageManager() throw() | MessageManager::~MessageManager() throw() | ||||
{ | { | ||||
jassert (instance == this); | |||||
instance = 0; | |||||
deleteAndZero (broadcastListeners); | deleteAndZero (broadcastListeners); | ||||
doPlatformSpecificShutdown(); | doPlatformSpecificShutdown(); | ||||
jassert (instance == this); | |||||
instance = 0; // do this last in case this instance is still needed by doPlatformSpecificShutdown() | |||||
} | } | ||||
MessageManager* MessageManager::getInstance() throw() | MessageManager* MessageManager::getInstance() throw() | ||||
@@ -7139,11 +7139,19 @@ public: | |||||
/** Returns true if no bits are set. */ | /** Returns true if no bits are set. */ | ||||
bool isEmpty() const throw(); | bool isEmpty() const throw(); | ||||
/** Returns a range of bits in the array as a new BitArray. | |||||
e.g. getBitRangeAsInt (0, 64) would return the lowest 64 bits. | |||||
@see getBitRangeAsInt | |||||
*/ | |||||
const BitArray getBitRange (int startBit, int numBits) const throw(); | |||||
/** Returns a range of bits in the array as an integer value. | /** Returns a range of bits in the array as an integer value. | ||||
e.g. getBitRangeAsInt (0, 32) would return the lowest 32 bits. | e.g. getBitRangeAsInt (0, 32) would return the lowest 32 bits. | ||||
Asking for more than 32 bits isn't allowed (obviously). | |||||
Asking for more than 32 bits isn't allowed (obviously) - for that, use | |||||
getBitRange(). | |||||
*/ | */ | ||||
int getBitRangeAsInt (int startBit, int numBits) const throw(); | int getBitRangeAsInt (int startBit, int numBits) const throw(); | ||||
@@ -776,8 +776,8 @@ static bool juce_slowCopyOfWavFileWithNewMetadata (const File& file, const Strin | |||||
if (reader != 0) | if (reader != 0) | ||||
{ | { | ||||
AudioFormatWriter* writer = wav.createWriterFor (outStream, reader->sampleRate, | |||||
reader->numChannels, reader->bitsPerSample, | |||||
AudioFormatWriter* writer = wav.createWriterFor (outStream, reader->sampleRate, | |||||
reader->numChannels, reader->bitsPerSample, | |||||
metadata, 0); | metadata, 0); | ||||
if (writer != 0) | if (writer != 0) | ||||
@@ -144,7 +144,7 @@ public: | |||||
//============================================================================== | //============================================================================== | ||||
/** Utility function to replace the metadata in a wav file with a new set of values. | /** 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 | |||||
If possible, this cheats by overwriting just the metadata region of the file, rather | |||||
than by copying the whole file again. | than by copying the whole file again. | ||||
*/ | */ | ||||
bool replaceMetadataInFile (const File& wavFile, const StringPairArray& newMetadata); | bool replaceMetadataInFile (const File& wavFile, const StringPairArray& newMetadata); | ||||
@@ -54,7 +54,7 @@ BEGIN_JUCE_NAMESPACE | |||||
#include "../../../../juce_appframework/gui/components/layout/juce_ComponentMovementWatcher.h" | #include "../../../../juce_appframework/gui/components/layout/juce_ComponentMovementWatcher.h" | ||||
#include "../../../../juce_appframework/gui/components/special/juce_NSViewComponent.h" | #include "../../../../juce_appframework/gui/components/special/juce_NSViewComponent.h" | ||||
#if JUCE_MAC && JUCE_SUPPORT_CARBON | #if JUCE_MAC && JUCE_SUPPORT_CARBON | ||||
#include "../../../../../build/macosx/platform_specific_code/juce_mac_CarbonViewWrapperComponent.h" | |||||
#include "../../../../../build/macosx/platform_specific_code/juce_mac_CarbonViewWrapperComponent.h" | |||||
#endif | #endif | ||||
#if JUCE_MAC | #if JUCE_MAC | ||||
@@ -62,11 +62,12 @@ MessageManager::MessageManager() throw() | |||||
MessageManager::~MessageManager() throw() | MessageManager::~MessageManager() throw() | ||||
{ | { | ||||
jassert (instance == this); | |||||
instance = 0; | |||||
deleteAndZero (broadcastListeners); | deleteAndZero (broadcastListeners); | ||||
doPlatformSpecificShutdown(); | doPlatformSpecificShutdown(); | ||||
jassert (instance == this); | |||||
instance = 0; // do this last in case this instance is still needed by doPlatformSpecificShutdown() | |||||
} | } | ||||
MessageManager* MessageManager::getInstance() throw() | MessageManager* MessageManager::getInstance() throw() | ||||
@@ -215,7 +215,7 @@ void ImageButton::paintButton (Graphics& g, | |||||
imageH = ih; | imageH = ih; | ||||
} | } | ||||
getLookAndFeel().drawImageButton (g, im, imageX, imageY, imageW, imageH, | |||||
getLookAndFeel().drawImageButton (g, im, imageX, imageY, imageW, imageH, | |||||
isButtonDown ? downOverlay | isButtonDown ? downOverlay | ||||
: (isMouseOverButton ? overOverlay | : (isMouseOverButton ? overOverlay | ||||
: normalOverlay), | : normalOverlay), | ||||
@@ -591,9 +591,9 @@ void TreeView::moveSelectedRow (int delta) | |||||
{ | { | ||||
if (! item->canBeSelected()) | if (! item->canBeSelected()) | ||||
{ | { | ||||
// if the row we want to highlight doesn't allow it, try skipping | |||||
// if the row we want to highlight doesn't allow it, try skipping | |||||
// to the next item.. | // to the next item.. | ||||
const int nextRowToTry = jlimit (0, getNumRowsInTree() - 1, | |||||
const int nextRowToTry = jlimit (0, getNumRowsInTree() - 1, | |||||
rowSelected + (delta < 0 ? -1 : 1)); | rowSelected + (delta < 0 ? -1 : 1)); | ||||
if (rowSelected != nextRowToTry) | if (rowSelected != nextRowToTry) | ||||
@@ -1632,7 +1632,7 @@ void LookAndFeel::drawImageButton (Graphics& g, Image* image, | |||||
{ | { | ||||
g.setOpacity (imageOpacity); | g.setOpacity (imageOpacity); | ||||
g.drawImage (image, imageX, imageY, imageW, imageH, | |||||
g.drawImage (image, imageX, imageY, imageW, imageH, | |||||
0, 0, image->getWidth(), image->getHeight(), false); | 0, 0, image->getWidth(), image->getHeight(), false); | ||||
} | } | ||||
@@ -693,32 +693,49 @@ void BitArray::shiftBits (int bits, const int startBit) throw() | |||||
} | } | ||||
} | } | ||||
const BitArray BitArray::getBitRange (int startBit, int numBits) const throw() | |||||
{ | |||||
BitArray r; | |||||
numBits = jmin (numBits, getHighestBit() + 1 - startBit); | |||||
r.ensureSize (numBits >> 5); | |||||
r.highestBit = numBits; | |||||
int i = 0; | |||||
while (numBits > 0) | |||||
{ | |||||
r.values[i++] = getBitRangeAsInt (startBit, jmin (32, numBits)); | |||||
numBits -= 32; | |||||
startBit += 32; | |||||
} | |||||
r.highestBit = r.getHighestBit(); | |||||
return r; | |||||
} | |||||
int BitArray::getBitRangeAsInt (const int startBit, int numBits) const throw() | int BitArray::getBitRangeAsInt (const int startBit, int numBits) const throw() | ||||
{ | { | ||||
if (numBits > 32) | if (numBits > 32) | ||||
{ | { | ||||
jassertfalse | |||||
jassertfalse // use getBitRange() if you need more than 32 bits.. | |||||
numBits = 32; | numBits = 32; | ||||
} | } | ||||
if (startBit == 0) | |||||
{ | |||||
if (numBits < 32) | |||||
return values[0] & ((1 << numBits) - 1); | |||||
numBits = jmin (numBits, highestBit + 1 - startBit); | |||||
return values[0]; | |||||
} | |||||
if (numBits <= 0) | |||||
return 0; | |||||
int n = 0; | |||||
for (int i = numBits; --i >= 0;) | |||||
{ | |||||
n <<= 1; | |||||
const int pos = startBit >> 5; | |||||
const int offset = startBit & 31; | |||||
const int endSpace = 32 - numBits; | |||||
if (operator[] (startBit + i)) | |||||
n |= 1; | |||||
} | |||||
uint32 n = ((uint32) values [pos]) >> offset; | |||||
if (offset > endSpace) | |||||
n |= ((uint32) values [pos + 1]) << (32 - offset); | |||||
return n; | |||||
return (int) (n & (((uint32) 0xffffffff) >> endSpace)); | |||||
} | } | ||||
void BitArray::setBitRangeAsInt (const int startBit, int numBits, unsigned int valueToSet) throw() | void BitArray::setBitRangeAsInt (const int startBit, int numBits, unsigned int valueToSet) throw() | ||||
@@ -128,11 +128,19 @@ public: | |||||
bool isEmpty() const throw(); | bool isEmpty() const throw(); | ||||
//============================================================================== | //============================================================================== | ||||
/** Returns a range of bits in the array as a new BitArray. | |||||
e.g. getBitRangeAsInt (0, 64) would return the lowest 64 bits. | |||||
@see getBitRangeAsInt | |||||
*/ | |||||
const BitArray getBitRange (int startBit, int numBits) const throw(); | |||||
/** Returns a range of bits in the array as an integer value. | /** Returns a range of bits in the array as an integer value. | ||||
e.g. getBitRangeAsInt (0, 32) would return the lowest 32 bits. | e.g. getBitRangeAsInt (0, 32) would return the lowest 32 bits. | ||||
Asking for more than 32 bits isn't allowed (obviously). | |||||
Asking for more than 32 bits isn't allowed (obviously) - for that, use | |||||
getBitRange(). | |||||
*/ | */ | ||||
int getBitRangeAsInt (int startBit, int numBits) const throw(); | int getBitRangeAsInt (int startBit, int numBits) const throw(); | ||||
@@ -69,9 +69,9 @@ public: | |||||
/** Creates a checksum for a string. | /** Creates a checksum for a string. | ||||
Note that this operates on the string as a block of unicode characters, so the | Note that this operates on the string as a block of unicode characters, so the | ||||
result you get will differ from the value you'd get if the string was treated | |||||
as a block of utf8 or ascii. Bear this in mind if you're comparing the result | |||||
of this method with a checksum created by a different framework, which may have | |||||
result you get will differ from the value you'd get if the string was treated | |||||
as a block of utf8 or ascii. Bear this in mind if you're comparing the result | |||||
of this method with a checksum created by a different framework, which may have | |||||
used a different encoding. | used a different encoding. | ||||
*/ | */ | ||||
MD5 (const String& text); | MD5 (const String& text); | ||||
@@ -770,7 +770,7 @@ bool File::containsSubDirectories() const throw() | |||||
String filename; | String filename; | ||||
bool isDirectory, isHidden; | bool isDirectory, isHidden; | ||||
void* const handle = juce_findFileStart (juce_addTrailingSeparator (fullPath), | void* const handle = juce_findFileStart (juce_addTrailingSeparator (fullPath), | ||||
T("*"), filename, | |||||
T("*"), filename, | |||||
&isDirectory, &isHidden, 0, 0, 0, 0); | &isDirectory, &isHidden, 0, 0, 0, 0); | ||||
if (handle != 0) | if (handle != 0) | ||||
@@ -1006,7 +1006,7 @@ public: | |||||
@param maxBufferSizeBytes the size of the destination buffer, in bytes. If the | @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 | string won't fit, it'll put in as many as it can while | ||||
still allowing for a terminating null char at the end, | still allowing for a terminating null char at the end, | ||||
and will return the number of bytes that were actually | |||||
and will return the number of bytes that were actually | |||||
used. If this value is < 0, no limit is used. | used. If this value is < 0, no limit is used. | ||||
*/ | */ | ||||
int copyToUTF8 (uint8* const destBuffer, const int maxBufferSizeBytes = 0x7fffffff) const throw(); | int copyToUTF8 (uint8* const destBuffer, const int maxBufferSizeBytes = 0x7fffffff) const throw(); | ||||