From a586966c65eb489296b1f2ab69658593d0606e93 Mon Sep 17 00:00:00 2001 From: jules Date: Tue, 28 Nov 2017 16:18:40 +0000 Subject: [PATCH] Added lambda callback methods to ListenerList. Its old method-invocation callbacks were refactored to use variadic templates instead of the old awful macros they used in the past, but please move your code to use the new lambda functions, as the one stuff will eventually be deprecated! --- .../Builds/Android/app/CMakeLists.txt | 2 - .../AnalyticsCollection_App.vcxproj | 3 - .../AnalyticsCollection_App.vcxproj.filters | 3 - .../AnimationAppExample_App.vcxproj | 3 - .../AnimationAppExample_App.vcxproj.filters | 3 - .../AudioAppExample_App.vcxproj | 3 - .../AudioAppExample_App.vcxproj.filters | 3 - .../BlocksDrawing_App.vcxproj | 3 - .../BlocksDrawing_App.vcxproj.filters | 3 - .../BlocksDrawing_App.vcxproj | 3 - .../BlocksDrawing_App.vcxproj.filters | 3 - .../BlocksDrawing/Source/LightpadComponent.h | 12 +- .../BlocksMonitor_App.vcxproj | 3 - .../BlocksMonitor_App.vcxproj.filters | 3 - .../BlocksMonitor_App.vcxproj | 3 - .../BlocksMonitor_App.vcxproj.filters | 3 - .../VisualStudio2015/BlocksSynth_App.vcxproj | 3 - .../BlocksSynth_App.vcxproj.filters | 3 - .../VisualStudio2017/BlocksSynth_App.vcxproj | 3 - .../BlocksSynth_App.vcxproj.filters | 3 - .../BouncingBallWavetableDemo_App.vcxproj | 3 - ...ncingBallWavetableDemo_App.vcxproj.filters | 3 - .../BouncingBallWavetableDemo_App.vcxproj | 3 - ...ncingBallWavetableDemo_App.vcxproj.filters | 3 - .../ComponentTutorialExample_App.vcxproj | 3 - ...mponentTutorialExample_App.vcxproj.filters | 3 - .../ComponentTutorialExample_App.vcxproj | 3 - ...mponentTutorialExample_App.vcxproj.filters | 3 - .../DSPModulePluginDemo_SharedCode.vcxproj | 3 - ...odulePluginDemo_SharedCode.vcxproj.filters | 3 - .../DSPModulePluginDemo_SharedCode.vcxproj | 3 - ...odulePluginDemo_SharedCode.vcxproj.filters | 3 - .../VisualStudio2017/DSPDemo_App.vcxproj | 3 - .../DSPDemo_App.vcxproj.filters | 3 - .../Demo/Builds/Android/app/CMakeLists.txt | 2 - .../VisualStudio2013/JuceDemo_App.vcxproj | 3 - .../JuceDemo_App.vcxproj.filters | 3 - .../VisualStudio2015/JuceDemo_App.vcxproj | 3 - .../JuceDemo_App.vcxproj.filters | 3 - .../VisualStudio2017/JuceDemo_App.vcxproj | 3 - .../JuceDemo_App.vcxproj.filters | 3 - .../VisualStudio2015/HelloWorld_App.vcxproj | 3 - .../HelloWorld_App.vcxproj.filters | 3 - .../VisualStudio2017/HelloWorld_App.vcxproj | 3 - .../HelloWorld_App.vcxproj.filters | 3 - .../Builds/Android/app/CMakeLists.txt | 2 - .../VisualStudio2015/MPETest_App.vcxproj | 3 - .../MPETest_App.vcxproj.filters | 3 - .../VisualStudio2017/MPETest_App.vcxproj | 3 - .../MPETest_App.vcxproj.filters | 3 - examples/MPETest/Source/MPESetupComponent.h | 32 +- .../Builds/Android/app/CMakeLists.txt | 2 - .../VisualStudio2015/MidiTest_App.vcxproj | 3 - .../MidiTest_App.vcxproj.filters | 3 - .../VisualStudio2017/MidiTest_App.vcxproj | 3 - .../MidiTest_App.vcxproj.filters | 3 - .../Builds/Android/app/CMakeLists.txt | 2 - .../JUCE Network Graphics Demo_App.vcxproj | 3 - ... Network Graphics Demo_App.vcxproj.filters | 3 - .../JUCE Network Graphics Demo_App.vcxproj | 3 - ... Network Graphics Demo_App.vcxproj.filters | 3 - .../VisualStudio2015/OSCMonitor_App.vcxproj | 3 - .../OSCMonitor_App.vcxproj.filters | 3 - .../VisualStudio2017/OSCMonitor_App.vcxproj | 3 - .../OSCMonitor_App.vcxproj.filters | 3 - .../Builds/Android/app/CMakeLists.txt | 2 - .../VisualStudio2015/OSCReceiver_App.vcxproj | 3 - .../OSCReceiver_App.vcxproj.filters | 3 - .../VisualStudio2017/OSCReceiver_App.vcxproj | 3 - .../OSCReceiver_App.vcxproj.filters | 3 - .../Builds/Android/app/CMakeLists.txt | 2 - .../VisualStudio2015/OSCSender_App.vcxproj | 3 - .../OSCSender_App.vcxproj.filters | 3 - .../VisualStudio2017/OSCSender_App.vcxproj | 3 - .../OSCSender_App.vcxproj.filters | 3 - .../OpenGLAppExample_App.vcxproj | 3 - .../OpenGLAppExample_App.vcxproj.filters | 3 - .../PluckedStringsDemo_App.vcxproj | 3 - .../PluckedStringsDemo_App.vcxproj.filters | 3 - .../PluckedStringsDemo_App.vcxproj | 3 - .../PluckedStringsDemo_App.vcxproj.filters | 3 - .../Arpeggiator_SharedCode.vcxproj | 3 - .../Arpeggiator_SharedCode.vcxproj.filters | 3 - .../Arpeggiator_SharedCode.vcxproj | 3 - .../Arpeggiator_SharedCode.vcxproj.filters | 3 - .../GainPlugIn_SharedCode.vcxproj | 3 - .../GainPlugIn_SharedCode.vcxproj.filters | 3 - .../GainPlugIn_SharedCode.vcxproj | 3 - .../GainPlugIn_SharedCode.vcxproj.filters | 3 - .../Source/IAAEffectProcessor.cpp | 5 +- .../MultiOutSynth_SharedCode.vcxproj | 3 - .../MultiOutSynth_SharedCode.vcxproj.filters | 3 - .../MultiOutSynth_SharedCode.vcxproj | 3 - .../MultiOutSynth_SharedCode.vcxproj.filters | 3 - .../NoiseGate_SharedCode.vcxproj | 3 - .../NoiseGate_SharedCode.vcxproj.filters | 3 - .../NoiseGate_SharedCode.vcxproj | 3 - .../NoiseGate_SharedCode.vcxproj.filters | 3 - .../Surround_SharedCode.vcxproj | 3 - .../Surround_SharedCode.vcxproj.filters | 3 - .../Surround_SharedCode.vcxproj | 3 - .../Surround_SharedCode.vcxproj.filters | 3 - .../Builds/Android/app/CMakeLists.txt | 2 - .../MacOSX/PushNotificationsDemo.entitlements | 8 + .../PushNotificationsDemo_App.vcxproj | 3 - .../PushNotificationsDemo_App.vcxproj.filters | 3 - .../SimpleFFTExample_App.vcxproj | 3 - .../SimpleFFTExample_App.vcxproj.filters | 3 - .../SimpleFFTExample_App.vcxproj | 3 - .../SimpleFFTExample_App.vcxproj.filters | 3 - .../Builds/Android/app/CMakeLists.txt | 2 - .../JuceDemoPlugin_SharedCode.vcxproj | 3 - .../JuceDemoPlugin_SharedCode.vcxproj.filters | 3 - .../JuceDemoPlugin_SharedCode.vcxproj | 3 - .../JuceDemoPlugin_SharedCode.vcxproj.filters | 3 - .../VisualStudio2013/Plugin Host_App.vcxproj | 3 - .../Plugin Host_App.vcxproj.filters | 3 - .../VisualStudio2015/Plugin Host_App.vcxproj | 3 - .../Plugin Host_App.vcxproj.filters | 3 - .../VisualStudio2017/Plugin Host_App.vcxproj | 3 - .../Plugin Host_App.vcxproj.filters | 3 - .../Builds/Android/app/CMakeLists.txt | 2 - .../AudioPerformanceTest_App.vcxproj | 3 - .../AudioPerformanceTest_App.vcxproj.filters | 3 - .../VisualStudio2013/Projucer_App.vcxproj | 3 - .../Projucer_App.vcxproj.filters | 3 - .../VisualStudio2015/Projucer_App.vcxproj | 3 - .../Projucer_App.vcxproj.filters | 3 - .../VisualStudio2017/Projucer_App.vcxproj | 3 - .../Projucer_App.vcxproj.filters | 3 - .../Source/Application/jucer_Application.cpp | 30 ++ .../CodeEditor/jucer_SourceCodeEditor.cpp | 2 +- .../Licenses/jucer_LicenseController.cpp | 6 +- .../LiveBuildEngine/jucer_ActivityList.h | 2 +- .../UnitTestRunner_ConsoleApp.vcxproj | 3 - .../UnitTestRunner_ConsoleApp.vcxproj.filters | 3 - .../BinaryBuilder_ConsoleApp.vcxproj | 3 - .../BinaryBuilder_ConsoleApp.vcxproj.filters | 3 - .../juce_dll_StaticLibrary.vcxproj | 3 - .../juce_dll_StaticLibrary.vcxproj.filters | 3 - .../mpe/juce_MPEInstrument.cpp | 56 +-- .../mpe/juce_MPEZoneLayout.cpp | 29 +- .../mpe/juce_MPEZoneLayout.h | 1 + .../audio_io/juce_AudioIODeviceType.cpp | 2 +- .../juce_AudioProcessorValueTreeState.cpp | 2 +- .../blocks/juce_TouchSurface.h | 2 +- .../topology/juce_PhysicalTopologySource.cpp | 22 +- .../topology/juce_RuleBasedTopologySource.cpp | 2 +- .../containers/juce_ListenerList.cpp | 189 ------- .../juce_core/containers/juce_ListenerList.h | 465 ++++-------------- modules/juce_core/juce_core.cpp | 1 - modules/juce_core/threads/juce_Thread.cpp | 4 +- modules/juce_core/threads/juce_ThreadPool.cpp | 2 +- .../values/juce_Value.cpp | 2 +- .../values/juce_ValueTree.cpp | 22 +- .../broadcasters/juce_ChangeBroadcaster.cpp | 2 +- modules/juce_graphics/images/juce_Image.cpp | 4 +- .../juce_gui_basics/buttons/juce_Button.cpp | 4 +- modules/juce_gui_basics/buttons/juce_Button.h | 6 +- .../juce_ApplicationCommandManager.cpp | 32 +- .../components/juce_Component.cpp | 45 +- .../components/juce_Desktop.cpp | 10 +- ...juce_DirectoryContentsDisplayComponent.cpp | 6 +- .../filebrowser/juce_FileBrowserComponent.cpp | 20 +- .../filebrowser/juce_FilenameComponent.cpp | 6 +- .../layout/juce_AnimatedPosition.h | 16 +- .../juce_gui_basics/layout/juce_ScrollBar.cpp | 6 +- .../menus/juce_MenuBarModel.cpp | 6 +- .../mouse/juce_MouseInactivityDetector.cpp | 11 +- .../mouse/juce_MouseInactivityDetector.h | 4 +- .../positioning/juce_MarkerList.cpp | 4 +- .../properties/juce_TextPropertyComponent.cpp | 2 +- .../juce_gui_basics/widgets/juce_ComboBox.cpp | 2 +- .../juce_gui_basics/widgets/juce_Label.cpp | 12 +- .../juce_gui_basics/widgets/juce_Slider.cpp | 10 +- .../widgets/juce_TextEditor.cpp | 8 +- .../code_editor/juce_CodeDocument.cpp | 4 +- .../misc/juce_PushNotifications.cpp | 4 +- .../native/juce_android_PushNotifications.cpp | 79 ++- .../native/juce_ios_PushNotifications.cpp | 30 +- .../native/juce_mac_PushNotifications.cpp | 30 +- modules/juce_osc/osc/juce_OSCReceiver.cpp | 20 +- .../in_app_purchases/juce_InAppPurchases.cpp | 8 +- .../native/juce_android_InAppPurchases.cpp | 9 +- .../native/juce_ios_InAppPurchases.cpp | 53 +- 185 files changed, 469 insertions(+), 1268 deletions(-) create mode 100644 examples/PushNotificationsDemo/Builds/MacOSX/PushNotificationsDemo.entitlements delete mode 100644 modules/juce_core/containers/juce_ListenerList.cpp diff --git a/examples/AnalyticsCollection/Builds/Android/app/CMakeLists.txt b/examples/AnalyticsCollection/Builds/Android/app/CMakeLists.txt index b203efc6e1..f56b85ccb2 100644 --- a/examples/AnalyticsCollection/Builds/Android/app/CMakeLists.txt +++ b/examples/AnalyticsCollection/Builds/Android/app/CMakeLists.txt @@ -52,7 +52,6 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_core/containers/juce_HashMap.h" "../../../../../modules/juce_core/containers/juce_HashMap_test.cpp" "../../../../../modules/juce_core/containers/juce_LinkedListPointer.h" - "../../../../../modules/juce_core/containers/juce_ListenerList.cpp" "../../../../../modules/juce_core/containers/juce_ListenerList.h" "../../../../../modules/juce_core/containers/juce_NamedValueSet.cpp" "../../../../../modules/juce_core/containers/juce_NamedValueSet.h" @@ -806,7 +805,6 @@ set_source_files_properties("../../../../../modules/juce_core/containers/juce_El set_source_files_properties("../../../../../modules/juce_core/containers/juce_HashMap.h" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_HashMap_test.cpp" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_LinkedListPointer.h" PROPERTIES HEADER_FILE_ONLY TRUE) -set_source_files_properties("../../../../../modules/juce_core/containers/juce_ListenerList.cpp" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_ListenerList.h" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_NamedValueSet.cpp" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_NamedValueSet.h" PROPERTIES HEADER_FILE_ONLY TRUE) diff --git a/examples/AnalyticsCollection/Builds/VisualStudio2017/AnalyticsCollection_App.vcxproj b/examples/AnalyticsCollection/Builds/VisualStudio2017/AnalyticsCollection_App.vcxproj index 5b04f18a96..87072634d2 100644 --- a/examples/AnalyticsCollection/Builds/VisualStudio2017/AnalyticsCollection_App.vcxproj +++ b/examples/AnalyticsCollection/Builds/VisualStudio2017/AnalyticsCollection_App.vcxproj @@ -170,9 +170,6 @@ true - - true - true diff --git a/examples/AnalyticsCollection/Builds/VisualStudio2017/AnalyticsCollection_App.vcxproj.filters b/examples/AnalyticsCollection/Builds/VisualStudio2017/AnalyticsCollection_App.vcxproj.filters index 0331e26fb9..ab01f68bdd 100644 --- a/examples/AnalyticsCollection/Builds/VisualStudio2017/AnalyticsCollection_App.vcxproj.filters +++ b/examples/AnalyticsCollection/Builds/VisualStudio2017/AnalyticsCollection_App.vcxproj.filters @@ -226,9 +226,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/AnimationAppExample/Builds/VisualStudio2017/AnimationAppExample_App.vcxproj b/examples/AnimationAppExample/Builds/VisualStudio2017/AnimationAppExample_App.vcxproj index a13757434e..d17c8ec8ef 100644 --- a/examples/AnimationAppExample/Builds/VisualStudio2017/AnimationAppExample_App.vcxproj +++ b/examples/AnimationAppExample/Builds/VisualStudio2017/AnimationAppExample_App.vcxproj @@ -531,9 +531,6 @@ true - - true - true diff --git a/examples/AnimationAppExample/Builds/VisualStudio2017/AnimationAppExample_App.vcxproj.filters b/examples/AnimationAppExample/Builds/VisualStudio2017/AnimationAppExample_App.vcxproj.filters index 5ae1115364..7a9bc15d0a 100644 --- a/examples/AnimationAppExample/Builds/VisualStudio2017/AnimationAppExample_App.vcxproj.filters +++ b/examples/AnimationAppExample/Builds/VisualStudio2017/AnimationAppExample_App.vcxproj.filters @@ -760,9 +760,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/AudioAppExample/Builds/VisualStudio2017/AudioAppExample_App.vcxproj b/examples/AudioAppExample/Builds/VisualStudio2017/AudioAppExample_App.vcxproj index 40f627f885..3d4d1c68c4 100644 --- a/examples/AudioAppExample/Builds/VisualStudio2017/AudioAppExample_App.vcxproj +++ b/examples/AudioAppExample/Builds/VisualStudio2017/AudioAppExample_App.vcxproj @@ -579,9 +579,6 @@ true - - true - true diff --git a/examples/AudioAppExample/Builds/VisualStudio2017/AudioAppExample_App.vcxproj.filters b/examples/AudioAppExample/Builds/VisualStudio2017/AudioAppExample_App.vcxproj.filters index 2b834c7e98..491e488251 100644 --- a/examples/AudioAppExample/Builds/VisualStudio2017/AudioAppExample_App.vcxproj.filters +++ b/examples/AudioAppExample/Builds/VisualStudio2017/AudioAppExample_App.vcxproj.filters @@ -838,9 +838,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/BLOCKS/BlocksDrawing/Builds/VisualStudio2015/BlocksDrawing_App.vcxproj b/examples/BLOCKS/BlocksDrawing/Builds/VisualStudio2015/BlocksDrawing_App.vcxproj index 41f0a96c2b..7a42343f95 100644 --- a/examples/BLOCKS/BlocksDrawing/Builds/VisualStudio2015/BlocksDrawing_App.vcxproj +++ b/examples/BLOCKS/BlocksDrawing/Builds/VisualStudio2015/BlocksDrawing_App.vcxproj @@ -597,9 +597,6 @@ true - - true - true diff --git a/examples/BLOCKS/BlocksDrawing/Builds/VisualStudio2015/BlocksDrawing_App.vcxproj.filters b/examples/BLOCKS/BlocksDrawing/Builds/VisualStudio2015/BlocksDrawing_App.vcxproj.filters index e2f4388cb5..7ab6873abe 100644 --- a/examples/BLOCKS/BlocksDrawing/Builds/VisualStudio2015/BlocksDrawing_App.vcxproj.filters +++ b/examples/BLOCKS/BlocksDrawing/Builds/VisualStudio2015/BlocksDrawing_App.vcxproj.filters @@ -853,9 +853,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/BLOCKS/BlocksDrawing/Builds/VisualStudio2017/BlocksDrawing_App.vcxproj b/examples/BLOCKS/BlocksDrawing/Builds/VisualStudio2017/BlocksDrawing_App.vcxproj index aa27647153..7935e26b8e 100644 --- a/examples/BLOCKS/BlocksDrawing/Builds/VisualStudio2017/BlocksDrawing_App.vcxproj +++ b/examples/BLOCKS/BlocksDrawing/Builds/VisualStudio2017/BlocksDrawing_App.vcxproj @@ -597,9 +597,6 @@ true - - true - true diff --git a/examples/BLOCKS/BlocksDrawing/Builds/VisualStudio2017/BlocksDrawing_App.vcxproj.filters b/examples/BLOCKS/BlocksDrawing/Builds/VisualStudio2017/BlocksDrawing_App.vcxproj.filters index 22964cd7cd..5cc1adcad9 100644 --- a/examples/BLOCKS/BlocksDrawing/Builds/VisualStudio2017/BlocksDrawing_App.vcxproj.filters +++ b/examples/BLOCKS/BlocksDrawing/Builds/VisualStudio2017/BlocksDrawing_App.vcxproj.filters @@ -853,9 +853,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/BLOCKS/BlocksDrawing/Source/LightpadComponent.h b/examples/BLOCKS/BlocksDrawing/Source/LightpadComponent.h index 557fc17c1d..3cba14c065 100644 --- a/examples/BLOCKS/BlocksDrawing/Source/LightpadComponent.h +++ b/examples/BLOCKS/BlocksDrawing/Source/LightpadComponent.h @@ -96,15 +96,9 @@ public: void mouseDown (const MouseEvent& e) override { for (auto x = 0; x < 15; ++x) - { for (auto y = 0; y < 15; ++y) - { if (leds.getUnchecked ((x * 15) + y)->getBounds().contains (e.position.toInt())) - { - listeners.call (&Listener::ledClicked, x, y, e.pressure); - } - } - } + listeners.call ([&] (Listener& l) { l.ledClicked (x, y, e.pressure); }); } void mouseDrag (const MouseEvent& e) override @@ -120,9 +114,9 @@ public: if (lastLED == Point (x, y) && t.toMilliseconds() - lastMouseEventTime.toMilliseconds() < 50) return; - listeners.call (&Listener::ledClicked, x, y, e.pressure); + listeners.call ([&] (Listener& l) { l.ledClicked (x, y, e.pressure); }); - lastLED = Point (x, y); + lastLED = { x, y }; lastMouseEventTime = t; } } diff --git a/examples/BLOCKS/BlocksMonitor/Builds/VisualStudio2015/BlocksMonitor_App.vcxproj b/examples/BLOCKS/BlocksMonitor/Builds/VisualStudio2015/BlocksMonitor_App.vcxproj index 37d46999af..e5bea57ae0 100644 --- a/examples/BLOCKS/BlocksMonitor/Builds/VisualStudio2015/BlocksMonitor_App.vcxproj +++ b/examples/BLOCKS/BlocksMonitor/Builds/VisualStudio2015/BlocksMonitor_App.vcxproj @@ -596,9 +596,6 @@ true - - true - true diff --git a/examples/BLOCKS/BlocksMonitor/Builds/VisualStudio2015/BlocksMonitor_App.vcxproj.filters b/examples/BLOCKS/BlocksMonitor/Builds/VisualStudio2015/BlocksMonitor_App.vcxproj.filters index d799903819..5a5f9059fe 100644 --- a/examples/BLOCKS/BlocksMonitor/Builds/VisualStudio2015/BlocksMonitor_App.vcxproj.filters +++ b/examples/BLOCKS/BlocksMonitor/Builds/VisualStudio2015/BlocksMonitor_App.vcxproj.filters @@ -850,9 +850,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/BLOCKS/BlocksMonitor/Builds/VisualStudio2017/BlocksMonitor_App.vcxproj b/examples/BLOCKS/BlocksMonitor/Builds/VisualStudio2017/BlocksMonitor_App.vcxproj index f32d996178..d4a2c7fc51 100644 --- a/examples/BLOCKS/BlocksMonitor/Builds/VisualStudio2017/BlocksMonitor_App.vcxproj +++ b/examples/BLOCKS/BlocksMonitor/Builds/VisualStudio2017/BlocksMonitor_App.vcxproj @@ -596,9 +596,6 @@ true - - true - true diff --git a/examples/BLOCKS/BlocksMonitor/Builds/VisualStudio2017/BlocksMonitor_App.vcxproj.filters b/examples/BLOCKS/BlocksMonitor/Builds/VisualStudio2017/BlocksMonitor_App.vcxproj.filters index 79fc5246cb..07c099b0bf 100644 --- a/examples/BLOCKS/BlocksMonitor/Builds/VisualStudio2017/BlocksMonitor_App.vcxproj.filters +++ b/examples/BLOCKS/BlocksMonitor/Builds/VisualStudio2017/BlocksMonitor_App.vcxproj.filters @@ -850,9 +850,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/BLOCKS/BlocksSynth/Builds/VisualStudio2015/BlocksSynth_App.vcxproj b/examples/BLOCKS/BlocksSynth/Builds/VisualStudio2015/BlocksSynth_App.vcxproj index f9da0f83b0..b01517fead 100644 --- a/examples/BLOCKS/BlocksSynth/Builds/VisualStudio2015/BlocksSynth_App.vcxproj +++ b/examples/BLOCKS/BlocksSynth/Builds/VisualStudio2015/BlocksSynth_App.vcxproj @@ -596,9 +596,6 @@ true - - true - true diff --git a/examples/BLOCKS/BlocksSynth/Builds/VisualStudio2015/BlocksSynth_App.vcxproj.filters b/examples/BLOCKS/BlocksSynth/Builds/VisualStudio2015/BlocksSynth_App.vcxproj.filters index 6ad0bf298e..40f406ada9 100644 --- a/examples/BLOCKS/BlocksSynth/Builds/VisualStudio2015/BlocksSynth_App.vcxproj.filters +++ b/examples/BLOCKS/BlocksSynth/Builds/VisualStudio2015/BlocksSynth_App.vcxproj.filters @@ -853,9 +853,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/BLOCKS/BlocksSynth/Builds/VisualStudio2017/BlocksSynth_App.vcxproj b/examples/BLOCKS/BlocksSynth/Builds/VisualStudio2017/BlocksSynth_App.vcxproj index 584d8c0889..f4c071ca44 100644 --- a/examples/BLOCKS/BlocksSynth/Builds/VisualStudio2017/BlocksSynth_App.vcxproj +++ b/examples/BLOCKS/BlocksSynth/Builds/VisualStudio2017/BlocksSynth_App.vcxproj @@ -596,9 +596,6 @@ true - - true - true diff --git a/examples/BLOCKS/BlocksSynth/Builds/VisualStudio2017/BlocksSynth_App.vcxproj.filters b/examples/BLOCKS/BlocksSynth/Builds/VisualStudio2017/BlocksSynth_App.vcxproj.filters index 10d20472d7..1f9906363c 100644 --- a/examples/BLOCKS/BlocksSynth/Builds/VisualStudio2017/BlocksSynth_App.vcxproj.filters +++ b/examples/BLOCKS/BlocksSynth/Builds/VisualStudio2017/BlocksSynth_App.vcxproj.filters @@ -853,9 +853,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/BouncingBallWavetableDemo/Builds/VisualStudio2013/BouncingBallWavetableDemo_App.vcxproj b/examples/BouncingBallWavetableDemo/Builds/VisualStudio2013/BouncingBallWavetableDemo_App.vcxproj index 9a8e761af9..0c18b15383 100644 --- a/examples/BouncingBallWavetableDemo/Builds/VisualStudio2013/BouncingBallWavetableDemo_App.vcxproj +++ b/examples/BouncingBallWavetableDemo/Builds/VisualStudio2013/BouncingBallWavetableDemo_App.vcxproj @@ -579,9 +579,6 @@ true - - true - true diff --git a/examples/BouncingBallWavetableDemo/Builds/VisualStudio2013/BouncingBallWavetableDemo_App.vcxproj.filters b/examples/BouncingBallWavetableDemo/Builds/VisualStudio2013/BouncingBallWavetableDemo_App.vcxproj.filters index d0bafb6ab0..b5ab01e7d7 100644 --- a/examples/BouncingBallWavetableDemo/Builds/VisualStudio2013/BouncingBallWavetableDemo_App.vcxproj.filters +++ b/examples/BouncingBallWavetableDemo/Builds/VisualStudio2013/BouncingBallWavetableDemo_App.vcxproj.filters @@ -823,9 +823,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/BouncingBallWavetableDemo/Builds/VisualStudio2017/BouncingBallWavetableDemo_App.vcxproj b/examples/BouncingBallWavetableDemo/Builds/VisualStudio2017/BouncingBallWavetableDemo_App.vcxproj index 84bd604b98..c337223d3a 100644 --- a/examples/BouncingBallWavetableDemo/Builds/VisualStudio2017/BouncingBallWavetableDemo_App.vcxproj +++ b/examples/BouncingBallWavetableDemo/Builds/VisualStudio2017/BouncingBallWavetableDemo_App.vcxproj @@ -579,9 +579,6 @@ true - - true - true diff --git a/examples/BouncingBallWavetableDemo/Builds/VisualStudio2017/BouncingBallWavetableDemo_App.vcxproj.filters b/examples/BouncingBallWavetableDemo/Builds/VisualStudio2017/BouncingBallWavetableDemo_App.vcxproj.filters index 6275a7c60b..d699094c94 100644 --- a/examples/BouncingBallWavetableDemo/Builds/VisualStudio2017/BouncingBallWavetableDemo_App.vcxproj.filters +++ b/examples/BouncingBallWavetableDemo/Builds/VisualStudio2017/BouncingBallWavetableDemo_App.vcxproj.filters @@ -823,9 +823,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/ComponentTutorialExample/Builds/VisualStudio2015/ComponentTutorialExample_App.vcxproj b/examples/ComponentTutorialExample/Builds/VisualStudio2015/ComponentTutorialExample_App.vcxproj index 580c74e03a..8bfd13bcc0 100644 --- a/examples/ComponentTutorialExample/Builds/VisualStudio2015/ComponentTutorialExample_App.vcxproj +++ b/examples/ComponentTutorialExample/Builds/VisualStudio2015/ComponentTutorialExample_App.vcxproj @@ -159,9 +159,6 @@ true - - true - true diff --git a/examples/ComponentTutorialExample/Builds/VisualStudio2015/ComponentTutorialExample_App.vcxproj.filters b/examples/ComponentTutorialExample/Builds/VisualStudio2015/ComponentTutorialExample_App.vcxproj.filters index ddbafe279e..e7079763cf 100644 --- a/examples/ComponentTutorialExample/Builds/VisualStudio2015/ComponentTutorialExample_App.vcxproj.filters +++ b/examples/ComponentTutorialExample/Builds/VisualStudio2015/ComponentTutorialExample_App.vcxproj.filters @@ -226,9 +226,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/ComponentTutorialExample/Builds/VisualStudio2017/ComponentTutorialExample_App.vcxproj b/examples/ComponentTutorialExample/Builds/VisualStudio2017/ComponentTutorialExample_App.vcxproj index ac57d9294c..ccea2b19e5 100644 --- a/examples/ComponentTutorialExample/Builds/VisualStudio2017/ComponentTutorialExample_App.vcxproj +++ b/examples/ComponentTutorialExample/Builds/VisualStudio2017/ComponentTutorialExample_App.vcxproj @@ -159,9 +159,6 @@ true - - true - true diff --git a/examples/ComponentTutorialExample/Builds/VisualStudio2017/ComponentTutorialExample_App.vcxproj.filters b/examples/ComponentTutorialExample/Builds/VisualStudio2017/ComponentTutorialExample_App.vcxproj.filters index 5b8e3106ea..ad00e681d9 100644 --- a/examples/ComponentTutorialExample/Builds/VisualStudio2017/ComponentTutorialExample_App.vcxproj.filters +++ b/examples/ComponentTutorialExample/Builds/VisualStudio2017/ComponentTutorialExample_App.vcxproj.filters @@ -226,9 +226,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/DSP module plugin demo/Builds/VisualStudio2015/DSPModulePluginDemo_SharedCode.vcxproj b/examples/DSP module plugin demo/Builds/VisualStudio2015/DSPModulePluginDemo_SharedCode.vcxproj index d36c16f85b..7312be5c8c 100644 --- a/examples/DSP module plugin demo/Builds/VisualStudio2015/DSPModulePluginDemo_SharedCode.vcxproj +++ b/examples/DSP module plugin demo/Builds/VisualStudio2015/DSPModulePluginDemo_SharedCode.vcxproj @@ -651,9 +651,6 @@ true - - true - true diff --git a/examples/DSP module plugin demo/Builds/VisualStudio2015/DSPModulePluginDemo_SharedCode.vcxproj.filters b/examples/DSP module plugin demo/Builds/VisualStudio2015/DSPModulePluginDemo_SharedCode.vcxproj.filters index 352fdcb618..ec2dabca98 100644 --- a/examples/DSP module plugin demo/Builds/VisualStudio2015/DSPModulePluginDemo_SharedCode.vcxproj.filters +++ b/examples/DSP module plugin demo/Builds/VisualStudio2015/DSPModulePluginDemo_SharedCode.vcxproj.filters @@ -937,9 +937,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/DSP module plugin demo/Builds/VisualStudio2017/DSPModulePluginDemo_SharedCode.vcxproj b/examples/DSP module plugin demo/Builds/VisualStudio2017/DSPModulePluginDemo_SharedCode.vcxproj index 76d5666104..4e4b25e1ef 100644 --- a/examples/DSP module plugin demo/Builds/VisualStudio2017/DSPModulePluginDemo_SharedCode.vcxproj +++ b/examples/DSP module plugin demo/Builds/VisualStudio2017/DSPModulePluginDemo_SharedCode.vcxproj @@ -652,9 +652,6 @@ true - - true - true diff --git a/examples/DSP module plugin demo/Builds/VisualStudio2017/DSPModulePluginDemo_SharedCode.vcxproj.filters b/examples/DSP module plugin demo/Builds/VisualStudio2017/DSPModulePluginDemo_SharedCode.vcxproj.filters index 46751c6198..daed5f961f 100644 --- a/examples/DSP module plugin demo/Builds/VisualStudio2017/DSPModulePluginDemo_SharedCode.vcxproj.filters +++ b/examples/DSP module plugin demo/Builds/VisualStudio2017/DSPModulePluginDemo_SharedCode.vcxproj.filters @@ -937,9 +937,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/DSPDemo/Builds/VisualStudio2017/DSPDemo_App.vcxproj b/examples/DSPDemo/Builds/VisualStudio2017/DSPDemo_App.vcxproj index 0af1327b6d..9086ec4d80 100644 --- a/examples/DSPDemo/Builds/VisualStudio2017/DSPDemo_App.vcxproj +++ b/examples/DSPDemo/Builds/VisualStudio2017/DSPDemo_App.vcxproj @@ -588,9 +588,6 @@ true - - true - true diff --git a/examples/DSPDemo/Builds/VisualStudio2017/DSPDemo_App.vcxproj.filters b/examples/DSPDemo/Builds/VisualStudio2017/DSPDemo_App.vcxproj.filters index b2a90ad782..feb15c7804 100644 --- a/examples/DSPDemo/Builds/VisualStudio2017/DSPDemo_App.vcxproj.filters +++ b/examples/DSPDemo/Builds/VisualStudio2017/DSPDemo_App.vcxproj.filters @@ -856,9 +856,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/Demo/Builds/Android/app/CMakeLists.txt b/examples/Demo/Builds/Android/app/CMakeLists.txt index 9ca57bc73c..25a55143c6 100644 --- a/examples/Demo/Builds/Android/app/CMakeLists.txt +++ b/examples/Demo/Builds/Android/app/CMakeLists.txt @@ -536,7 +536,6 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_core/containers/juce_HashMap.h" "../../../../../modules/juce_core/containers/juce_HashMap_test.cpp" "../../../../../modules/juce_core/containers/juce_LinkedListPointer.h" - "../../../../../modules/juce_core/containers/juce_ListenerList.cpp" "../../../../../modules/juce_core/containers/juce_ListenerList.h" "../../../../../modules/juce_core/containers/juce_NamedValueSet.cpp" "../../../../../modules/juce_core/containers/juce_NamedValueSet.h" @@ -1865,7 +1864,6 @@ set_source_files_properties("../../../../../modules/juce_core/containers/juce_El set_source_files_properties("../../../../../modules/juce_core/containers/juce_HashMap.h" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_HashMap_test.cpp" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_LinkedListPointer.h" PROPERTIES HEADER_FILE_ONLY TRUE) -set_source_files_properties("../../../../../modules/juce_core/containers/juce_ListenerList.cpp" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_ListenerList.h" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_NamedValueSet.cpp" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_NamedValueSet.h" PROPERTIES HEADER_FILE_ONLY TRUE) diff --git a/examples/Demo/Builds/VisualStudio2013/JuceDemo_App.vcxproj b/examples/Demo/Builds/VisualStudio2013/JuceDemo_App.vcxproj index 9260aed50f..865206343d 100644 --- a/examples/Demo/Builds/VisualStudio2013/JuceDemo_App.vcxproj +++ b/examples/Demo/Builds/VisualStudio2013/JuceDemo_App.vcxproj @@ -762,9 +762,6 @@ true - - true - true diff --git a/examples/Demo/Builds/VisualStudio2013/JuceDemo_App.vcxproj.filters b/examples/Demo/Builds/VisualStudio2013/JuceDemo_App.vcxproj.filters index dee71f0ca0..1acc5ef56f 100644 --- a/examples/Demo/Builds/VisualStudio2013/JuceDemo_App.vcxproj.filters +++ b/examples/Demo/Builds/VisualStudio2013/JuceDemo_App.vcxproj.filters @@ -1135,9 +1135,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/Demo/Builds/VisualStudio2015/JuceDemo_App.vcxproj b/examples/Demo/Builds/VisualStudio2015/JuceDemo_App.vcxproj index 6994438394..4f3b31a7e3 100644 --- a/examples/Demo/Builds/VisualStudio2015/JuceDemo_App.vcxproj +++ b/examples/Demo/Builds/VisualStudio2015/JuceDemo_App.vcxproj @@ -762,9 +762,6 @@ true - - true - true diff --git a/examples/Demo/Builds/VisualStudio2015/JuceDemo_App.vcxproj.filters b/examples/Demo/Builds/VisualStudio2015/JuceDemo_App.vcxproj.filters index 6542cee2fa..bbad95ced0 100644 --- a/examples/Demo/Builds/VisualStudio2015/JuceDemo_App.vcxproj.filters +++ b/examples/Demo/Builds/VisualStudio2015/JuceDemo_App.vcxproj.filters @@ -1135,9 +1135,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/Demo/Builds/VisualStudio2017/JuceDemo_App.vcxproj b/examples/Demo/Builds/VisualStudio2017/JuceDemo_App.vcxproj index 724b24c7db..c70e920172 100644 --- a/examples/Demo/Builds/VisualStudio2017/JuceDemo_App.vcxproj +++ b/examples/Demo/Builds/VisualStudio2017/JuceDemo_App.vcxproj @@ -762,9 +762,6 @@ true - - true - true diff --git a/examples/Demo/Builds/VisualStudio2017/JuceDemo_App.vcxproj.filters b/examples/Demo/Builds/VisualStudio2017/JuceDemo_App.vcxproj.filters index bd2b0fad2b..bb940a7fb5 100644 --- a/examples/Demo/Builds/VisualStudio2017/JuceDemo_App.vcxproj.filters +++ b/examples/Demo/Builds/VisualStudio2017/JuceDemo_App.vcxproj.filters @@ -1135,9 +1135,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/HelloWorld/Builds/VisualStudio2015/HelloWorld_App.vcxproj b/examples/HelloWorld/Builds/VisualStudio2015/HelloWorld_App.vcxproj index 3fdc109426..da74866b02 100644 --- a/examples/HelloWorld/Builds/VisualStudio2015/HelloWorld_App.vcxproj +++ b/examples/HelloWorld/Builds/VisualStudio2015/HelloWorld_App.vcxproj @@ -159,9 +159,6 @@ true - - true - true diff --git a/examples/HelloWorld/Builds/VisualStudio2015/HelloWorld_App.vcxproj.filters b/examples/HelloWorld/Builds/VisualStudio2015/HelloWorld_App.vcxproj.filters index 43ef549efc..38c38a9759 100644 --- a/examples/HelloWorld/Builds/VisualStudio2015/HelloWorld_App.vcxproj.filters +++ b/examples/HelloWorld/Builds/VisualStudio2015/HelloWorld_App.vcxproj.filters @@ -226,9 +226,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/HelloWorld/Builds/VisualStudio2017/HelloWorld_App.vcxproj b/examples/HelloWorld/Builds/VisualStudio2017/HelloWorld_App.vcxproj index 153cc20d20..edad529c8d 100644 --- a/examples/HelloWorld/Builds/VisualStudio2017/HelloWorld_App.vcxproj +++ b/examples/HelloWorld/Builds/VisualStudio2017/HelloWorld_App.vcxproj @@ -159,9 +159,6 @@ true - - true - true diff --git a/examples/HelloWorld/Builds/VisualStudio2017/HelloWorld_App.vcxproj.filters b/examples/HelloWorld/Builds/VisualStudio2017/HelloWorld_App.vcxproj.filters index b51607a2c8..8a1ce16f0a 100644 --- a/examples/HelloWorld/Builds/VisualStudio2017/HelloWorld_App.vcxproj.filters +++ b/examples/HelloWorld/Builds/VisualStudio2017/HelloWorld_App.vcxproj.filters @@ -226,9 +226,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/InAppPurchase/Builds/Android/app/CMakeLists.txt b/examples/InAppPurchase/Builds/Android/app/CMakeLists.txt index eae0a01093..26f473ccc3 100644 --- a/examples/InAppPurchase/Builds/Android/app/CMakeLists.txt +++ b/examples/InAppPurchase/Builds/Android/app/CMakeLists.txt @@ -411,7 +411,6 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_core/containers/juce_HashMap.h" "../../../../../modules/juce_core/containers/juce_HashMap_test.cpp" "../../../../../modules/juce_core/containers/juce_LinkedListPointer.h" - "../../../../../modules/juce_core/containers/juce_ListenerList.cpp" "../../../../../modules/juce_core/containers/juce_ListenerList.h" "../../../../../modules/juce_core/containers/juce_NamedValueSet.cpp" "../../../../../modules/juce_core/containers/juce_NamedValueSet.h" @@ -1657,7 +1656,6 @@ set_source_files_properties("../../../../../modules/juce_core/containers/juce_El set_source_files_properties("../../../../../modules/juce_core/containers/juce_HashMap.h" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_HashMap_test.cpp" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_LinkedListPointer.h" PROPERTIES HEADER_FILE_ONLY TRUE) -set_source_files_properties("../../../../../modules/juce_core/containers/juce_ListenerList.cpp" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_ListenerList.h" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_NamedValueSet.cpp" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_NamedValueSet.h" PROPERTIES HEADER_FILE_ONLY TRUE) diff --git a/examples/MPETest/Builds/VisualStudio2015/MPETest_App.vcxproj b/examples/MPETest/Builds/VisualStudio2015/MPETest_App.vcxproj index 52fafad83e..f4791c95f7 100644 --- a/examples/MPETest/Builds/VisualStudio2015/MPETest_App.vcxproj +++ b/examples/MPETest/Builds/VisualStudio2015/MPETest_App.vcxproj @@ -578,9 +578,6 @@ true - - true - true diff --git a/examples/MPETest/Builds/VisualStudio2015/MPETest_App.vcxproj.filters b/examples/MPETest/Builds/VisualStudio2015/MPETest_App.vcxproj.filters index 9dd7d6ca77..fd912789ac 100644 --- a/examples/MPETest/Builds/VisualStudio2015/MPETest_App.vcxproj.filters +++ b/examples/MPETest/Builds/VisualStudio2015/MPETest_App.vcxproj.filters @@ -835,9 +835,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/MPETest/Builds/VisualStudio2017/MPETest_App.vcxproj b/examples/MPETest/Builds/VisualStudio2017/MPETest_App.vcxproj index fd95805c31..2670460b5a 100644 --- a/examples/MPETest/Builds/VisualStudio2017/MPETest_App.vcxproj +++ b/examples/MPETest/Builds/VisualStudio2017/MPETest_App.vcxproj @@ -578,9 +578,6 @@ true - - true - true diff --git a/examples/MPETest/Builds/VisualStudio2017/MPETest_App.vcxproj.filters b/examples/MPETest/Builds/VisualStudio2017/MPETest_App.vcxproj.filters index e5eee952a2..e01d44ac82 100644 --- a/examples/MPETest/Builds/VisualStudio2017/MPETest_App.vcxproj.filters +++ b/examples/MPETest/Builds/VisualStudio2017/MPETest_App.vcxproj.filters @@ -835,9 +835,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/MPETest/Source/MPESetupComponent.h b/examples/MPETest/Source/MPESetupComponent.h index be25364095..ed26c2f1c3 100644 --- a/examples/MPETest/Source/MPESetupComponent.h +++ b/examples/MPETest/Source/MPESetupComponent.h @@ -173,7 +173,7 @@ private: masterPitchbendRange.getText().getIntValue()); zoneLayout.addZone (newZone); - listeners.call (&MPESetupComponent::Listener::zoneAdded, newZone); + listeners.call ([&] (Listener& l) { l.zoneAdded (newZone); }); } else { @@ -185,7 +185,7 @@ private: void clearAllZonesButtonClicked() { zoneLayout.clearAllZones(); - listeners.call (&MPESetupComponent::Listener::allZonesCleared); + listeners.call ([] (Listener& l) { l.allZonesCleared(); }); } //============================================================================== @@ -206,10 +206,9 @@ private: if (areLegacyModeParametersValid()) { - listeners.call (&MPESetupComponent::Listener::legacyModeChanged, - legacyModeEnabledToggle.getToggleState(), - legacyPitchbendRange.getText().getIntValue(), - getLegacyModeChannelRange()); + listeners.call ([&] (Listener& l) { l.legacyModeChanged (legacyModeEnabledToggle.getToggleState(), + legacyPitchbendRange.getText().getIntValue(), + getLegacyModeChannelRange()); }); } else { @@ -220,8 +219,8 @@ private: //============================================================================== void voiceStealingEnabledToggleClicked() { - listeners.call (&MPESetupComponent::Listener::voiceStealingEnabledChanged, - voiceStealingEnabledToggle.getToggleState()); + bool newState = voiceStealingEnabledToggle.getToggleState(); + listeners.call ([=] (Listener& l) { l.voiceStealingEnabledChanged (newState); }); } //============================================================================== @@ -231,7 +230,7 @@ private: { numberOfVoicesChanged(); } - else if (legacyModeEnabledToggle.getToggleState() == true) + else if (legacyModeEnabledToggle.getToggleState()) { if (comboBoxThatHasChanged == &legacyPitchbendRange) legacyModePitchbendRangeChanged(); @@ -243,17 +242,16 @@ private: //============================================================================== void numberOfVoicesChanged() { - listeners.call (&MPESetupComponent::Listener::numberOfVoicesChanged, - numberOfVoices.getText().getIntValue()); + listeners.call ([this] (Listener& l) { l.numberOfVoicesChanged (numberOfVoices.getText().getIntValue()); }); } void legacyModePitchbendRangeChanged() { jassert (legacyModeEnabledToggle.getToggleState() == true); - listeners.call (&MPESetupComponent::Listener::legacyModeChanged, true, - legacyPitchbendRange.getText().getIntValue(), - getLegacyModeChannelRange()); + listeners.call ([this] (Listener& l) { l.legacyModeChanged (true, + legacyPitchbendRange.getText().getIntValue(), + getLegacyModeChannelRange()); }); } void legacyModeChannelRangeChanged() @@ -262,9 +260,9 @@ private: if (areLegacyModeParametersValid()) { - listeners.call (&MPESetupComponent::Listener::legacyModeChanged, true, - legacyPitchbendRange.getText().getIntValue(), - getLegacyModeChannelRange()); + listeners.call ([this] (Listener& l) { l.legacyModeChanged (true, + legacyPitchbendRange.getText().getIntValue(), + getLegacyModeChannelRange()); }); } else { diff --git a/examples/MidiTest/Builds/Android/app/CMakeLists.txt b/examples/MidiTest/Builds/Android/app/CMakeLists.txt index c4edb7f534..9aec4b729e 100644 --- a/examples/MidiTest/Builds/Android/app/CMakeLists.txt +++ b/examples/MidiTest/Builds/Android/app/CMakeLists.txt @@ -387,7 +387,6 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_core/containers/juce_HashMap.h" "../../../../../modules/juce_core/containers/juce_HashMap_test.cpp" "../../../../../modules/juce_core/containers/juce_LinkedListPointer.h" - "../../../../../modules/juce_core/containers/juce_ListenerList.cpp" "../../../../../modules/juce_core/containers/juce_ListenerList.h" "../../../../../modules/juce_core/containers/juce_NamedValueSet.cpp" "../../../../../modules/juce_core/containers/juce_NamedValueSet.h" @@ -1541,7 +1540,6 @@ set_source_files_properties("../../../../../modules/juce_core/containers/juce_El set_source_files_properties("../../../../../modules/juce_core/containers/juce_HashMap.h" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_HashMap_test.cpp" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_LinkedListPointer.h" PROPERTIES HEADER_FILE_ONLY TRUE) -set_source_files_properties("../../../../../modules/juce_core/containers/juce_ListenerList.cpp" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_ListenerList.h" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_NamedValueSet.cpp" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_NamedValueSet.h" PROPERTIES HEADER_FILE_ONLY TRUE) diff --git a/examples/MidiTest/Builds/VisualStudio2015/MidiTest_App.vcxproj b/examples/MidiTest/Builds/VisualStudio2015/MidiTest_App.vcxproj index 8a5b00db89..2e7e967a5b 100644 --- a/examples/MidiTest/Builds/VisualStudio2015/MidiTest_App.vcxproj +++ b/examples/MidiTest/Builds/VisualStudio2015/MidiTest_App.vcxproj @@ -579,9 +579,6 @@ true - - true - true diff --git a/examples/MidiTest/Builds/VisualStudio2015/MidiTest_App.vcxproj.filters b/examples/MidiTest/Builds/VisualStudio2015/MidiTest_App.vcxproj.filters index 0a1fe0ee2c..33b9331d9d 100644 --- a/examples/MidiTest/Builds/VisualStudio2015/MidiTest_App.vcxproj.filters +++ b/examples/MidiTest/Builds/VisualStudio2015/MidiTest_App.vcxproj.filters @@ -802,9 +802,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/MidiTest/Builds/VisualStudio2017/MidiTest_App.vcxproj b/examples/MidiTest/Builds/VisualStudio2017/MidiTest_App.vcxproj index 3f910dc52e..228f2322e7 100644 --- a/examples/MidiTest/Builds/VisualStudio2017/MidiTest_App.vcxproj +++ b/examples/MidiTest/Builds/VisualStudio2017/MidiTest_App.vcxproj @@ -579,9 +579,6 @@ true - - true - true diff --git a/examples/MidiTest/Builds/VisualStudio2017/MidiTest_App.vcxproj.filters b/examples/MidiTest/Builds/VisualStudio2017/MidiTest_App.vcxproj.filters index bf65098245..a9b9067e26 100644 --- a/examples/MidiTest/Builds/VisualStudio2017/MidiTest_App.vcxproj.filters +++ b/examples/MidiTest/Builds/VisualStudio2017/MidiTest_App.vcxproj.filters @@ -802,9 +802,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/NetworkGraphicsDemo/Builds/Android/app/CMakeLists.txt b/examples/NetworkGraphicsDemo/Builds/Android/app/CMakeLists.txt index bb9a1e09db..b074be4e2f 100644 --- a/examples/NetworkGraphicsDemo/Builds/Android/app/CMakeLists.txt +++ b/examples/NetworkGraphicsDemo/Builds/Android/app/CMakeLists.txt @@ -390,7 +390,6 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_core/containers/juce_HashMap.h" "../../../../../modules/juce_core/containers/juce_HashMap_test.cpp" "../../../../../modules/juce_core/containers/juce_LinkedListPointer.h" - "../../../../../modules/juce_core/containers/juce_ListenerList.cpp" "../../../../../modules/juce_core/containers/juce_ListenerList.h" "../../../../../modules/juce_core/containers/juce_NamedValueSet.cpp" "../../../../../modules/juce_core/containers/juce_NamedValueSet.h" @@ -1619,7 +1618,6 @@ set_source_files_properties("../../../../../modules/juce_core/containers/juce_El set_source_files_properties("../../../../../modules/juce_core/containers/juce_HashMap.h" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_HashMap_test.cpp" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_LinkedListPointer.h" PROPERTIES HEADER_FILE_ONLY TRUE) -set_source_files_properties("../../../../../modules/juce_core/containers/juce_ListenerList.cpp" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_ListenerList.h" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_NamedValueSet.cpp" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_NamedValueSet.h" PROPERTIES HEADER_FILE_ONLY TRUE) diff --git a/examples/NetworkGraphicsDemo/Builds/VisualStudio2013/JUCE Network Graphics Demo_App.vcxproj b/examples/NetworkGraphicsDemo/Builds/VisualStudio2013/JUCE Network Graphics Demo_App.vcxproj index aefc254771..812aa60880 100644 --- a/examples/NetworkGraphicsDemo/Builds/VisualStudio2013/JUCE Network Graphics Demo_App.vcxproj +++ b/examples/NetworkGraphicsDemo/Builds/VisualStudio2013/JUCE Network Graphics Demo_App.vcxproj @@ -578,9 +578,6 @@ true - - true - true diff --git a/examples/NetworkGraphicsDemo/Builds/VisualStudio2013/JUCE Network Graphics Demo_App.vcxproj.filters b/examples/NetworkGraphicsDemo/Builds/VisualStudio2013/JUCE Network Graphics Demo_App.vcxproj.filters index 56e0fc8bb1..46f03713f2 100644 --- a/examples/NetworkGraphicsDemo/Builds/VisualStudio2013/JUCE Network Graphics Demo_App.vcxproj.filters +++ b/examples/NetworkGraphicsDemo/Builds/VisualStudio2013/JUCE Network Graphics Demo_App.vcxproj.filters @@ -829,9 +829,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/NetworkGraphicsDemo/Builds/VisualStudio2017/JUCE Network Graphics Demo_App.vcxproj b/examples/NetworkGraphicsDemo/Builds/VisualStudio2017/JUCE Network Graphics Demo_App.vcxproj index 18002b1ae4..3bcb18c1c9 100644 --- a/examples/NetworkGraphicsDemo/Builds/VisualStudio2017/JUCE Network Graphics Demo_App.vcxproj +++ b/examples/NetworkGraphicsDemo/Builds/VisualStudio2017/JUCE Network Graphics Demo_App.vcxproj @@ -578,9 +578,6 @@ true - - true - true diff --git a/examples/NetworkGraphicsDemo/Builds/VisualStudio2017/JUCE Network Graphics Demo_App.vcxproj.filters b/examples/NetworkGraphicsDemo/Builds/VisualStudio2017/JUCE Network Graphics Demo_App.vcxproj.filters index 6ab09d8fbf..e88d2578d4 100644 --- a/examples/NetworkGraphicsDemo/Builds/VisualStudio2017/JUCE Network Graphics Demo_App.vcxproj.filters +++ b/examples/NetworkGraphicsDemo/Builds/VisualStudio2017/JUCE Network Graphics Demo_App.vcxproj.filters @@ -829,9 +829,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/OSCMonitor/Builds/VisualStudio2015/OSCMonitor_App.vcxproj b/examples/OSCMonitor/Builds/VisualStudio2015/OSCMonitor_App.vcxproj index d942f840ba..e1a310c672 100644 --- a/examples/OSCMonitor/Builds/VisualStudio2015/OSCMonitor_App.vcxproj +++ b/examples/OSCMonitor/Builds/VisualStudio2015/OSCMonitor_App.vcxproj @@ -530,9 +530,6 @@ true - - true - true diff --git a/examples/OSCMonitor/Builds/VisualStudio2015/OSCMonitor_App.vcxproj.filters b/examples/OSCMonitor/Builds/VisualStudio2015/OSCMonitor_App.vcxproj.filters index ba6d2d9a2a..8440cc9aa2 100644 --- a/examples/OSCMonitor/Builds/VisualStudio2015/OSCMonitor_App.vcxproj.filters +++ b/examples/OSCMonitor/Builds/VisualStudio2015/OSCMonitor_App.vcxproj.filters @@ -763,9 +763,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/OSCMonitor/Builds/VisualStudio2017/OSCMonitor_App.vcxproj b/examples/OSCMonitor/Builds/VisualStudio2017/OSCMonitor_App.vcxproj index a88f0d93c6..f26b49bb75 100644 --- a/examples/OSCMonitor/Builds/VisualStudio2017/OSCMonitor_App.vcxproj +++ b/examples/OSCMonitor/Builds/VisualStudio2017/OSCMonitor_App.vcxproj @@ -530,9 +530,6 @@ true - - true - true diff --git a/examples/OSCMonitor/Builds/VisualStudio2017/OSCMonitor_App.vcxproj.filters b/examples/OSCMonitor/Builds/VisualStudio2017/OSCMonitor_App.vcxproj.filters index dfa5769799..952e1e9f35 100644 --- a/examples/OSCMonitor/Builds/VisualStudio2017/OSCMonitor_App.vcxproj.filters +++ b/examples/OSCMonitor/Builds/VisualStudio2017/OSCMonitor_App.vcxproj.filters @@ -763,9 +763,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/OSCReceiver/Builds/Android/app/CMakeLists.txt b/examples/OSCReceiver/Builds/Android/app/CMakeLists.txt index a11e76b265..d2fcd599ed 100644 --- a/examples/OSCReceiver/Builds/Android/app/CMakeLists.txt +++ b/examples/OSCReceiver/Builds/Android/app/CMakeLists.txt @@ -42,7 +42,6 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_core/containers/juce_HashMap.h" "../../../../../modules/juce_core/containers/juce_HashMap_test.cpp" "../../../../../modules/juce_core/containers/juce_LinkedListPointer.h" - "../../../../../modules/juce_core/containers/juce_ListenerList.cpp" "../../../../../modules/juce_core/containers/juce_ListenerList.h" "../../../../../modules/juce_core/containers/juce_NamedValueSet.cpp" "../../../../../modules/juce_core/containers/juce_NamedValueSet.h" @@ -882,7 +881,6 @@ set_source_files_properties("../../../../../modules/juce_core/containers/juce_El set_source_files_properties("../../../../../modules/juce_core/containers/juce_HashMap.h" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_HashMap_test.cpp" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_LinkedListPointer.h" PROPERTIES HEADER_FILE_ONLY TRUE) -set_source_files_properties("../../../../../modules/juce_core/containers/juce_ListenerList.cpp" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_ListenerList.h" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_NamedValueSet.cpp" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_NamedValueSet.h" PROPERTIES HEADER_FILE_ONLY TRUE) diff --git a/examples/OSCReceiver/Builds/VisualStudio2015/OSCReceiver_App.vcxproj b/examples/OSCReceiver/Builds/VisualStudio2015/OSCReceiver_App.vcxproj index 5db68d0975..3d149e8113 100644 --- a/examples/OSCReceiver/Builds/VisualStudio2015/OSCReceiver_App.vcxproj +++ b/examples/OSCReceiver/Builds/VisualStudio2015/OSCReceiver_App.vcxproj @@ -158,9 +158,6 @@ true - - true - true diff --git a/examples/OSCReceiver/Builds/VisualStudio2015/OSCReceiver_App.vcxproj.filters b/examples/OSCReceiver/Builds/VisualStudio2015/OSCReceiver_App.vcxproj.filters index c3c8c900c6..4d5be385f4 100644 --- a/examples/OSCReceiver/Builds/VisualStudio2015/OSCReceiver_App.vcxproj.filters +++ b/examples/OSCReceiver/Builds/VisualStudio2015/OSCReceiver_App.vcxproj.filters @@ -238,9 +238,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/OSCReceiver/Builds/VisualStudio2017/OSCReceiver_App.vcxproj b/examples/OSCReceiver/Builds/VisualStudio2017/OSCReceiver_App.vcxproj index f08c98067c..380fbdacd7 100644 --- a/examples/OSCReceiver/Builds/VisualStudio2017/OSCReceiver_App.vcxproj +++ b/examples/OSCReceiver/Builds/VisualStudio2017/OSCReceiver_App.vcxproj @@ -158,9 +158,6 @@ true - - true - true diff --git a/examples/OSCReceiver/Builds/VisualStudio2017/OSCReceiver_App.vcxproj.filters b/examples/OSCReceiver/Builds/VisualStudio2017/OSCReceiver_App.vcxproj.filters index afd6b47996..14951a9f47 100644 --- a/examples/OSCReceiver/Builds/VisualStudio2017/OSCReceiver_App.vcxproj.filters +++ b/examples/OSCReceiver/Builds/VisualStudio2017/OSCReceiver_App.vcxproj.filters @@ -238,9 +238,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/OSCSender/Builds/Android/app/CMakeLists.txt b/examples/OSCSender/Builds/Android/app/CMakeLists.txt index f270668c6c..cad5f84140 100644 --- a/examples/OSCSender/Builds/Android/app/CMakeLists.txt +++ b/examples/OSCSender/Builds/Android/app/CMakeLists.txt @@ -42,7 +42,6 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_core/containers/juce_HashMap.h" "../../../../../modules/juce_core/containers/juce_HashMap_test.cpp" "../../../../../modules/juce_core/containers/juce_LinkedListPointer.h" - "../../../../../modules/juce_core/containers/juce_ListenerList.cpp" "../../../../../modules/juce_core/containers/juce_ListenerList.h" "../../../../../modules/juce_core/containers/juce_NamedValueSet.cpp" "../../../../../modules/juce_core/containers/juce_NamedValueSet.h" @@ -804,7 +803,6 @@ set_source_files_properties("../../../../../modules/juce_core/containers/juce_El set_source_files_properties("../../../../../modules/juce_core/containers/juce_HashMap.h" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_HashMap_test.cpp" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_LinkedListPointer.h" PROPERTIES HEADER_FILE_ONLY TRUE) -set_source_files_properties("../../../../../modules/juce_core/containers/juce_ListenerList.cpp" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_ListenerList.h" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_NamedValueSet.cpp" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_NamedValueSet.h" PROPERTIES HEADER_FILE_ONLY TRUE) diff --git a/examples/OSCSender/Builds/VisualStudio2015/OSCSender_App.vcxproj b/examples/OSCSender/Builds/VisualStudio2015/OSCSender_App.vcxproj index 7da5e97ab3..8648224a7d 100644 --- a/examples/OSCSender/Builds/VisualStudio2015/OSCSender_App.vcxproj +++ b/examples/OSCSender/Builds/VisualStudio2015/OSCSender_App.vcxproj @@ -158,9 +158,6 @@ true - - true - true diff --git a/examples/OSCSender/Builds/VisualStudio2015/OSCSender_App.vcxproj.filters b/examples/OSCSender/Builds/VisualStudio2015/OSCSender_App.vcxproj.filters index 859ea1c9fa..f54ea18d00 100644 --- a/examples/OSCSender/Builds/VisualStudio2015/OSCSender_App.vcxproj.filters +++ b/examples/OSCSender/Builds/VisualStudio2015/OSCSender_App.vcxproj.filters @@ -211,9 +211,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/OSCSender/Builds/VisualStudio2017/OSCSender_App.vcxproj b/examples/OSCSender/Builds/VisualStudio2017/OSCSender_App.vcxproj index 3e6119c7b1..93f80a8860 100644 --- a/examples/OSCSender/Builds/VisualStudio2017/OSCSender_App.vcxproj +++ b/examples/OSCSender/Builds/VisualStudio2017/OSCSender_App.vcxproj @@ -158,9 +158,6 @@ true - - true - true diff --git a/examples/OSCSender/Builds/VisualStudio2017/OSCSender_App.vcxproj.filters b/examples/OSCSender/Builds/VisualStudio2017/OSCSender_App.vcxproj.filters index 96080c512c..bf6412a787 100644 --- a/examples/OSCSender/Builds/VisualStudio2017/OSCSender_App.vcxproj.filters +++ b/examples/OSCSender/Builds/VisualStudio2017/OSCSender_App.vcxproj.filters @@ -211,9 +211,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/OpenGLAppExample/Builds/VisualStudio2017/OpenGLAppExample_App.vcxproj b/examples/OpenGLAppExample/Builds/VisualStudio2017/OpenGLAppExample_App.vcxproj index e8b741843e..45e870d045 100644 --- a/examples/OpenGLAppExample/Builds/VisualStudio2017/OpenGLAppExample_App.vcxproj +++ b/examples/OpenGLAppExample/Builds/VisualStudio2017/OpenGLAppExample_App.vcxproj @@ -531,9 +531,6 @@ true - - true - true diff --git a/examples/OpenGLAppExample/Builds/VisualStudio2017/OpenGLAppExample_App.vcxproj.filters b/examples/OpenGLAppExample/Builds/VisualStudio2017/OpenGLAppExample_App.vcxproj.filters index dcb10d162d..22452c35f5 100644 --- a/examples/OpenGLAppExample/Builds/VisualStudio2017/OpenGLAppExample_App.vcxproj.filters +++ b/examples/OpenGLAppExample/Builds/VisualStudio2017/OpenGLAppExample_App.vcxproj.filters @@ -763,9 +763,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/PluckedStringsDemo/Builds/VisualStudio2013/PluckedStringsDemo_App.vcxproj b/examples/PluckedStringsDemo/Builds/VisualStudio2013/PluckedStringsDemo_App.vcxproj index 50ad59cfa5..a4adc76eb6 100644 --- a/examples/PluckedStringsDemo/Builds/VisualStudio2013/PluckedStringsDemo_App.vcxproj +++ b/examples/PluckedStringsDemo/Builds/VisualStudio2013/PluckedStringsDemo_App.vcxproj @@ -578,9 +578,6 @@ true - - true - true diff --git a/examples/PluckedStringsDemo/Builds/VisualStudio2013/PluckedStringsDemo_App.vcxproj.filters b/examples/PluckedStringsDemo/Builds/VisualStudio2013/PluckedStringsDemo_App.vcxproj.filters index 9bd3aff58f..ff1bccc264 100644 --- a/examples/PluckedStringsDemo/Builds/VisualStudio2013/PluckedStringsDemo_App.vcxproj.filters +++ b/examples/PluckedStringsDemo/Builds/VisualStudio2013/PluckedStringsDemo_App.vcxproj.filters @@ -799,9 +799,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/PluckedStringsDemo/Builds/VisualStudio2017/PluckedStringsDemo_App.vcxproj b/examples/PluckedStringsDemo/Builds/VisualStudio2017/PluckedStringsDemo_App.vcxproj index f239ce472b..b289ea8765 100644 --- a/examples/PluckedStringsDemo/Builds/VisualStudio2017/PluckedStringsDemo_App.vcxproj +++ b/examples/PluckedStringsDemo/Builds/VisualStudio2017/PluckedStringsDemo_App.vcxproj @@ -578,9 +578,6 @@ true - - true - true diff --git a/examples/PluckedStringsDemo/Builds/VisualStudio2017/PluckedStringsDemo_App.vcxproj.filters b/examples/PluckedStringsDemo/Builds/VisualStudio2017/PluckedStringsDemo_App.vcxproj.filters index 5e9a9685c2..425332bee8 100644 --- a/examples/PluckedStringsDemo/Builds/VisualStudio2017/PluckedStringsDemo_App.vcxproj.filters +++ b/examples/PluckedStringsDemo/Builds/VisualStudio2017/PluckedStringsDemo_App.vcxproj.filters @@ -799,9 +799,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/PlugInSamples/Arpeggiator/Builds/VisualStudio2015/Arpeggiator_SharedCode.vcxproj b/examples/PlugInSamples/Arpeggiator/Builds/VisualStudio2015/Arpeggiator_SharedCode.vcxproj index df7104cbc7..ef83e6b511 100644 --- a/examples/PlugInSamples/Arpeggiator/Builds/VisualStudio2015/Arpeggiator_SharedCode.vcxproj +++ b/examples/PlugInSamples/Arpeggiator/Builds/VisualStudio2015/Arpeggiator_SharedCode.vcxproj @@ -608,9 +608,6 @@ true - - true - true diff --git a/examples/PlugInSamples/Arpeggiator/Builds/VisualStudio2015/Arpeggiator_SharedCode.vcxproj.filters b/examples/PlugInSamples/Arpeggiator/Builds/VisualStudio2015/Arpeggiator_SharedCode.vcxproj.filters index dd743f2e8c..57d2ad5a53 100644 --- a/examples/PlugInSamples/Arpeggiator/Builds/VisualStudio2015/Arpeggiator_SharedCode.vcxproj.filters +++ b/examples/PlugInSamples/Arpeggiator/Builds/VisualStudio2015/Arpeggiator_SharedCode.vcxproj.filters @@ -853,9 +853,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/PlugInSamples/Arpeggiator/Builds/VisualStudio2017/Arpeggiator_SharedCode.vcxproj b/examples/PlugInSamples/Arpeggiator/Builds/VisualStudio2017/Arpeggiator_SharedCode.vcxproj index 209bcaaa26..ebd04968ff 100644 --- a/examples/PlugInSamples/Arpeggiator/Builds/VisualStudio2017/Arpeggiator_SharedCode.vcxproj +++ b/examples/PlugInSamples/Arpeggiator/Builds/VisualStudio2017/Arpeggiator_SharedCode.vcxproj @@ -602,9 +602,6 @@ true - - true - true diff --git a/examples/PlugInSamples/Arpeggiator/Builds/VisualStudio2017/Arpeggiator_SharedCode.vcxproj.filters b/examples/PlugInSamples/Arpeggiator/Builds/VisualStudio2017/Arpeggiator_SharedCode.vcxproj.filters index 1f3247db96..4197372bd4 100644 --- a/examples/PlugInSamples/Arpeggiator/Builds/VisualStudio2017/Arpeggiator_SharedCode.vcxproj.filters +++ b/examples/PlugInSamples/Arpeggiator/Builds/VisualStudio2017/Arpeggiator_SharedCode.vcxproj.filters @@ -853,9 +853,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/PlugInSamples/GainPlugIn/Builds/VisualStudio2015/GainPlugIn_SharedCode.vcxproj b/examples/PlugInSamples/GainPlugIn/Builds/VisualStudio2015/GainPlugIn_SharedCode.vcxproj index f7d9496e3a..83672e2884 100644 --- a/examples/PlugInSamples/GainPlugIn/Builds/VisualStudio2015/GainPlugIn_SharedCode.vcxproj +++ b/examples/PlugInSamples/GainPlugIn/Builds/VisualStudio2015/GainPlugIn_SharedCode.vcxproj @@ -608,9 +608,6 @@ true - - true - true diff --git a/examples/PlugInSamples/GainPlugIn/Builds/VisualStudio2015/GainPlugIn_SharedCode.vcxproj.filters b/examples/PlugInSamples/GainPlugIn/Builds/VisualStudio2015/GainPlugIn_SharedCode.vcxproj.filters index 8adf889699..0bdb3d64fa 100644 --- a/examples/PlugInSamples/GainPlugIn/Builds/VisualStudio2015/GainPlugIn_SharedCode.vcxproj.filters +++ b/examples/PlugInSamples/GainPlugIn/Builds/VisualStudio2015/GainPlugIn_SharedCode.vcxproj.filters @@ -853,9 +853,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/PlugInSamples/GainPlugIn/Builds/VisualStudio2017/GainPlugIn_SharedCode.vcxproj b/examples/PlugInSamples/GainPlugIn/Builds/VisualStudio2017/GainPlugIn_SharedCode.vcxproj index aade46ddbe..a36eeed394 100644 --- a/examples/PlugInSamples/GainPlugIn/Builds/VisualStudio2017/GainPlugIn_SharedCode.vcxproj +++ b/examples/PlugInSamples/GainPlugIn/Builds/VisualStudio2017/GainPlugIn_SharedCode.vcxproj @@ -602,9 +602,6 @@ true - - true - true diff --git a/examples/PlugInSamples/GainPlugIn/Builds/VisualStudio2017/GainPlugIn_SharedCode.vcxproj.filters b/examples/PlugInSamples/GainPlugIn/Builds/VisualStudio2017/GainPlugIn_SharedCode.vcxproj.filters index 22623800fc..0ea29f5db3 100644 --- a/examples/PlugInSamples/GainPlugIn/Builds/VisualStudio2017/GainPlugIn_SharedCode.vcxproj.filters +++ b/examples/PlugInSamples/GainPlugIn/Builds/VisualStudio2017/GainPlugIn_SharedCode.vcxproj.filters @@ -853,9 +853,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/PlugInSamples/InterAppAudioEffect/Source/IAAEffectProcessor.cpp b/examples/PlugInSamples/InterAppAudioEffect/Source/IAAEffectProcessor.cpp index a8e331a00b..8e25c4a4d7 100644 --- a/examples/PlugInSamples/InterAppAudioEffect/Source/IAAEffectProcessor.cpp +++ b/examples/PlugInSamples/InterAppAudioEffect/Source/IAAEffectProcessor.cpp @@ -131,10 +131,9 @@ void IAAEffectProcessor::processBlock (AudioBuffer& buffer, MidiBuffer&) for (int channel = 0; channel < totalNumInputChannels; ++channel) { buffer.applyGainRamp (channel, 0, numSamples, previousGain, gain); + auto newLevel = buffer.getMagnitude (channel, 0, numSamples); - meterListeners.call (&IAAEffectProcessor::MeterListener::handleNewMeterValue, - channel, - buffer.getMagnitude (channel, 0, numSamples)); + meterListeners.call ([=] (MeterListener& l) { l.handleNewMeterValue (channel, newLevel); }); } previousGain = gain; diff --git a/examples/PlugInSamples/MultiOutSynth/Builds/VisualStudio2015/MultiOutSynth_SharedCode.vcxproj b/examples/PlugInSamples/MultiOutSynth/Builds/VisualStudio2015/MultiOutSynth_SharedCode.vcxproj index d03012e231..90f2a63039 100644 --- a/examples/PlugInSamples/MultiOutSynth/Builds/VisualStudio2015/MultiOutSynth_SharedCode.vcxproj +++ b/examples/PlugInSamples/MultiOutSynth/Builds/VisualStudio2015/MultiOutSynth_SharedCode.vcxproj @@ -608,9 +608,6 @@ true - - true - true diff --git a/examples/PlugInSamples/MultiOutSynth/Builds/VisualStudio2015/MultiOutSynth_SharedCode.vcxproj.filters b/examples/PlugInSamples/MultiOutSynth/Builds/VisualStudio2015/MultiOutSynth_SharedCode.vcxproj.filters index 04c9b70548..2cc9115cc8 100644 --- a/examples/PlugInSamples/MultiOutSynth/Builds/VisualStudio2015/MultiOutSynth_SharedCode.vcxproj.filters +++ b/examples/PlugInSamples/MultiOutSynth/Builds/VisualStudio2015/MultiOutSynth_SharedCode.vcxproj.filters @@ -856,9 +856,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/PlugInSamples/MultiOutSynth/Builds/VisualStudio2017/MultiOutSynth_SharedCode.vcxproj b/examples/PlugInSamples/MultiOutSynth/Builds/VisualStudio2017/MultiOutSynth_SharedCode.vcxproj index 7027673c12..1ab82da8ca 100644 --- a/examples/PlugInSamples/MultiOutSynth/Builds/VisualStudio2017/MultiOutSynth_SharedCode.vcxproj +++ b/examples/PlugInSamples/MultiOutSynth/Builds/VisualStudio2017/MultiOutSynth_SharedCode.vcxproj @@ -602,9 +602,6 @@ true - - true - true diff --git a/examples/PlugInSamples/MultiOutSynth/Builds/VisualStudio2017/MultiOutSynth_SharedCode.vcxproj.filters b/examples/PlugInSamples/MultiOutSynth/Builds/VisualStudio2017/MultiOutSynth_SharedCode.vcxproj.filters index 3b638d759b..48d88f93b2 100644 --- a/examples/PlugInSamples/MultiOutSynth/Builds/VisualStudio2017/MultiOutSynth_SharedCode.vcxproj.filters +++ b/examples/PlugInSamples/MultiOutSynth/Builds/VisualStudio2017/MultiOutSynth_SharedCode.vcxproj.filters @@ -856,9 +856,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/PlugInSamples/NoiseGate/Builds/VisualStudio2015/NoiseGate_SharedCode.vcxproj b/examples/PlugInSamples/NoiseGate/Builds/VisualStudio2015/NoiseGate_SharedCode.vcxproj index 4f1044274f..0812f24e0f 100644 --- a/examples/PlugInSamples/NoiseGate/Builds/VisualStudio2015/NoiseGate_SharedCode.vcxproj +++ b/examples/PlugInSamples/NoiseGate/Builds/VisualStudio2015/NoiseGate_SharedCode.vcxproj @@ -608,9 +608,6 @@ true - - true - true diff --git a/examples/PlugInSamples/NoiseGate/Builds/VisualStudio2015/NoiseGate_SharedCode.vcxproj.filters b/examples/PlugInSamples/NoiseGate/Builds/VisualStudio2015/NoiseGate_SharedCode.vcxproj.filters index 99374b6014..0f5e6bc169 100644 --- a/examples/PlugInSamples/NoiseGate/Builds/VisualStudio2015/NoiseGate_SharedCode.vcxproj.filters +++ b/examples/PlugInSamples/NoiseGate/Builds/VisualStudio2015/NoiseGate_SharedCode.vcxproj.filters @@ -853,9 +853,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/PlugInSamples/NoiseGate/Builds/VisualStudio2017/NoiseGate_SharedCode.vcxproj b/examples/PlugInSamples/NoiseGate/Builds/VisualStudio2017/NoiseGate_SharedCode.vcxproj index 252f3e8701..71e642e580 100644 --- a/examples/PlugInSamples/NoiseGate/Builds/VisualStudio2017/NoiseGate_SharedCode.vcxproj +++ b/examples/PlugInSamples/NoiseGate/Builds/VisualStudio2017/NoiseGate_SharedCode.vcxproj @@ -602,9 +602,6 @@ true - - true - true diff --git a/examples/PlugInSamples/NoiseGate/Builds/VisualStudio2017/NoiseGate_SharedCode.vcxproj.filters b/examples/PlugInSamples/NoiseGate/Builds/VisualStudio2017/NoiseGate_SharedCode.vcxproj.filters index 37b9839995..99b478922c 100644 --- a/examples/PlugInSamples/NoiseGate/Builds/VisualStudio2017/NoiseGate_SharedCode.vcxproj.filters +++ b/examples/PlugInSamples/NoiseGate/Builds/VisualStudio2017/NoiseGate_SharedCode.vcxproj.filters @@ -853,9 +853,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/PlugInSamples/Surround/Builds/VisualStudio2015/Surround_SharedCode.vcxproj b/examples/PlugInSamples/Surround/Builds/VisualStudio2015/Surround_SharedCode.vcxproj index a48a95c327..50eb1c8bb7 100644 --- a/examples/PlugInSamples/Surround/Builds/VisualStudio2015/Surround_SharedCode.vcxproj +++ b/examples/PlugInSamples/Surround/Builds/VisualStudio2015/Surround_SharedCode.vcxproj @@ -602,9 +602,6 @@ true - - true - true diff --git a/examples/PlugInSamples/Surround/Builds/VisualStudio2015/Surround_SharedCode.vcxproj.filters b/examples/PlugInSamples/Surround/Builds/VisualStudio2015/Surround_SharedCode.vcxproj.filters index e964dbdeef..d4c7a1f3f7 100644 --- a/examples/PlugInSamples/Surround/Builds/VisualStudio2015/Surround_SharedCode.vcxproj.filters +++ b/examples/PlugInSamples/Surround/Builds/VisualStudio2015/Surround_SharedCode.vcxproj.filters @@ -853,9 +853,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/PlugInSamples/Surround/Builds/VisualStudio2017/Surround_SharedCode.vcxproj b/examples/PlugInSamples/Surround/Builds/VisualStudio2017/Surround_SharedCode.vcxproj index 0065b3cb31..9713384f20 100644 --- a/examples/PlugInSamples/Surround/Builds/VisualStudio2017/Surround_SharedCode.vcxproj +++ b/examples/PlugInSamples/Surround/Builds/VisualStudio2017/Surround_SharedCode.vcxproj @@ -602,9 +602,6 @@ true - - true - true diff --git a/examples/PlugInSamples/Surround/Builds/VisualStudio2017/Surround_SharedCode.vcxproj.filters b/examples/PlugInSamples/Surround/Builds/VisualStudio2017/Surround_SharedCode.vcxproj.filters index 68b49a5807..2999890d20 100644 --- a/examples/PlugInSamples/Surround/Builds/VisualStudio2017/Surround_SharedCode.vcxproj.filters +++ b/examples/PlugInSamples/Surround/Builds/VisualStudio2017/Surround_SharedCode.vcxproj.filters @@ -853,9 +853,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/PushNotificationsDemo/Builds/Android/app/CMakeLists.txt b/examples/PushNotificationsDemo/Builds/Android/app/CMakeLists.txt index 27bac28918..ea2dec0161 100644 --- a/examples/PushNotificationsDemo/Builds/Android/app/CMakeLists.txt +++ b/examples/PushNotificationsDemo/Builds/Android/app/CMakeLists.txt @@ -373,7 +373,6 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_core/containers/juce_HashMap.h" "../../../../../modules/juce_core/containers/juce_HashMap_test.cpp" "../../../../../modules/juce_core/containers/juce_LinkedListPointer.h" - "../../../../../modules/juce_core/containers/juce_ListenerList.cpp" "../../../../../modules/juce_core/containers/juce_ListenerList.h" "../../../../../modules/juce_core/containers/juce_NamedValueSet.cpp" "../../../../../modules/juce_core/containers/juce_NamedValueSet.h" @@ -1564,7 +1563,6 @@ set_source_files_properties("../../../../../modules/juce_core/containers/juce_El set_source_files_properties("../../../../../modules/juce_core/containers/juce_HashMap.h" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_HashMap_test.cpp" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_LinkedListPointer.h" PROPERTIES HEADER_FILE_ONLY TRUE) -set_source_files_properties("../../../../../modules/juce_core/containers/juce_ListenerList.cpp" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_ListenerList.h" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_NamedValueSet.cpp" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_NamedValueSet.h" PROPERTIES HEADER_FILE_ONLY TRUE) diff --git a/examples/PushNotificationsDemo/Builds/MacOSX/PushNotificationsDemo.entitlements b/examples/PushNotificationsDemo/Builds/MacOSX/PushNotificationsDemo.entitlements new file mode 100644 index 0000000000..1da788e485 --- /dev/null +++ b/examples/PushNotificationsDemo/Builds/MacOSX/PushNotificationsDemo.entitlements @@ -0,0 +1,8 @@ + + + + + com.apple.developer.aps-environment + development + + diff --git a/examples/PushNotificationsDemo/Builds/VisualStudio2015/PushNotificationsDemo_App.vcxproj b/examples/PushNotificationsDemo/Builds/VisualStudio2015/PushNotificationsDemo_App.vcxproj index b20b9216ee..5dff5e9d16 100644 --- a/examples/PushNotificationsDemo/Builds/VisualStudio2015/PushNotificationsDemo_App.vcxproj +++ b/examples/PushNotificationsDemo/Builds/VisualStudio2015/PushNotificationsDemo_App.vcxproj @@ -531,9 +531,6 @@ true - - true - true diff --git a/examples/PushNotificationsDemo/Builds/VisualStudio2015/PushNotificationsDemo_App.vcxproj.filters b/examples/PushNotificationsDemo/Builds/VisualStudio2015/PushNotificationsDemo_App.vcxproj.filters index a292292f8a..decdd7bc3a 100644 --- a/examples/PushNotificationsDemo/Builds/VisualStudio2015/PushNotificationsDemo_App.vcxproj.filters +++ b/examples/PushNotificationsDemo/Builds/VisualStudio2015/PushNotificationsDemo_App.vcxproj.filters @@ -757,9 +757,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/SimpleFFTExample/Builds/VisualStudio2013/SimpleFFTExample_App.vcxproj b/examples/SimpleFFTExample/Builds/VisualStudio2013/SimpleFFTExample_App.vcxproj index 2a8611c534..865c3e2f50 100644 --- a/examples/SimpleFFTExample/Builds/VisualStudio2013/SimpleFFTExample_App.vcxproj +++ b/examples/SimpleFFTExample/Builds/VisualStudio2013/SimpleFFTExample_App.vcxproj @@ -578,9 +578,6 @@ true - - true - true diff --git a/examples/SimpleFFTExample/Builds/VisualStudio2013/SimpleFFTExample_App.vcxproj.filters b/examples/SimpleFFTExample/Builds/VisualStudio2013/SimpleFFTExample_App.vcxproj.filters index 1302b375a2..28d4416e9b 100644 --- a/examples/SimpleFFTExample/Builds/VisualStudio2013/SimpleFFTExample_App.vcxproj.filters +++ b/examples/SimpleFFTExample/Builds/VisualStudio2013/SimpleFFTExample_App.vcxproj.filters @@ -820,9 +820,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/SimpleFFTExample/Builds/VisualStudio2017/SimpleFFTExample_App.vcxproj b/examples/SimpleFFTExample/Builds/VisualStudio2017/SimpleFFTExample_App.vcxproj index e9951206a4..fc7322363c 100644 --- a/examples/SimpleFFTExample/Builds/VisualStudio2017/SimpleFFTExample_App.vcxproj +++ b/examples/SimpleFFTExample/Builds/VisualStudio2017/SimpleFFTExample_App.vcxproj @@ -578,9 +578,6 @@ true - - true - true diff --git a/examples/SimpleFFTExample/Builds/VisualStudio2017/SimpleFFTExample_App.vcxproj.filters b/examples/SimpleFFTExample/Builds/VisualStudio2017/SimpleFFTExample_App.vcxproj.filters index e6d7730549..30e55c2e07 100644 --- a/examples/SimpleFFTExample/Builds/VisualStudio2017/SimpleFFTExample_App.vcxproj.filters +++ b/examples/SimpleFFTExample/Builds/VisualStudio2017/SimpleFFTExample_App.vcxproj.filters @@ -820,9 +820,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/audio plugin demo/Builds/Android/app/CMakeLists.txt b/examples/audio plugin demo/Builds/Android/app/CMakeLists.txt index 67ceaef99d..109346fecb 100644 --- a/examples/audio plugin demo/Builds/Android/app/CMakeLists.txt +++ b/examples/audio plugin demo/Builds/Android/app/CMakeLists.txt @@ -487,7 +487,6 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_core/containers/juce_HashMap.h" "../../../../../modules/juce_core/containers/juce_HashMap_test.cpp" "../../../../../modules/juce_core/containers/juce_LinkedListPointer.h" - "../../../../../modules/juce_core/containers/juce_ListenerList.cpp" "../../../../../modules/juce_core/containers/juce_ListenerList.h" "../../../../../modules/juce_core/containers/juce_NamedValueSet.cpp" "../../../../../modules/juce_core/containers/juce_NamedValueSet.h" @@ -1743,7 +1742,6 @@ set_source_files_properties("../../../../../modules/juce_core/containers/juce_El set_source_files_properties("../../../../../modules/juce_core/containers/juce_HashMap.h" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_HashMap_test.cpp" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_LinkedListPointer.h" PROPERTIES HEADER_FILE_ONLY TRUE) -set_source_files_properties("../../../../../modules/juce_core/containers/juce_ListenerList.cpp" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_ListenerList.h" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_NamedValueSet.cpp" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_NamedValueSet.h" PROPERTIES HEADER_FILE_ONLY TRUE) diff --git a/examples/audio plugin demo/Builds/VisualStudio2015/JuceDemoPlugin_SharedCode.vcxproj b/examples/audio plugin demo/Builds/VisualStudio2015/JuceDemoPlugin_SharedCode.vcxproj index 1d273fc82d..431c5d6bf7 100644 --- a/examples/audio plugin demo/Builds/VisualStudio2015/JuceDemoPlugin_SharedCode.vcxproj +++ b/examples/audio plugin demo/Builds/VisualStudio2015/JuceDemoPlugin_SharedCode.vcxproj @@ -651,9 +651,6 @@ true - - true - true diff --git a/examples/audio plugin demo/Builds/VisualStudio2015/JuceDemoPlugin_SharedCode.vcxproj.filters b/examples/audio plugin demo/Builds/VisualStudio2015/JuceDemoPlugin_SharedCode.vcxproj.filters index 98dd75d53b..6f7993310e 100644 --- a/examples/audio plugin demo/Builds/VisualStudio2015/JuceDemoPlugin_SharedCode.vcxproj.filters +++ b/examples/audio plugin demo/Builds/VisualStudio2015/JuceDemoPlugin_SharedCode.vcxproj.filters @@ -895,9 +895,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/audio plugin demo/Builds/VisualStudio2017/JuceDemoPlugin_SharedCode.vcxproj b/examples/audio plugin demo/Builds/VisualStudio2017/JuceDemoPlugin_SharedCode.vcxproj index 4bb92d9f25..846c1ba391 100644 --- a/examples/audio plugin demo/Builds/VisualStudio2017/JuceDemoPlugin_SharedCode.vcxproj +++ b/examples/audio plugin demo/Builds/VisualStudio2017/JuceDemoPlugin_SharedCode.vcxproj @@ -651,9 +651,6 @@ true - - true - true diff --git a/examples/audio plugin demo/Builds/VisualStudio2017/JuceDemoPlugin_SharedCode.vcxproj.filters b/examples/audio plugin demo/Builds/VisualStudio2017/JuceDemoPlugin_SharedCode.vcxproj.filters index 2e488ee624..d1ef36815d 100644 --- a/examples/audio plugin demo/Builds/VisualStudio2017/JuceDemoPlugin_SharedCode.vcxproj.filters +++ b/examples/audio plugin demo/Builds/VisualStudio2017/JuceDemoPlugin_SharedCode.vcxproj.filters @@ -895,9 +895,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/audio plugin host/Builds/VisualStudio2013/Plugin Host_App.vcxproj b/examples/audio plugin host/Builds/VisualStudio2013/Plugin Host_App.vcxproj index 1fbba4fd24..0342e49414 100644 --- a/examples/audio plugin host/Builds/VisualStudio2013/Plugin Host_App.vcxproj +++ b/examples/audio plugin host/Builds/VisualStudio2013/Plugin Host_App.vcxproj @@ -583,9 +583,6 @@ true - - true - true diff --git a/examples/audio plugin host/Builds/VisualStudio2013/Plugin Host_App.vcxproj.filters b/examples/audio plugin host/Builds/VisualStudio2013/Plugin Host_App.vcxproj.filters index 019159d646..230d2e31a2 100644 --- a/examples/audio plugin host/Builds/VisualStudio2013/Plugin Host_App.vcxproj.filters +++ b/examples/audio plugin host/Builds/VisualStudio2013/Plugin Host_App.vcxproj.filters @@ -847,9 +847,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/audio plugin host/Builds/VisualStudio2015/Plugin Host_App.vcxproj b/examples/audio plugin host/Builds/VisualStudio2015/Plugin Host_App.vcxproj index 107931df88..dd2a117b98 100644 --- a/examples/audio plugin host/Builds/VisualStudio2015/Plugin Host_App.vcxproj +++ b/examples/audio plugin host/Builds/VisualStudio2015/Plugin Host_App.vcxproj @@ -583,9 +583,6 @@ true - - true - true diff --git a/examples/audio plugin host/Builds/VisualStudio2015/Plugin Host_App.vcxproj.filters b/examples/audio plugin host/Builds/VisualStudio2015/Plugin Host_App.vcxproj.filters index 2bb073ad61..e3bcafeab6 100644 --- a/examples/audio plugin host/Builds/VisualStudio2015/Plugin Host_App.vcxproj.filters +++ b/examples/audio plugin host/Builds/VisualStudio2015/Plugin Host_App.vcxproj.filters @@ -847,9 +847,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/examples/audio plugin host/Builds/VisualStudio2017/Plugin Host_App.vcxproj b/examples/audio plugin host/Builds/VisualStudio2017/Plugin Host_App.vcxproj index 7731ba4d12..577df8be75 100644 --- a/examples/audio plugin host/Builds/VisualStudio2017/Plugin Host_App.vcxproj +++ b/examples/audio plugin host/Builds/VisualStudio2017/Plugin Host_App.vcxproj @@ -583,9 +583,6 @@ true - - true - true diff --git a/examples/audio plugin host/Builds/VisualStudio2017/Plugin Host_App.vcxproj.filters b/examples/audio plugin host/Builds/VisualStudio2017/Plugin Host_App.vcxproj.filters index f1cca067f0..a4ec46092f 100644 --- a/examples/audio plugin host/Builds/VisualStudio2017/Plugin Host_App.vcxproj.filters +++ b/examples/audio plugin host/Builds/VisualStudio2017/Plugin Host_App.vcxproj.filters @@ -847,9 +847,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/extras/AudioPerformanceTest/Builds/Android/app/CMakeLists.txt b/extras/AudioPerformanceTest/Builds/Android/app/CMakeLists.txt index 4e0c273bd0..080546b919 100644 --- a/extras/AudioPerformanceTest/Builds/Android/app/CMakeLists.txt +++ b/extras/AudioPerformanceTest/Builds/Android/app/CMakeLists.txt @@ -386,7 +386,6 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_core/containers/juce_HashMap.h" "../../../../../modules/juce_core/containers/juce_HashMap_test.cpp" "../../../../../modules/juce_core/containers/juce_LinkedListPointer.h" - "../../../../../modules/juce_core/containers/juce_ListenerList.cpp" "../../../../../modules/juce_core/containers/juce_ListenerList.h" "../../../../../modules/juce_core/containers/juce_NamedValueSet.cpp" "../../../../../modules/juce_core/containers/juce_NamedValueSet.h" @@ -1540,7 +1539,6 @@ set_source_files_properties("../../../../../modules/juce_core/containers/juce_El set_source_files_properties("../../../../../modules/juce_core/containers/juce_HashMap.h" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_HashMap_test.cpp" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_LinkedListPointer.h" PROPERTIES HEADER_FILE_ONLY TRUE) -set_source_files_properties("../../../../../modules/juce_core/containers/juce_ListenerList.cpp" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_ListenerList.h" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_NamedValueSet.cpp" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/containers/juce_NamedValueSet.h" PROPERTIES HEADER_FILE_ONLY TRUE) diff --git a/extras/AudioPerformanceTest/Builds/VisualStudio2015/AudioPerformanceTest_App.vcxproj b/extras/AudioPerformanceTest/Builds/VisualStudio2015/AudioPerformanceTest_App.vcxproj index d8f85c6bdf..9d6f071527 100644 --- a/extras/AudioPerformanceTest/Builds/VisualStudio2015/AudioPerformanceTest_App.vcxproj +++ b/extras/AudioPerformanceTest/Builds/VisualStudio2015/AudioPerformanceTest_App.vcxproj @@ -578,9 +578,6 @@ true - - true - true diff --git a/extras/AudioPerformanceTest/Builds/VisualStudio2015/AudioPerformanceTest_App.vcxproj.filters b/extras/AudioPerformanceTest/Builds/VisualStudio2015/AudioPerformanceTest_App.vcxproj.filters index 7ee827bcde..86b299445e 100644 --- a/extras/AudioPerformanceTest/Builds/VisualStudio2015/AudioPerformanceTest_App.vcxproj.filters +++ b/extras/AudioPerformanceTest/Builds/VisualStudio2015/AudioPerformanceTest_App.vcxproj.filters @@ -799,9 +799,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/extras/Projucer/Builds/VisualStudio2013/Projucer_App.vcxproj b/extras/Projucer/Builds/VisualStudio2013/Projucer_App.vcxproj index 0343a17600..2e43207beb 100644 --- a/extras/Projucer/Builds/VisualStudio2013/Projucer_App.vcxproj +++ b/extras/Projucer/Builds/VisualStudio2013/Projucer_App.vcxproj @@ -253,9 +253,6 @@ true - - true - true diff --git a/extras/Projucer/Builds/VisualStudio2013/Projucer_App.vcxproj.filters b/extras/Projucer/Builds/VisualStudio2013/Projucer_App.vcxproj.filters index 89851da244..cc50137afb 100644 --- a/extras/Projucer/Builds/VisualStudio2013/Projucer_App.vcxproj.filters +++ b/extras/Projucer/Builds/VisualStudio2013/Projucer_App.vcxproj.filters @@ -502,9 +502,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/extras/Projucer/Builds/VisualStudio2015/Projucer_App.vcxproj b/extras/Projucer/Builds/VisualStudio2015/Projucer_App.vcxproj index 5d67556fb0..172ae90cc7 100644 --- a/extras/Projucer/Builds/VisualStudio2015/Projucer_App.vcxproj +++ b/extras/Projucer/Builds/VisualStudio2015/Projucer_App.vcxproj @@ -253,9 +253,6 @@ true - - true - true diff --git a/extras/Projucer/Builds/VisualStudio2015/Projucer_App.vcxproj.filters b/extras/Projucer/Builds/VisualStudio2015/Projucer_App.vcxproj.filters index facd9bd391..617f9b04a6 100644 --- a/extras/Projucer/Builds/VisualStudio2015/Projucer_App.vcxproj.filters +++ b/extras/Projucer/Builds/VisualStudio2015/Projucer_App.vcxproj.filters @@ -502,9 +502,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj b/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj index fd95b7edf6..fcf6cd1a87 100644 --- a/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj +++ b/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj @@ -253,9 +253,6 @@ true - - true - true diff --git a/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj.filters b/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj.filters index 740ef42bee..8607abb9c6 100644 --- a/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj.filters +++ b/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj.filters @@ -502,9 +502,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/extras/Projucer/Source/Application/jucer_Application.cpp b/extras/Projucer/Source/Application/jucer_Application.cpp index 8c9d6ef7be..64b05b9635 100644 --- a/extras/Projucer/Source/Application/jucer_Application.cpp +++ b/extras/Projucer/Source/Application/jucer_Application.cpp @@ -28,6 +28,36 @@ void createGUIEditorMenu (PopupMenu&); void handleGUIEditorMenuCommand (int); void registerGUIEditorCommands(); + + void attachCallback (Button& button, std::function callback) + { + struct ButtonCallback : public Button::Listener, + private ComponentListener + { + ButtonCallback (Button& b, std::function f) : target (b), fn (f) + { + target.addListener (this); + target.addComponentListener (this); + } + + ~ButtonCallback() + { + target.removeListener (this); + } + + void componentBeingDeleted (Component&) override { delete this; } + void buttonClicked (Button*) override { fn(); } + + Button& target; + std::function fn; + + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ButtonCallback) + }; + + new ButtonCallback (button, callback); + } + + //============================================================================== struct ProjucerApplication::MainMenuModel : public MenuBarModel { diff --git a/extras/Projucer/Source/CodeEditor/jucer_SourceCodeEditor.cpp b/extras/Projucer/Source/CodeEditor/jucer_SourceCodeEditor.cpp index 8f79c2a2b5..1ec95f4435 100644 --- a/extras/Projucer/Source/CodeEditor/jucer_SourceCodeEditor.cpp +++ b/extras/Projucer/Source/CodeEditor/jucer_SourceCodeEditor.cpp @@ -550,7 +550,7 @@ void GenericCodeEditorComponent::handleEscapeKey() void GenericCodeEditorComponent::editorViewportPositionChanged() { CodeEditorComponent::editorViewportPositionChanged(); - listeners.call (&Listener::codeEditorViewportMoved, *this); + listeners.call ([this] (Listener& l) { l.codeEditorViewportMoved (*this); }); } //============================================================================== diff --git a/extras/Projucer/Source/Licenses/jucer_LicenseController.cpp b/extras/Projucer/Source/Licenses/jucer_LicenseController.cpp index 3338977ff2..47059fdee2 100644 --- a/extras/Projucer/Source/Licenses/jucer_LicenseController.cpp +++ b/extras/Projucer/Source/Licenses/jucer_LicenseController.cpp @@ -141,7 +141,8 @@ void LicenseController::startWebviewIfNeeded() if (guiNotInitialisedYet) { guiNotInitialisedYet = false; - listeners.call (&StateChangedCallback::licenseStateChanged, getState()); + auto stateParam = getState(); + listeners.call ([&] (StateChangedCallback& l) { l.licenseStateChanged (stateParam); }); } #if ! JUCER_ENABLE_GPL_MODE @@ -258,7 +259,8 @@ void LicenseController::updateState (const LicenseState& newState) state = newState; licenseStateToSettings (state, props); - listeners.call (&StateChangedCallback::licenseStateChanged, getState()); + auto stateParam = getState(); + listeners.call ([&] (StateChangedCallback& l) { l.licenseStateChanged (stateParam); }); } LicenseState LicenseController::licenseStateFromOldSettings (XmlElement* licenseXml) diff --git a/extras/Projucer/Source/LiveBuildEngine/jucer_ActivityList.h b/extras/Projucer/Source/LiveBuildEngine/jucer_ActivityList.h index f0f56e6218..097f7f798a 100644 --- a/extras/Projucer/Source/LiveBuildEngine/jucer_ActivityList.h +++ b/extras/Projucer/Source/LiveBuildEngine/jucer_ActivityList.h @@ -96,7 +96,7 @@ struct ActivityList : public ChangeBroadcaster void sendClassListChangedMessage (const ClassDatabase::ClassList& newList) { checkThread(); - listeners.call (&ActivityList::Listener::classListChanged, newList); + listeners.call ([&] (Listener& l) { l.classListChanged (newList); }); } private: diff --git a/extras/UnitTestRunner/Builds/VisualStudio2017/UnitTestRunner_ConsoleApp.vcxproj b/extras/UnitTestRunner/Builds/VisualStudio2017/UnitTestRunner_ConsoleApp.vcxproj index c5a1d6e3f0..fa0c047631 100644 --- a/extras/UnitTestRunner/Builds/VisualStudio2017/UnitTestRunner_ConsoleApp.vcxproj +++ b/extras/UnitTestRunner/Builds/VisualStudio2017/UnitTestRunner_ConsoleApp.vcxproj @@ -610,9 +610,6 @@ true - - true - true diff --git a/extras/UnitTestRunner/Builds/VisualStudio2017/UnitTestRunner_ConsoleApp.vcxproj.filters b/extras/UnitTestRunner/Builds/VisualStudio2017/UnitTestRunner_ConsoleApp.vcxproj.filters index e65fcc791f..5e15a514f4 100644 --- a/extras/UnitTestRunner/Builds/VisualStudio2017/UnitTestRunner_ConsoleApp.vcxproj.filters +++ b/extras/UnitTestRunner/Builds/VisualStudio2017/UnitTestRunner_ConsoleApp.vcxproj.filters @@ -931,9 +931,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/extras/binarybuilder/Builds/VisualStudio2017/BinaryBuilder_ConsoleApp.vcxproj b/extras/binarybuilder/Builds/VisualStudio2017/BinaryBuilder_ConsoleApp.vcxproj index fef2e753fc..53387b976f 100644 --- a/extras/binarybuilder/Builds/VisualStudio2017/BinaryBuilder_ConsoleApp.vcxproj +++ b/extras/binarybuilder/Builds/VisualStudio2017/BinaryBuilder_ConsoleApp.vcxproj @@ -158,9 +158,6 @@ true - - true - true diff --git a/extras/binarybuilder/Builds/VisualStudio2017/BinaryBuilder_ConsoleApp.vcxproj.filters b/extras/binarybuilder/Builds/VisualStudio2017/BinaryBuilder_ConsoleApp.vcxproj.filters index 69bed1dfd6..9f0a48e82e 100644 --- a/extras/binarybuilder/Builds/VisualStudio2017/BinaryBuilder_ConsoleApp.vcxproj.filters +++ b/extras/binarybuilder/Builds/VisualStudio2017/BinaryBuilder_ConsoleApp.vcxproj.filters @@ -85,9 +85,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/extras/windows dll/Builds/VisualStudio2017/juce_dll_StaticLibrary.vcxproj b/extras/windows dll/Builds/VisualStudio2017/juce_dll_StaticLibrary.vcxproj index eb491dba9d..ebb0e2a769 100644 --- a/extras/windows dll/Builds/VisualStudio2017/juce_dll_StaticLibrary.vcxproj +++ b/extras/windows dll/Builds/VisualStudio2017/juce_dll_StaticLibrary.vcxproj @@ -577,9 +577,6 @@ true - - true - true diff --git a/extras/windows dll/Builds/VisualStudio2017/juce_dll_StaticLibrary.vcxproj.filters b/extras/windows dll/Builds/VisualStudio2017/juce_dll_StaticLibrary.vcxproj.filters index 130d945ac8..1932936d1f 100644 --- a/extras/windows dll/Builds/VisualStudio2017/juce_dll_StaticLibrary.vcxproj.filters +++ b/extras/windows dll/Builds/VisualStudio2017/juce_dll_StaticLibrary.vcxproj.filters @@ -826,9 +826,6 @@ Juce Modules\juce_core\containers - - Juce Modules\juce_core\containers - Juce Modules\juce_core\containers diff --git a/modules/juce_audio_basics/mpe/juce_MPEInstrument.cpp b/modules/juce_audio_basics/mpe/juce_MPEInstrument.cpp index 3f919d8d44..3908af7c54 100644 --- a/modules/juce_audio_basics/mpe/juce_MPEInstrument.cpp +++ b/modules/juce_audio_basics/mpe/juce_MPEInstrument.cpp @@ -220,13 +220,13 @@ void MPEInstrument::processMidiAllNotesOffMessage (const MidiMessage& message) { for (int i = notes.size(); --i >= 0;) { - MPENote& note = notes.getReference (i); + auto& note = notes.getReference (i); if (note.midiChannel == message.getChannel()) { note.keyState = MPENote::off; note.noteOffVelocity = MPEValue::from7BitInt (64); // some reasonable number - listeners.call (&MPEInstrument::Listener::noteReleased, note); + listeners.call ([&] (Listener& l) { l.noteReleased (note); }); notes.remove (i); } } @@ -235,13 +235,13 @@ void MPEInstrument::processMidiAllNotesOffMessage (const MidiMessage& message) { for (int i = notes.size(); --i >= 0;) { - MPENote& note = notes.getReference (i); + auto& note = notes.getReference (i); if (zone->isUsingChannelAsNoteChannel (note.midiChannel)) { note.keyState = MPENote::off; note.noteOffVelocity = MPEValue::from7BitInt (64); // some reasonable number - listeners.call (&MPEInstrument::Listener::noteReleased, note); + listeners.call ([&] (Listener& l) { l.noteReleased (note); }); notes.remove (i); } } @@ -294,17 +294,17 @@ void MPEInstrument::noteOn (int midiChannel, const ScopedLock sl (lock); updateNoteTotalPitchbend (newNote); - if (MPENote* alreadyPlayingNote = getNotePtr (midiChannel, midiNoteNumber)) + if (auto* alreadyPlayingNote = getNotePtr (midiChannel, midiNoteNumber)) { // pathological case: second note-on received for same note -> retrigger it alreadyPlayingNote->keyState = MPENote::off; alreadyPlayingNote->noteOffVelocity = MPEValue::from7BitInt (64); // some reasonable number - listeners.call (&MPEInstrument::Listener::noteReleased, *alreadyPlayingNote); + listeners.call ([=] (Listener& l) { l.noteReleased (*alreadyPlayingNote); }); notes.remove (alreadyPlayingNote); } notes.add (newNote); - listeners.call (&MPEInstrument::Listener::noteAdded, newNote); + listeners.call ([&] (Listener& l) { l.noteAdded (newNote); }); } //============================================================================== @@ -317,7 +317,7 @@ void MPEInstrument::noteOff (int midiChannel, const ScopedLock sl (lock); - if (MPENote* note = getNotePtr (midiChannel, midiNoteNumber)) + if (auto* note = getNotePtr (midiChannel, midiNoteNumber)) { note->keyState = (note->keyState == MPENote::keyDownAndSustained) ? MPENote::sustained : MPENote::off; note->noteOffVelocity = midiNoteOffVelocity; @@ -330,12 +330,12 @@ void MPEInstrument::noteOff (int midiChannel, if (note->keyState == MPENote::off) { - listeners.call (&MPEInstrument::Listener::noteReleased, *note); + listeners.call ([=] (Listener& l) { l.noteReleased (*note); }); notes.remove (note); } else { - listeners.call (&MPEInstrument::Listener::noteKeyStateChanged, *note); + listeners.call ([=] (Listener& l) { l.noteKeyStateChanged (*note); }); } } } @@ -375,7 +375,7 @@ void MPEInstrument::updateDimension (int midiChannel, MPEDimension& dimension, M if (notes.isEmpty()) return; - if (MPEZone* zone = zoneLayout.getZoneByMasterChannel (midiChannel)) + if (auto* zone = zoneLayout.getZoneByMasterChannel (midiChannel)) { updateDimensionMaster (*zone, dimension, value); } @@ -385,7 +385,7 @@ void MPEInstrument::updateDimension (int midiChannel, MPEDimension& dimension, M { for (int i = notes.size(); --i >= 0;) { - MPENote& note = notes.getReference (i); + auto& note = notes.getReference (i); if (note.midiChannel == midiChannel) updateDimensionForNote (note, dimension, value); @@ -393,7 +393,7 @@ void MPEInstrument::updateDimension (int midiChannel, MPEDimension& dimension, M } else { - if (MPENote* note = getNotePtr (midiChannel, dimension.trackingMode)) + if (auto* note = getNotePtr (midiChannel, dimension.trackingMode)) updateDimensionForNote (*note, dimension, value); } } @@ -402,11 +402,11 @@ void MPEInstrument::updateDimension (int midiChannel, MPEDimension& dimension, M //============================================================================== void MPEInstrument::updateDimensionMaster (MPEZone& zone, MPEDimension& dimension, MPEValue value) { - const Range channels (zone.getNoteChannelRange()); + auto channels = zone.getNoteChannelRange(); for (int i = notes.size(); --i >= 0;) { - MPENote& note = notes.getReference (i); + auto& note = notes.getReference (i); if (! channels.contains (note.midiChannel)) continue; @@ -416,7 +416,7 @@ void MPEInstrument::updateDimensionMaster (MPEZone& zone, MPEDimension& dimensio // master pitchbend is a special case: we don't change the note's own pitchbend, // instead we have to update its total (master + note) pitchbend. updateNoteTotalPitchbend (note); - listeners.call (&MPEInstrument::Listener::notePitchbendChanged, note); + listeners.call ([&] (Listener& l) { l.notePitchbendChanged (note); }); } else if (dimension.getValue (note) != value) { @@ -443,9 +443,9 @@ void MPEInstrument::updateDimensionForNote (MPENote& note, MPEDimension& dimensi //============================================================================== void MPEInstrument::callListenersDimensionChanged (MPENote& note, MPEDimension& dimension) { - if (&dimension == &pressureDimension) { listeners.call (&MPEInstrument::Listener::notePressureChanged, note); return; } - if (&dimension == &timbreDimension) { listeners.call (&MPEInstrument::Listener::noteTimbreChanged, note); return; } - if (&dimension == &pitchbendDimension) { listeners.call (&MPEInstrument::Listener::notePitchbendChanged, note); return; } + if (&dimension == &pressureDimension) { listeners.call ([&] (Listener& l) { l.notePressureChanged (note); }); return; } + if (&dimension == &timbreDimension) { listeners.call ([&] (Listener& l) { l.noteTimbreChanged (note); }); return; } + if (&dimension == &pitchbendDimension) { listeners.call ([&] (Listener& l) { l.notePitchbendChanged (note); }); return; } } //============================================================================== @@ -457,10 +457,10 @@ void MPEInstrument::updateNoteTotalPitchbend (MPENote& note) } else { - if (MPEZone* zone = zoneLayout.getZoneByNoteChannel (note.midiChannel)) + if (auto* zone = zoneLayout.getZoneByNoteChannel (note.midiChannel)) { - double notePitchbendInSemitones = note.pitchbend.asSignedFloat() * zone->getPerNotePitchbendRange(); - double masterPitchbendInSemitones = pitchbendDimension.lastValueReceivedOnChannel[zone->getMasterChannel() - 1].asSignedFloat() * zone->getMasterPitchbendRange(); + auto notePitchbendInSemitones = note.pitchbend.asSignedFloat() * zone->getPerNotePitchbendRange(); + auto masterPitchbendInSemitones = pitchbendDimension.lastValueReceivedOnChannel[zone->getMasterChannel() - 1].asSignedFloat() * zone->getMasterPitchbendRange(); note.totalPitchbendInSemitones = notePitchbendInSemitones + masterPitchbendInSemitones; } else @@ -490,14 +490,14 @@ void MPEInstrument::handleSustainOrSostenuto (int midiChannel, bool isDown, bool // in MPE mode, sustain/sostenuto is per-zone and expected on the master channel; // in legacy mode, sustain/sostenuto is per MIDI channel (within the channel range used). - MPEZone* affectedZone = zoneLayout.getZoneByMasterChannel (midiChannel); + auto* affectedZone = zoneLayout.getZoneByMasterChannel (midiChannel); if (legacyMode.isEnabled ? (! legacyMode.channelRange.contains (midiChannel)) : (affectedZone == nullptr)) return; for (int i = notes.size(); --i >= 0;) { - MPENote& note = notes.getReference (i); + auto& note = notes.getReference (i); if (legacyMode.isEnabled ? (note.midiChannel == midiChannel) : affectedZone->isUsingChannel (note.midiChannel)) { @@ -510,12 +510,12 @@ void MPEInstrument::handleSustainOrSostenuto (int midiChannel, bool isDown, bool if (note.keyState == MPENote::off) { - listeners.call (&MPEInstrument::Listener::noteReleased, note); + listeners.call ([&] (Listener& l) { l.noteReleased (note); }); notes.remove (i); } else { - listeners.call (&MPEInstrument::Listener::noteKeyStateChanged, note); + listeners.call ([&] (Listener& l) { l.noteKeyStateChanged (note); }); } } } @@ -681,10 +681,10 @@ void MPEInstrument::releaseAllNotes() for (int i = notes.size(); --i >= 0;) { - MPENote& note = notes.getReference (i); + auto& note = notes.getReference (i); note.keyState = MPENote::off; note.noteOffVelocity = MPEValue::from7BitInt (64); // some reasonable number - listeners.call (&MPEInstrument::Listener::noteReleased, note); + listeners.call ([&] (Listener& l) { l.noteReleased (note); }); } notes.clear(); diff --git a/modules/juce_audio_basics/mpe/juce_MPEZoneLayout.cpp b/modules/juce_audio_basics/mpe/juce_MPEZoneLayout.cpp index f0d525ad35..c8f670a4a4 100644 --- a/modules/juce_audio_basics/mpe/juce_MPEZoneLayout.cpp +++ b/modules/juce_audio_basics/mpe/juce_MPEZoneLayout.cpp @@ -35,10 +35,15 @@ MPEZoneLayout::MPEZoneLayout (const MPEZoneLayout& other) MPEZoneLayout& MPEZoneLayout::operator= (const MPEZoneLayout& other) { zones = other.zones; - listeners.call (&MPEZoneLayout::Listener::zoneLayoutChanged, *this); + sendLayoutChangeMessage(); return *this; } +void MPEZoneLayout::sendLayoutChangeMessage() +{ + listeners.call ([this] (Listener& l) { l.zoneLayoutChanged (*this); }); +} + //============================================================================== bool MPEZoneLayout::addZone (MPEZone newZone) { @@ -46,7 +51,7 @@ bool MPEZoneLayout::addZone (MPEZone newZone) for (int i = zones.size(); --i >= 0;) { - MPEZone& zone = zones.getReference (i); + auto& zone = zones.getReference (i); if (zone.overlapsWith (newZone)) { @@ -59,7 +64,7 @@ bool MPEZoneLayout::addZone (MPEZone newZone) } zones.add (newZone); - listeners.call (&MPEZoneLayout::Listener::zoneLayoutChanged, *this); + sendLayoutChangeMessage(); return noOtherZonesModified; } @@ -80,7 +85,7 @@ MPEZone* MPEZoneLayout::getZoneByIndex (int index) const noexcept void MPEZoneLayout::clearAllZones() { zones.clear(); - listeners.call (&MPEZoneLayout::Listener::zoneLayoutChanged, *this); + sendLayoutChangeMessage(); } //============================================================================== @@ -119,22 +124,22 @@ void MPEZoneLayout::processZoneLayoutRpnMessage (MidiRPNMessage rpn) //============================================================================== void MPEZoneLayout::processPitchbendRangeRpnMessage (MidiRPNMessage rpn) { - if (MPEZone* zone = getZoneByFirstNoteChannel (rpn.channel)) + if (auto* zone = getZoneByFirstNoteChannel (rpn.channel)) { if (zone->getPerNotePitchbendRange() != rpn.value) { zone->setPerNotePitchbendRange (rpn.value); - listeners.call (&MPEZoneLayout::Listener::zoneLayoutChanged, *this); + sendLayoutChangeMessage(); return; } } - if (MPEZone* zone = getZoneByMasterChannel (rpn.channel)) + if (auto* zone = getZoneByMasterChannel (rpn.channel)) { if (zone->getMasterPitchbendRange() != rpn.value) { zone->setMasterPitchbendRange (rpn.value); - listeners.call (&MPEZoneLayout::Listener::zoneLayoutChanged, *this); + sendLayoutChangeMessage(); return; } } @@ -154,7 +159,7 @@ void MPEZoneLayout::processNextMidiBuffer (const MidiBuffer& buffer) //============================================================================== MPEZone* MPEZoneLayout::getZoneByChannel (int channel) const noexcept { - for (MPEZone* zone = zones.begin(); zone != zones.end(); ++zone) + for (auto* zone = zones.begin(); zone != zones.end(); ++zone) if (zone->isUsingChannel (channel)) return zone; @@ -163,7 +168,7 @@ MPEZone* MPEZoneLayout::getZoneByChannel (int channel) const noexcept MPEZone* MPEZoneLayout::getZoneByMasterChannel (int channel) const noexcept { - for (MPEZone* zone = zones.begin(); zone != zones.end(); ++zone) + for (auto* zone = zones.begin(); zone != zones.end(); ++zone) if (zone->getMasterChannel() == channel) return zone; @@ -172,7 +177,7 @@ MPEZone* MPEZoneLayout::getZoneByMasterChannel (int channel) const noexcept MPEZone* MPEZoneLayout::getZoneByFirstNoteChannel (int channel) const noexcept { - for (MPEZone* zone = zones.begin(); zone != zones.end(); ++zone) + for (auto* zone = zones.begin(); zone != zones.end(); ++zone) if (zone->getFirstNoteChannel() == channel) return zone; @@ -181,7 +186,7 @@ MPEZone* MPEZoneLayout::getZoneByFirstNoteChannel (int channel) const noexcept MPEZone* MPEZoneLayout::getZoneByNoteChannel (int channel) const noexcept { - for (MPEZone* zone = zones.begin(); zone != zones.end(); ++zone) + for (auto* zone = zones.begin(); zone != zones.end(); ++zone) if (zone->isUsingChannelAsNoteChannel (channel)) return zone; diff --git a/modules/juce_audio_basics/mpe/juce_MPEZoneLayout.h b/modules/juce_audio_basics/mpe/juce_MPEZoneLayout.h index 5b0337c113..c24accedd8 100644 --- a/modules/juce_audio_basics/mpe/juce_MPEZoneLayout.h +++ b/modules/juce_audio_basics/mpe/juce_MPEZoneLayout.h @@ -156,6 +156,7 @@ private: void processRpnMessage (MidiRPNMessage); void processZoneLayoutRpnMessage (MidiRPNMessage); void processPitchbendRangeRpnMessage (MidiRPNMessage); + void sendLayoutChangeMessage(); }; } // namespace juce diff --git a/modules/juce_audio_devices/audio_io/juce_AudioIODeviceType.cpp b/modules/juce_audio_devices/audio_io/juce_AudioIODeviceType.cpp index 838aaa6547..3e28df6fad 100644 --- a/modules/juce_audio_devices/audio_io/juce_AudioIODeviceType.cpp +++ b/modules/juce_audio_devices/audio_io/juce_AudioIODeviceType.cpp @@ -38,7 +38,7 @@ void AudioIODeviceType::removeListener (Listener* l) { listeners.remove (l); } void AudioIODeviceType::callDeviceChangeListeners() { - listeners.call (&AudioIODeviceType::Listener::audioDeviceListChanged); + listeners.call ([] (Listener& l) { l.audioDeviceListChanged(); }); } //============================================================================== diff --git a/modules/juce_audio_processors/utilities/juce_AudioProcessorValueTreeState.cpp b/modules/juce_audio_processors/utilities/juce_AudioProcessorValueTreeState.cpp index 0d8438c1b7..2cbb68598b 100644 --- a/modules/juce_audio_processors/utilities/juce_AudioProcessorValueTreeState.cpp +++ b/modules/juce_audio_processors/utilities/juce_AudioProcessorValueTreeState.cpp @@ -88,7 +88,7 @@ struct AudioProcessorValueTreeState::Parameter : public AudioProcessorParamete { value = newValue; - listeners.call (&AudioProcessorValueTreeState::Listener::parameterChanged, paramID, value); + listeners.call ([=] (AudioProcessorValueTreeState::Listener& l) { l.parameterChanged (paramID, value); }); listenersNeedCalling = false; needsUpdate.set (1); diff --git a/modules/juce_blocks_basics/blocks/juce_TouchSurface.h b/modules/juce_blocks_basics/blocks/juce_TouchSurface.h index 0a8d71e96f..c48869e7ab 100644 --- a/modules/juce_blocks_basics/blocks/juce_TouchSurface.h +++ b/modules/juce_blocks_basics/blocks/juce_TouchSurface.h @@ -112,7 +112,7 @@ public: /** Testing feature: this allows you to inject touches onto a touch surface. */ void callListenersTouchChanged (const TouchSurface::Touch& t) { - listeners.call (&Listener::touchChanged, *this, t); + listeners.call ([this, &t] (Listener& l) { l.touchChanged (*this, t); }); } /** Adds a listener to be called when the surface is touched. */ diff --git a/modules/juce_blocks_basics/topology/juce_PhysicalTopologySource.cpp b/modules/juce_blocks_basics/topology/juce_PhysicalTopologySource.cpp index 3d9d15fef1..8c71548270 100644 --- a/modules/juce_blocks_basics/topology/juce_PhysicalTopologySource.cpp +++ b/modules/juce_blocks_basics/topology/juce_PhysicalTopologySource.cpp @@ -125,7 +125,7 @@ struct PhysicalTopologySource::Internal { JUCE_ASSERT_MESSAGE_MANAGER_IS_LOCKED - listeners.call (&Listener::connectionBeingDeleted, *this); + listeners.call ([this] (Listener& l) { l.connectionBeingDeleted (*this); }); if (midiInput != nullptr) midiInput->stop(); @@ -191,7 +191,7 @@ struct PhysicalTopologySource::Internal if (handleMessageFromDevice != nullptr) handleMessageFromDevice (data + sizeof (BlocksProtocol::roliSysexHeader), (size_t) bodySize); - listeners.call (&Listener::handleIncomingMidiMessage, message); + listeners.call ([&] (Listener& l) { l.handleIncomingMidiMessage (message); }); } std::unique_ptr midiInput; @@ -1207,7 +1207,7 @@ struct PhysicalTopologySource::Internal lastTopology = detector->currentTopology; for (auto* d : detector->activeTopologySources) - d->listeners.call (&TopologySource::Listener::topologyChanged); + d->listeners.call ([] (TopologySource::Listener& l) { l.topologyChanged(); }); #if DUMP_TOPOLOGY dumpTopology (lastTopology); @@ -1363,7 +1363,7 @@ struct PhysicalTopologySource::Internal for (uint32 i = 0; i < BlocksProtocol::numProgramMessageInts; ++i) m.values[i] = data[i]; - programEventListeners.call (&Block::ProgramEventListener::handleProgramEvent, *this, m); + programEventListeners.call ([&] (ProgramEventListener& l) { l.handleProgramEvent (*this, m); }); } static BlockImplementation* getFrom (Block& b) noexcept @@ -1831,8 +1831,8 @@ struct PhysicalTopologySource::Internal void handleIncomingMidiMessage (const juce::MidiMessage& message) override { - dataInputPortListeners.call (&Block::DataInputPortListener::handleIncomingDataPortMessage, - *this, message.getRawData(), (size_t) message.getRawDataSize()); + dataInputPortListeners.call ([&] (DataInputPortListener& l) { l.handleIncomingDataPortMessage (*this, message.getRawData(), + (size_t) message.getRawDataSize()); }); } void connectionBeingDeleted (const MIDIDeviceConnection& c) override @@ -2025,7 +2025,7 @@ struct PhysicalTopologySource::Internal if (t.zVelocity <= 0) t.zVelocity = t.z; if (t.zVelocity <= 0) t.zVelocity = 0.9f; - listeners.call (&TouchSurface::Listener::touchChanged, *this, t); + listeners.call ([&] (TouchSurface::Listener& l) { l.touchChanged (*this, t); }); } // Normal handling: @@ -2035,7 +2035,7 @@ struct PhysicalTopologySource::Internal if (touchEvent.isTouchStart) status.lastStrikePressure = touchEvent.zVelocity; - listeners.call (&TouchSurface::Listener::touchChanged, *this, touchEvent); + listeners.call ([&] (TouchSurface::Listener& l) { l.touchChanged (*this, touchEvent); }); } void timerCallback() override @@ -2074,7 +2074,7 @@ struct PhysicalTopologySource::Internal killTouch.isTouchStart = false; killTouch.isTouchEnd = true; - listeners.call (&TouchSurface::Listener::touchChanged, *this, killTouch); + listeners.call ([&] (TouchSurface::Listener& l) { l.touchChanged (*this, killTouch); }); status.isActive = false; } @@ -2148,9 +2148,9 @@ struct PhysicalTopologySource::Internal void sendButtonChangeToListeners (Block::Timestamp timestamp, bool isDown) { if (isDown) - listeners.call (&ControlButton::Listener::buttonPressed, *this, timestamp); + listeners.call ([&] (ControlButton::Listener& l) { l.buttonPressed (*this, timestamp); }); else - listeners.call (&ControlButton::Listener::buttonReleased, *this, timestamp); + listeners.call ([&] (ControlButton::Listener& l) { l.buttonReleased (*this, timestamp); }); } BlockImplementation& blockImpl; diff --git a/modules/juce_blocks_basics/topology/juce_RuleBasedTopologySource.cpp b/modules/juce_blocks_basics/topology/juce_RuleBasedTopologySource.cpp index 33ff36c286..83e72dc455 100644 --- a/modules/juce_blocks_basics/topology/juce_RuleBasedTopologySource.cpp +++ b/modules/juce_blocks_basics/topology/juce_RuleBasedTopologySource.cpp @@ -75,7 +75,7 @@ struct RuleBasedTopologySource::Internal : public TopologySource::Listener, if (topology != newTopology) { topology = newTopology; - owner.listeners.call (&TopologySource::Listener::topologyChanged); + owner.listeners.call ([] (TopologySource::Listener& l) { l.topologyChanged(); }); } } diff --git a/modules/juce_core/containers/juce_ListenerList.cpp b/modules/juce_core/containers/juce_ListenerList.cpp deleted file mode 100644 index 16d671c108..0000000000 --- a/modules/juce_core/containers/juce_ListenerList.cpp +++ /dev/null @@ -1,189 +0,0 @@ -/* - ============================================================================== - - This file is part of the JUCE library. - Copyright (c) 2017 - ROLI Ltd. - - JUCE is an open source library subject to commercial or open-source - licensing. - - The code included in this file is provided under the terms of the ISC license - http://www.isc.org/downloads/software-support-policy/isc-license. Permission - To use, copy, modify, and/or distribute this software for any purpose with or - without fee is hereby granted provided that the above copyright notice and - this permission notice appear in all copies. - - JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER - EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE - DISCLAIMED. - - ============================================================================== -*/ - -namespace juce -{ - -#if JUCE_UNIT_TESTS - -struct ListenerBase -{ - ListenerBase (int& counter) : c (counter) {} - virtual ~ListenerBase() {} - - // Required to suppress VS2013 compiler warnings - ListenerBase& operator= (const ListenerBase&) = delete; - - virtual void f () = 0; - virtual void f (void*) = 0; - virtual void f (void*, void*) = 0; - virtual void f (void*, void*, void*) = 0; - virtual void f (void*, void*, void*, void*) = 0; - virtual void f (void*, void*, void*, void*, void*) = 0; - virtual void f (void*, void*, void*, void*, void*, void*) = 0; - - int& c; -}; - -struct Listener1 : public ListenerBase -{ - Listener1 (int& counter) : ListenerBase (counter) {} - - // Required to suppress VS2013 compiler warnings - Listener1& operator= (const Listener1&) = delete; - - void f () override { c += 1; } - void f (void*) override { c += 2; } - void f (void*, void*) override { c += 3; } - void f (void*, void*, void*) override { c += 4; } - void f (void*, void*, void*, void*) override { c += 5; } - void f (void*, void*, void*, void*, void*) override { c += 6; } - void f (void*, void*, void*, void*, void*, void*) override { c += 7; } -}; - -struct Listener2 : public ListenerBase -{ - Listener2 (int& counter) : ListenerBase (counter) {} - - // Required to suppress VS2013 compiler warnings - Listener1& operator= (const Listener1&) = delete; - - void f () override { c -= 2; } - void f (void*) override { c -= 4; } - void f (void*, void*) override { c -= 6; } - void f (void*, void*, void*) override { c -= 8; } - void f (void*, void*, void*, void*) override { c -= 10; } - void f (void*, void*, void*, void*, void*) override { c -= 12; } - void f (void*, void*, void*, void*, void*, void*) override { c -= 14; } -}; - -class ListenerListTests : public UnitTest -{ -public: - ListenerListTests() : UnitTest ("ListenerList", "Containers") {} - - template - void callHelper (std::vector& expectedCounterValues) - { - counter = 0; - listeners.call (&ListenerBase::f); - expect (counter == expectedCounterValues[0]); - - ListenerList::DummyBailOutChecker boc; - - counter = 0; - listeners.callChecked (boc, &ListenerBase::f); - expect (counter == expectedCounterValues[0]); - } - - template - void callHelper (std::vector& expectedCounterValues, T first, Args... args) - { - const int expected = expectedCounterValues[sizeof... (args) + 1]; - - counter = 0; - listeners.call (&ListenerBase::f, first, args...); - expect (counter == expected); - - ListenerList::DummyBailOutChecker boc; - counter = 0; - listeners.callChecked (boc, &ListenerBase::f, first, args...); - expect (counter == expected); - - callHelper (expectedCounterValues, args...); - } - - template - void callExcludingHelper (ListenerBase* listenerToExclude, - std::vector& expectedCounterValues) - { - counter = 0; - listeners.callExcluding (listenerToExclude, &ListenerBase::f); - expect (counter == expectedCounterValues[0]); - - ListenerList::DummyBailOutChecker boc; - - counter = 0; - listeners.callCheckedExcluding (listenerToExclude, boc, &ListenerBase::f); - expect (counter == expectedCounterValues[0]); - } - - template - void callExcludingHelper (ListenerBase* listenerToExclude, - std::vector& expectedCounterValues, T first, Args... args) - { - const int expected = expectedCounterValues[sizeof... (args) + 1]; - - counter = 0; - listeners.callExcluding (listenerToExclude, &ListenerBase::f, first, args...); - expect (counter == expected); - - ListenerList::DummyBailOutChecker boc; - counter = 0; - listeners.callCheckedExcluding (listenerToExclude, boc, &ListenerBase::f, first, args...); - expect (counter == expected); - - callExcludingHelper (listenerToExclude, expectedCounterValues, args...); - } - - void runTest() override - { - counter = 0; - - beginTest ("Call single listener"); - listeners.add (&listener1); - std::vector expectedCounterValues; - for (int i = 1; i < 8; ++i) - expectedCounterValues.push_back (i); - - callHelper (expectedCounterValues, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr); - - beginTest ("Call multiple listeners"); - listeners.add (&listener2); - expectedCounterValues.clear(); - for (int i = 1; i < 8; ++i) - expectedCounterValues.push_back (-i); - - callHelper (expectedCounterValues, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr); - - beginTest ("Call listeners excluding"); - expectedCounterValues.clear(); - for (int i = 1; i < 8; ++i) - expectedCounterValues.push_back (i); - - callExcludingHelper (&listener2, expectedCounterValues, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr); - - listeners.remove (&listener1); - listeners.remove (&listener2); - } - - int counter = 0; - ListenerList listeners; - Listener1 listener1 {counter}; - Listener2 listener2 {counter}; -}; - -static ListenerListTests listenerListTests; - -#endif - -} // namespace juce diff --git a/modules/juce_core/containers/juce_ListenerList.h b/modules/juce_core/containers/juce_ListenerList.h index 357700c9bc..d806189099 100644 --- a/modules/juce_core/containers/juce_ListenerList.h +++ b/modules/juce_core/containers/juce_ListenerList.h @@ -39,12 +39,12 @@ namespace juce void myCallbackMethod (int foo, bool bar); }; - ListenerList listeners; + ListenerList listeners; listeners.add (someCallbackObjects...); // This will invoke myCallbackMethod (1234, true) on each of the objects // in the list... - listeners.call (&MyListenerType::myCallbackMethod, 1234, true); + listeners.call ([] (MyListenerType& l) { l.myCallbackMethod (1234, true); }); @endcode If you add or remove listeners from the list during one of the callbacks - i.e. while @@ -65,22 +65,13 @@ template > class ListenerList { - #ifndef DOXYGEN - #define LL_TEMPLATE(a) typename P##a - #define LL_PARAM(a) typename TypeHelpers::ParameterType::type param##a - #endif - public: //============================================================================== /** Creates an empty list. */ - ListenerList() - { - } + ListenerList() {} /** Destructor. */ - ~ListenerList() - { - } + ~ListenerList() {} //============================================================================== /** Adds a listener to the list. @@ -88,387 +79,88 @@ public: this method has no effect. @see remove */ - void add (ListenerClass* const listenerToAdd) + void add (ListenerClass* listenerToAdd) { - // Listeners can't be null pointers! - jassert (listenerToAdd != nullptr); - if (listenerToAdd != nullptr) listeners.addIfNotAlreadyThere (listenerToAdd); + else + jassertfalse; // Listeners can't be null pointers! } /** Removes a listener from the list. If the listener wasn't in the list, this has no effect. */ - void remove (ListenerClass* const listenerToRemove) + void remove (ListenerClass* listenerToRemove) { - // Listeners can't be null pointers! - jassert (listenerToRemove != nullptr); - + jassert (listenerToRemove != nullptr); // Listeners can't be null pointers! listeners.removeFirstMatchingValue (listenerToRemove); } /** Returns the number of registered listeners. */ - int size() const noexcept - { - return listeners.size(); - } + int size() const noexcept { return listeners.size(); } /** Returns true if any listeners are registered. */ - bool isEmpty() const noexcept - { - return listeners.size() == 0; - } + bool isEmpty() const noexcept { return listeners.isEmpty(); } /** Clears the list. */ - void clear() - { - listeners.clear(); - } + void clear() { listeners.clear(); } /** Returns true if the specified listener has been added to the list. */ - bool contains (ListenerClass* const listener) const noexcept - { - return listeners.contains (listener); - } + bool contains (ListenerClass* listener) const noexcept { return listeners.contains (listener); } + + /** Returns the raw array of listeners. */ + const ArrayType& getListeners() const noexcept { return listeners; } //============================================================================== - /** Calls a member function on each listener in the list, with no parameters. */ - void call (void (ListenerClass::*callbackFunction) ()) - { - callChecked (static_cast (DummyBailOutChecker()), callbackFunction); - } - - /** Calls a member function, with no parameters, on all but the specified listener in the list. - This can be useful if the caller is also a listener and needs to exclude itself. - */ - void callExcluding (ListenerClass* listenerToExclude, void (ListenerClass::*callbackFunction) ()) - { - callCheckedExcluding (listenerToExclude, - static_cast (DummyBailOutChecker()), callbackFunction); - } - - /** Calls a member function on each listener in the list, with no parameters and a bail-out-checker. - See the class description for info about writing a bail-out checker. - */ - template - void callChecked (const BailOutCheckerType& bailOutChecker, - void (ListenerClass::*callbackFunction) ()) - { - for (Iterator iter (*this); iter.next (bailOutChecker);) - (iter.getListener()->*callbackFunction) (); - } - - /** Calls a member function on all but the specified listener in the list with a bail-out-checker. - This can be useful if the caller is also a listener and needs to exclude itself. See the class - description for info about writing a bail-out checker. - */ - template - void callCheckedExcluding (ListenerClass* listenerToExclude, - const BailOutCheckerType& bailOutChecker, - void (ListenerClass::*callbackFunction) ()) - { - for (Iterator iter (*this); iter.next (bailOutChecker);) - if (iter.getListener() != listenerToExclude) - (iter.getListener()->*callbackFunction) (); - } - - //============================================================================== - /** Calls a member function on each listener in the list, with 1 parameter. */ - template - void call (void (ListenerClass::*callbackFunction) (P1), LL_PARAM(1)) + /** Calls a member function on each listener in the list, with multiple parameters. */ + template + void call (Callback&& callback) { for (Iterator iter (*this); iter.next();) - (iter.getListener()->*callbackFunction) (param1); + callback (*iter.getListener()); } - /** Calls a member function, with 1 parameter, on all but the specified listener in the list. + /** Calls a member function with 1 parameter, on all but the specified listener in the list. This can be useful if the caller is also a listener and needs to exclude itself. */ - template - void callExcluding (ListenerClass* listenerToExclude, - void (ListenerClass::*callbackFunction) (P1), LL_PARAM(1)) + template + void callExcluding (ListenerClass* listenerToExclude, Callback&& callback) { for (Iterator iter (*this); iter.next();) - if (iter.getListener() != listenerToExclude) - (iter.getListener()->*callbackFunction) (param1); + { + auto* l = iter.getListener(); + + if (l != listenerToExclude) + callback (*l); + } } /** Calls a member function on each listener in the list, with 1 parameter and a bail-out-checker. See the class description for info about writing a bail-out checker. */ - template - void callChecked (const BailOutCheckerType& bailOutChecker, - void (ListenerClass::*callbackFunction) (P1), - LL_PARAM(1)) + template + void callChecked (const BailOutCheckerType& bailOutChecker, Callback&& callback) { for (Iterator iter (*this); iter.next (bailOutChecker);) - (iter.getListener()->*callbackFunction) (param1); + callback (*iter.getListener()); } /** Calls a member function, with 1 parameter, on all but the specified listener in the list with a bail-out-checker. This can be useful if the caller is also a listener and needs to exclude itself. See the class description for info about writing a bail-out checker. */ - template + template void callCheckedExcluding (ListenerClass* listenerToExclude, const BailOutCheckerType& bailOutChecker, - void (ListenerClass::*callbackFunction) (P1), - LL_PARAM(1)) + Callback&& callback) { for (Iterator iter (*this); iter.next (bailOutChecker);) - if (iter.getListener() != listenerToExclude) - (iter.getListener()->*callbackFunction) (param1); - } + { + auto* l = iter.getListener(); - //============================================================================== - /** Calls a member function on each listener in the list, with 2 parameters. */ - template - void call (void (ListenerClass::*callbackFunction) (P1, P2), - LL_PARAM(1), LL_PARAM(2)) - { - for (Iterator iter (*this); iter.next();) - (iter.getListener()->*callbackFunction) (param1, param2); - } - - /** Calls a member function, with 2 parameters, on all but the specified listener in the list. - This can be useful if the caller is also a listener and needs to exclude itself. - */ - template - void callExcluding (ListenerClass* listenerToExclude, - void (ListenerClass::*callbackFunction) (P1, P2), - LL_PARAM(1), LL_PARAM(2)) - { - for (Iterator iter (*this); iter.next();) - if (iter.getListener() != listenerToExclude) - (iter.getListener()->*callbackFunction) (param1, param2); - } - - /** Calls a member function on each listener in the list, with 2 parameters and a bail-out-checker. - See the class description for info about writing a bail-out checker. - */ - template - void callChecked (const BailOutCheckerType& bailOutChecker, - void (ListenerClass::*callbackFunction) (P1, P2), - LL_PARAM(1), LL_PARAM(2)) - { - for (Iterator iter (*this); iter.next (bailOutChecker);) - (iter.getListener()->*callbackFunction) (param1, param2); - } - - /** Calls a member function, with 2 parameters, on all but the specified listener in the list - with a bail-out-checker. This can be useful if the caller is also a listener and needs to - exclude itself. See the class description for info about writing a bail-out checker. - */ - template - void callCheckedExcluding (ListenerClass* listenerToExclude, - const BailOutCheckerType& bailOutChecker, - void (ListenerClass::*callbackFunction) (P1, P2), - LL_PARAM(1), LL_PARAM(2)) - { - for (Iterator iter (*this); iter.next (bailOutChecker);) - if (iter.getListener() != listenerToExclude) - (iter.getListener()->*callbackFunction) (param1, param2); - } - - //============================================================================== - /** Calls a member function on each listener in the list, with 3 parameters. */ - template - void call (void (ListenerClass::*callbackFunction) (P1, P2, P3), - LL_PARAM(1), LL_PARAM(2), LL_PARAM(3)) - { - for (Iterator iter (*this); iter.next();) - (iter.getListener()->*callbackFunction) (param1, param2, param3); - } - - /** Calls a member function, with 3 parameters, on all but the specified listener in the list. - This can be useful if the caller is also a listener and needs to exclude itself. - */ - template - void callExcluding (ListenerClass* listenerToExclude, - void (ListenerClass::*callbackFunction) (P1, P2, P3), - LL_PARAM(1), LL_PARAM(2), LL_PARAM(3)) - { - for (Iterator iter (*this); iter.next();) - if (iter.getListener() != listenerToExclude) - (iter.getListener()->*callbackFunction) (param1, param2, param3); - } - - /** Calls a member function on each listener in the list, with 3 parameters and a bail-out-checker. - See the class description for info about writing a bail-out checker. - */ - template - void callChecked (const BailOutCheckerType& bailOutChecker, - void (ListenerClass::*callbackFunction) (P1, P2, P3), - LL_PARAM(1), LL_PARAM(2), LL_PARAM(3)) - { - for (Iterator iter (*this); iter.next (bailOutChecker);) - (iter.getListener()->*callbackFunction) (param1, param2, param3); - } - - /** Calls a member function, with 3 parameters, on all but the specified listener in the list - with a bail-out-checker. This can be useful if the caller is also a listener and needs to - exclude itself. See the class description for info about writing a bail-out checker. - */ - template - void callCheckedExcluding (ListenerClass* listenerToExclude, - const BailOutCheckerType& bailOutChecker, - void (ListenerClass::*callbackFunction) (P1, P2, P3), - LL_PARAM(1), LL_PARAM(2), LL_PARAM(3)) - { - for (Iterator iter (*this); iter.next (bailOutChecker);) - if (iter.getListener() != listenerToExclude) - (iter.getListener()->*callbackFunction) (param1, param2, param3); - } - - //============================================================================== - /** Calls a member function on each listener in the list, with 4 parameters. */ - template - void call (void (ListenerClass::*callbackFunction) (P1, P2, P3, P4), - LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4)) - { - for (Iterator iter (*this); iter.next();) - (iter.getListener()->*callbackFunction) (param1, param2, param3, param4); - } - - /** Calls a member function, with 4 parameters, on all but the specified listener in the list. - This can be useful if the caller is also a listener and needs to exclude itself. - */ - template - void callExcluding (ListenerClass* listenerToExclude, - void (ListenerClass::*callbackFunction) (P1, P2, P3, P4), - LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4)) - { - for (Iterator iter (*this); iter.next();) - if (iter.getListener() != listenerToExclude) - (iter.getListener()->*callbackFunction) (param1, param2, param3, param4); - } - - /** Calls a member function on each listener in the list, with 4 parameters and a bail-out-checker. - See the class description for info about writing a bail-out checker. - */ - template - void callChecked (const BailOutCheckerType& bailOutChecker, - void (ListenerClass::*callbackFunction) (P1, P2, P3, P4), - LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4)) - { - for (Iterator iter (*this); iter.next (bailOutChecker);) - (iter.getListener()->*callbackFunction) (param1, param2, param3, param4); - } - - /** Calls a member function, with 4 parameters, on all but the specified listener in the list - with a bail-out-checker. This can be useful if the caller is also a listener and needs to - exclude itself. See the class description for info about writing a bail-out checker. - */ - template - void callCheckedExcluding (ListenerClass* listenerToExclude, - const BailOutCheckerType& bailOutChecker, - void (ListenerClass::*callbackFunction) (P1, P2, P3, P4), - LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4)) - { - for (Iterator iter (*this); iter.next (bailOutChecker);) - if (iter.getListener() != listenerToExclude) - (iter.getListener()->*callbackFunction) (param1, param2, param3, param4); - } - - //============================================================================== - /** Calls a member function on each listener in the list, with 5 parameters. */ - template - void call (void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5), - LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4), LL_PARAM(5)) - { - for (Iterator iter (*this); iter.next();) - (iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5); - } - - /** Calls a member function, with 5 parameters, on all but the specified listener in the list. - This can be useful if the caller is also a listener and needs to exclude itself. - */ - template - void callExcluding (ListenerClass* listenerToExclude, - void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5), - LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4), LL_PARAM(5)) - { - for (Iterator iter (*this); iter.next();) - if (iter.getListener() != listenerToExclude) - (iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5); - } - - /** Calls a member function on each listener in the list, with 5 parameters and a bail-out-checker. - See the class description for info about writing a bail-out checker. - */ - template - void callChecked (const BailOutCheckerType& bailOutChecker, - void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5), - LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4), LL_PARAM(5)) - { - for (Iterator iter (*this); iter.next (bailOutChecker);) - (iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5); - } - - /** Calls a member function, with 5 parameters, on all but the specified listener in the list - with a bail-out-checker. This can be useful if the caller is also a listener and needs to - exclude itself. See the class description for info about writing a bail-out checker. - */ - template - void callCheckedExcluding (ListenerClass* listenerToExclude, - const BailOutCheckerType& bailOutChecker, - void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5), - LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4), LL_PARAM(5)) - { - for (Iterator iter (*this); iter.next (bailOutChecker);) - if (iter.getListener() != listenerToExclude) - (iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5); - } - - //============================================================================== - /** Calls a member function on each listener in the list, with 6 parameters. */ - template - void call (void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5, P6), - LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4), LL_PARAM(5), LL_PARAM(6)) - { - for (Iterator iter (*this); iter.next();) - (iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5, param6); - } - - /** Calls a member function, with 6 parameters, on all but the specified listener in the list. - This can be useful if the caller is also a listener and needs to exclude itself. - */ - template - void callExcluding (ListenerClass* listenerToExclude, - void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5, P6), - LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4), LL_PARAM(5), LL_PARAM(6)) - { - for (Iterator iter (*this); iter.next();) - if (iter.getListener() != listenerToExclude) - (iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5, param6); - } - - /** Calls a member function on each listener in the list, with 6 parameters and a bail-out-checker. - See the class description for info about writing a bail-out checker. - */ - template - void callChecked (const BailOutCheckerType& bailOutChecker, - void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5, P6), - LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4), LL_PARAM(5), LL_PARAM(6)) - { - for (Iterator iter (*this); iter.next (bailOutChecker);) - (iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5, param6); - } - - /** Calls a member function, with 5 parameters, on all but the specified listener in the list - with a bail-out-checker. This can be useful if the caller is also a listener and needs to - exclude itself. See the class description for info about writing a bail-out checker. - */ - template - void callCheckedExcluding (ListenerClass* listenerToExclude, - const BailOutCheckerType& bailOutChecker, - void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5, P6), - LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4), LL_PARAM(5), LL_PARAM(6)) - { - for (Iterator iter (*this); iter.next (bailOutChecker);) - if (iter.getListener() != listenerToExclude) - (iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5, param6); + if (l != listenerToExclude) + callback (*l); + } } //============================================================================== @@ -480,13 +172,14 @@ public: bool shouldBailOut() const noexcept { return false; } }; + typedef ListenerList ThisType; + typedef ListenerClass ListenerType; + //============================================================================== /** Iterates the listeners in a ListenerList. */ template - class Iterator + struct Iterator { - public: - //============================================================================== Iterator (const ListType& listToIterate) noexcept : list (listToIterate), index (listToIterate.size()) {} @@ -499,7 +192,7 @@ public: if (index <= 0) return false; - const int listSize = list.size(); + auto listSize = list.size(); if (--index < listSize) return true; @@ -526,19 +219,77 @@ public: JUCE_DECLARE_NON_COPYABLE (Iterator) }; - typedef ListenerList ThisType; - typedef ListenerClass ListenerType; + //============================================================================== + #ifndef DOXYGEN + // There are now lambda-based call functions that can be used to replace these old method-based versions. + // We'll eventually deprecate these old ones, so please begin moving your code to use lambdas! + void call (void (ListenerClass::*callbackFunction) ()) + { + call ([=] (ListenerClass& l) { (l.*callbackFunction)(); }); + } - const ArrayType& getListeners() const noexcept { return listeners; } + void callExcluding (ListenerClass* listenerToExclude, void (ListenerClass::*callbackFunction) ()) + { + callExcluding (listenerToExclude, [=] (ListenerClass& l) { (l.*callbackFunction)(); }); + } + + template + void callChecked (const BailOutCheckerType& bailOutChecker, void (ListenerClass::*callbackFunction) ()) + { + callChecked (bailOutChecker, [=] (ListenerClass& l) { (l.*callbackFunction)(); }); + } + + template + void callCheckedExcluding (ListenerClass* listenerToExclude, + const BailOutCheckerType& bailOutChecker, + void (ListenerClass::*callbackFunction) ()) + { + callCheckedExcluding (listenerToExclude, bailOutChecker, [=] (ListenerClass& l) { (l.*callbackFunction)(); }); + } + + template + void call (void (ListenerClass::*callbackFunction) (MethodArgs...), Args&&... args) + { + for (Iterator iter (*this); iter.next();) + (iter.getListener()->*callbackFunction) (static_cast::type> (args)...); + } + + template + void callExcluding (ListenerClass* listenerToExclude, + void (ListenerClass::*callbackFunction) (MethodArgs...), + Args&&... args) + { + for (Iterator iter (*this); iter.next();) + if (iter.getListener() != listenerToExclude) + (iter.getListener()->*callbackFunction) (static_cast::type> (args)...); + } + + template + void callChecked (const BailOutCheckerType& bailOutChecker, + void (ListenerClass::*callbackFunction) (MethodArgs...), + Args&&... args) + { + for (Iterator iter (*this); iter.next (bailOutChecker);) + (iter.getListener()->*callbackFunction) (static_cast::type> (args)...); + } + + template + void callCheckedExcluding (ListenerClass* listenerToExclude, + const BailOutCheckerType& bailOutChecker, + void (ListenerClass::*callbackFunction) (MethodArgs...), + Args&&... args) + { + for (Iterator iter (*this); iter.next (bailOutChecker);) + if (iter.getListener() != listenerToExclude) + (iter.getListener()->*callbackFunction) (static_cast::type> (args)...); + } + #endif private: //============================================================================== ArrayType listeners; JUCE_DECLARE_NON_COPYABLE (ListenerList) - - #undef LL_TEMPLATE - #undef LL_PARAM }; } // namespace juce diff --git a/modules/juce_core/juce_core.cpp b/modules/juce_core/juce_core.cpp index 136dd284e7..71c0554db0 100644 --- a/modules/juce_core/juce_core.cpp +++ b/modules/juce_core/juce_core.cpp @@ -119,7 +119,6 @@ //============================================================================== #include "containers/juce_AbstractFifo.cpp" #include "containers/juce_NamedValueSet.cpp" -#include "containers/juce_ListenerList.cpp" #include "containers/juce_PropertySet.cpp" #include "containers/juce_Variant.cpp" #include "files/juce_DirectoryIterator.cpp" diff --git a/modules/juce_core/threads/juce_Thread.cpp b/modules/juce_core/threads/juce_Thread.cpp index 4a335937f0..0e433e7b6e 100644 --- a/modules/juce_core/threads/juce_Thread.cpp +++ b/modules/juce_core/threads/juce_Thread.cpp @@ -167,7 +167,7 @@ Thread* JUCE_CALLTYPE Thread::getCurrentThread() void Thread::signalThreadShouldExit() { shouldExit = true; - listeners.call (&Listener::exitSignalSent); + listeners.call ([] (Listener& l) { l.exitSignalSent(); }); } bool Thread::currentThreadShouldExit() @@ -183,7 +183,7 @@ bool Thread::waitForThreadToExit (const int timeOutMilliseconds) const // Doh! So how exactly do you expect this thread to wait for itself to stop?? jassert (getThreadId() != getCurrentThreadId() || getCurrentThreadId() == 0); - const uint32 timeoutEnd = Time::getMillisecondCounter() + (uint32) timeOutMilliseconds; + auto timeoutEnd = Time::getMillisecondCounter() + (uint32) timeOutMilliseconds; while (isThreadRunning()) { diff --git a/modules/juce_core/threads/juce_ThreadPool.cpp b/modules/juce_core/threads/juce_ThreadPool.cpp index 4f12038327..2f6dba675d 100644 --- a/modules/juce_core/threads/juce_ThreadPool.cpp +++ b/modules/juce_core/threads/juce_ThreadPool.cpp @@ -69,7 +69,7 @@ void ThreadPoolJob::setJobName (const String& newName) void ThreadPoolJob::signalJobShouldExit() { shouldStop = true; - listeners.call (&Thread::Listener::exitSignalSent); + listeners.call ([] (Thread::Listener& l) { l.exitSignalSent(); }); } void ThreadPoolJob::addListener (Thread::Listener* listener) diff --git a/modules/juce_data_structures/values/juce_Value.cpp b/modules/juce_data_structures/values/juce_Value.cpp index b09530fed6..b455e35491 100644 --- a/modules/juce_data_structures/values/juce_Value.cpp +++ b/modules/juce_data_structures/values/juce_Value.cpp @@ -230,7 +230,7 @@ void Value::callListeners() if (listeners.size() > 0) { Value v (*this); // (create a copy in case this gets deleted by a callback) - listeners.call (&ValueListener::valueChanged, v); + listeners.call ([&] (ValueListener& l) { l.valueChanged (v); }); } } diff --git a/modules/juce_data_structures/values/juce_ValueTree.cpp b/modules/juce_data_structures/values/juce_ValueTree.cpp index cc97abca74..045f631219 100644 --- a/modules/juce_data_structures/values/juce_ValueTree.cpp +++ b/modules/juce_data_structures/values/juce_ValueTree.cpp @@ -66,13 +66,13 @@ public: } template - void callListeners (Function fn) const + void callListeners (ValueTree::Listener* listenerToExclude, Function fn) const { auto numListeners = valueTreesWithListeners.size(); if (numListeners == 1) { - fn (valueTreesWithListeners.getUnchecked(0)->listeners); + valueTreesWithListeners.getUnchecked(0)->listeners.callExcluding (listenerToExclude, fn); } else if (numListeners > 0) { @@ -83,40 +83,40 @@ public: auto* v = listenersCopy.getUnchecked(i); if (i == 0 || valueTreesWithListeners.contains (v)) - fn (v->listeners); + v->listeners.callExcluding (listenerToExclude, fn); } } } template - void callListenersForAllParents (Function fn) const + void callListenersForAllParents (ValueTree::Listener* listenerToExclude, Function fn) const { for (auto* t = this; t != nullptr; t = t->parent) - t->callListeners (fn); + t->callListeners (listenerToExclude, fn); } void sendPropertyChangeMessage (const Identifier& property, ValueTree::Listener* listenerToExclude = nullptr) { ValueTree tree (this); - callListenersForAllParents ([&] (ListenerList& list) { list.callExcluding (listenerToExclude, &ValueTree::Listener::valueTreePropertyChanged, tree, property); }); + callListenersForAllParents (listenerToExclude, [&] (Listener& l) { l.valueTreePropertyChanged (tree, property); }); } void sendChildAddedMessage (ValueTree child) { ValueTree tree (this); - callListenersForAllParents ([&] (ListenerList& list) { list.call (&ValueTree::Listener::valueTreeChildAdded, tree, child); }); + callListenersForAllParents (nullptr, [&] (Listener& l) { l.valueTreeChildAdded (tree, child); }); } void sendChildRemovedMessage (ValueTree child, int index) { ValueTree tree (this); - callListenersForAllParents ([=, &tree, &child] (ListenerList& list) { list.call (&ValueTree::Listener::valueTreeChildRemoved, tree, child, index); }); + callListenersForAllParents (nullptr, [=, &tree, &child] (Listener& l) { l.valueTreeChildRemoved (tree, child, index); }); } void sendChildOrderChangedMessage (int oldIndex, int newIndex) { ValueTree tree (this); - callListenersForAllParents ([=, &tree] (ListenerList& list) { list.call (&ValueTree::Listener::valueTreeChildOrderChanged, tree, oldIndex, newIndex); }); + callListenersForAllParents (nullptr, [=, &tree] (Listener& l) { l.valueTreeChildOrderChanged (tree, oldIndex, newIndex); }); } void sendParentChangeMessage() @@ -127,7 +127,7 @@ public: if (auto* child = children.getObjectPointer (j)) child->sendParentChangeMessage(); - callListeners ([&] (ListenerList& list) { list.call (&ValueTree::Listener::valueTreeParentChanged, tree); }); + callListeners (nullptr, [&] (Listener& l) { l.valueTreeParentChanged (tree); }); } void setProperty (const Identifier& name, const var& newValue, UndoManager* undoManager, @@ -615,7 +615,7 @@ ValueTree& ValueTree::operator= (const ValueTree& other) object = other.object; - listeners.call (&ValueTree::Listener::valueTreeRedirected, *this); + listeners.call ([this] (Listener& l) { l.valueTreeRedirected (*this); }); } } diff --git a/modules/juce_events/broadcasters/juce_ChangeBroadcaster.cpp b/modules/juce_events/broadcasters/juce_ChangeBroadcaster.cpp index a816c3d8ff..5b7298a2b5 100644 --- a/modules/juce_events/broadcasters/juce_ChangeBroadcaster.cpp +++ b/modules/juce_events/broadcasters/juce_ChangeBroadcaster.cpp @@ -81,7 +81,7 @@ void ChangeBroadcaster::dispatchPendingMessages() void ChangeBroadcaster::callListeners() { - changeListeners.call (&ChangeListener::changeListenerCallback, this); + changeListeners.call ([this] (ChangeListener& l) { l.changeListenerCallback (this); }); } //============================================================================== diff --git a/modules/juce_graphics/images/juce_Image.cpp b/modules/juce_graphics/images/juce_Image.cpp index 1181c0e0f4..0ecbcc91b6 100644 --- a/modules/juce_graphics/images/juce_Image.cpp +++ b/modules/juce_graphics/images/juce_Image.cpp @@ -36,12 +36,12 @@ ImagePixelData::ImagePixelData (const Image::PixelFormat format, const int w, co ImagePixelData::~ImagePixelData() { - listeners.call (&Listener::imageDataBeingDeleted, this); + listeners.call ([this] (Listener& l) { l.imageDataBeingDeleted (this); }); } void ImagePixelData::sendDataChangeMessage() { - listeners.call (&Listener::imageDataChanged, this); + listeners.call ([this] (Listener& l) { l.imageDataChanged (this); }); } int ImagePixelData::getSharedCount() const noexcept diff --git a/modules/juce_gui_basics/buttons/juce_Button.cpp b/modules/juce_gui_basics/buttons/juce_Button.cpp index fd90a382d6..8600592211 100644 --- a/modules/juce_gui_basics/buttons/juce_Button.cpp +++ b/modules/juce_gui_basics/buttons/juce_Button.cpp @@ -396,7 +396,7 @@ void Button::sendClickMessage (const ModifierKeys& modifiers) clicked (modifiers); if (! checker.shouldBailOut()) - buttonListeners.callChecked (checker, &Button::Listener::buttonClicked, this); + buttonListeners.callChecked (checker, [this] (Listener& l) { l.buttonClicked (this); }); } void Button::sendStateMessage() @@ -406,7 +406,7 @@ void Button::sendStateMessage() buttonStateChanged(); if (! checker.shouldBailOut()) - buttonListeners.callChecked (checker, &Button::Listener::buttonStateChanged, this); + buttonListeners.callChecked (checker, [this] (Listener& l) { l.buttonStateChanged (this); }); } //============================================================================== diff --git a/modules/juce_gui_basics/buttons/juce_Button.h b/modules/juce_gui_basics/buttons/juce_Button.h index 91792d98ee..4c80befa9e 100644 --- a/modules/juce_gui_basics/buttons/juce_Button.h +++ b/modules/juce_gui_basics/buttons/juce_Button.h @@ -352,9 +352,6 @@ public: /** Returns the button's current over/down/up state. */ ButtonState getState() const noexcept { return buttonState; } - // This method's parameters have changed - see the new version. - JUCE_DEPRECATED (void setToggleState (bool, bool)); - //============================================================================== /** This abstract base class is implemented by LookAndFeel classes to provide button-drawing functionality. @@ -390,6 +387,9 @@ public: #endif }; + // This method's parameters have changed - see the new version. + JUCE_DEPRECATED (void setToggleState (bool, bool)); + protected: //============================================================================== /** This method is called when the button has been clicked. diff --git a/modules/juce_gui_basics/commands/juce_ApplicationCommandManager.cpp b/modules/juce_gui_basics/commands/juce_ApplicationCommandManager.cpp index e68511cff8..d54322e086 100644 --- a/modules/juce_gui_basics/commands/juce_ApplicationCommandManager.cpp +++ b/modules/juce_gui_basics/commands/juce_ApplicationCommandManager.cpp @@ -70,7 +70,7 @@ void ApplicationCommandManager::registerCommand (const ApplicationCommandInfo& n } else { - ApplicationCommandInfo* const newInfo = new ApplicationCommandInfo (newCommand); + auto* newInfo = new ApplicationCommandInfo (newCommand); newInfo->flags &= ~ApplicationCommandInfo::isTicked; commands.add (newInfo); @@ -129,12 +129,12 @@ ApplicationCommandInfo* ApplicationCommandManager::getMutableCommandForID (Comma return nullptr; } -const ApplicationCommandInfo* ApplicationCommandManager::getCommandForID (const CommandID commandID) const noexcept +const ApplicationCommandInfo* ApplicationCommandManager::getCommandForID (CommandID commandID) const noexcept { return getMutableCommandForID (commandID); } -String ApplicationCommandManager::getNameOfCommand (const CommandID commandID) const noexcept +String ApplicationCommandManager::getNameOfCommand (CommandID commandID) const noexcept { if (auto* ci = getCommandForID (commandID)) return ci->shortName; @@ -142,7 +142,7 @@ String ApplicationCommandManager::getNameOfCommand (const CommandID commandID) c return {}; } -String ApplicationCommandManager::getDescriptionOfCommand (const CommandID commandID) const noexcept +String ApplicationCommandManager::getDescriptionOfCommand (CommandID commandID) const noexcept { if (auto* ci = getCommandForID (commandID)) return ci->description.isNotEmpty() ? ci->description @@ -173,7 +173,7 @@ Array ApplicationCommandManager::getCommandsInCategory (const String& } //============================================================================== -bool ApplicationCommandManager::invokeDirectly (const CommandID commandID, const bool asynchronously) +bool ApplicationCommandManager::invokeDirectly (CommandID commandID, bool asynchronously) { ApplicationCommandTarget::InvocationInfo info (commandID); info.invocationMethod = ApplicationCommandTarget::InvocationInfo::direct; @@ -181,7 +181,7 @@ bool ApplicationCommandManager::invokeDirectly (const CommandID commandID, const return invoke (info, asynchronously); } -bool ApplicationCommandManager::invoke (const ApplicationCommandTarget::InvocationInfo& inf, const bool asynchronously) +bool ApplicationCommandManager::invoke (const ApplicationCommandTarget::InvocationInfo& inf, bool asynchronously) { // This call isn't thread-safe for use from a non-UI thread without locking the message // manager first.. @@ -204,21 +204,21 @@ bool ApplicationCommandManager::invoke (const ApplicationCommandTarget::Invocati } //============================================================================== -ApplicationCommandTarget* ApplicationCommandManager::getFirstCommandTarget (const CommandID) +ApplicationCommandTarget* ApplicationCommandManager::getFirstCommandTarget (CommandID) { return firstTarget != nullptr ? firstTarget : findDefaultComponentTarget(); } -void ApplicationCommandManager::setFirstCommandTarget (ApplicationCommandTarget* const newTarget) noexcept +void ApplicationCommandManager::setFirstCommandTarget (ApplicationCommandTarget* newTarget) noexcept { firstTarget = newTarget; } -ApplicationCommandTarget* ApplicationCommandManager::getTargetForCommand (const CommandID commandID, +ApplicationCommandTarget* ApplicationCommandManager::getTargetForCommand (CommandID commandID, ApplicationCommandInfo& upToDateInfo) { - ApplicationCommandTarget* target = getFirstCommandTarget (commandID); + auto* target = getFirstCommandTarget (commandID); if (target == nullptr) target = JUCEApplication::getInstance(); @@ -238,7 +238,7 @@ ApplicationCommandTarget* ApplicationCommandManager::getTargetForCommand (const //============================================================================== ApplicationCommandTarget* ApplicationCommandManager::findTargetForComponent (Component* c) { - ApplicationCommandTarget* target = dynamic_cast (c); + auto* target = dynamic_cast (c); if (target == nullptr && c != nullptr) target = c->findParentComponentOfClass(); @@ -248,7 +248,7 @@ ApplicationCommandTarget* ApplicationCommandManager::findTargetForComponent (Com ApplicationCommandTarget* ApplicationCommandManager::findDefaultComponentTarget() { - Component* c = Component::getCurrentlyFocusedComponent(); + auto* c = Component::getCurrentlyFocusedComponent(); if (c == nullptr) { @@ -290,24 +290,24 @@ ApplicationCommandTarget* ApplicationCommandManager::findDefaultComponentTarget( } //============================================================================== -void ApplicationCommandManager::addListener (ApplicationCommandManagerListener* const listener) +void ApplicationCommandManager::addListener (ApplicationCommandManagerListener* listener) { listeners.add (listener); } -void ApplicationCommandManager::removeListener (ApplicationCommandManagerListener* const listener) +void ApplicationCommandManager::removeListener (ApplicationCommandManagerListener* listener) { listeners.remove (listener); } void ApplicationCommandManager::sendListenerInvokeCallback (const ApplicationCommandTarget::InvocationInfo& info) { - listeners.call (&ApplicationCommandManagerListener::applicationCommandInvoked, info); + listeners.call ([&] (ApplicationCommandManagerListener& l) { l.applicationCommandInvoked (info); }); } void ApplicationCommandManager::handleAsyncUpdate() { - listeners.call (&ApplicationCommandManagerListener::applicationCommandListChanged); + listeners.call ([] (ApplicationCommandManagerListener& l) { l.applicationCommandListChanged(); }); } void ApplicationCommandManager::globalFocusChanged (Component*) diff --git a/modules/juce_gui_basics/components/juce_Component.cpp b/modules/juce_gui_basics/components/juce_Component.cpp index f8a2cb6487..f68eeab363 100644 --- a/modules/juce_gui_basics/components/juce_Component.cpp +++ b/modules/juce_gui_basics/components/juce_Component.cpp @@ -36,7 +36,7 @@ class Component::MouseListenerList public: MouseListenerList() noexcept {} - void addListener (MouseListener* const newListener, const bool wantsEventsForAllNestedChildComponents) + void addListener (MouseListener* newListener, bool wantsEventsForAllNestedChildComponents) { if (! listeners.contains (newListener)) { @@ -52,7 +52,7 @@ public: } } - void removeListener (MouseListener* const listenerToRemove) + void removeListener (MouseListener* listenerToRemove) { auto index = listeners.indexOf (listenerToRemove); @@ -150,7 +150,7 @@ private: struct BailOutChecker2 { - BailOutChecker2 (Component::BailOutChecker& boc, Component* const comp) + BailOutChecker2 (Component::BailOutChecker& boc, Component* comp) : checker (boc), safePointer (comp) { } @@ -470,7 +470,7 @@ Component::~Component() { static_assert (sizeof (flags) <= sizeof (componentFlags), "componentFlags has too many bits!"); - componentListeners.call (&ComponentListener::componentBeingDeleted, *this); + componentListeners.call ([this] (ComponentListener& l) { l.componentBeingDeleted (*this); }); masterReference.clear(); @@ -505,7 +505,7 @@ void Component::setName (const String& name) peer->setTitle (name); BailOutChecker checker (this); - componentListeners.callChecked (checker, &ComponentListener::componentNameChanged, *this); + componentListeners.callChecked (checker, [this] (ComponentListener& l) { l.componentNameChanged (*this); }); } } @@ -569,7 +569,7 @@ void Component::sendVisibilityChangeMessage() visibilityChanged(); if (! checker.shouldBailOut()) - componentListeners.callChecked (checker, &ComponentListener::componentVisibilityChanged, *this); + componentListeners.callChecked (checker, [this] (ComponentListener& l) { l.componentVisibilityChanged (*this); }); } bool Component::isShowing() const @@ -1207,8 +1207,7 @@ void Component::sendMovedResizedMessages (const bool wasMoved, const bool wasRes parentComponent->childBoundsChanged (this); if (! checker.shouldBailOut()) - componentListeners.callChecked (checker, &ComponentListener::componentMovedOrResized, - *this, wasMoved, wasResized); + componentListeners.callChecked (checker, [=] (ComponentListener& l) { l.componentMovedOrResized (*this, wasMoved, wasResized); }); } void Component::setSize (int w, int h) @@ -1661,7 +1660,7 @@ void Component::internalChildrenChanged() childrenChanged(); if (! checker.shouldBailOut()) - componentListeners.callChecked (checker, &ComponentListener::componentChildrenChanged, *this); + componentListeners.callChecked (checker, [this] (ComponentListener& l) { l.componentChildrenChanged (*this); }); } } @@ -1674,7 +1673,7 @@ void Component::internalHierarchyChanged() if (checker.shouldBailOut()) return; - componentListeners.callChecked (checker, &ComponentListener::componentParentHierarchyChanged, *this); + componentListeners.callChecked (checker, [this] (ComponentListener& l) { l.componentParentHierarchyChanged (*this); }); if (checker.shouldBailOut()) return; @@ -2387,7 +2386,7 @@ void Component::internalMouseEnter (MouseInputSource source, Point relati if (checker.shouldBailOut()) return; - Desktop::getInstance().getMouseListeners().callChecked (checker, &MouseListener::mouseEnter, me); + Desktop::getInstance().getMouseListeners().callChecked (checker, [&] (MouseListener& l) { l.mouseEnter (me); }); MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseEnter, me); } @@ -2416,7 +2415,7 @@ void Component::internalMouseExit (MouseInputSource source, Point relativ if (checker.shouldBailOut()) return; - Desktop::getInstance().getMouseListeners().callChecked (checker, &MouseListener::mouseExit, me); + Desktop::getInstance().getMouseListeners().callChecked (checker, [&] (MouseListener& l) { l.mouseExit (me); }); MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseExit, me); } @@ -2444,7 +2443,7 @@ void Component::internalMouseDown (MouseInputSource source, Point relativ orientation, rotation, tiltX, tiltY, this, this, time, relativePos, time, source.getNumberOfMultipleClicks(), false); - desktop.getMouseListeners().callChecked (checker, &MouseListener::mouseDown, me); + desktop.getMouseListeners().callChecked (checker, [&] (MouseListener& l) { l.mouseDown (me); }); return; } } @@ -2481,7 +2480,7 @@ void Component::internalMouseDown (MouseInputSource source, Point relativ if (checker.shouldBailOut()) return; - desktop.getMouseListeners().callChecked (checker, &MouseListener::mouseDown, me); + desktop.getMouseListeners().callChecked (checker, [&] (MouseListener& l) { l.mouseDown (me); }); MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseDown, me); } @@ -2509,7 +2508,7 @@ void Component::internalMouseUp (MouseInputSource source, Point relativeP return; auto& desktop = Desktop::getInstance(); - desktop.getMouseListeners().callChecked (checker, &MouseListener::mouseUp, me); + desktop.getMouseListeners().callChecked (checker, [&] (MouseListener& l) { l.mouseUp (me); }); MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseUp, me); @@ -2524,7 +2523,7 @@ void Component::internalMouseUp (MouseInputSource source, Point relativeP if (checker.shouldBailOut()) return; - desktop.mouseListeners.callChecked (checker, &MouseListener::mouseDoubleClick, me); + desktop.mouseListeners.callChecked (checker, [&] (MouseListener& l) { l.mouseDoubleClick (me); }); MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseDoubleClick, me); } } @@ -2547,7 +2546,7 @@ void Component::internalMouseDrag (MouseInputSource source, Point relativ if (checker.shouldBailOut()) return; - Desktop::getInstance().getMouseListeners().callChecked (checker, &MouseListener::mouseDrag, me); + Desktop::getInstance().getMouseListeners().callChecked (checker, [&] (MouseListener& l) { l.mouseDrag (me); }); MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseDrag, me); } @@ -2575,7 +2574,7 @@ void Component::internalMouseMove (MouseInputSource source, Point relativ if (checker.shouldBailOut()) return; - desktop.getMouseListeners().callChecked (checker, &MouseListener::mouseMove, me); + desktop.getMouseListeners().callChecked (checker, [&] (MouseListener& l) { l.mouseMove (me); }); MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseMove, me); } @@ -2595,7 +2594,7 @@ void Component::internalMouseWheel (MouseInputSource source, Point relati if (isCurrentlyBlockedByAnotherModalComponent()) { // allow blocked mouse-events to go to global listeners.. - desktop.mouseListeners.callChecked (checker, &MouseListener::mouseWheelMove, me, wheel); + desktop.mouseListeners.callChecked (checker, [&] (MouseListener& l) { l.mouseWheelMove (me, wheel); }); } else { @@ -2604,7 +2603,7 @@ void Component::internalMouseWheel (MouseInputSource source, Point relati if (checker.shouldBailOut()) return; - desktop.mouseListeners.callChecked (checker, &MouseListener::mouseWheelMove, me, wheel); + desktop.mouseListeners.callChecked (checker, [&] (MouseListener& l) { l.mouseWheelMove (me, wheel); }); if (! checker.shouldBailOut()) MouseListenerList::sendWheelEvent (*this, checker, me, wheel); @@ -2654,7 +2653,7 @@ void Component::internalBroughtToFront() if (checker.shouldBailOut()) return; - componentListeners.callChecked (checker, &ComponentListener::componentBroughtToFront, *this); + componentListeners.callChecked (checker, [this] (ComponentListener& l) { l.componentBroughtToFront (*this); }); if (checker.shouldBailOut()) return; @@ -2903,7 +2902,7 @@ void JUCE_CALLTYPE Component::unfocusAllComponents() c->giveAwayFocus (true); } -void Component::giveAwayFocus (const bool sendFocusLossEvent) +void Component::giveAwayFocus (bool sendFocusLossEvent) { auto* componentLosingFocus = currentlyFocusedComponent; currentlyFocusedComponent = nullptr; @@ -2933,7 +2932,7 @@ void Component::setEnabled (const bool shouldBeEnabled) sendEnablementChangeMessage(); BailOutChecker checker (this); - componentListeners.callChecked (checker, &ComponentListener::componentEnablementChanged, *this); + componentListeners.callChecked (checker, [this] (ComponentListener& l) { l.componentEnablementChanged (*this); }); } } diff --git a/modules/juce_gui_basics/components/juce_Desktop.cpp b/modules/juce_gui_basics/components/juce_Desktop.cpp index edaf72f98b..27fdd37763 100644 --- a/modules/juce_gui_basics/components/juce_Desktop.cpp +++ b/modules/juce_gui_basics/components/juce_Desktop.cpp @@ -197,7 +197,7 @@ void Desktop::handleAsyncUpdate() // The component may be deleted during this operation, but we'll use a SafePointer rather than a // BailOutChecker so that any remaining listeners will still get a callback (with a null pointer). WeakReference currentFocus (Component::getCurrentlyFocusedComponent()); - focusListeners.call (&FocusChangeListener::globalFocusChanged, currentFocus); + focusListeners.call ([&] (FocusChangeListener& l) { l.globalFocusChanged (currentFocus); }); } //============================================================================== @@ -248,8 +248,8 @@ void Desktop::sendMouseMove() if (auto* target = findComponentAt (lastFakeMouseMove.roundToInt())) { Component::BailOutChecker checker (target); - const Point pos (target->getLocalPoint (nullptr, lastFakeMouseMove)); - const Time now (Time::getCurrentTime()); + auto pos = target->getLocalPoint (nullptr, lastFakeMouseMove); + auto now = Time::getCurrentTime(); const MouseEvent me (getMainMouseSource(), pos, ModifierKeys::getCurrentModifiers(), MouseInputSource::invalidPressure, MouseInputSource::invalidOrientation, MouseInputSource::invalidRotation, @@ -257,9 +257,9 @@ void Desktop::sendMouseMove() target, target, now, pos, now, 0, false); if (me.mods.isAnyMouseButtonDown()) - mouseListeners.callChecked (checker, &MouseListener::mouseDrag, me); + mouseListeners.callChecked (checker, [&] (MouseListener& l) { l.mouseDrag (me); }); else - mouseListeners.callChecked (checker, &MouseListener::mouseMove, me); + mouseListeners.callChecked (checker, [&] (MouseListener& l) { l.mouseMove (me); }); } } } diff --git a/modules/juce_gui_basics/filebrowser/juce_DirectoryContentsDisplayComponent.cpp b/modules/juce_gui_basics/filebrowser/juce_DirectoryContentsDisplayComponent.cpp index b83d356253..ff42121ccb 100644 --- a/modules/juce_gui_basics/filebrowser/juce_DirectoryContentsDisplayComponent.cpp +++ b/modules/juce_gui_basics/filebrowser/juce_DirectoryContentsDisplayComponent.cpp @@ -47,7 +47,7 @@ void DirectoryContentsDisplayComponent::removeListener (FileBrowserListener* l) void DirectoryContentsDisplayComponent::sendSelectionChangeMessage() { Component::BailOutChecker checker (dynamic_cast (this)); - listeners.callChecked (checker, &FileBrowserListener::selectionChanged); + listeners.callChecked (checker, [] (FileBrowserListener& l) { l.selectionChanged(); }); } void DirectoryContentsDisplayComponent::sendMouseClickMessage (const File& file, const MouseEvent& e) @@ -55,7 +55,7 @@ void DirectoryContentsDisplayComponent::sendMouseClickMessage (const File& file, if (directoryContentsList.getDirectory().exists()) { Component::BailOutChecker checker (dynamic_cast (this)); - listeners.callChecked (checker, &FileBrowserListener::fileClicked, file, e); + listeners.callChecked (checker, [&] (FileBrowserListener& l) { l.fileClicked (file, e); }); } } @@ -64,7 +64,7 @@ void DirectoryContentsDisplayComponent::sendDoubleClickMessage (const File& file if (directoryContentsList.getDirectory().exists()) { Component::BailOutChecker checker (dynamic_cast (this)); - listeners.callChecked (checker, &FileBrowserListener::fileDoubleClicked, file); + listeners.callChecked (checker, [&] (FileBrowserListener& l) { l.fileDoubleClicked (file); }); } } diff --git a/modules/juce_gui_basics/filebrowser/juce_FileBrowserComponent.cpp b/modules/juce_gui_basics/filebrowser/juce_FileBrowserComponent.cpp index 456002e350..de343edba7 100644 --- a/modules/juce_gui_basics/filebrowser/juce_FileBrowserComponent.cpp +++ b/modules/juce_gui_basics/filebrowser/juce_FileBrowserComponent.cpp @@ -68,7 +68,7 @@ FileBrowserComponent::FileBrowserComponent (int flags_, if ((flags & useTreeView) != 0) { - FileTreeComponent* const tree = new FileTreeComponent (*fileList); + auto tree = new FileTreeComponent (*fileList); fileListComponent = tree; if ((flags & canSelectMultipleItems) != 0) @@ -78,7 +78,7 @@ FileBrowserComponent::FileBrowserComponent (int flags_, } else { - FileListComponent* const list = new FileListComponent (*fileList); + auto list = new FileListComponent (*fileList); fileListComponent = list; list->setOutlineThickness (1); @@ -147,7 +147,7 @@ bool FileBrowserComponent::isSaveMode() const noexcept int FileBrowserComponent::getNumSelectedFiles() const noexcept { - if (chosenFiles.size() == 0 && currentFileIsValid()) + if (chosenFiles.isEmpty() && currentFileIsValid()) return 1; return chosenFiles.size(); @@ -166,7 +166,7 @@ File FileBrowserComponent::getSelectedFile (int index) const noexcept bool FileBrowserComponent::currentFileIsValid() const { - const File f (getSelectedFile (0)); + auto f = getSelectedFile (0); if (isSaveMode()) return (flags & canSelectDirectories) != 0 || ! f.isDirectory(); @@ -266,7 +266,7 @@ void FileBrowserComponent::setRoot (const File& newRootDirectory) if (callListeners) { Component::BailOutChecker checker (this); - listeners.callChecked (checker, &FileBrowserListener::browserRootChanged, currentRoot); + listeners.callChecked (checker, [&] (FileBrowserListener& l) { l.browserRootChanged (currentRoot); }); } } @@ -366,7 +366,7 @@ void FileBrowserComponent::sendListenerChangeMessage() // You shouldn't delete the browser when the file gets changed! jassert (! checker.shouldBailOut()); - listeners.callChecked (checker, &FileBrowserListener::selectionChanged); + listeners.callChecked (checker, [] (FileBrowserListener& l) { l.selectionChanged(); }); } void FileBrowserComponent::selectionChanged() @@ -400,7 +400,7 @@ void FileBrowserComponent::selectionChanged() void FileBrowserComponent::fileClicked (const File& f, const MouseEvent& e) { Component::BailOutChecker checker (this); - listeners.callChecked (checker, &FileBrowserListener::fileClicked, f, e); + listeners.callChecked (checker, [&] (FileBrowserListener& l) { l.fileClicked (f, e); }); } void FileBrowserComponent::fileDoubleClicked (const File& f) @@ -415,7 +415,7 @@ void FileBrowserComponent::fileDoubleClicked (const File& f) else { Component::BailOutChecker checker (this); - listeners.callChecked (checker, &FileBrowserListener::fileDoubleClicked, f); + listeners.callChecked (checker, [&] (FileBrowserListener& l) { l.fileDoubleClicked (f); }); } } @@ -489,11 +489,11 @@ void FileBrowserComponent::buttonClicked (Button*) void FileBrowserComponent::comboBoxChanged (ComboBox*) { - const String newText (currentPathBox.getText().trim().unquoted()); + auto newText = currentPathBox.getText().trim().unquoted(); if (newText.isNotEmpty()) { - const int index = currentPathBox.getSelectedId() - 1; + auto index = currentPathBox.getSelectedId() - 1; StringArray rootNames, rootPaths; getRoots (rootNames, rootPaths); diff --git a/modules/juce_gui_basics/filebrowser/juce_FilenameComponent.cpp b/modules/juce_gui_basics/filebrowser/juce_FilenameComponent.cpp index 4fda4c4070..d3efecc638 100644 --- a/modules/juce_gui_basics/filebrowser/juce_FilenameComponent.cpp +++ b/modules/juce_gui_basics/filebrowser/juce_FilenameComponent.cpp @@ -175,7 +175,7 @@ String FilenameComponent::getCurrentFileText() const File FilenameComponent::getCurrentFile() const { - File f (File::getCurrentWorkingDirectory().getChildFile (getCurrentFileText())); + auto f = File::getCurrentWorkingDirectory().getChildFile (getCurrentFileText()); if (enforcedSuffix.isNotEmpty()) f = f.withFileExtension (enforcedSuffix); @@ -244,7 +244,7 @@ void FilenameComponent::setMaxNumberOfRecentFiles (const int newMaximum) void FilenameComponent::addRecentlyUsedFile (const File& file) { - StringArray files (getRecentlyUsedFilenames()); + auto files = getRecentlyUsedFilenames(); if (file.getFullPathName().isNotEmpty()) { @@ -269,7 +269,7 @@ void FilenameComponent::removeListener (FilenameComponentListener* const listene void FilenameComponent::handleAsyncUpdate() { Component::BailOutChecker checker (this); - listeners.callChecked (checker, &FilenameComponentListener::filenameComponentChanged, this); + listeners.callChecked (checker, [this] (FilenameComponentListener& l) { l.filenameComponentChanged (this); }); } } // namespace juce diff --git a/modules/juce_gui_basics/layout/juce_AnimatedPosition.h b/modules/juce_gui_basics/layout/juce_AnimatedPosition.h index 7b4b320f4e..dccf55df2a 100644 --- a/modules/juce_gui_basics/layout/juce_AnimatedPosition.h +++ b/modules/juce_gui_basics/layout/juce_AnimatedPosition.h @@ -160,14 +160,14 @@ private: static double getSpeed (const Time last, double lastPos, const Time now, double newPos) { - const double elapsedSecs = jmax (0.005, (now - last).inSeconds()); - const double v = (newPos - lastPos) / elapsedSecs; + auto elapsedSecs = jmax (0.005, (now - last).inSeconds()); + auto v = (newPos - lastPos) / elapsedSecs; return std::abs (v) > 0.2 ? v : 0.0; } void moveTo (double newPos) { - const Time now (Time::getCurrentTime()); + auto now = Time::getCurrentTime(); releaseVelocity = getSpeed (lastDrag, position, now, newPos); behaviour.releasedWithVelocity (newPos, releaseVelocity); lastDrag = now; @@ -182,18 +182,16 @@ private: if (position != newPosition) { position = newPosition; - listeners.call (&Listener::positionChanged, *this, newPosition); + listeners.call ([this, newPosition] (Listener& l) { l.positionChanged (*this, newPosition); }); } } void timerCallback() override { - const Time now = Time::getCurrentTime(); - - const double elapsed = jlimit (0.001, 0.020, (now - lastUpdate).inSeconds()); + auto now = Time::getCurrentTime(); + auto elapsed = jlimit (0.001, 0.020, (now - lastUpdate).inSeconds()); lastUpdate = now; - - const double newPos = behaviour.getNextPosition (position, elapsed); + auto newPos = behaviour.getNextPosition (position, elapsed); if (behaviour.isStopped (newPos)) stopTimer(); diff --git a/modules/juce_gui_basics/layout/juce_ScrollBar.cpp b/modules/juce_gui_basics/layout/juce_ScrollBar.cpp index 056d4ecc4a..c0107d2658 100644 --- a/modules/juce_gui_basics/layout/juce_ScrollBar.cpp +++ b/modules/juce_gui_basics/layout/juce_ScrollBar.cpp @@ -171,14 +171,14 @@ void ScrollBar::removeListener (Listener* const listener) void ScrollBar::handleAsyncUpdate() { - double start = visibleRange.getStart(); // (need to use a temp variable for VC7 compatibility) - listeners.call (&ScrollBar::Listener::scrollBarMoved, this, start); + auto start = visibleRange.getStart(); // (need to use a temp variable for VC7 compatibility) + listeners.call ([=] (Listener& l) { l.scrollBarMoved (this, start); }); } //============================================================================== void ScrollBar::updateThumbPosition() { - const int minimumScrollBarThumbSize = getLookAndFeel().getMinimumScrollbarThumbSize (*this); + auto minimumScrollBarThumbSize = getLookAndFeel().getMinimumScrollbarThumbSize (*this); int newThumbSize = roundToInt (totalRange.getLength() > 0 ? (visibleRange.getLength() * thumbAreaSize) / totalRange.getLength() : thumbAreaSize); diff --git a/modules/juce_gui_basics/menus/juce_MenuBarModel.cpp b/modules/juce_gui_basics/menus/juce_MenuBarModel.cpp index fcc06afe98..0c599e43f8 100644 --- a/modules/juce_gui_basics/menus/juce_MenuBarModel.cpp +++ b/modules/juce_gui_basics/menus/juce_MenuBarModel.cpp @@ -75,12 +75,12 @@ void MenuBarModel::removeListener (Listener* const listenerToRemove) noexcept //============================================================================== void MenuBarModel::handleAsyncUpdate() { - listeners.call (&MenuBarModel::Listener::menuBarItemsChanged, this); + listeners.call ([this] (Listener& l) { l.menuBarItemsChanged (this); }); } void MenuBarModel::applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo& info) { - listeners.call (&MenuBarModel::Listener::menuCommandInvoked, this, info); + listeners.call ([this, &info] (Listener& l) { l.menuCommandInvoked (this, info); }); } void MenuBarModel::applicationCommandListChanged() @@ -91,7 +91,7 @@ void MenuBarModel::applicationCommandListChanged() void MenuBarModel::handleMenuBarActivate (bool isActive) { menuBarActivated (isActive); - listeners.call (&MenuBarModel::Listener::menuBarActivated, this, isActive); + listeners.call ([this, isActive] (Listener& l) { l.menuBarActivated (this, isActive); }); } void MenuBarModel::menuBarActivated (bool) {} diff --git a/modules/juce_gui_basics/mouse/juce_MouseInactivityDetector.cpp b/modules/juce_gui_basics/mouse/juce_MouseInactivityDetector.cpp index 45b35219a0..b5053e4535 100644 --- a/modules/juce_gui_basics/mouse/juce_MouseInactivityDetector.cpp +++ b/modules/juce_gui_basics/mouse/juce_MouseInactivityDetector.cpp @@ -27,8 +27,7 @@ namespace juce { -MouseInactivityDetector::MouseInactivityDetector (Component& c) - : targetComp (c), delayMs (1500), toleranceDistance (15), isActive (true) +MouseInactivityDetector::MouseInactivityDetector (Component& c) : targetComp (c) { targetComp.addMouseListener (this, true); } @@ -51,7 +50,7 @@ void MouseInactivityDetector::timerCallback() void MouseInactivityDetector::wakeUp (const MouseEvent& e, bool alwaysWake) { - const Point newPos (e.getEventRelativeTo (&targetComp).getPosition()); + auto newPos = e.getEventRelativeTo (&targetComp).getPosition(); if ((! isActive) && (alwaysWake || e.source.isTouch() || newPos.getDistanceFrom (lastMousePos) > toleranceDistance)) setActive (true); @@ -69,8 +68,10 @@ void MouseInactivityDetector::setActive (bool b) { isActive = b; - listenerList.call (b ? &Listener::mouseBecameActive - : &Listener::mouseBecameInactive); + if (isActive) + listenerList.call ([] (Listener& l) { l.mouseBecameActive(); }); + else + listenerList.call ([] (Listener& l) { l.mouseBecameInactive(); }); } } diff --git a/modules/juce_gui_basics/mouse/juce_MouseInactivityDetector.h b/modules/juce_gui_basics/mouse/juce_MouseInactivityDetector.h index f8c6a5e555..a965743573 100644 --- a/modules/juce_gui_basics/mouse/juce_MouseInactivityDetector.h +++ b/modules/juce_gui_basics/mouse/juce_MouseInactivityDetector.h @@ -90,8 +90,8 @@ private: Component& targetComp; ListenerList listenerList; Point lastMousePos; - int delayMs, toleranceDistance; - bool isActive; + int delayMs = 1500, toleranceDistance = 15; + bool isActive = true; void timerCallback() override; void wakeUp (const MouseEvent&, bool alwaysWake); diff --git a/modules/juce_gui_basics/positioning/juce_MarkerList.cpp b/modules/juce_gui_basics/positioning/juce_MarkerList.cpp index 7646943d31..b5b83253c8 100644 --- a/modules/juce_gui_basics/positioning/juce_MarkerList.cpp +++ b/modules/juce_gui_basics/positioning/juce_MarkerList.cpp @@ -50,7 +50,7 @@ MarkerList& MarkerList::operator= (const MarkerList& other) MarkerList::~MarkerList() { - listeners.call (&MarkerList::Listener::markerListBeingDeleted, this); + listeners.call ([this] (Listener& l) { l.markerListBeingDeleted (this); }); } bool MarkerList::operator== (const MarkerList& other) const noexcept @@ -148,7 +148,7 @@ void MarkerList::removeMarker (const String& name) void MarkerList::markersHaveChanged() { - listeners.call (&MarkerList::Listener::markersChanged, this); + listeners.call ([this] (Listener& l) { l.markersChanged (this); }); } void MarkerList::Listener::markerListBeingDeleted (MarkerList*) diff --git a/modules/juce_gui_basics/properties/juce_TextPropertyComponent.cpp b/modules/juce_gui_basics/properties/juce_TextPropertyComponent.cpp index 290b8fd478..9bff521da4 100644 --- a/modules/juce_gui_basics/properties/juce_TextPropertyComponent.cpp +++ b/modules/juce_gui_basics/properties/juce_TextPropertyComponent.cpp @@ -170,7 +170,7 @@ void TextPropertyComponent::removeListener (TextPropertyComponentListener* const void TextPropertyComponent::callListeners() { Component::BailOutChecker checker (this); - listenerList.callChecked (checker, &TextPropertyComponentListener::textPropertyComponentChanged, this); + listenerList.callChecked (checker, [this] (Listener& l) { l.textPropertyComponentChanged (this); }); } void TextPropertyComponent::colourChanged() diff --git a/modules/juce_gui_basics/widgets/juce_ComboBox.cpp b/modules/juce_gui_basics/widgets/juce_ComboBox.cpp index f3ff747841..d367956236 100644 --- a/modules/juce_gui_basics/widgets/juce_ComboBox.cpp +++ b/modules/juce_gui_basics/widgets/juce_ComboBox.cpp @@ -629,7 +629,7 @@ void ComboBox::removeListener (ComboBoxListener* listener) { listeners.remove void ComboBox::handleAsyncUpdate() { Component::BailOutChecker checker (this); - listeners.callChecked (checker, &ComboBox::Listener::comboBoxChanged, this); + listeners.callChecked (checker, [this] (Listener& l) { l.comboBoxChanged (this); }); } void ComboBox::sendChange (const NotificationType notification) diff --git a/modules/juce_gui_basics/widgets/juce_Label.cpp b/modules/juce_gui_basics/widgets/juce_Label.cpp index 3640e730c8..ac51d54491 100644 --- a/modules/juce_gui_basics/widgets/juce_Label.cpp +++ b/modules/juce_gui_basics/widgets/juce_Label.cpp @@ -154,7 +154,7 @@ void Label::attachToComponent (Component* owner, const bool onLeft) void Label::componentMovedOrResized (Component& component, bool /*wasMoved*/, bool /*wasResized*/) { - const Font f (getLookAndFeel().getLabelFont (*this)); + auto f = getLookAndFeel().getLabelFont (*this); if (leftOfOwnerComp) { @@ -191,16 +191,16 @@ void Label::textWasChanged() {} void Label::editorShown (TextEditor* textEditor) { Component::BailOutChecker checker (this); - listeners.callChecked (checker, &LabelListener::editorShown, this, *textEditor); + listeners.callChecked (checker, [this, textEditor] (LabelListener& l) { l.editorShown (this, *textEditor); }); } void Label::editorAboutToBeHidden (TextEditor* textEditor) { - if (ComponentPeer* const peer = getPeer()) + if (auto* peer = getPeer()) peer->dismissPendingTextInput(); Component::BailOutChecker checker (this); - listeners.callChecked (checker, &LabelListener::editorHidden, this, *textEditor); + listeners.callChecked (checker, [this, textEditor] (LabelListener& l) { l.editorHidden (this, *textEditor); }); } void Label::showEditor() @@ -230,7 +230,7 @@ void Label::showEditor() bool Label::updateFromTextEditorContents (TextEditor& ed) { - const String newText (ed.getText()); + auto newText = ed.getText(); if (textValue.toString() != newText) { @@ -409,7 +409,7 @@ void Label::removeListener (LabelListener* const listener) void Label::callChangeListeners() { Component::BailOutChecker checker (this); - listeners.callChecked (checker, &Label::Listener::labelTextChanged, this); + listeners.callChecked (checker, [this] (Listener& l) { l.labelTextChanged (this); }); } //============================================================================== diff --git a/modules/juce_gui_basics/widgets/juce_Slider.cpp b/modules/juce_gui_basics/widgets/juce_Slider.cpp index 664ffd42c7..c6c8f77ed3 100644 --- a/modules/juce_gui_basics/widgets/juce_Slider.cpp +++ b/modules/juce_gui_basics/widgets/juce_Slider.cpp @@ -320,8 +320,7 @@ public: cancelPendingUpdate(); Component::BailOutChecker checker (&owner); - Slider* slider = &owner; // (must use an intermediate variable here to avoid a VS2005 compiler bug) - listeners.callChecked (checker, &Slider::Listener::sliderValueChanged, slider); + listeners.callChecked (checker, [&] (Slider::Listener& l) { l.sliderValueChanged (&owner); }); } void sendDragStart() @@ -329,19 +328,16 @@ public: owner.startedDragging(); Component::BailOutChecker checker (&owner); - Slider* slider = &owner; // (must use an intermediate variable here to avoid a VS2005 compiler bug) - listeners.callChecked (checker, &Slider::Listener::sliderDragStarted, slider); + listeners.callChecked (checker, [&] (Slider::Listener& l) { l.sliderDragStarted (&owner); }); } void sendDragEnd() { owner.stoppedDragging(); - sliderBeingDragged = -1; Component::BailOutChecker checker (&owner); - Slider* slider = &owner; // (must use an intermediate variable here to avoid a VS2005 compiler bug) - listeners.callChecked (checker, &Slider::Listener::sliderDragEnded, slider); + listeners.callChecked (checker, [&] (Slider::Listener& l) { l.sliderDragEnded (&owner); }); } struct DragInProgress diff --git a/modules/juce_gui_basics/widgets/juce_TextEditor.cpp b/modules/juce_gui_basics/widgets/juce_TextEditor.cpp index da5190a3b2..ca3af1f372 100644 --- a/modules/juce_gui_basics/widgets/juce_TextEditor.cpp +++ b/modules/juce_gui_basics/widgets/juce_TextEditor.cpp @@ -2098,20 +2098,20 @@ void TextEditor::handleCommandMessage (const int commandId) switch (commandId) { case TextEditorDefs::textChangeMessageId: - listeners.callChecked (checker, &Listener::textEditorTextChanged, (TextEditor&) *this); + listeners.callChecked (checker, [this] (Listener& l) { l.textEditorTextChanged (*this); }); break; case TextEditorDefs::returnKeyMessageId: - listeners.callChecked (checker, &Listener::textEditorReturnKeyPressed, (TextEditor&) *this); + listeners.callChecked (checker, [this] (Listener& l) { l.textEditorReturnKeyPressed (*this); }); break; case TextEditorDefs::escapeKeyMessageId: - listeners.callChecked (checker, &Listener::textEditorEscapeKeyPressed, (TextEditor&) *this); + listeners.callChecked (checker, [this] (Listener& l) { l.textEditorEscapeKeyPressed (*this); }); break; case TextEditorDefs::focusLossMessageId: updateValueFromText(); - listeners.callChecked (checker, &Listener::textEditorFocusLost, (TextEditor&) *this); + listeners.callChecked (checker, [this] (Listener& l) { l.textEditorFocusLost (*this); }); break; default: diff --git a/modules/juce_gui_extra/code_editor/juce_CodeDocument.cpp b/modules/juce_gui_extra/code_editor/juce_CodeDocument.cpp index 2c3cd4355c..bfe6d0e6f3 100644 --- a/modules/juce_gui_extra/code_editor/juce_CodeDocument.cpp +++ b/modules/juce_gui_extra/code_editor/juce_CodeDocument.cpp @@ -841,7 +841,7 @@ void CodeDocument::insert (const String& text, const int insertPos, const bool u if (p->getPosition() >= insertPos) p->setPosition (p->getPosition() + newTextLength); - listeners.call (&CodeDocument::Listener::codeDocumentTextInserted, text, insertPos); + listeners.call ([&] (Listener& l) { l.codeDocumentTextInserted (text, insertPos); }); } } } @@ -935,7 +935,7 @@ void CodeDocument::remove (const int startPos, const int endPos, const bool undo p->setPosition (totalChars); } - listeners.call (&CodeDocument::Listener::codeDocumentTextDeleted, startPos, endPos); + listeners.call ([=] (Listener& l) { l.codeDocumentTextDeleted (startPos, endPos); }); } } diff --git a/modules/juce_gui_extra/misc/juce_PushNotifications.cpp b/modules/juce_gui_extra/misc/juce_PushNotifications.cpp index 62c4de567c..c1efbc0dc0 100644 --- a/modules/juce_gui_extra/misc/juce_PushNotifications.cpp +++ b/modules/juce_gui_extra/misc/juce_PushNotifications.cpp @@ -53,7 +53,7 @@ void PushNotifications::requestPermissionsWithSettings (const PushNotifications: pimpl->requestPermissionsWithSettings (settings); #else ignoreUnused (settings); - listeners.call (&PushNotifications::Listener::notificationSettingsReceived, {}); + listeners.call ([] (Listener& l) { l.notificationSettingsReceived ({}); }); #endif } @@ -62,7 +62,7 @@ void PushNotifications::requestSettingsUsed() #if JUCE_PUSH_NOTIFICATIONS && (JUCE_IOS || JUCE_MAC) pimpl->requestSettingsUsed(); #else - listeners.call (&PushNotifications::Listener::notificationSettingsReceived, {}); + listeners.call ([] (Listener& l) { l.notificationSettingsReceived ({}); }); #endif } diff --git a/modules/juce_gui_extra/native/juce_android_PushNotifications.cpp b/modules/juce_gui_extra/native/juce_android_PushNotifications.cpp index 787450cb49..e0d16a01a7 100644 --- a/modules/juce_gui_extra/native/juce_android_PushNotifications.cpp +++ b/modules/juce_gui_extra/native/juce_android_PushNotifications.cpp @@ -377,11 +377,11 @@ struct PushNotifications::Pimpl } } - owner.listeners.call (&Listener::deliveredNotificationsListReceived, notifications); + owner.listeners.call ([&] (Listener& l) { l.deliveredNotificationsListReceived (notifications); }); #else // Not supported on this platform jassertfalse; - owner.listeners.call (&Listener::deliveredNotificationsListReceived, {}); + owner.listeners.call ([] (Listener& l) { l.deliveredNotificationsListReceived ({}); }); #endif } @@ -403,25 +403,21 @@ struct PushNotifications::Pimpl if (actionString.contains (notificationString)) { - owner.listeners.call (&PushNotifications::Listener::handleNotification, true, notification); + owner.listeners.call ([&] (Listener& l) { l.handleNotification (true, notification); }); } else if (actionString.contains (notificationButtonActionString)) { - String prefix = notificationButtonActionString + notification.identifier + "."; + auto prefix = notificationButtonActionString + notification.identifier + "."; auto actionTitle = actionString.fromLastOccurrenceOf (prefix, false, false) // skip prefix .fromFirstOccurrenceOf (".", false, false); // skip action index - owner.listeners.call (&PushNotifications::Listener::handleNotificationAction, - true, - notification, - actionTitle, - {}); + owner.listeners.call ([&] (Listener& l) { l.handleNotificationAction (true, notification, actionTitle, {}); }); } #if __ANDROID_API__ >= 20 else if (actionString.contains (notificationTextInputActionString)) { - String prefix = notificationTextInputActionString + notification.identifier + "."; + auto prefix = notificationTextInputActionString + notification.identifier + "."; auto actionTitle = actionString.fromLastOccurrenceOf (prefix, false, false) // skip prefix .fromFirstOccurrenceOf (".", false, false); // skip action index @@ -430,26 +426,16 @@ struct PushNotifications::Pimpl auto resultKeyString = javaString (actionTitle + actionIndex); auto remoteInputResult = LocalRef (env->CallStaticObjectMethod (RemoteInput, RemoteInput.getResultsFromIntent, intent.get())); + String responseString; if (remoteInputResult.get() != 0) { auto charSequence = LocalRef (env->CallObjectMethod (remoteInputResult, JavaBundle.getCharSequence, resultKeyString.get())); - auto responseString = LocalRef ((jstring) env->CallObjectMethod (charSequence, JavaCharSequence.toString)); + auto responseStringRef = LocalRef ((jstring) env->CallObjectMethod (charSequence, JavaCharSequence.toString)); + responseString = juceString (responseStringRef.get()); + } - owner.listeners.call (&PushNotifications::Listener::handleNotificationAction, - true, - notification, - actionTitle, - juceString (responseString.get())); - } - else - { - owner.listeners.call (&PushNotifications::Listener::handleNotificationAction, - true, - notification, - actionTitle, - {}); - } + owner.listeners.call ([&] (Listener& l) { l.handleNotificationAction (true, notification, actionTitle, responseString); }); } #endif } @@ -459,9 +445,9 @@ struct PushNotifications::Pimpl auto* env = getEnv(); auto bundle = LocalRef (env->CallObjectMethod (intent, AndroidIntent.getExtras)); + auto notification = localNotificationBundleToJuceNotification (bundle); - owner.listeners.call (&PushNotifications::Listener::localNotificationDismissedByUser, - localNotificationBundleToJuceNotification (bundle)); + owner.listeners.call ([&] (Listener& l) { l.localNotificationDismissedByUser (notification); }); } void removeAllDeliveredNotifications() @@ -507,9 +493,9 @@ struct PushNotifications::Pimpl { #if defined(JUCE_FIREBASE_INSTANCE_ID_SERVICE_CLASSNAME) MessageManager::callAsync ([this, token]() - { - owner.listeners.call (&PushNotifications::Listener::deviceTokenRefreshed, token); - }); + { + owner.listeners.call ([&] (Listener& l) { l.deviceTokenRefreshed (token); }); + }); #else ignoreUnused (token); #endif @@ -588,9 +574,9 @@ struct PushNotifications::Pimpl auto* env = getEnv(); auto bundle = LocalRef (env->CallObjectMethod (intent, AndroidIntent.getExtras)); + auto notification = remoteNotificationBundleToJuceNotification (bundle); - owner.listeners.call (&PushNotifications::Listener::handleNotification, false, - remoteNotificationBundleToJuceNotification (bundle)); + owner.listeners.call ([&] (Listener& l) { l.handleNotification (false, notification); }); #else ignoreUnused (intent); #endif @@ -603,8 +589,8 @@ struct PushNotifications::Pimpl MessageManager::callAsync ([this, rn]() { - owner.listeners.call (&PushNotifications::Listener::handleNotification, false, - firebaseRemoteNotificationToJuceNotification (rn.get())); + auto notification = firebaseRemoteNotificationToJuceNotification (rn.get()); + owner.listeners.call ([&] (Listener& l) { l.handleNotification (false, notification); }); }); #else ignoreUnused (remoteNotification); @@ -615,9 +601,9 @@ struct PushNotifications::Pimpl { #if defined(JUCE_FIREBASE_MESSAGING_SERVICE_CLASSNAME) MessageManager::callAsync ([this]() - { - owner.listeners.call (&PushNotifications::Listener::remoteNotificationsDeleted); - }); + { + owner.listeners.call ([] (Listener& l) { l.remoteNotificationsDeleted(); }); + }); #endif } @@ -627,10 +613,10 @@ struct PushNotifications::Pimpl GlobalRef mid (messageId); MessageManager::callAsync ([this, mid]() - { - owner.listeners.call (&PushNotifications::Listener::upstreamMessageSent, - juceString ((jstring) mid.get())); - }); + { + auto midString = juceString ((jstring) mid.get()); + owner.listeners.call ([&] (Listener& l) { l.upstreamMessageSent (midString); }); + }); #else ignoreUnused (messageId); #endif @@ -643,11 +629,12 @@ struct PushNotifications::Pimpl GlobalRef mid (messageId), e (error); MessageManager::callAsync ([this, mid, e]() - { - owner.listeners.call (&PushNotifications::Listener::upstreamMessageSendingError, - juceString ((jstring) mid.get()), - juceString ((jstring) e.get())); - }); + { + auto midString = juceString ((jstring) mid.get()); + auto eString = juceString ((jstring) e.get()); + + owner.listeners.call ([&] (Listener& l) { l.upstreamMessageSendingError (midString, eString); }); + }); #else ignoreUnused (messageId, error); #endif diff --git a/modules/juce_gui_extra/native/juce_ios_PushNotifications.cpp b/modules/juce_gui_extra/native/juce_ios_PushNotifications.cpp index 74fdd65ff3..df00c2744b 100644 --- a/modules/juce_gui_extra/native/juce_ios_PushNotifications.cpp +++ b/modules/juce_gui_extra/native/juce_ios_PushNotifications.cpp @@ -644,7 +644,7 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate for (UIUserNotificationCategory *c in s.categories) settings.categories.add (PushNotificationsDelegateDetails::uiUserNotificationCategoryToCategory (c)); - owner.listeners.call (&PushNotifications::Listener::notificationSettingsReceived, settings); + owner.listeners.call ([&] (Listener& l) { l.notificationSettingsReceived (settings); }); } #if defined (__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 else @@ -663,7 +663,7 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate for (UNNotificationCategory* c in categories) settings.categories.add (PushNotificationsDelegateDetails::unNotificationCategoryToCategory (c)); - owner.listeners.call (&PushNotifications::Listener::notificationSettingsReceived, settings); + owner.listeners.call ([&] (Listener& l) { l.notificationSettingsReceived (settings); }); } ]; @@ -707,7 +707,7 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate { // Not supported on this platform jassertfalse; - owner.listeners.call (&Listener::deliveredNotificationsListReceived, {}); + owner.listeners.call ([] (Listener& l) { l.deliveredNotificationsListReceived ({}); }); } #if defined (__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 else @@ -720,7 +720,7 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate for (UNNotification* n in notifications) notifs.add (PushNotificationsDelegateDetails::unNotificationToJuceNotification (n)); - owner.listeners.call (&Listener::deliveredNotificationsListReceived, notifs); + owner.listeners.call ([&] (Listener& l) { l.deliveredNotificationsListReceived (notifs); }); }]; } #endif @@ -775,7 +775,7 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate for (UILocalNotification* n in [UIApplication sharedApplication].scheduledLocalNotifications) notifs.add (PushNotificationsDelegateDetails::uiLocalNotificationToJuceNotification (n)); - owner.listeners.call (&PushNotifications::Listener::pendingLocalNotificationsListReceived, notifs); + owner.listeners.call ([&] (Listener& l) { l.pendingLocalNotificationsListReceived (notifs); }); } #if defined (__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 else @@ -789,7 +789,7 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate for (UNNotificationRequest* r : requests) notifs.add (PushNotificationsDelegateDetails::unNotificationRequestToJuceNotification (r)); - owner.listeners.call (&PushNotifications::Listener::pendingLocalNotificationsListReceived, notifs); + owner.listeners.call ([&] (Listener& l) { l.pendingLocalNotificationsListReceived (notifs); }); } ]; } @@ -854,7 +854,7 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate initialised = true; - owner.listeners.call (&PushNotifications::Listener::deviceTokenRefreshed, deviceToken); + owner.listeners.call ([&] (Listener& l) { l.deviceTokenRefreshed (deviceToken); }); } void failedToRegisterForRemoteNotifications (NSError* error) override @@ -868,16 +868,13 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate { auto n = PushNotificationsDelegateDetails::nsDictionaryToJuceNotification (userInfo); - owner.listeners.call (&PushNotifications::Listener::handleNotification, false, n); + owner.listeners.call ([&] (Listener& l) { l.handleNotification (false, n); }); } void didReceiveRemoteNotificationFetchCompletionHandler (NSDictionary* userInfo, void (^completionHandler)(UIBackgroundFetchResult result)) override { - auto n = PushNotificationsDelegateDetails::nsDictionaryToJuceNotification (userInfo); - - owner.listeners.call (&PushNotifications::Listener::handleNotification, false, n); - + didReceiveRemoteNotification (userInfo); completionHandler (UIBackgroundFetchResultNewData); } @@ -890,7 +887,7 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate auto actionString = nsStringToJuce (actionIdentifier); auto response = PushNotificationsDelegateDetails::getUserResponseFromNSDictionary (responseInfo); - owner.listeners.call (&PushNotifications::Listener::handleNotificationAction, false, n, actionString, response); + owner.listeners.call ([&] (Listener& l) { l.handleNotificationAction (false, n, actionString, response); }); completionHandler(); } @@ -899,7 +896,7 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate { auto n = PushNotificationsDelegateDetails::uiLocalNotificationToJuceNotification (notification); - owner.listeners.call (&PushNotifications::Listener::handleNotification, true, n); + owner.listeners.call ([&] (Listener& l) { l.handleNotification (true, n); }); } void handleActionForLocalNotificationCompletionHandler (NSString* actionIdentifier, @@ -921,7 +918,7 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate auto actionString = nsStringToJuce (actionIdentifier); auto response = PushNotificationsDelegateDetails::getUserResponseFromNSDictionary (responseInfo); - owner.listeners.call (&PushNotifications::Listener::handleNotificationAction, true, n, actionString, response); + owner.listeners.call ([&] (Listener& l) { l.handleNotificationAction (true, n, actionString, response); }); completionHandler(); } @@ -961,8 +958,7 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate responseString = nsStringToJuce (textResponse.userText); } - owner.listeners.call (&PushNotifications::Listener::handleNotificationAction, ! remote, n, actionString, responseString); - + owner.listeners.call ([&] (Listener& l) { l.handleNotificationAction (! remote, n, actionString, responseString); }); completionHandler(); } #endif diff --git a/modules/juce_gui_extra/native/juce_mac_PushNotifications.cpp b/modules/juce_gui_extra/native/juce_mac_PushNotifications.cpp index 47a9a1df9f..2b3673c84e 100644 --- a/modules/juce_gui_extra/native/juce_mac_PushNotifications.cpp +++ b/modules/juce_gui_extra/native/juce_mac_PushNotifications.cpp @@ -379,7 +379,7 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate if (isEarlierThanLion) { // no settings available - owner.listeners.call (&PushNotifications::Listener::notificationSettingsReceived, {}); + owner.listeners.call ([] (Listener& l) { l.notificationSettingsReceived ({}); }); return; } @@ -391,7 +391,7 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate settings.allowAlert = [NSApplication sharedApplication].enabledRemoteNotificationTypes & NSRemoteNotificationTypeAlert; } - owner.listeners.call (&PushNotifications::Listener::notificationSettingsReceived, settings); + owner.listeners.call ([&] (Listener& l) { l.notificationSettingsReceived (settings); }); } bool areNotificationsEnabled() const { return true; } @@ -410,7 +410,7 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate for (NSUserNotification* n in [NSUserNotificationCenter defaultUserNotificationCenter].deliveredNotifications) notifs.add (PushNotificationsDelegateDetailsOsx::nsUserNotificationToJuceNotification (n, isEarlierThanMavericks, isEarlierThanYosemite)); - owner.listeners.call (&Listener::deliveredNotificationsListReceived, notifs); + owner.listeners.call ([&] (Listener& l) { l.deliveredNotificationsListReceived (notifs); }); } void removeAllDeliveredNotifications() @@ -440,7 +440,7 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate for (NSUserNotification* n in [NSUserNotificationCenter defaultUserNotificationCenter].scheduledNotifications) notifs.add (PushNotificationsDelegateDetailsOsx::nsUserNotificationToJuceNotification (n, isEarlierThanMavericks, isEarlierThanYosemite)); - owner.listeners.call (&PushNotifications::Listener::pendingLocalNotificationsListReceived, notifs); + owner.listeners.call ([&] (Listener& l) { l.pendingLocalNotificationsListReceived (notifs); }); } void removePendingLocalNotification (const String& identifier) @@ -480,47 +480,45 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate initialised = true; - owner.listeners.call (&PushNotifications::Listener::deviceTokenRefreshed, deviceToken); + owner.listeners.call ([&] (Listener& l) { l.deviceTokenRefreshed (deviceToken); }); } void failedToRegisterForRemoteNotifications (NSError* error) override { ignoreUnused (error); - deviceToken.clear(); } void didReceiveRemoteNotification (NSDictionary* userInfo) override { auto n = PushNotificationsDelegateDetailsOsx::nsDictionaryToJuceNotification (userInfo); - - owner.listeners.call (&PushNotifications::Listener::handleNotification, true, n); + owner.listeners.call ([&] (Listener& l) { l.handleNotification (true, n); }); } - void didDeliverNotification (NSUserNotification* notification) override + void didDeliverNotification (NSUserNotification* notification) override { ignoreUnused (notification); } - void didActivateNotification (NSUserNotification* notification) override + void didActivateNotification (NSUserNotification* notification) override { auto n = PushNotificationsDelegateDetailsOsx::nsUserNotificationToJuceNotification (notification, isEarlierThanMavericks, isEarlierThanYosemite); if (notification.activationType == NSUserNotificationActivationTypeContentsClicked) { - owner.listeners.call (&PushNotifications::Listener::handleNotification, notification.remote, n); + owner.listeners.call ([&] (Listener& l) { l.handleNotification (notification.remote, n); }); } else { auto actionIdentifier = (! isEarlierThanYosemite && notification.additionalActivationAction != nil) - ? nsStringToJuce (notification.additionalActivationAction.identifier) - : nsStringToJuce (notification.actionButtonTitle); + ? nsStringToJuce (notification.additionalActivationAction.identifier) + : nsStringToJuce (notification.actionButtonTitle); auto reply = notification.activationType == NSUserNotificationActivationTypeReplied - ? nsStringToJuce ([notification.response string]) - : String(); + ? nsStringToJuce ([notification.response string]) + : String(); - owner.listeners.call (&PushNotifications::Listener::handleNotificationAction, notification.remote, n, actionIdentifier, reply); + owner.listeners.call ([&] (Listener& l) { l.handleNotificationAction (notification.remote, n, actionIdentifier, reply); }); } } diff --git a/modules/juce_osc/osc/juce_OSCReceiver.cpp b/modules/juce_osc/osc/juce_OSCReceiver.cpp index 56f31e9be9..7dfcbba082 100644 --- a/modules/juce_osc/osc/juce_OSCReceiver.cpp +++ b/modules/juce_osc/osc/juce_OSCReceiver.cpp @@ -518,9 +518,15 @@ private: typedef OSCReceiver::Listener Listener; if (content.isMessage()) - listeners.call (&Listener::oscMessageReceived, content.getMessage()); + { + auto&& message = content.getMessage(); + listeners.call ([&] (Listener& l) { l.oscMessageReceived (message); }); + } else if (content.isBundle()) - listeners.call (&Listener::oscBundleReceived, content.getBundle()); + { + auto&& bundle = content.getBundle(); + listeners.call ([&] (Listener& l) { l.oscBundleReceived (bundle); }); + } } void callRealtimeListeners (const OSCBundle::Element& content) @@ -528,9 +534,15 @@ private: typedef OSCReceiver::Listener Listener; if (content.isMessage()) - realtimeListeners.call (&Listener::oscMessageReceived, content.getMessage()); + { + auto&& message = content.getMessage(); + realtimeListeners.call ([&] (Listener& l) { l.oscMessageReceived (message); }); + } else if (content.isBundle()) - realtimeListeners.call (&Listener::oscBundleReceived, content.getBundle()); + { + auto&& bundle = content.getBundle(); + realtimeListeners.call ([&] (Listener& l) { l.oscBundleReceived (bundle); }); + } } //============================================================================== diff --git a/modules/juce_product_unlocking/in_app_purchases/juce_InAppPurchases.cpp b/modules/juce_product_unlocking/in_app_purchases/juce_InAppPurchases.cpp index c28df9133b..7a13e5c2a8 100644 --- a/modules/juce_product_unlocking/in_app_purchases/juce_InAppPurchases.cpp +++ b/modules/juce_product_unlocking/in_app_purchases/juce_InAppPurchases.cpp @@ -53,7 +53,7 @@ void InAppPurchases::getProductsInformation (const StringArray& productIdentifie for (auto productId : productIdentifiers) products.add (Product { productId, {}, {}, {}, {} }); - listeners.call (&Listener::productsInfoReturned, products); + listeners.call ([&] (Listener& l) { l.productsInfoReturned (products); }); #endif } @@ -68,7 +68,7 @@ void InAppPurchases::purchaseProduct (const String& productIdentifier, #else Listener::PurchaseInfo purchaseInfo { Purchase { "", productIdentifier, {}, {}, {} }, {} }; - listeners.call (&Listener::productPurchaseFinished, purchaseInfo, false, "In-app purchases unavailable"); + listeners.call ([&] (Listener& l) { l.productPurchaseFinished (purchaseInfo, false, "In-app purchases unavailable"); }); ignoreUnused (isSubscription, upgradeProductIdentifiers, creditForUnusedSubscription); #endif } @@ -78,7 +78,7 @@ void InAppPurchases::restoreProductsBoughtList (bool includeDownloadInfo, const #if JUCE_ANDROID || JUCE_IOS || JUCE_MAC pimpl->restoreProductsBoughtList (includeDownloadInfo, subscriptionsSharedSecret); #else - listeners.call (&Listener::purchasesListRestored, Array(), false, "In-app purchases unavailable"); + listeners.call ([] (Listener& l) { l.purchasesListRestored ({}, false, "In-app purchases unavailable"); }); ignoreUnused (includeDownloadInfo, subscriptionsSharedSecret); #endif } @@ -88,7 +88,7 @@ void InAppPurchases::consumePurchase (const String& productIdentifier, const Str #if JUCE_ANDROID || JUCE_IOS || JUCE_MAC pimpl->consumePurchase (productIdentifier, purchaseToken); #else - listeners.call (&Listener::productConsumed, productIdentifier, false, "In-app purchases unavailable"); + listeners.call ([&] (Listener& l) { l.productConsumed (productIdentifier, false, "In-app purchases unavailable"); }); ignoreUnused (purchaseToken); #endif } diff --git a/modules/juce_product_unlocking/native/juce_android_InAppPurchases.cpp b/modules/juce_product_unlocking/native/juce_android_InAppPurchases.cpp index d4a4bb9827..b227f650c6 100644 --- a/modules/juce_product_unlocking/native/juce_android_InAppPurchases.cpp +++ b/modules/juce_product_unlocking/native/juce_android_InAppPurchases.cpp @@ -263,7 +263,7 @@ struct InAppPurchases::Pimpl : private AsyncUpdater, //============================================================================== void notifyAboutPurchaseResult (const InAppPurchases::Purchase& purchase, bool success, const String& statusDescription) { - owner.listeners.call (&Listener::productPurchaseFinished, { purchase, {} }, success, statusDescription); + owner.listeners.call ([&] (Listener& l) { l.productPurchaseFinished ({ purchase, {} }, success, statusDescription); }); } //============================================================================== @@ -738,7 +738,7 @@ struct InAppPurchases::Pimpl : private AsyncUpdater, { const auto& result = getProductsInformationJobResults.getReference (i); - owner.listeners.call (&Listener::productsInfoReturned, result); + owner.listeners.call ([&] (Listener& l) { l.productsInfoReturned (result); }); getProductsInformationJobResults.remove (i); } } @@ -750,7 +750,7 @@ struct InAppPurchases::Pimpl : private AsyncUpdater, { const auto& result = getProductsBoughtJobResults.getReference (i); - owner.listeners.call (&Listener::purchasesListRestored, result.purchases, result.success, result.statusDescription); + owner.listeners.call ([&] (Listener& l) { l.purchasesListRestored (result.purchases, result.success, result.statusDescription); }); getProductsBoughtJobResults.remove (i); } } @@ -762,8 +762,7 @@ struct InAppPurchases::Pimpl : private AsyncUpdater, { const auto& result = consumePurchaseJobResults.getReference (i); - owner.listeners.call (&Listener::productConsumed, result.productIdentifier, - result.success, result.statusDescription); + owner.listeners.call ([&] (Listener& l) { l.productConsumed (result.productIdentifier, result.success, result.statusDescription); }); consumePurchaseJobResults.remove (i); } } diff --git a/modules/juce_product_unlocking/native/juce_ios_InAppPurchases.cpp b/modules/juce_product_unlocking/native/juce_ios_InAppPurchases.cpp index 01ccd8f7c7..426af72496 100644 --- a/modules/juce_product_unlocking/native/juce_ios_InAppPurchases.cpp +++ b/modules/juce_product_unlocking/native/juce_ios_InAppPurchases.cpp @@ -196,7 +196,7 @@ struct InAppPurchases::Pimpl : public SKDelegateAndPaymentObserver { if (! [SKPaymentQueue canMakePayments]) { - owner.listeners.call (&Listener::productPurchaseFinished, {}, false, NEEDS_TRANS ("Payments not allowed")); + owner.listeners.call ([&] (Listener& l) { l.productPurchaseFinished ({}, false, NEEDS_TRANS ("Payments not allowed")); }); return; } @@ -299,8 +299,8 @@ struct InAppPurchases::Pimpl : public SKDelegateAndPaymentObserver if (pendingRequest.request == receiptRefreshRequest) { - auto errorDetails = error != nil ? (", " + nsStringToJuce ([error localizedDescription])) : String (""); - owner.listeners.call (&Listener::purchasesListRestored, {}, false, NEEDS_TRANS ("Receipt fetch failed") + errorDetails); + auto errorDetails = error != nil ? (", " + nsStringToJuce ([error localizedDescription])) : String(); + owner.listeners.call ([&] (Listener& l) { l.purchasesListRestored ({}, false, NEEDS_TRANS ("Receipt fetch failed") + errorDetails); }); pendingReceiptRefreshRequests.remove (i); return; } @@ -326,12 +326,12 @@ struct InAppPurchases::Pimpl : public SKDelegateAndPaymentObserver void restoreCompletedTransactionsFailedWithError (SKPaymentQueue*, NSError* error) override { - owner.listeners.call (&Listener::purchasesListRestored, {}, false, nsStringToJuce (error.localizedDescription)); + owner.listeners.call ([&] (Listener& l) { l.purchasesListRestored ({}, false, nsStringToJuce (error.localizedDescription)); }); } void restoreCompletedTransactionsFinished (SKPaymentQueue*) override { - owner.listeners.call (&Listener::purchasesListRestored, restoredPurchases, true, NEEDS_TRANS ("Success")); + owner.listeners.call ([this] (Listener& l) { l.purchasesListRestored (restoredPurchases, true, NEEDS_TRANS ("Success")); }); restoredPurchases.clear(); } @@ -348,9 +348,10 @@ struct InAppPurchases::Pimpl : public SKDelegateAndPaymentObserver #endif { case SKDownloadStateWaiting: break; - case SKDownloadStatePaused: owner.listeners.call (&Listener::productDownloadPaused, *pendingDownload); break; - case SKDownloadStateActive: owner.listeners.call (&Listener::productDownloadProgressUpdate, *pendingDownload, - download.progress, RelativeTime (download.timeRemaining)); break; + case SKDownloadStatePaused: owner.listeners.call ([&] (Listener& l) { l.productDownloadPaused (*pendingDownload); }); break; + case SKDownloadStateActive: owner.listeners.call ([&] (Listener& l) { l.productDownloadProgressUpdate (*pendingDownload, + download.progress, + RelativeTime (download.timeRemaining)); }); break; case SKDownloadStateFinished: case SKDownloadStateFailed: case SKDownloadStateCancelled: processDownloadFinish (pendingDownload, download); break; @@ -369,7 +370,7 @@ struct InAppPurchases::Pimpl : public SKDelegateAndPaymentObserver for (SKProduct* skProduct in products) productsToReturn.add (SKProductToIAPProduct (skProduct)); - owner.listeners.call (&Listener::productsInfoReturned, productsToReturn); + owner.listeners.call ([&] (Listener& l) { l.productsInfoReturned (productsToReturn); }); } void startPurchase (NSArray* products) @@ -385,8 +386,7 @@ struct InAppPurchases::Pimpl : public SKDelegateAndPaymentObserver } else { - owner.listeners.call (&Listener::productPurchaseFinished, {}, false, - NEEDS_TRANS ("Your app is not setup for payments")); + owner.listeners.call ([] (Listener& l) { l.productPurchaseFinished ({}, false, NEEDS_TRANS ("Your app is not setup for payments")); }); } } @@ -464,8 +464,8 @@ struct InAppPurchases::Pimpl : public SKDelegateAndPaymentObserver if (transaction.transactionState == SKPaymentTransactionStateRestored) restoredPurchases.add ({ purchase, downloads }); else - owner.listeners.call (&Listener::productPurchaseFinished, { purchase, downloads }, success, - SKPaymentTransactionStateToString (transaction.transactionState)); + owner.listeners.call ([&] (Listener& l) { l.productPurchaseFinished ({ purchase, downloads }, success, + SKPaymentTransactionStateToString (transaction.transactionState)); }); } PendingDownloadsTransaction* getPendingDownloadsTransactionForSKTransaction (SKPaymentTransaction* transaction) @@ -514,7 +514,7 @@ struct InAppPurchases::Pimpl : public SKDelegateAndPaymentObserver ? URL (nsStringToJuce (download.contentURL.absoluteString)) : URL(); - owner.listeners.call (&Listener::productDownloadFinished, *pendingDownload, contentURL); + owner.listeners.call ([&] (Listener& l) { l.productDownloadFinished (*pendingDownload, contentURL); }); if (pdt->canBeMarkedAsFinished()) { @@ -534,7 +534,7 @@ struct InAppPurchases::Pimpl : public SKDelegateAndPaymentObserver if (auto* receiptData = [NSData dataWithContentsOfURL: receiptURL]) fetchReceiptDetailsFromAppStore (receiptData, secret); else - owner.listeners.call (&Listener::purchasesListRestored, {}, false, NEEDS_TRANS ("Receipt fetch failed")); + owner.listeners.call ([&] (Listener& l) { l.purchasesListRestored ({}, false, NEEDS_TRANS ("Receipt fetch failed")); }); } void fetchReceiptDetailsFromAppStore (NSData* receiptData, const String& secret) @@ -551,7 +551,7 @@ struct InAppPurchases::Pimpl : public SKDelegateAndPaymentObserver error: &error]; if (requestData == nil) { - owner.listeners.call (&Listener::purchasesListRestored, {}, false, NEEDS_TRANS ("Receipt fetch failed")); + sendReceiptFetchFail(); return; } @@ -572,7 +572,7 @@ struct InAppPurchases::Pimpl : public SKDelegateAndPaymentObserver { if (connectionError != nil) { - owner.listeners.call (&Listener::purchasesListRestored, {}, false, NEEDS_TRANS ("Receipt fetch failed")); + sendReceiptFetchFail(); } else { @@ -581,7 +581,7 @@ struct InAppPurchases::Pimpl : public SKDelegateAndPaymentObserver if (NSDictionary* receiptDetails = [NSJSONSerialization JSONObjectWithData: data options: 0 error: &err]) processReceiptDetails (receiptDetails); else - owner.listeners.call (&Listener::purchasesListRestored, {}, false, NEEDS_TRANS ("Receipt fetch failed")); + sendReceiptFetchFail(); } }]; @@ -622,31 +622,34 @@ struct InAppPurchases::Pimpl : public SKDelegateAndPaymentObserver } else { - return sendReceiptFetchFail(); + return sendReceiptFetchFailAsync(); } } } } else { - return sendReceiptFetchFail(); + return sendReceiptFetchFailAsync(); } } - MessageManager::callAsync ([this, purchases]() { owner.listeners.call (&Listener::purchasesListRestored, - purchases, true, NEEDS_TRANS ("Success")); }); + MessageManager::callAsync ([this, purchases]() { owner.listeners.call ([&] (Listener& l) { l.purchasesListRestored (purchases, true, NEEDS_TRANS ("Success")); }); }); return; } } } - sendReceiptFetchFail(); + sendReceiptFetchFailAsync(); } void sendReceiptFetchFail() { - MessageManager::callAsync ([this]() { owner.listeners.call (&Listener::purchasesListRestored, - {}, false, NEEDS_TRANS ("Receipt fetch failed")); }); + owner.listeners.call ([] (Listener& l) { l.purchasesListRestored ({}, false, NEEDS_TRANS ("Receipt fetch failed")); }); + } + + void sendReceiptFetchFailAsync() + { + MessageManager::callAsync ([this]() { sendReceiptFetchFail(); }); } static int64 getPurchaseDateMs (id date)