| @@ -38,7 +38,7 @@ ProjectType::ProjectType (const String& type_, const String& desc_) | |||||
| ProjectType::~ProjectType() | ProjectType::~ProjectType() | ||||
| { | { | ||||
| getAllTypes().removeValue (this); | |||||
| getAllTypes().removeFirstMatchingValue (this); | |||||
| } | } | ||||
| Array<ProjectType*>& ProjectType::getAllTypes() | Array<ProjectType*>& ProjectType::getAllTypes() | ||||
| @@ -180,5 +180,5 @@ void MidiKeyboardState::addListener (MidiKeyboardStateListener* const listener) | |||||
| void MidiKeyboardState::removeListener (MidiKeyboardStateListener* const listener) | void MidiKeyboardState::removeListener (MidiKeyboardStateListener* const listener) | ||||
| { | { | ||||
| const ScopedLock sl (lock); | const ScopedLock sl (lock); | ||||
| listeners.removeValue (listener); | |||||
| listeners.removeFirstMatchingValue (listener); | |||||
| } | } | ||||
| @@ -601,7 +601,7 @@ void AudioDeviceManager::removeAudioCallback (AudioIODeviceCallback* callbackToR | |||||
| const ScopedLock sl (audioCallbackLock); | const ScopedLock sl (audioCallbackLock); | ||||
| needsDeinitialising = needsDeinitialising && callbacks.contains (callbackToRemove); | needsDeinitialising = needsDeinitialising && callbacks.contains (callbackToRemove); | ||||
| callbacks.removeValue (callbackToRemove); | |||||
| callbacks.removeFirstMatchingValue (callbackToRemove); | |||||
| } | } | ||||
| if (needsDeinitialising) | if (needsDeinitialising) | ||||
| @@ -45,7 +45,7 @@ public: | |||||
| ~IPhoneAudioIODevice() | ~IPhoneAudioIODevice() | ||||
| { | { | ||||
| getSessionHolder().activeDevices.removeValue (this); | |||||
| getSessionHolder().activeDevices.removeFirstMatchingValue (this); | |||||
| close(); | close(); | ||||
| } | } | ||||
| @@ -257,7 +257,7 @@ namespace CoreMidiHelpers | |||||
| { | { | ||||
| const ScopedLock sl (callbackLock); | const ScopedLock sl (callbackLock); | ||||
| activeCallbacks.removeValue (this); | |||||
| activeCallbacks.removeFirstMatchingValue (this); | |||||
| } | } | ||||
| if (portAndEndpoint != nullptr && portAndEndpoint->port != 0) | if (portAndEndpoint != nullptr && portAndEndpoint->port != 0) | ||||
| @@ -1297,7 +1297,7 @@ Array<int> AudioCDReader::findIndexesInTrack (const int trackNumber) | |||||
| pos += samplesPerFrame * framesPerIndexRead; | pos += samplesPerFrame * framesPerIndexRead; | ||||
| } | } | ||||
| indexes.removeValue (trackStart); | |||||
| indexes.removeFirstMatchingValue (trackStart); | |||||
| } | } | ||||
| return indexes; | return indexes; | ||||
| @@ -105,7 +105,7 @@ public: | |||||
| isStarted = false; | isStarted = false; | ||||
| midiInReset (deviceHandle); | midiInReset (deviceHandle); | ||||
| midiInStop (deviceHandle); | midiInStop (deviceHandle); | ||||
| activeMidiCollectors.removeValue (this); | |||||
| activeMidiCollectors.removeFirstMatchingValue (this); | |||||
| unprepareAllHeaders(); | unprepareAllHeaders(); | ||||
| concatenator.reset(); | concatenator.reset(); | ||||
| } | } | ||||
| @@ -436,7 +436,7 @@ MidiOutput::~MidiOutput() | |||||
| if (MidiOutHandle::activeHandles.contains (h) && --(h->refCount) == 0) | if (MidiOutHandle::activeHandles.contains (h) && --(h->refCount) == 0) | ||||
| { | { | ||||
| midiOutClose (h->handle); | midiOutClose (h->handle); | ||||
| MidiOutHandle::activeHandles.removeValue (h); | |||||
| MidiOutHandle::activeHandles.removeFirstMatchingValue (h); | |||||
| delete h; | delete h; | ||||
| } | } | ||||
| } | } | ||||
| @@ -394,7 +394,7 @@ public: | |||||
| ~ModuleHandle() | ~ModuleHandle() | ||||
| { | { | ||||
| getActiveModules().removeValue (this); | |||||
| getActiveModules().removeFirstMatchingValue (this); | |||||
| close(); | close(); | ||||
| } | } | ||||
| @@ -1153,7 +1153,7 @@ public: | |||||
| closePluginWindow(); | closePluginWindow(); | ||||
| #endif | #endif | ||||
| activeVSTWindows.removeValue (this); | |||||
| activeVSTWindows.removeFirstMatchingValue (this); | |||||
| plugin.editorBeingDeleted (this); | plugin.editorBeingDeleted (this); | ||||
| } | } | ||||
| @@ -1319,7 +1319,7 @@ public: | |||||
| void broughtToFront() | void broughtToFront() | ||||
| { | { | ||||
| activeVSTWindows.removeValue (this); | |||||
| activeVSTWindows.removeFirstMatchingValue (this); | |||||
| activeVSTWindows.add (this); | activeVSTWindows.add (this); | ||||
| #if JUCE_MAC | #if JUCE_MAC | ||||
| @@ -743,7 +743,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 (ParameterType valueToRemove) | |||||
| void removeFirstMatchingValue (ParameterType valueToRemove) | |||||
| { | { | ||||
| const ScopedLockType lock (getLock()); | const ScopedLockType lock (getLock()); | ||||
| ElementType* const e = data.elements; | ElementType* const e = data.elements; | ||||
| @@ -758,6 +758,24 @@ public: | |||||
| } | } | ||||
| } | } | ||||
| /** Removes an item from the array. | |||||
| This will remove the first occurrence of the given element from the array. | |||||
| If the item isn't found, no action is taken. | |||||
| @param valueToRemove the object to try to remove | |||||
| @see remove, removeRange | |||||
| */ | |||||
| void removeAllInstancesOf (ParameterType valueToRemove) | |||||
| { | |||||
| const ScopedLockType lock (getLock()); | |||||
| ElementType* const e = data.elements; | |||||
| for (int i = numUsed; --i >= 0;) | |||||
| if (valueToRemove == e[i]) | |||||
| remove (i); | |||||
| } | |||||
| /** Removes a range of elements from the array. | /** Removes a range of elements from the array. | ||||
| This will remove a set of elements, starting from the given index, | This will remove a set of elements, starting from the given index, | ||||
| @@ -31,7 +31,7 @@ JNIClassBase::JNIClassBase (const char* classPath_) | |||||
| JNIClassBase::~JNIClassBase() | JNIClassBase::~JNIClassBase() | ||||
| { | { | ||||
| getClasses().removeValue (this); | |||||
| getClasses().removeFirstMatchingValue (this); | |||||
| } | } | ||||
| Array<JNIClassBase*>& JNIClassBase::getClasses() | Array<JNIClassBase*>& JNIClassBase::getClasses() | ||||
| @@ -58,7 +58,7 @@ OutputStream::OutputStream() | |||||
| OutputStream::~OutputStream() | OutputStream::~OutputStream() | ||||
| { | { | ||||
| #if JUCE_DEBUG | #if JUCE_DEBUG | ||||
| danglingStreamChecker.activeStreams.removeValue (this); | |||||
| danglingStreamChecker.activeStreams.removeFirstMatchingValue (this); | |||||
| #endif | #endif | ||||
| } | } | ||||
| @@ -202,7 +202,7 @@ bool ThreadPool::removeJob (ThreadPoolJob* const job, | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| jobs.removeValue (job); | |||||
| jobs.removeFirstMatchingValue (job); | |||||
| addToDeleteList (deletionList, job); | addToDeleteList (deletionList, job); | ||||
| } | } | ||||
| } | } | ||||
| @@ -351,7 +351,7 @@ bool ThreadPool::runNextJob() | |||||
| if (result != ThreadPoolJob::jobNeedsRunningAgain || job->shouldStop) | if (result != ThreadPoolJob::jobNeedsRunningAgain || job->shouldStop) | ||||
| { | { | ||||
| jobs.removeValue (job); | |||||
| jobs.removeFirstMatchingValue (job); | |||||
| addToDeleteList (deletionList, job); | addToDeleteList (deletionList, job); | ||||
| jobFinishedSignal.signal(); | jobFinishedSignal.signal(); | ||||
| @@ -59,11 +59,11 @@ void TimeSliceThread::removeTimeSliceClient (TimeSliceClient* const client) | |||||
| const ScopedLock sl2 (callbackLock); | const ScopedLock sl2 (callbackLock); | ||||
| const ScopedLock sl3 (listLock); | const ScopedLock sl3 (listLock); | ||||
| clients.removeValue (client); | |||||
| clients.removeFirstMatchingValue (client); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| clients.removeValue (client); | |||||
| clients.removeFirstMatchingValue (client); | |||||
| } | } | ||||
| } | } | ||||
| @@ -156,7 +156,7 @@ void TimeSliceThread::run() | |||||
| if (msUntilNextCall >= 0) | if (msUntilNextCall >= 0) | ||||
| clientBeingCalled->nextCallTime += RelativeTime::milliseconds (msUntilNextCall); | clientBeingCalled->nextCallTime += RelativeTime::milliseconds (msUntilNextCall); | ||||
| else | else | ||||
| clients.removeValue (clientBeingCalled); | |||||
| clients.removeFirstMatchingValue (clientBeingCalled); | |||||
| clientBeingCalled = nullptr; | clientBeingCalled = nullptr; | ||||
| } | } | ||||
| @@ -31,7 +31,7 @@ UnitTest::UnitTest (const String& name_) | |||||
| UnitTest::~UnitTest() | UnitTest::~UnitTest() | ||||
| { | { | ||||
| getAllTests().removeValue (this); | |||||
| getAllTests().removeFirstMatchingValue (this); | |||||
| } | } | ||||
| Array<UnitTest*>& UnitTest::getAllTests() | Array<UnitTest*>& UnitTest::getAllTests() | ||||
| @@ -115,7 +115,7 @@ public: | |||||
| // Listeners can't be null pointers! | // Listeners can't be null pointers! | ||||
| jassert (listenerToRemove != nullptr); | jassert (listenerToRemove != nullptr); | ||||
| listeners.removeValue (listenerToRemove); | |||||
| listeners.removeFirstMatchingValue (listenerToRemove); | |||||
| } | } | ||||
| /** Returns the number of registered listeners. */ | /** Returns the number of registered listeners. */ | ||||
| @@ -34,7 +34,7 @@ DeletedAtShutdown::DeletedAtShutdown() | |||||
| DeletedAtShutdown::~DeletedAtShutdown() | DeletedAtShutdown::~DeletedAtShutdown() | ||||
| { | { | ||||
| const SpinLock::ScopedLockType sl (deletedAtShutdownLock); | const SpinLock::ScopedLockType sl (deletedAtShutdownLock); | ||||
| getObjects().removeValue (this); | |||||
| getObjects().removeFirstMatchingValue (this); | |||||
| } | } | ||||
| void DeletedAtShutdown::deleteAll() | void DeletedAtShutdown::deleteAll() | ||||
| @@ -2907,7 +2907,7 @@ void Component::addKeyListener (KeyListener* const newListener) | |||||
| void Component::removeKeyListener (KeyListener* const listenerToRemove) | void Component::removeKeyListener (KeyListener* const listenerToRemove) | ||||
| { | { | ||||
| if (keyListeners != nullptr) | if (keyListeners != nullptr) | ||||
| keyListeners->removeValue (listenerToRemove); | |||||
| keyListeners->removeFirstMatchingValue (listenerToRemove); | |||||
| } | } | ||||
| bool Component::keyPressed (const KeyPress&) { return false; } | bool Component::keyPressed (const KeyPress&) { return false; } | ||||
| @@ -119,7 +119,7 @@ void Desktop::addDesktopComponent (Component* const c) | |||||
| void Desktop::removeDesktopComponent (Component* const c) | void Desktop::removeDesktopComponent (Component* const c) | ||||
| { | { | ||||
| desktopComponents.removeValue (c); | |||||
| desktopComponents.removeFirstMatchingValue (c); | |||||
| } | } | ||||
| void Desktop::componentBroughtToFront (Component* const c) | void Desktop::componentBroughtToFront (Component* const c) | ||||
| @@ -96,7 +96,7 @@ void ComponentMovementWatcher::componentMovedOrResized (Component&, bool wasMove | |||||
| void ComponentMovementWatcher::componentBeingDeleted (Component& comp) | void ComponentMovementWatcher::componentBeingDeleted (Component& comp) | ||||
| { | { | ||||
| registeredParentComps.removeValue (&comp); | |||||
| registeredParentComps.removeFirstMatchingValue (&comp); | |||||
| if (component == &comp) | if (component == &comp) | ||||
| unregister(); | unregister(); | ||||
| @@ -258,7 +258,7 @@ bool MultiDocumentPanel::closeDocument (Component* component, | |||||
| if (shouldDelete) | if (shouldDelete) | ||||
| delete component; | delete component; | ||||
| components.removeValue (component); | |||||
| components.removeFirstMatchingValue (component); | |||||
| if (isFullscreenWhenOneDocument() && components.size() == 1) | if (isFullscreenWhenOneDocument() && components.size() == 1) | ||||
| { | { | ||||
| @@ -294,7 +294,7 @@ bool MultiDocumentPanel::closeDocument (Component* component, | |||||
| if (tabComponent != nullptr && tabComponent->getNumTabs() <= numDocsBeforeTabsUsed) | if (tabComponent != nullptr && tabComponent->getNumTabs() <= numDocsBeforeTabsUsed) | ||||
| tabComponent = nullptr; | tabComponent = nullptr; | ||||
| components.removeValue (component); | |||||
| components.removeFirstMatchingValue (component); | |||||
| if (components.size() > 0 && tabComponent == nullptr) | if (components.size() > 0 && tabComponent == nullptr) | ||||
| addAndMakeVisible (components.getFirst()); | addAndMakeVisible (components.getFirst()); | ||||
| @@ -515,7 +515,7 @@ void MultiDocumentPanel::updateOrder() | |||||
| if (current != nullptr) | if (current != nullptr) | ||||
| { | { | ||||
| components.removeValue (current); | |||||
| components.removeFirstMatchingValue (current); | |||||
| components.add (current); | components.add (current); | ||||
| } | } | ||||
| } | } | ||||
| @@ -287,7 +287,7 @@ public: | |||||
| ~Window() | ~Window() | ||||
| { | { | ||||
| getActiveWindows().removeValue (this); | |||||
| getActiveWindows().removeFirstMatchingValue (this); | |||||
| Desktop::getInstance().removeGlobalMouseListener (this); | Desktop::getInstance().removeGlobalMouseListener (this); | ||||
| activeSubMenu = nullptr; | activeSubMenu = nullptr; | ||||
| items.clear(); | items.clear(); | ||||
| @@ -77,7 +77,7 @@ public: | |||||
| if (isStandard) | if (isStandard) | ||||
| { | { | ||||
| const SpinLock::ScopedLockType sl (lock); | const SpinLock::ScopedLockType sl (lock); | ||||
| getCursors().removeValue (this); | |||||
| getCursors().removeFirstMatchingValue (this); | |||||
| } | } | ||||
| delete this; | delete this; | ||||
| @@ -836,7 +836,7 @@ public: | |||||
| if (isKeyDown) | if (isKeyDown) | ||||
| keysCurrentlyDown.addIfNotAlreadyThere (keyCode); | keysCurrentlyDown.addIfNotAlreadyThere (keyCode); | ||||
| else | else | ||||
| keysCurrentlyDown.removeValue (keyCode); | |||||
| keysCurrentlyDown.removeFirstMatchingValue (keyCode); | |||||
| } | } | ||||
| } | } | ||||
| @@ -265,7 +265,7 @@ void RelativeCoordinatePositionerBase::componentChildrenChanged (Component& chan | |||||
| void RelativeCoordinatePositionerBase::componentBeingDeleted (Component& comp) | void RelativeCoordinatePositionerBase::componentBeingDeleted (Component& comp) | ||||
| { | { | ||||
| jassert (sourceComponents.contains (&comp)); | jassert (sourceComponents.contains (&comp)); | ||||
| sourceComponents.removeValue (&comp); | |||||
| sourceComponents.removeFirstMatchingValue (&comp); | |||||
| registeredOk = false; | registeredOk = false; | ||||
| } | } | ||||
| @@ -277,7 +277,7 @@ void RelativeCoordinatePositionerBase::markersChanged (MarkerList*) | |||||
| void RelativeCoordinatePositionerBase::markerListBeingDeleted (MarkerList* markerList) | void RelativeCoordinatePositionerBase::markerListBeingDeleted (MarkerList* markerList) | ||||
| { | { | ||||
| jassert (sourceMarkerLists.contains (markerList)); | jassert (sourceMarkerLists.contains (markerList)); | ||||
| sourceMarkerLists.removeValue (markerList); | |||||
| sourceMarkerLists.removeFirstMatchingValue (markerList); | |||||
| } | } | ||||
| void RelativeCoordinatePositionerBase::apply() | void RelativeCoordinatePositionerBase::apply() | ||||
| @@ -480,7 +480,7 @@ void TableHeaderComponent::addListener (Listener* const newListener) | |||||
| void TableHeaderComponent::removeListener (Listener* const listenerToRemove) | void TableHeaderComponent::removeListener (Listener* const listenerToRemove) | ||||
| { | { | ||||
| listeners.removeValue (listenerToRemove); | |||||
| listeners.removeFirstMatchingValue (listenerToRemove); | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -325,8 +325,8 @@ Component* AlertWindow::removeCustomComponent (const int index) | |||||
| if (c != nullptr) | if (c != nullptr) | ||||
| { | { | ||||
| customComps.removeValue (c); | |||||
| allComps.removeValue (c); | |||||
| customComps.removeFirstMatchingValue (c); | |||||
| allComps.removeFirstMatchingValue (c); | |||||
| removeChildComponent (c); | removeChildComponent (c); | ||||
| updateLayout (false); | updateLayout (false); | ||||
| @@ -45,7 +45,7 @@ ComponentPeer::ComponentPeer (Component* const component_, const int styleFlags_ | |||||
| ComponentPeer::~ComponentPeer() | ComponentPeer::~ComponentPeer() | ||||
| { | { | ||||
| heavyweightPeers.removeValue (this); | |||||
| heavyweightPeers.removeFirstMatchingValue (this); | |||||
| Desktop::getInstance().triggerFocusCallback(); | Desktop::getInstance().triggerFocusCallback(); | ||||
| } | } | ||||
| @@ -92,7 +92,7 @@ public: | |||||
| if (currentActive == w) | if (currentActive == w) | ||||
| currentActive = nullptr; | currentActive = nullptr; | ||||
| windows.removeValue (w); | |||||
| windows.removeFirstMatchingValue (w); | |||||
| if (windows.size() == 0) | if (windows.size() == 0) | ||||
| deleteInstance(); | deleteInstance(); | ||||
| @@ -458,7 +458,7 @@ void CodeDocument::Position::setPositionMaintained (const bool isMaintained) | |||||
| { | { | ||||
| // If this happens, you may have deleted the document while there are Position objects that are still using it... | // If this happens, you may have deleted the document while there are Position objects that are still using it... | ||||
| jassert (owner->positionsToMaintain.contains (this)); | jassert (owner->positionsToMaintain.contains (this)); | ||||
| owner->positionsToMaintain.removeValue (this); | |||||
| owner->positionsToMaintain.removeFirstMatchingValue (this); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -328,7 +328,7 @@ ActiveXControlComponent::ActiveXControlComponent() | |||||
| ActiveXControlComponent::~ActiveXControlComponent() | ActiveXControlComponent::~ActiveXControlComponent() | ||||
| { | { | ||||
| deleteControl(); | deleteControl(); | ||||
| ActiveXHelpers::activeXComps.removeValue (this); | |||||
| ActiveXHelpers::activeXComps.removeFirstMatchingValue (this); | |||||
| } | } | ||||
| void ActiveXControlComponent::paint (Graphics& g) | void ActiveXControlComponent::paint (Graphics& g) | ||||
| @@ -56,7 +56,7 @@ public: | |||||
| { | { | ||||
| { | { | ||||
| const ScopedLock sl (contextListLock); | const ScopedLock sl (contextListLock); | ||||
| contextList.removeValue (this); | |||||
| contextList.removeFirstMatchingValue (this); | |||||
| } | } | ||||
| android.activity.callVoidMethod (JuceAppActivity.deleteView, glView.get()); | android.activity.callVoidMethod (JuceAppActivity.deleteView, glView.get()); | ||||