| @@ -50,7 +50,7 @@ public: | |||
| Image image (Image::ARGB, 200, 200, true); | |||
| Graphics g (image); | |||
| ScopedPointer<Drawable> svgDrawable = Drawable::createFromImageData (iconData, (size_t) iconDataSize); | |||
| ScopedPointer<Drawable> svgDrawable (Drawable::createFromImageData (iconData, (size_t) iconDataSize)); | |||
| svgDrawable->drawWithin (g, image.getBounds().toFloat(), RectanglePlacement::fillDestination, 1.0f); | |||
| @@ -519,8 +519,8 @@ public: | |||
| conv->convertSamples (inPlace ? reversed : converted, original, numSamples); | |||
| // ..and back again.. | |||
| conv = new AudioData::ConverterInstance <AudioData::Pointer<F2, E2, AudioData::NonInterleaved, AudioData::Const>, | |||
| AudioData::Pointer<F1, E1, AudioData::NonInterleaved, AudioData::NonConst>>(); | |||
| conv.reset (new AudioData::ConverterInstance <AudioData::Pointer<F2, E2, AudioData::NonInterleaved, AudioData::Const>, | |||
| AudioData::Pointer<F1, E1, AudioData::NonInterleaved, AudioData::NonConst>>()); | |||
| if (! inPlace) | |||
| zeromem (reversed, sizeof (reversed)); | |||
| @@ -532,7 +532,7 @@ public: | |||
| AudioData::Pointer<F1, E1, AudioData::NonInterleaved, AudioData::Const> d2 (reversed); | |||
| const int errorMargin = 2 * AudioData::Pointer<F1, E1, AudioData::NonInterleaved, AudioData::Const>::get32BitResolution() | |||
| + AudioData::Pointer<F2, E2, AudioData::NonInterleaved, AudioData::Const>::get32BitResolution(); | |||
| + AudioData::Pointer<F2, E2, AudioData::NonInterleaved, AudioData::Const>::get32BitResolution(); | |||
| for (int i = 0; i < numSamples; ++i) | |||
| { | |||
| @@ -2133,7 +2133,7 @@ private: | |||
| void noteReleased (MPENote finishedNote) override | |||
| { | |||
| noteReleasedCallCounter++; | |||
| lastNoteFinished = new MPENote (finishedNote); | |||
| lastNoteFinished.reset (new MPENote (finishedNote)); | |||
| } | |||
| }; | |||
| @@ -71,7 +71,7 @@ void MixerAudioSource::removeInputSource (AudioSource* const input) | |||
| return; | |||
| if (inputsToDelete [index]) | |||
| toDelete = input; | |||
| toDelete.reset (input); | |||
| inputsToDelete.shiftBits (-1, index); | |||
| inputs.remove (index); | |||
| @@ -89,14 +89,8 @@ private: | |||
| //============================================================================== | |||
| AudioDeviceManager::AudioDeviceManager() | |||
| : numInputChansNeeded (0), | |||
| numOutputChansNeeded (2), | |||
| listNeedsScanning (true), | |||
| testSoundPosition (0), | |||
| cpuUsageMs (0), | |||
| timeToCpuScale (0) | |||
| { | |||
| callbackHandler = new CallbackHandler (*this); | |||
| callbackHandler.reset (new CallbackHandler (*this)); | |||
| } | |||
| AudioDeviceManager::~AudioDeviceManager() | |||
| @@ -113,12 +107,12 @@ void AudioDeviceManager::createDeviceTypesIfNeeded() | |||
| OwnedArray<AudioIODeviceType> types; | |||
| createAudioDeviceTypes (types); | |||
| for (int i = 0; i < types.size(); ++i) | |||
| addAudioDeviceType (types.getUnchecked(i)); | |||
| for (auto* t : types) | |||
| addAudioDeviceType (t); | |||
| types.clear (false); | |||
| if (AudioIODeviceType* first = availableDeviceTypes.getFirst()) | |||
| if (auto* first = availableDeviceTypes.getFirst()) | |||
| currentDeviceType = first->getTypeName(); | |||
| } | |||
| } | |||
| @@ -171,7 +165,7 @@ void AudioDeviceManager::addAudioDeviceType (AudioIODeviceType* newDeviceType) | |||
| availableDeviceTypes.add (newDeviceType); | |||
| lastDeviceTypeConfigs.add (new AudioDeviceSetup()); | |||
| newDeviceType->addListener (callbackHandler); | |||
| newDeviceType->addListener (callbackHandler.get()); | |||
| } | |||
| } | |||
| @@ -254,7 +248,7 @@ String AudioDeviceManager::initialiseFromXML (const XmlElement& xml, | |||
| const String& preferredDefaultDeviceName, | |||
| const AudioDeviceSetup* preferredSetupOptions) | |||
| { | |||
| lastExplicitSettings = new XmlElement (xml); | |||
| lastExplicitSettings.reset (new XmlElement (xml)); | |||
| String error; | |||
| AudioDeviceSetup setup; | |||
| @@ -299,10 +293,8 @@ String AudioDeviceManager::initialiseFromXML (const XmlElement& xml, | |||
| forEachXmlChildElementWithTagName (xml, c, "MIDIINPUT") | |||
| midiInsFromXml.add (c->getStringAttribute ("name")); | |||
| const StringArray allMidiIns (MidiInput::getDevices()); | |||
| for (int i = allMidiIns.size(); --i >= 0;) | |||
| setMidiInputEnabled (allMidiIns[i], midiInsFromXml.contains (allMidiIns[i])); | |||
| for (auto& m : MidiInput::getDevices()) | |||
| setMidiInputEnabled (m, midiInsFromXml.contains (m)); | |||
| if (error.isNotEmpty() && selectDefaultDeviceOnFailure) | |||
| error = initialise (numInputChansNeeded, numOutputChansNeeded, | |||
| @@ -319,12 +311,12 @@ String AudioDeviceManager::initialiseWithDefaultDevices (int numInputChannelsNee | |||
| lastExplicitSettings.reset(); | |||
| return initialise (numInputChannelsNeeded, numOutputChannelsNeeded, | |||
| nullptr, false, String(), nullptr); | |||
| nullptr, false, {}, nullptr); | |||
| } | |||
| void AudioDeviceManager::insertDefaultDeviceNames (AudioDeviceSetup& setup) const | |||
| { | |||
| if (AudioIODeviceType* type = getCurrentDeviceTypeObject()) | |||
| if (auto* type = getCurrentDeviceTypeObject()) | |||
| { | |||
| if (setup.outputDeviceName.isEmpty()) | |||
| setup.outputDeviceName = type->getDeviceNames (false) [type->getDefaultDeviceIndex (false)]; | |||
| @@ -336,7 +328,7 @@ void AudioDeviceManager::insertDefaultDeviceNames (AudioDeviceSetup& setup) cons | |||
| XmlElement* AudioDeviceManager::createStateXml() const | |||
| { | |||
| return lastExplicitSettings.createCopy(); | |||
| return createCopyIfNotNull (lastExplicitSettings.get()); | |||
| } | |||
| //============================================================================== | |||
| @@ -473,7 +465,7 @@ String AudioDeviceManager::setAudioDeviceSetup (const AudioDeviceSetup& newSetup | |||
| if (newInputDeviceName.isNotEmpty() && ! deviceListContains (type, true, newInputDeviceName)) | |||
| return "No such device: " + newInputDeviceName; | |||
| currentAudioDevice = type->createDevice (newOutputDeviceName, newInputDeviceName); | |||
| currentAudioDevice.reset (type->createDevice (newOutputDeviceName, newInputDeviceName)); | |||
| if (currentAudioDevice == nullptr) | |||
| error = "Can't open the audio device!\n\n" | |||
| @@ -521,7 +513,7 @@ String AudioDeviceManager::setAudioDeviceSetup (const AudioDeviceSetup& newSetup | |||
| { | |||
| currentDeviceType = currentAudioDevice->getTypeName(); | |||
| currentAudioDevice->start (callbackHandler); | |||
| currentAudioDevice->start (callbackHandler.get()); | |||
| currentSetup.sampleRate = currentAudioDevice->getCurrentSampleRate(); | |||
| currentSetup.bufferSize = currentAudioDevice->getCurrentBufferSizeSamples(); | |||
| @@ -618,7 +610,7 @@ void AudioDeviceManager::restartLastAudioDevice() | |||
| void AudioDeviceManager::updateXml() | |||
| { | |||
| lastExplicitSettings = new XmlElement ("DEVICESETUP"); | |||
| lastExplicitSettings.reset (new XmlElement ("DEVICESETUP")); | |||
| lastExplicitSettings->setAttribute ("deviceType", currentDeviceType); | |||
| lastExplicitSettings->setAttribute ("audioOutputDeviceName", currentSetup.outputDeviceName); | |||
| @@ -668,7 +660,7 @@ void AudioDeviceManager::addAudioCallback (AudioIODeviceCallback* newCallback) | |||
| } | |||
| if (currentAudioDevice != nullptr && newCallback != nullptr) | |||
| newCallback->audioDeviceAboutToStart (currentAudioDevice); | |||
| newCallback->audioDeviceAboutToStart (currentAudioDevice.get()); | |||
| const ScopedLock sl (audioCallbackLock); | |||
| callbacks.add (newCallback); | |||
| @@ -814,11 +806,11 @@ void AudioDeviceManager::setMidiInputEnabled (const String& name, const bool ena | |||
| { | |||
| if (enabled) | |||
| { | |||
| const int index = MidiInput::getDevices().indexOf (name); | |||
| auto index = MidiInput::getDevices().indexOf (name); | |||
| if (index >= 0) | |||
| { | |||
| if (MidiInput* const midiIn = MidiInput::openDevice (index, callbackHandler)) | |||
| if (auto* midiIn = MidiInput::openDevice (index, callbackHandler.get())) | |||
| { | |||
| enabledMidiInputs.add (midiIn); | |||
| midiIn->start(); | |||
| @@ -839,8 +831,8 @@ void AudioDeviceManager::setMidiInputEnabled (const String& name, const bool ena | |||
| bool AudioDeviceManager::isMidiInputEnabled (const String& name) const | |||
| { | |||
| for (int i = enabledMidiInputs.size(); --i >= 0;) | |||
| if (enabledMidiInputs[i]->getName() == name) | |||
| for (auto* mi : enabledMidiInputs) | |||
| if (mi->getName() == name) | |||
| return true; | |||
| return false; | |||
| @@ -865,7 +857,7 @@ void AudioDeviceManager::removeMidiInputCallback (const String& name, MidiInputC | |||
| { | |||
| for (int i = midiCallbacks.size(); --i >= 0;) | |||
| { | |||
| const MidiCallbackInfo& mc = midiCallbacks.getReference(i); | |||
| auto& mc = midiCallbacks.getReference(i); | |||
| if (mc.callback == callbackToRemove && mc.deviceName == name) | |||
| { | |||
| @@ -881,13 +873,9 @@ void AudioDeviceManager::handleIncomingMidiMessageInt (MidiInput* source, const | |||
| { | |||
| const ScopedLock sl (midiCallbackLock); | |||
| for (int i = 0; i < midiCallbacks.size(); ++i) | |||
| { | |||
| const MidiCallbackInfo& mc = midiCallbacks.getReference(i); | |||
| for (auto& mc : midiCallbacks) | |||
| if (mc.deviceName.isEmpty() || mc.deviceName == source->getName()) | |||
| mc.callback->handleIncomingMidiMessage (source, message); | |||
| } | |||
| } | |||
| } | |||
| @@ -911,11 +899,11 @@ void AudioDeviceManager::setDefaultMidiOutput (const String& deviceName) | |||
| defaultMidiOutputName = deviceName; | |||
| if (deviceName.isNotEmpty()) | |||
| defaultMidiOutput = MidiOutput::openDevice (MidiOutput::getDevices().indexOf (deviceName)); | |||
| defaultMidiOutput.reset (MidiOutput::openDevice (MidiOutput::getDevices().indexOf (deviceName))); | |||
| if (currentAudioDevice != nullptr) | |||
| for (int i = oldCallbacks.size(); --i >= 0;) | |||
| oldCallbacks.getUnchecked(i)->audioDeviceAboutToStart (currentAudioDevice); | |||
| for (auto* c : oldCallbacks) | |||
| c->audioDeviceAboutToStart (currentAudioDevice.get()); | |||
| { | |||
| const ScopedLock sl (audioCallbackLock); | |||
| @@ -982,7 +970,7 @@ void AudioDeviceManager::playTestSound() | |||
| { | |||
| const ScopedLock sl (audioCallbackLock); | |||
| oldSound = testSound; | |||
| std::swap (oldSound, testSound); | |||
| } | |||
| } | |||
| @@ -1007,7 +995,7 @@ void AudioDeviceManager::playTestSound() | |||
| newSound->applyGainRamp (0, soundLength - soundLength / 4, soundLength / 4, 1.0f, 0.0f); | |||
| const ScopedLock sl (audioCallbackLock); | |||
| testSound = newSound; | |||
| testSound.reset (newSound); | |||
| } | |||
| } | |||
| @@ -234,7 +234,7 @@ public: | |||
| /** Returns the currently-active audio device. */ | |||
| AudioIODevice* getCurrentAudioDevice() const noexcept { return currentAudioDevice; } | |||
| AudioIODevice* getCurrentAudioDevice() const noexcept { return currentAudioDevice.get(); } | |||
| /** Returns the type of audio device currently in use. | |||
| @see setCurrentAudioDeviceType | |||
| @@ -372,7 +372,7 @@ public: | |||
| If no device has been selected, or the device can't be opened, this will return nullptr. | |||
| @see getDefaultMidiOutputName | |||
| */ | |||
| MidiOutput* getDefaultMidiOutput() const noexcept { return defaultMidiOutput; } | |||
| MidiOutput* getDefaultMidiOutput() const noexcept { return defaultMidiOutput.get(); } | |||
| /** Returns a list of the types of device supported. */ | |||
| const OwnedArray<AudioIODeviceType>& getAvailableDeviceTypes(); | |||
| @@ -453,11 +453,11 @@ private: | |||
| AudioDeviceSetup currentSetup; | |||
| ScopedPointer<AudioIODevice> currentAudioDevice; | |||
| Array<AudioIODeviceCallback*> callbacks; | |||
| int numInputChansNeeded, numOutputChansNeeded; | |||
| int numInputChansNeeded = 0, numOutputChansNeeded = 2; | |||
| String currentDeviceType; | |||
| BigInteger inputChannels, outputChannels; | |||
| ScopedPointer<XmlElement> lastExplicitSettings; | |||
| mutable bool listNeedsScanning; | |||
| mutable bool listNeedsScanning = true; | |||
| AudioBuffer<float> tempBuffer; | |||
| struct MidiCallbackInfo | |||
| @@ -475,10 +475,10 @@ private: | |||
| CriticalSection audioCallbackLock, midiCallbackLock; | |||
| ScopedPointer<AudioBuffer<float>> testSound; | |||
| int testSoundPosition; | |||
| int testSoundPosition = 0; | |||
| double cpuUsageMs, timeToCpuScale, msPerBlock; | |||
| int xruns; | |||
| double cpuUsageMs = 0, timeToCpuScale = 0, msPerBlock = 0; | |||
| int xruns = 0; | |||
| struct LevelMeter | |||
| { | |||
| @@ -965,14 +965,14 @@ public: | |||
| } | |||
| jassert (device != nullptr); | |||
| internal = device; | |||
| internal.reset (device); | |||
| AudioObjectPropertyAddress pa; | |||
| pa.mSelector = kAudioObjectPropertySelectorWildcard; | |||
| pa.mScope = kAudioObjectPropertyScopeWildcard; | |||
| pa.mElement = kAudioObjectPropertyElementWildcard; | |||
| AudioObjectAddPropertyListener (kAudioObjectSystemObject, &pa, hardwareListenerProc, internal); | |||
| AudioObjectAddPropertyListener (kAudioObjectSystemObject, &pa, hardwareListenerProc, internal.get()); | |||
| } | |||
| ~CoreAudioIODevice() | |||
| @@ -984,7 +984,7 @@ public: | |||
| pa.mScope = kAudioObjectPropertyScopeWildcard; | |||
| pa.mElement = kAudioObjectPropertyElementWildcard; | |||
| AudioObjectRemovePropertyListener (kAudioObjectSystemObject, &pa, hardwareListenerProc, internal); | |||
| AudioObjectRemovePropertyListener (kAudioObjectSystemObject, &pa, hardwareListenerProc, internal.get()); | |||
| } | |||
| StringArray getOutputChannelNames() override { return internal->outChanNames; } | |||
| @@ -1226,7 +1226,7 @@ public: | |||
| Array<AudioIODevice*> devs; | |||
| for (auto* d : devices) | |||
| devs.add (d->device); | |||
| devs.add (d->device.get()); | |||
| return devs; | |||
| } | |||
| @@ -2160,10 +2160,10 @@ public: | |||
| ScopedPointer<CoreAudioIODevice> in, out; | |||
| if (inputDeviceID != 0) | |||
| in = new CoreAudioIODevice (*this, inputDeviceName, inputDeviceID, inputIndex, 0, -1); | |||
| in.reset (new CoreAudioIODevice (*this, inputDeviceName, inputDeviceID, inputIndex, 0, -1)); | |||
| if (outputDeviceID != 0) | |||
| out = new CoreAudioIODevice (*this, outputDeviceName, 0, -1, outputDeviceID, outputIndex); | |||
| out.reset (new CoreAudioIODevice (*this, outputDeviceName, 0, -1, outputDeviceID, outputIndex)); | |||
| if (in == nullptr) return out.release(); | |||
| if (out == nullptr) return in.release(); | |||
| @@ -511,15 +511,15 @@ MidiInput* MidiInput::openDevice (int index, MidiInputCallback* callback) | |||
| MIDIPortRef port; | |||
| ScopedPointer<MidiPortAndCallback> mpc (new MidiPortAndCallback (*callback)); | |||
| if (CHECK_ERROR (MIDIInputPortCreate (client, name.cfString, midiInputProc, mpc, &port))) | |||
| if (CHECK_ERROR (MIDIInputPortCreate (client, name.cfString, midiInputProc, mpc.get(), &port))) | |||
| { | |||
| if (CHECK_ERROR (MIDIPortConnectSource (port, endPoint, nullptr))) | |||
| { | |||
| mpc->portAndEndpoint = new MidiPortAndEndpoint (port, endPoint); | |||
| mpc->portAndEndpoint.reset (new MidiPortAndEndpoint (port, endPoint)); | |||
| newInput = new MidiInput (getDevices() [index]); | |||
| mpc->input = newInput; | |||
| newInput->internal = mpc; | |||
| newInput->internal = mpc.get(); | |||
| const ScopedLock sl (callbackLock); | |||
| activeCallbacks.add (mpc.release()); | |||
| @@ -553,15 +553,15 @@ MidiInput* MidiInput::createNewDevice (const String& deviceName, MidiInputCallba | |||
| ScopedCFString name; | |||
| name.cfString = deviceName.toCFString(); | |||
| if (CHECK_ERROR (MIDIDestinationCreate (client, name.cfString, midiInputProc, mpc, &endPoint))) | |||
| if (CHECK_ERROR (MIDIDestinationCreate (client, name.cfString, midiInputProc, mpc.get(), &endPoint))) | |||
| { | |||
| CoreMidiHelpers::setUniqueIdForMidiPort (endPoint, deviceName, true); | |||
| mpc->portAndEndpoint = new MidiPortAndEndpoint (0, endPoint); | |||
| mpc->portAndEndpoint.reset (new MidiPortAndEndpoint (0, endPoint)); | |||
| mi = new MidiInput (deviceName); | |||
| mpc->input = mi; | |||
| mi->internal = mpc; | |||
| mi->internal = mpc.get(); | |||
| const ScopedLock sl (callbackLock); | |||
| activeCallbacks.add (mpc.release()); | |||
| @@ -486,7 +486,9 @@ int OggVorbisAudioFormat::estimateOggFileQuality (const File& source) | |||
| { | |||
| if (auto* in = source.createInputStream()) | |||
| { | |||
| if (ScopedPointer<AudioFormatReader> r = createReaderFor (in, true)) | |||
| ScopedPointer<AudioFormatReader> r (createReaderFor (in, true)); | |||
| if (r != nullptr) | |||
| { | |||
| auto lengthSecs = r->lengthInSamples / r->sampleRate; | |||
| auto approxBitsPerSecond = (int) (source.getSize() * 8 / lengthSecs); | |||
| @@ -1738,13 +1738,19 @@ namespace WavFileHelpers | |||
| TemporaryFile tempFile (file); | |||
| WavAudioFormat wav; | |||
| if (ScopedPointer<AudioFormatReader> reader = wav.createReaderFor (file.createInputStream(), true)) | |||
| ScopedPointer<AudioFormatReader> reader (wav.createReaderFor (file.createInputStream(), true)); | |||
| if (reader != nullptr) | |||
| { | |||
| if (ScopedPointer<OutputStream> outStream = tempFile.getFile().createOutputStream()) | |||
| ScopedPointer<OutputStream> outStream (tempFile.getFile().createOutputStream()); | |||
| if (outStream != nullptr) | |||
| { | |||
| if (ScopedPointer<AudioFormatWriter> writer = wav.createWriterFor (outStream, reader->sampleRate, | |||
| reader->numChannels, (int) reader->bitsPerSample, | |||
| metadata, 0)) | |||
| ScopedPointer<AudioFormatWriter> writer (wav.createWriterFor (outStream.get(), reader->sampleRate, | |||
| reader->numChannels, (int) reader->bitsPerSample, | |||
| metadata, 0)); | |||
| if (writer != nullptr) | |||
| { | |||
| outStream.release(); | |||
| @@ -1765,7 +1771,9 @@ bool WavAudioFormat::replaceMetadataInFile (const File& wavFile, const StringPai | |||
| { | |||
| using namespace WavFileHelpers; | |||
| if (ScopedPointer<WavAudioFormatReader> reader = static_cast<WavAudioFormatReader*> (createReaderFor (wavFile.createInputStream(), true))) | |||
| ScopedPointer<WavAudioFormatReader> reader (static_cast<WavAudioFormatReader*> (createReaderFor (wavFile.createInputStream(), true))); | |||
| if (reader != nullptr) | |||
| { | |||
| auto bwavPos = reader->bwavChunkStart; | |||
| auto bwavSize = reader->bwavSize; | |||
| @@ -146,7 +146,7 @@ AudioFormatReader* AudioFormatManager::createReaderFor (InputStream* audioFileSt | |||
| for (auto* af : knownFormats) | |||
| { | |||
| if (auto* r = af->createReaderFor (in, false)) | |||
| if (auto* r = af->createReaderFor (in.get(), false)) | |||
| { | |||
| in.release(); | |||
| return r; | |||
| @@ -394,7 +394,7 @@ bool MemoryMappedAudioFormatReader::mapSectionOfFile (Range<int64> samplesToMap) | |||
| const Range<int64> fileRange (sampleToFilePos (samplesToMap.getStart()), | |||
| sampleToFilePos (samplesToMap.getEnd())); | |||
| map = new MemoryMappedFile (file, fileRange, MemoryMappedFile::readOnly); | |||
| map.reset (new MemoryMappedFile (file, fileRange, MemoryMappedFile::readOnly)); | |||
| if (map->getData() == nullptr) | |||
| map.reset(); | |||
| @@ -44,9 +44,9 @@ SamplerSound::SamplerSound (const String& soundName, | |||
| length = jmin ((int) source.lengthInSamples, | |||
| (int) (maxSampleLengthSeconds * sourceSampleRate)); | |||
| data = new AudioBuffer<float> (jmin (2, (int) source.numChannels), length + 4); | |||
| data.reset (new AudioBuffer<float> (jmin (2, (int) source.numChannels), length + 4)); | |||
| source.read (data, 0, length + 4, 0, true, true); | |||
| source.read (data.get(), 0, length + 4, 0, true, true); | |||
| attackSamples = roundToInt (attackTimeSecs * sourceSampleRate); | |||
| releaseSamples = roundToInt (releaseTimeSecs * sourceSampleRate); | |||
| @@ -79,7 +79,7 @@ public: | |||
| /** Returns the audio sample data. | |||
| This could return nullptr if there was a problem loading the data. | |||
| */ | |||
| AudioBuffer<float>* getAudioData() const noexcept { return data; } | |||
| AudioBuffer<float>* getAudioData() const noexcept { return data.get(); } | |||
| //============================================================================== | |||
| @@ -125,7 +125,7 @@ AudioPluginInstance* AudioPluginFormat::createInstanceFromDescription (const Plu | |||
| createPluginInstanceAsync (desc, initialSampleRate, initialBufferSize, eventSignaler.release()); | |||
| else | |||
| createPluginInstance (desc, initialSampleRate, initialBufferSize, | |||
| eventSignaler, EventSignaler::staticCompletionCallback); | |||
| eventSignaler.get(), EventSignaler::staticCompletionCallback); | |||
| waitForCreation.wait(); | |||
| @@ -2223,7 +2223,7 @@ AudioProcessorEditor* AudioUnitPluginInstance::createEditor() | |||
| ScopedPointer<AudioProcessorEditor> w (new AudioUnitPluginWindowCocoa (*this, false)); | |||
| if (! static_cast<AudioUnitPluginWindowCocoa*> (w.get())->isValid()) | |||
| w = nullptr; | |||
| w.reset(); | |||
| #if JUCE_SUPPORT_CARBON | |||
| if (w == nullptr) | |||
| @@ -2236,7 +2236,7 @@ AudioProcessorEditor* AudioUnitPluginInstance::createEditor() | |||
| #endif | |||
| if (w == nullptr) | |||
| w = new AudioUnitPluginWindowCocoa (*this, true); // use AUGenericView as a fallback | |||
| w.reset (new AudioUnitPluginWindowCocoa (*this, true)); // use AUGenericView as a fallback | |||
| return w.release(); | |||
| } | |||
| @@ -897,14 +897,14 @@ struct DescriptionFactory | |||
| if (pf2.loadFrom (factory)) | |||
| { | |||
| info2 = new PClassInfo2(); | |||
| pf2->getClassInfo2 (i, info2); | |||
| info2.reset (new PClassInfo2()); | |||
| pf2->getClassInfo2 (i, info2.get()); | |||
| } | |||
| if (pf3.loadFrom (factory)) | |||
| { | |||
| infoW = new PClassInfoW(); | |||
| pf3->getClassInfoUnicode (i, infoW); | |||
| infoW.reset (new PClassInfoW()); | |||
| pf3->getClassInfoUnicode (i, infoW.get()); | |||
| } | |||
| } | |||
| @@ -923,7 +923,7 @@ struct DescriptionFactory | |||
| auto numOutputs = getNumSingleDirectionChannelsFor (component, false, true); | |||
| createPluginDescription (desc, file, companyName, name, | |||
| info, info2, infoW, numInputs, numOutputs); | |||
| info, info2.get(), infoW.get(), numInputs, numOutputs); | |||
| component->terminate(); | |||
| } | |||
| @@ -1246,7 +1246,7 @@ private: | |||
| //============================================================================== | |||
| bool open (const File& f, const PluginDescription& description) | |||
| { | |||
| dllHandle = new DLLHandle (f.getFullPathName()); | |||
| dllHandle.reset (new DLLHandle (f.getFullPathName())); | |||
| ComSmartPtr<IPluginFactory> pluginFactory (dllHandle->getPluginFactory()); | |||
| @@ -1572,23 +1572,23 @@ struct VST3ComponentHolder | |||
| if (pf2.loadFrom (factory)) | |||
| { | |||
| info2 = new PClassInfo2(); | |||
| pf2->getClassInfo2 (classIdx, info2); | |||
| info2.reset (new PClassInfo2()); | |||
| pf2->getClassInfo2 (classIdx, info2.get()); | |||
| } | |||
| else | |||
| { | |||
| info2 = nullptr; | |||
| info2.reset(); | |||
| } | |||
| if (pf3.loadFrom (factory)) | |||
| { | |||
| pf3->setHostContext (host->getFUnknown()); | |||
| infoW = new PClassInfoW(); | |||
| pf3->getClassInfoUnicode (classIdx, infoW); | |||
| infoW.reset (new PClassInfoW()); | |||
| pf3->getClassInfoUnicode (classIdx, infoW.get()); | |||
| } | |||
| else | |||
| { | |||
| infoW = nullptr; | |||
| infoW.reset(); | |||
| } | |||
| Vst::BusInfo bus; | |||
| @@ -1606,7 +1606,7 @@ struct VST3ComponentHolder | |||
| createPluginDescription (description, module->file, | |||
| factoryInfo.vendor, module->name, | |||
| info, info2, infoW, | |||
| info, info2.get(), infoW.get(), | |||
| totalNumInputChannels, | |||
| totalNumOutputChannels); | |||
| @@ -2784,14 +2784,14 @@ void VST3PluginFormat::createPluginInstance (const PluginDescription& descriptio | |||
| if (const VST3Classes::VST3ModuleHandle::Ptr module = VST3Classes::VST3ModuleHandle::findOrCreateModule (file, description)) | |||
| { | |||
| ScopedPointer<VST3Classes::VST3ComponentHolder> holder = new VST3Classes::VST3ComponentHolder (module); | |||
| ScopedPointer<VST3Classes::VST3ComponentHolder> holder (new VST3Classes::VST3ComponentHolder (module)); | |||
| if (holder->initialise()) | |||
| { | |||
| result = new VST3Classes::VST3PluginInstance (holder.release()); | |||
| result.reset (new VST3Classes::VST3PluginInstance (holder.release())); | |||
| if (! result->initialise()) | |||
| result = nullptr; | |||
| result.reset(); | |||
| } | |||
| } | |||
| @@ -447,7 +447,7 @@ struct ModuleHandle : public ReferenceCountedObject | |||
| .findChildFiles (vstXmlFiles, File::findFiles, false, "*.vstxml"); | |||
| if (vstXmlFiles.size() > 0) | |||
| vstXml = XmlDocument::parse (vstXmlFiles.getReference(0)); | |||
| vstXml.reset (XmlDocument::parse (vstXmlFiles.getReference(0))); | |||
| } | |||
| } | |||
| @@ -2077,10 +2077,16 @@ public: | |||
| #if JUCE_SUPPORT_CARBON | |||
| if (! plug.usesCocoaNSView) | |||
| addAndMakeVisible (carbonWrapper = new CarbonWrapperComponent (*this)); | |||
| { | |||
| carbonWrapper.reset (new CarbonWrapperComponent (*this)); | |||
| addAndMakeVisible (carbonWrapper.get()); | |||
| } | |||
| else | |||
| #endif | |||
| addAndMakeVisible (cocoaWrapper = new AutoResizingNSViewComponentWithParent()); | |||
| { | |||
| cocoaWrapper.reset (new AutoResizingNSViewComponentWithParent()); | |||
| addAndMakeVisible (cocoaWrapper.get()); | |||
| } | |||
| #endif | |||
| activeVSTWindows.add (this); | |||
| @@ -2096,9 +2102,9 @@ public: | |||
| #if JUCE_MAC | |||
| #if JUCE_SUPPORT_CARBON | |||
| carbonWrapper = nullptr; | |||
| carbonWrapper.reset(); | |||
| #endif | |||
| cocoaWrapper = nullptr; | |||
| cocoaWrapper.reset(); | |||
| #elif JUCE_LINUX | |||
| display = XWindowSystem::getInstance()->displayUnref(); | |||
| #endif | |||
| @@ -2791,10 +2797,10 @@ void VSTPluginFormat::createPluginInstance (const PluginDescription& desc, | |||
| { | |||
| shellUIDToCreate = desc.uid; | |||
| result = VSTPluginInstance::create (module, sampleRate, blockSize); | |||
| result.reset (VSTPluginInstance::create (module, sampleRate, blockSize)); | |||
| if (result != nullptr && ! result->initialiseEffect (sampleRate, blockSize)) | |||
| result = nullptr; | |||
| result.reset(); | |||
| } | |||
| previousWorkingDirectory.setAsCurrentWorkingDirectory(); | |||
| @@ -2954,9 +2960,13 @@ AudioPluginInstance* VSTPluginFormat::createCustomVSTFromMainCall (void* entryPo | |||
| ModuleHandle::Ptr module = new ModuleHandle (File(), (MainCall) entryPointFunction); | |||
| if (module->open()) | |||
| if (ScopedPointer<VSTPluginInstance> result = VSTPluginInstance::create (module, initialSampleRate, initialBufferSize)) | |||
| { | |||
| ScopedPointer<VSTPluginInstance> result (VSTPluginInstance::create (module, initialSampleRate, initialBufferSize)); | |||
| if (result != nullptr) | |||
| if (result->initialiseEffect (initialSampleRate, initialBufferSize)) | |||
| return result.release(); | |||
| } | |||
| return nullptr; | |||
| } | |||
| @@ -2966,7 +2976,7 @@ void VSTPluginFormat::setExtraFunctions (AudioPluginInstance* plugin, ExtraFunct | |||
| ScopedPointer<ExtraFunctions> f (functions); | |||
| if (auto* vst = dynamic_cast<VSTPluginInstance*> (plugin)) | |||
| vst->extraFunctions = f; | |||
| std::swap (vst->extraFunctions, f); | |||
| } | |||
| AudioPluginInstance* VSTPluginFormat::getPluginInstanceFromVstEffectInterface (void* aEffect) | |||
| @@ -46,7 +46,7 @@ AudioProcessorEditor::~AudioProcessorEditor() | |||
| // if this fails, then the wrapper hasn't called editorBeingDeleted() on the | |||
| // filter for some reason.. | |||
| jassert (processor.getActiveEditor() != this); | |||
| removeComponentListener (resizeListener); | |||
| removeComponentListener (resizeListener.get()); | |||
| } | |||
| void AudioProcessorEditor::setControlHighlight (ParameterControlHighlightInfo) {} | |||
| @@ -77,7 +77,8 @@ void AudioProcessorEditor::initialise() | |||
| resizable = false; | |||
| attachConstrainer (&defaultConstrainer); | |||
| addComponentListener (resizeListener = new AudioProcessorEditorListener (*this)); | |||
| resizeListener.reset (new AudioProcessorEditorListener (*this)); | |||
| addComponentListener (resizeListener.get()); | |||
| } | |||
| //============================================================================== | |||
| @@ -108,7 +109,8 @@ void AudioProcessorEditor::setResizable (const bool shouldBeResizable, const boo | |||
| { | |||
| if (shouldHaveCornerResizer) | |||
| { | |||
| Component::addChildComponent (resizableCorner = new ResizableCornerComponent (this, constrainer)); | |||
| resizableCorner.reset (new ResizableCornerComponent (this, constrainer)); | |||
| Component::addChildComponent (resizableCorner.get()); | |||
| resizableCorner->setAlwaysOnTop (true); | |||
| } | |||
| else | |||
| @@ -1144,8 +1144,8 @@ void AudioProcessorGraph::clearRenderingSequence() | |||
| { | |||
| const ScopedLock sl (getCallbackLock()); | |||
| renderSequenceFloat.swapWith (oldSequenceF); | |||
| renderSequenceDouble.swapWith (oldSequenceD); | |||
| std::swap (renderSequenceFloat, oldSequenceF); | |||
| std::swap (renderSequenceDouble, oldSequenceD); | |||
| } | |||
| } | |||
| @@ -1187,8 +1187,8 @@ void AudioProcessorGraph::buildRenderingSequence() | |||
| const ScopedLock sl (getCallbackLock()); | |||
| renderSequenceFloat.swapWith (newSequenceF); | |||
| renderSequenceDouble.swapWith (newSequenceD); | |||
| std::swap (renderSequenceFloat, newSequenceF); | |||
| std::swap (renderSequenceDouble, newSequenceD); | |||
| } | |||
| void AudioProcessorGraph::handleAsyncUpdate() | |||
| @@ -96,7 +96,7 @@ public: | |||
| const NodeID nodeID; | |||
| /** The actual processor object that this node represents. */ | |||
| AudioProcessor* getProcessor() const noexcept { return processor; } | |||
| AudioProcessor* getProcessor() const noexcept { return processor.get(); } | |||
| /** A set of user-definable properties that are associated with this node. | |||
| @@ -115,7 +115,7 @@ bool KnownPluginList::isListingUpToDate (const String& fileOrIdentifier, | |||
| void KnownPluginList::setCustomScanner (CustomScanner* newScanner) | |||
| { | |||
| scanner = newScanner; | |||
| scanner.reset (newScanner); | |||
| } | |||
| bool KnownPluginList::scanAndAddFile (const String& fileOrIdentifier, | |||
| @@ -425,7 +425,7 @@ struct PluginTreeUtils | |||
| { | |||
| current->folder = lastType; | |||
| tree.subFolders.add (current.release()); | |||
| current = new KnownPluginList::PluginTree(); | |||
| current.reset (new KnownPluginList::PluginTree()); | |||
| } | |||
| lastType = thisType; | |||
| @@ -142,7 +142,7 @@ PluginListComponent::PluginListComponent (AudioPluginFormatManager& manager, Kno | |||
| allowAsync (allowPluginsWhichRequireAsynchronousInstantiation), | |||
| numThreads (allowAsync ? 1 : 0) | |||
| { | |||
| tableModel = new TableModel (*this, listToEdit); | |||
| tableModel.reset (new TableModel (*this, listToEdit)); | |||
| TableHeaderComponent& header = table.getHeader(); | |||
| @@ -154,7 +154,7 @@ PluginListComponent::PluginListComponent (AudioPluginFormatManager& manager, Kno | |||
| table.setHeaderHeight (22); | |||
| table.setRowHeight (20); | |||
| table.setModel (tableModel); | |||
| table.setModel (tableModel.get()); | |||
| table.setMultipleSelectionEnabled (true); | |||
| addAndMakeVisible (table); | |||
| @@ -228,8 +228,8 @@ void PluginListComponent::removeSelectedPlugins() | |||
| void PluginListComponent::setTableModel (TableListBoxModel* model) | |||
| { | |||
| table.setModel (nullptr); | |||
| tableModel = model; | |||
| table.setModel (tableModel); | |||
| tableModel.reset (model); | |||
| table.setModel (tableModel.get()); | |||
| table.getHeader().reSortTable(); | |||
| table.updateContent(); | |||
| @@ -479,8 +479,8 @@ private: | |||
| { | |||
| pathChooserWindow.setVisible (false); | |||
| scanner = new PluginDirectoryScanner (owner.list, formatToScan, pathList.getPath(), | |||
| true, owner.deadMansPedalFile, allowAsync); | |||
| scanner.reset (new PluginDirectoryScanner (owner.list, formatToScan, pathList.getPath(), | |||
| true, owner.deadMansPedalFile, allowAsync)); | |||
| if (propertiesToUse != nullptr) | |||
| { | |||
| @@ -494,7 +494,7 @@ private: | |||
| if (numThreads > 0) | |||
| { | |||
| pool = new ThreadPool (numThreads); | |||
| pool.reset (new ThreadPool (numThreads)); | |||
| for (int i = numThreads; --i >= 0;) | |||
| pool->addJob (new ScanJob (*this), true); | |||
| @@ -560,9 +560,9 @@ private: | |||
| void PluginListComponent::scanFor (AudioPluginFormat& format) | |||
| { | |||
| currentScanner = new Scanner (*this, format, propertiesToUse, allowAsync, numThreads, | |||
| dialogTitle.isNotEmpty() ? dialogTitle : TRANS("Scanning for plug-ins..."), | |||
| dialogText.isNotEmpty() ? dialogText : TRANS("Searching for all possible plug-in files...")); | |||
| currentScanner.reset (new Scanner (*this, format, propertiesToUse, allowAsync, numThreads, | |||
| dialogTitle.isNotEmpty() ? dialogTitle : TRANS("Scanning for plug-ins..."), | |||
| dialogText.isNotEmpty() ? dialogText : TRANS("Searching for all possible plug-in files..."))); | |||
| } | |||
| bool PluginListComponent::isScanning() const noexcept | |||
| @@ -574,8 +574,8 @@ void PluginListComponent::scanFinished (const StringArray& failedFiles) | |||
| { | |||
| StringArray shortNames; | |||
| for (int i = 0; i < failedFiles.size(); ++i) | |||
| shortNames.add (File::createFileWithoutCheckingPath (failedFiles[i]).getFileName()); | |||
| for (auto& f : failedFiles) | |||
| shortNames.add (File::createFileWithoutCheckingPath (f).getFileName()); | |||
| currentScanner.reset(); // mustn't delete this before using the failed files array | |||
| @@ -207,7 +207,8 @@ public: | |||
| { | |||
| if (hideAdvancedOptionsWithButton) | |||
| { | |||
| addAndMakeVisible (showAdvancedSettingsButton = new TextButton (TRANS("Show advanced settings..."))); | |||
| showAdvancedSettingsButton.reset (new TextButton (TRANS("Show advanced settings..."))); | |||
| addAndMakeVisible (showAdvancedSettingsButton.get()); | |||
| showAdvancedSettingsButton->onClick = [this] { showAdvanced(); }; | |||
| } | |||
| @@ -353,8 +354,8 @@ public: | |||
| error = setup.manager->setAudioDeviceSetup (config, true); | |||
| showCorrectDeviceName (inputDeviceDropDown, true); | |||
| showCorrectDeviceName (outputDeviceDropDown, false); | |||
| showCorrectDeviceName (inputDeviceDropDown.get(), true); | |||
| showCorrectDeviceName (outputDeviceDropDown.get(), false); | |||
| updateControlPanelButton(); | |||
| resized(); | |||
| @@ -433,12 +434,12 @@ public: | |||
| { | |||
| if (outputChanList == nullptr) | |||
| { | |||
| addAndMakeVisible (outputChanList | |||
| = new ChannelSelectorListBox (setup, ChannelSelectorListBox::audioOutputType, | |||
| TRANS ("(no audio output channels found)"))); | |||
| outputChanLabel = new Label ({}, TRANS("Active output channels:")); | |||
| outputChanList.reset (new ChannelSelectorListBox (setup, ChannelSelectorListBox::audioOutputType, | |||
| TRANS ("(no audio output channels found)"))); | |||
| addAndMakeVisible (outputChanList.get()); | |||
| outputChanLabel.reset (new Label ({}, TRANS("Active output channels:"))); | |||
| outputChanLabel->setJustificationType (Justification::centredRight); | |||
| outputChanLabel->attachToComponent (outputChanList, true); | |||
| outputChanLabel->attachToComponent (outputChanList.get(), true); | |||
| } | |||
| outputChanList->refresh(); | |||
| @@ -454,12 +455,12 @@ public: | |||
| { | |||
| if (inputChanList == nullptr) | |||
| { | |||
| addAndMakeVisible (inputChanList | |||
| = new ChannelSelectorListBox (setup, ChannelSelectorListBox::audioInputType, | |||
| TRANS("(no audio input channels found)"))); | |||
| inputChanLabel = new Label ({}, TRANS("Active input channels:")); | |||
| inputChanList.reset (new ChannelSelectorListBox (setup, ChannelSelectorListBox::audioInputType, | |||
| TRANS("(no audio input channels found)"))); | |||
| addAndMakeVisible (inputChanList.get()); | |||
| inputChanLabel.reset (new Label ({}, TRANS("Active input channels:"))); | |||
| inputChanLabel->setJustificationType (Justification::centredRight); | |||
| inputChanLabel->attachToComponent (inputChanList, true); | |||
| inputChanLabel->attachToComponent (inputChanList.get(), true); | |||
| } | |||
| inputChanList->refresh(); | |||
| @@ -564,8 +565,9 @@ private: | |||
| if (currentDevice != nullptr && currentDevice->hasControlPanel()) | |||
| { | |||
| addAndMakeVisible (showUIButton = new TextButton (TRANS ("Control Panel"), | |||
| TRANS ("Opens the device's own control panel"))); | |||
| showUIButton.reset (new TextButton (TRANS ("Control Panel"), | |||
| TRANS ("Opens the device's own control panel"))); | |||
| addAndMakeVisible (showUIButton.get()); | |||
| showUIButton->onClick = [this] { showDeviceUIPanel(); }; | |||
| } | |||
| @@ -580,9 +582,9 @@ private: | |||
| { | |||
| if (resetDeviceButton == nullptr) | |||
| { | |||
| addAndMakeVisible (resetDeviceButton = new TextButton (TRANS ("Reset Device"), | |||
| TRANS ("Resets the audio interface - sometimes needed after changing a device's properties in its custom control panel"))); | |||
| resetDeviceButton.reset (new TextButton (TRANS ("Reset Device"), | |||
| TRANS ("Resets the audio interface - sometimes needed after changing a device's properties in its custom control panel"))); | |||
| addAndMakeVisible (resetDeviceButton.get()); | |||
| resetDeviceButton->onClick = [this] { resetDevice(); }; | |||
| resized(); | |||
| } | |||
| @@ -600,19 +602,19 @@ private: | |||
| { | |||
| if (outputDeviceDropDown == nullptr) | |||
| { | |||
| outputDeviceDropDown = new ComboBox(); | |||
| outputDeviceDropDown.reset (new ComboBox()); | |||
| outputDeviceDropDown->onChange = [this] { updateConfig (true, false, false, false); }; | |||
| addAndMakeVisible (outputDeviceDropDown); | |||
| addAndMakeVisible (outputDeviceDropDown.get()); | |||
| outputDeviceLabel = new Label ({}, type.hasSeparateInputsAndOutputs() ? TRANS("Output:") | |||
| : TRANS("Device:")); | |||
| outputDeviceLabel->attachToComponent (outputDeviceDropDown, true); | |||
| outputDeviceLabel.reset (new Label ({}, type.hasSeparateInputsAndOutputs() ? TRANS("Output:") | |||
| : TRANS("Device:"))); | |||
| outputDeviceLabel->attachToComponent (outputDeviceDropDown.get(), true); | |||
| if (setup.maxNumOutputChannels > 0) | |||
| { | |||
| addAndMakeVisible (testButton = new TextButton (TRANS("Test"), | |||
| TRANS("Plays a test tone"))); | |||
| testButton.reset (new TextButton (TRANS("Test"), TRANS("Plays a test tone"))); | |||
| addAndMakeVisible (testButton.get()); | |||
| testButton->onClick = [this] { playTestSound(); }; | |||
| } | |||
| } | |||
| @@ -620,7 +622,7 @@ private: | |||
| addNamesToDeviceBox (*outputDeviceDropDown, false); | |||
| } | |||
| showCorrectDeviceName (outputDeviceDropDown, false); | |||
| showCorrectDeviceName (outputDeviceDropDown.get(), false); | |||
| } | |||
| void updateInputsComboBox() | |||
| @@ -629,31 +631,32 @@ private: | |||
| { | |||
| if (inputDeviceDropDown == nullptr) | |||
| { | |||
| inputDeviceDropDown = new ComboBox(); | |||
| inputDeviceDropDown.reset (new ComboBox()); | |||
| inputDeviceDropDown->onChange = [this] { updateConfig (false, true, false, false); }; | |||
| addAndMakeVisible (inputDeviceDropDown); | |||
| addAndMakeVisible (inputDeviceDropDown.get()); | |||
| inputDeviceLabel = new Label ({}, TRANS("Input:")); | |||
| inputDeviceLabel->attachToComponent (inputDeviceDropDown, true); | |||
| inputDeviceLabel.reset (new Label ({}, TRANS("Input:"))); | |||
| inputDeviceLabel->attachToComponent (inputDeviceDropDown.get(), true); | |||
| addAndMakeVisible (inputLevelMeter | |||
| = new SimpleDeviceManagerInputLevelMeter (*setup.manager)); | |||
| inputLevelMeter.reset (new SimpleDeviceManagerInputLevelMeter (*setup.manager)); | |||
| addAndMakeVisible (inputLevelMeter.get()); | |||
| } | |||
| addNamesToDeviceBox (*inputDeviceDropDown, true); | |||
| } | |||
| showCorrectDeviceName (inputDeviceDropDown, true); | |||
| showCorrectDeviceName (inputDeviceDropDown.get(), true); | |||
| } | |||
| void updateSampleRateComboBox (AudioIODevice* currentDevice) | |||
| { | |||
| if (sampleRateDropDown == nullptr) | |||
| { | |||
| addAndMakeVisible (sampleRateDropDown = new ComboBox()); | |||
| sampleRateDropDown.reset (new ComboBox()); | |||
| addAndMakeVisible (sampleRateDropDown.get()); | |||
| sampleRateLabel = new Label ({}, TRANS("Sample rate:")); | |||
| sampleRateLabel->attachToComponent (sampleRateDropDown, true); | |||
| sampleRateLabel.reset (new Label ({}, TRANS("Sample rate:"))); | |||
| sampleRateLabel->attachToComponent (sampleRateDropDown.get(), true); | |||
| } | |||
| else | |||
| { | |||
| @@ -675,10 +678,11 @@ private: | |||
| { | |||
| if (bufferSizeDropDown == nullptr) | |||
| { | |||
| addAndMakeVisible (bufferSizeDropDown = new ComboBox()); | |||
| bufferSizeDropDown.reset (new ComboBox()); | |||
| addAndMakeVisible (bufferSizeDropDown.get()); | |||
| bufferSizeLabel = new Label ({}, TRANS("Audio buffer size:")); | |||
| bufferSizeLabel->attachToComponent (bufferSizeDropDown, true); | |||
| bufferSizeLabel.reset (new Label ({}, TRANS("Audio buffer size:"))); | |||
| bufferSizeLabel->attachToComponent (bufferSizeDropDown.get(), true); | |||
| } | |||
| else | |||
| { | |||
| @@ -975,33 +979,33 @@ AudioDeviceSelectorComponent::AudioDeviceSelectorComponent (AudioDeviceManager& | |||
| if (types.size() > 1) | |||
| { | |||
| deviceTypeDropDown = new ComboBox(); | |||
| deviceTypeDropDown.reset (new ComboBox()); | |||
| for (int i = 0; i < types.size(); ++i) | |||
| deviceTypeDropDown->addItem (types.getUnchecked(i)->getTypeName(), i + 1); | |||
| addAndMakeVisible (deviceTypeDropDown); | |||
| addAndMakeVisible (deviceTypeDropDown.get()); | |||
| deviceTypeDropDown->onChange = [this] { updateDeviceType(); }; | |||
| deviceTypeDropDownLabel = new Label ({}, TRANS("Audio device type:")); | |||
| deviceTypeDropDownLabel.reset (new Label ({}, TRANS("Audio device type:"))); | |||
| deviceTypeDropDownLabel->setJustificationType (Justification::centredRight); | |||
| deviceTypeDropDownLabel->attachToComponent (deviceTypeDropDown, true); | |||
| deviceTypeDropDownLabel->attachToComponent (deviceTypeDropDown.get(), true); | |||
| } | |||
| if (showMidiInputOptions) | |||
| { | |||
| addAndMakeVisible (midiInputsList | |||
| = new MidiInputSelectorComponentListBox (deviceManager, | |||
| midiInputsList.reset (new MidiInputSelectorComponentListBox (deviceManager, | |||
| "(" + TRANS("No MIDI inputs available") + ")")); | |||
| addAndMakeVisible (midiInputsList.get()); | |||
| midiInputsLabel = new Label ({}, TRANS ("Active MIDI inputs:")); | |||
| midiInputsLabel.reset (new Label ({}, TRANS ("Active MIDI inputs:"))); | |||
| midiInputsLabel->setJustificationType (Justification::topRight); | |||
| midiInputsLabel->attachToComponent (midiInputsList, true); | |||
| midiInputsLabel->attachToComponent (midiInputsList.get(), true); | |||
| if (BluetoothMidiDevicePairingDialogue::isAvailable()) | |||
| { | |||
| addAndMakeVisible (bluetoothButton = new TextButton (TRANS("Bluetooth MIDI"), | |||
| TRANS("Scan for bluetooth MIDI devices"))); | |||
| bluetoothButton.reset (new TextButton (TRANS("Bluetooth MIDI"), TRANS("Scan for bluetooth MIDI devices"))); | |||
| addAndMakeVisible (bluetoothButton.get()); | |||
| bluetoothButton->onClick = [this] { handleBluetoothButton(); }; | |||
| } | |||
| } | |||
| @@ -1014,11 +1018,12 @@ AudioDeviceSelectorComponent::AudioDeviceSelectorComponent (AudioDeviceManager& | |||
| if (showMidiOutputSelector) | |||
| { | |||
| addAndMakeVisible (midiOutputSelector = new ComboBox()); | |||
| midiOutputSelector.reset (new ComboBox()); | |||
| addAndMakeVisible (midiOutputSelector.get()); | |||
| midiOutputSelector->onChange = [this] { updateMidiOutput(); }; | |||
| midiOutputLabel = new Label ("lm", TRANS("MIDI Output:")); | |||
| midiOutputLabel->attachToComponent (midiOutputSelector, true); | |||
| midiOutputLabel.reset (new Label ("lm", TRANS("MIDI Output:"))); | |||
| midiOutputLabel->attachToComponent (midiOutputSelector.get(), true); | |||
| } | |||
| else | |||
| { | |||
| @@ -1139,7 +1144,7 @@ void AudioDeviceSelectorComponent::updateAllControls() | |||
| details.useStereoPairs = showChannelsAsStereoPairs; | |||
| auto* sp = new AudioDeviceSettingsPanel (*type, details, hideAdvancedOptionsWithButton); | |||
| audioDeviceSettingsComp = sp; | |||
| audioDeviceSettingsComp.reset (sp); | |||
| addAndMakeVisible (sp); | |||
| sp->updateAllControls(); | |||
| } | |||
| @@ -1186,7 +1191,7 @@ void AudioDeviceSelectorComponent::handleBluetoothButton() | |||
| ListBox* AudioDeviceSelectorComponent::getMidiInputSelectorListBox() const noexcept | |||
| { | |||
| return midiInputsList; | |||
| return midiInputsList.get(); | |||
| } | |||
| } // namespace juce | |||
| @@ -219,8 +219,8 @@ private: | |||
| void createReader() | |||
| { | |||
| if (reader == nullptr && source != nullptr) | |||
| if (InputStream* audioFileStream = source->createInputStream()) | |||
| reader = owner.formatManagerToUse.createReaderFor (audioFileStream); | |||
| if (auto* audioFileStream = source->createInputStream()) | |||
| reader.reset (owner.formatManagerToUse.createReaderFor (audioFileStream)); | |||
| } | |||
| bool readNextBlock() | |||
| @@ -648,7 +648,7 @@ bool AudioThumbnail::setDataSource (LevelDataSource* newSource) | |||
| if (cache.loadThumb (*this, newSource->hashCode) && isFullyLoaded()) | |||
| { | |||
| source = newSource; // (make sure this isn't done before loadThumb is called) | |||
| source.reset (newSource); // (make sure this isn't done before loadThumb is called) | |||
| source->lengthInSamples = totalSamples; | |||
| source->sampleRate = sampleRate; | |||
| @@ -657,7 +657,7 @@ bool AudioThumbnail::setDataSource (LevelDataSource* newSource) | |||
| } | |||
| else | |||
| { | |||
| source = newSource; // (make sure this isn't done before loadThumb is called) | |||
| source.reset (newSource); // (make sure this isn't done before loadThumb is called) | |||
| const ScopedLock sl (lock); | |||
| source->initialise (numSamplesFinished); | |||
| @@ -807,7 +807,7 @@ void AudioThumbnail::drawChannel (Graphics& g, const Rectangle<int>& area, doubl | |||
| const ScopedLock sl (lock); | |||
| window->drawChannel (g, area, startTime, endTime, channelNum, verticalZoomFactor, | |||
| sampleRate, numChannels, samplesPerThumbSample, source, channels); | |||
| sampleRate, numChannels, samplesPerThumbSample, source.get(), channels); | |||
| } | |||
| void AudioThumbnail::drawChannels (Graphics& g, const Rectangle<int>& area, double startTimeSeconds, | |||
| @@ -68,8 +68,11 @@ private: | |||
| MidiKeyboardComponent::MidiKeyboardComponent (MidiKeyboardState& s, Orientation o) | |||
| : state (s), orientation (o) | |||
| { | |||
| addChildComponent (scrollDown = new UpDownButton (*this, -1)); | |||
| addChildComponent (scrollUp = new UpDownButton (*this, 1)); | |||
| scrollDown.reset (new UpDownButton (*this, -1)); | |||
| scrollUp .reset (new UpDownButton (*this, 1)); | |||
| addChildComponent (scrollDown.get()); | |||
| addChildComponent (scrollUp.get()); | |||
| // initialise with a default set of qwerty key-mappings.. | |||
| int note = 0; | |||
| @@ -411,7 +411,7 @@ public: | |||
| { | |||
| toDelete.reset (data.elements[indexToChange]); | |||
| if (toDelete == newObject) | |||
| if (toDelete.get() == newObject) | |||
| toDelete.release(); | |||
| } | |||
| @@ -389,7 +389,7 @@ struct JavascriptEngine::RootObject : public DynamicObject | |||
| struct DotOperator : public Expression | |||
| { | |||
| DotOperator (const CodeLocation& l, ExpPtr& p, const Identifier& c) noexcept : Expression (l), parent (p), child (c) {} | |||
| DotOperator (const CodeLocation& l, ExpPtr& p, const Identifier& c) noexcept : Expression (l), parent (p.release()), child (c) {} | |||
| var getResult (const Scope& s) const override | |||
| { | |||
| @@ -478,7 +478,7 @@ struct JavascriptEngine::RootObject : public DynamicObject | |||
| struct BinaryOperatorBase : public Expression | |||
| { | |||
| BinaryOperatorBase (const CodeLocation& l, ExpPtr& a, ExpPtr& b, TokenType op) noexcept | |||
| : Expression (l), lhs (a), rhs (b), operation (op) {} | |||
| : Expression (l), lhs (a.release()), rhs (b.release()), operation (op) {} | |||
| ExpPtr lhs, rhs; | |||
| TokenType operation; | |||
| @@ -674,7 +674,7 @@ struct JavascriptEngine::RootObject : public DynamicObject | |||
| struct Assignment : public Expression | |||
| { | |||
| Assignment (const CodeLocation& l, ExpPtr& dest, ExpPtr& source) noexcept : Expression (l), target (dest), newValue (source) {} | |||
| Assignment (const CodeLocation& l, ExpPtr& dest, ExpPtr& source) noexcept : Expression (l), target (dest.release()), newValue (source.release()) {} | |||
| var getResult (const Scope& s) const override | |||
| { | |||
| @@ -1080,7 +1080,7 @@ struct JavascriptEngine::RootObject : public DynamicObject | |||
| } | |||
| match (TokenTypes::closeParen); | |||
| fo.body = parseBlock(); | |||
| fo.body.reset (parseBlock()); | |||
| } | |||
| Expression* parseExpression() | |||
| @@ -1270,7 +1270,7 @@ struct JavascriptEngine::RootObject : public DynamicObject | |||
| Expression* parseFunctionCall (FunctionCall* call, ExpPtr& function) | |||
| { | |||
| ScopedPointer<FunctionCall> s (call); | |||
| s->object = function; | |||
| s->object.reset (function.release()); | |||
| match (TokenTypes::openParen); | |||
| while (currentType != TokenTypes::closeParen) | |||
| @@ -1296,7 +1296,7 @@ struct JavascriptEngine::RootObject : public DynamicObject | |||
| if (matchIf (TokenTypes::openBracket)) | |||
| { | |||
| ScopedPointer<ArraySubscript> s (new ArraySubscript (location)); | |||
| s->object = input; | |||
| s->object.reset (input.release()); | |||
| s->index.reset (parseExpression()); | |||
| match (TokenTypes::closeBracket); | |||
| return parseSuffixes (s.release()); | |||
| @@ -1505,7 +1505,7 @@ struct JavascriptEngine::RootObject : public DynamicObject | |||
| Expression* parseTernaryOperator (ExpPtr& condition) | |||
| { | |||
| ScopedPointer<ConditionalOp> e (new ConditionalOp (location)); | |||
| e->condition = condition; | |||
| e->condition.reset (condition.release()); | |||
| e->trueBranch.reset (parseExpression()); | |||
| match (TokenTypes::colon); | |||
| e->falseBranch.reset (parseExpression()); | |||
| @@ -1023,22 +1023,22 @@ Expression Expression::adjustedToGiveNewResult (const double targetValue, const | |||
| { | |||
| ScopedPointer<Term> newTerm (term->clone()); | |||
| Helpers::Constant* termToAdjust = Helpers::findTermToAdjust (newTerm, true); | |||
| Helpers::Constant* termToAdjust = Helpers::findTermToAdjust (newTerm.get(), true); | |||
| if (termToAdjust == nullptr) | |||
| termToAdjust = Helpers::findTermToAdjust (newTerm, false); | |||
| termToAdjust = Helpers::findTermToAdjust (newTerm.get(), false); | |||
| if (termToAdjust == nullptr) | |||
| { | |||
| newTerm = new Helpers::Add (newTerm.release(), new Helpers::Constant (0, false)); | |||
| termToAdjust = Helpers::findTermToAdjust (newTerm, false); | |||
| newTerm.reset (new Helpers::Add (newTerm.release(), new Helpers::Constant (0, false))); | |||
| termToAdjust = Helpers::findTermToAdjust (newTerm.get(), false); | |||
| } | |||
| jassert (termToAdjust != nullptr); | |||
| if (const Term* parent = Helpers::findDestinationFor (newTerm, termToAdjust)) | |||
| if (const Term* parent = Helpers::findDestinationFor (newTerm.get(), termToAdjust)) | |||
| { | |||
| if (const Helpers::TermPtr reverseTerm = parent->createTermToEvaluateInput (scope, termToAdjust, targetValue, newTerm)) | |||
| if (Helpers::TermPtr reverseTerm = parent->createTermToEvaluateInput (scope, termToAdjust, targetValue, newTerm.get())) | |||
| termToAdjust->value = Expression (reverseTerm).evaluate (scope); | |||
| else | |||
| return Expression (targetValue); | |||
| @@ -66,7 +66,7 @@ namespace FunctionTestsHelpers | |||
| FunctionObject (const FunctionObject& other) | |||
| { | |||
| bigData = new BigData (*other.bigData); | |||
| bigData.reset (new BigData (*other.bigData)); | |||
| } | |||
| int operator()(int i) const { return bigData->sum() + i; } | |||
| @@ -1118,7 +1118,7 @@ private: | |||
| [req addValue: juceStringToNS (value) forHTTPHeaderField: juceStringToNS (key)]; | |||
| } | |||
| connection = new URLConnectionState (req, numRedirectsToFollow); | |||
| connection.reset (new URLConnectionState (req, numRedirectsToFollow)); | |||
| } | |||
| } | |||
| @@ -1257,7 +1257,7 @@ bool ChildProcess::start (const StringArray& args, int streamFlags) | |||
| if (args.size() == 0) | |||
| return false; | |||
| activeProcess = new ActiveProcess (args, streamFlags); | |||
| activeProcess.reset (new ActiveProcess (args, streamFlags)); | |||
| if (activeProcess->childPID == 0) | |||
| activeProcess.reset(); | |||
| @@ -118,9 +118,11 @@ URL::DownloadTask* URL::DownloadTask::createFallbackDownloader (const URL& urlTo | |||
| const size_t bufferSize = 0x8000; | |||
| targetFileToUse.deleteFile(); | |||
| if (ScopedPointer<FileOutputStream> outputStream = targetFileToUse.createOutputStream (bufferSize)) | |||
| ScopedPointer<FileOutputStream> outputStream (targetFileToUse.createOutputStream (bufferSize)); | |||
| if (outputStream != nullptr) | |||
| { | |||
| ScopedPointer<WebInputStream> stream = new WebInputStream (urlToUse, usePostRequest); | |||
| ScopedPointer<WebInputStream> stream (new WebInputStream (urlToUse, usePostRequest)); | |||
| stream->withExtraHeaders (extraHeadersToUse); | |||
| if (stream->connect (nullptr)) | |||
| @@ -650,10 +652,9 @@ InputStream* URL::createInputStream (const bool usePostCommand, | |||
| ScopedPointer<WebInputStream> wi (new WebInputStream (*this, usePostCommand)); | |||
| struct ProgressCallbackCaller : WebInputStream::Listener | |||
| struct ProgressCallbackCaller : public WebInputStream::Listener | |||
| { | |||
| ProgressCallbackCaller (OpenStreamProgressCallback* const progressCallbackToUse, | |||
| void* const progressCallbackContextToUse) | |||
| ProgressCallbackCaller (OpenStreamProgressCallback* progressCallbackToUse, void* progressCallbackContextToUse) | |||
| : callback (progressCallbackToUse), data (progressCallbackContextToUse) | |||
| {} | |||
| @@ -670,7 +671,7 @@ InputStream* URL::createInputStream (const bool usePostCommand, | |||
| ProgressCallbackCaller& operator= (const ProgressCallbackCaller&) { jassertfalse; return *this; } | |||
| }; | |||
| ScopedPointer<ProgressCallbackCaller> callbackCaller = | |||
| ScopedPointer<ProgressCallbackCaller> callbackCaller | |||
| (progressCallback != nullptr ? new ProgressCallbackCaller (progressCallback, progressCallbackContext) : nullptr); | |||
| if (headers.isNotEmpty()) | |||
| @@ -684,7 +685,7 @@ InputStream* URL::createInputStream (const bool usePostCommand, | |||
| wi->withNumRedirectsToFollow (numRedirectsToFollow); | |||
| bool success = wi->connect (callbackCaller); | |||
| bool success = wi->connect (callbackCaller.get()); | |||
| if (statusCode != nullptr) | |||
| *statusCode = wi->getStatusCode(); | |||
| @@ -44,7 +44,7 @@ LocalisedStrings& LocalisedStrings::operator= (const LocalisedStrings& other) | |||
| languageName = other.languageName; | |||
| countryCodes = other.countryCodes; | |||
| translations = other.translations; | |||
| fallback = createCopyIfNotNull (other.fallback.get()); | |||
| fallback.reset (createCopyIfNotNull (other.fallback.get())); | |||
| return *this; | |||
| } | |||
| @@ -171,19 +171,19 @@ void LocalisedStrings::addStrings (const LocalisedStrings& other) | |||
| void LocalisedStrings::setFallback (LocalisedStrings* f) | |||
| { | |||
| fallback = f; | |||
| fallback.reset (f); | |||
| } | |||
| //============================================================================== | |||
| void LocalisedStrings::setCurrentMappings (LocalisedStrings* newTranslations) | |||
| { | |||
| const SpinLock::ScopedLockType sl (currentMappingsLock); | |||
| currentMappings = newTranslations; | |||
| currentMappings.reset (newTranslations); | |||
| } | |||
| LocalisedStrings* LocalisedStrings::getCurrentMappings() | |||
| { | |||
| return currentMappings; | |||
| return currentMappings.get(); | |||
| } | |||
| String LocalisedStrings::translateWithCurrentMappings (const String& text) { return juce::translate (text); } | |||
| @@ -40,25 +40,25 @@ XmlElement* XmlDocument::parse (const String& xmlData) | |||
| return doc.getDocumentElement(); | |||
| } | |||
| void XmlDocument::setInputSource (InputSource* const newSource) noexcept | |||
| void XmlDocument::setInputSource (InputSource* newSource) noexcept | |||
| { | |||
| inputSource = newSource; | |||
| inputSource.reset (newSource); | |||
| } | |||
| void XmlDocument::setEmptyTextElementsIgnored (const bool shouldBeIgnored) noexcept | |||
| void XmlDocument::setEmptyTextElementsIgnored (bool shouldBeIgnored) noexcept | |||
| { | |||
| ignoreEmptyTextElements = shouldBeIgnored; | |||
| } | |||
| namespace XmlIdentifierChars | |||
| { | |||
| static bool isIdentifierCharSlow (const juce_wchar c) noexcept | |||
| static bool isIdentifierCharSlow (juce_wchar c) noexcept | |||
| { | |||
| return CharacterFunctions::isLetterOrDigit (c) | |||
| || c == '_' || c == '-' || c == ':' || c == '.'; | |||
| } | |||
| static bool isIdentifierChar (const juce_wchar c) noexcept | |||
| static bool isIdentifierChar (juce_wchar c) noexcept | |||
| { | |||
| static const uint32 legalChars[] = { 0, 0x7ff6000, 0x87fffffe, 0x7fffffe, 0 }; | |||
| @@ -93,7 +93,9 @@ XmlElement* XmlDocument::getDocumentElement (const bool onlyReadOuterDocumentEle | |||
| { | |||
| if (originalText.isEmpty() && inputSource != nullptr) | |||
| { | |||
| if (ScopedPointer<InputStream> in = inputSource->createInputStream()) | |||
| ScopedPointer<InputStream> in (inputSource->createInputStream()); | |||
| if (in != nullptr) | |||
| { | |||
| MemoryOutputStream data; | |||
| data.writeFromInputStream (*in, onlyReadOuterDocumentElement ? 8192 : -1); | |||
| @@ -141,8 +143,12 @@ void XmlDocument::setLastError (const String& desc, const bool carryOn) | |||
| String XmlDocument::getFileContents (const String& filename) const | |||
| { | |||
| if (inputSource != nullptr) | |||
| if (ScopedPointer<InputStream> in = inputSource->createInputStreamFor (filename.trim().unquoted())) | |||
| { | |||
| ScopedPointer<InputStream> in (inputSource->createInputStreamFor (filename.trim().unquoted())); | |||
| if (in != nullptr) | |||
| return in->readEntireStreamAsString(); | |||
| } | |||
| return {}; | |||
| } | |||
| @@ -286,7 +286,7 @@ bool GZIPDecompressorInputStream::setPosition (int64 newPos) | |||
| isEof = false; | |||
| activeBufferSize = 0; | |||
| currentPos = 0; | |||
| helper = new GZIPDecompressHelper (format); | |||
| helper.reset (new GZIPDecompressHelper (format)); | |||
| sourceStream->setPosition (originalSourcePos); | |||
| } | |||
| @@ -128,7 +128,8 @@ struct ZipFile::ZipInputStream : public InputStream | |||
| { | |||
| if (zf.inputSource != nullptr) | |||
| { | |||
| inputStream = streamToDelete = file.inputSource->createInputStream(); | |||
| streamToDelete.reset (file.inputSource->createInputStream()); | |||
| inputStream = streamToDelete.get(); | |||
| } | |||
| else | |||
| { | |||
| @@ -223,7 +224,7 @@ ZipFile::ZipFile (InputStream* stream, bool deleteStreamWhenDestroyed) | |||
| : inputStream (stream) | |||
| { | |||
| if (deleteStreamWhenDestroyed) | |||
| streamToDelete = inputStream; | |||
| streamToDelete.reset (inputStream); | |||
| init(); | |||
| } | |||
| @@ -339,7 +340,7 @@ void ZipFile::init() | |||
| if (inputSource != nullptr) | |||
| { | |||
| in = inputSource->createInputStream(); | |||
| toDelete = in; | |||
| toDelete.reset (in); | |||
| } | |||
| if (in != nullptr) | |||
| @@ -516,7 +517,7 @@ private: | |||
| { | |||
| if (stream == nullptr) | |||
| { | |||
| stream = file.createInputStream(); | |||
| stream.reset (file.createInputStream()); | |||
| if (stream == nullptr) | |||
| return false; | |||
| @@ -982,7 +982,9 @@ ValueTree ValueTree::fromXml (const XmlElement& xml) | |||
| String ValueTree::toXmlString() const | |||
| { | |||
| if (ScopedPointer<XmlElement> xml = createXml()) | |||
| ScopedPointer<XmlElement> xml (createXml()); | |||
| if (xml != nullptr) | |||
| return xml->createDocument ({}); | |||
| return {}; | |||
| @@ -1142,7 +1144,7 @@ public: | |||
| ScopedPointer<XmlElement> xml1 (v1.createXml()); | |||
| ScopedPointer<XmlElement> xml2 (v2.createCopy().createXml()); | |||
| expect (xml1->isEquivalentTo (xml2, false)); | |||
| expect (xml1->isEquivalentTo (xml2.get(), false)); | |||
| auto v4 = v2.createCopy(); | |||
| expect (v1.isEquivalentTo (v4)); | |||
| @@ -54,7 +54,7 @@ FillType::FillType (const Image& im, const AffineTransform& t) noexcept | |||
| FillType::FillType (const FillType& other) | |||
| : colour (other.colour), | |||
| gradient (other.gradient.createCopy()), | |||
| gradient (createCopyIfNotNull (other.gradient.get())), | |||
| image (other.image), | |||
| transform (other.transform) | |||
| { | |||
| @@ -65,7 +65,7 @@ FillType& FillType::operator= (const FillType& other) | |||
| if (this != &other) | |||
| { | |||
| colour = other.colour; | |||
| gradient.reset (other.gradient.createCopy()); | |||
| gradient.reset (createCopyIfNotNull (other.gradient.get())); | |||
| image = other.image; | |||
| transform = other.transform; | |||
| } | |||
| @@ -2661,10 +2661,10 @@ public: | |||
| void initialise (StateObjectType* state) | |||
| { | |||
| currentState = state; | |||
| currentState.reset (state); | |||
| } | |||
| inline StateObjectType* operator->() const noexcept { return currentState; } | |||
| inline StateObjectType* operator->() const noexcept { return currentState.get(); } | |||
| inline StateObjectType& operator*() const noexcept { return *currentState; } | |||
| void save() | |||
| @@ -2693,7 +2693,7 @@ public: | |||
| void endTransparencyLayer() | |||
| { | |||
| const ScopedPointer<StateObjectType> finishedTransparencyLayer (currentState); | |||
| ScopedPointer<StateObjectType> finishedTransparencyLayer (currentState.release()); | |||
| restore(); | |||
| currentState->endTransparencyLayer (*finishedTransparencyLayer); | |||
| } | |||
| @@ -79,7 +79,7 @@ Button::Button (const String& name) : Component (name), text (name) | |||
| callbackHelper.reset (new CallbackHelper (*this)); | |||
| setWantsKeyboardFocus (true); | |||
| isOn.addListener (callbackHelper); | |||
| isOn.addListener (callbackHelper.get()); | |||
| } | |||
| Button::~Button() | |||
| @@ -87,9 +87,9 @@ Button::~Button() | |||
| clearShortcuts(); | |||
| if (commandManagerToUse != nullptr) | |||
| commandManagerToUse->removeListener (callbackHelper); | |||
| commandManagerToUse->removeListener (callbackHelper.get()); | |||
| isOn.removeListener (callbackHelper); | |||
| isOn.removeListener (callbackHelper.get()); | |||
| callbackHelper.reset(); | |||
| } | |||
| @@ -509,12 +509,12 @@ void Button::parentHierarchyChanged() | |||
| if (newKeySource != keySource.get()) | |||
| { | |||
| if (keySource != nullptr) | |||
| keySource->removeKeyListener (callbackHelper); | |||
| keySource->removeKeyListener (callbackHelper.get()); | |||
| keySource = newKeySource; | |||
| if (keySource != nullptr) | |||
| keySource->addKeyListener (callbackHelper); | |||
| keySource->addKeyListener (callbackHelper.get()); | |||
| } | |||
| } | |||
| @@ -528,12 +528,12 @@ void Button::setCommandToTrigger (ApplicationCommandManager* const newCommandMan | |||
| if (commandManagerToUse != newCommandManager) | |||
| { | |||
| if (commandManagerToUse != nullptr) | |||
| commandManagerToUse->removeListener (callbackHelper); | |||
| commandManagerToUse->removeListener (callbackHelper.get()); | |||
| commandManagerToUse = newCommandManager; | |||
| if (commandManagerToUse != nullptr) | |||
| commandManagerToUse->addListener (callbackHelper); | |||
| commandManagerToUse->addListener (callbackHelper.get()); | |||
| // if you've got clickTogglesState turned on, you shouldn't also connect the button | |||
| // up to be a command invoker. Instead, your command handler must flip the state of whatever | |||
| @@ -137,8 +137,8 @@ void DrawableButton::buttonStateChanged() | |||
| } | |||
| else | |||
| { | |||
| imageToDraw = getToggleState() ? disabledImageOn | |||
| : disabledImage; | |||
| imageToDraw = getToggleState() ? disabledImageOn.get() | |||
| : disabledImage.get(); | |||
| if (imageToDraw == nullptr) | |||
| { | |||
| @@ -201,19 +201,19 @@ Drawable* DrawableButton::getCurrentImage() const noexcept | |||
| Drawable* DrawableButton::getNormalImage() const noexcept | |||
| { | |||
| return (getToggleState() && normalImageOn != nullptr) ? normalImageOn | |||
| : normalImage; | |||
| return (getToggleState() && normalImageOn != nullptr) ? normalImageOn.get() | |||
| : normalImage.get(); | |||
| } | |||
| Drawable* DrawableButton::getOverImage() const noexcept | |||
| { | |||
| if (getToggleState()) | |||
| { | |||
| if (overImageOn != nullptr) return overImageOn; | |||
| if (normalImageOn != nullptr) return normalImageOn; | |||
| if (overImageOn != nullptr) return overImageOn.get(); | |||
| if (normalImageOn != nullptr) return normalImageOn.get(); | |||
| } | |||
| return overImage != nullptr ? overImage : normalImage; | |||
| return overImage != nullptr ? overImage.get() : normalImage.get(); | |||
| } | |||
| Drawable* DrawableButton::getDownImage() const noexcept | |||
| @@ -101,9 +101,9 @@ Drawable* ToolbarButton::getImageToUse() const | |||
| return nullptr; | |||
| if (getToggleState() && toggledOnImage != nullptr) | |||
| return toggledOnImage; | |||
| return toggledOnImage.get(); | |||
| return normalImage; | |||
| return normalImage.get(); | |||
| } | |||
| void ToolbarButton::buttonStateChanged() | |||
| @@ -830,7 +830,7 @@ private: | |||
| void Component::setCachedComponentImage (CachedComponentImage* newCachedImage) | |||
| { | |||
| if (cachedImage != newCachedImage) | |||
| if (cachedImage.get() != newCachedImage) | |||
| { | |||
| cachedImage.reset (newCachedImage); | |||
| repaint(); | |||
| @@ -2140,14 +2140,13 @@ void Component::copyAllExplicitColoursTo (Component& target) const | |||
| } | |||
| //============================================================================== | |||
| Component::Positioner::Positioner (Component& c) noexcept | |||
| : component (c) | |||
| Component::Positioner::Positioner (Component& c) noexcept : component (c) | |||
| { | |||
| } | |||
| Component::Positioner* Component::getPositioner() const noexcept | |||
| { | |||
| return positioner; | |||
| return positioner.get(); | |||
| } | |||
| void Component::setPositioner (Positioner* newPositioner) | |||
| @@ -2775,7 +2774,9 @@ void Component::moveKeyboardFocusToSibling (bool moveToNext) | |||
| if (parentComponent != nullptr) | |||
| { | |||
| if (ScopedPointer<KeyboardFocusTraverser> traverser = createFocusTraverser()) | |||
| ScopedPointer<KeyboardFocusTraverser> traverser (createFocusTraverser()); | |||
| if (traverser != nullptr) | |||
| { | |||
| auto* nextComp = moveToNext ? traverser->getNextComponent (this) | |||
| : traverser->getPreviousComponent (this); | |||
| @@ -96,7 +96,7 @@ LookAndFeel& Desktop::getDefaultLookAndFeel() noexcept | |||
| if (defaultLookAndFeel == nullptr) | |||
| defaultLookAndFeel.reset (new LookAndFeel_V4()); | |||
| currentLookAndFeel = defaultLookAndFeel; | |||
| currentLookAndFeel = defaultLookAndFeel.get(); | |||
| } | |||
| return *currentLookAndFeel; | |||
| @@ -373,13 +373,13 @@ public: | |||
| #ifndef DOXYGEN | |||
| /** @internal */ | |||
| void refresh(); | |||
| /** @internal */ | |||
| ~Displays(); | |||
| #endif | |||
| private: | |||
| friend class Desktop; | |||
| friend struct ContainerDeletePolicy<Displays>; | |||
| Displays (Desktop&); | |||
| ~Displays(); | |||
| void init (Desktop&); | |||
| void findDisplays (float masterScale); | |||
| @@ -109,7 +109,7 @@ DrawableComposite* Drawable::getParent() const | |||
| void Drawable::setClipPath (Drawable* clipPath) | |||
| { | |||
| if (drawableClipPath != clipPath) | |||
| if (drawableClipPath.get() != clipPath) | |||
| { | |||
| drawableClipPath.reset (clipPath); | |||
| repaint(); | |||
| @@ -1711,8 +1711,8 @@ Drawable* Drawable::createFromSVGFile (const File& svgFile) | |||
| if (svgDocument != nullptr) | |||
| { | |||
| SVGState state (svgDocument, svgFile); | |||
| return state.parseSVGElement (SVGState::XmlPath (svgDocument, nullptr)); | |||
| SVGState state (svgDocument.get(), svgFile); | |||
| return state.parseSVGElement (SVGState::XmlPath (svgDocument.get(), nullptr)); | |||
| } | |||
| } | |||
| @@ -334,15 +334,15 @@ FilePreviewComponent* FileBrowserComponent::getPreviewComponent() const noexcept | |||
| DirectoryContentsDisplayComponent* FileBrowserComponent::getDisplayComponent() const noexcept | |||
| { | |||
| return fileListComponent; | |||
| return fileListComponent.get(); | |||
| } | |||
| //============================================================================== | |||
| void FileBrowserComponent::resized() | |||
| { | |||
| getLookAndFeel() | |||
| .layoutFileBrowserComponent (*this, fileListComponent, previewComp, | |||
| ¤tPathBox, &filenameBox, goUpButton); | |||
| .layoutFileBrowserComponent (*this, fileListComponent.get(), previewComp, | |||
| ¤tPathBox, &filenameBox, goUpButton.get()); | |||
| } | |||
| //============================================================================== | |||
| @@ -68,7 +68,7 @@ void FilenameComponent::paintOverChildren (Graphics& g) | |||
| void FilenameComponent::resized() | |||
| { | |||
| getLookAndFeel().layoutFilenameComponent (*this, &filenameBox, browseButton); | |||
| getLookAndFeel().layoutFilenameComponent (*this, &filenameBox, browseButton.get()); | |||
| } | |||
| KeyboardFocusTraverser* FilenameComponent::createFocusTraverser() | |||
| @@ -68,8 +68,8 @@ public: | |||
| bool useTimeslice (const int elapsed) | |||
| { | |||
| if (auto* c = proxy != nullptr ? static_cast<Component*> (proxy) | |||
| : static_cast<Component*> (component)) | |||
| if (auto* c = proxy != nullptr ? proxy.get() | |||
| : component.get()) | |||
| { | |||
| msElapsed += elapsed; | |||
| double newProgress = msElapsed / (double) msTotal; | |||
| @@ -114,7 +114,7 @@ ComponentBuilder::~ComponentBuilder() | |||
| #if JUCE_DEBUG | |||
| // Don't delete the managed component!! The builder owns that component, and will delete | |||
| // it automatically when it gets deleted. | |||
| jassert (componentRef.get() == static_cast<Component*> (component)); | |||
| jassert (componentRef.get() == component.get()); | |||
| #endif | |||
| } | |||
| @@ -125,11 +125,11 @@ Component* ComponentBuilder::getManagedComponent() | |||
| component.reset (createComponent()); | |||
| #if JUCE_DEBUG | |||
| componentRef = component; | |||
| componentRef = component.get(); | |||
| #endif | |||
| } | |||
| return component; | |||
| return component.get(); | |||
| } | |||
| Component* ComponentBuilder::createComponent() | |||
| @@ -152,7 +152,7 @@ void TabBarButton::setExtraComponent (Component* comp, ExtraComponentPlacement p | |||
| void TabBarButton::childBoundsChanged (Component* c) | |||
| { | |||
| if (c == extraComponent) | |||
| if (c == extraComponent.get()) | |||
| { | |||
| owner.resized(); | |||
| resized(); | |||
| @@ -263,7 +263,7 @@ void TabbedButtonBar::addTab (const String& tabName, | |||
| tabs.insert (insertIndex, newTab); | |||
| currentTabIndex = tabs.indexOf (currentTab); | |||
| addAndMakeVisible (newTab->button, insertIndex); | |||
| addAndMakeVisible (newTab->button.get(), insertIndex); | |||
| resized(); | |||
| @@ -358,7 +358,7 @@ void TabbedButtonBar::setCurrentTabIndex (int newIndex, bool shouldSendChangeMes | |||
| TabBarButton* TabbedButtonBar::getTabButton (const int index) const | |||
| { | |||
| if (auto* tab = tabs[index]) | |||
| return static_cast<TabBarButton*> (tab->button); | |||
| return static_cast<TabBarButton*> (tab->button.get()); | |||
| return nullptr; | |||
| } | |||
| @@ -366,7 +366,7 @@ TabBarButton* TabbedButtonBar::getTabButton (const int index) const | |||
| int TabbedButtonBar::indexOfTabButton (const TabBarButton* button) const | |||
| { | |||
| for (int i = tabs.size(); --i >= 0;) | |||
| if (tabs.getUnchecked(i)->button == button) | |||
| if (tabs.getUnchecked(i)->button.get() == button) | |||
| return i; | |||
| return -1; | |||
| @@ -435,7 +435,8 @@ void TabbedButtonBar::updateTabPositions (bool animate) | |||
| { | |||
| if (extraTabsButton == nullptr) | |||
| { | |||
| addAndMakeVisible (extraTabsButton = lf.createTabBarExtrasButton()); | |||
| extraTabsButton.reset (lf.createTabBarExtrasButton()); | |||
| addAndMakeVisible (extraTabsButton.get()); | |||
| extraTabsButton->setAlwaysOnTop (true); | |||
| extraTabsButton->setTriggeredOnMouseDown (true); | |||
| extraTabsButton->onClick = [this] { showExtraItemsMenu(); }; | |||
| @@ -569,7 +570,7 @@ void TabbedButtonBar::showExtraItemsMenu() | |||
| m.addItem (i + 1, tab->name, true, i == currentTabIndex); | |||
| } | |||
| m.showMenuAsync (PopupMenu::Options().withTargetComponent (extraTabsButton), | |||
| m.showMenuAsync (PopupMenu::Options().withTargetComponent (extraTabsButton.get()), | |||
| ModalCallbackFunction::forComponent (extraItemsMenuCallback, this)); | |||
| } | |||
| @@ -291,7 +291,7 @@ void Viewport::setScrollOnDragEnabled (bool shouldScrollOnDrag) | |||
| if (isScrollOnDragEnabled() != shouldScrollOnDrag) | |||
| { | |||
| if (shouldScrollOnDrag) | |||
| dragToScrollListener = new DragToScrollListener (*this); | |||
| dragToScrollListener.reset (new DragToScrollListener (*this)); | |||
| else | |||
| dragToScrollListener.reset(); | |||
| } | |||
| @@ -490,13 +490,13 @@ int Viewport::getScrollBarThickness() const | |||
| void Viewport::scrollBarMoved (ScrollBar* scrollBarThatHasMoved, double newRangeStart) | |||
| { | |||
| const int newRangeStartInt = roundToInt (newRangeStart); | |||
| auto newRangeStartInt = roundToInt (newRangeStart); | |||
| if (scrollBarThatHasMoved == horizontalScrollBar) | |||
| if (scrollBarThatHasMoved == horizontalScrollBar.get()) | |||
| { | |||
| setViewPosition (newRangeStartInt, getViewPositionY()); | |||
| } | |||
| else if (scrollBarThatHasMoved == verticalScrollBar) | |||
| else if (scrollBarThatHasMoved == verticalScrollBar.get()) | |||
| { | |||
| setViewPosition (getViewPositionX(), newRangeStartInt); | |||
| } | |||
| @@ -2623,7 +2623,7 @@ void LookAndFeel_V2::layoutFileBrowserComponent (FileBrowserComponent& browserCo | |||
| //============================================================================== | |||
| static Drawable* createDrawableFromSVG (const char* data) | |||
| { | |||
| ScopedPointer<XmlElement> xml = XmlDocument::parse (data); | |||
| ScopedPointer<XmlElement> xml (XmlDocument::parse (data)); | |||
| jassert (xml != nullptr); | |||
| return Drawable::createFromSVG (*xml); | |||
| } | |||
| @@ -2631,7 +2631,7 @@ static Drawable* createDrawableFromSVG (const char* data) | |||
| const Drawable* LookAndFeel_V2::getDefaultFolderImage() | |||
| { | |||
| if (folderImage == nullptr) | |||
| folderImage = createDrawableFromSVG (R"svgdata( | |||
| folderImage.reset (createDrawableFromSVG (R"svgdata( | |||
| <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="706" height="532"> | |||
| <defs> | |||
| <linearGradient id="a"> | |||
| @@ -2646,22 +2646,22 @@ const Drawable* LookAndFeel_V2::getDefaultFolderImage() | |||
| <path d="M608.6 136.8L235.2 208a22.7 22.7 0 0 0-16 19l-40.8 241c1.7 8.4 9.6 14.5 17.8 12.3l380-104c8-2.2 10.7-10.2 12.3-18.4l38-210.1c.4-15.4-10.4-11.8-18-11.1z" display="block" fill="url(#c)" opacity=".8" stroke="#446c98" stroke-width="7"/> | |||
| </g> | |||
| </svg> | |||
| )svgdata"); | |||
| )svgdata")); | |||
| return folderImage; | |||
| return folderImage.get(); | |||
| } | |||
| const Drawable* LookAndFeel_V2::getDefaultDocumentFileImage() | |||
| { | |||
| if (documentImage == nullptr) | |||
| documentImage = createDrawableFromSVG (R"svgdata( | |||
| documentImage.reset (createDrawableFromSVG (R"svgdata( | |||
| <svg version="1" viewBox="-10 -10 450 600" xmlns="http://www.w3.org/2000/svg"> | |||
| <path d="M17 0h290l120 132v426c0 10-8 19-17 19H17c-9 0-17-9-17-19V19C0 8 8 0 17 0z" fill="#e5e5e5" stroke="#888888" stroke-width="7"/> | |||
| <path d="M427 132H324c-9 0-17-9-17-19V0l120 132z" fill="#ccc"/> | |||
| </svg> | |||
| )svgdata"); | |||
| )svgdata")); | |||
| return documentImage; | |||
| return documentImage.get(); | |||
| } | |||
| //============================================================================== | |||
| @@ -181,7 +181,7 @@ void BurgerMenuComponent::paintListBoxItem (int rowIndex, Graphics& g, int w, in | |||
| hasSubMenu (item), | |||
| item.text, | |||
| item.shortcutKeyDescription, | |||
| item.image, | |||
| item.image.get(), | |||
| colour); | |||
| } | |||
| } | |||
| @@ -120,7 +120,7 @@ struct ItemComponent : public Component | |||
| hasSubMenu (item), | |||
| item.text, | |||
| item.shortcutKeyDescription, | |||
| item.image, | |||
| item.image.get(), | |||
| getColour (item)); | |||
| } | |||
| @@ -561,7 +561,7 @@ public: | |||
| if (mw == window) | |||
| return true; | |||
| mw = mw->activeSubMenu; | |||
| mw = mw->activeSubMenu.get(); | |||
| } | |||
| return false; | |||
| @@ -1843,7 +1843,7 @@ bool PopupMenu::MenuItemIterator::next() | |||
| if (searchRecursively && currentItem->subMenu != nullptr) | |||
| { | |||
| index.add (0); | |||
| menus.add (currentItem->subMenu); | |||
| menus.add (currentItem->subMenu.get()); | |||
| } | |||
| else | |||
| index.setUnchecked (index.size() - 1, index.getLast() + 1); | |||
| @@ -78,7 +78,7 @@ public: | |||
| delegate = [cls.createInstance() init]; | |||
| object_setInstanceVariable (delegate, "cppObject", this); | |||
| [panel setDelegate:delegate]; | |||
| [panel setDelegate: delegate]; | |||
| filters.addTokens (owner.filters.replaceCharacters (",:", ";;"), ";", String()); | |||
| filters.trim(); | |||
| @@ -150,10 +150,9 @@ public: | |||
| } | |||
| [panel close]; | |||
| [panel release]; | |||
| } | |||
| panel.reset(); | |||
| if (delegate != nil) | |||
| { | |||
| [delegate release]; | |||
| @@ -292,7 +291,7 @@ private: | |||
| NSView* nsViewPreview = nullptr; | |||
| bool selectsDirectories, selectsFiles, isSave, selectMultiple; | |||
| ScopedPointer<NSSavePanel> panel; | |||
| NSSavePanel* panel; | |||
| DelegateType* delegate; | |||
| StringArray filters; | |||
| @@ -612,7 +612,7 @@ public: | |||
| ~TemporaryMainMenuWithStandardCommands() | |||
| { | |||
| MenuBarModel::setMacMainMenu (oldMenu, oldAppleMenu, oldRecentItems); | |||
| MenuBarModel::setMacMainMenu (oldMenu, oldAppleMenu.get(), oldRecentItems); | |||
| } | |||
| private: | |||
| @@ -200,7 +200,8 @@ Value& TextPropertyComponent::getValue() const | |||
| void TextPropertyComponent::createEditor (int maxNumChars, bool isMultiLine, bool isEditable) | |||
| { | |||
| addAndMakeVisible (textEditor = new LabelComp (*this, maxNumChars, isMultiLine, isEditable)); | |||
| textEditor.reset (new LabelComp (*this, maxNumChars, isMultiLine, isEditable)); | |||
| addAndMakeVisible (textEditor.get()); | |||
| if (isMultiLine) | |||
| { | |||
| @@ -418,10 +418,10 @@ void ComboBox::lookAndFeelChanged() | |||
| newLabel->setText (label->getText(), dontSendNotification); | |||
| } | |||
| label = newLabel; | |||
| std::swap (label, newLabel); | |||
| } | |||
| addAndMakeVisible (label); | |||
| addAndMakeVisible (label.get()); | |||
| EditableState newEditableState = (label->isEditable() ? labelIsEditable : labelIsNotEditable); | |||
| @@ -221,7 +221,7 @@ void Label::showEditor() | |||
| resized(); | |||
| repaint(); | |||
| editorShown (editor); | |||
| editorShown (editor.get()); | |||
| enterModalState (false); | |||
| editor->grabKeyboardFocus(); | |||
| @@ -254,9 +254,10 @@ void Label::hideEditor (bool discardCurrentEditorContents) | |||
| if (editor != nullptr) | |||
| { | |||
| WeakReference<Component> deletionChecker (this); | |||
| ScopedPointer<TextEditor> outgoingEditor (editor); | |||
| ScopedPointer<TextEditor> outgoingEditor; | |||
| std::swap (outgoingEditor, editor); | |||
| editorAboutToBeHidden (outgoingEditor); | |||
| editorAboutToBeHidden (outgoingEditor.get()); | |||
| const bool changed = (! discardCurrentEditorContents) | |||
| && updateFromTextEditorContents (*outgoingEditor); | |||
| @@ -311,7 +312,7 @@ TextEditor* Label::createEditorComponent() | |||
| TextEditor* Label::getCurrentTextEditor() const noexcept | |||
| { | |||
| return editor; | |||
| return editor.get(); | |||
| } | |||
| //============================================================================== | |||
| @@ -410,7 +411,7 @@ void Label::textEditorTextChanged (TextEditor& ed) | |||
| { | |||
| if (editor != nullptr) | |||
| { | |||
| jassert (&ed == editor); | |||
| jassert (&ed == editor.get()); | |||
| if (! (hasKeyboardFocus (true) || isCurrentlyBlockedByAnotherModalComponent())) | |||
| { | |||
| @@ -426,7 +427,7 @@ void Label::textEditorReturnKeyPressed (TextEditor& ed) | |||
| { | |||
| if (editor != nullptr) | |||
| { | |||
| jassert (&ed == editor); | |||
| jassert (&ed == editor.get()); | |||
| WeakReference<Component> deletionChecker (this); | |||
| bool changed = updateFromTextEditorContents (ed); | |||
| @@ -446,7 +447,7 @@ void Label::textEditorEscapeKeyPressed (TextEditor& ed) | |||
| { | |||
| if (editor != nullptr) | |||
| { | |||
| jassert (&ed == editor); | |||
| jassert (&ed == editor.get()); | |||
| ignoreUnused (ed); | |||
| editor->setText (textValue.toString(), false); | |||
| @@ -52,11 +52,11 @@ public: | |||
| { | |||
| setMouseCursor (m->getMouseCursorForRow (row)); | |||
| customComponent = m->refreshComponentForRow (newRow, nowSelected, customComponent.release()); | |||
| customComponent.reset (m->refreshComponentForRow (newRow, nowSelected, customComponent.release())); | |||
| if (customComponent != nullptr) | |||
| { | |||
| addAndMakeVisible (customComponent); | |||
| addAndMakeVisible (customComponent.get()); | |||
| customComponent->setBounds (getLocalBounds()); | |||
| } | |||
| } | |||
| @@ -452,7 +452,7 @@ void ListBox::visibilityChanged() | |||
| Viewport* ListBox::getViewport() const noexcept | |||
| { | |||
| return viewport; | |||
| return viewport.get(); | |||
| } | |||
| //============================================================================== | |||
| @@ -655,7 +655,7 @@ int ListBox::getInsertionIndexForPosition (const int x, const int y) const noexc | |||
| Component* ListBox::getComponentForRowNumber (const int row) const noexcept | |||
| { | |||
| if (auto* listRowComp = viewport->getComponentForRowIfOnscreen (row)) | |||
| return listRowComp->customComponent; | |||
| return listRowComp->customComponent.get(); | |||
| return nullptr; | |||
| } | |||
| @@ -850,18 +850,17 @@ void ListBox::parentHierarchyChanged() | |||
| colourChanged(); | |||
| } | |||
| void ListBox::setOutlineThickness (const int newThickness) | |||
| void ListBox::setOutlineThickness (int newThickness) | |||
| { | |||
| outlineThickness = newThickness; | |||
| resized(); | |||
| } | |||
| void ListBox::setHeaderComponent (Component* const newHeaderComponent) | |||
| void ListBox::setHeaderComponent (Component* newHeaderComponent) | |||
| { | |||
| if (headerComponent != newHeaderComponent) | |||
| if (headerComponent.get() != newHeaderComponent) | |||
| { | |||
| headerComponent.reset (newHeaderComponent); | |||
| addAndMakeVisible (newHeaderComponent); | |||
| ListBox::resized(); | |||
| } | |||
| @@ -695,7 +695,8 @@ void TableHeaderComponent::beginDrag (const MouseEvent& e) | |||
| auto temp = columnIdBeingDragged; | |||
| columnIdBeingDragged = 0; | |||
| addAndMakeVisible (dragOverlayComp = new DragOverlayComp (createComponentSnapshot (columnRect, false))); | |||
| dragOverlayComp.reset (new DragOverlayComp (createComponentSnapshot (columnRect, false))); | |||
| addAndMakeVisible (dragOverlayComp.get()); | |||
| columnIdBeingDragged = temp; | |||
| dragOverlayComp->setBounds (columnRect); | |||
| @@ -880,7 +880,8 @@ TextEditor::TextEditor (const String& name, juce_wchar passwordChar) | |||
| { | |||
| setMouseCursor (MouseCursor::IBeamCursor); | |||
| addAndMakeVisible (viewport = new TextEditorViewport (*this)); | |||
| viewport.reset (new TextEditorViewport (*this)); | |||
| addAndMakeVisible (viewport.get()); | |||
| viewport->setViewedComponent (textHolder = new TextHolderComponent (*this)); | |||
| viewport->setWantsKeyboardFocus (false); | |||
| viewport->setScrollBarsShown (false, false); | |||
| @@ -1082,7 +1083,8 @@ void TextEditor::recreateCaret() | |||
| { | |||
| if (caret == nullptr) | |||
| { | |||
| textHolder->addChildComponent (caret = getLookAndFeel().createCaretComponent (this)); | |||
| caret.reset (getLookAndFeel().createCaretComponent (this)); | |||
| textHolder->addChildComponent (caret.get()); | |||
| updateCaretPosition(); | |||
| } | |||
| } | |||
| @@ -543,7 +543,7 @@ void Toolbar::showMissingItems() | |||
| { | |||
| PopupMenu m; | |||
| m.addCustomItem (1, new MissingItemsComponent (*this, getThickness())); | |||
| m.showMenuAsync (PopupMenu::Options().withTargetComponent (missingItemsButton), nullptr); | |||
| m.showMenuAsync (PopupMenu::Options().withTargetComponent (missingItemsButton.get()), nullptr); | |||
| } | |||
| } | |||
| @@ -173,9 +173,9 @@ void ToolbarItemComponent::paintButton (Graphics& g, const bool over, const bool | |||
| if (toolbarStyle != Toolbar::iconsOnly) | |||
| { | |||
| const int indent = contentArea.getX(); | |||
| int y = indent; | |||
| int h = getHeight() - indent * 2; | |||
| auto indent = contentArea.getX(); | |||
| auto y = indent; | |||
| auto h = getHeight() - indent * 2; | |||
| if (toolbarStyle == Toolbar::iconsWithText) | |||
| { | |||
| @@ -212,7 +212,7 @@ void ToolbarItemComponent::resized() | |||
| } | |||
| else | |||
| { | |||
| contentArea = Rectangle<int>(); | |||
| contentArea = {}; | |||
| } | |||
| contentAreaChanged (contentArea); | |||
| @@ -231,7 +231,8 @@ void ToolbarItemComponent::setEditingMode (const ToolbarEditingMode newMode) | |||
| } | |||
| else if (overlayComp == nullptr) | |||
| { | |||
| addAndMakeVisible (overlayComp = new ItemDragAndDropOverlayComponent()); | |||
| overlayComp.reset (new ItemDragAndDropOverlayComponent()); | |||
| addAndMakeVisible (overlayComp.get()); | |||
| overlayComp->parentSizeChanged(); | |||
| } | |||
| @@ -440,7 +440,7 @@ TreeView::TreeView (const String& name) | |||
| : Component (name), | |||
| viewport (new TreeViewport()) | |||
| { | |||
| addAndMakeVisible (viewport); | |||
| addAndMakeVisible (viewport.get()); | |||
| viewport->setViewedComponent (new ContentComponent (*this)); | |||
| setWantsKeyboardFocus (true); | |||
| } | |||
| @@ -547,7 +547,7 @@ void TreeView::setOpenCloseButtonsVisible (const bool shouldBeVisible) | |||
| Viewport* TreeView::getViewport() const noexcept | |||
| { | |||
| return viewport; | |||
| return viewport.get(); | |||
| } | |||
| //============================================================================== | |||
| @@ -68,10 +68,10 @@ DocumentWindow::~DocumentWindow() | |||
| // Don't delete or remove the resizer components yourself! They're managed by the | |||
| // DocumentWindow, and you should leave them alone! You may have deleted them | |||
| // accidentally by careless use of deleteAllChildren()..? | |||
| jassert (menuBar == nullptr || getIndexOfChildComponent (menuBar) >= 0); | |||
| jassert (titleBarButtons[0] == nullptr || getIndexOfChildComponent (titleBarButtons[0]) >= 0); | |||
| jassert (titleBarButtons[1] == nullptr || getIndexOfChildComponent (titleBarButtons[1]) >= 0); | |||
| jassert (titleBarButtons[2] == nullptr || getIndexOfChildComponent (titleBarButtons[2]) >= 0); | |||
| jassert (menuBar == nullptr || getIndexOfChildComponent (menuBar.get()) >= 0); | |||
| jassert (titleBarButtons[0] == nullptr || getIndexOfChildComponent (titleBarButtons[0].get()) >= 0); | |||
| jassert (titleBarButtons[1] == nullptr || getIndexOfChildComponent (titleBarButtons[1].get()) >= 0); | |||
| jassert (titleBarButtons[2] == nullptr || getIndexOfChildComponent (titleBarButtons[2].get()) >= 0); | |||
| for (auto& b : titleBarButtons) | |||
| b.reset(); | |||
| @@ -140,7 +140,7 @@ void DocumentWindow::setMenuBar (MenuBarModel* newMenuBarModel, const int newMen | |||
| Component* DocumentWindow::getMenuBarComponent() const noexcept | |||
| { | |||
| return menuBar; | |||
| return menuBar.get(); | |||
| } | |||
| void DocumentWindow::setMenuBarComponent (Component* newMenuBarComponent) | |||
| @@ -229,9 +229,9 @@ void DocumentWindow::resized() | |||
| .positionDocumentWindowButtons (*this, | |||
| titleBarArea.getX(), titleBarArea.getY(), | |||
| titleBarArea.getWidth(), titleBarArea.getHeight(), | |||
| titleBarButtons[0], | |||
| titleBarButtons[1], | |||
| titleBarButtons[2], | |||
| titleBarButtons[0].get(), | |||
| titleBarButtons[1].get(), | |||
| titleBarButtons[2].get(), | |||
| positionTitleBarButtonsOnLeft); | |||
| if (menuBar != nullptr) | |||
| @@ -270,9 +270,9 @@ Rectangle<int> DocumentWindow::getTitleBarArea() | |||
| return { border.getLeft(), border.getTop(), getWidth() - border.getLeftAndRight(), getTitleBarHeight() }; | |||
| } | |||
| Button* DocumentWindow::getCloseButton() const noexcept { return titleBarButtons[2]; } | |||
| Button* DocumentWindow::getMinimiseButton() const noexcept { return titleBarButtons[0]; } | |||
| Button* DocumentWindow::getMaximiseButton() const noexcept { return titleBarButtons[1]; } | |||
| Button* DocumentWindow::getCloseButton() const noexcept { return titleBarButtons[2].get(); } | |||
| Button* DocumentWindow::getMinimiseButton() const noexcept { return titleBarButtons[0].get(); } | |||
| Button* DocumentWindow::getMaximiseButton() const noexcept { return titleBarButtons[1].get(); } | |||
| int DocumentWindow::getDesktopWindowStyleFlags() const | |||
| { | |||
| @@ -305,11 +305,11 @@ void DocumentWindow::lookAndFeelChanged() | |||
| if (buttonListener == nullptr) | |||
| buttonListener.reset (new ButtonListenerProxy (*this)); | |||
| b->addListener (buttonListener); | |||
| b->addListener (buttonListener.get()); | |||
| b->setWantsKeyboardFocus (false); | |||
| // (call the Component method directly to avoid the assertion in ResizableWindow) | |||
| Component::addAndMakeVisible (b); | |||
| Component::addAndMakeVisible (b.get()); | |||
| } | |||
| } | |||
| @@ -47,8 +47,8 @@ ResizableWindow::~ResizableWindow() | |||
| // Don't delete or remove the resizer components yourself! They're managed by the | |||
| // ResizableWindow, and you should leave them alone! You may have deleted them | |||
| // accidentally by careless use of deleteAllChildren()..? | |||
| jassert (resizableCorner == nullptr || getIndexOfChildComponent (resizableCorner) >= 0); | |||
| jassert (resizableBorder == nullptr || getIndexOfChildComponent (resizableBorder) >= 0); | |||
| jassert (resizableCorner == nullptr || getIndexOfChildComponent (resizableCorner.get()) >= 0); | |||
| jassert (resizableBorder == nullptr || getIndexOfChildComponent (resizableBorder.get()) >= 0); | |||
| resizableCorner.reset(); | |||
| resizableBorder.reset(); | |||
| @@ -367,14 +367,14 @@ CodeEditorComponent::CodeEditorComponent (CodeDocument& doc, CodeTokeniser* cons | |||
| setLineNumbersShown (true); | |||
| verticalScrollBar.addListener (pimpl); | |||
| horizontalScrollBar.addListener (pimpl); | |||
| document.addListener (pimpl); | |||
| verticalScrollBar.addListener (pimpl.get()); | |||
| horizontalScrollBar.addListener (pimpl.get()); | |||
| document.addListener (pimpl.get()); | |||
| } | |||
| CodeEditorComponent::~CodeEditorComponent() | |||
| { | |||
| document.removeListener (pimpl); | |||
| document.removeListener (pimpl.get()); | |||
| } | |||
| int CodeEditorComponent::getGutterSize() const noexcept | |||
| @@ -126,7 +126,7 @@ void PreferencesPanel::setCurrentPage (const String& pageName) | |||
| if (currentPage != nullptr) | |||
| { | |||
| addAndMakeVisible (currentPage); | |||
| addAndMakeVisible (currentPage.get()); | |||
| currentPage->toBack(); | |||
| resized(); | |||
| } | |||
| @@ -76,11 +76,11 @@ public: | |||
| : ThreadPoolJob ("OpenGL Rendering"), | |||
| context (c), component (comp) | |||
| { | |||
| nativeContext = new NativeContext (component, pixFormat, contextToShare, | |||
| c.useMultisampling, c.versionRequired); | |||
| nativeContext.reset (new NativeContext (component, pixFormat, contextToShare, | |||
| c.useMultisampling, c.versionRequired)); | |||
| if (nativeContext->createdOk()) | |||
| context.nativeContext = nativeContext; | |||
| context.nativeContext = nativeContext.get(); | |||
| else | |||
| nativeContext.reset(); | |||
| } | |||
| @@ -95,7 +95,7 @@ public: | |||
| { | |||
| if (nativeContext != nullptr) | |||
| { | |||
| renderThread = new ThreadPool (1); | |||
| renderThread.reset (new ThreadPool (1)); | |||
| resume(); | |||
| } | |||
| } | |||
| @@ -886,7 +886,7 @@ void OpenGLContext::attachTo (Component& component) | |||
| if (getTargetComponent() != &component) | |||
| { | |||
| detach(); | |||
| attachment = new Attachment (*this, component); | |||
| attachment.reset (new Attachment (*this, component)); | |||
| } | |||
| } | |||
| @@ -202,7 +202,7 @@ bool OpenGLFrameBuffer::initialise (OpenGLContext& context, const Image& image) | |||
| bool OpenGLFrameBuffer::initialise (OpenGLFrameBuffer& other) | |||
| { | |||
| const Pimpl* const p = other.pimpl; | |||
| auto* p = other.pimpl.get(); | |||
| if (p == nullptr) | |||
| { | |||
| @@ -242,7 +242,7 @@ void OpenGLFrameBuffer::saveAndRelease() | |||
| { | |||
| if (pimpl != nullptr) | |||
| { | |||
| savedState = new SavedState (*this, pimpl->width, pimpl->height); | |||
| savedState.reset (new SavedState (*this, pimpl->width, pimpl->height)); | |||
| pimpl.reset(); | |||
| } | |||
| } | |||
| @@ -251,12 +251,13 @@ bool OpenGLFrameBuffer::reloadSavedCopy (OpenGLContext& context) | |||
| { | |||
| if (savedState != nullptr) | |||
| { | |||
| ScopedPointer<SavedState> state (savedState); | |||
| ScopedPointer<SavedState> state; | |||
| std::swap (state, savedState); | |||
| if (state->restore (context, *this)) | |||
| return true; | |||
| savedState = state; | |||
| std::swap (state, savedState); | |||
| } | |||
| return false; | |||
| @@ -1587,7 +1587,7 @@ struct SavedState : public RenderingHelpers::SavedStateBase<SavedState> | |||
| SavedState (const SavedState& other) | |||
| : BaseClass (other), font (other.font), state (other.state), | |||
| transparencyLayer (other.transparencyLayer), | |||
| previousTarget (other.previousTarget.createCopy()) | |||
| previousTarget (createCopyIfNotNull (other.previousTarget.get())) | |||
| {} | |||
| SavedState* beginTransparencyLayer (float opacity) | |||
| @@ -1600,7 +1600,7 @@ struct SavedState : public RenderingHelpers::SavedStateBase<SavedState> | |||
| state->flush(); | |||
| s->transparencyLayer = Image (OpenGLImageType().create (Image::ARGB, clipBounds.getWidth(), clipBounds.getHeight(), true)); | |||
| s->previousTarget = new Target (state->target); | |||
| s->previousTarget.reset (new Target (state->target)); | |||
| state->target = Target (state->target.context, *OpenGLImageType::getFrameBufferFrom (s->transparencyLayer), clipBounds.getPosition()); | |||
| s->transparencyLayerAlpha = opacity; | |||
| s->cloneClipIfMultiplyReferenced(); | |||
| @@ -156,8 +156,8 @@ private: | |||
| static void initialise (OpenGLFrameBuffer& frameBuffer, Image::BitmapData& bitmapData, int x, int y) | |||
| { | |||
| DataReleaser* r = new DataReleaser (frameBuffer, x, y, bitmapData.width, bitmapData.height); | |||
| bitmapData.dataReleaser = r; | |||
| auto* r = new DataReleaser (frameBuffer, x, y, bitmapData.width, bitmapData.height); | |||
| bitmapData.dataReleaser.reset (r); | |||
| bitmapData.data = (uint8*) r->data.get(); | |||
| bitmapData.lineStride = (bitmapData.width * bitmapData.pixelStride + 3) & ~3; | |||
| @@ -54,7 +54,8 @@ struct OnlineUnlockForm::OverlayComp : public Component, | |||
| if (hasCancelButton) | |||
| { | |||
| addAndMakeVisible (cancelButton = new TextButton (TRANS ("Cancel"))); | |||
| cancelButton.reset (new TextButton (TRANS ("Cancel"))); | |||
| addAndMakeVisible (cancelButton.get()); | |||
| cancelButton->addListener (this); | |||
| } | |||
| @@ -128,7 +129,7 @@ struct OnlineUnlockForm::OverlayComp : public Component, | |||
| void buttonClicked (Button* button) override | |||
| { | |||
| if (button == cancelButton) | |||
| if (button == cancelButton.get()) | |||
| { | |||
| form.status.userCancelled(); | |||
| @@ -267,8 +268,8 @@ void OnlineUnlockForm::lookAndFeelChanged() | |||
| void OnlineUnlockForm::showBubbleMessage (const String& text, Component& target) | |||
| { | |||
| bubble = new BubbleMessageComponent (500); | |||
| addChildComponent (bubble); | |||
| bubble.reset (new BubbleMessageComponent (500)); | |||
| addChildComponent (bubble.get()); | |||
| AttributedString attString; | |||
| attString.append (text, Font (16.0f)); | |||
| @@ -123,7 +123,7 @@ struct KeyFileUtils | |||
| const MemoryBlock mb (val.toMemoryBlock()); | |||
| if (CharPointer_UTF8::isValidString (static_cast<const char*> (mb.getData()), (int) mb.getSize())) | |||
| xml = XmlDocument::parse (mb.toString()); | |||
| xml.reset (XmlDocument::parse (mb.toString())); | |||
| } | |||
| return xml != nullptr ? *xml : XmlElement("key"); | |||
| @@ -57,7 +57,7 @@ String TracktionMarketplaceStatus::readReplyFromWebserver (const String& email, | |||
| { | |||
| ScopedLock lock (streamCreationLock); | |||
| stream = new WebInputStream (url, true); | |||
| stream.reset (new WebInputStream (url, true)); | |||
| } | |||
| if (stream->connect (nullptr)) | |||
| @@ -36,7 +36,7 @@ namespace juce | |||
| //============================================================================== | |||
| VideoComponent::VideoComponent() : pimpl (new Pimpl()) | |||
| { | |||
| addAndMakeVisible (pimpl); | |||
| addAndMakeVisible (pimpl.get()); | |||
| } | |||
| VideoComponent::~VideoComponent() | |||
| @@ -46,14 +46,14 @@ VideoComponent::~VideoComponent() | |||
| Result VideoComponent::load (const File& file) | |||
| { | |||
| Result r = pimpl->load (file); | |||
| auto r = pimpl->load (file); | |||
| resized(); | |||
| return r; | |||
| } | |||
| Result VideoComponent::load (const URL& url) | |||
| { | |||
| Result r = pimpl->load (url); | |||
| auto r = pimpl->load (url); | |||
| resized(); | |||
| return r; | |||
| } | |||
| @@ -86,11 +86,11 @@ float VideoComponent::getAudioVolume() const { return pimpl->getV | |||
| void VideoComponent::resized() | |||
| { | |||
| Rectangle<int> r = getLocalBounds(); | |||
| auto r = getLocalBounds(); | |||
| if (isVideoOpen() && ! r.isEmpty()) | |||
| { | |||
| Rectangle<int> nativeSize = getVideoNativeSize(); | |||
| auto nativeSize = getVideoNativeSize(); | |||
| if (nativeSize.isEmpty()) | |||
| { | |||