| @@ -371,7 +371,7 @@ private: | |||
| //============================================================================== | |||
| AudioCDBurner::AudioCDBurner (const int deviceIndex) | |||
| { | |||
| pimpl = new Pimpl (*this, deviceIndex); | |||
| pimpl.reset (new Pimpl (*this, deviceIndex)); | |||
| } | |||
| AudioCDBurner::~AudioCDBurner() | |||
| @@ -236,7 +236,7 @@ AudioCDBurner::AudioCDBurner (const int deviceIndex) | |||
| IDiscRecorder* discRecorder = CDBurnerHelpers::enumCDBurners (0, deviceIndex, &discMaster); | |||
| if (discRecorder != nullptr) | |||
| pimpl = new Pimpl (*this, discMaster, discRecorder); | |||
| pimpl.reset (new Pimpl (*this, discMaster, discRecorder)); | |||
| } | |||
| AudioCDBurner::~AudioCDBurner() | |||
| @@ -409,7 +409,7 @@ public: | |||
| { | |||
| if (deleteOldElement) | |||
| { | |||
| toDelete = data.elements[indexToChange]; | |||
| toDelete.reset (data.elements[indexToChange]); | |||
| if (toDelete == newObject) | |||
| toDelete.release(); | |||
| @@ -95,8 +95,8 @@ bool DirectoryIterator::next (bool* isDirResult, bool* isHiddenResult, int64* fi | |||
| if (isDirectory) | |||
| { | |||
| if (isRecursive && ((whatToLookFor & File::ignoreHiddenFiles) == 0 || ! isHidden)) | |||
| subIterator = new DirectoryIterator (File::createFileWithoutCheckingPath (path + filename), | |||
| true, wildCard, whatToLookFor); | |||
| subIterator.reset (new DirectoryIterator (File::createFileWithoutCheckingPath (path + filename), | |||
| true, wildCard, whatToLookFor)); | |||
| matches = (whatToLookFor & File::findDirectories) != 0; | |||
| } | |||
| @@ -1149,10 +1149,10 @@ struct JavascriptEngine::RootObject : public DynamicObject | |||
| { | |||
| ScopedPointer<IfStatement> s (new IfStatement (location)); | |||
| match (TokenTypes::openParen); | |||
| s->condition = parseExpression(); | |||
| s->condition.reset (parseExpression()); | |||
| match (TokenTypes::closeParen); | |||
| s->trueBranch = parseStatement(); | |||
| s->falseBranch = matchIf (TokenTypes::else_) ? parseStatement() : new Statement (location); | |||
| s->trueBranch.reset (parseStatement()); | |||
| s->falseBranch.reset (matchIf (TokenTypes::else_) ? parseStatement() : new Statement (location)); | |||
| return s.release(); | |||
| } | |||
| @@ -1170,7 +1170,7 @@ struct JavascriptEngine::RootObject : public DynamicObject | |||
| { | |||
| ScopedPointer<VarStatement> s (new VarStatement (location)); | |||
| s->name = parseIdentifier(); | |||
| s->initialiser = matchIf (TokenTypes::assign) ? parseExpression() : new Expression (location); | |||
| s->initialiser.reset (matchIf (TokenTypes::assign) ? parseExpression() : new Expression (location)); | |||
| if (matchIf (TokenTypes::comma)) | |||
| { | |||
| @@ -1200,46 +1200,46 @@ struct JavascriptEngine::RootObject : public DynamicObject | |||
| { | |||
| ScopedPointer<LoopStatement> s (new LoopStatement (location, false)); | |||
| match (TokenTypes::openParen); | |||
| s->initialiser = parseStatement(); | |||
| s->initialiser.reset (parseStatement()); | |||
| if (matchIf (TokenTypes::semicolon)) | |||
| s->condition = new LiteralValue (location, true); | |||
| s->condition.reset (new LiteralValue (location, true)); | |||
| else | |||
| { | |||
| s->condition = parseExpression(); | |||
| s->condition.reset (parseExpression()); | |||
| match (TokenTypes::semicolon); | |||
| } | |||
| if (matchIf (TokenTypes::closeParen)) | |||
| s->iterator = new Statement (location); | |||
| s->iterator.reset (new Statement (location)); | |||
| else | |||
| { | |||
| s->iterator = parseExpression(); | |||
| s->iterator.reset (parseExpression()); | |||
| match (TokenTypes::closeParen); | |||
| } | |||
| s->body = parseStatement(); | |||
| s->body.reset (parseStatement()); | |||
| return s.release(); | |||
| } | |||
| Statement* parseDoOrWhileLoop (bool isDoLoop) | |||
| { | |||
| ScopedPointer<LoopStatement> s (new LoopStatement (location, isDoLoop)); | |||
| s->initialiser = new Statement (location); | |||
| s->iterator = new Statement (location); | |||
| s->initialiser.reset (new Statement (location)); | |||
| s->iterator.reset (new Statement (location)); | |||
| if (isDoLoop) | |||
| { | |||
| s->body = parseBlock(); | |||
| s->body.reset (parseBlock()); | |||
| match (TokenTypes::while_); | |||
| } | |||
| match (TokenTypes::openParen); | |||
| s->condition = parseExpression(); | |||
| s->condition.reset (parseExpression()); | |||
| match (TokenTypes::closeParen); | |||
| if (! isDoLoop) | |||
| s->body = parseStatement(); | |||
| s->body.reset (parseStatement()); | |||
| return s.release(); | |||
| } | |||
| @@ -1297,7 +1297,7 @@ struct JavascriptEngine::RootObject : public DynamicObject | |||
| { | |||
| ScopedPointer<ArraySubscript> s (new ArraySubscript (location)); | |||
| s->object = input; | |||
| s->index = parseExpression(); | |||
| s->index.reset (parseExpression()); | |||
| match (TokenTypes::closeBracket); | |||
| return parseSuffixes (s.release()); | |||
| } | |||
| @@ -1377,7 +1377,7 @@ struct JavascriptEngine::RootObject : public DynamicObject | |||
| ExpPtr name (new UnqualifiedName (location, parseIdentifier())); | |||
| while (matchIf (TokenTypes::dot)) | |||
| name = new DotOperator (location, name, parseIdentifier()); | |||
| name.reset (new DotOperator (location, name, parseIdentifier())); | |||
| return parseFunctionCall (new NewOperator (location), name); | |||
| } | |||
| @@ -1405,7 +1405,7 @@ struct JavascriptEngine::RootObject : public DynamicObject | |||
| Expression* parseTypeof() | |||
| { | |||
| ScopedPointer<FunctionCall> f (new FunctionCall (location)); | |||
| f->object = new UnqualifiedName (location, "typeof"); | |||
| f->object.reset (new UnqualifiedName (location, "typeof")); | |||
| f->arguments.add (parseUnary()); | |||
| return f.release(); | |||
| } | |||
| @@ -1427,9 +1427,9 @@ struct JavascriptEngine::RootObject : public DynamicObject | |||
| for (;;) | |||
| { | |||
| if (matchIf (TokenTypes::times)) { ExpPtr b (parseUnary()); a = new MultiplyOp (location, a, b); } | |||
| else if (matchIf (TokenTypes::divide)) { ExpPtr b (parseUnary()); a = new DivideOp (location, a, b); } | |||
| else if (matchIf (TokenTypes::modulo)) { ExpPtr b (parseUnary()); a = new ModuloOp (location, a, b); } | |||
| if (matchIf (TokenTypes::times)) { ExpPtr b (parseUnary()); a.reset (new MultiplyOp (location, a, b)); } | |||
| else if (matchIf (TokenTypes::divide)) { ExpPtr b (parseUnary()); a.reset (new DivideOp (location, a, b)); } | |||
| else if (matchIf (TokenTypes::modulo)) { ExpPtr b (parseUnary()); a.reset (new ModuloOp (location, a, b)); } | |||
| else break; | |||
| } | |||
| @@ -1442,8 +1442,8 @@ struct JavascriptEngine::RootObject : public DynamicObject | |||
| for (;;) | |||
| { | |||
| if (matchIf (TokenTypes::plus)) { ExpPtr b (parseMultiplyDivide()); a = new AdditionOp (location, a, b); } | |||
| else if (matchIf (TokenTypes::minus)) { ExpPtr b (parseMultiplyDivide()); a = new SubtractionOp (location, a, b); } | |||
| if (matchIf (TokenTypes::plus)) { ExpPtr b (parseMultiplyDivide()); a.reset (new AdditionOp (location, a, b)); } | |||
| else if (matchIf (TokenTypes::minus)) { ExpPtr b (parseMultiplyDivide()); a.reset (new SubtractionOp (location, a, b)); } | |||
| else break; | |||
| } | |||
| @@ -1456,9 +1456,9 @@ struct JavascriptEngine::RootObject : public DynamicObject | |||
| for (;;) | |||
| { | |||
| if (matchIf (TokenTypes::leftShift)) { ExpPtr b (parseExpression()); a = new LeftShiftOp (location, a, b); } | |||
| else if (matchIf (TokenTypes::rightShift)) { ExpPtr b (parseExpression()); a = new RightShiftOp (location, a, b); } | |||
| else if (matchIf (TokenTypes::rightShiftUnsigned)) { ExpPtr b (parseExpression()); a = new RightShiftUnsignedOp (location, a, b); } | |||
| if (matchIf (TokenTypes::leftShift)) { ExpPtr b (parseExpression()); a.reset (new LeftShiftOp (location, a, b)); } | |||
| else if (matchIf (TokenTypes::rightShift)) { ExpPtr b (parseExpression()); a.reset (new RightShiftOp (location, a, b)); } | |||
| else if (matchIf (TokenTypes::rightShiftUnsigned)) { ExpPtr b (parseExpression()); a.reset (new RightShiftUnsignedOp (location, a, b)); } | |||
| else break; | |||
| } | |||
| @@ -1471,14 +1471,14 @@ struct JavascriptEngine::RootObject : public DynamicObject | |||
| for (;;) | |||
| { | |||
| if (matchIf (TokenTypes::equals)) { ExpPtr b (parseShiftOperator()); a = new EqualsOp (location, a, b); } | |||
| else if (matchIf (TokenTypes::notEquals)) { ExpPtr b (parseShiftOperator()); a = new NotEqualsOp (location, a, b); } | |||
| else if (matchIf (TokenTypes::typeEquals)) { ExpPtr b (parseShiftOperator()); a = new TypeEqualsOp (location, a, b); } | |||
| else if (matchIf (TokenTypes::typeNotEquals)) { ExpPtr b (parseShiftOperator()); a = new TypeNotEqualsOp (location, a, b); } | |||
| else if (matchIf (TokenTypes::lessThan)) { ExpPtr b (parseShiftOperator()); a = new LessThanOp (location, a, b); } | |||
| else if (matchIf (TokenTypes::lessThanOrEqual)) { ExpPtr b (parseShiftOperator()); a = new LessThanOrEqualOp (location, a, b); } | |||
| else if (matchIf (TokenTypes::greaterThan)) { ExpPtr b (parseShiftOperator()); a = new GreaterThanOp (location, a, b); } | |||
| else if (matchIf (TokenTypes::greaterThanOrEqual)) { ExpPtr b (parseShiftOperator()); a = new GreaterThanOrEqualOp (location, a, b); } | |||
| if (matchIf (TokenTypes::equals)) { ExpPtr b (parseShiftOperator()); a.reset (new EqualsOp (location, a, b)); } | |||
| else if (matchIf (TokenTypes::notEquals)) { ExpPtr b (parseShiftOperator()); a.reset (new NotEqualsOp (location, a, b)); } | |||
| else if (matchIf (TokenTypes::typeEquals)) { ExpPtr b (parseShiftOperator()); a.reset (new TypeEqualsOp (location, a, b)); } | |||
| else if (matchIf (TokenTypes::typeNotEquals)) { ExpPtr b (parseShiftOperator()); a.reset (new TypeNotEqualsOp (location, a, b)); } | |||
| else if (matchIf (TokenTypes::lessThan)) { ExpPtr b (parseShiftOperator()); a.reset (new LessThanOp (location, a, b)); } | |||
| else if (matchIf (TokenTypes::lessThanOrEqual)) { ExpPtr b (parseShiftOperator()); a.reset (new LessThanOrEqualOp (location, a, b)); } | |||
| else if (matchIf (TokenTypes::greaterThan)) { ExpPtr b (parseShiftOperator()); a.reset (new GreaterThanOp (location, a, b)); } | |||
| else if (matchIf (TokenTypes::greaterThanOrEqual)) { ExpPtr b (parseShiftOperator()); a.reset (new GreaterThanOrEqualOp (location, a, b)); } | |||
| else break; | |||
| } | |||
| @@ -1491,11 +1491,11 @@ struct JavascriptEngine::RootObject : public DynamicObject | |||
| for (;;) | |||
| { | |||
| if (matchIf (TokenTypes::logicalAnd)) { ExpPtr b (parseComparator()); a = new LogicalAndOp (location, a, b); } | |||
| else if (matchIf (TokenTypes::logicalOr)) { ExpPtr b (parseComparator()); a = new LogicalOrOp (location, a, b); } | |||
| else if (matchIf (TokenTypes::bitwiseAnd)) { ExpPtr b (parseComparator()); a = new BitwiseAndOp (location, a, b); } | |||
| else if (matchIf (TokenTypes::bitwiseOr)) { ExpPtr b (parseComparator()); a = new BitwiseOrOp (location, a, b); } | |||
| else if (matchIf (TokenTypes::bitwiseXor)) { ExpPtr b (parseComparator()); a = new BitwiseXorOp (location, a, b); } | |||
| if (matchIf (TokenTypes::logicalAnd)) { ExpPtr b (parseComparator()); a.reset (new LogicalAndOp (location, a, b)); } | |||
| else if (matchIf (TokenTypes::logicalOr)) { ExpPtr b (parseComparator()); a.reset (new LogicalOrOp (location, a, b)); } | |||
| else if (matchIf (TokenTypes::bitwiseAnd)) { ExpPtr b (parseComparator()); a.reset (new BitwiseAndOp (location, a, b)); } | |||
| else if (matchIf (TokenTypes::bitwiseOr)) { ExpPtr b (parseComparator()); a.reset (new BitwiseOrOp (location, a, b)); } | |||
| else if (matchIf (TokenTypes::bitwiseXor)) { ExpPtr b (parseComparator()); a.reset (new BitwiseXorOp (location, a, b)); } | |||
| else break; | |||
| } | |||
| @@ -1506,9 +1506,9 @@ struct JavascriptEngine::RootObject : public DynamicObject | |||
| { | |||
| ScopedPointer<ConditionalOp> e (new ConditionalOp (location)); | |||
| e->condition = condition; | |||
| e->trueBranch = parseExpression(); | |||
| e->trueBranch.reset (parseExpression()); | |||
| match (TokenTypes::colon); | |||
| e->falseBranch = parseExpression(); | |||
| e->falseBranch.reset (parseExpression()); | |||
| return e.release(); | |||
| } | |||
| @@ -139,7 +139,7 @@ public: | |||
| if (object.get() != newObject) | |||
| { | |||
| reset(); | |||
| object = newObject; | |||
| object.reset (newObject); | |||
| } | |||
| shouldDelete = takeOwnership; | |||
| @@ -198,15 +198,15 @@ void NamedPipe::close() | |||
| bool NamedPipe::openInternal (const String& pipeName, const bool createPipe, bool mustNotExist) | |||
| { | |||
| #if JUCE_IOS | |||
| pimpl = new Pimpl (File::getSpecialLocation (File::tempDirectory) | |||
| .getChildFile (File::createLegalFileName (pipeName)).getFullPathName(), createPipe); | |||
| pimpl.reset (new Pimpl (File::getSpecialLocation (File::tempDirectory) | |||
| .getChildFile (File::createLegalFileName (pipeName)).getFullPathName(), createPipe)); | |||
| #else | |||
| String file (pipeName); | |||
| if (! File::isAbsolutePath (file)) | |||
| file = "/tmp/" + File::createLegalFileName (file); | |||
| pimpl = new Pimpl (file, createPipe); | |||
| pimpl.reset (new Pimpl (file, createPipe)); | |||
| #endif | |||
| if (createPipe && ! pimpl->createFifos (mustNotExist)) | |||
| @@ -877,7 +877,7 @@ bool InterProcessLock::enter (const int timeOutMillisecs) | |||
| if (pimpl == nullptr) | |||
| { | |||
| pimpl = new Pimpl (name, timeOutMillisecs); | |||
| pimpl.reset (new Pimpl (name, timeOutMillisecs)); | |||
| if (pimpl->handle == 0) | |||
| pimpl.reset(); | |||
| @@ -1051,17 +1051,17 @@ void NamedPipe::close() | |||
| SetEvent (pimpl->cancelEvent); | |||
| ScopedWriteLock sl (lock); | |||
| pimpl = nullptr; | |||
| pimpl.reset(); | |||
| } | |||
| } | |||
| bool NamedPipe::openInternal (const String& pipeName, const bool createPipe, bool mustNotExist) | |||
| { | |||
| pimpl = new Pimpl (pipeName, createPipe, mustNotExist); | |||
| pimpl.reset (new Pimpl (pipeName, createPipe, mustNotExist)); | |||
| if (createPipe && pimpl->pipeH == INVALID_HANDLE_VALUE) | |||
| { | |||
| pimpl = nullptr; | |||
| pimpl.reset(); | |||
| return false; | |||
| } | |||
| @@ -380,10 +380,10 @@ bool InterProcessLock::enter (const int timeOutMillisecs) | |||
| if (pimpl == nullptr) | |||
| { | |||
| pimpl = new Pimpl (name, timeOutMillisecs); | |||
| pimpl.reset (new Pimpl (name, timeOutMillisecs)); | |||
| if (pimpl->handle == 0) | |||
| pimpl = nullptr; | |||
| pimpl.reset(); | |||
| } | |||
| else | |||
| { | |||
| @@ -401,7 +401,7 @@ void InterProcessLock::exit() | |||
| jassert (pimpl != nullptr); | |||
| if (pimpl != nullptr && --(pimpl->refCount) == 0) | |||
| pimpl = nullptr; | |||
| pimpl.reset(); | |||
| } | |||
| //============================================================================== | |||
| @@ -23,7 +23,7 @@ | |||
| namespace juce | |||
| { | |||
| HighResolutionTimer::HighResolutionTimer() { pimpl = new Pimpl (*this); } | |||
| HighResolutionTimer::HighResolutionTimer() { pimpl.reset (new Pimpl (*this)); } | |||
| HighResolutionTimer::~HighResolutionTimer() { stopTimer(); } | |||
| void HighResolutionTimer::startTimer (int periodMs) { pimpl->start (jmax (1, periodMs)); } | |||
| @@ -188,7 +188,7 @@ bool PropertiesFile::loadAsXml() | |||
| if (doc != nullptr && doc->hasTagName (PropertyFileConstants::fileTag)) | |||
| { | |||
| doc = parser.getDocumentElement(); | |||
| doc.reset (parser.getDocumentElement()); | |||
| if (doc != nullptr) | |||
| { | |||
| @@ -1004,7 +1004,7 @@ private: | |||
| //============================================================================== | |||
| Convolution::Convolution() | |||
| { | |||
| pimpl = new Pimpl(); | |||
| pimpl.reset (new Pimpl()); | |||
| pimpl->addToFifo (Convolution::Pimpl::ChangeRequest::changeEngine, juce::var (0)); | |||
| } | |||
| @@ -153,7 +153,7 @@ bool ChildProcessMaster::launchSlaveProcess (const File& executable, const Strin | |||
| if (childProcess->start (args, streamFlags)) | |||
| { | |||
| connection = new Connection (*this, pipeName, timeoutMs <= 0 ? defaultTimeoutMs : timeoutMs); | |||
| connection.reset (new Connection (*this, pipeName, timeoutMs <= 0 ? defaultTimeoutMs : timeoutMs)); | |||
| if (connection->isConnected()) | |||
| { | |||
| @@ -254,7 +254,7 @@ bool ChildProcessSlave::initialiseFromCommandLine (const String& commandLine, | |||
| if (pipeName.isNotEmpty()) | |||
| { | |||
| connection = new Connection (*this, pipeName, timeoutMs <= 0 ? defaultTimeoutMs : timeoutMs); | |||
| connection.reset (new Connection (*this, pipeName, timeoutMs <= 0 ? defaultTimeoutMs : timeoutMs)); | |||
| if (! connection->isConnected()) | |||
| connection.reset(); | |||
| @@ -37,7 +37,7 @@ InterprocessConnection::InterprocessConnection (bool callbacksOnMessageThread, u | |||
| : useMessageThread (callbacksOnMessageThread), | |||
| magicMessageHeader (magicMessageHeaderNumber) | |||
| { | |||
| thread = new ConnectionThread (*this); | |||
| thread.reset (new ConnectionThread (*this)); | |||
| } | |||
| InterprocessConnection::~InterprocessConnection() | |||
| @@ -56,7 +56,7 @@ bool InterprocessConnection::connectToSocket (const String& hostName, | |||
| disconnect(); | |||
| const ScopedLock sl (pipeAndSocketLock); | |||
| socket = new StreamingSocket(); | |||
| socket.reset (new StreamingSocket()); | |||
| if (socket->connect (hostName, portNumber, timeOutMillisecs)) | |||
| { | |||
| @@ -179,7 +179,7 @@ int InterprocessConnection::writeData (void* data, int dataSize) | |||
| void InterprocessConnection::initialiseWithSocket (StreamingSocket* newSocket) | |||
| { | |||
| jassert (socket == nullptr && pipe == nullptr); | |||
| socket = newSocket; | |||
| socket.reset (newSocket); | |||
| connectionMadeInt(); | |||
| thread->startThread(); | |||
| } | |||
| @@ -187,7 +187,7 @@ void InterprocessConnection::initialiseWithSocket (StreamingSocket* newSocket) | |||
| void InterprocessConnection::initialiseWithPipe (NamedPipe* newPipe) | |||
| { | |||
| jassert (socket == nullptr && pipe == nullptr); | |||
| pipe = newPipe; | |||
| pipe.reset (newPipe); | |||
| connectionMadeInt(); | |||
| thread->startThread(); | |||
| } | |||
| @@ -37,7 +37,7 @@ bool InterprocessConnectionServer::beginWaitingForSocket (const int portNumber, | |||
| { | |||
| stop(); | |||
| socket = new StreamingSocket(); | |||
| socket.reset (new StreamingSocket()); | |||
| if (socket->createListener (portNumber, bindAddress)) | |||
| { | |||
| @@ -134,7 +134,7 @@ bool JUCEApplicationBase::sendCommandLineToPreexistingInstance() | |||
| { | |||
| jassert (multipleInstanceHandler == nullptr); // this must only be called once! | |||
| multipleInstanceHandler = new MultipleInstanceHandler (getApplicationName()); | |||
| multipleInstanceHandler.reset (new MultipleInstanceHandler (getApplicationName())); | |||
| return multipleInstanceHandler->sendCommandLineToPreexistingInstance(); | |||
| } | |||
| @@ -194,7 +194,7 @@ void MessageManager::deliverBroadcastMessage (const String& value) | |||
| void MessageManager::registerBroadcastListener (ActionListener* const listener) | |||
| { | |||
| if (broadcaster == nullptr) | |||
| broadcaster = new ActionBroadcaster(); | |||
| broadcaster.reset (new ActionBroadcaster()); | |||
| broadcaster->addActionListener (listener); | |||
| } | |||
| @@ -514,7 +514,7 @@ private: | |||
| }; | |||
| }; | |||
| MountedVolumeListChangeDetector::MountedVolumeListChangeDetector() { pimpl = new Pimpl (*this); } | |||
| MountedVolumeListChangeDetector::MountedVolumeListChangeDetector() { pimpl.reset (new Pimpl (*this)); } | |||
| MountedVolumeListChangeDetector::~MountedVolumeListChangeDetector() {} | |||
| #endif | |||
| @@ -234,7 +234,7 @@ struct MountedVolumeListChangeDetector::Pimpl : private DeviceChangeDetector | |||
| Array<File> lastVolumeList; | |||
| }; | |||
| MountedVolumeListChangeDetector::MountedVolumeListChangeDetector() { pimpl = new Pimpl (*this); } | |||
| MountedVolumeListChangeDetector::MountedVolumeListChangeDetector() { pimpl.reset (new Pimpl (*this)); } | |||
| MountedVolumeListChangeDetector::~MountedVolumeListChangeDetector() {} | |||
| } // namespace juce | |||
| @@ -65,7 +65,7 @@ FillType& FillType::operator= (const FillType& other) | |||
| if (this != &other) | |||
| { | |||
| colour = other.colour; | |||
| gradient = other.gradient.createCopy(); | |||
| gradient.reset (other.gradient.createCopy()); | |||
| image = other.image; | |||
| transform = other.transform; | |||
| } | |||
| @@ -75,7 +75,7 @@ FillType& FillType::operator= (const FillType& other) | |||
| FillType::FillType (FillType&& other) noexcept | |||
| : colour (other.colour), | |||
| gradient (other.gradient.release()), | |||
| gradient (static_cast<ScopedPointer<ColourGradient>&&> (other.gradient)), | |||
| image (static_cast<Image&&> (other.image)), | |||
| transform (other.transform) | |||
| { | |||
| @@ -86,7 +86,7 @@ FillType& FillType::operator= (FillType&& other) noexcept | |||
| jassert (this != &other); // hopefully the compiler should make this situation impossible! | |||
| colour = other.colour; | |||
| gradient = other.gradient.release(); | |||
| gradient = static_cast<ScopedPointer<ColourGradient>&&> (other.gradient); | |||
| image = static_cast<Image&&> (other.image); | |||
| transform = other.transform; | |||
| return *this; | |||
| @@ -112,7 +112,7 @@ bool FillType::operator!= (const FillType& other) const | |||
| void FillType::setColour (Colour newColour) noexcept | |||
| { | |||
| gradient.reset(); | |||
| image = Image(); | |||
| image = {}; | |||
| colour = newColour; | |||
| } | |||
| @@ -124,8 +124,8 @@ void FillType::setGradient (const ColourGradient& newGradient) | |||
| } | |||
| else | |||
| { | |||
| image = Image(); | |||
| gradient = new ColourGradient (newGradient); | |||
| image = {}; | |||
| gradient.reset (new ColourGradient (newGradient)); | |||
| colour = Colours::black; | |||
| } | |||
| } | |||
| @@ -363,8 +363,8 @@ namespace TextLayoutHelpers | |||
| Array<float> xOffsets; | |||
| t.font.getGlyphPositions (getTrimmedEndIfNotAllWhitespace (t.text), newGlyphs, xOffsets); | |||
| if (currentRun == nullptr) currentRun = new TextLayout::Run(); | |||
| if (currentLine == nullptr) currentLine = new TextLayout::Line(); | |||
| if (currentRun == nullptr) currentRun .reset (new TextLayout::Run()); | |||
| if (currentLine == nullptr) currentLine.reset (new TextLayout::Line()); | |||
| if (newGlyphs.size() > 0) | |||
| { | |||
| @@ -404,7 +404,7 @@ namespace TextLayoutHelpers | |||
| if (t.line != nextToken->line) | |||
| { | |||
| if (currentRun == nullptr) | |||
| currentRun = new TextLayout::Run(); | |||
| currentRun.reset (new TextLayout::Run()); | |||
| addRun (*currentLine, currentRun.release(), t, runStartPosition, charPosition); | |||
| currentLine->stringRange = { lineStartPosition, charPosition }; | |||
| @@ -258,7 +258,7 @@ void Typeface::applyVerticalHintingTransform (float fontSize, Path& path) | |||
| ScopedLock sl (hintingLock); | |||
| if (hintingParams == nullptr) | |||
| hintingParams = new HintingParams (*this); | |||
| hintingParams.reset (new HintingParams (*this)); | |||
| return hintingParams->applyVerticalHintingTransform (fontSize, path); | |||
| } | |||
| @@ -2676,7 +2676,7 @@ public: | |||
| { | |||
| if (auto* top = stack.getLast()) | |||
| { | |||
| currentState = top; | |||
| currentState.reset (top); | |||
| stack.removeLast (1, false); | |||
| } | |||
| else | |||
| @@ -2688,7 +2688,7 @@ public: | |||
| void beginTransparencyLayer (float opacity) | |||
| { | |||
| save(); | |||
| currentState = currentState->beginTransparencyLayer (opacity); | |||
| currentState.reset (currentState->beginTransparencyLayer (opacity)); | |||
| } | |||
| void endTransparencyLayer() | |||
| @@ -341,9 +341,9 @@ void CoreGraphicsContext::restoreState() | |||
| { | |||
| CGContextRestoreGState (context); | |||
| if (SavedState* const top = stateStack.getLast()) | |||
| if (auto* top = stateStack.getLast()) | |||
| { | |||
| state = top; | |||
| state.reset (top); | |||
| stateStack.removeLast (1, false); | |||
| lastClipRectIsValid = false; | |||
| } | |||
| @@ -53,15 +53,16 @@ void DrawableButton::setImages (const Drawable* normal, | |||
| { | |||
| jassert (normal != nullptr); // you really need to give it at least a normal image.. | |||
| normalImage = copyDrawableIfNotNull (normal); | |||
| overImage = copyDrawableIfNotNull (over); | |||
| downImage = copyDrawableIfNotNull (down); | |||
| disabledImage = copyDrawableIfNotNull (disabled); | |||
| normalImageOn = copyDrawableIfNotNull (normalOn); | |||
| overImageOn = copyDrawableIfNotNull (overOn); | |||
| downImageOn = copyDrawableIfNotNull (downOn); | |||
| disabledImageOn = copyDrawableIfNotNull (disabledOn); | |||
| currentImage = nullptr; | |||
| normalImage .reset (copyDrawableIfNotNull (normal)); | |||
| overImage .reset (copyDrawableIfNotNull (over)); | |||
| downImage .reset (copyDrawableIfNotNull (down)); | |||
| disabledImage .reset (copyDrawableIfNotNull (disabled)); | |||
| normalImageOn .reset (copyDrawableIfNotNull (normalOn)); | |||
| overImageOn .reset (copyDrawableIfNotNull (overOn)); | |||
| downImageOn .reset (copyDrawableIfNotNull (downOn)); | |||
| disabledImageOn .reset (copyDrawableIfNotNull (disabledOn)); | |||
| currentImage = nullptr; | |||
| buttonStateChanged(); | |||
| } | |||
| @@ -29,7 +29,7 @@ namespace juce | |||
| ApplicationCommandManager::ApplicationCommandManager() | |||
| { | |||
| keyMappings = new KeyPressMappingSet (*this); | |||
| keyMappings.reset (new KeyPressMappingSet (*this)); | |||
| Desktop::getInstance().addFocusChangeListener (this); | |||
| } | |||
| @@ -261,7 +261,7 @@ XmlElement* KeyPressMappingSet::createXml (const bool saveDifferencesFromDefault | |||
| if (saveDifferencesFromDefaultSet) | |||
| { | |||
| defaultSet = new KeyPressMappingSet (commandManager); | |||
| defaultSet.reset (new KeyPressMappingSet (commandManager)); | |||
| defaultSet->resetToDefaultMappings(); | |||
| } | |||
| @@ -832,7 +832,7 @@ void Component::setCachedComponentImage (CachedComponentImage* newCachedImage) | |||
| { | |||
| if (cachedImage != newCachedImage) | |||
| { | |||
| cachedImage = newCachedImage; | |||
| cachedImage.reset (newCachedImage); | |||
| repaint(); | |||
| } | |||
| } | |||
| @@ -848,7 +848,7 @@ void Component::setBufferedToImage (bool shouldBeBuffered) | |||
| if (shouldBeBuffered) | |||
| { | |||
| if (cachedImage == nullptr) | |||
| cachedImage = new StandardCachedComponentImage (*this); | |||
| cachedImage.reset (new StandardCachedComponentImage (*this)); | |||
| } | |||
| else | |||
| { | |||
| @@ -1267,7 +1267,7 @@ void Component::setTransform (const AffineTransform& newTransform) | |||
| else if (affineTransform == nullptr) | |||
| { | |||
| repaint(); | |||
| affineTransform = new AffineTransform (newTransform); | |||
| affineTransform.reset (new AffineTransform (newTransform)); | |||
| repaint(); | |||
| sendMovedResizedMessages (false, false); | |||
| } | |||
| @@ -2154,7 +2154,7 @@ void Component::setPositioner (Positioner* newPositioner) | |||
| { | |||
| // You can only assign a positioner to the component that it was created for! | |||
| jassert (newPositioner == nullptr || this == &(newPositioner->getComponent())); | |||
| positioner = newPositioner; | |||
| positioner.reset (newPositioner); | |||
| } | |||
| //============================================================================== | |||
| @@ -2263,7 +2263,7 @@ void Component::addMouseListener (MouseListener* newListener, | |||
| jassert ((newListener != this) || wantsEventsForAllNestedChildComponents); | |||
| if (mouseListeners == nullptr) | |||
| mouseListeners = new MouseListenerList(); | |||
| mouseListeners.reset (new MouseListenerList()); | |||
| mouseListeners->addListener (newListener, wantsEventsForAllNestedChildComponents); | |||
| } | |||
| @@ -2928,7 +2928,7 @@ Point<int> Component::getMouseXYRelative() const | |||
| void Component::addKeyListener (KeyListener* newListener) | |||
| { | |||
| if (keyListeners == nullptr) | |||
| keyListeners = new Array<KeyListener*>(); | |||
| keyListeners.reset (new Array<KeyListener*>()); | |||
| keyListeners->addIfNotAlreadyThere (newListener); | |||
| } | |||
| @@ -29,13 +29,9 @@ namespace juce | |||
| Desktop::Desktop() | |||
| : mouseSources (new MouseInputSource::SourceList()), | |||
| mouseClickCounter (0), mouseWheelCounter (0), | |||
| kioskModeComponent (nullptr), | |||
| kioskModeReentrant (false), | |||
| allowedOrientations (allOrientations), | |||
| masterScaleFactor ((float) getDefaultMasterScale()) | |||
| { | |||
| displays = new Displays (*this); | |||
| displays.reset (new Displays (*this)); | |||
| } | |||
| Desktop::~Desktop() | |||
| @@ -67,7 +63,7 @@ int Desktop::getNumComponents() const noexcept | |||
| return desktopComponents.size(); | |||
| } | |||
| Component* Desktop::getComponent (const int index) const noexcept | |||
| Component* Desktop::getComponent (int index) const noexcept | |||
| { | |||
| return desktopComponents [index]; | |||
| } | |||
| @@ -78,11 +74,11 @@ Component* Desktop::findComponentAt (Point<int> screenPosition) const | |||
| for (int i = desktopComponents.size(); --i >= 0;) | |||
| { | |||
| Component* const c = desktopComponents.getUnchecked(i); | |||
| auto* c = desktopComponents.getUnchecked(i); | |||
| if (c->isVisible()) | |||
| { | |||
| const Point<int> relative (c->getLocalPoint (nullptr, screenPosition)); | |||
| auto relative = c->getLocalPoint (nullptr, screenPosition); | |||
| if (c->contains (relative)) | |||
| return c->getComponentAt (relative); | |||
| @@ -98,7 +94,7 @@ LookAndFeel& Desktop::getDefaultLookAndFeel() noexcept | |||
| if (currentLookAndFeel == nullptr) | |||
| { | |||
| if (defaultLookAndFeel == nullptr) | |||
| defaultLookAndFeel = new LookAndFeel_V4(); | |||
| defaultLookAndFeel.reset (new LookAndFeel_V4()); | |||
| currentLookAndFeel = defaultLookAndFeel; | |||
| } | |||
| @@ -112,26 +108,26 @@ void Desktop::setDefaultLookAndFeel (LookAndFeel* newDefaultLookAndFeel) | |||
| currentLookAndFeel = newDefaultLookAndFeel; | |||
| for (int i = getNumComponents(); --i >= 0;) | |||
| if (Component* const c = getComponent (i)) | |||
| if (auto* c = getComponent (i)) | |||
| c->sendLookAndFeelChange(); | |||
| } | |||
| //============================================================================== | |||
| void Desktop::addDesktopComponent (Component* const c) | |||
| void Desktop::addDesktopComponent (Component* c) | |||
| { | |||
| jassert (c != nullptr); | |||
| jassert (! desktopComponents.contains (c)); | |||
| desktopComponents.addIfNotAlreadyThere (c); | |||
| } | |||
| void Desktop::removeDesktopComponent (Component* const c) | |||
| void Desktop::removeDesktopComponent (Component* c) | |||
| { | |||
| desktopComponents.removeFirstMatchingValue (c); | |||
| } | |||
| void Desktop::componentBroughtToFront (Component* const c) | |||
| void Desktop::componentBroughtToFront (Component* c) | |||
| { | |||
| const int index = desktopComponents.indexOf (c); | |||
| auto index = desktopComponents.indexOf (c); | |||
| jassert (index >= 0); | |||
| if (index >= 0) | |||
| @@ -179,18 +175,18 @@ int Desktop::getMouseWheelMoveCounter() const noexcept { return mouseWheelC | |||
| void Desktop::incrementMouseClickCounter() noexcept { ++mouseClickCounter; } | |||
| void Desktop::incrementMouseWheelCounter() noexcept { ++mouseWheelCounter; } | |||
| const Array<MouseInputSource>& Desktop::getMouseSources() const noexcept { return mouseSources->sourceArray; } | |||
| int Desktop::getNumMouseSources() const noexcept { return mouseSources->sources.size(); } | |||
| int Desktop::getNumDraggingMouseSources() const noexcept { return mouseSources->getNumDraggingMouseSources(); } | |||
| MouseInputSource* Desktop::getMouseSource (int index) const noexcept { return mouseSources->getMouseSource (index); } | |||
| MouseInputSource* Desktop::getDraggingMouseSource (int index) const noexcept { return mouseSources->getDraggingMouseSource (index); } | |||
| MouseInputSource Desktop::getMainMouseSource() const noexcept { return MouseInputSource (mouseSources->sources.getUnchecked(0)); } | |||
| void Desktop::beginDragAutoRepeat (int interval) { mouseSources->beginDragAutoRepeat (interval); } | |||
| const Array<MouseInputSource>& Desktop::getMouseSources() const noexcept { return mouseSources->sourceArray; } | |||
| int Desktop::getNumMouseSources() const noexcept { return mouseSources->sources.size(); } | |||
| int Desktop::getNumDraggingMouseSources() const noexcept { return mouseSources->getNumDraggingMouseSources(); } | |||
| MouseInputSource* Desktop::getMouseSource (int index) const noexcept { return mouseSources->getMouseSource (index); } | |||
| MouseInputSource* Desktop::getDraggingMouseSource (int index) const noexcept { return mouseSources->getDraggingMouseSource (index); } | |||
| MouseInputSource Desktop::getMainMouseSource() const noexcept { return MouseInputSource (mouseSources->sources.getUnchecked(0)); } | |||
| void Desktop::beginDragAutoRepeat (int interval) { mouseSources->beginDragAutoRepeat (interval); } | |||
| //============================================================================== | |||
| void Desktop::addFocusChangeListener (FocusChangeListener* const listener) { focusListeners.add (listener); } | |||
| void Desktop::removeFocusChangeListener (FocusChangeListener* const listener) { focusListeners.remove (listener); } | |||
| void Desktop::triggerFocusCallback() { triggerAsyncUpdate(); } | |||
| void Desktop::addFocusChangeListener (FocusChangeListener* l) { focusListeners.add (l); } | |||
| void Desktop::removeFocusChangeListener (FocusChangeListener* l) { focusListeners.remove (l); } | |||
| void Desktop::triggerFocusCallback() { triggerAsyncUpdate(); } | |||
| void Desktop::handleAsyncUpdate() | |||
| { | |||
| @@ -217,14 +213,14 @@ ListenerList<MouseListener>& Desktop::getMouseListeners() | |||
| return mouseListeners; | |||
| } | |||
| void Desktop::addGlobalMouseListener (MouseListener* const listener) | |||
| void Desktop::addGlobalMouseListener (MouseListener* listener) | |||
| { | |||
| ASSERT_MESSAGE_MANAGER_IS_LOCKED | |||
| mouseListeners.add (listener); | |||
| resetTimer(); | |||
| } | |||
| void Desktop::removeGlobalMouseListener (MouseListener* const listener) | |||
| void Desktop::removeGlobalMouseListener (MouseListener* listener) | |||
| { | |||
| ASSERT_MESSAGE_MANAGER_IS_LOCKED | |||
| mouseListeners.remove (listener); | |||
| @@ -279,20 +275,18 @@ const Desktop::Displays::Display& Desktop::Displays::getMainDisplay() const noex | |||
| const Desktop::Displays::Display& Desktop::Displays::getDisplayContaining (Point<int> position) const noexcept | |||
| { | |||
| ASSERT_MESSAGE_MANAGER_IS_LOCKED | |||
| const Display* best = &displays.getReference(0); | |||
| auto* best = &displays.getReference(0); | |||
| double bestDistance = 1.0e10; | |||
| for (int i = displays.size(); --i >= 0;) | |||
| for (auto& d : displays) | |||
| { | |||
| const Display& d = displays.getReference(i); | |||
| if (d.totalArea.contains (position)) | |||
| { | |||
| best = &d; | |||
| break; | |||
| } | |||
| const double distance = d.totalArea.getCentre().getDistanceFrom (position); | |||
| auto distance = d.totalArea.getCentre().getDistanceFrom (position); | |||
| if (distance < bestDistance) | |||
| { | |||
| @@ -309,11 +303,8 @@ RectangleList<int> Desktop::Displays::getRectangleList (bool userAreasOnly) cons | |||
| ASSERT_MESSAGE_MANAGER_IS_LOCKED | |||
| RectangleList<int> rl; | |||
| for (int i = 0; i < displays.size(); ++i) | |||
| { | |||
| const Display& d = displays.getReference(i); | |||
| for (auto& d : displays) | |||
| rl.addWithoutMerging (userAreasOnly ? d.userArea : d.totalArea); | |||
| } | |||
| return rl; | |||
| } | |||
| @@ -353,13 +344,13 @@ void Desktop::Displays::refresh() | |||
| if (oldDisplays != displays) | |||
| { | |||
| for (int i = ComponentPeer::getNumPeers(); --i >= 0;) | |||
| if (ComponentPeer* const peer = ComponentPeer::getPeer (i)) | |||
| if (auto* peer = ComponentPeer::getPeer (i)) | |||
| peer->handleScreenSizeChange(); | |||
| } | |||
| } | |||
| //============================================================================== | |||
| void Desktop::setKioskModeComponent (Component* componentToUse, const bool allowMenusAndBars) | |||
| void Desktop::setKioskModeComponent (Component* componentToUse, bool allowMenusAndBars) | |||
| { | |||
| if (kioskModeReentrant) | |||
| return; | |||
| @@ -371,7 +362,7 @@ void Desktop::setKioskModeComponent (Component* componentToUse, const bool allow | |||
| // agh! Don't delete or remove a component from the desktop while it's still the kiosk component! | |||
| jassert (kioskModeComponent == nullptr || ComponentPeer::getPeerFor (kioskModeComponent) != nullptr); | |||
| if (Component* const oldKioskComp = kioskModeComponent) | |||
| if (auto* oldKioskComp = kioskModeComponent) | |||
| { | |||
| kioskModeComponent = nullptr; // (to make sure that isKioskMode() returns false when resizing the old one) | |||
| setKioskComponent (oldKioskComp, false, allowMenusAndBars); | |||
| @@ -392,7 +383,7 @@ void Desktop::setKioskModeComponent (Component* componentToUse, const bool allow | |||
| } | |||
| //============================================================================== | |||
| void Desktop::setOrientationsEnabled (const int newOrientations) | |||
| void Desktop::setOrientationsEnabled (int newOrientations) | |||
| { | |||
| if (allowedOrientations != newOrientations) | |||
| { | |||
| @@ -409,7 +400,7 @@ int Desktop::getOrientationsEnabled() const noexcept | |||
| return allowedOrientations; | |||
| } | |||
| bool Desktop::isOrientationEnabled (const DisplayOrientation orientation) const noexcept | |||
| bool Desktop::isOrientationEnabled (DisplayOrientation orientation) const noexcept | |||
| { | |||
| // Make sure you only pass one valid flag in here... | |||
| jassert (orientation == upright || orientation == upsideDown | |||
| @@ -430,18 +430,18 @@ private: | |||
| Point<float> lastFakeMouseMove; | |||
| void sendMouseMove(); | |||
| int mouseClickCounter, mouseWheelCounter; | |||
| int mouseClickCounter = 0, mouseWheelCounter = 0; | |||
| void incrementMouseClickCounter() noexcept; | |||
| void incrementMouseWheelCounter() noexcept; | |||
| ScopedPointer<LookAndFeel> defaultLookAndFeel; | |||
| WeakReference<LookAndFeel> currentLookAndFeel; | |||
| Component* kioskModeComponent; | |||
| Component* kioskModeComponent = nullptr; | |||
| Rectangle<int> kioskComponentOriginalBounds; | |||
| bool kioskModeReentrant; | |||
| bool kioskModeReentrant = false; | |||
| int allowedOrientations; | |||
| int allowedOrientations = allOrientations; | |||
| void allowedOrientationsChanged(); | |||
| float masterScaleFactor; | |||
| @@ -111,7 +111,7 @@ void Drawable::setClipPath (Drawable* clipPath) | |||
| { | |||
| if (drawableClipPath != clipPath) | |||
| { | |||
| drawableClipPath = clipPath; | |||
| drawableClipPath.reset (clipPath); | |||
| repaint(); | |||
| } | |||
| } | |||
| @@ -1170,8 +1170,7 @@ private: | |||
| { | |||
| const auto indexOfComma = link.indexOf (","); | |||
| auto format = link.substring (5, indexOfComma).trim(); | |||
| const auto indexOfSemi = format.indexOf (";"); | |||
| auto indexOfSemi = format.indexOf (";"); | |||
| if (format.substring (indexOfSemi + 1).trim().equalsIgnoreCase ("base64")) | |||
| { | |||
| @@ -1179,10 +1178,10 @@ private: | |||
| if (mime.equalsIgnoreCase ("image/png") || mime.equalsIgnoreCase ("image/jpeg")) | |||
| { | |||
| const String base64text = link.substring (indexOfComma + 1).removeCharacters ("\t\n\r "); | |||
| auto base64text = link.substring (indexOfComma + 1).removeCharacters ("\t\n\r "); | |||
| if (Base64::convertFromBase64 (imageStream, base64text)) | |||
| inputStream = new MemoryInputStream (imageStream.getData(), imageStream.getDataSize(), false); | |||
| inputStream.reset (new MemoryInputStream (imageStream.getData(), imageStream.getDataSize(), false)); | |||
| } | |||
| } | |||
| } | |||
| @@ -1191,7 +1190,7 @@ private: | |||
| auto linkedFile = originalFile.getParentDirectory().getChildFile (link); | |||
| if (linkedFile.existsAsFile()) | |||
| inputStream = linkedFile.createInputStream(); | |||
| inputStream.reset (linkedFile.createInputStream()); | |||
| } | |||
| if (inputStream != nullptr) | |||
| @@ -176,7 +176,7 @@ void ContentSharer::startNewShare (std::function<void (bool, const String&)> cal | |||
| // You should not start another sharing operation before the previous one is finished. | |||
| // Forcibly stopping a previous sharing operation is rarely a good idea! | |||
| jassert (pimpl == nullptr); | |||
| pimpl = nullptr; | |||
| pimpl.reset(); | |||
| prepareDataThread = nullptr; | |||
| prepareImagesThread = nullptr; | |||
| @@ -187,7 +187,7 @@ void ContentSharer::startNewShare (std::function<void (bool, const String&)> cal | |||
| jassert (callbackToUse); | |||
| callback = static_cast<std::function<void (bool, const String&)>&&> (callbackToUse); | |||
| pimpl = createPimpl(); | |||
| pimpl.reset (createPimpl()); | |||
| } | |||
| #endif | |||
| @@ -263,7 +263,7 @@ void ContentSharer::sharingFinished (bool succeeded, const String& errorDescript | |||
| std::swap (cb, callback); | |||
| #if JUCE_IOS || JUCE_ANDROID | |||
| pimpl = nullptr; | |||
| pimpl.reset(); | |||
| #endif | |||
| if (cb) | |||
| @@ -107,7 +107,7 @@ void DirectoryContentsList::refresh() | |||
| if (root.isDirectory()) | |||
| { | |||
| fileFindHandle = new DirectoryIterator (root, false, "*", fileTypeFlags); | |||
| fileFindHandle.reset (new DirectoryIterator (root, false, "*", fileTypeFlags)); | |||
| shouldStop = false; | |||
| thread.addTimeSliceClient (this); | |||
| } | |||
| @@ -64,12 +64,12 @@ FileBrowserComponent::FileBrowserComponent (int flags_, | |||
| filename = initialFileOrDirectory.getFileName(); | |||
| } | |||
| fileList = new DirectoryContentsList (this, thread); | |||
| fileList.reset (new DirectoryContentsList (this, thread)); | |||
| if ((flags & useTreeView) != 0) | |||
| { | |||
| auto tree = new FileTreeComponent (*fileList); | |||
| fileListComponent = tree; | |||
| fileListComponent.reset (tree); | |||
| if ((flags & canSelectMultipleItems) != 0) | |||
| tree->setMultiSelectEnabled (true); | |||
| @@ -79,7 +79,7 @@ FileBrowserComponent::FileBrowserComponent (int flags_, | |||
| else | |||
| { | |||
| auto list = new FileListComponent (*fileList); | |||
| fileListComponent = list; | |||
| fileListComponent.reset (list); | |||
| list->setOutlineThickness (1); | |||
| if ((flags & canSelectMultipleItems) != 0) | |||
| @@ -105,7 +105,8 @@ FileBrowserComponent::FileBrowserComponent (int flags_, | |||
| addAndMakeVisible (fileLabel); | |||
| fileLabel.attachToComponent (&filenameBox, true); | |||
| addAndMakeVisible (goUpButton = getLookAndFeel().createFileBrowserGoUpButton()); | |||
| goUpButton.reset (getLookAndFeel().createFileBrowserGoUpButton()); | |||
| addAndMakeVisible (goUpButton.get()); | |||
| goUpButton->onClick = [this] { goUp(); }; | |||
| goUpButton->setTooltip (TRANS ("Go up to parent directory")); | |||
| @@ -156,7 +156,7 @@ bool FileChooser::showDialog (const int flags, FilePreviewComponent* const previ | |||
| { | |||
| FocusRestorer focusRestorer; | |||
| pimpl = createPimpl (flags, previewComp); | |||
| pimpl.reset (createPimpl (flags, previewComp)); | |||
| pimpl->runModally(); | |||
| // ensure that the finished function was invoked | |||
| @@ -177,7 +177,7 @@ void FileChooser::launchAsync (int flags, std::function<void (const FileChooser& | |||
| asyncCallback = static_cast<std::function<void (const FileChooser&)>&&> (callback); | |||
| pimpl = createPimpl (flags, previewComp); | |||
| pimpl.reset (createPimpl (flags, previewComp)); | |||
| pimpl->launch(); | |||
| } | |||
| @@ -194,9 +194,9 @@ FileChooser::Pimpl* FileChooser::createPimpl (int flags, FilePreviewComponent* p | |||
| { | |||
| // you cannot run two file chooser dialog boxes at the same time | |||
| jassertfalse; | |||
| pimpl = nullptr; | |||
| pimpl.reset(); | |||
| } | |||
| // You've set the flags for both saveMode and openMode! | |||
| jassert (! (((flags & FileBrowserComponent::saveMode) != 0) | |||
| && ((flags & FileBrowserComponent::openMode) != 0))); | |||
| @@ -256,7 +256,7 @@ void FileChooser::finished (const Array<URL>& asyncResults) | |||
| results = asyncResults; | |||
| pimpl = nullptr; | |||
| pimpl.reset(); | |||
| if (callback) | |||
| callback (*this); | |||
| @@ -87,8 +87,8 @@ void FilenameComponent::setBrowseButtonText (const String& newBrowseButtonText) | |||
| void FilenameComponent::lookAndFeelChanged() | |||
| { | |||
| browseButton.reset(); | |||
| addAndMakeVisible (browseButton = getLookAndFeel().createFilenameComponentBrowseButton (browseButtonText)); | |||
| browseButton.reset (getLookAndFeel().createFilenameComponentBrowseButton (browseButtonText)); | |||
| addAndMakeVisible (browseButton.get()); | |||
| browseButton->setConnectedEdges (Button::ConnectedOnLeft); | |||
| browseButton->onClick = [this] { showChooser(); }; | |||
| resized(); | |||
| @@ -59,7 +59,7 @@ public: | |||
| endSpeed = jmax (0.0, endSpd * invTotalDistance); | |||
| if (useProxyComponent) | |||
| proxy = new ProxyComponent (*component); | |||
| proxy.reset (new ProxyComponent (*component)); | |||
| else | |||
| proxy.reset(); | |||
| @@ -122,7 +122,7 @@ Component* ComponentBuilder::getManagedComponent() | |||
| { | |||
| if (component == nullptr) | |||
| { | |||
| component = createComponent(); | |||
| component.reset (createComponent()); | |||
| #if JUCE_DEBUG | |||
| componentRef = component; | |||
| @@ -192,7 +192,8 @@ bool MultiDocumentPanel::addDocument (Component* const component, | |||
| { | |||
| if (tabComponent == nullptr && components.size() > numDocsBeforeTabsUsed) | |||
| { | |||
| addAndMakeVisible (tabComponent = new TabbedComponentInternal()); | |||
| tabComponent.reset (new TabbedComponentInternal()); | |||
| addAndMakeVisible (tabComponent.get()); | |||
| auto temp = components; | |||
| @@ -245,7 +245,7 @@ void ScrollBar::paint (Graphics& g) | |||
| { | |||
| if (thumbAreaSize > 0) | |||
| { | |||
| LookAndFeel& lf = getLookAndFeel(); | |||
| auto& lf = getLookAndFeel(); | |||
| const int thumb = (thumbAreaSize > lf.getMinimumScrollbarThumbSize (*this)) | |||
| ? thumbSize : 0; | |||
| @@ -269,9 +269,9 @@ void ScrollBar::lookAndFeelChanged() | |||
| void ScrollBar::resized() | |||
| { | |||
| const int length = vertical ? getHeight() : getWidth(); | |||
| auto length = vertical ? getHeight() : getWidth(); | |||
| LookAndFeel& lf = getLookAndFeel(); | |||
| auto& lf = getLookAndFeel(); | |||
| const bool buttonsVisible = lf.areScrollbarButtonsVisible(); | |||
| int buttonSize = 0; | |||
| @@ -279,8 +279,11 @@ void ScrollBar::resized() | |||
| { | |||
| if (upButton == nullptr) | |||
| { | |||
| addAndMakeVisible (upButton = new ScrollbarButton (vertical ? 0 : 3, *this)); | |||
| addAndMakeVisible (downButton = new ScrollbarButton (vertical ? 2 : 1, *this)); | |||
| upButton .reset (new ScrollbarButton (vertical ? 0 : 3, *this)); | |||
| downButton.reset (new ScrollbarButton (vertical ? 2 : 1, *this)); | |||
| addAndMakeVisible (upButton.get()); | |||
| addAndMakeVisible (downButton.get()); | |||
| setButtonRepeatSpeed (initialDelayInMillisecs, repeatDelayInMillisecs, minimumDelayInMillisecs); | |||
| } | |||
| @@ -145,7 +145,8 @@ void TabBarButton::setExtraComponent (Component* comp, ExtraComponentPlacement p | |||
| { | |||
| jassert (extraCompPlacement == beforeText || extraCompPlacement == afterText); | |||
| extraCompPlacement = placement; | |||
| addAndMakeVisible (extraComponent = comp); | |||
| extraComponent.reset (comp); | |||
| addAndMakeVisible (extraComponent.get()); | |||
| resized(); | |||
| } | |||
| @@ -200,7 +201,8 @@ TabbedButtonBar::TabbedButtonBar (Orientation orientationToUse) | |||
| : orientation (orientationToUse) | |||
| { | |||
| setInterceptsMouseClicks (false, true); | |||
| addAndMakeVisible (behindFrontTab = new BehindFrontTabComp (*this)); | |||
| behindFrontTab.reset (new BehindFrontTabComp (*this)); | |||
| addAndMakeVisible (behindFrontTab.get()); | |||
| setFocusContainer (true); | |||
| } | |||
| @@ -256,7 +258,7 @@ void TabbedButtonBar::addTab (const String& tabName, | |||
| auto* newTab = new TabInfo(); | |||
| newTab->name = tabName; | |||
| newTab->colour = tabBackgroundColour; | |||
| newTab->button = createTabButton (tabName, insertIndex); | |||
| newTab->button.reset (createTabButton (tabName, insertIndex)); | |||
| jassert (newTab->button != nullptr); | |||
| tabs.insert (insertIndex, newTab); | |||
| @@ -90,7 +90,8 @@ struct TabbedComponent::ButtonBar : public TabbedButtonBar | |||
| //============================================================================== | |||
| TabbedComponent::TabbedComponent (const TabbedButtonBar::Orientation orientation) | |||
| { | |||
| addAndMakeVisible (tabs = new ButtonBar (*this, orientation)); | |||
| tabs.reset (new ButtonBar (*this, orientation)); | |||
| addAndMakeVisible (tabs.get()); | |||
| } | |||
| TabbedComponent::~TabbedComponent() | |||
| @@ -102,8 +102,11 @@ void Viewport::recreateScrollbars() | |||
| verticalScrollBar.reset(); | |||
| horizontalScrollBar.reset(); | |||
| addChildComponent (verticalScrollBar = createScrollBarComponent (true)); | |||
| addChildComponent (horizontalScrollBar = createScrollBarComponent (false)); | |||
| verticalScrollBar .reset (createScrollBarComponent (true)); | |||
| horizontalScrollBar.reset (createScrollBarComponent (false)); | |||
| addChildComponent (verticalScrollBar.get()); | |||
| addChildComponent (horizontalScrollBar.get()); | |||
| getVerticalScrollBar().addListener (this); | |||
| getHorizontalScrollBar().addListener (this); | |||
| @@ -126,7 +129,6 @@ Point<int> Viewport::viewportPosToCompPos (Point<int> pos) const | |||
| Point<int> p (jmax (jmin (0, contentHolder.getWidth() - contentBounds.getWidth()), jmin (0, -(pos.x))), | |||
| jmax (jmin (0, contentHolder.getHeight() - contentBounds.getHeight()), jmin (0, -(pos.y)))); | |||
| return p.transformedBy (contentComp->getTransform().inverted()); | |||
| } | |||
| @@ -906,11 +906,11 @@ public: | |||
| if (childComp != nullptr | |||
| && hasActiveSubMenu (childComp->item)) | |||
| { | |||
| activeSubMenu = new HelperClasses::MenuWindow (*(childComp->item.subMenu), this, | |||
| options.withTargetScreenArea (childComp->getScreenBounds()) | |||
| .withMinimumWidth (0) | |||
| .withTargetComponent (nullptr), | |||
| false, dismissOnMouseUp, managerOfChosenCommand, scaleFactor); | |||
| activeSubMenu.reset (new HelperClasses::MenuWindow (*(childComp->item.subMenu), this, | |||
| options.withTargetScreenArea (childComp->getScreenBounds()) | |||
| .withMinimumWidth (0) | |||
| .withTargetComponent (nullptr), | |||
| false, dismissOnMouseUp, managerOfChosenCommand, scaleFactor)); | |||
| activeSubMenu->setVisible (true); // (must be called before enterModalState on Windows to avoid DropShadower confusion) | |||
| activeSubMenu->enterModalState (false); | |||
| @@ -1342,8 +1342,8 @@ PopupMenu::Item& PopupMenu::Item::operator= (const Item& other) | |||
| { | |||
| text = other.text; | |||
| itemID = other.itemID; | |||
| subMenu = createCopyIfNotNull (other.subMenu.get()); | |||
| image = (other.image != nullptr ? other.image->createCopy() : nullptr); | |||
| subMenu.reset (createCopyIfNotNull (other.subMenu.get())); | |||
| image.reset (other.image != nullptr ? other.image->createCopy() : nullptr); | |||
| customComponent = other.customComponent; | |||
| customCallback = other.customCallback; | |||
| commandManager = other.commandManager; | |||
| @@ -1401,7 +1401,7 @@ void PopupMenu::addItem (int itemResultID, const String& itemText, bool isActive | |||
| i.itemID = itemResultID; | |||
| i.isEnabled = isActive; | |||
| i.isTicked = isTicked; | |||
| i.image = iconToUse; | |||
| i.image.reset (iconToUse); | |||
| addItem (i); | |||
| } | |||
| @@ -1423,7 +1423,7 @@ void PopupMenu::addCommandItem (ApplicationCommandManager* commandManager, | |||
| i.commandManager = commandManager; | |||
| i.isEnabled = target != nullptr && (info.flags & ApplicationCommandInfo::isDisabled) == 0; | |||
| i.isTicked = (info.flags & ApplicationCommandInfo::isTicked) != 0; | |||
| i.image = iconToUse; | |||
| i.image.reset (iconToUse); | |||
| addItem (i); | |||
| } | |||
| } | |||
| @@ -1437,7 +1437,7 @@ void PopupMenu::addColouredItem (int itemResultID, const String& itemText, Colou | |||
| i.colour = itemTextColour; | |||
| i.isEnabled = isActive; | |||
| i.isTicked = isTicked; | |||
| i.image = iconToUse; | |||
| i.image.reset (iconToUse); | |||
| addItem (i); | |||
| } | |||
| @@ -1450,7 +1450,7 @@ void PopupMenu::addColouredItem (int itemResultID, const String& itemText, Colou | |||
| i.colour = itemTextColour; | |||
| i.isEnabled = isActive; | |||
| i.isTicked = isTicked; | |||
| i.image = createDrawableFromImage (iconToUse); | |||
| i.image.reset (createDrawableFromImage (iconToUse)); | |||
| addItem (i); | |||
| } | |||
| @@ -1459,7 +1459,7 @@ void PopupMenu::addCustomItem (int itemResultID, CustomComponent* cc, const Popu | |||
| Item i; | |||
| i.itemID = itemResultID; | |||
| i.customComponent = cc; | |||
| i.subMenu = createCopyIfNotNull (subMenu); | |||
| i.subMenu.reset (createCopyIfNotNull (subMenu)); | |||
| addItem (i); | |||
| } | |||
| @@ -1489,10 +1489,10 @@ void PopupMenu::addSubMenu (const String& subMenuName, const PopupMenu& subMenu, | |||
| Item i; | |||
| i.text = subMenuName; | |||
| i.itemID = itemResultID; | |||
| i.subMenu = new PopupMenu (subMenu); | |||
| i.subMenu.reset (new PopupMenu (subMenu)); | |||
| i.isEnabled = isActive && (itemResultID != 0 || subMenu.getNumItems() > 0); | |||
| i.isTicked = isTicked; | |||
| i.image = iconToUse; | |||
| i.image.reset (iconToUse); | |||
| addItem (i); | |||
| } | |||
| @@ -1639,7 +1639,7 @@ int PopupMenu::showWithOptionalCallback (const Options& options, ModalComponentM | |||
| if (auto* window = createWindow (options, &(callback->managerOfChosenCommand))) | |||
| { | |||
| callback->component = window; | |||
| callback->component.reset (window); | |||
| window->setVisible (true); // (must be called before enterModalState on Windows to avoid DropShadower confusion) | |||
| window->enterModalState (false, userCallbackDeleter.release()); | |||
| @@ -121,7 +121,7 @@ struct ReportingThread : public Thread, | |||
| void run() override | |||
| { | |||
| webStream = new WebInputStream (url, true); | |||
| webStream.reset (new WebInputStream (url, true)); | |||
| webStream->withExtraHeaders (headers); | |||
| webStream->connect (nullptr); | |||
| @@ -138,8 +138,7 @@ private: | |||
| //============================================================================== | |||
| void ReportingThreadContainer::sendReport (String address, String& userAgent, StringPairArray& parameters) | |||
| { | |||
| reportingThread = new ReportingThread (*this, address, userAgent, parameters); | |||
| reportingThread.reset (new ReportingThread (*this, address, userAgent, parameters)); | |||
| reportingThread->startThread(); | |||
| } | |||
| @@ -137,7 +137,7 @@ public: | |||
| if (panel != nil) | |||
| { | |||
| [panel setDelegate:nil]; | |||
| [panel setDelegate: nil]; | |||
| if (nsViewPreview != nil) | |||
| { | |||
| @@ -152,7 +152,7 @@ public: | |||
| [panel close]; | |||
| } | |||
| panel = nullptr; | |||
| panel.reset(); | |||
| if (delegate != nil) | |||
| { | |||
| @@ -178,7 +178,7 @@ public: | |||
| ScopedPointer<TemporaryMainMenuWithStandardCommands> tempMenu; | |||
| if (JUCEApplicationBase::isStandaloneApp()) | |||
| tempMenu = new TemporaryMainMenuWithStandardCommands(); | |||
| tempMenu.reset (new TemporaryMainMenuWithStandardCommands()); | |||
| jassert (panel != nil); | |||
| #if defined (MAC_OS_X_VERSION_10_6) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6) | |||
| @@ -102,7 +102,7 @@ public: | |||
| menuBarItemsChanged (nullptr); | |||
| } | |||
| extraAppleMenuItems = createCopyIfNotNull (newExtraAppleMenuItems); | |||
| extraAppleMenuItems.reset (createCopyIfNotNull (newExtraAppleMenuItems)); | |||
| } | |||
| void addTopLevelMenu (NSMenu* parent, const PopupMenu& child, const String& name, int menuId, int topLevelIndex) | |||
| @@ -249,7 +249,7 @@ public: | |||
| if (i.text == recentItemsMenuName) | |||
| { | |||
| if (recent == nullptr) | |||
| recent = new RecentFilesMenuItem(); | |||
| recent.reset (new RecentFilesMenuItem()); | |||
| if (recent->recentItem != nil) | |||
| { | |||
| @@ -573,7 +573,7 @@ public: | |||
| : oldMenu (MenuBarModel::getMacMainMenu()) | |||
| { | |||
| if (auto* appleMenu = MenuBarModel::getMacExtraAppleItemsMenu()) | |||
| oldAppleMenu = new PopupMenu (*appleMenu); | |||
| oldAppleMenu.reset (new PopupMenu (*appleMenu)); | |||
| if (auto* handler = JuceMainMenuHandler::instance) | |||
| oldRecentItems = handler->recentItemsMenuName; | |||
| @@ -364,7 +364,7 @@ public: | |||
| if (Process::isForegroundProcess()) | |||
| { | |||
| if (assertion == nullptr) | |||
| assertion = new PMAssertion(); | |||
| assertion.reset (new PMAssertion()); | |||
| } | |||
| else | |||
| { | |||
| @@ -415,7 +415,7 @@ void Desktop::setScreenSaverEnabled (const bool isEnabled) | |||
| if (isEnabled) | |||
| screenSaverDefeater.reset(); | |||
| else if (screenSaverDefeater == nullptr) | |||
| screenSaverDefeater = new ScreenSaverDefeater(); | |||
| screenSaverDefeater.reset (new ScreenSaverDefeater()); | |||
| } | |||
| bool Desktop::isScreenSaverEnabled() | |||
| @@ -206,7 +206,8 @@ void Label::showEditor() | |||
| { | |||
| if (editor == nullptr) | |||
| { | |||
| addAndMakeVisible (editor = createEditorComponent()); | |||
| editor.reset (createEditorComponent()); | |||
| addAndMakeVisible (editor.get()); | |||
| editor->setText (getText(), false); | |||
| editor->setKeyboardType (keyboardType); | |||
| editor->addListener (this); | |||
| @@ -377,7 +377,8 @@ struct ListBoxMouseMoveSelector : public MouseListener | |||
| ListBox::ListBox (const String& name, ListBoxModel* const m) | |||
| : Component (name), model (m) | |||
| { | |||
| addAndMakeVisible (viewport = new ListViewport (*this)); | |||
| viewport.reset (new ListViewport (*this)); | |||
| addAndMakeVisible (viewport.get()); | |||
| ListBox::setWantsKeyboardFocus (true); | |||
| ListBox::colourChanged(); | |||
| @@ -408,7 +409,7 @@ void ListBox::setMouseMoveSelectsRows (bool b) | |||
| if (b) | |||
| { | |||
| if (mouseMoveSelector == nullptr) | |||
| mouseMoveSelector = new ListBoxMouseMoveSelector (*this); | |||
| mouseMoveSelector.reset (new ListBoxMouseMoveSelector (*this)); | |||
| } | |||
| else | |||
| { | |||
| @@ -859,7 +860,7 @@ void ListBox::setHeaderComponent (Component* const newHeaderComponent) | |||
| { | |||
| if (headerComponent != newHeaderComponent) | |||
| { | |||
| headerComponent = newHeaderComponent; | |||
| headerComponent.reset (newHeaderComponent); | |||
| addAndMakeVisible (newHeaderComponent); | |||
| ListBox::resized(); | |||
| @@ -1352,7 +1352,7 @@ void Slider::init (SliderStyle style, TextEntryBoxPosition textBoxPos) | |||
| setWantsKeyboardFocus (false); | |||
| setRepaintsOnMouseActivity (true); | |||
| pimpl = new Pimpl (*this, style, textBoxPos); | |||
| pimpl.reset (new Pimpl (*this, style, textBoxPos)); | |||
| Slider::lookAndFeelChanged(); | |||
| updateText(); | |||
| @@ -243,7 +243,8 @@ private: | |||
| //============================================================================== | |||
| Toolbar::Toolbar() | |||
| { | |||
| addChildComponent (missingItemsButton = getLookAndFeel().createToolbarMissingItemsButton (*this)); | |||
| missingItemsButton.reset (getLookAndFeel().createToolbarMissingItemsButton (*this)); | |||
| addChildComponent (missingItemsButton.get()); | |||
| missingItemsButton->setAlwaysOnTop (true); | |||
| missingItemsButton->onClick = [this] { showMissingItems(); }; | |||
| @@ -353,7 +354,7 @@ int Toolbar::getItemId (const int itemIndex) const noexcept | |||
| ToolbarItemComponent* Toolbar::getItemComponent (const int itemIndex) const noexcept | |||
| { | |||
| return items [itemIndex]; | |||
| return items[itemIndex]; | |||
| } | |||
| ToolbarItemComponent* Toolbar::getNextActiveComponent (int index, const int delta) const | |||
| @@ -1008,8 +1008,11 @@ void TreeView::showDragHighlight (const InsertPoint& insertPos) noexcept | |||
| if (dragInsertPointHighlight == nullptr) | |||
| { | |||
| addAndMakeVisible (dragInsertPointHighlight = new InsertPointHighlight()); | |||
| addAndMakeVisible (dragTargetGroupHighlight = new TargetGroupHighlight()); | |||
| dragInsertPointHighlight.reset (new InsertPointHighlight()); | |||
| dragTargetGroupHighlight.reset (new TargetGroupHighlight()); | |||
| addAndMakeVisible (dragInsertPointHighlight.get()); | |||
| addAndMakeVisible (dragTargetGroupHighlight.get()); | |||
| } | |||
| dragInsertPointHighlight->setTargetPosition (insertPos, viewport->getViewWidth()); | |||
| @@ -145,8 +145,8 @@ Component* DocumentWindow::getMenuBarComponent() const noexcept | |||
| void DocumentWindow::setMenuBarComponent (Component* newMenuBarComponent) | |||
| { | |||
| // (call the Component method directly to avoid the assertion in ResizableWindow) | |||
| Component::addAndMakeVisible (menuBar = newMenuBarComponent); | |||
| menuBar.reset (newMenuBarComponent); | |||
| Component::addAndMakeVisible (menuBar.get()); // (call the superclass method directly to avoid the assertion in ResizableWindow) | |||
| if (menuBar != nullptr) | |||
| menuBar->setEnabled (isActiveWindow()); | |||
| @@ -292,18 +292,18 @@ void DocumentWindow::lookAndFeelChanged() | |||
| if (! isUsingNativeTitleBar()) | |||
| { | |||
| LookAndFeel& lf = getLookAndFeel(); | |||
| auto& lf = getLookAndFeel(); | |||
| if ((requiredButtons & minimiseButton) != 0) titleBarButtons[0] = lf.createDocumentWindowButton (minimiseButton); | |||
| if ((requiredButtons & maximiseButton) != 0) titleBarButtons[1] = lf.createDocumentWindowButton (maximiseButton); | |||
| if ((requiredButtons & closeButton) != 0) titleBarButtons[2] = lf.createDocumentWindowButton (closeButton); | |||
| if ((requiredButtons & minimiseButton) != 0) titleBarButtons[0].reset (lf.createDocumentWindowButton (minimiseButton)); | |||
| if ((requiredButtons & maximiseButton) != 0) titleBarButtons[1].reset (lf.createDocumentWindowButton (maximiseButton)); | |||
| if ((requiredButtons & closeButton) != 0) titleBarButtons[2].reset (lf.createDocumentWindowButton (closeButton)); | |||
| for (auto& b : titleBarButtons) | |||
| { | |||
| if (b != nullptr) | |||
| { | |||
| if (buttonListener == nullptr) | |||
| buttonListener = new ButtonListenerProxy (*this); | |||
| buttonListener.reset (new ButtonListenerProxy (*this)); | |||
| b->addListener (buttonListener); | |||
| b->setWantsKeyboardFocus (false); | |||
| @@ -277,7 +277,8 @@ void ResizableWindow::setResizable (const bool shouldBeResizable, | |||
| if (resizableCorner == nullptr) | |||
| { | |||
| Component::addChildComponent (resizableCorner = new ResizableCornerComponent (this, constrainer)); | |||
| resizableCorner.reset (new ResizableCornerComponent (this, constrainer)); | |||
| Component::addChildComponent (resizableCorner.get()); | |||
| resizableCorner->setAlwaysOnTop (true); | |||
| } | |||
| } | |||
| @@ -286,7 +287,10 @@ void ResizableWindow::setResizable (const bool shouldBeResizable, | |||
| resizableCorner.reset(); | |||
| if (resizableBorder == nullptr) | |||
| Component::addChildComponent (resizableBorder = new ResizableBorderComponent (this, constrainer)); | |||
| { | |||
| resizableBorder.reset (new ResizableBorderComponent (this, constrainer)); | |||
| Component::addChildComponent (resizableBorder.get()); | |||
| } | |||
| } | |||
| } | |||
| else | |||
| @@ -38,13 +38,12 @@ ThreadWithProgressWindow::ThreadWithProgressWindow (const String& title, | |||
| timeOutMsWhenCancelling (cancellingTimeOutMs), | |||
| wasCancelledByUser (false) | |||
| { | |||
| alertWindow = LookAndFeel::getDefaultLookAndFeel() | |||
| .createAlertWindow (title, String(), | |||
| cancelButtonText.isEmpty() ? TRANS("Cancel") | |||
| : cancelButtonText, | |||
| String(), String(), | |||
| AlertWindow::NoIcon, hasCancelButton ? 1 : 0, | |||
| componentToCentreAround); | |||
| alertWindow.reset (LookAndFeel::getDefaultLookAndFeel() | |||
| .createAlertWindow (title, {}, | |||
| cancelButtonText.isEmpty() ? TRANS("Cancel") | |||
| : cancelButtonText, | |||
| {}, {}, AlertWindow::NoIcon, hasCancelButton ? 1 : 0, | |||
| componentToCentreAround)); | |||
| // if there are no buttons, we won't allow the user to interrupt the thread. | |||
| alertWindow->setEscapeKeyCancels (false); | |||
| @@ -221,7 +221,7 @@ void TopLevelWindow::setDropShadowEnabled (const bool useShadow) | |||
| { | |||
| if (shadower == nullptr) | |||
| { | |||
| shadower = getLookAndFeel().createDropShadowerForComponent (this); | |||
| shadower.reset (getLookAndFeel().createDropShadowerForComponent (this)); | |||
| if (shadower != nullptr) | |||
| shadower->setOwner (this); | |||
| @@ -289,7 +289,7 @@ public: | |||
| void paint (Graphics& g) override | |||
| { | |||
| jassert (dynamic_cast<CodeEditorComponent*> (getParentComponent()) != nullptr); | |||
| const CodeEditorComponent& editor = *static_cast<CodeEditorComponent*> (getParentComponent()); | |||
| auto& editor = *static_cast<CodeEditorComponent*> (getParentComponent()); | |||
| g.fillAll (editor.findColour (CodeEditorComponent::backgroundColourId) | |||
| .overlaidWith (editor.findColour (lineNumberBackgroundId))); | |||
| @@ -301,10 +301,10 @@ public: | |||
| const int lastLineToDraw = jmin (editor.lines.size(), clip.getBottom() / lineH + 1, | |||
| lastNumLines - editor.firstLineOnScreen); | |||
| const Font lineNumberFont (editor.getFont().withHeight (jmin (13.0f, lineHeightFloat * 0.8f))); | |||
| const float w = getWidth() - 2.0f; | |||
| auto lineNumberFont = editor.getFont().withHeight (jmin (13.0f, lineHeightFloat * 0.8f)); | |||
| auto w = getWidth() - 2.0f; | |||
| GlyphArrangement ga; | |||
| for (int i = firstLineToDraw; i < lastLineToDraw; ++i) | |||
| ga.addFittedText (lineNumberFont, String (editor.firstLineOnScreen + i + 1), | |||
| 0, (float) (lineH * i), w, lineHeightFloat, | |||
| @@ -316,7 +316,7 @@ public: | |||
| void documentChanged (CodeDocument& doc, int newFirstLine) | |||
| { | |||
| const int newNumLines = doc.getNumLines(); | |||
| auto newNumLines = doc.getNumLines(); | |||
| if (newNumLines != lastNumLines || firstLine != newFirstLine) | |||
| { | |||
| @@ -339,7 +339,7 @@ CodeEditorComponent::CodeEditorComponent (CodeDocument& doc, CodeTokeniser* cons | |||
| selectionEnd (doc, 0, 0), | |||
| codeTokeniser (tokeniser) | |||
| { | |||
| pimpl = new Pimpl (*this); | |||
| pimpl.reset (new Pimpl (*this)); | |||
| caretPos.setPositionMaintained (true); | |||
| selectionStart.setPositionMaintained (true); | |||
| @@ -349,7 +349,8 @@ CodeEditorComponent::CodeEditorComponent (CodeDocument& doc, CodeTokeniser* cons | |||
| setMouseCursor (MouseCursor::IBeamCursor); | |||
| setWantsKeyboardFocus (true); | |||
| addAndMakeVisible (caret = getLookAndFeel().createCaretComponent (this)); | |||
| caret.reset (getLookAndFeel().createCaretComponent (this)); | |||
| addAndMakeVisible (caret.get()); | |||
| addAndMakeVisible (verticalScrollBar); | |||
| verticalScrollBar.setSingleStepSize (1.0); | |||
| @@ -416,7 +417,10 @@ void CodeEditorComponent::setLineNumbersShown (const bool shouldBeShown) | |||
| gutter.reset(); | |||
| if (shouldBeShown) | |||
| addAndMakeVisible (gutter = new GutterComponent()); | |||
| { | |||
| gutter.reset (new GutterComponent()); | |||
| addAndMakeVisible (gutter.get()); | |||
| } | |||
| resized(); | |||
| } | |||
| @@ -438,7 +442,7 @@ void CodeEditorComponent::setReadOnly (bool b) noexcept | |||
| //============================================================================== | |||
| void CodeEditorComponent::resized() | |||
| { | |||
| const int visibleWidth = getWidth() - scrollbarThickness - getGutterSize(); | |||
| auto visibleWidth = getWidth() - scrollbarThickness - getGutterSize(); | |||
| linesOnScreen = jmax (1, (getHeight() - scrollbarThickness) / lineHeight); | |||
| columnsOnScreen = jmax (1, (int) (visibleWidth / charWidth)); | |||
| lines.clear(); | |||
| @@ -503,9 +507,8 @@ void CodeEditorComponent::rebuildLineTokens() | |||
| { | |||
| pimpl->cancelPendingUpdate(); | |||
| const int numNeeded = linesOnScreen + 1; | |||
| int minLineToRepaint = numNeeded; | |||
| auto numNeeded = linesOnScreen + 1; | |||
| auto minLineToRepaint = numNeeded; | |||
| int maxLineToRepaint = 0; | |||
| if (numNeeded != lines.size()) | |||
| @@ -73,7 +73,7 @@ public: | |||
| class ColourSelector::ColourSpaceView : public Component | |||
| { | |||
| public: | |||
| ColourSpaceView (ColourSelector& cs, float& hue, float& sat, float& val, const int edgeSize) | |||
| ColourSpaceView (ColourSelector& cs, float& hue, float& sat, float& val, int edgeSize) | |||
| : owner (cs), h (hue), s (sat), v (val), lastHue (0.0f), edge (edgeSize) | |||
| { | |||
| addAndMakeVisible (marker); | |||
| @@ -84,19 +84,19 @@ public: | |||
| { | |||
| if (colours.isNull()) | |||
| { | |||
| const int width = getWidth() / 2; | |||
| const int height = getHeight() / 2; | |||
| auto width = getWidth() / 2; | |||
| auto height = getHeight() / 2; | |||
| colours = Image (Image::RGB, width, height, false); | |||
| Image::BitmapData pixels (colours, Image::BitmapData::writeOnly); | |||
| for (int y = 0; y < height; ++y) | |||
| { | |||
| const float val = 1.0f - y / (float) height; | |||
| auto val = 1.0f - y / (float) height; | |||
| for (int x = 0; x < width; ++x) | |||
| { | |||
| const float sat = x / (float) width; | |||
| auto sat = x / (float) width; | |||
| pixels.setPixelColour (x, y, Colour (h, sat, val, 1.0f)); | |||
| } | |||
| } | |||
| @@ -117,8 +117,8 @@ public: | |||
| void mouseDrag (const MouseEvent& e) override | |||
| { | |||
| const float sat = (e.x - edge) / (float) (getWidth() - edge * 2); | |||
| const float val = 1.0f - (e.y - edge) / (float) (getHeight() - edge * 2); | |||
| auto sat = (e.x - edge) / (float) (getWidth() - edge * 2); | |||
| auto val = 1.0f - (e.y - edge) / (float) (getHeight() - edge * 2); | |||
| owner.setSV (sat, val); | |||
| } | |||
| @@ -172,8 +172,8 @@ public: | |||
| void paint (Graphics& g) override | |||
| { | |||
| const float cw = (float) getWidth(); | |||
| const float ch = (float) getHeight(); | |||
| auto cw = (float) getWidth(); | |||
| auto ch = (float) getHeight(); | |||
| Path p; | |||
| p.addTriangle (1.0f, 1.0f, | |||
| @@ -199,7 +199,7 @@ private: | |||
| class ColourSelector::HueSelectorComp : public Component | |||
| { | |||
| public: | |||
| HueSelectorComp (ColourSelector& cs, float& hue, const int edgeSize) | |||
| HueSelectorComp (ColourSelector& cs, float& hue, int edgeSize) | |||
| : owner (cs), h (hue), edge (edgeSize) | |||
| { | |||
| addAndMakeVisible (marker); | |||
| @@ -259,11 +259,11 @@ public: | |||
| void paint (Graphics& g) override | |||
| { | |||
| const Colour c (owner.getSwatchColour (index)); | |||
| auto col = owner.getSwatchColour (index); | |||
| g.fillCheckerBoard (getLocalBounds().toFloat(), 6.0f, 6.0f, | |||
| Colour (0xffdddddd).overlaidWith (c), | |||
| Colour (0xffffffff).overlaidWith (c)); | |||
| Colour (0xffdddddd).overlaidWith (col), | |||
| Colour (0xffffffff).overlaidWith (col)); | |||
| } | |||
| void mouseDown (const MouseEvent&) override | |||
| @@ -310,7 +310,7 @@ private: | |||
| }; | |||
| //============================================================================== | |||
| ColourSelector::ColourSelector (const int sectionsToShow, const int edge, const int gapAroundColourSpaceComponent) | |||
| ColourSelector::ColourSelector (int sectionsToShow, int edge, int gapAroundColourSpaceComponent) | |||
| : colour (Colours::white), | |||
| flags (sectionsToShow), | |||
| edgeGap (edge) | |||
| @@ -322,10 +322,15 @@ ColourSelector::ColourSelector (const int sectionsToShow, const int edge, const | |||
| if ((flags & showSliders) != 0) | |||
| { | |||
| addAndMakeVisible (sliders[0] = new ColourComponentSlider (TRANS ("red"))); | |||
| addAndMakeVisible (sliders[1] = new ColourComponentSlider (TRANS ("green"))); | |||
| addAndMakeVisible (sliders[2] = new ColourComponentSlider (TRANS ("blue"))); | |||
| addChildComponent (sliders[3] = new ColourComponentSlider (TRANS ("alpha"))); | |||
| sliders[0].reset (new ColourComponentSlider (TRANS ("red"))); | |||
| sliders[1].reset (new ColourComponentSlider (TRANS ("green"))); | |||
| sliders[2].reset (new ColourComponentSlider (TRANS ("blue"))); | |||
| sliders[3].reset (new ColourComponentSlider (TRANS ("alpha"))); | |||
| addAndMakeVisible (sliders[0].get()); | |||
| addAndMakeVisible (sliders[1].get()); | |||
| addAndMakeVisible (sliders[2].get()); | |||
| addChildComponent (sliders[3].get()); | |||
| sliders[3]->setVisible ((flags & showAlphaChannel) != 0); | |||
| @@ -335,8 +340,11 @@ ColourSelector::ColourSelector (const int sectionsToShow, const int edge, const | |||
| if ((flags & showColourspace) != 0) | |||
| { | |||
| addAndMakeVisible (colourSpace = new ColourSpaceView (*this, h, s, v, gapAroundColourSpaceComponent)); | |||
| addAndMakeVisible (hueSelector = new HueSelectorComp (*this, h, gapAroundColourSpaceComponent)); | |||
| colourSpace.reset (new ColourSpaceView (*this, h, s, v, gapAroundColourSpaceComponent)); | |||
| hueSelector.reset (new HueSelectorComp (*this, h, gapAroundColourSpaceComponent)); | |||
| addAndMakeVisible (colourSpace.get()); | |||
| addAndMakeVisible (hueSelector.get()); | |||
| } | |||
| update (dontSendNotification); | |||
| @@ -491,7 +499,7 @@ void ColourSelector::resized() | |||
| if ((flags & showSliders) != 0) | |||
| { | |||
| const int sliderHeight = jmax (4, sliderSpace / numSliders); | |||
| auto sliderHeight = jmax (4, sliderSpace / numSliders); | |||
| for (int i = 0; i < numSliders; ++i) | |||
| { | |||
| @@ -561,7 +569,7 @@ int ColourSelector::getNumSwatches() const | |||
| return 0; | |||
| } | |||
| Colour ColourSelector::getSwatchColour (const int) const | |||
| Colour ColourSelector::getSwatchColour (int) const | |||
| { | |||
| jassertfalse; // if you've overridden getNumSwatches(), you also need to implement this method | |||
| return Colours::black; | |||
| @@ -195,7 +195,7 @@ public: | |||
| void assignNewKey() | |||
| { | |||
| currentKeyEntryWindow = new KeyEntryWindow (owner); | |||
| currentKeyEntryWindow.reset (new KeyEntryWindow (owner)); | |||
| currentKeyEntryWindow->enterModalState (true, ModalCallbackFunction::forComponent (keyChosen, this)); | |||
| } | |||
| @@ -387,7 +387,7 @@ KeyMappingEditorComponent::KeyMappingEditorComponent (KeyPressMappingSet& mappin | |||
| : mappings (mappingManager), | |||
| resetButton (TRANS ("reset to defaults")) | |||
| { | |||
| treeItem = new TopLevelItem (*this); | |||
| treeItem.reset (new TopLevelItem (*this)); | |||
| if (showResetToDefaultButton) | |||
| { | |||
| @@ -122,7 +122,7 @@ void PreferencesPanel::setCurrentPage (const String& pageName) | |||
| currentPageName = pageName; | |||
| currentPage.reset(); | |||
| currentPage = createComponentForPage (pageName); | |||
| currentPage.reset (createComponentForPage (pageName)); | |||
| if (currentPage != nullptr) | |||
| { | |||
| @@ -137,7 +137,7 @@ private: | |||
| //============================================================================== | |||
| class Pimpl; | |||
| ScopedPointer<Pimpl> browser; | |||
| bool blankPageShown, unloadPageWhenBrowserIsHidden; | |||
| bool blankPageShown = false, unloadPageWhenBrowserIsHidden; | |||
| String lastURL; | |||
| StringArray lastHeaders; | |||
| MemoryBlock lastPostData; | |||
| @@ -138,14 +138,14 @@ private: | |||
| AndroidViewComponent::AndroidViewComponent() {} | |||
| AndroidViewComponent::~AndroidViewComponent() {} | |||
| void AndroidViewComponent::setView (void* const view) | |||
| void AndroidViewComponent::setView (void* view) | |||
| { | |||
| if (view != getView()) | |||
| { | |||
| pimpl = nullptr; | |||
| pimpl.reset(); | |||
| if (view != nullptr) | |||
| pimpl = new Pimpl ((jobject) view, *this); | |||
| pimpl.reset (new Pimpl ((jobject) view, *this)); | |||
| } | |||
| } | |||
| @@ -106,14 +106,14 @@ private: | |||
| UIViewComponent::UIViewComponent() {} | |||
| UIViewComponent::~UIViewComponent() {} | |||
| void UIViewComponent::setView (void* const view) | |||
| void UIViewComponent::setView (void* view) | |||
| { | |||
| if (view != getView()) | |||
| { | |||
| pimpl = nullptr; | |||
| pimpl.reset(); | |||
| if (view != nullptr) | |||
| pimpl = new Pimpl ((UIView*) view, *this); | |||
| pimpl.reset (new Pimpl ((UIView*) view, *this)); | |||
| } | |||
| } | |||
| @@ -98,14 +98,14 @@ private: | |||
| //============================================================================== | |||
| void SystemTrayIconComponent::setIconImage (const Image& newImage) | |||
| { | |||
| pimpl = nullptr; | |||
| pimpl.reset(); | |||
| if (newImage.isValid()) | |||
| { | |||
| if (! isOnDesktop()) | |||
| addToDesktop (0); | |||
| pimpl = new Pimpl (newImage, (Window) getWindowHandle()); | |||
| pimpl.reset (new Pimpl (newImage, (Window) getWindowHandle())); | |||
| setVisible (true); | |||
| toFront (false); | |||
| @@ -236,7 +236,7 @@ void SystemTrayIconComponent::setIconImage (const Image& newImage) | |||
| if (newImage.isValid()) | |||
| { | |||
| if (pimpl == nullptr) | |||
| pimpl = new Pimpl (*this, newImage); | |||
| pimpl.reset (new Pimpl (*this, newImage)); | |||
| else | |||
| pimpl->updateIcon (newImage); | |||
| } | |||
| @@ -356,13 +356,12 @@ private: | |||
| }; | |||
| //============================================================================== | |||
| WebBrowserComponent::WebBrowserComponent (const bool unloadWhenHidden) | |||
| : blankPageShown (false), | |||
| unloadPageWhenBrowserIsHidden (unloadWhenHidden) | |||
| WebBrowserComponent::WebBrowserComponent (bool unloadWhenHidden) | |||
| : unloadPageWhenBrowserIsHidden (unloadWhenHidden) | |||
| { | |||
| setOpaque (true); | |||
| addAndMakeVisible (browser = new Pimpl (this)); | |||
| browser.reset (new Pimpl (this)); | |||
| addAndMakeVisible (browser.get()); | |||
| } | |||
| WebBrowserComponent::~WebBrowserComponent() | |||
| @@ -203,13 +203,13 @@ void SystemTrayIconComponent::setIconImage (const Image& newImage) | |||
| HICON hicon = IconConverters::createHICONFromImage (newImage, TRUE, 0, 0); | |||
| if (pimpl == nullptr) | |||
| pimpl = new Pimpl (*this, hicon, (HWND) getWindowHandle()); | |||
| pimpl.reset (new Pimpl (*this, hicon, (HWND) getWindowHandle())); | |||
| else | |||
| pimpl->updateIcon (hicon); | |||
| } | |||
| else | |||
| { | |||
| pimpl = nullptr; | |||
| pimpl.reset(); | |||
| } | |||
| } | |||
| @@ -181,7 +181,7 @@ bool OpenGLFrameBuffer::initialise (OpenGLContext& context, int width, int heigh | |||
| jassert (context.isActive()); // The context must be active when creating a framebuffer! | |||
| pimpl.reset(); | |||
| pimpl = new Pimpl (context, width, height, false, false); | |||
| pimpl.reset (new Pimpl (context, width, height, false, false)); | |||
| if (! pimpl->createdOk()) | |||
| pimpl.reset(); | |||
| @@ -593,7 +593,7 @@ OSCReceiver::OSCReceiver() : pimpl (new Pimpl()) | |||
| OSCReceiver::~OSCReceiver() | |||
| { | |||
| pimpl = nullptr; | |||
| pimpl.reset(); | |||
| } | |||
| bool OSCReceiver::connect (int portNumber) | |||
| @@ -300,7 +300,7 @@ OSCSender::OSCSender() : pimpl (new Pimpl()) | |||
| OSCSender::~OSCSender() | |||
| { | |||
| pimpl->disconnect(); | |||
| pimpl = nullptr; | |||
| pimpl.reset(); | |||
| } | |||
| //============================================================================== | |||
| @@ -44,7 +44,7 @@ CameraDevice::CameraDevice (const String& nm, int index, int minWidth, int minHe | |||
| CameraDevice::~CameraDevice() | |||
| { | |||
| stopRecording(); | |||
| pimpl = nullptr; | |||
| pimpl.reset(); | |||
| } | |||
| Component* CameraDevice::createViewerComponent() | |||