Browse Source

Added X-windows locking for all linux windowing, and added a class ScopedXLock to allow it to be done around client code as well. Misc fixes for mac menus, win32 WM_QUIT messages, MidiKeyboardComponent. Added text colour id to DirectoryContentsDisplayComponent.

tags/2021-05-28
Julian Storer 15 years ago
parent
commit
6bf8b51c5a
35 changed files with 969 additions and 1019 deletions
  1. +284
    -292
      juce_amalgamated.cpp
  2. +176
    -209
      juce_amalgamated.h
  3. +3
    -2
      src/application/juce_Application.cpp
  4. +2
    -5
      src/audio/midi/juce_MidiBuffer.cpp
  5. +8
    -9
      src/audio/midi/juce_MidiMessageSequence.cpp
  6. +5
    -1
      src/audio/midi/juce_MidiMessageSequence.h
  7. +61
    -103
      src/containers/juce_Array.h
  8. +3
    -3
      src/containers/juce_ArrayAllocationBase.h
  9. +1
    -1
      src/containers/juce_BitArray.cpp
  10. +1
    -1
      src/containers/juce_BitArray.h
  11. +11
    -11
      src/containers/juce_HeapBlock.h
  12. +1
    -1
      src/containers/juce_MemoryBlock.cpp
  13. +1
    -1
      src/containers/juce_MemoryBlock.h
  14. +19
    -17
      src/containers/juce_ReferenceCountedArray.h
  15. +14
    -14
      src/containers/juce_ScopedPointer.h
  16. +1
    -1
      src/containers/juce_SortedSet.h
  17. +1
    -1
      src/containers/juce_ValueTree.cpp
  18. +33
    -145
      src/containers/juce_Variant.cpp
  19. +34
    -33
      src/containers/juce_Variant.h
  20. +26
    -2
      src/core/juce_PlatformUtilities.h
  21. +1
    -3
      src/core/juce_Uuid.cpp
  22. +1
    -4
      src/gui/components/filebrowser/juce_DirectoryContentsDisplayComponent.h
  23. +1
    -1
      src/gui/components/filebrowser/juce_FileChooserDialogBox.cpp
  24. +13
    -0
      src/gui/components/filebrowser/juce_FileChooserDialogBox.h
  25. +24
    -21
      src/gui/components/lookandfeel/juce_LookAndFeel.cpp
  26. +2
    -1
      src/gui/components/special/juce_MidiKeyboardComponent.cpp
  27. +8
    -11
      src/gui/graphics/geometry/juce_PositionedRectangle.cpp
  28. +1
    -3
      src/gui/graphics/geometry/juce_RectangleList.cpp
  29. +64
    -16
      src/native/linux/juce_linux_Messaging.cpp
  30. +97
    -14
      src/native/linux/juce_linux_Windowing.cpp
  31. +3
    -1
      src/native/mac/juce_mac_MainMenu.mm
  32. +9
    -5
      src/native/windows/juce_win32_Messaging.cpp
  33. +0
    -5
      src/native/windows/juce_win32_Windowing.cpp
  34. +31
    -50
      src/text/juce_StringArray.cpp
  35. +29
    -32
      src/text/juce_StringArray.h

+ 284
- 292
juce_amalgamated.cpp
File diff suppressed because it is too large
View File


+ 176
- 209
juce_amalgamated.h View File

@@ -1474,7 +1474,7 @@ class HeapBlock
{ {
public: public:


HeapBlock() : data (0)
HeapBlock() throw() : data (0)
{ {
} }


@@ -1488,26 +1488,26 @@ public:
::juce_free (data); ::juce_free (data);
} }


inline operator ElementType*() const { return data; }
inline operator ElementType*() const throw() { return data; }


inline operator void*() const { return (void*) data; }
inline operator void*() const throw() { return (void*) data; }


inline ElementType* operator->() const { return data; }
inline ElementType* operator->() const throw() { return data; }


template <class CastType> template <class CastType>
inline operator CastType*() const { return (CastType*) data; }
inline operator CastType*() const throw() { return (CastType*) data; }


template <typename IndexType> template <typename IndexType>
inline ElementType& operator[] (IndexType index) const { return data [index]; }
inline ElementType& operator[] (IndexType index) const throw() { return data [index]; }


template <typename IndexType> template <typename IndexType>
inline ElementType* operator+ (IndexType index) const { return data + index; }
inline ElementType* operator+ (IndexType index) const throw() { return data + index; }


inline ElementType** operator&() const { return (ElementType**) &data; }
inline ElementType** operator&() const throw() { return (ElementType**) &data; }


inline bool operator== (const ElementType* const otherPointer) const { return otherPointer == data; }
inline bool operator== (const ElementType* const otherPointer) const throw() { return otherPointer == data; }


inline bool operator!= (const ElementType* const otherPointer) const { return otherPointer != data; }
inline bool operator!= (const ElementType* const otherPointer) const throw() { return otherPointer != data; }


void malloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType)) void malloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType))
{ {
@@ -1545,7 +1545,7 @@ public:
data = 0; data = 0;
} }


void swapWith (HeapBlock <ElementType>& other)
void swapWith (HeapBlock <ElementType>& other) throw()
{ {
swapVariables (data, other.data); swapVariables (data, other.data);
} }
@@ -1588,19 +1588,19 @@ public:
} }
} }


void ensureAllocatedSize (int minNumElements)
void ensureAllocatedSize (const int minNumElements)
{ {
if (minNumElements > numAllocated) if (minNumElements > numAllocated)
setAllocatedSize ((minNumElements + minNumElements / 2 + 8) & ~7); setAllocatedSize ((minNumElements + minNumElements / 2 + 8) & ~7);
} }


void shrinkToNoMoreThan (int maxNumElements)
void shrinkToNoMoreThan (const int maxNumElements)
{ {
if (maxNumElements < numAllocated) if (maxNumElements < numAllocated)
setAllocatedSize (maxNumElements); setAllocatedSize (maxNumElements);
} }


