| @@ -341,8 +341,8 @@ private: | |||
| SLDataFormat_PCM pcmFormat = | |||
| { | |||
| SL_DATAFORMAT_PCM, | |||
| numChannels, | |||
| sampleRate * 1000, // (sample rate units are millihertz) | |||
| (SLuint32) numChannels, | |||
| (SLuint32) (sampleRate * 1000), // (sample rate units are millihertz) | |||
| SL_PCMSAMPLEFORMAT_FIXED_16, | |||
| SL_PCMSAMPLEFORMAT_FIXED_16, | |||
| SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT, | |||
| @@ -450,8 +450,8 @@ private: | |||
| SLDataFormat_PCM pcmFormat = | |||
| { | |||
| SL_DATAFORMAT_PCM, | |||
| numChannels, | |||
| sampleRate * 1000, // (sample rate units are millihertz) | |||
| (SLuint32) numChannels, | |||
| (SLuint32) (sampleRate * 1000), // (sample rate units are millihertz) | |||
| SL_PCMSAMPLEFORMAT_FIXED_16, | |||
| SL_PCMSAMPLEFORMAT_FIXED_16, | |||
| (numChannels == 1) ? SL_SPEAKER_FRONT_CENTER : (SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT), | |||
| @@ -536,9 +536,9 @@ private: | |||
| return AudioSessionGetProperty (propID, &valueSize, &result); | |||
| } | |||
| static bool setSessionUInt32Property (AudioSessionPropertyID propID, UInt32 v) noexcept { AudioSessionSetProperty (propID, sizeof (v), &v) == kAudioSessionNoError; } | |||
| static bool setSessionFloat32Property (AudioSessionPropertyID propID, Float32 v) noexcept { AudioSessionSetProperty (propID, sizeof (v), &v) == kAudioSessionNoError; } | |||
| static bool setSessionFloat64Property (AudioSessionPropertyID propID, Float64 v) noexcept { AudioSessionSetProperty (propID, sizeof (v), &v) == kAudioSessionNoError; } | |||
| static bool setSessionUInt32Property (AudioSessionPropertyID propID, UInt32 v) noexcept { return AudioSessionSetProperty (propID, sizeof (v), &v) == kAudioSessionNoError; } | |||
| static bool setSessionFloat32Property (AudioSessionPropertyID propID, Float32 v) noexcept { return AudioSessionSetProperty (propID, sizeof (v), &v) == kAudioSessionNoError; } | |||
| static bool setSessionFloat64Property (AudioSessionPropertyID propID, Float64 v) noexcept { return AudioSessionSetProperty (propID, sizeof (v), &v) == kAudioSessionNoError; } | |||
| JUCE_DECLARE_NON_COPYABLE (iOSAudioIODevice) | |||
| }; | |||
| @@ -33,8 +33,8 @@ namespace WasapiClasses | |||
| void logFailure (HRESULT hr) | |||
| { | |||
| (void) hr; | |||
| jassert (hr != 0x800401f0); // If you hit this, it means you're trying to call from | |||
| // a thread which hasn't been initialised with CoInitialize(). | |||
| jassert (hr != (HRESULT) 0x800401f0); // If you hit this, it means you're trying to call from | |||
| // a thread which hasn't been initialised with CoInitialize(). | |||
| #if JUCE_WASAPI_LOGGING | |||
| if (FAILED (hr)) | |||
| @@ -37,7 +37,7 @@ const char* const AiffAudioFormat::appleKey = "apple key"; | |||
| //============================================================================== | |||
| namespace AiffFileHelpers | |||
| { | |||
| inline int chunkName (const char* const name) { return (int) ByteOrder::littleEndianInt (name); } | |||
| inline int chunkName (const char* name) noexcept { return (int) ByteOrder::littleEndianInt (name); } | |||
| #if JUCE_MSVC | |||
| #pragma pack (push, 1) | |||
| @@ -165,13 +165,13 @@ bool LAMEEncoderAudioFormat::canHandleFile (const File&) | |||
| Array<int> LAMEEncoderAudioFormat::getPossibleSampleRates() | |||
| { | |||
| const int rates[] = { 32000, 44100, 48000, 0 }; | |||
| return Array <int> (rates); | |||
| return Array<int> (rates); | |||
| } | |||
| Array<int> LAMEEncoderAudioFormat::getPossibleBitDepths() | |||
| { | |||
| const int depths[] = { 16, 0 }; | |||
| return Array <int> (depths); | |||
| return Array<int> (depths); | |||
| } | |||
| bool LAMEEncoderAudioFormat::canDoStereo() { return true; } | |||
| @@ -62,7 +62,7 @@ namespace AudioUnitFormatHelpers | |||
| static ThreadLocalValue<int> insideCallback; | |||
| #endif | |||
| String osTypeToString (OSType type) | |||
| String osTypeToString (OSType type) noexcept | |||
| { | |||
| const juce_wchar s[4] = { (juce_wchar) ((type >> 24) & 0xff), | |||
| (juce_wchar) ((type >> 16) & 0xff), | |||
| @@ -88,9 +88,6 @@ namespace AudioUnitFormatHelpers | |||
| String createPluginIdentifier (const AudioComponentDescription& desc) | |||
| { | |||
| jassert (osTypeToString ('abcd') == "abcd"); // agh, must have got the endianness wrong.. | |||
| jassert (stringToOSType ("abcd") == (OSType) 'abcd'); // ditto | |||
| String s (auIdentifierPrefix); | |||
| if (desc.componentType == kAudioUnitType_MusicDevice) | |||
| @@ -215,9 +212,11 @@ namespace AudioUnitFormatHelpers | |||
| const short resFileId = CFBundleOpenBundleResourceMap (bundleRef); | |||
| UseResFile (resFileId); | |||
| for (ResourceIndex i = 1; i <= Count1Resources ('thng'); ++i) | |||
| const OSType thngType = stringToOSType ("thng"); | |||
| for (ResourceIndex i = 1; i <= Count1Resources (thngType); ++i) | |||
| { | |||
| if (Handle h = Get1IndResource ('thng', i)) | |||
| if (Handle h = Get1IndResource (thngType, i)) | |||
| { | |||
| HLock (h); | |||
| const uint32* const types = (const uint32*) *h; | |||
| @@ -428,16 +428,11 @@ public: | |||
| if (hasFlag (flags, Vst::kIoChanged)) | |||
| { | |||
| double sampleRate = owner->getSampleRate(); | |||
| int numSamples = owner->getBlockSize(); | |||
| const double sampleRate = owner->getSampleRate(); | |||
| const int blockSize = owner->getBlockSize(); | |||
| if (sampleRate <= 8000.0) | |||
| sampleRate = 44100.0; | |||
| if (numSamples <= 0) | |||
| numSamples = 1024; | |||
| owner->prepareToPlay (owner->getSampleRate(), owner->getBlockSize()); | |||
| owner->prepareToPlay (sampleRate >= 8000 ? sampleRate : 44100.0, | |||
| blockSize > 0 ? blockSize : 1024); | |||
| } | |||
| if (hasFlag (flags, Vst::kLatencyChanged)) | |||
| @@ -1451,7 +1446,7 @@ public: | |||
| warnOnFailure (view->removed()); | |||
| warnOnFailure (view->setFrame (nullptr)); | |||
| getAudioProcessor()->editorBeingDeleted (this); | |||
| processor.editorBeingDeleted (this); | |||
| #if JUCE_MAC | |||
| dummyComponent.setView (nullptr); | |||
| @@ -29,13 +29,6 @@ | |||
| #include "../../juce_gui_extra/native/juce_mac_CarbonViewWrapperComponent.h" | |||
| #endif | |||
| #if JUCE_MAC | |||
| static bool makeFSRefFromPath (FSRef* destFSRef, const String& path) | |||
| { | |||
| return FSPathMakeRef (reinterpret_cast<const UInt8*> (path.toRawUTF8()), destFSRef, 0) == noErr; | |||
| } | |||
| #endif | |||
| //============================================================================== | |||
| #undef PRAGMA_ALIGN_SUPPORTED | |||
| #define VST_FORCE_DEPRECATED 0 | |||
| @@ -84,74 +77,68 @@ | |||
| #endif | |||
| //============================================================================== | |||
| const int fxbVersionNum = 1; | |||
| struct fxProgram | |||
| namespace | |||
| { | |||
| VstInt32 chunkMagic; // 'CcnK' | |||
| VstInt32 byteSize; // of this chunk, excl. magic + byteSize | |||
| VstInt32 fxMagic; // 'FxCk' | |||
| VstInt32 version; | |||
| VstInt32 fxID; // fx unique id | |||
| VstInt32 fxVersion; | |||
| VstInt32 numParams; | |||
| char prgName[28]; | |||
| float params[1]; // variable no. of parameters | |||
| }; | |||
| const int fxbVersionNum = 1; | |||
| struct fxProgram | |||
| { | |||
| VstInt32 chunkMagic; // 'CcnK' | |||
| VstInt32 byteSize; // of this chunk, excl. magic + byteSize | |||
| VstInt32 fxMagic; // 'FxCk' | |||
| VstInt32 version; | |||
| VstInt32 fxID; // fx unique id | |||
| VstInt32 fxVersion; | |||
| VstInt32 numParams; | |||
| char prgName[28]; | |||
| float params[1]; // variable no. of parameters | |||
| }; | |||
| struct fxSet | |||
| { | |||
| VstInt32 chunkMagic; // 'CcnK' | |||
| VstInt32 byteSize; // of this chunk, excl. magic + byteSize | |||
| VstInt32 fxMagic; // 'FxBk' | |||
| VstInt32 version; | |||
| VstInt32 fxID; // fx unique id | |||
| VstInt32 fxVersion; | |||
| VstInt32 numPrograms; | |||
| char future[128]; | |||
| fxProgram programs[1]; // variable no. of programs | |||
| }; | |||
| struct fxSet | |||
| { | |||
| VstInt32 chunkMagic; // 'CcnK' | |||
| VstInt32 byteSize; // of this chunk, excl. magic + byteSize | |||
| VstInt32 fxMagic; // 'FxBk' | |||
| VstInt32 version; | |||
| VstInt32 fxID; // fx unique id | |||
| VstInt32 fxVersion; | |||
| VstInt32 numPrograms; | |||
| char future[128]; | |||
| fxProgram programs[1]; // variable no. of programs | |||
| }; | |||
| struct fxChunkSet | |||
| { | |||
| VstInt32 chunkMagic; // 'CcnK' | |||
| VstInt32 byteSize; // of this chunk, excl. magic + byteSize | |||
| VstInt32 fxMagic; // 'FxCh', 'FPCh', or 'FBCh' | |||
| VstInt32 version; | |||
| VstInt32 fxID; // fx unique id | |||
| VstInt32 fxVersion; | |||
| VstInt32 numPrograms; | |||
| char future[128]; | |||
| VstInt32 chunkSize; | |||
| char chunk[8]; // variable | |||
| }; | |||
| struct fxChunkSet | |||
| { | |||
| VstInt32 chunkMagic; // 'CcnK' | |||
| VstInt32 byteSize; // of this chunk, excl. magic + byteSize | |||
| VstInt32 fxMagic; // 'FxCh', 'FPCh', or 'FBCh' | |||
| VstInt32 version; | |||
| VstInt32 fxID; // fx unique id | |||
| VstInt32 fxVersion; | |||
| VstInt32 numPrograms; | |||
| char future[128]; | |||
| VstInt32 chunkSize; | |||
| char chunk[8]; // variable | |||
| }; | |||
| struct fxProgramSet | |||
| { | |||
| VstInt32 chunkMagic; // 'CcnK' | |||
| VstInt32 byteSize; // of this chunk, excl. magic + byteSize | |||
| VstInt32 fxMagic; // 'FxCh', 'FPCh', or 'FBCh' | |||
| VstInt32 version; | |||
| VstInt32 fxID; // fx unique id | |||
| VstInt32 fxVersion; | |||
| VstInt32 numPrograms; | |||
| char name[28]; | |||
| VstInt32 chunkSize; | |||
| char chunk[8]; // variable | |||
| }; | |||
| struct fxProgramSet | |||
| { | |||
| VstInt32 chunkMagic; // 'CcnK' | |||
| VstInt32 byteSize; // of this chunk, excl. magic + byteSize | |||
| VstInt32 fxMagic; // 'FxCh', 'FPCh', or 'FBCh' | |||
| VstInt32 version; | |||
| VstInt32 fxID; // fx unique id | |||
| VstInt32 fxVersion; | |||
| VstInt32 numPrograms; | |||
| char name[28]; | |||
| VstInt32 chunkSize; | |||
| char chunk[8]; // variable | |||
| }; | |||
| namespace | |||
| { | |||
| VstInt32 vst_swap (const VstInt32 x) noexcept | |||
| { | |||
| #ifdef JUCE_LITTLE_ENDIAN | |||
| return (VstInt32) ByteOrder::swap ((uint32) x); | |||
| #else | |||
| return x; | |||
| #endif | |||
| } | |||
| static VstInt32 fxbName (const char* name) noexcept { return (VstInt32) ByteOrder::bigEndianInt (name); } | |||
| static VstInt32 fxbSwap (const VstInt32 x) noexcept { return (VstInt32) ByteOrder::swapIfLittleEndian ((uint32) x); } | |||
| float vst_swapFloat (const float x) noexcept | |||
| static float fxbSwapFloat (const float x) noexcept | |||
| { | |||
| #ifdef JUCE_LITTLE_ENDIAN | |||
| union { uint32 asInt; float asFloat; } n; | |||
| @@ -162,8 +149,12 @@ namespace | |||
| return x; | |||
| #endif | |||
| } | |||
| } | |||
| double getVSTHostTimeNanoseconds() | |||
| //============================================================================== | |||
| namespace | |||
| { | |||
| static double getVSTHostTimeNanoseconds() noexcept | |||
| { | |||
| #if JUCE_WINDOWS | |||
| return timeGetTime() * 1000000.0; | |||
| @@ -177,39 +168,51 @@ namespace | |||
| return micro.lo * 1000.0; | |||
| #endif | |||
| } | |||
| } | |||
| //============================================================================== | |||
| typedef AEffect* (VSTCALLBACK *MainCall) (audioMasterCallback); | |||
| static int shellUIDToCreate = 0; | |||
| static int insideVSTCallback = 0; | |||
| static VstIntPtr VSTCALLBACK audioMaster (AEffect* effect, VstInt32 opcode, VstInt32 index, VstIntPtr value, void* ptr, float opt); | |||
| struct IdleCallRecursionPreventer | |||
| { | |||
| IdleCallRecursionPreventer() : isMessageThread (MessageManager::getInstance()->isThisTheMessageThread()) | |||
| { | |||
| if (isMessageThread) | |||
| ++insideVSTCallback; | |||
| } | |||
| static int shellUIDToCreate = 0; | |||
| static int insideVSTCallback = 0; | |||
| ~IdleCallRecursionPreventer() | |||
| { | |||
| if (isMessageThread) | |||
| --insideVSTCallback; | |||
| } | |||
| class IdleCallRecursionPreventer | |||
| { | |||
| public: | |||
| IdleCallRecursionPreventer() | |||
| : isMessageThread (MessageManager::getInstance()->isThisTheMessageThread()) | |||
| const bool isMessageThread; | |||
| JUCE_DECLARE_NON_COPYABLE (IdleCallRecursionPreventer) | |||
| }; | |||
| #if JUCE_MAC | |||
| static bool makeFSRefFromPath (FSRef* destFSRef, const String& path) | |||
| { | |||
| if (isMessageThread) | |||
| ++insideVSTCallback; | |||
| return FSPathMakeRef (reinterpret_cast<const UInt8*> (path.toRawUTF8()), destFSRef, 0) == noErr; | |||
| } | |||
| #endif | |||
| ~IdleCallRecursionPreventer() | |||
| #if JUCE_MAC && JUCE_PPC | |||
| static void* newCFMFromMachO (void* const machofp) noexcept | |||
| { | |||
| if (isMessageThread) | |||
| --insideVSTCallback; | |||
| } | |||
| void* result = (void*) new char[8]; | |||
| private: | |||
| const bool isMessageThread; | |||
| ((void**) result)[0] = machofp; | |||
| ((void**) result)[1] = result; | |||
| JUCE_DECLARE_NON_COPYABLE (IdleCallRecursionPreventer) | |||
| }; | |||
| return result; | |||
| } | |||
| #endif | |||
| } | |||
| class VSTPluginWindow; | |||
| //============================================================================== | |||
| typedef AEffect* (VSTCALLBACK *MainCall) (audioMasterCallback); | |||
| static VstIntPtr VSTCALLBACK audioMaster (AEffect* effect, VstInt32 opcode, VstInt32 index, VstIntPtr value, void* ptr, float opt); | |||
| //============================================================================== | |||
| // Change this to disable logging of various VST activities | |||
| @@ -223,27 +226,12 @@ class VSTPluginWindow; | |||
| #define JUCE_VST_LOG(a) | |||
| #endif | |||
| //============================================================================== | |||
| #if JUCE_MAC && JUCE_PPC | |||
| static void* NewCFMFromMachO (void* const machofp) noexcept | |||
| { | |||
| void* result = (void*) new char[8]; | |||
| ((void**) result)[0] = machofp; | |||
| ((void**) result)[1] = result; | |||
| return result; | |||
| } | |||
| #endif | |||
| //============================================================================== | |||
| #if JUCE_LINUX | |||
| extern Display* display; | |||
| extern XContext windowHandleXContext; | |||
| typedef void (*EventProcPtr) (XEvent* ev); | |||
| namespace | |||
| { | |||
| static bool xErrorTriggered = false; | |||
| @@ -254,6 +242,8 @@ namespace | |||
| return 0; | |||
| } | |||
| typedef void (*EventProcPtr) (XEvent* ev); | |||
| static EventProcPtr getPropertyFromXWindow (Window handle, Atom atom) | |||
| { | |||
| XErrorHandler oldErrorHandler = XSetErrorHandler (temporaryErrorHandler); | |||
| @@ -269,8 +259,7 @@ namespace | |||
| XSetErrorHandler (oldErrorHandler); | |||
| return (userCount == 1 && ! xErrorTriggered) ? *reinterpret_cast<EventProcPtr*> (data) | |||
| : 0; | |||
| return (userCount == 1 && ! xErrorTriggered) ? *reinterpret_cast<EventProcPtr*> (data) : nullptr; | |||
| } | |||
| Window getChildWindow (Window windowToCheck) | |||
| @@ -279,12 +268,7 @@ namespace | |||
| Window* childWindows; | |||
| unsigned int numChildren = 0; | |||
| XQueryTree (display, | |||
| windowToCheck, | |||
| &rootWindow, | |||
| &parentWindow, | |||
| &childWindows, | |||
| &numChildren); | |||
| XQueryTree (display, windowToCheck, &rootWindow, &parentWindow, &childWindows, &numChildren); | |||
| if (numChildren > 0) | |||
| return childWindows [0]; | |||
| @@ -354,9 +338,9 @@ public: | |||
| typedef ReferenceCountedObjectPtr<ModuleHandle> Ptr; | |||
| static Array <ModuleHandle*>& getActiveModules() | |||
| static Array<ModuleHandle*>& getActiveModules() | |||
| { | |||
| static Array <ModuleHandle*> activeModules; | |||
| static Array<ModuleHandle*> activeModules; | |||
| return activeModules; | |||
| } | |||
| @@ -470,7 +454,7 @@ public: | |||
| { | |||
| if (HGLOBAL hGlob = LoadResource (dllModule, res)) | |||
| { | |||
| const char* data = static_cast <const char*> (LockResource (hGlob)); | |||
| const char* data = static_cast<const char*> (LockResource (hGlob)); | |||
| return String::fromUTF8 (data, SizeofResource (dllModule, res)); | |||
| } | |||
| } | |||
| @@ -552,7 +536,7 @@ public: | |||
| } | |||
| } | |||
| } | |||
| #if JUCE_PPC | |||
| #if JUCE_PPC | |||
| else | |||
| { | |||
| FSRef fn; | |||
| @@ -605,7 +589,7 @@ public: | |||
| } | |||
| } | |||
| } | |||
| #endif | |||
| #endif | |||
| return ok; | |||
| } | |||
| @@ -683,7 +667,7 @@ public: | |||
| static void disposeMachOFromCFM (void* ptr) | |||
| { | |||
| delete[] static_cast <UInt32*> (ptr); | |||
| delete[] static_cast<UInt32*> (ptr); | |||
| } | |||
| void coerceAEffectFunctionCalls (AEffect* eff) | |||
| @@ -715,11 +699,11 @@ class VSTPluginInstance : public AudioPluginInstance, | |||
| private AsyncUpdater | |||
| { | |||
| public: | |||
| VSTPluginInstance (const ModuleHandle::Ptr& module_) | |||
| VSTPluginInstance (const ModuleHandle::Ptr& mh) | |||
| : effect (nullptr), | |||
| module (module_), | |||
| module (mh), | |||
| usesCocoaNSView (false), | |||
| name (module_->pluginName), | |||
| name (mh->pluginName), | |||
| wantsMidiMessages (false), | |||
| initialised (false), | |||
| isPowerOn (false), | |||
| @@ -741,7 +725,7 @@ public: | |||
| { | |||
| static void* audioMasterCoerced = nullptr; | |||
| if (audioMasterCoerced == nullptr) | |||
| audioMasterCoerced = NewCFMFromMachO ((void*) &audioMaster); | |||
| audioMasterCoerced = newCFMFromMachO ((void*) &audioMaster); | |||
| effect = module->moduleMain ((audioMasterCallback) audioMasterCoerced); | |||
| } | |||
| @@ -803,7 +787,7 @@ public: | |||
| char buffer [512] = { 0 }; | |||
| dispatch (effGetEffectName, 0, 0, buffer, 0); | |||
| desc.descriptiveName = String (buffer).trim(); | |||
| desc.descriptiveName = String::fromUTF8 (buffer).trim(); | |||
| if (desc.descriptiveName.isEmpty()) | |||
| desc.descriptiveName = name; | |||
| @@ -818,7 +802,7 @@ public: | |||
| { | |||
| char buffer [kVstMaxVendorStrLen + 8] = { 0 }; | |||
| dispatch (effGetVendorString, 0, 0, buffer, 0); | |||
| desc.manufacturerName = buffer; | |||
| desc.manufacturerName = String::fromUTF8 (buffer); | |||
| } | |||
| desc.version = getVersion(); | |||
| @@ -1146,8 +1130,7 @@ public: | |||
| bool isValidChannel (int index, bool isInput) const | |||
| { | |||
| return isInput ? (index < getNumInputChannels()) | |||
| : (index < getNumOutputChannels()); | |||
| return isPositiveAndBelow (index, isInput ? getNumInputChannels() : getNumOutputChannels()); | |||
| } | |||
| //============================================================================== | |||
| @@ -1214,7 +1197,7 @@ public: | |||
| char nm[264] = { 0 }; | |||
| if (dispatch (effGetProgramNameIndexed, jlimit (0, getNumPrograms(), index), -1, nm, 0) != 0) | |||
| return String (CharPointer_UTF8 (nm)).trim(); | |||
| return String::fromUTF8 (nm).trim(); | |||
| } | |||
| } | |||
| @@ -1449,20 +1432,20 @@ public: | |||
| const fxSet* const set = (const fxSet*) data; | |||
| if ((vst_swap (set->chunkMagic) != 'CcnK' && vst_swap (set->chunkMagic) != 'KncC') | |||
| || vst_swap (set->version) > fxbVersionNum) | |||
| if ((set->chunkMagic != fxbName ("CcnK") && set->chunkMagic != fxbName ("KncC")) | |||
| || fxbSwap (set->version) > fxbVersionNum) | |||
| return false; | |||
| if (vst_swap (set->fxMagic) == 'FxBk') | |||
| if (set->fxMagic == fxbName ("FxBk")) | |||
| { | |||
| // bank of programs | |||
| if (vst_swap (set->numPrograms) >= 0) | |||
| if (fxbSwap (set->numPrograms) >= 0) | |||
| { | |||
| const int oldProg = getCurrentProgram(); | |||
| const int numParams = vst_swap (((const fxProgram*) (set->programs))->numParams); | |||
| const int numParams = fxbSwap (((const fxProgram*) (set->programs))->numParams); | |||
| const int progLen = sizeof (fxProgram) + (numParams - 1) * sizeof (float); | |||
| for (int i = 0; i < vst_swap (set->numPrograms); ++i) | |||
| for (int i = 0; i < fxbSwap (set->numPrograms); ++i) | |||
| { | |||
| if (i != oldProg) | |||
| { | |||
| @@ -1470,7 +1453,7 @@ public: | |||
| if (((const char*) prog) - ((const char*) set) >= (ssize_t) dataSize) | |||
| return false; | |||
| if (vst_swap (set->numPrograms) > 0) | |||
| if (fxbSwap (set->numPrograms) > 0) | |||
| setCurrentProgram (i); | |||
| if (! restoreProgramSettings (prog)) | |||
| @@ -1478,7 +1461,7 @@ public: | |||
| } | |||
| } | |||
| if (vst_swap (set->numPrograms) > 0) | |||
| if (fxbSwap (set->numPrograms) > 0) | |||
| setCurrentProgram (oldProg); | |||
| const fxProgram* const prog = (const fxProgram*) (((const char*) (set->programs)) + oldProg * progLen); | |||
| @@ -1489,38 +1472,38 @@ public: | |||
| return false; | |||
| } | |||
| } | |||
| else if (vst_swap (set->fxMagic) == 'FxCk') | |||
| else if (set->fxMagic == fxbName ("FxCk")) | |||
| { | |||
| // single program | |||
| const fxProgram* const prog = (const fxProgram*) data; | |||
| if (vst_swap (prog->chunkMagic) != 'CcnK') | |||
| if (prog->chunkMagic != fxbName ("CcnK")) | |||
| return false; | |||
| changeProgramName (getCurrentProgram(), prog->prgName); | |||
| for (int i = 0; i < vst_swap (prog->numParams); ++i) | |||
| setParameter (i, vst_swapFloat (prog->params[i])); | |||
| for (int i = 0; i < fxbSwap (prog->numParams); ++i) | |||
| setParameter (i, fxbSwapFloat (prog->params[i])); | |||
| } | |||
| else if (vst_swap (set->fxMagic) == 'FBCh' || vst_swap (set->fxMagic) == 'hCBF') | |||
| else if (set->fxMagic == fxbName ("FBCh") || set->fxMagic == fxbName ("hCBF")) | |||
| { | |||
| // non-preset chunk | |||
| const fxChunkSet* const cset = (const fxChunkSet*) data; | |||
| if (vst_swap (cset->chunkSize) + sizeof (fxChunkSet) - 8 > (unsigned int) dataSize) | |||
| if (fxbSwap (cset->chunkSize) + sizeof (fxChunkSet) - 8 > (unsigned int) dataSize) | |||
| return false; | |||
| setChunkData (cset->chunk, vst_swap (cset->chunkSize), false); | |||
| setChunkData (cset->chunk, fxbSwap (cset->chunkSize), false); | |||
| } | |||
| else if (vst_swap (set->fxMagic) == 'FPCh' || vst_swap (set->fxMagic) == 'hCPF') | |||
| else if (set->fxMagic == fxbName ("FPCh") || set->fxMagic == fxbName ("hCPF")) | |||
| { | |||
| // preset chunk | |||
| const fxProgramSet* const cset = (const fxProgramSet*) data; | |||
| if (vst_swap (cset->chunkSize) + sizeof (fxProgramSet) - 8 > (unsigned int) dataSize) | |||
| if (fxbSwap (cset->chunkSize) + sizeof (fxProgramSet) - 8 > (unsigned int) dataSize) | |||
| return false; | |||
| setChunkData (cset->chunk, vst_swap (cset->chunkSize), true); | |||
| setChunkData (cset->chunk, fxbSwap (cset->chunkSize), true); | |||
| changeProgramName (getCurrentProgram(), cset->name); | |||
| } | |||
| @@ -1548,14 +1531,14 @@ public: | |||
| dest.setSize (totalLen, true); | |||
| fxChunkSet* const set = (fxChunkSet*) dest.getData(); | |||
| set->chunkMagic = vst_swap ('CcnK'); | |||
| set->chunkMagic = fxbName ("CcnK"); | |||
| set->byteSize = 0; | |||
| set->fxMagic = vst_swap ('FBCh'); | |||
| set->version = vst_swap (fxbVersionNum); | |||
| set->fxID = vst_swap (getUID()); | |||
| set->fxVersion = vst_swap (getVersionNumber()); | |||
| set->numPrograms = vst_swap (numPrograms); | |||
| set->chunkSize = vst_swap ((VstInt32) chunk.getSize()); | |||
| set->fxMagic = fxbName ("FBCh"); | |||
| set->version = fxbSwap (fxbVersionNum); | |||
| set->fxID = fxbSwap (getUID()); | |||
| set->fxVersion = fxbSwap (getVersionNumber()); | |||
| set->numPrograms = fxbSwap (numPrograms); | |||
| set->chunkSize = fxbSwap ((VstInt32) chunk.getSize()); | |||
| chunk.copyTo (set->chunk, 0, chunk.getSize()); | |||
| } | |||
| @@ -1565,14 +1548,14 @@ public: | |||
| dest.setSize (totalLen, true); | |||
| fxProgramSet* const set = (fxProgramSet*) dest.getData(); | |||
| set->chunkMagic = vst_swap ('CcnK'); | |||
| set->chunkMagic = fxbName ("CcnK"); | |||
| set->byteSize = 0; | |||
| set->fxMagic = vst_swap ('FPCh'); | |||
| set->version = vst_swap (fxbVersionNum); | |||
| set->fxID = vst_swap (getUID()); | |||
| set->fxVersion = vst_swap (getVersionNumber()); | |||
| set->numPrograms = vst_swap (numPrograms); | |||
| set->chunkSize = vst_swap ((VstInt32) chunk.getSize()); | |||
| set->fxMagic = fxbName ("FPCh"); | |||
| set->version = fxbSwap (fxbVersionNum); | |||
| set->fxID = fxbSwap (getUID()); | |||
| set->fxVersion = fxbSwap (getVersionNumber()); | |||
| set->numPrograms = fxbSwap (numPrograms); | |||
| set->chunkSize = fxbSwap ((VstInt32) chunk.getSize()); | |||
| getCurrentProgramName().copyToUTF8 (set->name, sizeof (set->name) - 1); | |||
| chunk.copyTo (set->chunk, 0, chunk.getSize()); | |||
| @@ -1587,13 +1570,13 @@ public: | |||
| dest.setSize (len, true); | |||
| fxSet* const set = (fxSet*) dest.getData(); | |||
| set->chunkMagic = vst_swap ('CcnK'); | |||
| set->chunkMagic = fxbName ("CcnK"); | |||
| set->byteSize = 0; | |||
| set->fxMagic = vst_swap ('FxBk'); | |||
| set->version = vst_swap (fxbVersionNum); | |||
| set->fxID = vst_swap (getUID()); | |||
| set->fxVersion = vst_swap (getVersionNumber()); | |||
| set->numPrograms = vst_swap (numPrograms); | |||
| set->fxMagic = fxbName ("FxBk"); | |||
| set->version = fxbSwap (fxbVersionNum); | |||
| set->fxID = fxbSwap (getUID()); | |||
| set->fxVersion = fxbSwap (getVersionNumber()); | |||
| set->numPrograms = fxbSwap (numPrograms); | |||
| const int oldProgram = getCurrentProgram(); | |||
| MemoryBlock oldSettings; | |||
| @@ -1688,12 +1671,12 @@ private: | |||
| bool restoreProgramSettings (const fxProgram* const prog) | |||
| { | |||
| if (vst_swap (prog->chunkMagic) == 'CcnK' && vst_swap (prog->fxMagic) == 'FxCk') | |||
| if (prog->chunkMagic == fxbName ("CcnK") && prog->fxMagic == fxbName ("FxCk")) | |||
| { | |||
| changeProgramName (getCurrentProgram(), prog->prgName); | |||
| for (int i = 0; i < vst_swap (prog->numParams); ++i) | |||
| setParameter (i, vst_swapFloat (prog->params[i])); | |||
| for (int i = 0; i < fxbSwap (prog->numParams); ++i) | |||
| setParameter (i, fxbSwapFloat (prog->params[i])); | |||
| return true; | |||
| } | |||
| @@ -1742,18 +1725,18 @@ private: | |||
| { | |||
| const int numParams = getNumParameters(); | |||
| prog->chunkMagic = vst_swap ('CcnK'); | |||
| prog->chunkMagic = fxbName ("CcnK"); | |||
| prog->byteSize = 0; | |||
| prog->fxMagic = vst_swap ('FxCk'); | |||
| prog->version = vst_swap (fxbVersionNum); | |||
| prog->fxID = vst_swap (getUID()); | |||
| prog->fxVersion = vst_swap (getVersionNumber()); | |||
| prog->numParams = vst_swap (numParams); | |||
| prog->fxMagic = fxbName ("FxCk"); | |||
| prog->version = fxbSwap (fxbVersionNum); | |||
| prog->fxID = fxbSwap (getUID()); | |||
| prog->fxVersion = fxbSwap (getVersionNumber()); | |||
| prog->numParams = fxbSwap (numParams); | |||
| getCurrentProgramName().copyToUTF8 (prog->prgName, sizeof (prog->prgName) - 1); | |||
| for (int i = 0; i < numParams; ++i) | |||
| prog->params[i] = vst_swapFloat (getParameter (i)); | |||
| prog->params[i] = fxbSwapFloat (getParameter (i)); | |||
| } | |||
| void updateStoredProgramNames() | |||
| @@ -1895,7 +1878,8 @@ private: | |||
| }; | |||
| //============================================================================== | |||
| static Array <VSTPluginWindow*> activeVSTWindows; | |||
| class VSTPluginWindow; | |||
| static Array<VSTPluginWindow*> activeVSTWindows; | |||
| //============================================================================== | |||
| class VSTPluginWindow : public AudioProcessorEditor, | |||
| @@ -2845,7 +2829,7 @@ FileSearchPath VSTPluginFormat::getDefaultLocationsToSearch() | |||
| const XmlElement* VSTPluginFormat::getVSTXML (AudioPluginInstance* plugin) | |||
| { | |||
| if (VSTPluginInstance* const vst = dynamic_cast <VSTPluginInstance*> (plugin)) | |||
| if (VSTPluginInstance* const vst = dynamic_cast<VSTPluginInstance*> (plugin)) | |||
| if (vst->module != nullptr) | |||
| return vst->module->vstXml.get(); | |||
| @@ -2854,7 +2838,7 @@ const XmlElement* VSTPluginFormat::getVSTXML (AudioPluginInstance* plugin) | |||
| bool VSTPluginFormat::loadFromFXBFile (AudioPluginInstance* plugin, const void* data, size_t dataSize) | |||
| { | |||
| if (VSTPluginInstance* vst = dynamic_cast <VSTPluginInstance*> (plugin)) | |||
| if (VSTPluginInstance* vst = dynamic_cast<VSTPluginInstance*> (plugin)) | |||
| return vst->loadFromFXBFile (data, dataSize); | |||
| return false; | |||
| @@ -2862,7 +2846,7 @@ bool VSTPluginFormat::loadFromFXBFile (AudioPluginInstance* plugin, const void* | |||
| bool VSTPluginFormat::saveToFXBFile (AudioPluginInstance* plugin, MemoryBlock& dest, bool asFXB) | |||
| { | |||
| if (VSTPluginInstance* vst = dynamic_cast <VSTPluginInstance*> (plugin)) | |||
| if (VSTPluginInstance* vst = dynamic_cast<VSTPluginInstance*> (plugin)) | |||
| return vst->saveToFXBFile (dest, asFXB); | |||
| return false; | |||
| @@ -2870,7 +2854,7 @@ bool VSTPluginFormat::saveToFXBFile (AudioPluginInstance* plugin, MemoryBlock& d | |||
| bool VSTPluginFormat::getChunkData (AudioPluginInstance* plugin, MemoryBlock& result, bool isPreset) | |||
| { | |||
| if (VSTPluginInstance* vst = dynamic_cast <VSTPluginInstance*> (plugin)) | |||
| if (VSTPluginInstance* vst = dynamic_cast<VSTPluginInstance*> (plugin)) | |||
| return vst->getChunkData (result, isPreset, 128); | |||
| return false; | |||
| @@ -2878,7 +2862,7 @@ bool VSTPluginFormat::getChunkData (AudioPluginInstance* plugin, MemoryBlock& re | |||
| bool VSTPluginFormat::setChunkData (AudioPluginInstance* plugin, const void* data, int size, bool isPreset) | |||
| { | |||
| if (VSTPluginInstance* vst = dynamic_cast <VSTPluginInstance*> (plugin)) | |||
| if (VSTPluginInstance* vst = dynamic_cast<VSTPluginInstance*> (plugin)) | |||
| return vst->setChunkData (data, size, isPreset); | |||
| return false; | |||
| @@ -2888,13 +2872,13 @@ void VSTPluginFormat::setExtraFunctions (AudioPluginInstance* plugin, ExtraFunct | |||
| { | |||
| ScopedPointer<ExtraFunctions> f (functions); | |||
| if (VSTPluginInstance* vst = dynamic_cast <VSTPluginInstance*> (plugin)) | |||
| if (VSTPluginInstance* vst = dynamic_cast<VSTPluginInstance*> (plugin)) | |||
| vst->extraFunctions = f; | |||
| } | |||
| VSTPluginFormat::VstIntPtr JUCE_CALLTYPE VSTPluginFormat::dispatcher (AudioPluginInstance* plugin, int32 opcode, int32 index, VstIntPtr value, void* ptr, float opt) | |||
| { | |||
| if (VSTPluginInstance* vst = dynamic_cast <VSTPluginInstance*> (plugin)) | |||
| if (VSTPluginInstance* vst = dynamic_cast<VSTPluginInstance*> (plugin)) | |||
| return vst->dispatch (opcode, index, value, ptr, opt); | |||
| return 0; | |||
| @@ -41,8 +41,9 @@ | |||
| //============================================================================== | |||
| #if JUCE_MAC | |||
| #if (JUCE_PLUGINHOST_VST || JUCE_PLUGINHOST_AU) \ | |||
| || ! (defined (MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6) | |||
| #if JUCE_SUPPORT_CARBON \ | |||
| && ((JUCE_PLUGINHOST_VST || JUCE_PLUGINHOST_AU) \ | |||
| || ! (defined (MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6)) | |||
| #define Point CarbonDummyPointName // (workaround to avoid definition of "Point" by old Carbon headers) | |||
| #define Component CarbonDummyCompName | |||
| #include <Carbon/Carbon.h> | |||
| @@ -231,9 +231,6 @@ AudioProcessorEditor* AudioProcessor::createEditorIfNeeded() | |||
| AudioProcessorEditor* const ed = createEditor(); | |||
| // You must make your hasEditor() method return a consistent result! | |||
| jassert (hasEditor() == (ed != nullptr)); | |||
| if (ed != nullptr) | |||
| { | |||
| // you must give your editor comp a size before returning it.. | |||
| @@ -243,6 +240,9 @@ AudioProcessorEditor* AudioProcessor::createEditorIfNeeded() | |||
| activeEditor = ed; | |||
| } | |||
| // You must make your hasEditor() method return a consistent result! | |||
| jassert (hasEditor() == (ed != nullptr)); | |||
| return ed; | |||
| } | |||
| @@ -325,7 +325,7 @@ public: | |||
| /** Called by the host to tell this processor whether it's being used in a non-realtime | |||
| capacity for offline rendering or bouncing. | |||
| */ | |||
| void setNonRealtime (bool isNonRealtime) noexcept; | |||
| virtual void setNonRealtime (bool isNonRealtime) noexcept; | |||
| //============================================================================== | |||
| /** Creates the filter's UI. | |||
| @@ -22,16 +22,22 @@ | |||
| ============================================================================== | |||
| */ | |||
| AudioProcessorEditor::AudioProcessorEditor (AudioProcessor* const p) | |||
| : owner (p) | |||
| AudioProcessorEditor::AudioProcessorEditor (AudioProcessor& p) noexcept : processor (p) | |||
| { | |||
| } | |||
| AudioProcessorEditor::AudioProcessorEditor (AudioProcessor* p) noexcept : processor (*p) | |||
| { | |||
| // the filter must be valid.. | |||
| jassert (owner != nullptr); | |||
| jassert (p != nullptr); | |||
| } | |||
| AudioProcessorEditor::~AudioProcessorEditor() | |||
| { | |||
| // if this fails, then the wrapper hasn't called editorBeingDeleted() on the | |||
| // filter for some reason.. | |||
| jassert (owner->getActiveEditor() != this); | |||
| jassert (processor.getActiveEditor() != this); | |||
| } | |||
| void AudioProcessorEditor::setControlHighlight (ParameterControlHighlightInfo) {} | |||
| int AudioProcessorEditor::getControlParameterIndex (Component&) { return -1; } | |||
| @@ -39,9 +39,11 @@ class JUCE_API AudioProcessorEditor : public Component | |||
| { | |||
| protected: | |||
| //============================================================================== | |||
| /** Creates an editor for the specified processor. | |||
| */ | |||
| AudioProcessorEditor (AudioProcessor* owner); | |||
| /** Creates an editor for the specified processor. */ | |||
| AudioProcessorEditor (AudioProcessor&) noexcept; | |||
| /** Creates an editor for the specified processor. */ | |||
| AudioProcessorEditor (AudioProcessor*) noexcept; | |||
| public: | |||
| /** Destructor. */ | |||
| @@ -49,14 +51,40 @@ public: | |||
| //============================================================================== | |||
| /** Returns a pointer to the processor that this editor represents. */ | |||
| AudioProcessor* getAudioProcessor() const noexcept { return owner; } | |||
| /** The AudioProcessor that this editor represents. */ | |||
| AudioProcessor& processor; | |||
| /** Returns a pointer to the processor that this editor represents. | |||
| This method is here to support legacy code, but it's easier to just use the | |||
| AudioProcessorEditor::processor member variable directly to get this object. | |||
| */ | |||
| AudioProcessor* getAudioProcessor() const noexcept { return &processor; } | |||
| private: | |||
| //============================================================================== | |||
| AudioProcessor* const owner; | |||
| /** Used by the setParameterHighlighting() method. */ | |||
| struct ParameterControlHighlightInfo | |||
| { | |||
| int parameterIndex; | |||
| bool isHighlighted; | |||
| Colour suggestedColour; | |||
| }; | |||
| /** Some types of plugin can call this to suggest that the control for a particular | |||
| parameter should be highlighted. | |||
| Currently only AAX plugins will call this, and implementing it is optional. | |||
| */ | |||
| virtual void setControlHighlight (ParameterControlHighlightInfo); | |||
| /** Called by certain plug-in wrappers to find out whether a component is used | |||
| to control a parameter. | |||
| If the given component represents a particular plugin parameter, then this | |||
| method should return the index of that parameter. If not, it should return -1. | |||
| Currently only AAX plugins will call this, and implementing it is optional. | |||
| */ | |||
| virtual int getControlParameterIndex (Component&); | |||
| private: | |||
| JUCE_DECLARE_NON_COPYABLE (AudioProcessorEditor) | |||
| }; | |||
| @@ -71,18 +71,26 @@ PluginDescription& PluginDescription::operator= (const PluginDescription& other) | |||
| return *this; | |||
| } | |||
| bool PluginDescription::isDuplicateOf (const PluginDescription& other) const | |||
| bool PluginDescription::isDuplicateOf (const PluginDescription& other) const noexcept | |||
| { | |||
| return fileOrIdentifier == other.fileOrIdentifier | |||
| && uid == other.uid; | |||
| } | |||
| static String getPluginDescSuffix (const PluginDescription& d) | |||
| { | |||
| return "-" + String::toHexString (d.fileOrIdentifier.hashCode()) | |||
| + "-" + String::toHexString (d.uid); | |||
| } | |||
| bool PluginDescription::matchesIdentifierString (const String& identifierString) const | |||
| { | |||
| return identifierString.endsWithIgnoreCase (getPluginDescSuffix (*this)); | |||
| } | |||
| String PluginDescription::createIdentifierString() const | |||
| { | |||
| return pluginFormatName | |||
| + "-" + name | |||
| + "-" + String::toHexString (fileOrIdentifier.hashCode()) | |||
| + "-" + String::toHexString (uid); | |||
| return pluginFormatName + "-" + name + getPluginDescSuffix (*this); | |||
| } | |||
| XmlElement* PluginDescription::createXml() const | |||
| @@ -107,7 +107,15 @@ public: | |||
| This isn't quite as simple as them just having the same file (because of | |||
| shell plug-ins). | |||
| */ | |||
| bool isDuplicateOf (const PluginDescription& other) const; | |||
| bool isDuplicateOf (const PluginDescription& other) const noexcept; | |||
| /** Return true if this description is equivalent to another one which created the | |||
| given identifier string. | |||
| Note that this isn't quite as simple as them just calling createIdentifierString() | |||
| and comparing the strings, because the identifers can differ (thanks to shell plug-ins). | |||
| */ | |||
| bool matchesIdentifierString (const String& identifierString) const; | |||
| //============================================================================== | |||
| /** Returns a string that can be saved and used to uniquely identify the | |||
| @@ -46,7 +46,7 @@ PluginDescription* KnownPluginList::getTypeForFile (const String& fileOrIdentifi | |||
| PluginDescription* KnownPluginList::getTypeForIdentifierString (const String& identifierString) const | |||
| { | |||
| for (int i = 0; i < types.size(); ++i) | |||
| if (types.getUnchecked(i)->createIdentifierString() == identifierString) | |||
| if (types.getUnchecked(i)->matchesIdentifierString (identifierString)) | |||
| return types.getUnchecked(i); | |||
| return nullptr; | |||
| @@ -65,8 +65,7 @@ private: | |||
| public: | |||
| //============================================================================== | |||
| /** Creates an empty array. */ | |||
| Array() noexcept | |||
| : numUsed (0) | |||
| Array() noexcept : numUsed (0) | |||
| { | |||
| } | |||
| @@ -88,9 +88,8 @@ NamedValueSet& NamedValueSet::operator= (NamedValueSet&& other) noexcept | |||
| } | |||
| #endif | |||
| NamedValueSet::~NamedValueSet() | |||
| NamedValueSet::~NamedValueSet() noexcept | |||
| { | |||
| clear(); | |||
| } | |||
| void NamedValueSet::clear() | |||
| @@ -113,7 +112,7 @@ int NamedValueSet::size() const noexcept | |||
| return values.size(); | |||
| } | |||
| const var& NamedValueSet::operator[] (const Identifier& name) const | |||
| const var& NamedValueSet::operator[] (const Identifier& name) const noexcept | |||
| { | |||
| if (const var* v = getVarPointer (name)) | |||
| return *v; | |||
| @@ -170,7 +169,7 @@ bool NamedValueSet::set (Identifier name, const var& newValue) | |||
| return true; | |||
| } | |||
| bool NamedValueSet::contains (const Identifier& name) const | |||
| bool NamedValueSet::contains (const Identifier& name) const noexcept | |||
| { | |||
| return getVarPointer (name) != nullptr; | |||
| } | |||
| @@ -54,7 +54,7 @@ public: | |||
| #endif | |||
| /** Destructor. */ | |||
| ~NamedValueSet(); | |||
| ~NamedValueSet() noexcept; | |||
| bool operator== (const NamedValueSet&) const; | |||
| bool operator!= (const NamedValueSet&) const; | |||
| @@ -67,7 +67,7 @@ public: | |||
| If the name isn't found, this will return a void variant. | |||
| @see getProperty | |||
| */ | |||
| const var& operator[] (const Identifier& name) const; | |||
| const var& operator[] (const Identifier& name) const noexcept; | |||
| /** Tries to return the named value, but if no such value is found, this will | |||
| instead return the supplied default value. | |||
| @@ -89,7 +89,7 @@ public: | |||
| #endif | |||
| /** Returns true if the set contains an item with the specified name. */ | |||
| bool contains (const Identifier& name) const; | |||
| bool contains (const Identifier& name) const noexcept; | |||
| /** Removes a value from the set. | |||
| @returns true if a value was removed; false if there was no value | |||
| @@ -476,7 +476,7 @@ bool File::loadFileAsData (MemoryBlock& destBlock) const | |||
| return false; | |||
| FileInputStream in (*this); | |||
| return in.openedOk() && getSize() == in.readIntoMemoryBlock (destBlock); | |||
| return in.openedOk() && getSize() == (int64) in.readIntoMemoryBlock (destBlock); | |||
| } | |||
| String File::loadFileAsString() const | |||
| @@ -1145,8 +1145,14 @@ struct JavascriptEngine::RootObject : public DynamicObject | |||
| match (TokenTypes::semicolon); | |||
| } | |||
| s->iterator = parseExpression(); | |||
| match (TokenTypes::closeParen); | |||
| if (matchIf (TokenTypes::closeParen)) | |||
| s->iterator = new Statement (location); | |||
| else | |||
| { | |||
| s->iterator = parseExpression(); | |||
| match (TokenTypes::closeParen); | |||
| } | |||
| s->body = parseStatement(); | |||
| return s.release(); | |||
| } | |||
| @@ -1555,6 +1561,7 @@ struct JavascriptEngine::RootObject : public DynamicObject | |||
| setMethod ("log", Math_log); setMethod ("log10", Math_log10); | |||
| setMethod ("exp", Math_exp); setMethod ("pow", Math_pow); | |||
| setMethod ("sqr", Math_sqr); setMethod ("sqrt", Math_sqrt); | |||
| setMethod ("ceil", Math_ceil); setMethod ("floor", Math_floor); | |||
| } | |||
| static var Math_pi (Args) { return double_Pi; } | |||
| @@ -1587,6 +1594,8 @@ struct JavascriptEngine::RootObject : public DynamicObject | |||
| static var Math_pow (Args a) { return pow (getDouble (a, 0), getDouble (a, 1)); } | |||
| static var Math_sqr (Args a) { double x = getDouble (a, 0); return x * x; } | |||
| static var Math_sqrt (Args a) { return std::sqrt (getDouble (a, 0)); } | |||
| static var Math_ceil (Args a) { return std::ceil (getDouble (a, 0)); } | |||
| static var Math_floor (Args a) { return std::floor (getDouble (a, 0)); } | |||
| static Identifier getClassName() { static const Identifier i ("Math"); return i; } | |||
| template <typename Type> static Type sign (Type n) noexcept { return n > 0 ? (Type) 1 : (n < 0 ? (Type) -1 : 0); } | |||
| @@ -53,6 +53,8 @@ | |||
| #if JUCE_WINDOWS | |||
| #include <ctime> | |||
| #define _WINSOCK_DEPRECATED_NO_WARNINGS 1 | |||
| #include <winsock2.h> | |||
| #include <ws2tcpip.h> | |||
| @@ -95,7 +97,6 @@ | |||
| #endif | |||
| #if JUCE_MAC || JUCE_IOS | |||
| #include <execinfo.h> | |||
| #include <xlocale.h> | |||
| #include <mach/mach.h> | |||
| #endif | |||
| @@ -307,7 +307,7 @@ void BigInteger::negate() noexcept | |||
| negative = (! negative) && ! isZero(); | |||
| } | |||
| #if JUCE_USE_INTRINSICS && ! defined (__INTEL_COMPILER) | |||
| #if JUCE_USE_MSVC_INTRINSICS && ! defined (__INTEL_COMPILER) | |||
| #pragma intrinsic (_BitScanReverse) | |||
| #endif | |||
| @@ -317,7 +317,7 @@ inline static int highestBitInInt (uint32 n) noexcept | |||
| #if JUCE_GCC | |||
| return 31 - __builtin_clz (n); | |||
| #elif JUCE_USE_INTRINSICS | |||
| #elif JUCE_USE_MSVC_INTRINSICS | |||
| unsigned long highest; | |||
| _BitScanReverse (&highest, n); | |||
| return (int) highest; | |||
| @@ -77,6 +77,13 @@ public: | |||
| : Range (position2, position1); | |||
| } | |||
| /** Returns a range with a given start and length. */ | |||
| static Range withStartAndLength (const ValueType startValue, const ValueType length) noexcept | |||
| { | |||
| jassert (length >= ValueType()); | |||
| return Range (startValue, startValue + length); | |||
| } | |||
| /** Returns a range with the specified start position and a length of zero. */ | |||
| static Range emptyRange (const ValueType start) noexcept | |||
| { | |||
| @@ -218,7 +218,7 @@ private: | |||
| #else | |||
| #define JUCE_ATOMICS_WINDOWS 1 // Windows with intrinsics | |||
| #if JUCE_USE_INTRINSICS | |||
| #if JUCE_USE_MSVC_INTRINSICS | |||
| #ifndef __INTEL_COMPILER | |||
| #pragma intrinsic (_InterlockedExchange, _InterlockedIncrement, _InterlockedDecrement, _InterlockedCompareExchange, \ | |||
| _InterlockedCompareExchange64, _InterlockedExchangeAdd, _ReadWriteBarrier) | |||
| @@ -110,13 +110,13 @@ private: | |||
| //============================================================================== | |||
| #if JUCE_USE_INTRINSICS && ! defined (__INTEL_COMPILER) | |||
| #if JUCE_USE_MSVC_INTRINSICS && ! defined (__INTEL_COMPILER) | |||
| #pragma intrinsic (_byteswap_ulong) | |||
| #endif | |||
| inline uint16 ByteOrder::swap (uint16 n) noexcept | |||
| { | |||
| #if JUCE_USE_INTRINSICSxxx // agh - the MS compiler has an internal error when you try to use this intrinsic! | |||
| #if JUCE_USE_MSVC_INTRINSICSxxx // agh - the MS compiler has an internal error when you try to use this intrinsic! | |||
| return static_cast<uint16> (_byteswap_ushort (n)); | |||
| #else | |||
| return static_cast<uint16> ((n << 8) | (n >> 8)); | |||
| @@ -130,7 +130,7 @@ inline uint32 ByteOrder::swap (uint32 n) noexcept | |||
| #elif JUCE_GCC && JUCE_INTEL && ! JUCE_NO_INLINE_ASM | |||
| asm("bswap %%eax" : "=a"(n) : "a"(n)); | |||
| return n; | |||
| #elif JUCE_USE_INTRINSICS | |||
| #elif JUCE_USE_MSVC_INTRINSICS | |||
| return _byteswap_ulong (n); | |||
| #elif JUCE_MSVC && ! JUCE_NO_INLINE_ASM | |||
| __asm { | |||
| @@ -150,7 +150,7 @@ inline uint64 ByteOrder::swap (uint64 value) noexcept | |||
| { | |||
| #if JUCE_MAC || JUCE_IOS | |||
| return OSSwapInt64 (value); | |||
| #elif JUCE_USE_INTRINSICS | |||
| #elif JUCE_USE_MSVC_INTRINSICS | |||
| return _byteswap_uint64 (value); | |||
| #else | |||
| return (((int64) swap ((uint32) value)) << 32) | swap ((uint32) (value >> 32)); | |||
| @@ -158,7 +158,7 @@ public: | |||
| public: | |||
| Master() noexcept {} | |||
| ~Master() | |||
| ~Master() noexcept | |||
| { | |||
| // You must remember to call clear() in your source object's destructor! See the notes | |||
| // for the WeakReference class for an example of how to do this. | |||
| @@ -187,7 +187,7 @@ public: | |||
| to zero all the references to this object that may be out there. See the WeakReference | |||
| class notes for an example of how to do this. | |||
| */ | |||
| void clear() | |||
| void clear() noexcept | |||
| { | |||
| if (sharedPointer != nullptr) | |||
| sharedPointer->clearPointer(); | |||
| @@ -166,7 +166,7 @@ public: | |||
| int numBytes = stream.callIntMethod (HTTPStream.read, javaArray, (jint) bytesToRead); | |||
| if (numBytes > 0) | |||
| env->GetByteArrayRegion (javaArray, 0, numBytes, static_cast <jbyte*> (buffer)); | |||
| env->GetByteArrayRegion (javaArray, 0, numBytes, static_cast<jbyte*> (buffer)); | |||
| env->DeleteLocalRef (javaArray); | |||
| return numBytes; | |||
| @@ -38,7 +38,7 @@ void Logger::outputDebugString (const String& text) | |||
| #endif | |||
| //============================================================================== | |||
| #if JUCE_USE_INTRINSICS | |||
| #if JUCE_USE_MSVC_INTRINSICS | |||
| // CPU info functions using intrinsics... | |||
| @@ -313,7 +313,7 @@ double Time::getMillisecondCounterHiRes() noexcept { return hiResCounterHa | |||
| //============================================================================== | |||
| static int64 juce_getClockCycleCounter() noexcept | |||
| { | |||
| #if JUCE_USE_INTRINSICS | |||
| #if JUCE_USE_MSVC_INTRINSICS | |||
| // MS intrinsics version... | |||
| return (int64) __rdtsc(); | |||
| @@ -36,7 +36,7 @@ void* getUser32Function (const char* functionName) | |||
| } | |||
| //============================================================================== | |||
| #if ! JUCE_USE_INTRINSICS | |||
| #if ! JUCE_USE_MSVC_INTRINSICS | |||
| // In newer compilers, the inline versions of these are used (in juce_Atomic.h), but in | |||
| // older ones we have to actually call the ops as win32 functions.. | |||
| long juce_InterlockedExchange (volatile long* a, long b) noexcept { return InterlockedExchange (a, b); } | |||
| @@ -209,10 +209,10 @@ String InputStream::readNextLine() | |||
| return String::fromUTF8 (data, (int) i); | |||
| } | |||
| int InputStream::readIntoMemoryBlock (MemoryBlock& block, ssize_t numBytes) | |||
| size_t InputStream::readIntoMemoryBlock (MemoryBlock& block, ssize_t numBytes) | |||
| { | |||
| MemoryOutputStream mo (block, true); | |||
| return mo.writeFromInputStream (*this, numBytes); | |||
| return (size_t) mo.writeFromInputStream (*this, numBytes); | |||
| } | |||
| String InputStream::readEntireStreamAsString() | |||
| @@ -211,7 +211,7 @@ public: | |||
| /** Tries to read the whole stream and turn it into a string. | |||
| This will read from the stream's current position until the end-of-stream. | |||
| It can read from either UTF-16 or UTF-8 formats. | |||
| It can read from UTF-8 data, or UTF-16 if it detects suitable header-bytes. | |||
| */ | |||
| virtual String readEntireStreamAsString(); | |||
| @@ -223,8 +223,8 @@ public: | |||
| will be read until the stream is exhausted. | |||
| @returns the number of bytes that were added to the memory block | |||
| */ | |||
| virtual int readIntoMemoryBlock (MemoryBlock& destBlock, | |||
| ssize_t maxNumBytesToRead = -1); | |||
| virtual size_t readIntoMemoryBlock (MemoryBlock& destBlock, | |||
| ssize_t maxNumBytesToRead = -1); | |||
| //============================================================================== | |||
| /** Returns the offset of the next byte that will be read from the stream. | |||
| @@ -175,7 +175,7 @@ bool MemoryOutputStream::setPosition (int64 newPosition) | |||
| return false; | |||
| } | |||
| int MemoryOutputStream::writeFromInputStream (InputStream& source, int64 maxNumBytesToWrite) | |||
| int64 MemoryOutputStream::writeFromInputStream (InputStream& source, int64 maxNumBytesToWrite) | |||
| { | |||
| // before writing from an input, see if we can preallocate to make it more efficient.. | |||
| int64 availableData = source.getTotalLength() - source.getPosition(); | |||
| @@ -116,7 +116,7 @@ public: | |||
| bool write (const void*, size_t) override; | |||
| int64 getPosition() override { return (int64) position; } | |||
| bool setPosition (int64) override; | |||
| int writeFromInputStream (InputStream&, int64 maxNumBytesToWrite) override; | |||
| int64 writeFromInputStream (InputStream&, int64 maxNumBytesToWrite) override; | |||
| bool writeRepeatedByte (uint8 byte, size_t numTimesToRepeat) override; | |||
| private: | |||
| @@ -252,12 +252,12 @@ bool OutputStream::writeText (const String& text, const bool asUTF16, | |||
| return true; | |||
| } | |||
| int OutputStream::writeFromInputStream (InputStream& source, int64 numBytesToWrite) | |||
| int64 OutputStream::writeFromInputStream (InputStream& source, int64 numBytesToWrite) | |||
| { | |||
| if (numBytesToWrite < 0) | |||
| numBytesToWrite = std::numeric_limits<int64>::max(); | |||
| int numWritten = 0; | |||
| int64 numWritten = 0; | |||
| while (numBytesToWrite > 0) | |||
| { | |||
| @@ -221,7 +221,7 @@ public: | |||
| is exhausted) | |||
| @returns the number of bytes written | |||
| */ | |||
| virtual int writeFromInputStream (InputStream& source, int64 maxNumBytesToWrite); | |||
| virtual int64 writeFromInputStream (InputStream& source, int64 maxNumBytesToWrite); | |||
| //============================================================================== | |||
| /** Sets the string that will be written to the stream when the writeNewLine() | |||
| @@ -68,7 +68,7 @@ | |||
| @see jassert() | |||
| */ | |||
| #define juce_breakDebugger { ::kill (0, SIGTRAP); } | |||
| #elif JUCE_USE_INTRINSICS | |||
| #elif JUCE_USE_MSVC_INTRINSICS | |||
| #ifndef __INTEL_COMPILER | |||
| #pragma intrinsic (__debugbreak) | |||
| #endif | |||
| @@ -36,7 +36,7 @@ | |||
| */ | |||
| #define JUCE_MAJOR_VERSION 3 | |||
| #define JUCE_MINOR_VERSION 0 | |||
| #define JUCE_BUILDNUMBER 7 | |||
| #define JUCE_BUILDNUMBER 8 | |||
| /** Current Juce version number. | |||
| @@ -73,7 +73,7 @@ | |||
| #include <vector> | |||
| #include <algorithm> | |||
| #if JUCE_USE_INTRINSICS | |||
| #if JUCE_USE_MSVC_INTRINSICS | |||
| #include <intrin.h> | |||
| #endif | |||
| @@ -194,7 +194,7 @@ | |||
| #endif | |||
| #if JUCE_64BIT || ! JUCE_VC7_OR_EARLIER | |||
| #define JUCE_USE_INTRINSICS 1 | |||
| #define JUCE_USE_MSVC_INTRINSICS 1 | |||
| #endif | |||
| #else | |||
| #error unknown compiler | |||
| @@ -714,7 +714,7 @@ bool XmlElement::isEquivalentTo (const XmlElement* const other, | |||
| { | |||
| if (thisAtt == nullptr || otherAtt == nullptr) | |||
| { | |||
| if (thisAtt == otherAtt) // both 0, so it's a match | |||
| if (thisAtt == otherAtt) // both nullptr, so it's a match | |||
| break; | |||
| return false; | |||
| @@ -599,10 +599,17 @@ public: | |||
| /** Returns true if the given element is a child of this one. */ | |||
| bool containsChildElement (const XmlElement* possibleChild) const noexcept; | |||
| /** Recursively searches all sub-elements to find one that contains the specified | |||
| child element. | |||
| /** Recursively searches all sub-elements of this one, looking for an element | |||
| which is the direct parent of the specified element. | |||
| Because elements don't store a pointer to their parent, if you have one | |||
| and need to find its parent, the only way to do so is to exhaustively | |||
| search the whole tree for it. | |||
| If the given child is found somewhere in this element's hierarchy, then | |||
| this method will return its parent. If not, it will return nullptr. | |||
| */ | |||
| XmlElement* findParentElementOf (const XmlElement* elementToLookFor) noexcept; | |||
| XmlElement* findParentElementOf (const XmlElement* childToSearchFor) noexcept; | |||
| //============================================================================== | |||
| /** Sorts the child elements using a comparator. | |||
| @@ -347,7 +347,7 @@ void ZipFile::init() | |||
| in->setPosition (pos); | |||
| MemoryBlock headerData; | |||
| if (in->readIntoMemoryBlock (headerData, size) == size) | |||
| if (in->readIntoMemoryBlock (headerData, size) == (size_t) size) | |||
| { | |||
| pos = 0; | |||
| @@ -25,12 +25,11 @@ | |||
| class ActionBroadcaster::ActionMessage : public MessageManager::MessageBase | |||
| { | |||
| public: | |||
| ActionMessage (const ActionBroadcaster* const broadcaster_, | |||
| const String& messageText, | |||
| ActionListener* const listener_) noexcept | |||
| : broadcaster (const_cast <ActionBroadcaster*> (broadcaster_)), | |||
| ActionMessage (const ActionBroadcaster* ab, | |||
| const String& messageText, ActionListener* l) noexcept | |||
| : broadcaster (const_cast<ActionBroadcaster*> (ab)), | |||
| message (messageText), | |||
| listener (listener_) | |||
| listener (l) | |||
| {} | |||
| void messageCallback() override | |||
| @@ -31,7 +31,7 @@ struct InterprocessConnection::ConnectionThread : public Thread | |||
| private: | |||
| InterprocessConnection& owner; | |||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ConnectionThread); | |||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ConnectionThread) | |||
| }; | |||
| //============================================================================== | |||
| @@ -232,7 +232,7 @@ int JUCEApplicationBase::main() | |||
| jassert (app != nullptr); | |||
| if (! app->initialiseApp()) | |||
| return 0; | |||
| return app->getApplicationReturnValue(); | |||
| JUCE_TRY | |||
| { | |||
| @@ -50,24 +50,24 @@ | |||
| MyJUCEApp() {} | |||
| ~MyJUCEApp() {} | |||
| void initialise (const String& commandLine) | |||
| void initialise (const String& commandLine) override | |||
| { | |||
| myMainWindow = new MyApplicationWindow(); | |||
| myMainWindow->setBounds (100, 100, 400, 500); | |||
| myMainWindow->setVisible (true); | |||
| } | |||
| void shutdown() | |||
| void shutdown() override | |||
| { | |||
| myMainWindow = nullptr; | |||
| } | |||
| const String getApplicationName() | |||
| const String getApplicationName() override | |||
| { | |||
| return "Super JUCE-o-matic"; | |||
| } | |||
| const String getApplicationVersion() | |||
| const String getApplicationVersion() override | |||
| { | |||
| return "1.0"; | |||
| } | |||
| @@ -288,7 +288,10 @@ bool MessageManagerLock::attemptLock (Thread* const threadToCheck, ThreadPoolJob | |||
| blockingMessage = new BlockingMessage(); | |||
| if (! blockingMessage->post()) | |||
| { | |||
| blockingMessage = nullptr; | |||
| return false; | |||
| } | |||
| while (! blockingMessage->lockedEvent.wait (20)) | |||
| { | |||
| @@ -83,8 +83,8 @@ public: | |||
| void transformPoint (ValueType& x, ValueType& y) const noexcept | |||
| { | |||
| const ValueType oldX = x; | |||
| x = static_cast <ValueType> (mat00 * oldX + mat01 * y + mat02); | |||
| y = static_cast <ValueType> (mat10 * oldX + mat11 * y + mat12); | |||
| x = static_cast<ValueType> (mat00 * oldX + mat01 * y + mat02); | |||
| y = static_cast<ValueType> (mat10 * oldX + mat11 * y + mat12); | |||
| } | |||
| /** Transforms two 2D coordinates using this matrix. | |||
| @@ -97,10 +97,10 @@ public: | |||
| ValueType& x2, ValueType& y2) const noexcept | |||
| { | |||
| const ValueType oldX1 = x1, oldX2 = x2; | |||
| x1 = static_cast <ValueType> (mat00 * oldX1 + mat01 * y1 + mat02); | |||
| y1 = static_cast <ValueType> (mat10 * oldX1 + mat11 * y1 + mat12); | |||
| x2 = static_cast <ValueType> (mat00 * oldX2 + mat01 * y2 + mat02); | |||
| y2 = static_cast <ValueType> (mat10 * oldX2 + mat11 * y2 + mat12); | |||
| x1 = static_cast<ValueType> (mat00 * oldX1 + mat01 * y1 + mat02); | |||
| y1 = static_cast<ValueType> (mat10 * oldX1 + mat11 * y1 + mat12); | |||
| x2 = static_cast<ValueType> (mat00 * oldX2 + mat01 * y2 + mat02); | |||
| y2 = static_cast<ValueType> (mat10 * oldX2 + mat11 * y2 + mat12); | |||
| } | |||
| /** Transforms three 2D coordinates using this matrix. | |||
| @@ -114,12 +114,12 @@ public: | |||
| ValueType& x3, ValueType& y3) const noexcept | |||
| { | |||
| const ValueType oldX1 = x1, oldX2 = x2, oldX3 = x3; | |||
| x1 = static_cast <ValueType> (mat00 * oldX1 + mat01 * y1 + mat02); | |||
| y1 = static_cast <ValueType> (mat10 * oldX1 + mat11 * y1 + mat12); | |||
| x2 = static_cast <ValueType> (mat00 * oldX2 + mat01 * y2 + mat02); | |||
| y2 = static_cast <ValueType> (mat10 * oldX2 + mat11 * y2 + mat12); | |||
| x3 = static_cast <ValueType> (mat00 * oldX3 + mat01 * y3 + mat02); | |||
| y3 = static_cast <ValueType> (mat10 * oldX3 + mat11 * y3 + mat12); | |||
| x1 = static_cast<ValueType> (mat00 * oldX1 + mat01 * y1 + mat02); | |||
| y1 = static_cast<ValueType> (mat10 * oldX1 + mat11 * y1 + mat12); | |||
| x2 = static_cast<ValueType> (mat00 * oldX2 + mat01 * y2 + mat02); | |||
| y2 = static_cast<ValueType> (mat10 * oldX2 + mat11 * y2 + mat12); | |||
| x3 = static_cast<ValueType> (mat00 * oldX3 + mat01 * y3 + mat02); | |||
| y3 = static_cast<ValueType> (mat10 * oldX3 + mat11 * y3 + mat12); | |||
| } | |||
| //============================================================================== | |||
| @@ -231,8 +231,7 @@ public: | |||
| float x10, float y10, | |||
| float x01, float y01) noexcept; | |||
| /** Returns the transform that will map three specified points onto three target points. | |||
| */ | |||
| /** Returns the transform that will map three specified points onto three target points. */ | |||
| static AffineTransform fromTargetPoints (float sourceX1, float sourceY1, float targetX1, float targetY1, | |||
| float sourceX2, float sourceY2, float targetX2, float targetY2, | |||
| float sourceX3, float sourceY3, float targetX3, float targetY3) noexcept; | |||
| @@ -506,8 +506,8 @@ private: | |||
| lf.lfOutPrecision = OUT_OUTLINE_PRECIS; | |||
| lf.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; | |||
| lf.lfQuality = PROOF_QUALITY; | |||
| lf.lfItalic = (BYTE) (style == "Italic" ? TRUE : FALSE); | |||
| lf.lfWeight = style == "Bold" ? FW_BOLD : FW_NORMAL; | |||
| lf.lfItalic = (BYTE) (style.contains ("Italic") ? TRUE : FALSE); | |||
| lf.lfWeight = style.contains ("Bold") ? FW_BOLD : FW_NORMAL; | |||
| lf.lfHeight = -256; | |||
| name.copyToUTF16 (lf.lfFaceName, sizeof (lf.lfFaceName)); | |||
| @@ -53,24 +53,24 @@ | |||
| MyJUCEApp() {} | |||
| ~MyJUCEApp() {} | |||
| void initialise (const String& commandLine) | |||
| void initialise (const String& commandLine) override | |||
| { | |||
| myMainWindow = new MyApplicationWindow(); | |||
| myMainWindow->setBounds (100, 100, 400, 500); | |||
| myMainWindow->setVisible (true); | |||
| } | |||
| void shutdown() | |||
| void shutdown() override | |||
| { | |||
| myMainWindow = nullptr; | |||
| } | |||
| const String getApplicationName() | |||
| const String getApplicationName() override | |||
| { | |||
| return "Super JUCE-o-matic"; | |||
| } | |||
| const String getApplicationVersion() | |||
| const String getApplicationVersion() override | |||
| { | |||
| return "1.0"; | |||
| } | |||
| @@ -141,7 +141,7 @@ public: | |||
| } | |||
| private: | |||
| Array <MouseListener*> listeners; | |||
| Array<MouseListener*> listeners; | |||
| int numDeepMouseListeners; | |||
| class BailOutChecker2 | |||
| @@ -256,7 +256,7 @@ struct Component::ComponentHelpers | |||
| #if JUCE_MODAL_LOOPS_PERMITTED | |||
| static void* runModalLoopCallback (void* userData) | |||
| { | |||
| return (void*) (pointer_sized_int) static_cast <Component*> (userData)->runModalLoop(); | |||
| return (void*) (pointer_sized_int) static_cast<Component*> (userData)->runModalLoop(); | |||
| } | |||
| #endif | |||
| @@ -399,16 +399,6 @@ struct Component::ComponentHelpers | |||
| return convertFromDistantParentSpace (topLevelComp, *target, p); | |||
| } | |||
| static Rectangle<int> getUnclippedArea (const Component& comp) | |||
| { | |||
| Rectangle<int> r (comp.getLocalBounds()); | |||
| if (Component* const p = comp.getParentComponent()) | |||
| r = r.getIntersection (convertFromParentSpace (comp, getUnclippedArea (*p))); | |||
| return r; | |||
| } | |||
| static bool clipObscuredRegions (const Component& comp, Graphics& g, const Rectangle<int>& clipRect, Point<int> delta) | |||
| { | |||
| bool nothingChanged = true; | |||
| @@ -441,35 +431,6 @@ struct Component::ComponentHelpers | |||
| return nothingChanged; | |||
| } | |||
| static void subtractObscuredRegions (const Component& comp, RectangleList<int>& result, | |||
| Point<int> delta, const Rectangle<int>& clipRect, | |||
| const Component* const compToAvoid) | |||
| { | |||
| for (int i = comp.childComponentList.size(); --i >= 0;) | |||
| { | |||
| const Component* const c = comp.childComponentList.getUnchecked(i); | |||
| if (c != compToAvoid && c->isVisible()) | |||
| { | |||
| if (c->isOpaque() && c->componentTransparency == 0) | |||
| { | |||
| Rectangle<int> childBounds (c->bounds.getIntersection (clipRect)); | |||
| childBounds.translate (delta.x, delta.y); | |||
| result.subtract (childBounds); | |||
| } | |||
| else | |||
| { | |||
| Rectangle<int> newClip (clipRect.getIntersection (c->bounds)); | |||
| newClip.translate (-c->getX(), -c->getY()); | |||
| subtractObscuredRegions (*c, result, c->getPosition() + delta, | |||
| newClip, compToAvoid); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| static Rectangle<int> getParentOrMainMonitorBounds (const Component& comp) | |||
| { | |||
| if (Component* p = comp.getParentComponent()) | |||
| @@ -480,7 +441,7 @@ struct Component::ComponentHelpers | |||
| }; | |||
| //============================================================================== | |||
| Component::Component() | |||
| Component::Component() noexcept | |||
| : parentComponent (nullptr), | |||
| lookAndFeel (nullptr), | |||
| effect (nullptr), | |||
| @@ -489,7 +450,7 @@ Component::Component() | |||
| { | |||
| } | |||
| Component::Component (const String& name) | |||
| Component::Component (const String& name) noexcept | |||
| : componentName (name), | |||
| parentComponent (nullptr), | |||
| lookAndFeel (nullptr), | |||
| @@ -620,7 +581,6 @@ bool Component::isShowing() const | |||
| return false; | |||
| } | |||
| //============================================================================== | |||
| void* Component::getWindowHandle() const | |||
| { | |||
| @@ -880,7 +840,7 @@ void Component::setBufferedToImage (const bool shouldBeBuffered) | |||
| // so by calling setBufferedToImage, you'll be deleting the custom one - this is almost certainly | |||
| // not what you wanted to happen... If you really do know what you're doing here, and want to | |||
| // avoid this assertion, just call setCachedComponentImage (nullptr) before setBufferedToImage(). | |||
| jassert (cachedImage == nullptr || dynamic_cast <StandardCachedComponentImage*> (cachedImage.get()) != nullptr); | |||
| jassert (cachedImage == nullptr || dynamic_cast<StandardCachedComponentImage*> (cachedImage.get()) != nullptr); | |||
| if (shouldBeBuffered) | |||
| { | |||
| @@ -1643,7 +1603,7 @@ Component* Component::getChildComponent (const int index) const noexcept | |||
| int Component::getIndexOfChildComponent (const Component* const child) const noexcept | |||
| { | |||
| return childComponentList.indexOf (const_cast <Component*> (child)); | |||
| return childComponentList.indexOf (const_cast<Component*> (child)); | |||
| } | |||
| Component* Component::findChildWithID (StringRef targetID) const noexcept | |||
| @@ -1665,7 +1625,7 @@ Component* Component::getTopLevelComponent() const noexcept | |||
| while (comp->parentComponent != nullptr) | |||
| comp = comp->parentComponent; | |||
| return const_cast <Component*> (comp); | |||
| return const_cast<Component*> (comp); | |||
| } | |||
| bool Component::isParentOf (const Component* possibleChild) const noexcept | |||
| @@ -2064,7 +2024,10 @@ void Component::paintEntireComponent (Graphics& g, const bool ignoreAlphaLevel) | |||
| // If sizing a top-level-window and the OS paint message is delivered synchronously | |||
| // before resized() is called, then we'll invoke the callback here, to make sure | |||
| // the components inside have had a chance to sort their sizes out.. | |||
| sendMovedResizedMessagesIfPending(); | |||
| #if JUCE_DEBUG | |||
| if (! flags.isInsidePaintCall) // (avoids an assertion in plugins hosted in WaveLab) | |||
| #endif | |||
| sendMovedResizedMessagesIfPending(); | |||
| #if JUCE_DEBUG | |||
| flags.isInsidePaintCall = true; | |||
| @@ -2202,7 +2165,7 @@ void Component::sendLookAndFeelChange() | |||
| Colour Component::findColour (const int colourId, const bool inheritFromParent) const | |||
| { | |||
| if (const var* const v = properties.getVarPointer (ComponentHelpers::getColourPropertyId (colourId))) | |||
| return Colour ((uint32) static_cast <int> (*v)); | |||
| return Colour ((uint32) static_cast<int> (*v)); | |||
| if (inheritFromParent && parentComponent != nullptr | |||
| && (lookAndFeel == nullptr || ! lookAndFeel->isColourSpecified (colourId))) | |||
| @@ -2281,28 +2244,6 @@ Rectangle<int> Component::getBoundsInParent() const noexcept | |||
| : bounds.transformedBy (*affineTransform); | |||
| } | |||
| void Component::getVisibleArea (RectangleList<int>& result, const bool includeSiblings) const | |||
| { | |||
| result.clear(); | |||
| const Rectangle<int> unclipped (ComponentHelpers::getUnclippedArea (*this)); | |||
| if (! unclipped.isEmpty()) | |||
| { | |||
| result.add (unclipped); | |||
| if (includeSiblings) | |||
| { | |||
| const Component* const c = getTopLevelComponent(); | |||
| ComponentHelpers::subtractObscuredRegions (*c, result, getLocalPoint (c, Point<int>()), | |||
| c->getLocalBounds(), this); | |||
| } | |||
| ComponentHelpers::subtractObscuredRegions (*this, result, Point<int>(), unclipped, nullptr); | |||
| result.consolidate(); | |||
| } | |||
| } | |||
| //============================================================================== | |||
| void Component::mouseEnter (const MouseEvent&) {} | |||
| void Component::mouseExit (const MouseEvent&) {} | |||
| @@ -2853,7 +2794,7 @@ void Component::grabFocusInternal (const FocusChangeType cause, const bool canTr | |||
| else | |||
| { | |||
| // find the default child component.. | |||
| ScopedPointer <KeyboardFocusTraverser> traverser (createFocusTraverser()); | |||
| ScopedPointer<KeyboardFocusTraverser> traverser (createFocusTraverser()); | |||
| if (traverser != nullptr) | |||
| { | |||
| @@ -2895,7 +2836,7 @@ void Component::moveKeyboardFocusToSibling (const bool moveToNext) | |||
| if (parentComponent != nullptr) | |||
| { | |||
| ScopedPointer <KeyboardFocusTraverser> traverser (createFocusTraverser()); | |||
| ScopedPointer<KeyboardFocusTraverser> traverser (createFocusTraverser()); | |||
| if (traverser != nullptr) | |||
| { | |||
| @@ -3049,7 +2990,7 @@ Point<int> Component::getMouseXYRelative() const | |||
| void Component::addKeyListener (KeyListener* const newListener) | |||
| { | |||
| if (keyListeners == nullptr) | |||
| keyListeners = new Array <KeyListener*>(); | |||
| keyListeners = new Array<KeyListener*>(); | |||
| keyListeners->addIfNotAlreadyThere (newListener); | |||
| } | |||
| @@ -46,7 +46,7 @@ public: | |||
| subclass of Component or use one of the other types of component from | |||
| the library. | |||
| */ | |||
| Component(); | |||
| Component() noexcept; | |||
| /** Destructor. | |||
| @@ -66,7 +66,7 @@ public: | |||
| /** Creates a component, setting its name at the same time. | |||
| @see getName, setName | |||
| */ | |||
| explicit Component (const String& componentName); | |||
| explicit Component (const String& componentName) noexcept; | |||
| /** Returns the name of this component. | |||
| @see setName | |||
| @@ -315,16 +315,6 @@ public: | |||
| */ | |||
| Rectangle<int> getBoundsInParent() const noexcept; | |||
| /** Returns the region of this component that's not obscured by other, opaque components. | |||
| The RectangleList that is returned represents the area of this component | |||
| which isn't covered by opaque child components. | |||
| If includeSiblings is true, it will also take into account any siblings | |||
| that may be overlapping the component. | |||
| */ | |||
| void getVisibleArea (RectangleList<int>& result, bool includeSiblings) const; | |||
| //============================================================================== | |||
| /** Returns this component's x coordinate relative the screen's top-left origin. | |||
| @see getX, localPointToGlobal | |||
| @@ -807,7 +797,7 @@ public: | |||
| TargetClass* findParentComponentOfClass() const | |||
| { | |||
| for (Component* p = parentComponent; p != nullptr; p = p->parentComponent) | |||
| if (TargetClass* const target = dynamic_cast <TargetClass*> (p)) | |||
| if (TargetClass* const target = dynamic_cast<TargetClass*> (p)) | |||
| return target; | |||
| return nullptr; | |||
| @@ -1166,7 +1156,7 @@ public: | |||
| By default, components are considered transparent, unless this is used to | |||
| make it otherwise. | |||
| @see isOpaque, getVisibleArea | |||
| @see isOpaque | |||
| */ | |||
| void setOpaque (bool shouldBeOpaque); | |||
| @@ -2136,31 +2126,31 @@ public: | |||
| SafePointer() noexcept {} | |||
| /** Creates a SafePointer that points at the given component. */ | |||
| SafePointer (ComponentType* const component) : weakRef (component) {} | |||
| SafePointer (ComponentType* component) : weakRef (component) {} | |||
| /** Creates a copy of another SafePointer. */ | |||
| SafePointer (const SafePointer& other) noexcept : weakRef (other.weakRef) {} | |||
| SafePointer (const SafePointer& other) noexcept : weakRef (other.weakRef) {} | |||
| /** Copies another pointer to this one. */ | |||
| SafePointer& operator= (const SafePointer& other) { weakRef = other.weakRef; return *this; } | |||
| SafePointer& operator= (const SafePointer& other) { weakRef = other.weakRef; return *this; } | |||
| /** Copies another pointer to this one. */ | |||
| SafePointer& operator= (ComponentType* const newComponent) { weakRef = newComponent; return *this; } | |||
| SafePointer& operator= (ComponentType* newComponent) { weakRef = newComponent; return *this; } | |||
| /** Returns the component that this pointer refers to, or null if the component no longer exists. */ | |||
| ComponentType* getComponent() const noexcept { return dynamic_cast <ComponentType*> (weakRef.get()); } | |||
| ComponentType* getComponent() const noexcept { return dynamic_cast<ComponentType*> (weakRef.get()); } | |||
| /** Returns the component that this pointer refers to, or null if the component no longer exists. */ | |||
| operator ComponentType*() const noexcept { return getComponent(); } | |||
| operator ComponentType*() const noexcept { return getComponent(); } | |||
| /** Returns the component that this pointer refers to, or null if the component no longer exists. */ | |||
| ComponentType* operator->() noexcept { return getComponent(); } | |||
| ComponentType* operator->() noexcept { return getComponent(); } | |||
| /** Returns the component that this pointer refers to, or null if the component no longer exists. */ | |||
| const ComponentType* operator->() const noexcept { return getComponent(); } | |||
| const ComponentType* operator->() const noexcept { return getComponent(); } | |||
| /** If the component is valid, this deletes it and sets this pointer to null. */ | |||
| void deleteAndZero() { delete getComponent(); } | |||
| void deleteAndZero() { delete getComponent(); } | |||
| bool operator== (ComponentType* component) const noexcept { return weakRef == component; } | |||
| bool operator!= (ComponentType* component) const noexcept { return weakRef != component; } | |||
| @@ -2268,20 +2258,20 @@ private: | |||
| String componentName, componentID; | |||
| Component* parentComponent; | |||
| Rectangle<int> bounds; | |||
| ScopedPointer <Positioner> positioner; | |||
| ScopedPointer <AffineTransform> affineTransform; | |||
| Array <Component*> childComponentList; | |||
| ScopedPointer<Positioner> positioner; | |||
| ScopedPointer<AffineTransform> affineTransform; | |||
| Array<Component*> childComponentList; | |||
| LookAndFeel* lookAndFeel; | |||
| MouseCursor cursor; | |||
| ImageEffectFilter* effect; | |||
| ScopedPointer <CachedComponentImage> cachedImage; | |||
| ScopedPointer<CachedComponentImage> cachedImage; | |||
| class MouseListenerList; | |||
| friend class MouseListenerList; | |||
| friend struct ContainerDeletePolicy<MouseListenerList>; | |||
| ScopedPointer <MouseListenerList> mouseListeners; | |||
| ScopedPointer <Array <KeyListener*> > keyListeners; | |||
| ListenerList <ComponentListener> componentListeners; | |||
| ScopedPointer<MouseListenerList> mouseListeners; | |||
| ScopedPointer<Array<KeyListener*> > keyListeners; | |||
| ListenerList<ComponentListener> componentListeners; | |||
| NamedValueSet properties; | |||
| friend class WeakReference<Component>; | |||
| @@ -2308,9 +2298,9 @@ private: | |||
| bool mouseDownWasBlocked : 1; | |||
| bool isMoveCallbackPending : 1; | |||
| bool isResizeCallbackPending : 1; | |||
| #if JUCE_DEBUG | |||
| #if JUCE_DEBUG | |||
| bool isInsidePaintCall : 1; | |||
| #endif | |||
| #endif | |||
| }; | |||
| union | |||
| @@ -49,7 +49,7 @@ | |||
| #import <WebKit/WebKit.h> | |||
| #import <IOKit/pwr_mgt/IOPMLib.h> | |||
| #if JUCE_SUPPORT_CARBON | |||
| #if JUCE_SUPPORT_CARBON && ! (defined (MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6) | |||
| #define Point CarbonDummyPointName | |||
| #define Component CarbonDummyCompName | |||
| #import <Carbon/Carbon.h> // still needed for SetSystemUIMode() | |||
| @@ -25,8 +25,7 @@ | |||
| class ComponentAnimator::AnimationTask | |||
| { | |||
| public: | |||
| AnimationTask (Component* const comp) | |||
| : component (comp) | |||
| AnimationTask (Component* const comp) noexcept : component (comp) | |||
| { | |||
| } | |||
| @@ -34,7 +33,7 @@ public: | |||
| float finalAlpha, | |||
| int millisecondsToSpendMoving, | |||
| bool useProxyComponent, | |||
| double startSpeed_, double endSpeed_) | |||
| double startSpd, double endSpd) | |||
| { | |||
| msElapsed = 0; | |||
| msTotal = jmax (1, millisecondsToSpendMoving); | |||
| @@ -51,10 +50,10 @@ public: | |||
| bottom = component->getBottom(); | |||
| alpha = component->getAlpha(); | |||
| const double invTotalDistance = 4.0 / (startSpeed_ + endSpeed_ + 2.0); | |||
| startSpeed = jmax (0.0, startSpeed_ * invTotalDistance); | |||
| const double invTotalDistance = 4.0 / (startSpd + endSpd + 2.0); | |||
| startSpeed = jmax (0.0, startSpd * invTotalDistance); | |||
| midSpeed = invTotalDistance; | |||
| endSpeed = jmax (0.0, endSpeed_ * invTotalDistance); | |||
| endSpeed = jmax (0.0, endSpd * invTotalDistance); | |||
| if (useProxyComponent) | |||
| proxy = new ProxyComponent (*component); | |||
| @@ -148,10 +148,10 @@ public: | |||
| private: | |||
| //============================================================================== | |||
| class AnimationTask; | |||
| OwnedArray <AnimationTask> tasks; | |||
| OwnedArray<AnimationTask> tasks; | |||
| uint32 lastTime; | |||
| AnimationTask* findTaskFor (Component* component) const noexcept; | |||
| AnimationTask* findTaskFor (Component*) const noexcept; | |||
| void timerCallback(); | |||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ComponentAnimator) | |||
| @@ -238,7 +238,7 @@ void ComponentBuilder::updateChildComponents (Component& parent, const ValueTree | |||
| const int numExistingChildComps = parent.getNumChildComponents(); | |||
| Array <Component*> componentsInOrder; | |||
| Array<Component*> componentsInOrder; | |||
| componentsInOrder.ensureStorageAllocated (numExistingChildComps); | |||
| { | |||
| @@ -226,7 +226,7 @@ public: | |||
| private: | |||
| //============================================================================= | |||
| OwnedArray <TypeHandler> types; | |||
| OwnedArray<TypeHandler> types; | |||
| ScopedPointer<Component> component; | |||
| ImageProvider* imageProvider; | |||
| #if JUCE_DEBUG | |||
| @@ -128,7 +128,7 @@ private: | |||
| SpinLock MouseCursor::SharedCursorHandle::lock; | |||
| //============================================================================== | |||
| MouseCursor::MouseCursor() | |||
| MouseCursor::MouseCursor() noexcept | |||
| : cursorHandle (nullptr) | |||
| { | |||
| } | |||
| @@ -72,10 +72,10 @@ public: | |||
| //============================================================================== | |||
| /** Creates the standard arrow cursor. */ | |||
| MouseCursor(); | |||
| MouseCursor() noexcept; | |||
| /** Creates one of the standard mouse cursor */ | |||
| MouseCursor (StandardCursorType type); | |||
| MouseCursor (StandardCursorType); | |||
| /** Creates a custom cursor from an image. | |||
| @@ -43,7 +43,7 @@ JUCE_JNI_CALLBACK (JUCE_ANDROID_ACTIVITY_CLASSNAME, launchApp, void, (JNIEnv* en | |||
| JUCEApplicationBase* app = JUCEApplicationBase::createInstance(); | |||
| if (! app->initialiseApp()) | |||
| exit (0); | |||
| exit (app->getApplicationReturnValue()); | |||
| jassert (MessageManager::getInstance()->isThisTheMessageThread()); | |||
| } | |||
| @@ -1045,7 +1045,7 @@ public: | |||
| r = Desktop::getInstance().getDisplays().getMainDisplay().userArea; | |||
| if (! r.isEmpty()) | |||
| setBounds (r, shouldBeFullScreen); | |||
| setBounds (ScalingHelpers::scaledScreenPosToUnscaled (component, r), shouldBeFullScreen); | |||
| component.repaint(); | |||
| } | |||
| @@ -1115,9 +1115,9 @@ public: | |||
| if (c == &component) | |||
| break; | |||
| // TODO: needs scaling correctly | |||
| if (c->contains (localPos + bounds.getPosition() - c->getScreenPosition())) | |||
| return false; | |||
| if (ComponentPeer* peer = c->getPeer()) | |||
| if (peer->contains (localPos + bounds.getPosition() - peer->getBounds().getPosition(), true)) | |||
| return false; | |||
| } | |||
| if (trueIfInAChildWindow) | |||
| @@ -369,7 +369,7 @@ public: | |||
| // (can't call the component's setBounds method because that'll reset our fullscreen flag) | |||
| if (r != component.getBounds() && ! r.isEmpty()) | |||
| setBounds (r, shouldBeFullScreen); | |||
| setBounds (ScalingHelpers::scaledScreenPosToUnscaled (component, r), shouldBeFullScreen); | |||
| } | |||
| } | |||
| } | |||
| @@ -411,8 +411,9 @@ public: | |||
| if (NSWindow* const viewWindow = [view window]) | |||
| { | |||
| const NSRect windowFrame = [viewWindow frame]; | |||
| const NSPoint screenPoint = NSMakePoint (windowFrame.origin.x + localPos.getX(), | |||
| windowFrame.origin.y + windowFrame.size.height - localPos.getY()); | |||
| const NSPoint windowPoint = [view convertPoint: NSMakePoint (localPos.x, localPos.y) toView: nil]; | |||
| const NSPoint screenPoint = NSMakePoint (windowFrame.origin.x + windowPoint.x, | |||
| windowFrame.origin.y + windowFrame.size.height - windowPoint.y); | |||
| if (! isWindowAtPoint (viewWindow, screenPoint)) | |||
| return false; | |||
| @@ -763,7 +763,7 @@ public: | |||
| ShowWindow (hwnd, SW_SHOWNORMAL); | |||
| if (! boundsCopy.isEmpty()) | |||
| setBounds (boundsCopy, false); | |||
| setBounds (ScalingHelpers::scaledScreenPosToUnscaled (component, boundsCopy), false); | |||
| } | |||
| else | |||
| { | |||
| @@ -1528,10 +1528,14 @@ private: | |||
| // if something in a paint handler calls, e.g. a message box, this can become reentrant and | |||
| // corrupt the image it's using to paint into, so do a check here. | |||
| static bool reentrant = false; | |||
| if (! (reentrant || dontRepaint)) | |||
| if (! reentrant) | |||
| { | |||
| const ScopedValueSetter<bool> setter (reentrant, true, false); | |||
| performPaint (dc, rgn, regionType, paintStruct); | |||
| if (dontRepaint) | |||
| component.handleCommandMessage (0); // (this triggers a repaint in the openGL context) | |||
| else | |||
| performPaint (dc, rgn, regionType, paintStruct); | |||
| } | |||
| DeleteObject (rgn); | |||
| @@ -2896,18 +2900,15 @@ private: | |||
| ModifierKeys HWNDComponentPeer::currentModifiers; | |||
| ModifierKeys HWNDComponentPeer::modifiersAtLastCallback; | |||
| ComponentPeer* Component::createNewPeer (int styleFlags, void* nativeWindowToAttachTo) | |||
| ComponentPeer* Component::createNewPeer (int styleFlags, void* parentHWND) | |||
| { | |||
| return new HWNDComponentPeer (*this, styleFlags, | |||
| (HWND) nativeWindowToAttachTo, false); | |||
| return new HWNDComponentPeer (*this, styleFlags, (HWND) parentHWND, false); | |||
| } | |||
| ComponentPeer* createNonRepaintingEmbeddedWindowsPeer (Component* component, void* parent) | |||
| ComponentPeer* createNonRepaintingEmbeddedWindowsPeer (Component& component, void* parentHWND) | |||
| { | |||
| jassert (component != nullptr); | |||
| return new HWNDComponentPeer (*component, ComponentPeer::windowIgnoresMouseClicks, | |||
| (HWND) parent, true); | |||
| return new HWNDComponentPeer (component, ComponentPeer::windowIgnoresMouseClicks, | |||
| (HWND) parentHWND, true); | |||
| } | |||
| @@ -418,7 +418,7 @@ private: | |||
| bool isEnabled : 1, isHeading : 1; | |||
| }; | |||
| OwnedArray <ItemInfo> items; | |||
| OwnedArray<ItemInfo> items; | |||
| Value currentId; | |||
| int lastCurrentId; | |||
| bool isButtonDown, separatorPending, menuActive, scrollWheelEnabled; | |||
| @@ -457,7 +457,7 @@ void ListBox::updateContent() | |||
| if (selected.size() > 0 && selected [selected.size() - 1] >= totalItems) | |||
| { | |||
| selected.removeRange (Range <int> (totalItems, std::numeric_limits<int>::max())); | |||
| selected.removeRange (Range<int> (totalItems, std::numeric_limits<int>::max())); | |||
| lastRowSelected = getSelectedRow (0); | |||
| selectionChanged = true; | |||
| } | |||
| @@ -516,7 +516,7 @@ void ListBox::deselectRow (const int row) | |||
| { | |||
| if (selected.contains (row)) | |||
| { | |||
| selected.removeRange (Range <int> (row, row + 1)); | |||
| selected.removeRange (Range<int> (row, row + 1)); | |||
| if (row == lastRowSelected) | |||
| lastRowSelected = getSelectedRow (0); | |||
| @@ -530,7 +530,7 @@ void ListBox::setSelectedRows (const SparseSet<int>& setOfRowsToBeSelected, | |||
| const NotificationType sendNotificationEventToModel) | |||
| { | |||
| selected = setOfRowsToBeSelected; | |||
| selected.removeRange (Range <int> (totalItems, std::numeric_limits<int>::max())); | |||
| selected.removeRange (Range<int> (totalItems, std::numeric_limits<int>::max())); | |||
| if (! isRowSelected (lastRowSelected)) | |||
| lastRowSelected = getSelectedRow (0); | |||
| @@ -554,10 +554,10 @@ void ListBox::selectRangeOfRows (int firstRow, int lastRow) | |||
| firstRow = jlimit (0, jmax (0, numRows), firstRow); | |||
| lastRow = jlimit (0, jmax (0, numRows), lastRow); | |||
| selected.addRange (Range <int> (jmin (firstRow, lastRow), | |||
| jmax (firstRow, lastRow) + 1)); | |||
| selected.addRange (Range<int> (jmin (firstRow, lastRow), | |||
| jmax (firstRow, lastRow) + 1)); | |||
| selected.removeRange (Range <int> (lastRow, lastRow + 1)); | |||
| selected.removeRange (Range<int> (lastRow, lastRow + 1)); | |||
| } | |||
| selectRowInternal (lastRow, false, false, true); | |||
| @@ -652,7 +652,7 @@ int ListBox::getInsertionIndexForPosition (const int x, const int y) const noexc | |||
| Component* ListBox::getComponentForRowNumber (const int row) const noexcept | |||
| { | |||
| if (RowComponent* const listRowComp = viewport->getComponentForRowIfOnscreen (row)) | |||
| return static_cast <Component*> (listRowComp->customComponent); | |||
| return static_cast<Component*> (listRowComp->customComponent); | |||
| return nullptr; | |||
| } | |||
| @@ -853,6 +853,11 @@ void ListBox::colourChanged() | |||
| repaint(); | |||
| } | |||
| void ListBox::parentHierarchyChanged() | |||
| { | |||
| colourChanged(); | |||
| } | |||
| void ListBox::setOutlineThickness (const int newThickness) | |||
| { | |||
| outlineThickness = newThickness; | |||
| @@ -540,6 +540,8 @@ public: | |||
| /** @internal */ | |||
| void colourChanged() override; | |||
| /** @internal */ | |||
| void parentHierarchyChanged() override; | |||
| /** @internal */ | |||
| void startDragAndDrop (const MouseEvent&, const var& dragDescription, bool allowDraggingToOtherWindows); | |||
| private: | |||
| @@ -320,12 +320,12 @@ public: | |||
| { | |||
| if (notification != dontSendNotification) | |||
| { | |||
| owner.valueChanged(); | |||
| if (notification == sendNotificationSync) | |||
| handleAsyncUpdate(); | |||
| else | |||
| triggerAsyncUpdate(); | |||
| owner.valueChanged(); | |||
| } | |||
| } | |||
| @@ -566,6 +566,7 @@ public: | |||
| valueBox->setWantsKeyboardFocus (false); | |||
| valueBox->setText (previousTextBoxContent, dontSendNotification); | |||
| valueBox->setTooltip (owner.getTooltip()); | |||
| if (valueBox->isEditable() != editableText) // (avoid overriding the single/double click flags unless we have to) | |||
| valueBox->setEditable (editableText && owner.isEnabled()); | |||
| @@ -577,10 +578,6 @@ public: | |||
| valueBox->addMouseListener (&owner, false); | |||
| valueBox->setMouseCursor (MouseCursor::ParentCursor); | |||
| } | |||
| else | |||
| { | |||
| valueBox->setTooltip (owner.getTooltip()); | |||
| } | |||
| } | |||
| else | |||
| { | |||
| @@ -404,7 +404,7 @@ void AlertWindow::updateLayout (const bool onlyIncreaseSize) | |||
| for (int i = textBlocks.size(); --i >= 0;) | |||
| { | |||
| const AlertTextComp* const ac = static_cast <const AlertTextComp*> (textBlocks.getUnchecked(i)); | |||
| const AlertTextComp* const ac = static_cast<const AlertTextComp*> (textBlocks.getUnchecked(i)); | |||
| w = jmax (w, ac->getPreferredWidth()); | |||
| } | |||
| @@ -412,7 +412,7 @@ void AlertWindow::updateLayout (const bool onlyIncreaseSize) | |||
| for (int i = textBlocks.size(); --i >= 0;) | |||
| { | |||
| AlertTextComp* const ac = static_cast <AlertTextComp*> (textBlocks.getUnchecked(i)); | |||
| AlertTextComp* const ac = static_cast<AlertTextComp*> (textBlocks.getUnchecked(i)); | |||
| ac->updateLayout ((int) (w * 0.8f)); | |||
| h += ac->getHeight() + 10; | |||
| } | |||
| @@ -470,11 +470,11 @@ void AlertWindow::updateLayout (const bool onlyIncreaseSize) | |||
| Component* const c = allComps.getUnchecked(i); | |||
| h = 22; | |||
| const int comboIndex = comboBoxes.indexOf (dynamic_cast <ComboBox*> (c)); | |||
| const int comboIndex = comboBoxes.indexOf (dynamic_cast<ComboBox*> (c)); | |||
| if (comboIndex >= 0 && comboBoxNames [comboIndex].isNotEmpty()) | |||
| y += labelHeight; | |||
| const int tbIndex = textBoxes.indexOf (dynamic_cast <TextEditor*> (c)); | |||
| const int tbIndex = textBoxes.indexOf (dynamic_cast<TextEditor*> (c)); | |||
| if (tbIndex >= 0 && textboxNames[tbIndex].isNotEmpty()) | |||
| y += labelHeight; | |||
| @@ -536,7 +536,8 @@ bool AlertWindow::keyPressed (const KeyPress& key) | |||
| exitModalState (0); | |||
| return true; | |||
| } | |||
| else if (key.isKeyCode (KeyPress::returnKey) && buttons.size() == 1) | |||
| if (key.isKeyCode (KeyPress::returnKey) && buttons.size() == 1) | |||
| { | |||
| buttons.getUnchecked(0)->triggerClick(); | |||
| return true; | |||
| @@ -592,8 +593,8 @@ private: | |||
| LookAndFeel& lf = associatedComponent != nullptr ? associatedComponent->getLookAndFeel() | |||
| : LookAndFeel::getDefaultLookAndFeel(); | |||
| ScopedPointer <Component> alertBox (lf.createAlertWindow (title, message, button1, button2, button3, | |||
| iconType, numButtons, associatedComponent)); | |||
| ScopedPointer<Component> alertBox (lf.createAlertWindow (title, message, button1, button2, button3, | |||
| iconType, numButtons, associatedComponent)); | |||
| jassert (alertBox != nullptr); // you have to return one of these! | |||
| @@ -614,7 +615,7 @@ private: | |||
| static void* showCallback (void* userData) | |||
| { | |||
| static_cast <AlertWindowInfo*> (userData)->show(); | |||
| static_cast<AlertWindowInfo*> (userData)->show(); | |||
| return nullptr; | |||
| } | |||
| }; | |||
| @@ -35,7 +35,7 @@ public: | |||
| const CodeDocument::Position& selStart, | |||
| const CodeDocument::Position& selEnd) | |||
| { | |||
| Array <SyntaxToken> newTokens; | |||
| Array<SyntaxToken> newTokens; | |||
| newTokens.ensureStorageAllocated (8); | |||
| if (tokeniser == nullptr) | |||
| @@ -129,13 +129,13 @@ private: | |||
| int tokenType; | |||
| }; | |||
| Array <SyntaxToken> tokens; | |||
| Array<SyntaxToken> tokens; | |||
| int highlightColumnStart, highlightColumnEnd; | |||
| static void createTokens (int startPosition, const String& lineText, | |||
| CodeDocument::Iterator& source, | |||
| CodeTokeniser& tokeniser, | |||
| Array <SyntaxToken>& newTokens) | |||
| Array<SyntaxToken>& newTokens) | |||
| { | |||
| CodeDocument::Iterator lastIterator (source); | |||
| const int lineLength = lineText.length(); | |||
| @@ -168,7 +168,7 @@ private: | |||
| source = lastIterator; | |||
| } | |||
| static void replaceTabsWithSpaces (Array <SyntaxToken>& tokens, const int spacesPerTab) | |||
| static void replaceTabsWithSpaces (Array<SyntaxToken>& tokens, const int spacesPerTab) | |||
| { | |||
| int x = 0; | |||
| for (int i = 0; i < tokens.size(); ++i) | |||
| @@ -412,7 +412,7 @@ bool CodeEditorComponent::isTextInputActive() const | |||
| return true; | |||
| } | |||
| void CodeEditorComponent::setTemporaryUnderlining (const Array <Range<int> >&) | |||
| void CodeEditorComponent::setTemporaryUnderlining (const Array<Range<int> >&) | |||
| { | |||
| jassertfalse; // TODO Windows IME not yet supported for this comp.. | |||
| } | |||
| @@ -1235,7 +1235,7 @@ ApplicationCommandTarget* CodeEditorComponent::getNextCommandTarget() | |||
| return findFirstTargetParentComponent(); | |||
| } | |||
| void CodeEditorComponent::getAllCommands (Array <CommandID>& commands) | |||
| void CodeEditorComponent::getAllCommands (Array<CommandID>& commands) | |||
| { | |||
| const CommandID ids[] = { StandardApplicationCommandIDs::cut, | |||
| StandardApplicationCommandIDs::copy, | |||
| @@ -40,17 +40,12 @@ | |||
| //============================================================================== | |||
| #if JUCE_MAC | |||
| #define Point CarbonDummyPointName | |||
| #define Component CarbonDummyCompName | |||
| #import <WebKit/WebKit.h> | |||
| #import <IOKit/IOKitLib.h> | |||
| #import <IOKit/IOCFPlugIn.h> | |||
| #import <IOKit/hid/IOHIDLib.h> | |||
| #import <IOKit/hid/IOHIDKeys.h> | |||
| #import <IOKit/pwr_mgt/IOPMLib.h> | |||
| #import <Carbon/Carbon.h> // still needed for SetSystemUIMode() | |||
| #undef Point | |||
| #undef Component | |||
| #elif JUCE_IOS | |||
| @@ -145,7 +145,7 @@ private: | |||
| ScopedPointer<Slider> sliders[4]; | |||
| ScopedPointer<ColourSpaceView> colourSpace; | |||
| ScopedPointer<HueSelectorComp> hueSelector; | |||
| OwnedArray <SwatchComponent> swatchComponents; | |||
| OwnedArray<SwatchComponent> swatchComponents; | |||
| const int flags; | |||
| int edgeGap; | |||
| Rectangle<int> previewArea; | |||
| @@ -70,6 +70,7 @@ private: | |||
| static void runOpenPanel (id, SEL, WebView*, id<WebOpenPanelResultListener> resultListener, BOOL allowMultipleFiles) | |||
| { | |||
| #if JUCE_MODAL_LOOPS_PERMITTED | |||
| FileChooser chooser (TRANS("Select the file you want to upload..."), | |||
| File::getSpecialLocation (File::userHomeDirectory), "*"); | |||
| @@ -81,6 +82,10 @@ private: | |||
| for (int i = 0; i < files.size(); ++i) | |||
| [resultListener chooseFilename: juceStringToNS (files.getReference(i).getFullPathName())]; | |||
| } | |||
| #else | |||
| (void) resultListener; (void) allowMultipleFiles; | |||
| jassertfalse; // Can't use this without modal loops being enabled! | |||
| #endif | |||
| } | |||
| }; | |||