| @@ -690,31 +690,24 @@ public: | |||||
| JUCE_ASIO_LOG ("showing control panel"); | JUCE_ASIO_LOG ("showing control panel"); | ||||
| bool done = false; | bool done = false; | ||||
| insideControlPanelModalLoop = true; | |||||
| JUCE_TRY | |||||
| { | |||||
| // are there are devices that need to be closed before showing their control panel? | |||||
| // close(); | |||||
| insideControlPanelModalLoop = true; | |||||
| const uint32 started = Time::getMillisecondCounter(); | |||||
| const uint32 started = Time::getMillisecondCounter(); | |||||
| if (asioObject != nullptr) | |||||
| { | |||||
| asioObject->controlPanel(); | |||||
| if (asioObject != nullptr) | |||||
| { | |||||
| asioObject->controlPanel(); | |||||
| const int spent = (int) Time::getMillisecondCounter() - (int) started; | |||||
| const int spent = (int) Time::getMillisecondCounter() - (int) started; | |||||
| JUCE_ASIO_LOG ("spent: " + String (spent)); | |||||
| JUCE_ASIO_LOG ("spent: " + String (spent)); | |||||
| if (spent > 300) | |||||
| { | |||||
| shouldUsePreferredSize = true; | |||||
| done = true; | |||||
| } | |||||
| if (spent > 300) | |||||
| { | |||||
| shouldUsePreferredSize = true; | |||||
| done = true; | |||||
| } | } | ||||
| } | } | ||||
| JUCE_CATCH_ALL | |||||
| insideControlPanelModalLoop = false; | insideControlPanelModalLoop = false; | ||||
| return done; | return done; | ||||
| @@ -182,11 +182,9 @@ namespace DSoundLogging | |||||
| } | } | ||||
| } | } | ||||
| #define CATCH JUCE_CATCH_EXCEPTION | |||||
| #define JUCE_DS_LOG(a) DSoundLogging::logMessage(a); | #define JUCE_DS_LOG(a) DSoundLogging::logMessage(a); | ||||
| #define JUCE_DS_LOG_ERROR(a) DSoundLogging::logError(a, __LINE__); | #define JUCE_DS_LOG_ERROR(a) DSoundLogging::logError(a, __LINE__); | ||||
| #else | #else | ||||
| #define CATCH JUCE_CATCH_ALL | |||||
| #define JUCE_DS_LOG(a) | #define JUCE_DS_LOG(a) | ||||
| #define JUCE_DS_LOG_ERROR(a) | #define JUCE_DS_LOG_ERROR(a) | ||||
| #endif | #endif | ||||
| @@ -1754,19 +1754,15 @@ public: | |||||
| if (! isActive) | if (! isActive) | ||||
| return; // Avoids redundantly calling things like setActive | return; // Avoids redundantly calling things like setActive | ||||
| JUCE_TRY | |||||
| { | |||||
| isActive = false; | |||||
| isActive = false; | |||||
| setStateForAllBusses (false); | |||||
| setStateForAllBusses (false); | |||||
| if (processor != nullptr) | |||||
| warnOnFailure (processor->setProcessing (false)); | |||||
| if (processor != nullptr) | |||||
| warnOnFailure (processor->setProcessing (false)); | |||||
| if (component != nullptr) | |||||
| warnOnFailure (component->setActive (false)); | |||||
| } | |||||
| JUCE_CATCH_ALL_ASSERT | |||||
| if (component != nullptr) | |||||
| warnOnFailure (component->setActive (false)); | |||||
| } | } | ||||
| bool supportsDoublePrecisionProcessing() const override | bool supportsDoublePrecisionProcessing() const override | ||||
| @@ -112,27 +112,26 @@ private: | |||||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (BluetoothMidiSelectorOverlay) | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (BluetoothMidiSelectorOverlay) | ||||
| }; | }; | ||||
| #endif // JUCE_MODULE_AVAILABLE_juce_gui_extra && ! TARGET_IPHONE_SIMULATOR | |||||
| //============================================================================== | |||||
| bool BluetoothMidiDevicePairingDialogue::open() | bool BluetoothMidiDevicePairingDialogue::open() | ||||
| { | { | ||||
| #if JUCE_MODULE_AVAILABLE_juce_gui_extra && ! TARGET_IPHONE_SIMULATOR | |||||
| if (isAvailable()) | if (isAvailable()) | ||||
| { | { | ||||
| new BluetoothMidiSelectorOverlay(); | new BluetoothMidiSelectorOverlay(); | ||||
| return true; | return true; | ||||
| } | } | ||||
| #endif | |||||
| return false; | return false; | ||||
| } | } | ||||
| bool BluetoothMidiDevicePairingDialogue::isAvailable() | bool BluetoothMidiDevicePairingDialogue::isAvailable() | ||||
| { | { | ||||
| #if JUCE_MODULE_AVAILABLE_juce_gui_extra && ! TARGET_IPHONE_SIMULATOR | |||||
| return NSClassFromString ([NSString stringWithUTF8String: "CABTMIDICentralViewController"]) != nil; | return NSClassFromString ([NSString stringWithUTF8String: "CABTMIDICentralViewController"]) != nil; | ||||
| #else | |||||
| return false; | |||||
| #endif | |||||
| } | } | ||||
| //============================================================================== | |||||
| #else | |||||
| bool BluetoothMidiDevicePairingDialogue::open() { return false; } | |||||
| bool BluetoothMidiDevicePairingDialogue::isAvailable() { return false; } | |||||
| #endif | |||||
| @@ -798,14 +798,8 @@ bool DirectoryIterator::NativeIterator::next (String& filenameFound, | |||||
| //============================================================================== | //============================================================================== | ||||
| bool JUCE_CALLTYPE Process::openDocument (const String& fileName, const String& parameters) | bool JUCE_CALLTYPE Process::openDocument (const String& fileName, const String& parameters) | ||||
| { | { | ||||
| HINSTANCE hInstance = 0; | |||||
| JUCE_TRY | |||||
| { | |||||
| hInstance = ShellExecute (0, 0, fileName.toWideCharPointer(), | |||||
| parameters.toWideCharPointer(), 0, SW_SHOWDEFAULT); | |||||
| } | |||||
| JUCE_CATCH_ALL | |||||
| HINSTANCE hInstance = ShellExecute (0, 0, fileName.toWideCharPointer(), | |||||
| parameters.toWideCharPointer(), 0, SW_SHOWDEFAULT); | |||||
| return hInstance > (HINSTANCE) 32; | return hInstance > (HINSTANCE) 32; | ||||
| } | } | ||||
| @@ -314,27 +314,17 @@ bool juce_isRunningInWine() | |||||
| bool DynamicLibrary::open (const String& name) | bool DynamicLibrary::open (const String& name) | ||||
| { | { | ||||
| close(); | close(); | ||||
| JUCE_TRY | |||||
| { | |||||
| handle = LoadLibrary (name.toWideCharPointer()); | |||||
| } | |||||
| JUCE_CATCH_ALL | |||||
| handle = LoadLibrary (name.toWideCharPointer()); | |||||
| return handle != nullptr; | return handle != nullptr; | ||||
| } | } | ||||
| void DynamicLibrary::close() | void DynamicLibrary::close() | ||||
| { | { | ||||
| JUCE_TRY | |||||
| if (handle != nullptr) | |||||
| { | { | ||||
| if (handle != nullptr) | |||||
| { | |||||
| FreeLibrary ((HMODULE) handle); | |||||
| handle = nullptr; | |||||
| } | |||||
| FreeLibrary ((HMODULE) handle); | |||||
| handle = nullptr; | |||||
| } | } | ||||
| JUCE_CATCH_ALL | |||||
| } | } | ||||
| void* DynamicLibrary::getFunction (const String& functionName) noexcept | void* DynamicLibrary::getFunction (const String& functionName) noexcept | ||||
| @@ -251,40 +251,6 @@ | |||||
| #endif | #endif | ||||
| //============================================================================== | |||||
| #if JUCE_CATCH_UNHANDLED_EXCEPTIONS | |||||
| #define JUCE_TRY try | |||||
| #define JUCE_CATCH_ALL catch (...) {} | |||||
| #define JUCE_CATCH_ALL_ASSERT catch (...) { jassertfalse; } | |||||
| #if ! JUCE_MODULE_AVAILABLE_juce_gui_basics | |||||
| #define JUCE_CATCH_EXCEPTION JUCE_CATCH_ALL | |||||
| #else | |||||
| /** Used in try-catch blocks, this macro will send exceptions to the JUCEApplicationBase | |||||
| object so they can be logged by the application if it wants to. | |||||
| */ | |||||
| #define JUCE_CATCH_EXCEPTION \ | |||||
| catch (const std::exception& e) \ | |||||
| { \ | |||||
| juce::JUCEApplicationBase::sendUnhandledException (&e, __FILE__, __LINE__); \ | |||||
| } \ | |||||
| catch (...) \ | |||||
| { \ | |||||
| juce::JUCEApplicationBase::sendUnhandledException (nullptr, __FILE__, __LINE__); \ | |||||
| } | |||||
| #endif | |||||
| #else | |||||
| #define JUCE_TRY | |||||
| #define JUCE_CATCH_EXCEPTION | |||||
| #define JUCE_CATCH_ALL | |||||
| #define JUCE_CATCH_ALL_ASSERT | |||||
| #endif | |||||
| //============================================================================== | //============================================================================== | ||||
| #if JUCE_DEBUG || DOXYGEN | #if JUCE_DEBUG || DOXYGEN | ||||
| /** A platform-independent way of forcing an inline function. | /** A platform-independent way of forcing an inline function. | ||||
| @@ -86,22 +86,25 @@ void Thread::threadEntryPoint() | |||||
| const CurrentThreadHolder::Ptr currentThreadHolder (getCurrentThreadHolder()); | const CurrentThreadHolder::Ptr currentThreadHolder (getCurrentThreadHolder()); | ||||
| currentThreadHolder->value = this; | currentThreadHolder->value = this; | ||||
| JUCE_TRY | |||||
| { | |||||
| if (threadName.isNotEmpty()) | |||||
| setCurrentThreadName (threadName); | |||||
| if (threadName.isNotEmpty()) | |||||
| setCurrentThreadName (threadName); | |||||
| if (startSuspensionEvent.wait (10000)) | |||||
| { | |||||
| jassert (getCurrentThreadId() == threadId); | |||||
| if (startSuspensionEvent.wait (10000)) | |||||
| { | |||||
| jassert (getCurrentThreadId() == threadId); | |||||
| if (affinityMask != 0) | |||||
| setCurrentThreadAffinityMask (affinityMask); | |||||
| if (affinityMask != 0) | |||||
| setCurrentThreadAffinityMask (affinityMask); | |||||
| try | |||||
| { | |||||
| run(); | run(); | ||||
| } | } | ||||
| catch (...) | |||||
| { | |||||
| jassertfalse; // Your run() method mustn't throw any exceptions! | |||||
| } | |||||
| } | } | ||||
| JUCE_CATCH_ALL_ASSERT | |||||
| currentThreadHolder->value.releaseCurrentThreadStorage(); | currentThreadHolder->value.releaseCurrentThreadStorage(); | ||||
| closeThreadHandle(); | closeThreadHandle(); | ||||
| @@ -336,11 +336,14 @@ bool ThreadPool::runNextJob (ThreadPoolThread& thread) | |||||
| ThreadPoolJob::JobStatus result = ThreadPoolJob::jobHasFinished; | ThreadPoolJob::JobStatus result = ThreadPoolJob::jobHasFinished; | ||||
| thread.currentJob = job; | thread.currentJob = job; | ||||
| JUCE_TRY | |||||
| try | |||||
| { | { | ||||
| result = job->runJob(); | result = job->runJob(); | ||||
| } | } | ||||
| JUCE_CATCH_ALL_ASSERT | |||||
| catch (...) | |||||
| { | |||||
| jassertfalse; // Your runJob() method mustn't throw any exceptions! | |||||
| } | |||||
| thread.currentJob = nullptr; | thread.currentJob = nullptr; | ||||
| @@ -38,10 +38,6 @@ | |||||
| #include "../juce_core/native/juce_BasicNativeHeaders.h" | #include "../juce_core/native/juce_BasicNativeHeaders.h" | ||||
| #include "juce_events.h" | #include "juce_events.h" | ||||
| #if JUCE_CATCH_UNHANDLED_EXCEPTIONS && JUCE_MODULE_AVAILABLE_juce_gui_basics | |||||
| #include "../juce_gui_basics/juce_gui_basics.h" | |||||
| #endif | |||||
| //============================================================================== | //============================================================================== | ||||
| #if JUCE_MAC | #if JUCE_MAC | ||||
| #import <IOKit/IOKitLib.h> | #import <IOKit/IOKitLib.h> | ||||
| @@ -279,4 +279,27 @@ private: | |||||
| }; | }; | ||||
| //============================================================================== | |||||
| #if JUCE_CATCH_UNHANDLED_EXCEPTIONS || defined (DOXYGEN) | |||||
| /** The JUCE_TRY/JUCE_CATCH_EXCEPTION wrappers can be used to pass any uncaught exceptions to | |||||
| the JUCEApplicationBase::sendUnhandledException() method. | |||||
| This functionality can be enabled with the JUCE_CATCH_UNHANDLED_EXCEPTIONS macro. | |||||
| */ | |||||
| #define JUCE_TRY try | |||||
| /** The JUCE_TRY/JUCE_CATCH_EXCEPTION wrappers can be used to pass any uncaught exceptions to | |||||
| the JUCEApplicationBase::sendUnhandledException() method. | |||||
| This functionality can be enabled with the JUCE_CATCH_UNHANDLED_EXCEPTIONS macro. | |||||
| */ | |||||
| #define JUCE_CATCH_EXCEPTION \ | |||||
| catch (const std::exception& e) { juce::JUCEApplicationBase::sendUnhandledException (&e, __FILE__, __LINE__); } \ | |||||
| catch (...) { juce::JUCEApplicationBase::sendUnhandledException (nullptr, __FILE__, __LINE__); } | |||||
| #else | |||||
| #define JUCE_TRY | |||||
| #define JUCE_CATCH_EXCEPTION | |||||
| #endif | |||||
| #endif // JUCE_APPLICATIONBASE_H_INCLUDED | #endif // JUCE_APPLICATIONBASE_H_INCLUDED | ||||
| @@ -32,8 +32,7 @@ class ActionBroadcaster; | |||||
| //============================================================================== | //============================================================================== | ||||
| /** See MessageManager::callFunctionOnMessageThread() for use of this function type | |||||
| */ | |||||
| /** See MessageManager::callFunctionOnMessageThread() for use of this function type. */ | |||||
| typedef void* (MessageCallbackFunction) (void* userData); | typedef void* (MessageCallbackFunction) (void* userData); | ||||
| @@ -159,9 +159,7 @@ void Typeface::setTypefaceCacheSize (int numFontsToCache) | |||||
| TypefaceCache::getInstance()->setSize (numFontsToCache); | TypefaceCache::getInstance()->setSize (numFontsToCache); | ||||
| } | } | ||||
| #if JUCE_MODULE_AVAILABLE_juce_opengl | |||||
| extern void clearOpenGLGlyphCache(); | |||||
| #endif | |||||
| void (*clearOpenGLGlyphCache)() = nullptr; | |||||
| void Typeface::clearTypefaceCache() | void Typeface::clearTypefaceCache() | ||||
| { | { | ||||
| @@ -169,9 +167,8 @@ void Typeface::clearTypefaceCache() | |||||
| RenderingHelpers::SoftwareRendererSavedState::clearGlyphCache(); | RenderingHelpers::SoftwareRendererSavedState::clearGlyphCache(); | ||||
| #if JUCE_MODULE_AVAILABLE_juce_opengl | |||||
| clearOpenGLGlyphCache(); | |||||
| #endif | |||||
| if (clearOpenGLGlyphCache != nullptr) | |||||
| clearOpenGLGlyphCache(); | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -40,10 +40,6 @@ | |||||
| #include "../juce_core/native/juce_BasicNativeHeaders.h" | #include "../juce_core/native/juce_BasicNativeHeaders.h" | ||||
| #include "juce_gui_basics.h" | #include "juce_gui_basics.h" | ||||
| #if JUCE_MODULE_AVAILABLE_juce_opengl | |||||
| #include "../juce_opengl/juce_opengl.h" | |||||
| #endif | |||||
| //============================================================================== | //============================================================================== | ||||
| #if JUCE_MAC | #if JUCE_MAC | ||||
| #import <WebKit/WebKit.h> | #import <WebKit/WebKit.h> | ||||
| @@ -1129,19 +1129,16 @@ public: | |||||
| JUCE_DECLARE_NON_COPYABLE (JuceDropTarget) | JUCE_DECLARE_NON_COPYABLE (JuceDropTarget) | ||||
| }; | }; | ||||
| #if JUCE_MODULE_AVAILABLE_juce_audio_plugin_client | |||||
| static bool offerKeyMessageToJUCEWindow (MSG& m) | static bool offerKeyMessageToJUCEWindow (MSG& m) | ||||
| { | { | ||||
| if (m.message == WM_KEYDOWN || m.message == WM_KEYUP) | if (m.message == WM_KEYDOWN || m.message == WM_KEYUP) | ||||
| if (Component::getCurrentlyFocusedComponent() != nullptr) | if (Component::getCurrentlyFocusedComponent() != nullptr) | ||||
| if (HWNDComponentPeer* h = getOwnerOfWindow (m.hwnd)) | if (HWNDComponentPeer* h = getOwnerOfWindow (m.hwnd)) | ||||
| if (m.message == WM_KEYDOWN ? h->doKeyDown (m.wParam) | |||||
| : h->doKeyUp (m.wParam)) | |||||
| return true; | |||||
| return m.message == WM_KEYDOWN ? h->doKeyDown (m.wParam) | |||||
| : h->doKeyUp (m.wParam); | |||||
| return false; | return false; | ||||
| } | } | ||||
| #endif | |||||
| private: | private: | ||||
| HWND hwnd, parentToAddTo; | HWND hwnd, parentToAddTo; | ||||
| @@ -3021,9 +3018,8 @@ bool KeyPress::isKeyCurrentlyDown (const int keyCode) | |||||
| return HWNDComponentPeer::isKeyDown (k); | return HWNDComponentPeer::isKeyDown (k); | ||||
| } | } | ||||
| #if JUCE_MODULE_AVAILABLE_juce_audio_plugin_client | |||||
| // (This internal function is used by the plugin client module) | |||||
| bool offerKeyMessageToJUCEWindow (MSG& m) { return HWNDComponentPeer::offerKeyMessageToJUCEWindow (m); } | bool offerKeyMessageToJUCEWindow (MSG& m) { return HWNDComponentPeer::offerKeyMessageToJUCEWindow (m); } | ||||
| #endif | |||||
| //============================================================================== | //============================================================================== | ||||
| bool JUCE_CALLTYPE Process::isForegroundProcess() | bool JUCE_CALLTYPE Process::isForegroundProcess() | ||||
| @@ -22,6 +22,8 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| */ | */ | ||||
| extern void (*clearOpenGLGlyphCache)(); // declared in juce_graphics | |||||
| namespace OpenGLRendering | namespace OpenGLRendering | ||||
| { | { | ||||
| @@ -1589,7 +1591,7 @@ public: | |||||
| } | } | ||||
| } | } | ||||
| typedef RenderingHelpers::GlyphCache <RenderingHelpers::CachedGlyphEdgeTable <SavedState>, SavedState> GlyphCacheType; | |||||
| typedef RenderingHelpers::GlyphCache<RenderingHelpers::CachedGlyphEdgeTable<SavedState>, SavedState> GlyphCacheType; | |||||
| void drawGlyph (int glyphNumber, const AffineTransform& trans) | void drawGlyph (int glyphNumber, const AffineTransform& trans) | ||||
| { | { | ||||
| @@ -1770,9 +1772,15 @@ private: | |||||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (NonShaderContext) | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (NonShaderContext) | ||||
| }; | }; | ||||
| LowLevelGraphicsContext* createOpenGLContext (const Target&); | |||||
| LowLevelGraphicsContext* createOpenGLContext (const Target& target) | |||||
| static void clearOpenGLGlyphCacheCallback() | |||||
| { | { | ||||
| SavedState::GlyphCacheType::getInstance().reset(); | |||||
| } | |||||
| static LowLevelGraphicsContext* createOpenGLContext (const Target& target) | |||||
| { | |||||
| clearOpenGLGlyphCache = clearOpenGLGlyphCacheCallback; | |||||
| if (target.context.areShadersAvailable()) | if (target.context.areShadersAvailable()) | ||||
| return new ShaderContext (target); | return new ShaderContext (target); | ||||
| @@ -1795,17 +1803,9 @@ LowLevelGraphicsContext* createOpenGLGraphicsContext (OpenGLContext& context, Op | |||||
| LowLevelGraphicsContext* createOpenGLGraphicsContext (OpenGLContext& context, unsigned int frameBufferID, int width, int height) | LowLevelGraphicsContext* createOpenGLGraphicsContext (OpenGLContext& context, unsigned int frameBufferID, int width, int height) | ||||
| { | { | ||||
| using namespace OpenGLRendering; | |||||
| return OpenGLRendering::createOpenGLContext (OpenGLRendering::Target (context, frameBufferID, width, height)); | return OpenGLRendering::createOpenGLContext (OpenGLRendering::Target (context, frameBufferID, width, height)); | ||||
| } | } | ||||
| void clearOpenGLGlyphCache(); | |||||
| void clearOpenGLGlyphCache() | |||||
| { | |||||
| OpenGLRendering::SavedState::GlyphCacheType::getInstance().reset(); | |||||
| } | |||||
| //============================================================================== | //============================================================================== | ||||
| struct CustomProgram : public ReferenceCountedObject, | struct CustomProgram : public ReferenceCountedObject, | ||||
| public OpenGLRendering::ShaderPrograms::ShaderBase | public OpenGLRendering::ShaderPrograms::ShaderBase | ||||