void swapWith (ArrayAllocationBase <ElementType>& other)
void swapWith (ArrayAllocationBase <ElementType>& other) throw()
{ {
elements.swapWith (other.elements); elements.swapWith (other.elements);
swapVariables (numAllocated, other.numAllocated); swapVariables (numAllocated, other.numAllocated);
@@ -1873,7 +1873,8 @@ public:
#endif // __JUCE_CRITICALSECTION_JUCEHEADER__ #endif // __JUCE_CRITICALSECTION_JUCEHEADER__
/********* End of inlined file: juce_CriticalSection.h *********/ /********* End of inlined file: juce_CriticalSection.h *********/


template <class ElementType, class TypeOfCriticalSectionToUse = DummyCriticalSection>
template <typename ElementType,
typename TypeOfCriticalSectionToUse = DummyCriticalSection>
class Array class Array
{ {
public: public:
@@ -1883,7 +1884,7 @@ public:
{ {
} }


Array (const Array<ElementType, TypeOfCriticalSectionToUse>& other) throw()
Array (const Array<ElementType, TypeOfCriticalSectionToUse>& other)
{ {
other.lockArray(); other.lockArray();
numUsed = other.numUsed; numUsed = other.numUsed;
@@ -1895,14 +1896,14 @@ public:
other.unlockArray(); other.unlockArray();
} }


Array (const ElementType* values) throw()
explicit Array (const ElementType* values)
: numUsed (0) : numUsed (0)
{ {
while (*values != 0) while (*values != 0)
add (*values++); add (*values++);
} }


Array (const ElementType* values, int numValues) throw()
Array (const ElementType* values, int numValues)
: numUsed (numValues) : numUsed (numValues)
{ {
data.setAllocatedSize (numValues); data.setAllocatedSize (numValues);
@@ -1911,50 +1912,25 @@ public:
new (data.elements + i) ElementType (values[i]); new (data.elements + i) ElementType (values[i]);
} }


~Array() throw()
~Array()
{ {
for (int i = 0; i < numUsed; ++i) for (int i = 0; i < numUsed; ++i)
data.elements[i].~ElementType(); data.elements[i].~ElementType();
} }


const Array <ElementType, TypeOfCriticalSectionToUse>& operator= (const Array <ElementType, TypeOfCriticalSectionToUse>& other) throw()
Array <ElementType, TypeOfCriticalSectionToUse>& operator= (const Array <ElementType, TypeOfCriticalSectionToUse>& other)
{ {
if (this != &other) if (this != &other)
{ {
other.lockArray();
lock.enter();

if (other.size() > numUsed)
{
data.ensureAllocatedSize (other.size());

int i = 0;
for (; i < numUsed; ++i)
data.elements[i] = other.data.elements[i];

numUsed = other.size();
for (; i < numUsed; ++i)
new (data.elements + i) ElementType (other.data.elements[i]);
}
else
{
numUsed = other.size();

for (int i = 0; i < numUsed; ++i)
data.elements[i] = other.data.elements[i];

minimiseStorageOverheads();
}

lock.exit();
other.unlockArray();
Array<ElementType, TypeOfCriticalSectionToUse> otherCopy (other);
swapWithArray (otherCopy);
} }


return *this; return *this;
} }


template <class OtherArrayType> template <class OtherArrayType>
bool operator== (const OtherArrayType& other) const throw()
bool operator== (const OtherArrayType& other) const
{ {
lock.enter(); lock.enter();


@@ -1978,12 +1954,12 @@ public:
} }


template <class OtherArrayType> template <class OtherArrayType>
bool operator!= (const OtherArrayType& other) const throw()
bool operator!= (const OtherArrayType& other) const
{ {
return ! operator== (other); return ! operator== (other);
} }


void clear() throw()
void clear()
{ {
lock.enter(); lock.enter();


@@ -1995,7 +1971,7 @@ public:
lock.exit(); lock.exit();
} }


void clearQuick() throw()
void clearQuick()
{ {
lock.enter(); lock.enter();


@@ -2011,22 +1987,22 @@ public:
return numUsed; return numUsed;
} }


inline ElementType operator[] (const int index) const throw()
inline ElementType operator[] (const int index) const
{ {
lock.enter(); lock.enter();
const ElementType result = (((unsigned int) index) < (unsigned int) numUsed)
const ElementType result ((((unsigned int) index) < (unsigned int) numUsed)
? data.elements [index] ? data.elements [index]
: ElementType();
: ElementType());
lock.exit(); lock.exit();


return result; return result;
} }


inline ElementType getUnchecked (const int index) const throw()
inline const ElementType getUnchecked (const int index) const
{ {
lock.enter(); lock.enter();
jassert (((unsigned int) index) < (unsigned int) numUsed); jassert (((unsigned int) index) < (unsigned int) numUsed);
const ElementType result = data.elements [index];
const ElementType result (data.elements [index]);
lock.exit(); lock.exit();


return result; return result;
@@ -2041,27 +2017,27 @@ public:
return result; return result;
} }


inline ElementType getFirst() const throw()
inline ElementType getFirst() const
{ {
lock.enter(); lock.enter();
const ElementType result = (numUsed > 0) ? data.elements [0]
: ElementType();
const ElementType result ((numUsed > 0) ? data.elements [0]
: ElementType());
lock.exit(); lock.exit();


return result; return result;
} }


inline ElementType getLast() const throw()
inline ElementType getLast() const
{ {
lock.enter(); lock.enter();
const ElementType result = (numUsed > 0) ? data.elements [numUsed - 1]
: ElementType();
const ElementType result ((numUsed > 0) ? data.elements [numUsed - 1]
: ElementType());
lock.exit(); lock.exit();


return result; return result;
} }


int indexOf (const ElementType elementToLookFor) const throw()
int indexOf (const ElementType& elementToLookFor) const
{ {
int result = -1; int result = -1;


@@ -2083,28 +2059,13 @@ public:
return result; return result;
} }


bool contains (const ElementType elementToLookFor) const throw()
bool contains (const ElementType& elementToLookFor) const
{ {
lock.enter(); lock.enter();


const ElementType* e = data.elements; const ElementType* e = data.elements;
int num = numUsed; int num = numUsed;


while (num >= 4)
{
if (*e == elementToLookFor
|| *++e == elementToLookFor
|| *++e == elementToLookFor
|| *++e == elementToLookFor)
{
lock.exit();
return true;
}

num -= 4;
++e;
}

while (num > 0) while (num > 0)
{ {
if (elementToLookFor == *e) if (elementToLookFor == *e)
@@ -2121,7 +2082,7 @@ public:
return false; return false;
} }


void add (const ElementType newElement) throw()
void add (const ElementType& newElement)
{ {
lock.enter(); lock.enter();
data.ensureAllocatedSize (numUsed + 1); data.ensureAllocatedSize (numUsed + 1);
@@ -2129,7 +2090,7 @@ public:
lock.exit(); lock.exit();
} }


void insert (int indexToInsertAt, const ElementType newElement) throw()
void insert (int indexToInsertAt, const ElementType& newElement)
{ {
lock.enter(); lock.enter();
data.ensureAllocatedSize (numUsed + 1); data.ensureAllocatedSize (numUsed + 1);
@@ -2153,8 +2114,8 @@ public:
lock.exit(); lock.exit();
} }


void insertMultiple (int indexToInsertAt, const ElementType newElement,
int numberOfTimesToInsertIt) throw()
void insertMultiple (int indexToInsertAt, const ElementType& newElement,
int numberOfTimesToInsertIt)
{ {
if (numberOfTimesToInsertIt > 0) if (numberOfTimesToInsertIt > 0)
{ {
@@ -2184,7 +2145,7 @@ public:


void insertArray (int indexToInsertAt, void insertArray (int indexToInsertAt,
const ElementType* newElements, const ElementType* newElements,
int numberOfElements) throw()
int numberOfElements)
{ {
if (numberOfElements > 0) if (numberOfElements > 0)
{ {
@@ -2212,7 +2173,7 @@ public:
} }
} }


void addIfNotAlreadyThere (const ElementType newElement) throw()
void addIfNotAlreadyThere (const ElementType& newElement)
{ {
lock.enter(); lock.enter();


@@ -2222,8 +2183,7 @@ public:
lock.exit(); lock.exit();
} }


void set (const int indexToChange,
const ElementType newValue) throw()
void set (const int indexToChange, const ElementType& newValue)
{ {
jassert (indexToChange >= 0); jassert (indexToChange >= 0);


@@ -2242,8 +2202,7 @@ public:
lock.exit(); lock.exit();
} }


void setUnchecked (const int indexToChange,
const ElementType newValue) throw()
void setUnchecked (const int indexToChange, const ElementType& newValue)
{ {
lock.enter(); lock.enter();
jassert (((unsigned int) indexToChange) < (unsigned int) numUsed); jassert (((unsigned int) indexToChange) < (unsigned int) numUsed);
@@ -2251,8 +2210,7 @@ public:
lock.exit(); lock.exit();
} }


void addArray (const ElementType* elementsToAdd,
int numElementsToAdd) throw()
void addArray (const ElementType* elementsToAdd, int numElementsToAdd)
{ {
lock.enter(); lock.enter();


@@ -2280,7 +2238,7 @@ public:
template <class OtherArrayType> template <class OtherArrayType>
void addArray (const OtherArrayType& arrayToAddFrom, void addArray (const OtherArrayType& arrayToAddFrom,
int startIndex = 0, int startIndex = 0,
int numElementsToAdd = -1) throw()
int numElementsToAdd = -1)
{ {
arrayToAddFrom.lockArray(); arrayToAddFrom.lockArray();
lock.enter(); lock.enter();
@@ -2302,8 +2260,7 @@ public:
} }


template <class ElementComparator> template <class ElementComparator>
void addSorted (ElementComparator& comparator,
const ElementType newElement) throw()
void addSorted (ElementComparator& comparator, const ElementType& newElement)
{ {
lock.enter(); lock.enter();
insert (findInsertIndexInSortedArray (comparator, (ElementType*) data.elements, newElement, 0, numUsed), newElement); insert (findInsertIndexInSortedArray (comparator, (ElementType*) data.elements, newElement, 0, numUsed), newElement);
@@ -2311,8 +2268,7 @@ public:
} }


template <class ElementComparator> template <class ElementComparator>
int indexOfSorted (ElementComparator& comparator,
const ElementType elementToLookFor) const throw()
int indexOfSorted (ElementComparator& comparator, const ElementType& elementToLookFor) const
{ {
(void) comparator; // if you pass in an object with a static compareElements() method, this (void) comparator; // if you pass in an object with a static compareElements() method, this
// avoids getting warning messages about the parameter being unused // avoids getting warning messages about the parameter being unused
@@ -2350,7 +2306,7 @@ public:
} }
} }


ElementType remove (const int indexToRemove) throw()
ElementType remove (const int indexToRemove)
{ {
lock.enter(); lock.enter();


@@ -2379,7 +2335,7 @@ public:
} }
} }


void removeValue (const ElementType valueToRemove) throw()
void removeValue (const ElementType& valueToRemove)
{ {
lock.enter(); lock.enter();
ElementType* e = data.elements; ElementType* e = data.elements;
@@ -2398,8 +2354,7 @@ public:
lock.exit(); lock.exit();
} }


void removeRange (int startIndex,
int numberToRemove) throw()
void removeRange (int startIndex, int numberToRemove)
{ {
lock.enter(); lock.enter();
const int endIndex = jlimit (0, numUsed, startIndex + numberToRemove); const int endIndex = jlimit (0, numUsed, startIndex + numberToRemove);
@@ -2426,7 +2381,7 @@ public:
lock.exit(); lock.exit();
} }


void removeLast (int howManyToRemove = 1) throw()
void removeLast (int howManyToRemove = 1)
{ {
lock.enter(); lock.enter();


@@ -2445,7 +2400,7 @@ public:
} }


template <class OtherArrayType> template <class OtherArrayType>
void removeValuesIn (const OtherArrayType& otherArray) throw()
void removeValuesIn (const OtherArrayType& otherArray)
{ {
otherArray.lockArray(); otherArray.lockArray();
lock.enter(); lock.enter();
@@ -2469,7 +2424,7 @@ public:
} }


template <class OtherArrayType> template <class OtherArrayType>
void removeValuesNotIn (const OtherArrayType& otherArray) throw()
void removeValuesNotIn (const OtherArrayType& otherArray)
{ {
otherArray.lockArray(); otherArray.lockArray();
lock.enter(); lock.enter();
@@ -2493,7 +2448,7 @@ public:
} }


void swap (const int index1, void swap (const int index1,
const int index2) throw()
const int index2)
{ {
lock.enter(); lock.enter();


@@ -2507,8 +2462,7 @@ public:
lock.exit(); lock.exit();
} }


void move (const int currentIndex,
int newIndex) throw()
void move (const int currentIndex, int newIndex) throw()
{ {
if (currentIndex != newIndex) if (currentIndex != newIndex)
{ {
@@ -2542,14 +2496,14 @@ public:
} }
} }


void minimiseStorageOverheads() throw()
void minimiseStorageOverheads()
{ {
lock.enter(); lock.enter();
data.shrinkToNoMoreThan (numUsed); data.shrinkToNoMoreThan (numUsed);
lock.exit(); lock.exit();
} }


void ensureStorageAllocated (const int minNumElements) throw()
void ensureStorageAllocated (const int minNumElements)
{ {
lock.enter(); lock.enter();
data.ensureAllocatedSize (minNumElements); data.ensureAllocatedSize (minNumElements);
@@ -2558,7 +2512,7 @@ public:


template <class ElementComparator> template <class ElementComparator>
void sort (ElementComparator& comparator, void sort (ElementComparator& comparator,
const bool retainOrderOfEquivalentItems = false) const throw()
const bool retainOrderOfEquivalentItems = false) const
{ {
(void) comparator; // if you pass in an object with a static compareElements() method, this (void) comparator; // if you pass in an object with a static compareElements() method, this
// avoids getting warning messages about the parameter being unused // avoids getting warning messages about the parameter being unused
@@ -2616,7 +2570,7 @@ public:


~BitArray() throw(); ~BitArray() throw();


const BitArray& operator= (const BitArray& other) throw();
BitArray& operator= (const BitArray& other) throw();


bool operator== (const BitArray& other) const throw(); bool operator== (const BitArray& other) const throw();
bool operator!= (const BitArray& other) const throw(); bool operator!= (const BitArray& other) const throw();
@@ -2741,7 +2695,7 @@ public:


~MemoryBlock() throw(); ~MemoryBlock() throw();


const MemoryBlock& operator= (const MemoryBlock& other) throw();
MemoryBlock& operator= (const MemoryBlock& other) throw();


bool operator== (const MemoryBlock& other) const throw(); bool operator== (const MemoryBlock& other) const throw();


@@ -2822,22 +2776,22 @@ class JUCE_API ScopedPointer
{ {
public: public:


inline ScopedPointer() : object (0)
inline ScopedPointer() throw() : object (0)
{ {
} }


inline ScopedPointer (ObjectType* const objectToTakePossessionOf)
inline ScopedPointer (ObjectType* const objectToTakePossessionOf) throw()
: object (objectToTakePossessionOf) : object (objectToTakePossessionOf)
{ {
} }


ScopedPointer (ScopedPointer& objectToTransferFrom)
ScopedPointer (ScopedPointer& objectToTransferFrom) throw()
: object (objectToTransferFrom.object) : object (objectToTransferFrom.object)
{ {
objectToTransferFrom.object = 0; objectToTransferFrom.object = 0;
} }


inline ~ScopedPointer() { delete object; }
inline ~ScopedPointer() { delete object; }


const ScopedPointer& operator= (ScopedPointer& objectToTransferFrom) const ScopedPointer& operator= (ScopedPointer& objectToTransferFrom)
{ {
@@ -2868,24 +2822,24 @@ public:
return *this; return *this;
} }


inline operator ObjectType*() const { return object; }
inline operator ObjectType*() const throw() { return object; }


inline ObjectType& operator*() const { return *object; }
inline ObjectType& operator*() const throw() { return *object; }


inline ObjectType* operator->() const { return object; }
inline ObjectType* operator->() const throw() { return object; }


template <class CastType> template <class CastType>
inline operator CastType*() const { return static_cast <CastType*> (object); }
inline operator CastType*() const throw() { return static_cast <CastType*> (object); }


inline ObjectType** operator&() const { return (ObjectType**) &object; }
inline ObjectType** operator&() const throw() { return (ObjectType**) &object; }


ObjectType* release() { ObjectType* const o = object; object = 0; return o; }
ObjectType* release() throw() { ObjectType* const o = object; object = 0; return o; }


inline bool operator== (const ObjectType* const otherPointer) const { return otherPointer == object; }
inline bool operator== (const ObjectType* const otherPointer) const throw() { return otherPointer == object; }


inline bool operator!= (const ObjectType* const otherPointer) const { return otherPointer != object; }
inline bool operator!= (const ObjectType* const otherPointer) const throw() { return otherPointer != object; }


void swapWith (ScopedPointer <ObjectType>& other)
void swapWith (ScopedPointer <ObjectType>& other) throw()
{ {
// Two ScopedPointers should never be able to refer to the same object - if // Two ScopedPointers should never be able to refer to the same object - if
// this happens, you must have done something dodgy! // this happens, you must have done something dodgy!
@@ -2899,7 +2853,7 @@ private:
ObjectType* object; ObjectType* object;


// (Required as an alternative to the overloaded & operator). // (Required as an alternative to the overloaded & operator).
ScopedPointer* getAddress() { return this; }
ScopedPointer* getAddress() const throw() { return this; }
}; };


#endif // __JUCE_SCOPEDPOINTER_JUCEHEADER__ #endif // __JUCE_SCOPEDPOINTER_JUCEHEADER__
@@ -3409,88 +3363,85 @@ public:


StringArray() throw(); StringArray() throw();


StringArray (const StringArray& other) throw();
StringArray (const StringArray& other);


StringArray (const juce_wchar** const strings, StringArray (const juce_wchar** const strings,
const int numberOfStrings) throw();
const int numberOfStrings);


StringArray (const char** const strings, StringArray (const char** const strings,
const int numberOfStrings) throw();
const int numberOfStrings);


StringArray (const juce_wchar** const strings) throw();
explicit StringArray (const juce_wchar** const strings);


StringArray (const char** const strings) throw();
explicit StringArray (const char** const strings);


virtual ~StringArray() throw();
~StringArray();


const StringArray& operator= (const StringArray& other) throw();
const StringArray& operator= (const StringArray& other);


bool operator== (const StringArray& other) const throw();
bool operator== (const StringArray& other) const;


bool operator!= (const StringArray& other) const throw();
bool operator!= (const StringArray& other) const;


inline int size() const throw() { return strings.size(); }; inline int size() const throw() { return strings.size(); };


const String& operator[] (const int index) const throw(); const String& operator[] (const int index) const throw();


bool contains (const String& stringToLookFor, bool contains (const String& stringToLookFor,
const bool ignoreCase = false) const throw();
const bool ignoreCase = false) const;


int indexOf (const String& stringToLookFor, int indexOf (const String& stringToLookFor,
const bool ignoreCase = false, const bool ignoreCase = false,
int startIndex = 0) const throw();
int startIndex = 0) const;


void add (const String& stringToAdd) throw();
void add (const String& stringToAdd);


void insert (const int index,
const String& stringToAdd) throw();
void insert (const int index, const String& stringToAdd);


void addIfNotAlreadyThere (const String& stringToAdd,
const bool ignoreCase = false) throw();
void addIfNotAlreadyThere (const String& stringToAdd, const bool ignoreCase = false);


void set (const int index,
const String& newString) throw();
void set (const int index, const String& newString);


void addArray (const StringArray& other, void addArray (const StringArray& other,
int startIndex = 0, int startIndex = 0,
int numElementsToAdd = -1) throw();
int numElementsToAdd = -1);


int addTokens (const tchar* const stringToTokenise, int addTokens (const tchar* const stringToTokenise,
const bool preserveQuotedStrings) throw();
const bool preserveQuotedStrings);


int addTokens (const tchar* const stringToTokenise, int addTokens (const tchar* const stringToTokenise,
const tchar* breakCharacters, const tchar* breakCharacters,
const tchar* quoteCharacters) throw();
const tchar* quoteCharacters);


int addLines (const tchar* stringToBreakUp) throw();
int addLines (const tchar* stringToBreakUp);


void clear() throw();
void clear();


void remove (const int index) throw();
void remove (const int index);


void removeString (const String& stringToRemove, void removeString (const String& stringToRemove,
const bool ignoreCase = false) throw();
const bool ignoreCase = false);


void removeDuplicates (const bool ignoreCase) throw();
void removeDuplicates (const bool ignoreCase);


void removeEmptyStrings (const bool removeWhitespaceStrings = true) throw();
void removeEmptyStrings (const bool removeWhitespaceStrings = true);


void move (const int currentIndex, int newIndex) throw(); void move (const int currentIndex, int newIndex) throw();


void trim() throw();
void trim();


void appendNumbersToDuplicates (const bool ignoreCaseWhenComparing, void appendNumbersToDuplicates (const bool ignoreCaseWhenComparing,
const bool appendNumberToFirstInstance, const bool appendNumberToFirstInstance,
const tchar* const preNumberString = defaultPreNumberString, const tchar* const preNumberString = defaultPreNumberString,
const tchar* const postNumberString = defaultPostNumberString) throw();
const tchar* const postNumberString = defaultPostNumberString);


const String joinIntoString (const String& separatorString, const String joinIntoString (const String& separatorString,
int startIndex = 0, int startIndex = 0,
int numberOfElements = -1) const throw();
int numberOfElements = -1) const;


void sort (const bool ignoreCase) throw();
void sort (const bool ignoreCase);


void minimiseStorageOverheads() throw();
void minimiseStorageOverheads();


juce_UseDebuggingNewOperator juce_UseDebuggingNewOperator


@@ -4739,26 +4690,12 @@ public:
other.unlockArray(); other.unlockArray();
} }


const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& operator= (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) throw()
ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& operator= (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) throw()
{ {
if (this != &other) if (this != &other)
{ {
other.lockArray();
lock.enter();

clear();

data.ensureAllocatedSize (other.numUsed);
numUsed = other.numUsed;
memcpy (data.elements, other.data.elements, numUsed * sizeof (ObjectClass*));
minimiseStorageOverheads();

for (int i = numUsed; --i >= 0;)
if (data.elements[i] != 0)
data.elements[i]->incReferenceCount();

lock.exit();
other.unlockArray();
ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse> otherCopy (other);
swapWithArray (other);
} }


return *this; return *this;
@@ -5133,6 +5070,16 @@ public:
} }
} }


void swapWithArray (ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& otherArray) throw()
{
lock.enter();
otherArray.lock.enter();
data.swapWith (otherArray.data);
swapVariables (numUsed, otherArray.numUsed);
otherArray.lock.exit();
lock.exit();
}

bool operator== (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) const throw() bool operator== (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) const throw()
{ {
other.lockArray(); other.lockArray();
@@ -5244,7 +5191,7 @@ public:
{ {
} }


const SortedSet <ElementType, TypeOfCriticalSectionToUse>& operator= (const SortedSet <ElementType, TypeOfCriticalSectionToUse>& other) throw()
SortedSet <ElementType, TypeOfCriticalSectionToUse>& operator= (const SortedSet <ElementType, TypeOfCriticalSectionToUse>& other) throw()
{ {
if (this != &other) if (this != &other)
{ {
@@ -5918,33 +5865,35 @@ public:


~var(); ~var();


var (const var& valueToCopy) throw();
var (const var& valueToCopy);
var (const int value) throw(); var (const int value) throw();
var (const bool value) throw(); var (const bool value) throw();
var (const double value) throw(); var (const double value) throw();
var (const char* const value) throw();
var (const juce_wchar* const value) throw();
var (const String& value) throw();
var (DynamicObject* const object) throw();
var (const char* const value);
var (const juce_wchar* const value);
var (const String& value);
var (DynamicObject* const object);
var (MethodFunction method) throw(); var (MethodFunction method) throw();


const var& operator= (const var& valueToCopy) throw();
const var& operator= (const int value) throw();
const var& operator= (const bool value) throw();
const var& operator= (const double value) throw();
const var& operator= (const char* const value) throw();
const var& operator= (const juce_wchar* const value) throw();
const var& operator= (const String& value) throw();
const var& operator= (DynamicObject* const object) throw();
const var& operator= (MethodFunction method) throw();

operator int() const throw();
operator bool() const throw();
operator float() const throw();
operator double() const throw();
operator const String() const throw();
const String toString() const throw();
DynamicObject* getObject() const throw();
var& operator= (const var& valueToCopy);
var& operator= (int value);
var& operator= (bool value);
var& operator= (double value);
var& operator= (const char* value);
var& operator= (const juce_wchar* value);
var& operator= (const String& value);
var& operator= (DynamicObject* object);
var& operator= (MethodFunction method);

void swapWith (var& other) throw();

operator int() const;
operator bool() const;
operator float() const;
operator double() const;
operator const String() const;
const String toString() const;
DynamicObject* getObject() const;


bool isVoid() const throw() { return type == voidType; } bool isVoid() const throw() { return type == voidType; }
bool isInt() const throw() { return type == intType; } bool isInt() const throw() { return type == intType; }
@@ -5957,16 +5906,16 @@ public:
bool operator== (const var& other) const throw(); bool operator== (const var& other) const throw();
bool operator!= (const var& other) const throw(); bool operator!= (const var& other) const throw();


void writeToStream (OutputStream& output) const throw();
void writeToStream (OutputStream& output) const;


static const var readFromStream (InputStream& input) throw();
static const var readFromStream (InputStream& input);


class JUCE_API identifier class JUCE_API identifier
{ {
public: public:
identifier (const char* const name) throw();
identifier (const String& name) throw();
~identifier() throw();
identifier (const char* const name);
identifier (const String& name);
~identifier();


bool operator== (const identifier& other) const throw() bool operator== (const identifier& other) const throw()
{ {
@@ -5978,7 +5927,7 @@ public:
int hashCode; int hashCode;
}; };


const var operator[] (const identifier& propertyName) const throw();
const var operator[] (const identifier& propertyName) const;


const var call (const identifier& method) const; const var call (const identifier& method) const;
const var call (const identifier& method, const var& arg1) const; const var call (const identifier& method, const var& arg1) const;
@@ -6005,9 +5954,7 @@ private:
methodType methodType
}; };


Type type;

union
union ValueUnion
{ {
int intValue; int intValue;
bool boolValue; bool boolValue;
@@ -6015,9 +5962,10 @@ private:
String* stringValue; String* stringValue;
DynamicObject* objectValue; DynamicObject* objectValue;
MethodFunction methodValue; MethodFunction methodValue;
} value;
};


void releaseValue() throw();
Type type;
ValueUnion value;
}; };


class JUCE_API DynamicObject : public ReferenceCountedObject class JUCE_API DynamicObject : public ReferenceCountedObject
@@ -6861,6 +6809,18 @@ private:


#endif #endif


#if JUCE_LINUX

class ScopedXLock
{
public:
ScopedXLock();

~ScopedXLock();
};

#endif

#if JUCE_MAC #if JUCE_MAC


class JUCE_API AppleRemoteDevice class JUCE_API AppleRemoteDevice
@@ -16815,7 +16775,7 @@ public:


MidiMessageSequence (const MidiMessageSequence& other); MidiMessageSequence (const MidiMessageSequence& other);


const MidiMessageSequence& operator= (const MidiMessageSequence& other);
MidiMessageSequence& operator= (const MidiMessageSequence& other);


~MidiMessageSequence(); ~MidiMessageSequence();


@@ -16885,6 +16845,8 @@ public:
const double time, const double time,
OwnedArray<MidiMessage>& resultMessages); OwnedArray<MidiMessage>& resultMessages);


void swapWith (MidiMessageSequence& other) throw();

juce_UseDebuggingNewOperator juce_UseDebuggingNewOperator


static int compareElements (const MidiMessageSequence::MidiEventHolder* const first, static int compareElements (const MidiMessageSequence::MidiEventHolder* const first,
@@ -22578,6 +22540,11 @@ public:


bool show (int width = 0,int height = 0); bool show (int width = 0,int height = 0);


enum ColourIds
{
titleTextColourId = 0x1000850, /**< The colour to use to draw the box's title. */
};

void buttonClicked (Button* button); void buttonClicked (Button* button);
void closeButtonPressed(); void closeButtonPressed();
void selectionChanged(); void selectionChanged();


+ 3
- 2
src/application/juce_Application.cpp View File

@@ -45,6 +45,7 @@ BEGIN_JUCE_NAMESPACE
#include "../core/juce_Initialisation.h" #include "../core/juce_Initialisation.h"
#include "../threads/juce_Process.h" #include "../threads/juce_Process.h"
#include "../core/juce_PlatformUtilities.h" #include "../core/juce_PlatformUtilities.h"
#include "../text/juce_LocalisedStrings.h"
void juce_setCurrentThreadName (const String& name); void juce_setCurrentThreadName (const String& name);
@@ -139,8 +140,8 @@ void JUCEApplication::getCommandInfo (const CommandID commandID, ApplicationComm
{ {
if (commandID == StandardApplicationCommandIDs::quit) if (commandID == StandardApplicationCommandIDs::quit)
{ {
result.setInfo ("Quit",
"Quits the application",
result.setInfo (TRANS("Quit"),
TRANS("Quits the application"),
"Application", "Application",
0); 0);


+ 2
- 5
src/audio/midi/juce_MidiBuffer.cpp View File

@@ -50,11 +50,8 @@ MidiBuffer::MidiBuffer (const MidiBuffer& other) throw()
const MidiBuffer& MidiBuffer::operator= (const MidiBuffer& other) throw() const MidiBuffer& MidiBuffer::operator= (const MidiBuffer& other) throw()
{ {
if (this != &other)
{
bytesUsed = other.bytesUsed;
data = other.data;
}
bytesUsed = other.bytesUsed;
data = other.data;
return *this; return *this;
} }


+ 8
- 9
src/audio/midi/juce_MidiMessageSequence.cpp View File

@@ -44,19 +44,18 @@ MidiMessageSequence::MidiMessageSequence (const MidiMessageSequence& other)
list.add (new MidiEventHolder (other.list.getUnchecked(i)->message)); list.add (new MidiEventHolder (other.list.getUnchecked(i)->message));
} }
const MidiMessageSequence& MidiMessageSequence::operator= (const MidiMessageSequence& other)
MidiMessageSequence& MidiMessageSequence::operator= (const MidiMessageSequence& other)
{ {
if (this != &other)
{
clear();
for (int i = 0; i < other.list.size(); ++i)
list.add (new MidiEventHolder (other.list.getUnchecked(i)->message));
}
MidiMessageSequence otherCopy (other);
swapWith (otherCopy);
return *this; return *this;
} }
void MidiMessageSequence::swapWith (MidiMessageSequence& other) throw()
{
list.swapWithArray (other.list);
}
MidiMessageSequence::~MidiMessageSequence() MidiMessageSequence::~MidiMessageSequence()
{ {
} }


+ 5
- 1
src/audio/midi/juce_MidiMessageSequence.h View File

@@ -50,7 +50,7 @@ public:
MidiMessageSequence (const MidiMessageSequence& other); MidiMessageSequence (const MidiMessageSequence& other);
/** Replaces this sequence with another one. */ /** Replaces this sequence with another one. */
const MidiMessageSequence& operator= (const MidiMessageSequence& other);
MidiMessageSequence& operator= (const MidiMessageSequence& other);
/** Destructor. */ /** Destructor. */
~MidiMessageSequence(); ~MidiMessageSequence();
@@ -265,6 +265,10 @@ public:
const double time, const double time,
OwnedArray<MidiMessage>& resultMessages); OwnedArray<MidiMessage>& resultMessages);
//==============================================================================
/** Swaps this sequence with another one. */
void swapWith (MidiMessageSequence& other) throw();
//============================================================================== //==============================================================================
juce_UseDebuggingNewOperator juce_UseDebuggingNewOperator


+ 61
- 103
src/containers/juce_Array.h View File

@@ -33,25 +33,30 @@
//============================================================================== //==============================================================================
/** /**
Holds a list of primitive objects, such as ints, doubles, or pointers.
Holds a list of simple objects, such as ints, doubles, or pointers.
Examples of arrays are: Array<int> or Array<MyClass*>
Examples of arrays are: Array<int>, Array<Rectangle> or Array<MyClass*>
Note that when holding pointers to objects, the array doesn't take any ownership
of the objects - for doing this, see the OwnedArray class or the ReferenceCountedArray class.
The array can be used to hold simple, non-polymorphic objects as well as primitive types - to
do so, the class must fulfil these requirements:
- it must have a copy constructor and operator=
- it must be able to be relocated in memory by a memcpy without this causing a problem - so no
objects whose functionality relies on pointers or references to themselves can be used.
If you're using a class or struct as the element type, it must be
capable of being copied or moved with a straightforward memcpy, rather than
needing construction and destruction code.
You can of course have an array of pointers to any kind of object, e.g. Array <MyClass*>, but if
you do this, the array doesn't take any ownership of the objects - see the OwnedArray class or the
ReferenceCountedArray class for more powerful ways of holding lists of objects.
For holding lists of strings, use the specialised class StringArray.
For holding lists of strings, you can use Array <String>, but it's usually better to use the
specialised class StringArray, which provides more useful functions.
To make all the array's methods thread-safe, pass in "CriticalSection" as the templated To make all the array's methods thread-safe, pass in "CriticalSection" as the templated
TypeOfCriticalSectionToUse parameter, instead of the default DummyCriticalSection. TypeOfCriticalSectionToUse parameter, instead of the default DummyCriticalSection.
@see OwnedArray, ReferenceCountedArray, StringArray, CriticalSection @see OwnedArray, ReferenceCountedArray, StringArray, CriticalSection
*/ */
template <class ElementType, class TypeOfCriticalSectionToUse = DummyCriticalSection>
template <typename ElementType,
typename TypeOfCriticalSectionToUse = DummyCriticalSection>
class Array class Array
{ {
public: public:
@@ -65,7 +70,7 @@ public:
/** Creates a copy of another array. /** Creates a copy of another array.
@param other the array to copy @param other the array to copy
*/ */
Array (const Array<ElementType, TypeOfCriticalSectionToUse>& other) throw()
Array (const Array<ElementType, TypeOfCriticalSectionToUse>& other)
{ {
other.lockArray(); other.lockArray();
numUsed = other.numUsed; numUsed = other.numUsed;
@@ -81,7 +86,7 @@ public:
@param values the array to copy from @param values the array to copy from
*/ */
Array (const ElementType* values) throw()
explicit Array (const ElementType* values)
: numUsed (0) : numUsed (0)
{ {
while (*values != 0) while (*values != 0)
@@ -93,7 +98,7 @@ public:
@param values the array to copy from @param values the array to copy from
@param numValues the number of values in the array @param numValues the number of values in the array
*/ */
Array (const ElementType* values, int numValues) throw()
Array (const ElementType* values, int numValues)
: numUsed (numValues) : numUsed (numValues)
{ {
data.setAllocatedSize (numValues); data.setAllocatedSize (numValues);
@@ -103,7 +108,7 @@ public:
} }
/** Destructor. */ /** Destructor. */
~Array() throw()
~Array()
{ {
for (int i = 0; i < numUsed; ++i) for (int i = 0; i < numUsed; ++i)
data.elements[i].~ElementType(); data.elements[i].~ElementType();
@@ -112,37 +117,12 @@ public:
/** Copies another array. /** Copies another array.
@param other the array to copy @param other the array to copy
*/ */
const Array <ElementType, TypeOfCriticalSectionToUse>& operator= (const Array <ElementType, TypeOfCriticalSectionToUse>& other) throw()
Array <ElementType, TypeOfCriticalSectionToUse>& operator= (const Array <ElementType, TypeOfCriticalSectionToUse>& other)
{ {
if (this != &other) if (this != &other)
{ {
other.lockArray();
lock.enter();
if (other.size() > numUsed)
{
data.ensureAllocatedSize (other.size());
int i = 0;
for (; i < numUsed; ++i)
data.elements[i] = other.data.elements[i];
numUsed = other.size();
for (; i < numUsed; ++i)
new (data.elements + i) ElementType (other.data.elements[i]);
}
else
{
numUsed = other.size();
for (int i = 0; i < numUsed; ++i)
data.elements[i] = other.data.elements[i];
minimiseStorageOverheads();
}
lock.exit();
other.unlockArray();
Array<ElementType, TypeOfCriticalSectionToUse> otherCopy (other);
swapWithArray (otherCopy);
} }
return *this; return *this;
@@ -155,7 +135,7 @@ public:
@param other the other array to compare with @param other the other array to compare with
*/ */
template <class OtherArrayType> template <class OtherArrayType>
bool operator== (const OtherArrayType& other) const throw()
bool operator== (const OtherArrayType& other) const
{ {
lock.enter(); lock.enter();
@@ -184,7 +164,7 @@ public:
@param other the other array to compare with @param other the other array to compare with
*/ */
template <class OtherArrayType> template <class OtherArrayType>
bool operator!= (const OtherArrayType& other) const throw()
bool operator!= (const OtherArrayType& other) const
{ {
return ! operator== (other); return ! operator== (other);
} }
@@ -197,7 +177,7 @@ public:
@see clearQuick @see clearQuick
*/ */
void clear() throw()
void clear()
{ {
lock.enter(); lock.enter();
@@ -213,7 +193,7 @@ public:
@see clear @see clear
*/ */
void clearQuick() throw()
void clearQuick()
{ {
lock.enter(); lock.enter();
@@ -242,12 +222,12 @@ public:
@param index the index of the element being requested (0 is the first element in the array) @param index the index of the element being requested (0 is the first element in the array)
@see getUnchecked, getFirst, getLast @see getUnchecked, getFirst, getLast
*/ */
inline ElementType operator[] (const int index) const throw()
inline ElementType operator[] (const int index) const
{ {
lock.enter(); lock.enter();
const ElementType result = (((unsigned int) index) < (unsigned int) numUsed)
const ElementType result ((((unsigned int) index) < (unsigned int) numUsed)
? data.elements [index] ? data.elements [index]
: ElementType();
: ElementType());
lock.exit(); lock.exit();
return result; return result;
@@ -262,11 +242,11 @@ public:
@param index the index of the element being requested (0 is the first element in the array) @param index the index of the element being requested (0 is the first element in the array)
@see operator[], getFirst, getLast @see operator[], getFirst, getLast
*/ */
inline ElementType getUnchecked (const int index) const throw()
inline const ElementType getUnchecked (const int index) const
{ {
lock.enter(); lock.enter();
jassert (((unsigned int) index) < (unsigned int) numUsed); jassert (((unsigned int) index) < (unsigned int) numUsed);
const ElementType result = data.elements [index];
const ElementType result (data.elements [index]);
lock.exit(); lock.exit();
return result; return result;
@@ -294,11 +274,11 @@ public:
@see operator[], getUnchecked, getLast @see operator[], getUnchecked, getLast
*/ */
inline ElementType getFirst() const throw()
inline ElementType getFirst() const
{ {
lock.enter(); lock.enter();
const ElementType result = (numUsed > 0) ? data.elements [0]
: ElementType();
const ElementType result ((numUsed > 0) ? data.elements [0]
: ElementType());
lock.exit(); lock.exit();
return result; return result;
@@ -308,11 +288,11 @@ public:
@see operator[], getUnchecked, getFirst @see operator[], getUnchecked, getFirst
*/ */
inline ElementType getLast() const throw()
inline ElementType getLast() const
{ {
lock.enter(); lock.enter();
const ElementType result = (numUsed > 0) ? data.elements [numUsed - 1]
: ElementType();
const ElementType result ((numUsed > 0) ? data.elements [numUsed - 1]
: ElementType());
lock.exit(); lock.exit();
return result; return result;
@@ -327,7 +307,7 @@ public:
@param elementToLookFor the value or object to look for @param elementToLookFor the value or object to look for
@returns the index of the object, or -1 if it's not found @returns the index of the object, or -1 if it's not found
*/ */
int indexOf (const ElementType elementToLookFor) const throw()
int indexOf (const ElementType& elementToLookFor) const
{ {
int result = -1; int result = -1;
@@ -354,28 +334,13 @@ public:
@param elementToLookFor the value or object to look for @param elementToLookFor the value or object to look for
@returns true if the item is found @returns true if the item is found
*/ */
bool contains (const ElementType elementToLookFor) const throw()
bool contains (const ElementType& elementToLookFor) const
{ {
lock.enter(); lock.enter();
const ElementType* e = data.elements; const ElementType* e = data.elements;
int num = numUsed; int num = numUsed;
while (num >= 4)
{
if (*e == elementToLookFor
|| *++e == elementToLookFor
|| *++e == elementToLookFor
|| *++e == elementToLookFor)
{
lock.exit();
return true;
}
num -= 4;
++e;
}
while (num > 0) while (num > 0)
{ {
if (elementToLookFor == *e) if (elementToLookFor == *e)
@@ -398,7 +363,7 @@ public:
@param newElement the new object to add to the array @param newElement the new object to add to the array
@see set, insert, addIfNotAlreadyThere, addSorted, addArray @see set, insert, addIfNotAlreadyThere, addSorted, addArray
*/ */
void add (const ElementType newElement) throw()
void add (const ElementType& newElement)
{ {
lock.enter(); lock.enter();
data.ensureAllocatedSize (numUsed + 1); data.ensureAllocatedSize (numUsed + 1);
@@ -418,7 +383,7 @@ public:
@param newElement the new object to add to the array @param newElement the new object to add to the array
@see add, addSorted, set @see add, addSorted, set
*/ */
void insert (int indexToInsertAt, const ElementType newElement) throw()
void insert (int indexToInsertAt, const ElementType& newElement)
{ {
lock.enter(); lock.enter();
data.ensureAllocatedSize (numUsed + 1); data.ensureAllocatedSize (numUsed + 1);
@@ -454,8 +419,8 @@ public:
@param numberOfTimesToInsertIt how many copies of the value to insert @param numberOfTimesToInsertIt how many copies of the value to insert
@see insert, add, addSorted, set @see insert, add, addSorted, set
*/ */
void insertMultiple (int indexToInsertAt, const ElementType newElement,
int numberOfTimesToInsertIt) throw()
void insertMultiple (int indexToInsertAt, const ElementType& newElement,
int numberOfTimesToInsertIt)
{ {
if (numberOfTimesToInsertIt > 0) if (numberOfTimesToInsertIt > 0)
{ {
@@ -497,7 +462,7 @@ public:
*/ */
void insertArray (int indexToInsertAt, void insertArray (int indexToInsertAt,
const ElementType* newElements, const ElementType* newElements,
int numberOfElements) throw()
int numberOfElements)
{ {
if (numberOfElements > 0) if (numberOfElements > 0)
{ {
@@ -533,7 +498,7 @@ public:
@param newElement the new object to add to the array @param newElement the new object to add to the array
*/ */
void addIfNotAlreadyThere (const ElementType newElement) throw()
void addIfNotAlreadyThere (const ElementType& newElement)
{ {
lock.enter(); lock.enter();
@@ -552,8 +517,7 @@ public:
@param newValue the new value to set for this index. @param newValue the new value to set for this index.
@see add, insert @see add, insert
*/ */
void set (const int indexToChange,
const ElementType newValue) throw()
void set (const int indexToChange, const ElementType& newValue)
{ {
jassert (indexToChange >= 0); jassert (indexToChange >= 0);
@@ -581,8 +545,7 @@ public:
@param newValue the new value to set for this index. @param newValue the new value to set for this index.
@see set, getUnchecked @see set, getUnchecked
*/ */
void setUnchecked (const int indexToChange,
const ElementType newValue) throw()
void setUnchecked (const int indexToChange, const ElementType& newValue)
{ {
lock.enter(); lock.enter();
jassert (((unsigned int) indexToChange) < (unsigned int) numUsed); jassert (((unsigned int) indexToChange) < (unsigned int) numUsed);
@@ -596,8 +559,7 @@ public:
@param numElementsToAdd how many elements are in this other array @param numElementsToAdd how many elements are in this other array
@see add @see add
*/ */
void addArray (const ElementType* elementsToAdd,
int numElementsToAdd) throw()
void addArray (const ElementType* elementsToAdd, int numElementsToAdd)
{ {
lock.enter(); lock.enter();
@@ -639,7 +601,7 @@ public:
template <class OtherArrayType> template <class OtherArrayType>
void addArray (const OtherArrayType& arrayToAddFrom, void addArray (const OtherArrayType& arrayToAddFrom,
int startIndex = 0, int startIndex = 0,
int numElementsToAdd = -1) throw()
int numElementsToAdd = -1)
{ {
arrayToAddFrom.lockArray(); arrayToAddFrom.lockArray();
lock.enter(); lock.enter();
@@ -672,8 +634,7 @@ public:
@see add, sort @see add, sort
*/ */
template <class ElementComparator> template <class ElementComparator>
void addSorted (ElementComparator& comparator,
const ElementType newElement) throw()
void addSorted (ElementComparator& comparator, const ElementType& newElement)
{ {
lock.enter(); lock.enter();
insert (findInsertIndexInSortedArray (comparator, (ElementType*) data.elements, newElement, 0, numUsed), newElement); insert (findInsertIndexInSortedArray (comparator, (ElementType*) data.elements, newElement, 0, numUsed), newElement);
@@ -693,8 +654,7 @@ public:
@see addSorted, sort @see addSorted, sort
*/ */
template <class ElementComparator> template <class ElementComparator>
int indexOfSorted (ElementComparator& comparator,
const ElementType elementToLookFor) const throw()
int indexOfSorted (ElementComparator& comparator, const ElementType& elementToLookFor) const
{ {
(void) comparator; // if you pass in an object with a static compareElements() method, this (void) comparator; // if you pass in an object with a static compareElements() method, this
// avoids getting warning messages about the parameter being unused // avoids getting warning messages about the parameter being unused
@@ -743,7 +703,7 @@ public:
@returns the element that has been removed @returns the element that has been removed
@see removeValue, removeRange @see removeValue, removeRange
*/ */
ElementType remove (const int indexToRemove) throw()
ElementType remove (const int indexToRemove)
{ {
lock.enter(); lock.enter();
@@ -780,7 +740,7 @@ public:
@param valueToRemove the object to try to remove @param valueToRemove the object to try to remove
@see remove, removeRange @see remove, removeRange
*/ */
void removeValue (const ElementType valueToRemove) throw()
void removeValue (const ElementType& valueToRemove)
{ {
lock.enter(); lock.enter();
ElementType* e = data.elements; ElementType* e = data.elements;
@@ -811,8 +771,7 @@ public:
@param numberToRemove how many elements should be removed @param numberToRemove how many elements should be removed
@see remove, removeValue @see remove, removeValue
*/ */
void removeRange (int startIndex,
int numberToRemove) throw()
void removeRange (int startIndex, int numberToRemove)
{ {
lock.enter(); lock.enter();
const int endIndex = jlimit (0, numUsed, startIndex + numberToRemove); const int endIndex = jlimit (0, numUsed, startIndex + numberToRemove);
@@ -844,7 +803,7 @@ public:
@param howManyToRemove how many elements to remove from the end of the array @param howManyToRemove how many elements to remove from the end of the array
@see remove, removeValue, removeRange @see remove, removeValue, removeRange
*/ */
void removeLast (int howManyToRemove = 1) throw()
void removeLast (int howManyToRemove = 1)
{ {
lock.enter(); lock.enter();
@@ -868,7 +827,7 @@ public:
@see removeValuesNotIn, remove, removeValue, removeRange @see removeValuesNotIn, remove, removeValue, removeRange
*/ */
template <class OtherArrayType> template <class OtherArrayType>
void removeValuesIn (const OtherArrayType& otherArray) throw()
void removeValuesIn (const OtherArrayType& otherArray)
{ {
otherArray.lockArray(); otherArray.lockArray();
lock.enter(); lock.enter();
@@ -899,7 +858,7 @@ public:
@see removeValuesIn, remove, removeValue, removeRange @see removeValuesIn, remove, removeValue, removeRange
*/ */
template <class OtherArrayType> template <class OtherArrayType>
void removeValuesNotIn (const OtherArrayType& otherArray) throw()
void removeValuesNotIn (const OtherArrayType& otherArray)
{ {
otherArray.lockArray(); otherArray.lockArray();
lock.enter(); lock.enter();
@@ -931,7 +890,7 @@ public:
@param index2 index of the other element to swap @param index2 index of the other element to swap
*/ */
void swap (const int index1, void swap (const int index1,
const int index2) throw()
const int index2)
{ {
lock.enter(); lock.enter();
@@ -959,8 +918,7 @@ public:
is less than zero, the value will be moved to the end is less than zero, the value will be moved to the end
of the array of the array
*/ */
void move (const int currentIndex,
int newIndex) throw()
void move (const int currentIndex, int newIndex) throw()
{ {
if (currentIndex != newIndex) if (currentIndex != newIndex)
{ {
@@ -1001,7 +959,7 @@ public:
removing elements, they may have quite a lot of unused space allocated. removing elements, they may have quite a lot of unused space allocated.
This method will reduce the amount of allocated storage to a minimum. This method will reduce the amount of allocated storage to a minimum.
*/ */
void minimiseStorageOverheads() throw()
void minimiseStorageOverheads()
{ {
lock.enter(); lock.enter();
data.shrinkToNoMoreThan (numUsed); data.shrinkToNoMoreThan (numUsed);
@@ -1014,7 +972,7 @@ public:
the array won't have to keep dynamically resizing itself as the elements the array won't have to keep dynamically resizing itself as the elements
are added, and it'll therefore be more efficient. are added, and it'll therefore be more efficient.
*/ */
void ensureStorageAllocated (const int minNumElements) throw()
void ensureStorageAllocated (const int minNumElements)
{ {
lock.enter(); lock.enter();
data.ensureAllocatedSize (minNumElements); data.ensureAllocatedSize (minNumElements);
@@ -1050,7 +1008,7 @@ public:
*/ */
template <class ElementComparator> template <class ElementComparator>
void sort (ElementComparator& comparator, void sort (ElementComparator& comparator,
const bool retainOrderOfEquivalentItems = false) const throw()
const bool retainOrderOfEquivalentItems = false) const
{ {
(void) comparator; // if you pass in an object with a static compareElements() method, this (void) comparator; // if you pass in an object with a static compareElements() method, this
// avoids getting warning messages about the parameter being unused // avoids getting warning messages about the parameter being unused


+ 3
- 3
src/containers/juce_ArrayAllocationBase.h View File

@@ -83,7 +83,7 @@ public:
@param minNumElements the minimum number of elements that are needed @param minNumElements the minimum number of elements that are needed
*/ */
void ensureAllocatedSize (int minNumElements)
void ensureAllocatedSize (const int minNumElements)
{ {
if (minNumElements > numAllocated) if (minNumElements > numAllocated)
setAllocatedSize ((minNumElements + minNumElements / 2 + 8) & ~7); setAllocatedSize ((minNumElements + minNumElements / 2 + 8) & ~7);
@@ -92,14 +92,14 @@ public:
/** Minimises the amount of storage allocated so that it's no more than /** Minimises the amount of storage allocated so that it's no more than
the given number of elements. the given number of elements.
*/ */
void shrinkToNoMoreThan (int maxNumElements)
void shrinkToNoMoreThan (const int maxNumElements)
{ {
if (maxNumElements < numAllocated) if (maxNumElements < numAllocated)
setAllocatedSize (maxNumElements); setAllocatedSize (maxNumElements);
} }
/** Swap the contents of two objects. */ /** Swap the contents of two objects. */
void swapWith (ArrayAllocationBase <ElementType>& other)
void swapWith (ArrayAllocationBase <ElementType>& other) throw()
{ {
elements.swapWith (other.elements); elements.swapWith (other.elements);
swapVariables (numAllocated, other.numAllocated); swapVariables (numAllocated, other.numAllocated);


+ 1
- 1
src/containers/juce_BitArray.cpp View File

@@ -90,7 +90,7 @@ BitArray::~BitArray() throw()
{ {
} }
const BitArray& BitArray::operator= (const BitArray& other) throw()
BitArray& BitArray::operator= (const BitArray& other) throw()
{ {
if (this != &other) if (this != &other)
{ {


+ 1
- 1
src/containers/juce_BitArray.h View File

@@ -75,7 +75,7 @@ public:
//============================================================================== //==============================================================================
/** Copies another BitArray onto this one. */ /** Copies another BitArray onto this one. */
const BitArray& operator= (const BitArray& other) throw();
BitArray& operator= (const BitArray& other) throw();
/** Two arrays are the same if the same bits are set. */ /** Two arrays are the same if the same bits are set. */
bool operator== (const BitArray& other) const throw(); bool operator== (const BitArray& other) const throw();


+ 11
- 11
src/containers/juce_HeapBlock.h View File

@@ -78,7 +78,7 @@ public:
After creation, you can resize the array using the malloc(), calloc(), After creation, you can resize the array using the malloc(), calloc(),
or realloc() methods. or realloc() methods.
*/ */
HeapBlock() : data (0)
HeapBlock() throw() : data (0)
{ {
} }
@@ -108,54 +108,54 @@ public:
This may be a null pointer if the data hasn't yet been allocated, or if it has been This may be a null pointer if the data hasn't yet been allocated, or if it has been
freed by calling the free() method. freed by calling the free() method.
*/ */
inline operator ElementType*() const { return data; }
inline operator ElementType*() const throw() { return data; }
/** Returns a void pointer to the allocated data. /** Returns a void pointer to the allocated data.
This may be a null pointer if the data hasn't yet been allocated, or if it has been This may be a null pointer if the data hasn't yet been allocated, or if it has been
freed by calling the free() method. freed by calling the free() method.
*/ */
inline operator void*() const { return (void*) data; }
inline operator void*() const throw() { return (void*) data; }
/** Lets you use indirect calls to the first element in the array. /** Lets you use indirect calls to the first element in the array.
Obviously this will cause problems if the array hasn't been initialised, because it'll Obviously this will cause problems if the array hasn't been initialised, because it'll
be referencing a null pointer. be referencing a null pointer.
*/ */
inline ElementType* operator->() const { return data; }
inline ElementType* operator->() const throw() { return data; }
/** Returns a pointer to the data by casting it to any type you need. /** Returns a pointer to the data by casting it to any type you need.
*/ */
template <class CastType> template <class CastType>
inline operator CastType*() const { return (CastType*) data; }
inline operator CastType*() const throw() { return (CastType*) data; }
/** Returns a reference to one of the data elements. /** Returns a reference to one of the data elements.
Obviously there's no bounds-checking here, as this object is just a dumb pointer and Obviously there's no bounds-checking here, as this object is just a dumb pointer and
has no idea of the size it currently has allocated. has no idea of the size it currently has allocated.
*/ */
template <typename IndexType> template <typename IndexType>
inline ElementType& operator[] (IndexType index) const { return data [index]; }
inline ElementType& operator[] (IndexType index) const throw() { return data [index]; }
/** Returns a pointer to a data element at an offset from the start of the array. /** Returns a pointer to a data element at an offset from the start of the array.
This is the same as doing pointer arithmetic on the raw pointer itself. This is the same as doing pointer arithmetic on the raw pointer itself.
*/ */
template <typename IndexType> template <typename IndexType>
inline ElementType* operator+ (IndexType index) const { return data + index; }
inline ElementType* operator+ (IndexType index) const throw() { return data + index; }
/** Returns a reference to the raw data pointer. /** Returns a reference to the raw data pointer.
Beware that the pointer returned here will become invalid as soon as you call Beware that the pointer returned here will become invalid as soon as you call
any of the allocator methods on this object! any of the allocator methods on this object!
*/ */
inline ElementType** operator&() const { return (ElementType**) &data; }
inline ElementType** operator&() const throw() { return (ElementType**) &data; }
//============================================================================== //==============================================================================
/** Compares the pointer with another pointer. /** Compares the pointer with another pointer.
This can be handy for checking whether this is a null pointer. This can be handy for checking whether this is a null pointer.
*/ */
inline bool operator== (const ElementType* const otherPointer) const { return otherPointer == data; }
inline bool operator== (const ElementType* const otherPointer) const throw() { return otherPointer == data; }
/** Compares the pointer with another pointer. /** Compares the pointer with another pointer.
This can be handy for checking whether this is a null pointer. This can be handy for checking whether this is a null pointer.
*/ */
inline bool operator!= (const ElementType* const otherPointer) const { return otherPointer != data; }
inline bool operator!= (const ElementType* const otherPointer) const throw() { return otherPointer != data; }
//============================================================================== //==============================================================================
/** Allocates a specified amount of memory. /** Allocates a specified amount of memory.
@@ -224,7 +224,7 @@ public:
/** Swaps this object's data with the data of another HeapBlock. /** Swaps this object's data with the data of another HeapBlock.
The two objects simply exchange their data pointers. The two objects simply exchange their data pointers.
*/ */
void swapWith (HeapBlock <ElementType>& other)
void swapWith (HeapBlock <ElementType>& other) throw()
{ {
swapVariables (data, other.data); swapVariables (data, other.data);
} }


+ 1
- 1
src/containers/juce_MemoryBlock.cpp View File

@@ -84,7 +84,7 @@ MemoryBlock::~MemoryBlock() throw()
jassert (size == 0 || data != 0); // non-zero size but no data allocated? jassert (size == 0 || data != 0); // non-zero size but no data allocated?
} }
const MemoryBlock& MemoryBlock::operator= (const MemoryBlock& other) throw()
MemoryBlock& MemoryBlock::operator= (const MemoryBlock& other) throw()
{ {
if (this != &other) if (this != &other)
{ {


+ 1
- 1
src/containers/juce_MemoryBlock.h View File

@@ -68,7 +68,7 @@ public:
This block will be resized and copied to exactly match the other one. This block will be resized and copied to exactly match the other one.
*/ */
const MemoryBlock& operator= (const MemoryBlock& other) throw();
MemoryBlock& operator= (const MemoryBlock& other) throw();
//============================================================================== //==============================================================================
/** Compares two memory blocks. /** Compares two memory blocks.


+ 19
- 17
src/containers/juce_ReferenceCountedArray.h View File

@@ -77,26 +77,12 @@ public:
Any existing objects in this array will first be released. Any existing objects in this array will first be released.
*/ */
const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& operator= (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) throw()
ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& operator= (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) throw()
{ {
if (this != &other) if (this != &other)
{ {
other.lockArray();
lock.enter();
clear();
data.ensureAllocatedSize (other.numUsed);
numUsed = other.numUsed;
memcpy (data.elements, other.data.elements, numUsed * sizeof (ObjectClass*));
minimiseStorageOverheads();
for (int i = numUsed; --i >= 0;)
if (data.elements[i] != 0)
data.elements[i]->incReferenceCount();
lock.exit();
other.unlockArray();
ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse> otherCopy (other);
swapWithArray (other);
} }
return *this; return *this;
@@ -642,6 +628,22 @@ public:
} }
} }
//==============================================================================
/** This swaps the contents of this array with those of another array.
If you need to exchange two arrays, this is vastly quicker than using copy-by-value
because it just swaps their internal pointers.
*/
void swapWithArray (ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& otherArray) throw()
{
lock.enter();
otherArray.lock.enter();
data.swapWith (otherArray.data);
swapVariables (numUsed, otherArray.numUsed);
otherArray.lock.exit();
lock.exit();
}
//============================================================================== //==============================================================================
/** Compares this array to another one. /** Compares this array to another one.


+ 14
- 14
src/containers/juce_ScopedPointer.h View File

@@ -50,12 +50,12 @@ class JUCE_API ScopedPointer
public: public:
//============================================================================== //==============================================================================
/** Creates a ScopedPointer containing a null pointer. */ /** Creates a ScopedPointer containing a null pointer. */
inline ScopedPointer() : object (0)
inline ScopedPointer() throw() : object (0)
{ {
} }
/** Creates a ScopedPointer that owns the specified object. */ /** Creates a ScopedPointer that owns the specified object. */
inline ScopedPointer (ObjectType* const objectToTakePossessionOf)
inline ScopedPointer (ObjectType* const objectToTakePossessionOf) throw()
: object (objectToTakePossessionOf) : object (objectToTakePossessionOf)
{ {
} }
@@ -66,7 +66,7 @@ public:
the pointer from the other object to this one, and the other object is reset to the pointer from the other object to this one, and the other object is reset to
be a null pointer. be a null pointer.
*/ */
ScopedPointer (ScopedPointer& objectToTransferFrom)
ScopedPointer (ScopedPointer& objectToTransferFrom) throw()
: object (objectToTransferFrom.object) : object (objectToTransferFrom.object)
{ {
objectToTransferFrom.object = 0; objectToTransferFrom.object = 0;
@@ -75,7 +75,7 @@ public:
/** Destructor. /** Destructor.
This will delete the object that this ScopedPointer currently refers to. This will delete the object that this ScopedPointer currently refers to.
*/ */
inline ~ScopedPointer() { delete object; }
inline ~ScopedPointer() { delete object; }
/** Changes this ScopedPointer to point to a new object. /** Changes this ScopedPointer to point to a new object.
@@ -125,45 +125,45 @@ public:
//============================================================================== //==============================================================================
/** Returns the object that this ScopedPointer refers to. /** Returns the object that this ScopedPointer refers to.
*/ */
inline operator ObjectType*() const { return object; }
inline operator ObjectType*() const throw() { return object; }
/** Returns the object that this ScopedPointer refers to. /** Returns the object that this ScopedPointer refers to.
*/ */
inline ObjectType& operator*() const { return *object; }
inline ObjectType& operator*() const throw() { return *object; }
/** Lets you access methods and properties of the object that this ScopedPointer refers to. */ /** Lets you access methods and properties of the object that this ScopedPointer refers to. */
inline ObjectType* operator->() const { return object; }
inline ObjectType* operator->() const throw() { return object; }
/** Returns a pointer to the object by casting it to whatever type you need. */ /** Returns a pointer to the object by casting it to whatever type you need. */
template <class CastType> template <class CastType>
inline operator CastType*() const { return static_cast <CastType*> (object); }
inline operator CastType*() const throw() { return static_cast <CastType*> (object); }
/** Returns a reference to the address of the object that this ScopedPointer refers to. */ /** Returns a reference to the address of the object that this ScopedPointer refers to. */
inline ObjectType** operator&() const { return (ObjectType**) &object; }
inline ObjectType** operator&() const throw() { return (ObjectType**) &object; }
//============================================================================== //==============================================================================
/** Removes the current object from this ScopedPointer without deleting it. /** Removes the current object from this ScopedPointer without deleting it.
This will return the current object, and set the ScopedPointer to a null pointer. This will return the current object, and set the ScopedPointer to a null pointer.
*/ */
ObjectType* release() { ObjectType* const o = object; object = 0; return o; }
ObjectType* release() throw() { ObjectType* const o = object; object = 0; return o; }
//============================================================================== //==============================================================================
/** Compares the pointer with another pointer. /** Compares the pointer with another pointer.
This can be handy for checking whether this is a null pointer. This can be handy for checking whether this is a null pointer.
*/ */
inline bool operator== (const ObjectType* const otherPointer) const { return otherPointer == object; }
inline bool operator== (const ObjectType* const otherPointer) const throw() { return otherPointer == object; }
/** Compares the pointer with another pointer. /** Compares the pointer with another pointer.
This can be handy for checking whether this is a null pointer. This can be handy for checking whether this is a null pointer.
*/ */
inline bool operator!= (const ObjectType* const otherPointer) const { return otherPointer != object; }
inline bool operator!= (const ObjectType* const otherPointer) const throw() { return otherPointer != object; }
//============================================================================== //==============================================================================
/** Swaps this object with that of another ScopedPointer. /** Swaps this object with that of another ScopedPointer.
The two objects simply exchange their pointers. The two objects simply exchange their pointers.
*/ */
void swapWith (ScopedPointer <ObjectType>& other)
void swapWith (ScopedPointer <ObjectType>& other) throw()
{ {
// Two ScopedPointers should never be able to refer to the same object - if // Two ScopedPointers should never be able to refer to the same object - if
// this happens, you must have done something dodgy! // this happens, you must have done something dodgy!
@@ -177,7 +177,7 @@ private:
ObjectType* object; ObjectType* object;
// (Required as an alternative to the overloaded & operator). // (Required as an alternative to the overloaded & operator).
ScopedPointer* getAddress() { return this; }
ScopedPointer* getAddress() const throw() { return this; }
}; };


+ 1
- 1
src/containers/juce_SortedSet.h View File

@@ -88,7 +88,7 @@ public:
/** Copies another set over this one. /** Copies another set over this one.
@param other the set to copy @param other the set to copy
*/ */
const SortedSet <ElementType, TypeOfCriticalSectionToUse>& operator= (const SortedSet <ElementType, TypeOfCriticalSectionToUse>& other) throw()
SortedSet <ElementType, TypeOfCriticalSectionToUse>& operator= (const SortedSet <ElementType, TypeOfCriticalSectionToUse>& other) throw()
{ {
if (this != &other) if (this != &other)
{ {


+ 1
- 1
src/containers/juce_ValueTree.cpp View File

@@ -735,7 +735,7 @@ ValueTree ValueTree::fromXml (const XmlElement& xml)
const int numAtts = xml.getNumAttributes(); // xxx inefficient - should write an att iterator.. const int numAtts = xml.getNumAttributes(); // xxx inefficient - should write an att iterator..
for (int i = 0; i < numAtts; ++i) for (int i = 0; i < numAtts; ++i)
v.setProperty (xml.getAttributeName (i), xml.getAttributeValue (i), 0);
v.setProperty (xml.getAttributeName (i), var (xml.getAttributeValue (i)), 0);
forEachXmlChildElement (xml, e) forEachXmlChildElement (xml, e)
{ {


+ 33
- 145
src/containers/juce_Variant.cpp View File

@@ -37,7 +37,7 @@ var::var() throw()
value.doubleValue = 0; value.doubleValue = 0;
} }
void var::releaseValue() throw()
var::~var()
{ {
if (type == stringType) if (type == stringType)
delete value.stringValue; delete value.stringValue;
@@ -45,13 +45,8 @@ void var::releaseValue() throw()
value.objectValue->decReferenceCount(); value.objectValue->decReferenceCount();
} }
var::~var()
{
releaseValue();
}
//============================================================================== //==============================================================================
var::var (const var& valueToCopy) throw()
var::var (const var& valueToCopy)
: type (valueToCopy.type), : type (valueToCopy.type),
value (valueToCopy.value) value (valueToCopy.value)
{ {
@@ -79,25 +74,25 @@ var::var (const double value_) throw()
value.doubleValue = value_; value.doubleValue = value_;
} }
var::var (const String& value_) throw()
var::var (const String& value_)
: type (stringType) : type (stringType)
{ {
value.stringValue = new String (value_); value.stringValue = new String (value_);
} }
var::var (const char* const value_) throw()
var::var (const char* const value_)
: type (stringType) : type (stringType)
{ {
value.stringValue = new String (value_); value.stringValue = new String (value_);
} }
var::var (const juce_wchar* const value_) throw()
var::var (const juce_wchar* const value_)
: type (stringType) : type (stringType)
{ {
value.stringValue = new String (value_); value.stringValue = new String (value_);
} }
var::var (DynamicObject* const object) throw()
var::var (DynamicObject* const object)
: type (objectType) : type (objectType)
{ {
value.objectValue = object; value.objectValue = object;
@@ -113,131 +108,24 @@ var::var (MethodFunction method_) throw()
} }
//============================================================================== //==============================================================================
const var& var::operator= (const var& valueToCopy) throw()
{
if (this != &valueToCopy)
{
if (type == valueToCopy.type)
{
switch (type)
{
case voidType:
break;
case intType:
case boolType:
case doubleType:
value = valueToCopy.value;
break;
case stringType:
*(value.stringValue) = *(valueToCopy.value.stringValue);
break;
case objectType:
if (valueToCopy.value.objectValue != 0)
valueToCopy.value.objectValue->incReferenceCount();
if (value.objectValue != 0)
value.objectValue->decReferenceCount();
value.objectValue = valueToCopy.value.objectValue;
break;
default:
jassertfalse;
break;
}
}
else
{
releaseValue();
type = valueToCopy.type;
if (type == stringType)
{
value.stringValue = new String (*(valueToCopy.value.stringValue));
}
else
{
value = valueToCopy.value;
if (type == objectType && value.objectValue != 0)
value.objectValue->incReferenceCount();
}
}
}
return *this;
}
const var& var::operator= (const int value_) throw()
{
releaseValue();
type = intType;
value.intValue = value_;
return *this;
}
const var& var::operator= (const bool value_) throw()
{
releaseValue();
type = boolType;
value.boolValue = value_;
return *this;
}
const var& var::operator= (const double value_) throw()
{
releaseValue();
type = doubleType;
value.doubleValue = value_;
return *this;
}
const var& var::operator= (const char* const value_) throw()
{
releaseValue();
type = stringType;
value.stringValue = new String (value_);
return *this;
}
const var& var::operator= (const juce_wchar* const value_) throw()
{
releaseValue();
type = stringType;
value.stringValue = new String (value_);
return *this;
}
const var& var::operator= (const String& value_) throw()
void var::swapWith (var& other) throw()
{ {
releaseValue();
type = stringType;
value.stringValue = new String (value_);
return *this;
}
const var& var::operator= (DynamicObject* const value_) throw()
{
value_->incReferenceCount();
releaseValue();
type = objectType;
value.objectValue = value_;
return *this;
swapVariables (type, other.type);
swapVariables (value, other.value);
} }
const var& var::operator= (MethodFunction method_) throw()
{
releaseValue();
type = doubleType;
value.methodValue = method_;
return *this;
}
var& var::operator= (const var& value_) { var newValue (value_); swapWith (newValue); return *this; }
var& var::operator= (int value_) { var newValue (value_); swapWith (newValue); return *this; }
var& var::operator= (bool value_) { var newValue (value_); swapWith (newValue); return *this; }
var& var::operator= (double value_) { var newValue (value_); swapWith (newValue); return *this; }
var& var::operator= (const char* value_) { var newValue (value_); swapWith (newValue); return *this; }
var& var::operator= (const juce_wchar* value_) { var newValue (value_); swapWith (newValue); return *this; }
var& var::operator= (const String& value_) { var newValue (value_); swapWith (newValue); return *this; }
var& var::operator= (DynamicObject* value_) { var newValue (value_); swapWith (newValue); return *this; }
var& var::operator= (MethodFunction value_) { var newValue (value_); swapWith (newValue); return *this; }
//============================================================================== //==============================================================================
var::operator int() const throw()
var::operator int() const
{ {
switch (type) switch (type)
{ {
@@ -253,7 +141,7 @@ var::operator int() const throw()
return 0; return 0;
} }
var::operator bool() const throw()
var::operator bool() const
{ {
switch (type) switch (type)
{ {
@@ -271,12 +159,12 @@ var::operator bool() const throw()
return false; return false;
} }
var::operator float() const throw()
var::operator float() const
{ {
return (float) operator double(); return (float) operator double();
} }
var::operator double() const throw()
var::operator double() const
{ {
switch (type) switch (type)
{ {
@@ -292,7 +180,7 @@ var::operator double() const throw()
return 0.0; return 0.0;
} }
const String var::toString() const throw()
const String var::toString() const
{ {
switch (type) switch (type)
{ {
@@ -308,12 +196,12 @@ const String var::toString() const throw()
return String::empty; return String::empty;
} }
var::operator const String() const throw()
var::operator const String() const
{ {
return toString(); return toString();
} }
DynamicObject* var::getObject() const throw()
DynamicObject* var::getObject() const
{ {
return type == objectType ? value.objectValue : 0; return type == objectType ? value.objectValue : 0;
} }
@@ -339,7 +227,7 @@ bool var::operator!= (const var& other) const throw()
return ! operator== (other); return ! operator== (other);
} }
void var::writeToStream (OutputStream& output) const throw()
void var::writeToStream (OutputStream& output) const
{ {
switch (type) switch (type)
{ {
@@ -362,7 +250,7 @@ void var::writeToStream (OutputStream& output) const throw()
} }
} }
const var var::readFromStream (InputStream& input) throw()
const var var::readFromStream (InputStream& input)
{ {
const int numBytes = input.readCompressedInt(); const int numBytes = input.readCompressedInt();
@@ -388,7 +276,7 @@ const var var::readFromStream (InputStream& input) throw()
return var(); return var();
} }
const var var::operator[] (const var::identifier& propertyName) const throw()
const var var::operator[] (const var::identifier& propertyName) const
{ {
if (type == objectType && value.objectValue != 0) if (type == objectType && value.objectValue != 0)
return value.objectValue->getProperty (propertyName); return value.objectValue->getProperty (propertyName);
@@ -453,21 +341,21 @@ const var var::call (const var::identifier& method, const var& arg1, const var&
//============================================================================== //==============================================================================
var::identifier::identifier (const String& name_) throw()
var::identifier::identifier (const String& name_)
: name (name_), : name (name_),
hashCode (name_.hashCode()) hashCode (name_.hashCode())
{ {
jassert (name_.isNotEmpty()); jassert (name_.isNotEmpty());
} }
var::identifier::identifier (const char* const name_) throw()
var::identifier::identifier (const char* const name_)
: name (name_), : name (name_),
hashCode (name.hashCode()) hashCode (name.hashCode())
{ {
jassert (name.isNotEmpty()); jassert (name.isNotEmpty());
} }
var::identifier::~identifier() throw()
var::identifier::~identifier()
{ {
} }
@@ -531,13 +419,13 @@ const var DynamicObject::invokeMethod (const var::identifier& methodName,
const var* parameters, const var* parameters,
int numParameters) int numParameters)
{ {
return getProperty (methodName).invoke (this, parameters, numParameters);
return getProperty (methodName).invoke (var (this), parameters, numParameters);
} }
void DynamicObject::setMethod (const var::identifier& name, void DynamicObject::setMethod (const var::identifier& name,
var::MethodFunction methodFunction) var::MethodFunction methodFunction)
{ {
setProperty (name, methodFunction);
setProperty (name, var (methodFunction));
} }
void DynamicObject::clear() void DynamicObject::clear()


+ 34
- 33
src/containers/juce_Variant.h View File

@@ -59,33 +59,35 @@ public:
/** Destructor. */ /** Destructor. */
~var(); ~var();
var (const var& valueToCopy) throw();
var (const var& valueToCopy);
var (const int value) throw(); var (const int value) throw();
var (const bool value) throw(); var (const bool value) throw();
var (const double value) throw(); var (const double value) throw();
var (const char* const value) throw();
var (const juce_wchar* const value) throw();
var (const String& value) throw();
var (DynamicObject* const object) throw();
var (const char* const value);
var (const juce_wchar* const value);
var (const String& value);
var (DynamicObject* const object);
var (MethodFunction method) throw(); var (MethodFunction method) throw();
const var& operator= (const var& valueToCopy) throw();
const var& operator= (const int value) throw();
const var& operator= (const bool value) throw();
const var& operator= (const double value) throw();
const var& operator= (const char* const value) throw();
const var& operator= (const juce_wchar* const value) throw();
const var& operator= (const String& value) throw();
const var& operator= (DynamicObject* const object) throw();
const var& operator= (MethodFunction method) throw();
operator int() const throw();
operator bool() const throw();
operator float() const throw();
operator double() const throw();
operator const String() const throw();
const String toString() const throw();
DynamicObject* getObject() const throw();
var& operator= (const var& valueToCopy);
var& operator= (int value);
var& operator= (bool value);
var& operator= (double value);
var& operator= (const char* value);
var& operator= (const juce_wchar* value);
var& operator= (const String& value);
var& operator= (DynamicObject* object);
var& operator= (MethodFunction method);
void swapWith (var& other) throw();
operator int() const;
operator bool() const;
operator float() const;
operator double() const;
operator const String() const;
const String toString() const;
DynamicObject* getObject() const;
bool isVoid() const throw() { return type == voidType; } bool isVoid() const throw() { return type == voidType; }
bool isInt() const throw() { return type == intType; } bool isInt() const throw() { return type == intType; }
@@ -102,21 +104,21 @@ public:
/** Writes a binary representation of this value to a stream. /** Writes a binary representation of this value to a stream.
The data can be read back later using readFromStream(). The data can be read back later using readFromStream().
*/ */
void writeToStream (OutputStream& output) const throw();
void writeToStream (OutputStream& output) const;
/** Reads back a stored binary representation of a value. /** Reads back a stored binary representation of a value.
The data in the stream must have been written using writeToStream(), or this The data in the stream must have been written using writeToStream(), or this
will have unpredictable results. will have unpredictable results.
*/ */
static const var readFromStream (InputStream& input) throw();
static const var readFromStream (InputStream& input);
//============================================================================== //==============================================================================
class JUCE_API identifier class JUCE_API identifier
{ {
public: public:
identifier (const char* const name) throw();
identifier (const String& name) throw();
~identifier() throw();
identifier (const char* const name);
identifier (const String& name);
~identifier();
bool operator== (const identifier& other) const throw() bool operator== (const identifier& other) const throw()
{ {
@@ -129,7 +131,7 @@ public:
}; };
/** If this variant is an object, this returns one of its properties. */ /** If this variant is an object, this returns one of its properties. */
const var operator[] (const identifier& propertyName) const throw();
const var operator[] (const identifier& propertyName) const;
//============================================================================== //==============================================================================
/** If this variant is an object, this invokes one of its methods with no arguments. */ /** If this variant is an object, this invokes one of its methods with no arguments. */
@@ -167,9 +169,7 @@ private:
methodType methodType
}; };
Type type;
union
union ValueUnion
{ {
int intValue; int intValue;
bool boolValue; bool boolValue;
@@ -177,9 +177,10 @@ private:
String* stringValue; String* stringValue;
DynamicObject* objectValue; DynamicObject* objectValue;
MethodFunction methodValue; MethodFunction methodValue;
} value;
};
void releaseValue() throw();
Type type;
ValueUnion value;
}; };
//============================================================================== //==============================================================================


+ 26
- 2
src/core/juce_PlatformUtilities.h View File

@@ -196,9 +196,9 @@ public:
}; };
//==============================================================================
#if JUCE_MAC || JUCE_IPHONE #if JUCE_MAC || JUCE_IPHONE
//==============================================================================
/** A handy C++ wrapper that creates and deletes an NSAutoreleasePool object /** A handy C++ wrapper that creates and deletes an NSAutoreleasePool object
using RAII. using RAII.
*/ */
@@ -217,9 +217,33 @@ private:
#endif #endif
#if JUCE_MAC
//============================================================================== //==============================================================================
#if JUCE_LINUX
/** A handy class that uses XLockDisplay and XUnlockDisplay to lock the X server
using an RAII approach.
*/
class ScopedXLock
{
public:
/** Creating a ScopedXLock object locks the X display.
This uses XLockDisplay() to grab the display that Juce is using.
*/
ScopedXLock();
/** Deleting a ScopedXLock object unlocks the X display.
This calls XUnlockDisplay() to release the lock.
*/
~ScopedXLock();
};
#endif
//==============================================================================
#if JUCE_MAC
/** /**
A wrapper class for picking up events from an Apple IR remote control device. A wrapper class for picking up events from an Apple IR remote control device.


+ 1
- 3
src/core/juce_Uuid.cpp View File

@@ -76,9 +76,7 @@ Uuid::Uuid (const Uuid& other)
Uuid& Uuid::operator= (const Uuid& other) Uuid& Uuid::operator= (const Uuid& other)
{ {
if (this != &other)
value = other.value;
value = other.value;
return *this; return *this;
} }


+ 1
- 4
src/gui/components/filebrowser/juce_DirectoryContentsDisplayComponent.h View File

@@ -77,14 +77,11 @@ public:
//============================================================================== //==============================================================================
/** A set of colour IDs to use to change the colour of various aspects of the label.
/** A set of colour IDs to use to change the colour of various aspects of the list.
These constants can be used either via the Component::setColour(), or LookAndFeel::setColour() These constants can be used either via the Component::setColour(), or LookAndFeel::setColour()
methods. methods.
Note that you can also use the constants from TextEditor::ColourIds to change the
colour of the text editor that is opened when a label is editable.
@see Component::setColour, Component::findColour, LookAndFeel::setColour, LookAndFeel::findColour @see Component::setColour, Component::findColour, LookAndFeel::setColour, LookAndFeel::findColour
*/ */
enum ColourIds enum ColourIds


+ 1
- 1
src/gui/components/filebrowser/juce_FileChooserDialogBox.cpp View File

@@ -156,7 +156,7 @@ FileChooserDialogBox::ContentComponent::~ContentComponent()
void FileChooserDialogBox::ContentComponent::paint (Graphics& g) void FileChooserDialogBox::ContentComponent::paint (Graphics& g)
{ {
g.setColour (Colours::black);
g.setColour (getLookAndFeel().findColour (FileChooserDialogBox::titleTextColourId));
text.draw (g); text.draw (g);
} }


+ 13
- 0
src/gui/components/filebrowser/juce_FileChooserDialogBox.h View File

@@ -106,6 +106,19 @@ public:
bool show (int width = 0,int height = 0); bool show (int width = 0,int height = 0);
//==============================================================================
/** A set of colour IDs to use to change the colour of various aspects of the box.
These constants can be used either via the Component::setColour(), or LookAndFeel::setColour()
methods.
@see Component::setColour, Component::findColour, LookAndFeel::setColour, LookAndFeel::findColour
*/
enum ColourIds
{
titleTextColourId = 0x1000850, /**< The colour to use to draw the box's title. */
};
//============================================================================== //==============================================================================
/** @internal */ /** @internal */
void buttonClicked (Button* button); void buttonClicked (Button* button);


+ 24
- 21
src/gui/components/lookandfeel/juce_LookAndFeel.cpp View File

@@ -55,6 +55,7 @@ BEGIN_JUCE_NAMESPACE
#include "../filebrowser/juce_DirectoryContentsDisplayComponent.h" #include "../filebrowser/juce_DirectoryContentsDisplayComponent.h"
#include "../filebrowser/juce_FileSearchPathListComponent.h" #include "../filebrowser/juce_FileSearchPathListComponent.h"
#include "../filebrowser/juce_FileBrowserComponent.h" #include "../filebrowser/juce_FileBrowserComponent.h"
#include "../filebrowser/juce_FileChooserDialogBox.h"
#include "../layout/juce_GroupComponent.h" #include "../layout/juce_GroupComponent.h"
#include "../properties/juce_PropertyComponent.h" #include "../properties/juce_PropertyComponent.h"
#include "../juce_Desktop.h" #include "../juce_Desktop.h"
@@ -198,33 +199,35 @@ LookAndFeel::LookAndFeel()
GroupComponent::outlineColourId, 0x66000000, GroupComponent::outlineColourId, 0x66000000,
GroupComponent::textColourId, 0xff000000, GroupComponent::textColourId, 0xff000000,
DirectoryContentsDisplayComponent::highlightColourId, textHighlightColour,
DirectoryContentsDisplayComponent::textColourId, 0xff000000,
DirectoryContentsDisplayComponent::highlightColourId, textHighlightColour,
DirectoryContentsDisplayComponent::textColourId, 0xff000000,
0x1000440, /*LassoComponent::lassoFillColourId*/ 0x66dddddd,
0x1000441, /*LassoComponent::lassoOutlineColourId*/ 0x99111111,
0x1000440, /*LassoComponent::lassoFillColourId*/ 0x66dddddd,
0x1000441, /*LassoComponent::lassoOutlineColourId*/ 0x99111111,
MidiKeyboardComponent::whiteNoteColourId, 0xffffffff,
MidiKeyboardComponent::blackNoteColourId, 0xff000000,
MidiKeyboardComponent::keySeparatorLineColourId, 0x66000000,
MidiKeyboardComponent::mouseOverKeyOverlayColourId, 0x80ffff00,
MidiKeyboardComponent::keyDownOverlayColourId, 0xffb6b600,
MidiKeyboardComponent::textLabelColourId, 0xff000000,
MidiKeyboardComponent::upDownButtonBackgroundColourId, 0xffd3d3d3,
MidiKeyboardComponent::upDownButtonArrowColourId, 0xff000000,
MidiKeyboardComponent::whiteNoteColourId, 0xffffffff,
MidiKeyboardComponent::blackNoteColourId, 0xff000000,
MidiKeyboardComponent::keySeparatorLineColourId, 0x66000000,
MidiKeyboardComponent::mouseOverKeyOverlayColourId, 0x80ffff00,
MidiKeyboardComponent::keyDownOverlayColourId, 0xffb6b600,
MidiKeyboardComponent::textLabelColourId, 0xff000000,
MidiKeyboardComponent::upDownButtonBackgroundColourId, 0xffd3d3d3,
MidiKeyboardComponent::upDownButtonArrowColourId, 0xff000000,
CodeEditorComponent::backgroundColourId, 0xffffffff,
CodeEditorComponent::caretColourId, 0xff000000,
CodeEditorComponent::highlightColourId, textHighlightColour,
CodeEditorComponent::defaultTextColourId, 0xff000000,
CodeEditorComponent::backgroundColourId, 0xffffffff,
CodeEditorComponent::caretColourId, 0xff000000,
CodeEditorComponent::highlightColourId, textHighlightColour,
CodeEditorComponent::defaultTextColourId, 0xff000000,
ColourSelector::backgroundColourId, 0xffe5e5e5,
ColourSelector::labelTextColourId, 0xff000000,
ColourSelector::backgroundColourId, 0xffe5e5e5,
ColourSelector::labelTextColourId, 0xff000000,
KeyMappingEditorComponent::backgroundColourId, 0x00000000,
KeyMappingEditorComponent::textColourId, 0xff000000,
KeyMappingEditorComponent::backgroundColourId, 0x00000000,
KeyMappingEditorComponent::textColourId, 0xff000000,
FileSearchPathListComponent::backgroundColourId, 0xffffffff,
FileSearchPathListComponent::backgroundColourId, 0xffffffff,
FileChooserDialogBox::titleTextColourId, 0xff000000,
}; };
for (int i = 0; i < numElementsInArray (standardColours); i += 2) for (int i = 0; i < numElementsInArray (standardColours); i += 2)


+ 2
- 1
src/gui/components/special/juce_MidiKeyboardComponent.cpp View File

@@ -309,7 +309,8 @@ int MidiKeyboardComponent::remappedXYToNote (int x, int y, float& mousePositionV
if (x >= kx && x < kx + kw) if (x >= kx && x < kx + kw)
{ {
mousePositionVelocity = y / (float) getHeight();
const int whiteNoteLength = (orientation == horizontalKeyboard) ? getHeight() : getWidth();
mousePositionVelocity = y / (float) whiteNoteLength;
return note; return note;
} }
} }


+ 8
- 11
src/gui/graphics/geometry/juce_PositionedRectangle.cpp View File

@@ -57,17 +57,14 @@ PositionedRectangle::PositionedRectangle (const PositionedRectangle& other) thro
const PositionedRectangle& PositionedRectangle::operator= (const PositionedRectangle& other) throw() const PositionedRectangle& PositionedRectangle::operator= (const PositionedRectangle& other) throw()
{ {
if (this != &other)
{
x = other.x;
y = other.y;
w = other.w;
h = other.h;
xMode = other.xMode;
yMode = other.yMode;
wMode = other.wMode;
hMode = other.hMode;
}
x = other.x;
y = other.y;
w = other.w;
h = other.h;
xMode = other.xMode;
yMode = other.yMode;
wMode = other.wMode;
hMode = other.hMode;
return *this; return *this;
} }


+ 1
- 3
src/gui/graphics/geometry/juce_RectangleList.cpp View File

@@ -49,9 +49,7 @@ RectangleList::RectangleList (const RectangleList& other) throw()
const RectangleList& RectangleList::operator= (const RectangleList& other) throw() const RectangleList& RectangleList::operator= (const RectangleList& other) throw()
{ {
if (this != &other)
rects = other.rects;
rects = other.rects;
return *this; return *this;
} }


+ 64
- 16
src/native/linux/juce_linux_Messaging.cpp View File

@@ -52,14 +52,22 @@ extern void juce_windowMessageReceive (XEvent* event);
// Defined in Clipboard.cpp // Defined in Clipboard.cpp
extern void juce_handleSelectionRequest (XSelectionRequestEvent &evt); extern void juce_handleSelectionRequest (XSelectionRequestEvent &evt);
//==============================================================================
ScopedXLock::ScopedXLock() { XLockDisplay (display); }
ScopedXLock::~ScopedXLock() { XUnlockDisplay (display); }
//============================================================================== //==============================================================================
class InternalMessageQueue class InternalMessageQueue
{ {
public: public:
InternalMessageQueue() InternalMessageQueue()
: bytesInSocket (0)
{ {
int ret = ::socketpair (AF_LOCAL, SOCK_STREAM, 0, fd); int ret = ::socketpair (AF_LOCAL, SOCK_STREAM, 0, fd);
(void) ret; jassert (ret == 0); (void) ret; jassert (ret == 0);
setNonBlocking (fd[0]);
setNonBlocking (fd[1]);
} }
~InternalMessageQueue() ~InternalMessageQueue()
@@ -70,11 +78,20 @@ public:
void postMessage (Message* msg) void postMessage (Message* msg)
{ {
const int maxBytesInSocketQueue = 128;
ScopedLock sl (lock); ScopedLock sl (lock);
queue.add (msg); queue.add (msg);
const unsigned char x = 0xff;
write (fd[0], &x, 1);
if (bytesInSocket < maxBytesInSocketQueue)
{
++bytesInSocket;
ScopedUnlock ul (lock);
const unsigned char x = 0xff;
size_t bytesWritten = write (fd[0], &x, 1);
(void) bytesWritten;
}
} }
bool isEmpty() const bool isEmpty() const
@@ -83,20 +100,22 @@ public:
return queue.size() == 0; return queue.size() == 0;
} }
Message* popMessage()
Message* popNextMessage()
{ {
Message* m = 0;
ScopedLock sl (lock); ScopedLock sl (lock);
if (queue.size() != 0)
if (bytesInSocket > 0)
{ {
unsigned char x;
read (fd[1], &x, 1);
--bytesInSocket;
m = queue.getUnchecked(0);
queue.remove (0, false /* deleteObject */);
ScopedUnlock ul (lock);
unsigned char x;
size_t numBytes = read (fd[1], &x, 1);
(void) numBytes;
} }
Message* m = queue[0];
queue.remove (0, false /* deleteObject */);
return m; return m;
} }
@@ -106,6 +125,19 @@ private:
CriticalSection lock; CriticalSection lock;
OwnedArray <Message> queue; OwnedArray <Message> queue;
int fd[2]; int fd[2];
int bytesInSocket;
static bool setNonBlocking (int handle)
{
int socketFlags = fcntl (handle, F_GETFL, 0);
if (socketFlags == -1)
return false;
socketFlags |= O_NONBLOCK;
return fcntl (handle, F_SETFL, socketFlags) == 0;
}
}; };
//============================================================================== //==============================================================================
@@ -370,9 +402,16 @@ void* MessageManager::callFunctionOnMessageThread (MessageCallbackFunction* func
// Wait for an event (either XEvent, or an internal Message) // Wait for an event (either XEvent, or an internal Message)
static bool juce_sleepUntilEvent (const int timeoutMs) static bool juce_sleepUntilEvent (const int timeoutMs)
{ {
if ((display != 0 && XPending (display)) || ! juce_internalMessageQueue->isEmpty())
if (! juce_internalMessageQueue->isEmpty())
return true; return true;
if (display != 0)
{
ScopedXLock xlock;
if (XPending (display))
return true;
}
struct timeval tv; struct timeval tv;
tv.tv_sec = 0; tv.tv_sec = 0;
tv.tv_usec = timeoutMs * 1000; tv.tv_usec = timeoutMs * 1000;
@@ -385,23 +424,32 @@ static bool juce_sleepUntilEvent (const int timeoutMs)
if (display != 0) if (display != 0)
{ {
ScopedXLock xlock;
int fd1 = XConnectionNumber (display); int fd1 = XConnectionNumber (display);
FD_SET (fd1, &readset); FD_SET (fd1, &readset);
fdmax = jmax (fd0, fd1); fdmax = jmax (fd0, fd1);
} }
int ret = select (fdmax + 1, &readset, 0, 0, &tv);
const int ret = select (fdmax + 1, &readset, 0, 0, &tv);
return (ret > 0); // ret <= 0 if error or timeout return (ret > 0); // ret <= 0 if error or timeout
} }
// Handle next XEvent (if any) // Handle next XEvent (if any)
static bool juce_dispatchNextXEvent() static bool juce_dispatchNextXEvent()
{ {
if (display == 0 || ! XPending (display))
if (display == 0)
return false; return false;
XEvent evt; XEvent evt;
XNextEvent (display, &evt);
{
ScopedXLock xlock;
if (! XPending (display))
return false;
XNextEvent (display, &evt);
}
if (evt.type == SelectionRequest && evt.xany.window == juce_messageWindowHandle) if (evt.type == SelectionRequest && evt.xany.window == juce_messageWindowHandle)
{ {
@@ -418,10 +466,10 @@ static bool juce_dispatchNextXEvent()
// Handle next internal Message (if any) // Handle next internal Message (if any)
static bool juce_dispatchNextInternalMessage() static bool juce_dispatchNextInternalMessage()
{ {
if (juce_internalMessageQueue->isEmpty())
return false;
ScopedPointer <Message> msg (juce_internalMessageQueue->popNextMessage());
ScopedPointer <Message> msg (juce_internalMessageQueue->popMessage());
if (msg == 0)
return false;
if (msg->intParameter1 == MessageThreadFuncCall::uniqueID) if (msg->intParameter1 == MessageThreadFuncCall::uniqueID)
{ {


+ 97
- 14
src/native/linux/juce_linux_Windowing.cpp View File

@@ -130,6 +130,7 @@ static void getMousePos (int& x, int& y, int& mouseMods) throw()
unsigned int mask; unsigned int mask;
mouseMods = 0; mouseMods = 0;
ScopedXLock xlock;
if (XQueryPointer (display, if (XQueryPointer (display,
RootWindow (display, DefaultScreen (display)), RootWindow (display, DefaultScreen (display)),
@@ -201,6 +202,7 @@ bool KeyPress::isKeyCurrentlyDown (const int keyCode) throw()
} }
} }
ScopedXLock xlock;
return keyDown (XKeysymToKeycode (display, keysym)); return keyDown (XKeysymToKeycode (display, keysym));
} }
@@ -209,6 +211,7 @@ bool KeyPress::isKeyCurrentlyDown (const int keyCode) throw()
// modifier constants: check what they're mapped to // modifier constants: check what they're mapped to
static void getModifierMapping() throw() static void getModifierMapping() throw()
{ {
ScopedXLock xlock;
const int altLeftCode = XKeysymToKeycode (display, XK_Alt_L); const int altLeftCode = XKeysymToKeycode (display, XK_Alt_L);
const int numLockCode = XKeysymToKeycode (display, XK_Num_Lock); const int numLockCode = XKeysymToKeycode (display, XK_Num_Lock);
@@ -325,6 +328,8 @@ static bool updateKeyModifiersFromSym (KeySym sym, const bool press) throw()
#if JUCE_USE_XSHM #if JUCE_USE_XSHM
static bool isShmAvailable() throw() static bool isShmAvailable() throw()
{ {
ScopedXLock xlock;
static bool isChecked = false; static bool isChecked = false;
static bool isAvailable = false; static bool isAvailable = false;
@@ -384,6 +389,8 @@ static bool isShmAvailable() throw()
//============================================================================== //==============================================================================
static Pixmap juce_createColourPixmapFromImage (Display* display, const Image& image) static Pixmap juce_createColourPixmapFromImage (Display* display, const Image& image)
{ {
ScopedXLock xlock;
const int width = image.getWidth(); const int width = image.getWidth();
const int height = image.getHeight(); const int height = image.getHeight();
HeapBlock <uint32> colour (width * height); HeapBlock <uint32> colour (width * height);
@@ -408,6 +415,8 @@ static Pixmap juce_createColourPixmapFromImage (Display* display, const Image& i
static Pixmap juce_createMaskPixmapFromImage (Display* display, const Image& image) static Pixmap juce_createMaskPixmapFromImage (Display* display, const Image& image)
{ {
ScopedXLock xlock;
const int width = image.getWidth(); const int width = image.getWidth();
const int height = image.getHeight(); const int height = image.getHeight();
const int stride = (width + 7) >> 3; const int stride = (width + 7) >> 3;
@@ -447,6 +456,7 @@ public:
pixelStride = (format_ == RGB) ? 3 : 4; pixelStride = (format_ == RGB) ? 3 : 4;
lineStride = ((w * pixelStride + 3) & ~3); lineStride = ((w * pixelStride + 3) & ~3);
ScopedXLock xlock;
Visual* const visual = DefaultVisual (display, DefaultScreen (display)); Visual* const visual = DefaultVisual (display, DefaultScreen (display));
#if JUCE_USE_XSHM #if JUCE_USE_XSHM
@@ -545,6 +555,8 @@ public:
~XBitmapImage() ~XBitmapImage()
{ {
ScopedXLock xlock;
#if JUCE_USE_XSHM #if JUCE_USE_XSHM
if (usingXShm) if (usingXShm)
{ {
@@ -566,6 +578,8 @@ public:
void blitToWindow (Window window, int dx, int dy, int dw, int dh, int sx, int sy) void blitToWindow (Window window, int dx, int dy, int dw, int dh, int sx, int sy)
{ {
ScopedXLock xlock;
static GC gc = 0; static GC gc = 0;
if (gc == 0) if (gc == 0)
@@ -688,6 +702,7 @@ public:
{ {
XPointer peer = 0; XPointer peer = 0;
ScopedXLock xlock;
if (! XFindContext (display, (XID) windowHandle, improbableNumber, &peer)) if (! XFindContext (display, (XID) windowHandle, improbableNumber, &peer))
{ {
if (peer != 0 && ! ((LinuxComponentPeer*) peer)->isValidMessageListener()) if (peer != 0 && ! ((LinuxComponentPeer*) peer)->isValidMessageListener())
@@ -699,6 +714,7 @@ public:
void setVisible (bool shouldBeVisible) void setVisible (bool shouldBeVisible)
{ {
ScopedXLock xlock;
if (shouldBeVisible) if (shouldBeVisible)
XMapWindow (display, windowH); XMapWindow (display, windowH);
else else
@@ -733,6 +749,8 @@ public:
ww = jmax (1, w); ww = jmax (1, w);
wh = jmax (1, h); wh = jmax (1, h);
ScopedXLock xlock;
// Make sure the Window manager does what we want // Make sure the Window manager does what we want
XSizeHints* hints = XAllocSizeHints(); XSizeHints* hints = XAllocSizeHints();
hints->flags = USSize | USPosition; hints->flags = USSize | USPosition;
@@ -807,6 +825,7 @@ public:
clientMsg.message_type = wm_ChangeState; clientMsg.message_type = wm_ChangeState;
clientMsg.data.l[0] = IconicState; clientMsg.data.l[0] = IconicState;
ScopedXLock xlock;
XSendEvent (display, root, false, XSendEvent (display, root, false,
SubstructureRedirectMask | SubstructureNotifyMask, SubstructureRedirectMask | SubstructureNotifyMask,
(XEvent*) &clientMsg); (XEvent*) &clientMsg);
@@ -826,6 +845,7 @@ public:
Atom actualType; Atom actualType;
int actualFormat; int actualFormat;
ScopedXLock xlock;
if (XGetWindowProperty (display, windowH, wm_State, 0, 64, False, if (XGetWindowProperty (display, windowH, wm_State, 0, 64, False,
wm_State, &actualType, &actualFormat, &nitems, &bytesLeft, wm_State, &actualType, &actualFormat, &nitems, &bytesLeft,
&stateProp) == Success &stateProp) == Success
@@ -871,6 +891,7 @@ public:
uint32 windowListSize = 0; uint32 windowListSize = 0;
Window parent, root; Window parent, root;
ScopedXLock xlock;
if (XQueryTree (display, windowH, &root, &parent, &windowList, &windowListSize) != 0) if (XQueryTree (display, windowH, &root, &parent, &windowList, &windowListSize) != 0)
{ {
if (windowList != 0) if (windowList != 0)
@@ -888,6 +909,7 @@ public:
uint32 windowListSize = 0; uint32 windowListSize = 0;
bool result = false; bool result = false;
ScopedXLock xlock;
Window parent, root = RootWindow (display, DefaultScreen (display)); Window parent, root = RootWindow (display, DefaultScreen (display));
if (XQueryTree (display, root, &root, &parent, &windowList, &windowListSize) != 0) if (XQueryTree (display, root, &root, &parent, &windowList, &windowListSize) != 0)
@@ -945,6 +967,7 @@ public:
unsigned int bw, depth; unsigned int bw, depth;
int wx, wy, w, h; int wx, wy, w, h;
ScopedXLock xlock;
if (! XGetGeometry (display, (::Drawable) windowH, &root, if (! XGetGeometry (display, (::Drawable) windowH, &root,
&wx, &wy, (unsigned int*) &w, (unsigned int*) &h, &wx, &wy, (unsigned int*) &w, (unsigned int*) &h,
&bw, &depth)) &bw, &depth))
@@ -972,10 +995,13 @@ public:
if (wasVisible) if (wasVisible)
setVisible (false); // doesn't always seem to work if the window is visible when this is done.. setVisible (false); // doesn't always seem to work if the window is visible when this is done..
XSetWindowAttributes swa;
swa.override_redirect = alwaysOnTop ? True : False;
{
ScopedXLock xlock;
XSetWindowAttributes swa;
swa.override_redirect = alwaysOnTop ? True : False;
XChangeWindowAttributes (display, windowH, CWOverrideRedirect, &swa);
XChangeWindowAttributes (display, windowH, CWOverrideRedirect, &swa);
}
if (wasVisible) if (wasVisible)
setVisible (true); setVisible (true);
@@ -1005,18 +1031,21 @@ public:
ev.xclient.data.l[3] = 0; ev.xclient.data.l[3] = 0;
ev.xclient.data.l[4] = 0; ev.xclient.data.l[4] = 0;
XSendEvent (display, RootWindow (display, DefaultScreen (display)),
False,
SubstructureRedirectMask | SubstructureNotifyMask,
&ev);
{
ScopedXLock xlock;
XSendEvent (display, RootWindow (display, DefaultScreen (display)),
False,
SubstructureRedirectMask | SubstructureNotifyMask,
&ev);
XWindowAttributes attr;
XGetWindowAttributes (display, windowH, &attr);
XWindowAttributes attr;
XGetWindowAttributes (display, windowH, &attr);
if (attr.override_redirect)
XRaiseWindow (display, windowH);
if (attr.override_redirect)
XRaiseWindow (display, windowH);
XSync (display, False);
XSync (display, False);
}
handleBroughtToFront(); handleBroughtToFront();
} }
@@ -1032,6 +1061,7 @@ public:
Window newStack[] = { otherPeer->windowH, windowH }; Window newStack[] = { otherPeer->windowH, windowH };
ScopedXLock xlock;
XRestackWindows (display, newStack, 2); XRestackWindows (display, newStack, 2);
} }
} }
@@ -1040,6 +1070,7 @@ public:
{ {
int revert; int revert;
Window focusedWindow = 0; Window focusedWindow = 0;
ScopedXLock xlock;
XGetInputFocus (display, &focusedWindow, &revert); XGetInputFocus (display, &focusedWindow, &revert);
return focusedWindow == windowH; return focusedWindow == windowH;
@@ -1048,6 +1079,7 @@ public:
void grabFocus() void grabFocus()
{ {
XWindowAttributes atts; XWindowAttributes atts;
ScopedXLock xlock;
if (windowH != 0 if (windowH != 0
&& XGetWindowAttributes (display, windowH, &atts) && XGetWindowAttributes (display, windowH, &atts)
@@ -1092,6 +1124,7 @@ public:
for (int x = 0; x < newIcon.getWidth(); ++x) for (int x = 0; x < newIcon.getWidth(); ++x)
data[index++] = newIcon.getPixelAt (x, y).getARGB(); data[index++] = newIcon.getPixelAt (x, y).getARGB();
ScopedXLock xlock;
XChangeProperty (display, windowH, XChangeProperty (display, windowH,
XInternAtom (display, "_NET_WM_ICON", False), XInternAtom (display, "_NET_WM_ICON", False),
XA_CARDINAL, 32, PropModeReplace, XA_CARDINAL, 32, PropModeReplace,
@@ -1116,6 +1149,7 @@ public:
void deleteIconPixmaps() void deleteIconPixmaps()
{ {
ScopedXLock xlock;
XWMHints* wmHints = XGetWMHints (display, windowH); XWMHints* wmHints = XGetWMHints (display, windowH);
if (wmHints != 0) if (wmHints != 0)
@@ -1144,6 +1178,7 @@ public:
{ {
case 2: // 'KeyPress' case 2: // 'KeyPress'
{ {
ScopedXLock xlock;
XKeyEvent* const keyEvent = (XKeyEvent*) &event->xkey; XKeyEvent* const keyEvent = (XKeyEvent*) &event->xkey;
updateKeyStates (keyEvent->keycode, true); updateKeyStates (keyEvent->keycode, true);
@@ -1254,6 +1289,7 @@ public:
const XKeyEvent* const keyEvent = (const XKeyEvent*) &event->xkey; const XKeyEvent* const keyEvent = (const XKeyEvent*) &event->xkey;
updateKeyStates (keyEvent->keycode, false); updateKeyStates (keyEvent->keycode, false);
ScopedXLock xlock;
KeySym sym = XKeycodeToKeysym (display, keyEvent->keycode, 0); KeySym sym = XKeycodeToKeysym (display, keyEvent->keycode, 0);
const int oldMods = currentModifiers; const int oldMods = currentModifiers;
@@ -1363,7 +1399,11 @@ public:
Window wRoot = 0, wParent = 0; Window wRoot = 0, wParent = 0;
Window* wChild = 0; Window* wChild = 0;
unsigned int numChildren; unsigned int numChildren;
XQueryTree (display, windowH, &wRoot, &wParent, &wChild, &numChildren);
{
ScopedXLock xlock;
XQueryTree (display, windowH, &wRoot, &wParent, &wChild, &numChildren);
}
if (wParent != 0 if (wParent != 0
&& wParent != windowH && wParent != windowH
@@ -1458,6 +1498,7 @@ public:
// Batch together all pending expose events // Batch together all pending expose events
XExposeEvent* exposeEvent = (XExposeEvent*) &event->xexpose; XExposeEvent* exposeEvent = (XExposeEvent*) &event->xexpose;
XEvent nextEvent; XEvent nextEvent;
ScopedXLock xlock;
if (exposeEvent->window != windowH) if (exposeEvent->window != windowH)
{ {
@@ -1526,7 +1567,11 @@ public:
Window wRoot = 0; Window wRoot = 0;
Window* wChild = 0; Window* wChild = 0;
unsigned int numChildren; unsigned int numChildren;
XQueryTree (display, windowH, &wRoot, &parentWindow, &wChild, &numChildren);
{
ScopedXLock xlock;
XQueryTree (display, windowH, &wRoot, &parentWindow, &wChild, &numChildren);
}
if (parentWindow == windowH || parentWindow == wRoot) if (parentWindow == windowH || parentWindow == wRoot)
parentWindow = 0; parentWindow = 0;
@@ -1553,6 +1598,7 @@ public:
if (mappingEvent->request != MappingPointer) if (mappingEvent->request != MappingPointer)
{ {
// Deal with modifier/keyboard mapping // Deal with modifier/keyboard mapping
ScopedXLock xlock;
XRefreshKeyboardMapping (mappingEvent); XRefreshKeyboardMapping (mappingEvent);
getModifierMapping(); getModifierMapping();
} }
@@ -1572,6 +1618,7 @@ public:
{ {
XWindowAttributes atts; XWindowAttributes atts;
ScopedXLock xlock;
if (clientMsg->window != 0 if (clientMsg->window != 0
&& XGetWindowAttributes (display, clientMsg->window, &atts)) && XGetWindowAttributes (display, clientMsg->window, &atts))
{ {
@@ -1622,8 +1669,11 @@ public:
default: default:
#if JUCE_USE_XSHM #if JUCE_USE_XSHM
{
ScopedXLock xlock;
if (event->xany.type == XShmGetEventBase (display)) if (event->xany.type == XShmGetEventBase (display))
repainter->notifyPaintCompleted(); repainter->notifyPaintCompleted();
}
#endif #endif
break; break;
} }
@@ -1631,12 +1681,14 @@ public:
void showMouseCursor (Cursor cursor) throw() void showMouseCursor (Cursor cursor) throw()
{ {
ScopedXLock xlock;
XDefineCursor (display, windowH, cursor); XDefineCursor (display, windowH, cursor);
} }
//============================================================================== //==============================================================================
void setTaskBarIcon (const Image& image) void setTaskBarIcon (const Image& image)
{ {
ScopedXLock xlock;
deleteTaskBarIcon(); deleteTaskBarIcon();
taskbarImage = image.createCopy(); taskbarImage = image.createCopy();
@@ -1720,6 +1772,7 @@ private:
if (useARGBImagesForRendering) if (useARGBImagesForRendering)
{ {
ScopedXLock xlock;
XShmSegmentInfo segmentinfo; XShmSegmentInfo segmentinfo;
XImage* const testImage XImage* const testImage
@@ -1764,11 +1817,13 @@ private:
void performAnyPendingRepaintsNow() void performAnyPendingRepaintsNow()
{ {
#if JUCE_USE_XSHM
if (! shmCompletedDrawing) if (! shmCompletedDrawing)
{ {
startTimer (repaintTimerPeriod); startTimer (repaintTimerPeriod);
return; return;
} }
#endif
peer->clearMaskedRegion(); peer->clearMaskedRegion();
@@ -1870,6 +1925,7 @@ private:
motifHints.flags = 2; /* MWM_HINTS_DECORATIONS */ motifHints.flags = 2; /* MWM_HINTS_DECORATIONS */
motifHints.decorations = 0; motifHints.decorations = 0;
ScopedXLock xlock;
XChangeProperty (display, wndH, hints, hints, 32, PropModeReplace, XChangeProperty (display, wndH, hints, hints, 32, PropModeReplace,
(unsigned char*) &motifHints, 4); (unsigned char*) &motifHints, 4);
} }
@@ -1880,6 +1936,7 @@ private:
{ {
long gnomeHints = 0; long gnomeHints = 0;
ScopedXLock xlock;
XChangeProperty (display, wndH, hints, hints, 32, PropModeReplace, XChangeProperty (display, wndH, hints, hints, 32, PropModeReplace,
(unsigned char*) &gnomeHints, 1); (unsigned char*) &gnomeHints, 1);
} }
@@ -1890,6 +1947,7 @@ private:
{ {
long kwmHints = 2; /*KDE_tinyDecoration*/ long kwmHints = 2; /*KDE_tinyDecoration*/
ScopedXLock xlock;
XChangeProperty (display, wndH, hints, hints, 32, PropModeReplace, XChangeProperty (display, wndH, hints, hints, 32, PropModeReplace,
(unsigned char*) &kwmHints, 1); (unsigned char*) &kwmHints, 1);
} }
@@ -1898,6 +1956,7 @@ private:
if (hints != None) if (hints != None)
{ {
ScopedXLock xlock;
int netHints [2]; int netHints [2];
int numHints = 0; int numHints = 0;
if ((styleFlags & windowIsTemporary) != 0) if ((styleFlags & windowIsTemporary) != 0)
@@ -1920,6 +1979,7 @@ private:
void addWindowButtons (Window wndH) void addWindowButtons (Window wndH)
{ {
ScopedXLock xlock;
Atom hints = XInternAtom (display, "_MOTIF_WM_HINTS", True); Atom hints = XInternAtom (display, "_MOTIF_WM_HINTS", True);
if (hints != None) if (hints != None)
@@ -1975,6 +2035,7 @@ private:
void createWindow() void createWindow()
{ {
ScopedXLock xlock;
static bool atomsInitialised = false; static bool atomsInitialised = false;
if (! atomsInitialised) if (! atomsInitialised)
@@ -2173,6 +2234,8 @@ private:
void destroyWindow() void destroyWindow()
{ {
ScopedXLock xlock;
XPointer handlePointer; XPointer handlePointer;
if (! XFindContext (display, (XID) windowH, improbableNumber, &handlePointer)) if (! XFindContext (display, (XID) windowH, improbableNumber, &handlePointer))
XDeleteContext (display, (XID) windowH, improbableNumber); XDeleteContext (display, (XID) windowH, improbableNumber);
@@ -2203,6 +2266,7 @@ private:
{ {
XTextProperty nameProperty; XTextProperty nameProperty;
char* strings[] = { (char*) title }; char* strings[] = { (char*) title };
ScopedXLock xlock;
if (XStringListToTextProperty (strings, 1, &nameProperty)) if (XStringListToTextProperty (strings, 1, &nameProperty))
{ {
@@ -2221,6 +2285,7 @@ private:
} }
else if (windowBorder.getTopAndBottom() == 0 && windowBorder.getLeftAndRight() == 0) else if (windowBorder.getTopAndBottom() == 0 && windowBorder.getLeftAndRight() == 0)
{ {
ScopedXLock xlock;
Atom hints = XInternAtom (display, "_NET_FRAME_EXTENTS", True); Atom hints = XInternAtom (display, "_NET_FRAME_EXTENTS", True);
if (hints != None) if (hints != None)
@@ -2253,6 +2318,7 @@ private:
{ {
Window root, child; Window root, child;
unsigned int bw, depth; unsigned int bw, depth;
ScopedXLock xlock;
if (! XGetGeometry (display, (::Drawable) windowH, &root, if (! XGetGeometry (display, (::Drawable) windowH, &root,
&wx, &wy, (unsigned int*) &ww, (unsigned int*) &wh, &wx, &wy, (unsigned int*) &ww, (unsigned int*) &wh,
@@ -2285,6 +2351,7 @@ private:
msg.format = 32; msg.format = 32;
msg.data.l[0] = windowH; msg.data.l[0] = windowH;
ScopedXLock xlock;
XSendEvent (display, dragAndDropSourceWindow, False, 0, (XEvent*) &msg); XSendEvent (display, dragAndDropSourceWindow, False, 0, (XEvent*) &msg);
} }
@@ -2404,6 +2471,7 @@ private:
unsigned long count = 0, remaining = 0; unsigned long count = 0, remaining = 0;
unsigned char* data = 0; unsigned char* data = 0;
ScopedXLock xlock;
XGetWindowProperty (display, dragAndDropSourceWindow, XA_XdndTypeList, XGetWindowProperty (display, dragAndDropSourceWindow, XA_XdndTypeList,
0, 0x8000000L, False, XA_ATOM, &actual, &format, 0, 0x8000000L, False, XA_ATOM, &actual, &format,
&count, &remaining, &data); &count, &remaining, &data);
@@ -2461,6 +2529,7 @@ private:
uint8* data = 0; uint8* data = 0;
unsigned long count = 0, remaining = 0; unsigned long count = 0, remaining = 0;
int format = 0; int format = 0;
ScopedXLock xlock;
if (XGetWindowProperty (display, evt->xany.window, evt->xselection.property, if (XGetWindowProperty (display, evt->xany.window, evt->xselection.property,
dropData.getSize() / 4, 65536, 1, AnyPropertyType, &actual, dropData.getSize() / 4, 65536, 1, AnyPropertyType, &actual,
@@ -2499,6 +2568,7 @@ private:
{ {
dragAndDropTimestamp = clientMsg->data.l[2]; dragAndDropTimestamp = clientMsg->data.l[2];
ScopedXLock xlock;
XConvertSelection (display, XConvertSelection (display,
XA_XdndSelection, XA_XdndSelection,
dragAndDropCurrentMimeType, dragAndDropCurrentMimeType,
@@ -2570,6 +2640,7 @@ void juce_updateMultiMonitorInfo (Array <Rectangle>& monitorCoords, const bool /
#if JUCE_USE_XINERAMA #if JUCE_USE_XINERAMA
int major_opcode, first_event, first_error; int major_opcode, first_event, first_error;
ScopedXLock xlock;
if (XQueryExtension (display, "XINERAMA", &major_opcode, &first_event, &first_error)) if (XQueryExtension (display, "XINERAMA", &major_opcode, &first_event, &first_error))
{ {
typedef Bool (*tXineramaIsActive) (Display*); typedef Bool (*tXineramaIsActive) (Display*);
@@ -2675,6 +2746,7 @@ void Desktop::getMousePosition (int& x, int& y) throw()
void Desktop::setMousePosition (int x, int y) throw() void Desktop::setMousePosition (int x, int y) throw()
{ {
ScopedXLock xlock;
Window root = RootWindow (display, DefaultScreen (display)); Window root = RootWindow (display, DefaultScreen (display));
XWarpPointer (display, None, root, 0, 0, 0, 0, x, y); XWarpPointer (display, None, root, 0, 0, 0, 0, x, y);
} }
@@ -2700,6 +2772,7 @@ void Desktop::setScreenSaverEnabled (const bool isEnabled) throw()
xScreenSaverSuspend = (tXScreenSaverSuspend) dlsym (h, "XScreenSaverSuspend"); xScreenSaverSuspend = (tXScreenSaverSuspend) dlsym (h, "XScreenSaverSuspend");
} }
ScopedXLock xlock;
if (xScreenSaverSuspend != 0) if (xScreenSaverSuspend != 0)
xScreenSaverSuspend (display, ! isEnabled); xScreenSaverSuspend (display, ! isEnabled);
} }
@@ -2713,6 +2786,7 @@ bool Desktop::isScreenSaverEnabled() throw()
//============================================================================== //==============================================================================
void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hotspotY) throw() void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hotspotY) throw()
{ {
ScopedXLock xlock;
Window root = RootWindow (display, DefaultScreen (display)); Window root = RootWindow (display, DefaultScreen (display));
const unsigned int imageW = image.getWidth(); const unsigned int imageW = image.getWidth();
const unsigned int imageH = image.getHeight(); const unsigned int imageH = image.getHeight();
@@ -2779,6 +2853,7 @@ void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hot
void juce_deleteMouseCursor (void* const cursorHandle, const bool) throw() void juce_deleteMouseCursor (void* const cursorHandle, const bool) throw()
{ {
ScopedXLock xlock;
if (cursorHandle != None) if (cursorHandle != None)
XFreeCursor (display, (Cursor) cursorHandle); XFreeCursor (display, (Cursor) cursorHandle);
} }
@@ -2889,6 +2964,7 @@ void* juce_createStandardMouseCursor (MouseCursor::StandardCursorType type) thro
return (void*) None; // Use parent cursor return (void*) None; // Use parent cursor
} }
ScopedXLock xlock;
return (void*) XCreateFontCursor (display, shape); return (void*) XCreateFontCursor (display, shape);
} }
@@ -2938,6 +3014,7 @@ public:
if (peer == 0) if (peer == 0)
return; return;
ScopedXLock xlock;
XSync (display, False); XSync (display, False);
GLint attribs [64]; GLint attribs [64];
@@ -3005,6 +3082,7 @@ public:
{ {
makeInactive(); makeInactive();
ScopedXLock xlock;
glXDestroyContext (display, renderContext); glXDestroyContext (display, renderContext);
XUnmapWindow (display, embeddedWindow); XUnmapWindow (display, embeddedWindow);
@@ -3015,17 +3093,20 @@ public:
{ {
jassert (renderContext != 0); jassert (renderContext != 0);
ScopedXLock xlock;
return glXMakeCurrent (display, embeddedWindow, renderContext) return glXMakeCurrent (display, embeddedWindow, renderContext)
&& XSync (display, False); && XSync (display, False);
} }
bool makeInactive() const throw() bool makeInactive() const throw()
{ {
ScopedXLock xlock;
return (! isActive()) || glXMakeCurrent (display, None, 0); return (! isActive()) || glXMakeCurrent (display, None, 0);
} }
bool isActive() const throw() bool isActive() const throw()
{ {
ScopedXLock xlock;
return glXGetCurrentContext() == renderContext; return glXGetCurrentContext() == renderContext;
} }
@@ -3041,12 +3122,14 @@ public:
void updateWindowPosition (int x, int y, int w, int h, int) void updateWindowPosition (int x, int y, int w, int h, int)
{ {
ScopedXLock xlock;
XMoveResizeWindow (display, embeddedWindow, XMoveResizeWindow (display, embeddedWindow,
x, y, jmax (1, w), jmax (1, h)); x, y, jmax (1, w), jmax (1, h));
} }
void swapBuffers() void swapBuffers()
{ {
ScopedXLock xlock;
glXSwapBuffers (display, embeddedWindow); glXSwapBuffers (display, embeddedWindow);
} }


+ 3
- 1
src/native/mac/juce_mac_MainMenu.mm View File

@@ -177,7 +177,9 @@ public:
keyCode: 0]; keyCode: 0];
[menu performKeyEquivalent: f35Event]; [menu performKeyEquivalent: f35Event];
[menu removeItem: item];
if ([menu indexOfItem: item] >= 0)
[menu removeItem: item]; // (this throws if the item isn't actually in the menu)
} }
static NSMenuItem* findMenuItem (NSMenu* const menu, const ApplicationCommandTarget::InvocationInfo& info) static NSMenuItem* findMenuItem (NSMenu* const menu, const ApplicationCommandTarget::InvocationInfo& info)


+ 9
- 5
src/native/windows/juce_win32_Messaging.cpp View File

@@ -149,17 +149,21 @@ bool juce_dispatchNextMessageOnSystemQueue (const bool returnIfNoPendingMessages
if (returnIfNoPendingMessages && ! PeekMessage (&m, (HWND) 0, 0, 0, 0)) if (returnIfNoPendingMessages && ! PeekMessage (&m, (HWND) 0, 0, 0, 0))
return false; return false;
if (GetMessage (&m, (HWND) 0, 0, 0) > 0)
if (GetMessage (&m, (HWND) 0, 0, 0) >= 0)
{ {
if (m.message == specialId
&& m.hwnd == juce_messageWindowHandle)
if (m.message == specialId && m.hwnd == juce_messageWindowHandle)
{ {
MessageManager::getInstance()->deliverMessage ((void*) m.lParam); MessageManager::getInstance()->deliverMessage ((void*) m.lParam);
} }
else if (m.message == WM_QUIT)
{
if (JUCEApplication::getInstance())
JUCEApplication::getInstance()->systemRequestedQuit();
}
else if (! isEventBlockedByModalComps (m)) else if (! isEventBlockedByModalComps (m))
{ {
if (GetWindowLong (m.hwnd, GWLP_USERDATA) != improbableWindowNumber
&& (m.message == WM_LBUTTONDOWN || m.message == WM_RBUTTONDOWN))
if ((m.message == WM_LBUTTONDOWN || m.message == WM_RBUTTONDOWN)
&& GetWindowLong (m.hwnd, GWLP_USERDATA) != improbableWindowNumber)
{ {
// if it's someone else's window being clicked on, and the focus is // if it's someone else's window being clicked on, and the focus is
// currently on a juce window, pass the kb focus over.. // currently on a juce window, pass the kb focus over..


+ 0
- 5
src/native/windows/juce_win32_Windowing.cpp View File

@@ -2042,11 +2042,6 @@ private:
return 0; return 0;
case WM_QUIT:
if (JUCEApplication::getInstance() != 0)
JUCEApplication::getInstance()->systemRequestedQuit();
return 0;
case WM_QUERYENDSESSION: case WM_QUERYENDSESSION:
if (JUCEApplication::getInstance() != 0) if (JUCEApplication::getInstance() != 0)
{ {


+ 31
- 50
src/text/juce_StringArray.cpp View File

@@ -36,26 +36,26 @@ StringArray::StringArray() throw()
{ {
} }
StringArray::StringArray (const StringArray& other) throw()
StringArray::StringArray (const StringArray& other)
: strings (other.strings)
{ {
addArray (other);
} }
StringArray::StringArray (const juce_wchar** const initialStrings, StringArray::StringArray (const juce_wchar** const initialStrings,
const int numberOfStrings) throw()
const int numberOfStrings)
{ {
for (int i = 0; i < numberOfStrings; ++i) for (int i = 0; i < numberOfStrings; ++i)
add (initialStrings [i]); add (initialStrings [i]);
} }
StringArray::StringArray (const char** const initialStrings, StringArray::StringArray (const char** const initialStrings,
const int numberOfStrings) throw()
const int numberOfStrings)
{ {
for (int i = 0; i < numberOfStrings; ++i) for (int i = 0; i < numberOfStrings; ++i)
add (initialStrings [i]); add (initialStrings [i]);
} }
StringArray::StringArray (const juce_wchar** const initialStrings) throw()
StringArray::StringArray (const juce_wchar** const initialStrings)
{ {
int i = 0; int i = 0;
@@ -63,7 +63,7 @@ StringArray::StringArray (const juce_wchar** const initialStrings) throw()
add (initialStrings [i++]); add (initialStrings [i++]);
} }
StringArray::StringArray (const char** const initialStrings) throw()
StringArray::StringArray (const char** const initialStrings)
{ {
int i = 0; int i = 0;
@@ -71,23 +71,17 @@ StringArray::StringArray (const char** const initialStrings) throw()
add (initialStrings [i++]); add (initialStrings [i++]);
} }
const StringArray& StringArray::operator= (const StringArray& other) throw()
const StringArray& StringArray::operator= (const StringArray& other)
{ {
if (this != &other)
{
clear();
addArray (other);
}
strings = other.strings;
return *this; return *this;
} }
StringArray::~StringArray() throw()
StringArray::~StringArray()
{ {
clear();
} }
bool StringArray::operator== (const StringArray& other) const throw()
bool StringArray::operator== (const StringArray& other) const
{ {
if (other.size() != size()) if (other.size() != size())
return false; return false;
@@ -99,12 +93,12 @@ bool StringArray::operator== (const StringArray& other) const throw()
return true; return true;
} }
bool StringArray::operator!= (const StringArray& other) const throw()
bool StringArray::operator!= (const StringArray& other) const
{ {
return ! operator== (other); return ! operator== (other);
} }
void StringArray::clear() throw()
void StringArray::clear()
{ {
strings.clear(); strings.clear();
} }
@@ -117,27 +111,23 @@ const String& StringArray::operator[] (const int index) const throw()
return String::empty; return String::empty;
} }
void StringArray::add (const String& newString) throw()
void StringArray::add (const String& newString)
{ {
strings.add (newString); strings.add (newString);
} }
void StringArray::insert (const int index,
const String& newString) throw()
void StringArray::insert (const int index, const String& newString)
{ {
strings.insert (index, newString); strings.insert (index, newString);
} }
void StringArray::addIfNotAlreadyThere (const String& newString,
const bool ignoreCase) throw()
void StringArray::addIfNotAlreadyThere (const String& newString, const bool ignoreCase)
{ {
if (! contains (newString, ignoreCase)) if (! contains (newString, ignoreCase))
add (newString); add (newString);
} }
void StringArray::addArray (const StringArray& otherArray,
int startIndex,
int numElementsToAdd) throw()
void StringArray::addArray (const StringArray& otherArray, int startIndex, int numElementsToAdd)
{ {
if (startIndex < 0) if (startIndex < 0)
{ {
@@ -152,14 +142,12 @@ void StringArray::addArray (const StringArray& otherArray,
strings.add (otherArray.strings.getReference (startIndex++)); strings.add (otherArray.strings.getReference (startIndex++));
} }
void StringArray::set (const int index,
const String& newString) throw()
void StringArray::set (const int index, const String& newString)
{ {
strings.set (index, newString); strings.set (index, newString);
} }
bool StringArray::contains (const String& stringToLookFor,
const bool ignoreCase) const throw()
bool StringArray::contains (const String& stringToLookFor, const bool ignoreCase) const
{ {
if (ignoreCase) if (ignoreCase)
{ {
@@ -177,9 +165,7 @@ bool StringArray::contains (const String& stringToLookFor,
return false; return false;
} }
int StringArray::indexOf (const String& stringToLookFor,
const bool ignoreCase,
int i) const throw()
int StringArray::indexOf (const String& stringToLookFor, const bool ignoreCase, int i) const
{ {
if (i < 0) if (i < 0)
i = 0; i = 0;
@@ -211,13 +197,13 @@ int StringArray::indexOf (const String& stringToLookFor,
} }
//============================================================================== //==============================================================================
void StringArray::remove (const int index) throw()
void StringArray::remove (const int index)
{ {
strings.remove (index); strings.remove (index);
} }
void StringArray::removeString (const String& stringToRemove, void StringArray::removeString (const String& stringToRemove,
const bool ignoreCase) throw()
const bool ignoreCase)
{ {
if (ignoreCase) if (ignoreCase)
{ {
@@ -234,7 +220,7 @@ void StringArray::removeString (const String& stringToRemove,
} }
//============================================================================== //==============================================================================
void StringArray::removeEmptyStrings (const bool removeWhitespaceStrings) throw()
void StringArray::removeEmptyStrings (const bool removeWhitespaceStrings)
{ {
if (removeWhitespaceStrings) if (removeWhitespaceStrings)
{ {
@@ -250,7 +236,7 @@ void StringArray::removeEmptyStrings (const bool removeWhitespaceStrings) throw(
} }
} }
void StringArray::trim() throw()
void StringArray::trim()
{ {
for (int i = size(); --i >= 0;) for (int i = size(); --i >= 0;)
{ {
@@ -272,7 +258,7 @@ public:
static int compareElements (String& first, String& second) { return first.compareIgnoreCase (second); } static int compareElements (String& first, String& second) { return first.compareIgnoreCase (second); }
}; };
void StringArray::sort (const bool ignoreCase) throw()
void StringArray::sort (const bool ignoreCase)
{ {
if (ignoreCase) if (ignoreCase)
{ {
@@ -293,9 +279,7 @@ void StringArray::move (const int currentIndex, int newIndex) throw()
//============================================================================== //==============================================================================
const String StringArray::joinIntoString (const String& separator,
int start,
int numberToJoin) const throw()
const String StringArray::joinIntoString (const String& separator, int start, int numberToJoin) const
{ {
const int last = (numberToJoin < 0) ? size() const int last = (numberToJoin < 0) ? size()
: jmin (size(), start + numberToJoin); : jmin (size(), start + numberToJoin);
@@ -343,17 +327,14 @@ const String StringArray::joinIntoString (const String& separator,
return result; return result;
} }
int StringArray::addTokens (const tchar* const text,
const bool preserveQuotedStrings) throw()
int StringArray::addTokens (const tchar* const text, const bool preserveQuotedStrings)
{ {
return addTokens (text, return addTokens (text,
T(" \n\r\t"), T(" \n\r\t"),
preserveQuotedStrings ? T("\"") : 0); preserveQuotedStrings ? T("\"") : 0);
} }
int StringArray::addTokens (const tchar* const text,
const tchar* breakCharacters,
const tchar* quoteCharacters) throw()
int StringArray::addTokens (const tchar* const text, const tchar* breakCharacters, const tchar* quoteCharacters)
{ {
int num = 0; int num = 0;
@@ -437,7 +418,7 @@ int StringArray::addTokens (const tchar* const text,
return num; return num;
} }
int StringArray::addLines (const tchar* text) throw()
int StringArray::addLines (const tchar* text)
{ {
int numLines = 0; int numLines = 0;
@@ -484,7 +465,7 @@ int StringArray::addLines (const tchar* text) throw()
} }
//============================================================================== //==============================================================================
void StringArray::removeDuplicates (const bool ignoreCase) throw()
void StringArray::removeDuplicates (const bool ignoreCase)
{ {
for (int i = 0; i < size() - 1; ++i) for (int i = 0; i < size() - 1; ++i)
{ {
@@ -507,7 +488,7 @@ void StringArray::removeDuplicates (const bool ignoreCase) throw()
void StringArray::appendNumbersToDuplicates (const bool ignoreCase, void StringArray::appendNumbersToDuplicates (const bool ignoreCase,
const bool appendNumberToFirstInstance, const bool appendNumberToFirstInstance,
const tchar* const preNumberString, const tchar* const preNumberString,
const tchar* const postNumberString) throw()
const tchar* const postNumberString)
{ {
for (int i = 0; i < size() - 1; ++i) for (int i = 0; i < size() - 1; ++i)
{ {
@@ -535,7 +516,7 @@ void StringArray::appendNumbersToDuplicates (const bool ignoreCase,
} }
} }
void StringArray::minimiseStorageOverheads() throw()
void StringArray::minimiseStorageOverheads()
{ {
strings.minimiseStorageOverheads(); strings.minimiseStorageOverheads();
} }


+ 29
- 32
src/text/juce_StringArray.h View File

@@ -50,7 +50,7 @@ public:
StringArray() throw(); StringArray() throw();
/** Creates a copy of another string array */ /** Creates a copy of another string array */
StringArray (const StringArray& other) throw();
StringArray (const StringArray& other);
/** Creates a copy of an array of string literals. /** Creates a copy of an array of string literals.
@@ -59,7 +59,7 @@ public:
@param numberOfStrings how many items there are in the array @param numberOfStrings how many items there are in the array
*/ */
StringArray (const juce_wchar** const strings, StringArray (const juce_wchar** const strings,
const int numberOfStrings) throw();
const int numberOfStrings);
/** Creates a copy of an array of string literals. /** Creates a copy of an array of string literals.
@@ -68,27 +68,27 @@ public:
@param numberOfStrings how many items there are in the array @param numberOfStrings how many items there are in the array
*/ */
StringArray (const char** const strings, StringArray (const char** const strings,
const int numberOfStrings) throw();
const int numberOfStrings);
/** Creates a copy of a null-terminated array of string literals. /** Creates a copy of a null-terminated array of string literals.
Each item from the array passed-in is added, until it encounters a null pointer, Each item from the array passed-in is added, until it encounters a null pointer,
at which point it stops. at which point it stops.
*/ */
StringArray (const juce_wchar** const strings) throw();
explicit StringArray (const juce_wchar** const strings);
/** Creates a copy of a null-terminated array of string literals. /** Creates a copy of a null-terminated array of string literals.
Each item from the array passed-in is added, until it encounters a null pointer, Each item from the array passed-in is added, until it encounters a null pointer,
at which point it stops. at which point it stops.
*/ */
StringArray (const char** const strings) throw();
explicit StringArray (const char** const strings);
/** Destructor. */ /** Destructor. */
virtual ~StringArray() throw();
~StringArray();
/** Copies the contents of another string array into this one */ /** Copies the contents of another string array into this one */
const StringArray& operator= (const StringArray& other) throw();
const StringArray& operator= (const StringArray& other);
//============================================================================== //==============================================================================
/** Compares two arrays. /** Compares two arrays.
@@ -97,7 +97,7 @@ public:
@returns true only if the other array contains exactly the same strings in the same order @returns true only if the other array contains exactly the same strings in the same order
*/ */
bool operator== (const StringArray& other) const throw();
bool operator== (const StringArray& other) const;
/** Compares two arrays. /** Compares two arrays.
@@ -105,7 +105,7 @@ public:
@returns false if the other array contains exactly the same strings in the same order @returns false if the other array contains exactly the same strings in the same order
*/ */
bool operator!= (const StringArray& other) const throw();
bool operator!= (const StringArray& other) const;
//============================================================================== //==============================================================================
/** Returns the number of strings in the array */ /** Returns the number of strings in the array */
@@ -127,7 +127,7 @@ public:
@returns true if the string is found inside the array @returns true if the string is found inside the array
*/ */
bool contains (const String& stringToLookFor, bool contains (const String& stringToLookFor,
const bool ignoreCase = false) const throw();
const bool ignoreCase = false) const;
/** Searches for a string in the array. /** Searches for a string in the array.
@@ -141,11 +141,11 @@ public:
*/ */
int indexOf (const String& stringToLookFor, int indexOf (const String& stringToLookFor,
const bool ignoreCase = false, const bool ignoreCase = false,
int startIndex = 0) const throw();
int startIndex = 0) const;
//============================================================================== //==============================================================================
/** Appends a string at the end of the array. */ /** Appends a string at the end of the array. */
void add (const String& stringToAdd) throw();
void add (const String& stringToAdd);
/** Inserts a string into the array. /** Inserts a string into the array.
@@ -154,23 +154,20 @@ public:
If the index is less than zero or greater than the size of the array, If the index is less than zero or greater than the size of the array,
the new string will be added to the end of the array. the new string will be added to the end of the array.
*/ */
void insert (const int index,
const String& stringToAdd) throw();
void insert (const int index, const String& stringToAdd);
/** Adds a string to the array as long as it's not already in there. /** Adds a string to the array as long as it's not already in there.
The search can optionally be case-insensitive. The search can optionally be case-insensitive.
*/ */
void addIfNotAlreadyThere (const String& stringToAdd,
const bool ignoreCase = false) throw();
void addIfNotAlreadyThere (const String& stringToAdd, const bool ignoreCase = false);
/** Replaces one of the strings in the array with another one. /** Replaces one of the strings in the array with another one.
If the index is higher than the array's size, the new string will be If the index is higher than the array's size, the new string will be
added to the end of the array; if it's less than zero nothing happens. added to the end of the array; if it's less than zero nothing happens.
*/ */
void set (const int index,
const String& newString) throw();
void set (const int index, const String& newString);
/** Appends some strings from another array to the end of this one. /** Appends some strings from another array to the end of this one.
@@ -181,7 +178,7 @@ public:
*/ */
void addArray (const StringArray& other, void addArray (const StringArray& other,
int startIndex = 0, int startIndex = 0,
int numElementsToAdd = -1) throw();
int numElementsToAdd = -1);
/** Breaks up a string into tokens and adds them to this array. /** Breaks up a string into tokens and adds them to this array.
@@ -191,7 +188,7 @@ public:
@returns the number of tokens added @returns the number of tokens added
*/ */
int addTokens (const tchar* const stringToTokenise, int addTokens (const tchar* const stringToTokenise,
const bool preserveQuotedStrings) throw();
const bool preserveQuotedStrings);
/** Breaks up a string into tokens and adds them to this array. /** Breaks up a string into tokens and adds them to this array.
@@ -208,7 +205,7 @@ public:
*/ */
int addTokens (const tchar* const stringToTokenise, int addTokens (const tchar* const stringToTokenise,
const tchar* breakCharacters, const tchar* breakCharacters,
const tchar* quoteCharacters) throw();
const tchar* quoteCharacters);
/** Breaks up a string into lines and adds them to this array. /** Breaks up a string into lines and adds them to this array.
@@ -216,17 +213,17 @@ public:
to the array. Line-break characters are omitted from the strings that are added to to the array. Line-break characters are omitted from the strings that are added to
the array. the array.
*/ */
int addLines (const tchar* stringToBreakUp) throw();
int addLines (const tchar* stringToBreakUp);
//============================================================================== //==============================================================================
/** Removes all elements from the array. */ /** Removes all elements from the array. */
void clear() throw();
void clear();
/** Removes a string from the array. /** Removes a string from the array.
If the index is out-of-range, no action will be taken. If the index is out-of-range, no action will be taken.
*/ */
void remove (const int index) throw();
void remove (const int index);
/** Finds a string in the array and removes it. /** Finds a string in the array and removes it.
@@ -234,7 +231,7 @@ public:
comparison may be case-insensitive depending on the ignoreCase parameter. comparison may be case-insensitive depending on the ignoreCase parameter.
*/ */
void removeString (const String& stringToRemove, void removeString (const String& stringToRemove,
const bool ignoreCase = false) throw();
const bool ignoreCase = false);
/** Removes any duplicated elements from the array. /** Removes any duplicated elements from the array.
@@ -243,14 +240,14 @@ public:
@param ignoreCase whether to use a case-insensitive comparison @param ignoreCase whether to use a case-insensitive comparison
*/ */
void removeDuplicates (const bool ignoreCase) throw();
void removeDuplicates (const bool ignoreCase);
/** Removes empty strings from the array. /** Removes empty strings from the array.
@param removeWhitespaceStrings if true, strings that only contain whitespace @param removeWhitespaceStrings if true, strings that only contain whitespace
characters will also be removed characters will also be removed
*/ */
void removeEmptyStrings (const bool removeWhitespaceStrings = true) throw();
void removeEmptyStrings (const bool removeWhitespaceStrings = true);
/** Moves one of the strings to a different position. /** Moves one of the strings to a different position.
@@ -269,7 +266,7 @@ public:
void move (const int currentIndex, int newIndex) throw(); void move (const int currentIndex, int newIndex) throw();
/** Deletes any whitespace characters from the starts and ends of all the strings. */ /** Deletes any whitespace characters from the starts and ends of all the strings. */
void trim() throw();
void trim();
/** Adds numbers to the strings in the array, to make each string unique. /** Adds numbers to the strings in the array, to make each string unique.
@@ -285,7 +282,7 @@ public:
void appendNumbersToDuplicates (const bool ignoreCaseWhenComparing, void appendNumbersToDuplicates (const bool ignoreCaseWhenComparing,
const bool appendNumberToFirstInstance, const bool appendNumberToFirstInstance,
const tchar* const preNumberString = defaultPreNumberString, const tchar* const preNumberString = defaultPreNumberString,
const tchar* const postNumberString = defaultPostNumberString) throw();
const tchar* const postNumberString = defaultPostNumberString);
//============================================================================== //==============================================================================
/** Joins the strings in the array together into one string. /** Joins the strings in the array together into one string.
@@ -302,14 +299,14 @@ public:
*/ */
const String joinIntoString (const String& separatorString, const String joinIntoString (const String& separatorString,
int startIndex = 0, int startIndex = 0,
int numberOfElements = -1) const throw();
int numberOfElements = -1) const;
//============================================================================== //==============================================================================
/** Sorts the array into alphabetical order. /** Sorts the array into alphabetical order.
@param ignoreCase if true, the comparisons used will be case-sensitive. @param ignoreCase if true, the comparisons used will be case-sensitive.
*/ */
void sort (const bool ignoreCase) throw();
void sort (const bool ignoreCase);
//============================================================================== //==============================================================================
/** Reduces the amount of storage being used by the array. /** Reduces the amount of storage being used by the array.
@@ -318,7 +315,7 @@ public:
removing elements, they may have quite a lot of unused space allocated. removing elements, they may have quite a lot of unused space allocated.
This method will reduce the amount of allocated storage to a minimum. This method will reduce the amount of allocated storage to a minimum.
*/ */
void minimiseStorageOverheads() throw();
void minimiseStorageOverheads();
//============================================================================== //==============================================================================


Loading…
Cancel
Save