From b0bb41cc925ad4eab231572e05d45f6ea2dc011c Mon Sep 17 00:00:00 2001 From: Matthias von Faber Date: Tue, 10 Aug 2021 02:00:31 +0200 Subject: [PATCH] Drop JuceHeader.h, include JUCE modules directly (#4816) JuceHeader.h is a generated header that includes all enabled JUCE modules. This was bloating the preprocessed sources of many Surge TUs by hundreds of KBytes each (on Linux), slowing down the build somewhat. Also, JuceHeader.h is generated at build time, impairing IDE navigation and completion until halfway through an initial build. This change includes only the required JUCE modules directly, which is supported in CMake projects as per the documentation. --- CMakeLists.txt | 24 +------ .../effects/chowdsp/bbd_utils/BBDCompander.h | 2 +- src/gui/AccessibleHelpers.h | 5 +- src/gui/RuntimeFont.cpp | 3 +- src/gui/RuntimeFont.h | 2 +- src/gui/SkinSupport.h | 2 +- src/gui/SurgeGUICallbackInterfaces.h | 2 + src/gui/SurgeGUIEditor.h | 4 +- src/gui/SurgeGUIUtils.cpp | 3 +- src/gui/SurgeImage.cpp | 2 +- src/gui/SurgeImage.h | 2 +- src/gui/SurgeImageStore.h | 3 +- src/gui/SurgeJUCEHelpers.h | 2 +- src/gui/SurgeJUCELookAndFeel.h | 2 +- src/gui/overlays/AboutScreen.h | 3 +- src/gui/overlays/LuaEditors.h | 3 +- src/gui/overlays/MSEGEditor.h | 3 +- src/gui/overlays/MiniEdit.h | 3 +- src/gui/overlays/ModulationEditor.h | 2 +- src/gui/overlays/OverlayWrapper.h | 3 +- src/gui/overlays/PatchDBViewer.h | 3 +- src/gui/overlays/PatchStoreDialog.h | 3 +- src/gui/overlays/TypeinParamEditor.h | 3 +- src/gui/widgets/EffectChooser.h | 6 +- src/gui/widgets/EffectLabel.h | 4 +- src/gui/widgets/LFOAndStepDisplay.h | 3 +- src/gui/widgets/MainFrame.h | 3 +- src/gui/widgets/MenuForDiscreteParams.h | 4 +- src/gui/widgets/ModulatableControlInterface.h | 2 +- src/gui/widgets/ModulatableSlider.h | 3 +- src/gui/widgets/ModulationSourceButton.h | 4 +- src/gui/widgets/MultiSwitch.h | 6 +- src/gui/widgets/NumberField.h | 3 +- src/gui/widgets/OscillatorWaveformDisplay.h | 3 +- src/gui/widgets/ParameterInfowindow.h | 3 +- src/gui/widgets/PatchSelector.h | 4 +- src/gui/widgets/Switch.h | 3 +- src/gui/widgets/VerticalLabel.h | 3 +- src/gui/widgets/VuMeter.h | 3 +- src/gui/widgets/WaveShaperSelector.h | 3 +- src/gui/widgets/WidgetBaseMixin.h | 6 +- src/gui/widgets/XMLConfiguredMenus.h | 7 +- src/surge_effects_bank/SurgeFXEditor.cpp | 35 ++++----- src/surge_effects_bank/SurgeFXEditor.h | 11 +-- src/surge_effects_bank/SurgeFXProcessor.cpp | 43 +++++------ src/surge_effects_bank/SurgeFXProcessor.h | 30 ++++---- src/surge_effects_bank/SurgeLookAndFeel.h | 71 ++++++++++--------- src/surge_synth_juce/LockFreeStack.h | 3 +- src/surge_synth_juce/SurgeSynthEditor.h | 4 +- src/surge_synth_juce/SurgeSynthProcessor.h | 5 +- .../SurgeSynthVST3Extensions.cpp | 1 - 51 files changed, 191 insertions(+), 169 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f203fed8bd3..b53083c82f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -557,7 +557,7 @@ target_include_directories(surge-shared ${SURGE_COMMON_INCLUDES} ${OS_INCLUDE_DIRECTORIES} ) -target_compile_definitions(surge-shared PRIVATE ${OS_COMPILE_DEFINITIONS} ) +target_compile_definitions(surge-shared PUBLIC ${OS_COMPILE_DEFINITIONS} ) if( BUILD_HEADLESS ) add_executable(surge-headless @@ -585,7 +585,6 @@ if( BUILD_HEADLESS ) target_compile_definitions(surge-headless PRIVATE ${OS_COMPILE_DEFINITIONS} - TARGET_HEADLESS=1 $,BUILD_IS_DEBUG,BUILD_IS_RELEASE>=1 ) @@ -745,8 +744,6 @@ if( BUILD_SURGE_EFFECTS_BANK ) FORMATS ${SURGE_JUCE_FORMATS} ) - juce_generate_juce_header( surge-fx ) - file(GLOB SURGE_FX_BANK_RESOURCES_GLOB resources/surge_effects_bank/*.svg resources/surge_effects_bank/icons/*.svg @@ -780,9 +777,6 @@ if( BUILD_SURGE_EFFECTS_BANK ) JUCE_WASAPI=1 JUCE_DIRECTSOUND=1 - - TARGET_HEADLESS=1 - ) if (JUCE_ASIO_SUPPORT) @@ -891,8 +885,6 @@ if( BUILD_SURGE_XT ) FORMATS ${SURGE_JUCE_FORMATS} ) - juce_generate_juce_header( surge-xt ) - file(GLOB SURGE_SYNTH_JUCE_RESOURCES_GLOB resources/classic-skin-svgs/*.svg resources/fonts/Lato*ttf @@ -954,10 +946,6 @@ if( BUILD_SURGE_XT ) SURGE_JUCE_HOST_CONTEXT=${SURGE_JUCE_HOST_CONTEXT_DEFINE} SURGE_JUCE_VST3_EXTENSIONS=${SURGE_JUCE_VST3_EXTENSIONS} - TARGET_JUCE_SYNTH=1 - TARGET_HEADLESS=1 - TARGET_JUCE_UI=1 - $,BUILD_IS_DEBUG,BUILD_IS_RELEASE>=1 ) @@ -1038,15 +1026,6 @@ if( BUILD_SURGE_XT ) ) endif() - target_compile_definitions(surge-xt PUBLIC ${OS_COMPILE_DEFINITIONS} DONT_SET_USING_JUCE_NAMESPACE=1) - - target_compile_definitions(surge-xt_Standalone PUBLIC - TARGET_JUCE_SYNTH=1 - TARGET_HEADLESS=1 - TARGET_JUCE_UI=1) - - # add_dependencies(surge-juce-pipeline-targets surge-xt_Standalone) - get_target_property( SURGE_XT_OUTPUT_DIR surge-xt RUNTIME_OUTPUT_DIRECTORY ) # Really just a little convnience for BP on lin and win @@ -1282,7 +1261,6 @@ if( ${BUILD_SURGE_PYTHON_BINDINGS} ) target_compile_definitions(surgepy PRIVATE ${OS_COMPILE_DEFINITIONS} - TARGET_HEADLESS=1 $,BUILD_IS_DEBUG,BUILD_IS_RELEASE>=1 ) diff --git a/src/common/dsp/effects/chowdsp/bbd_utils/BBDCompander.h b/src/common/dsp/effects/chowdsp/bbd_utils/BBDCompander.h index 5ad23b0f137..9caa30e9cc1 100644 --- a/src/common/dsp/effects/chowdsp/bbd_utils/BBDCompander.h +++ b/src/common/dsp/effects/chowdsp/bbd_utils/BBDCompander.h @@ -1,6 +1,6 @@ #pragma once -#include +#include "juce_core/juce_core.h" /** * Signal averager used for BBD companding. diff --git a/src/gui/AccessibleHelpers.h b/src/gui/AccessibleHelpers.h index 62a12db0485..eae41977415 100644 --- a/src/gui/AccessibleHelpers.h +++ b/src/gui/AccessibleHelpers.h @@ -16,11 +16,12 @@ #ifndef SURGE_XT_ACCESSIBLEHELPERS_H #define SURGE_XT_ACCESSIBLEHELPERS_H -#include +#if SURGE_JUCE_ACCESSIBLE #include "Parameter.h" #include "SurgeGUIEditor.h" -#if SURGE_JUCE_ACCESSIBLE +#include "juce_gui_basics/juce_gui_basics.h" + namespace Surge { namespace Widgets diff --git a/src/gui/RuntimeFont.cpp b/src/gui/RuntimeFont.cpp index ac11353752f..a2a09d4297a 100644 --- a/src/gui/RuntimeFont.cpp +++ b/src/gui/RuntimeFont.cpp @@ -14,7 +14,8 @@ */ #include "RuntimeFont.h" -#include +#include "BinaryData.h" + #include namespace Surge diff --git a/src/gui/RuntimeFont.h b/src/gui/RuntimeFont.h index 93724b043ed..441e4e7600d 100644 --- a/src/gui/RuntimeFont.h +++ b/src/gui/RuntimeFont.h @@ -1,6 +1,6 @@ #pragma once -#include +#include "juce_graphics/juce_graphics.h" namespace Surge { diff --git a/src/gui/SkinSupport.h b/src/gui/SkinSupport.h index 212ba0bbf54..5eee36d2b77 100644 --- a/src/gui/SkinSupport.h +++ b/src/gui/SkinSupport.h @@ -14,7 +14,7 @@ #include "DebugHelpers.h" #include "globals.h" -#include +#include "juce_graphics/juce_graphics.h" #include "SkinModel.h" #include "SkinColors.h" diff --git a/src/gui/SurgeGUICallbackInterfaces.h b/src/gui/SurgeGUICallbackInterfaces.h index 5548c6cdee0..a32eb94a63a 100644 --- a/src/gui/SurgeGUICallbackInterfaces.h +++ b/src/gui/SurgeGUICallbackInterfaces.h @@ -16,6 +16,8 @@ #ifndef SURGE_XT_SURGEGUICALLBACKINTERFACES_H #define SURGE_XT_SURGEGUICALLBACKINTERFACES_H +#include "juce_gui_basics/juce_gui_basics.h" + namespace Surge { namespace GUI diff --git a/src/gui/SurgeGUIEditor.h b/src/gui/SurgeGUIEditor.h index 5b9e8617ddb..b2d5d9cd878 100644 --- a/src/gui/SurgeGUIEditor.h +++ b/src/gui/SurgeGUIEditor.h @@ -17,8 +17,6 @@ #include "globals.h" -#include - #include "SurgeGUICallbackInterfaces.h" #include "SurgeStorage.h" @@ -33,6 +31,8 @@ #include "overlays/OverlayWrapper.h" // This needs to be concrete for inline functions for now #include "widgets/ModulatableControlInterface.h" +#include "juce_gui_basics/juce_gui_basics.h" + #include #include #include diff --git a/src/gui/SurgeGUIUtils.cpp b/src/gui/SurgeGUIUtils.cpp index 2596a4c5f45..6335a0ac0ea 100644 --- a/src/gui/SurgeGUIUtils.cpp +++ b/src/gui/SurgeGUIUtils.cpp @@ -1,7 +1,8 @@ #include "SurgeGUIUtils.h" +#include "juce_core/juce_core.h" + #include -#include namespace Surge { diff --git a/src/gui/SurgeImage.cpp b/src/gui/SurgeImage.cpp index 8c559e149b5..27308ca0196 100644 --- a/src/gui/SurgeImage.cpp +++ b/src/gui/SurgeImage.cpp @@ -13,8 +13,8 @@ ** open source in September 2018. */ -#include #include "SurgeImage.h" +#include "BinaryData.h" SurgeImage::SurgeImage(int rid) { diff --git a/src/gui/SurgeImage.h b/src/gui/SurgeImage.h index f6c6de392a7..a4ea70c8afd 100644 --- a/src/gui/SurgeImage.h +++ b/src/gui/SurgeImage.h @@ -4,7 +4,7 @@ * A utility wrapper around loading and drawables and stuff */ -#include +#include "juce_gui_basics/juce_gui_basics.h" #include #include diff --git a/src/gui/SurgeImageStore.h b/src/gui/SurgeImageStore.h index 789695275df..bf17610c610 100644 --- a/src/gui/SurgeImageStore.h +++ b/src/gui/SurgeImageStore.h @@ -1,11 +1,12 @@ #pragma once #include "resource.h" -#include +#include #include #include #include #include +#include class SurgeImage; diff --git a/src/gui/SurgeJUCEHelpers.h b/src/gui/SurgeJUCEHelpers.h index a79a2955c01..2d852d2dc20 100644 --- a/src/gui/SurgeJUCEHelpers.h +++ b/src/gui/SurgeJUCEHelpers.h @@ -16,7 +16,7 @@ #ifndef SURGE_XT_JUCEHELPERS_H #define SURGE_XT_JUCEHELPERS_H -#include +#include "juce_gui_basics/juce_gui_basics.h" namespace Surge { diff --git a/src/gui/SurgeJUCELookAndFeel.h b/src/gui/SurgeJUCELookAndFeel.h index fe43df12a24..72cf7f5c377 100644 --- a/src/gui/SurgeJUCELookAndFeel.h +++ b/src/gui/SurgeJUCELookAndFeel.h @@ -16,7 +16,7 @@ #ifndef SURGE_XT_SURGEJUCELOOKANDFEEL_H #define SURGE_XT_SURGEJUCELOOKANDFEEL_H -#include +#include "juce_gui_basics/juce_gui_basics.h" class SurgeJUCELookAndFeel : public juce::LookAndFeel_V4 { diff --git a/src/gui/overlays/AboutScreen.h b/src/gui/overlays/AboutScreen.h index 5999380c6dd..0c1cf1b2245 100644 --- a/src/gui/overlays/AboutScreen.h +++ b/src/gui/overlays/AboutScreen.h @@ -16,9 +16,10 @@ #ifndef SURGE_XT_ABOUTSCREEN_H #define SURGE_XT_ABOUTSCREEN_H -#include #include "SkinSupport.h" +#include "juce_gui_basics/juce_gui_basics.h" + class SurgeGUIEditor; class SurgeStorage; diff --git a/src/gui/overlays/LuaEditors.h b/src/gui/overlays/LuaEditors.h index 8030710ca4b..41ade143faa 100644 --- a/src/gui/overlays/LuaEditors.h +++ b/src/gui/overlays/LuaEditors.h @@ -20,10 +20,11 @@ #ifndef SURGE_XT_LUAEDITORS_H #define SURGE_XT_LUAEDITORS_H -#include #include "SurgeStorage.h" #include "SkinSupport.h" +#include "juce_gui_extra/juce_gui_extra.h" + class SurgeGUIEditor; namespace Surge diff --git a/src/gui/overlays/MSEGEditor.h b/src/gui/overlays/MSEGEditor.h index 391e627431c..cd34bde1c40 100644 --- a/src/gui/overlays/MSEGEditor.h +++ b/src/gui/overlays/MSEGEditor.h @@ -14,11 +14,12 @@ */ #pragma once -#include #include "SurgeStorage.h" #include "SkinSupport.h" #include "RefreshableOverlay.h" +#include "juce_gui_basics/juce_gui_basics.h" + namespace Surge { namespace Overlays diff --git a/src/gui/overlays/MiniEdit.h b/src/gui/overlays/MiniEdit.h index a15494ca8a0..71e95c63920 100644 --- a/src/gui/overlays/MiniEdit.h +++ b/src/gui/overlays/MiniEdit.h @@ -16,9 +16,10 @@ #ifndef SURGE_XT_MINIEDIT_H #define SURGE_XT_MINIEDIT_H -#include #include "SkinSupport.h" +#include "juce_gui_basics/juce_gui_basics.h" + namespace Surge { namespace Overlays diff --git a/src/gui/overlays/ModulationEditor.h b/src/gui/overlays/ModulationEditor.h index b554e1ca04f..718eef90244 100644 --- a/src/gui/overlays/ModulationEditor.h +++ b/src/gui/overlays/ModulationEditor.h @@ -16,7 +16,7 @@ #ifndef SURGE_XT_MODULATIONEDITOR_H #define SURGE_XT_MODULATIONEDITOR_H -#include +#include "juce_gui_basics/juce_gui_basics.h" class SurgeGUIEditor; class SurgeSynthesizer; diff --git a/src/gui/overlays/OverlayWrapper.h b/src/gui/overlays/OverlayWrapper.h index 14bacdab4b1..7b2f0f95cec 100644 --- a/src/gui/overlays/OverlayWrapper.h +++ b/src/gui/overlays/OverlayWrapper.h @@ -16,9 +16,10 @@ #ifndef SURGE_XT_OVERLAYWRAPPER_H #define SURGE_XT_OVERLAYWRAPPER_H -#include #include "SkinSupport.h" +#include "juce_gui_basics/juce_gui_basics.h" + class SurgeGUIEditor; class SurgeImage; diff --git a/src/gui/overlays/PatchDBViewer.h b/src/gui/overlays/PatchDBViewer.h index 01b00c10aa2..10bc53aeeb6 100644 --- a/src/gui/overlays/PatchDBViewer.h +++ b/src/gui/overlays/PatchDBViewer.h @@ -16,9 +16,10 @@ #ifndef SURGE_PATCHDBVIEWER_H #define SURGE_PATCHDBVIEWER_H -#include #include "SurgeStorage.h" +#include "juce_gui_basics/juce_gui_basics.h" + class SurgeGUIEditor; namespace Surge diff --git a/src/gui/overlays/PatchStoreDialog.h b/src/gui/overlays/PatchStoreDialog.h index d6225fd98e6..9c4764f684d 100644 --- a/src/gui/overlays/PatchStoreDialog.h +++ b/src/gui/overlays/PatchStoreDialog.h @@ -16,9 +16,10 @@ #ifndef SURGE_XT_PATCHSTOREDIALOG_H #define SURGE_XT_PATCHSTOREDIALOG_H -#include #include "SkinSupport.h" +#include "juce_gui_basics/juce_gui_basics.h" + class SurgeGUIEditor; namespace Surge diff --git a/src/gui/overlays/TypeinParamEditor.h b/src/gui/overlays/TypeinParamEditor.h index e26ef1ce5fb..10edfe8289b 100644 --- a/src/gui/overlays/TypeinParamEditor.h +++ b/src/gui/overlays/TypeinParamEditor.h @@ -16,12 +16,13 @@ #ifndef SURGE_XT_TYPEINPARAMEDITOR_H #define SURGE_XT_TYPEINPARAMEDITOR_H -#include #include "Parameter.h" #include "SurgeStorage.h" #include "ModulationSource.h" #include "SkinSupport.h" +#include "juce_gui_basics/juce_gui_basics.h" + class SurgeGUIEditor; namespace Surge diff --git a/src/gui/widgets/EffectChooser.h b/src/gui/widgets/EffectChooser.h index 64abd0dcc70..7112a5fcbf7 100644 --- a/src/gui/widgets/EffectChooser.h +++ b/src/gui/widgets/EffectChooser.h @@ -16,13 +16,15 @@ #ifndef SURGE_XT_EFFECTCHOOSER_H #define SURGE_XT_EFFECTCHOOSER_H -#include -#include #include "SurgeStorage.h" #include "SkinSupport.h" #include "WidgetBaseMixin.h" #include "SurgeJUCEHelpers.h" +#include "juce_gui_basics/juce_gui_basics.h" + +#include + namespace Surge { namespace Widgets diff --git a/src/gui/widgets/EffectLabel.h b/src/gui/widgets/EffectLabel.h index a65b57a2627..e71b8f8816e 100644 --- a/src/gui/widgets/EffectLabel.h +++ b/src/gui/widgets/EffectLabel.h @@ -16,9 +16,11 @@ #ifndef SURGE_XT_EFFECTLABEL_H #define SURGE_XT_EFFECTLABEL_H -#include #include "SkinSupport.h" #include "RuntimeFont.h" + +#include "juce_gui_basics/juce_gui_basics.h" + #include namespace Surge diff --git a/src/gui/widgets/LFOAndStepDisplay.h b/src/gui/widgets/LFOAndStepDisplay.h index 9aa97a9975e..6463eeab29a 100644 --- a/src/gui/widgets/LFOAndStepDisplay.h +++ b/src/gui/widgets/LFOAndStepDisplay.h @@ -16,10 +16,11 @@ #ifndef SURGE_XT_LFOANDSTEPDISPLAY_H #define SURGE_XT_LFOANDSTEPDISPLAY_H -#include #include "WidgetBaseMixin.h" #include "SurgeStorage.h" +#include "juce_gui_basics/juce_gui_basics.h" + namespace Surge { namespace Widgets diff --git a/src/gui/widgets/MainFrame.h b/src/gui/widgets/MainFrame.h index e545bd6d894..2e1c5918439 100644 --- a/src/gui/widgets/MainFrame.h +++ b/src/gui/widgets/MainFrame.h @@ -16,10 +16,11 @@ #ifndef SURGE_XT_MAINFRAME_H #define SURGE_XT_MAINFRAME_H -#include #include "SurgeImage.h" #include "Parameter.h" +#include "juce_gui_basics/juce_gui_basics.h" + class SurgeGUIEditor; namespace Surge diff --git a/src/gui/widgets/MenuForDiscreteParams.h b/src/gui/widgets/MenuForDiscreteParams.h index 5929f7df92c..db97ed4b761 100644 --- a/src/gui/widgets/MenuForDiscreteParams.h +++ b/src/gui/widgets/MenuForDiscreteParams.h @@ -16,11 +16,13 @@ #ifndef SURGE_XT_MENUASMODULATABLEINTERFACE_H #define SURGE_XT_MENUASMODULATABLEINTERFACE_H -#include #include "SkinSupport.h" #include "WidgetBaseMixin.h" #include "ModulatableControlInterface.h" #include "SurgeJUCEHelpers.h" + +#include "juce_gui_basics/juce_gui_basics.h" + #include class SurgeImage; diff --git a/src/gui/widgets/ModulatableControlInterface.h b/src/gui/widgets/ModulatableControlInterface.h index 587ed2ade7b..614e3165ecb 100644 --- a/src/gui/widgets/ModulatableControlInterface.h +++ b/src/gui/widgets/ModulatableControlInterface.h @@ -16,7 +16,7 @@ #ifndef SURGE_XT_MODULATABLECONTROLINTERFACE_H #define SURGE_XT_MODULATABLECONTROLINTERFACE_H -#include +#include "juce_gui_basics/juce_gui_basics.h" namespace Surge { diff --git a/src/gui/widgets/ModulatableSlider.h b/src/gui/widgets/ModulatableSlider.h index e0ae7a0e617..bff0de936b1 100644 --- a/src/gui/widgets/ModulatableSlider.h +++ b/src/gui/widgets/ModulatableSlider.h @@ -16,12 +16,13 @@ #ifndef SURGE_XT_MODULATABLESLIDER_H #define SURGE_XT_MODULATABLESLIDER_H -#include #include "SkinSupport.h" #include "WidgetBaseMixin.h" #include "ModulatableControlInterface.h" #include "SurgeJUCEHelpers.h" +#include "juce_gui_basics/juce_gui_basics.h" + class SurgeStorage; namespace Surge diff --git a/src/gui/widgets/ModulationSourceButton.h b/src/gui/widgets/ModulationSourceButton.h index 6ce394dca79..ed425ecd48d 100644 --- a/src/gui/widgets/ModulationSourceButton.h +++ b/src/gui/widgets/ModulationSourceButton.h @@ -16,9 +16,11 @@ #ifndef SURGE_XT_MODULATIONSOURCEBUTTON_H #define SURGE_XT_MODULATIONSOURCEBUTTON_H -#include #include "WidgetBaseMixin.h" #include "ModulationSource.h" + +#include "juce_gui_basics/juce_gui_basics.h" + #include class SurgeStorage; diff --git a/src/gui/widgets/MultiSwitch.h b/src/gui/widgets/MultiSwitch.h index e0ab275609d..c103312cbe9 100644 --- a/src/gui/widgets/MultiSwitch.h +++ b/src/gui/widgets/MultiSwitch.h @@ -16,11 +16,11 @@ #ifndef SURGE_XT_MULTISWITCH_H #define SURGE_XT_MULTISWITCH_H -#include -#include -#include "SkinSupport.h" +#include "SurgeJUCEHelpers.h" #include "WidgetBaseMixin.h" +#include "juce_gui_basics/juce_gui_basics.h" + class SurgeImage; namespace Surge diff --git a/src/gui/widgets/NumberField.h b/src/gui/widgets/NumberField.h index 0fae86c738b..9e2c76b1e56 100644 --- a/src/gui/widgets/NumberField.h +++ b/src/gui/widgets/NumberField.h @@ -16,12 +16,13 @@ #ifndef SURGE_XT_NUMBERFIELD_H #define SURGE_XT_NUMBERFIELD_H -#include #include "SkinModel.h" #include "WidgetBaseMixin.h" #include "SurgeJUCEHelpers.h" #include "SurgeImage.h" +#include "juce_gui_basics/juce_gui_basics.h" + class SurgeStorage; namespace Surge diff --git a/src/gui/widgets/OscillatorWaveformDisplay.h b/src/gui/widgets/OscillatorWaveformDisplay.h index a76503c2c49..e285e6d032b 100644 --- a/src/gui/widgets/OscillatorWaveformDisplay.h +++ b/src/gui/widgets/OscillatorWaveformDisplay.h @@ -16,11 +16,12 @@ #ifndef SURGE_XT_OSCILLATORWAVEFORMDISPLAY_H #define SURGE_XT_OSCILLATORWAVEFORMDISPLAY_H -#include #include "SkinSupport.h" #include "Parameter.h" #include "SurgeStorage.h" +#include "juce_gui_basics/juce_gui_basics.h" + class SurgeStorage; class SurgeGUIEditor; class OscillatorStorage; diff --git a/src/gui/widgets/ParameterInfowindow.h b/src/gui/widgets/ParameterInfowindow.h index f87ac5df560..16772fa3593 100644 --- a/src/gui/widgets/ParameterInfowindow.h +++ b/src/gui/widgets/ParameterInfowindow.h @@ -16,10 +16,11 @@ #ifndef SURGE_XT_PARAMETERINFOWINDOW_H #define SURGE_XT_PARAMETERINFOWINDOW_H -#include #include "Parameter.h" #include "SkinSupport.h" +#include "juce_gui_basics/juce_gui_basics.h" + namespace Surge { namespace Widgets diff --git a/src/gui/widgets/PatchSelector.h b/src/gui/widgets/PatchSelector.h index ca28f4d9c2d..af0f6422de3 100644 --- a/src/gui/widgets/PatchSelector.h +++ b/src/gui/widgets/PatchSelector.h @@ -16,10 +16,10 @@ #ifndef SURGE_XT_PATCHSELECTOR_H #define SURGE_XT_PATCHSELECTOR_H -#include #include "SkinSupport.h" #include "WidgetBaseMixin.h" -#include "SurgeJUCEHelpers.h" + +#include "juce_gui_basics/juce_gui_basics.h" class SurgeStorage; diff --git a/src/gui/widgets/Switch.h b/src/gui/widgets/Switch.h index 316518bf21a..10d2b037f56 100644 --- a/src/gui/widgets/Switch.h +++ b/src/gui/widgets/Switch.h @@ -16,11 +16,12 @@ #ifndef SURGE_XT_SWITCH_H #define SURGE_XT_SWITCH_H -#include #include "SkinSupport.h" #include "WidgetBaseMixin.h" #include "SurgeJUCEHelpers.h" +#include "juce_gui_basics/juce_gui_basics.h" + class SurgeImage; namespace Surge diff --git a/src/gui/widgets/VerticalLabel.h b/src/gui/widgets/VerticalLabel.h index 7a41abbb9ed..cee2a06cfff 100644 --- a/src/gui/widgets/VerticalLabel.h +++ b/src/gui/widgets/VerticalLabel.h @@ -16,7 +16,8 @@ #ifndef SURGE_XT_VERTICAL_LABEL_H #define SURGE_XT_VERTICAL_LABEL_H -#include +#include "juce_gui_basics/juce_gui_basics.h" + #include namespace Surge diff --git a/src/gui/widgets/VuMeter.h b/src/gui/widgets/VuMeter.h index 77944697615..c8a440cb131 100644 --- a/src/gui/widgets/VuMeter.h +++ b/src/gui/widgets/VuMeter.h @@ -16,9 +16,10 @@ #ifndef SURGE_XT_VUMETER_H #define SURGE_XT_VUMETER_H -#include #include "WidgetBaseMixin.h" +#include "juce_gui_basics/juce_gui_basics.h" + class SurgeImage; namespace Surge diff --git a/src/gui/widgets/WaveShaperSelector.h b/src/gui/widgets/WaveShaperSelector.h index c9d9a2bd0b6..1487fed750b 100644 --- a/src/gui/widgets/WaveShaperSelector.h +++ b/src/gui/widgets/WaveShaperSelector.h @@ -5,12 +5,13 @@ #ifndef SURGE_XT_WAVESHAPERSELECTOR_H #define SURGE_XT_WAVESHAPERSELECTOR_H -#include #include "WidgetBaseMixin.h" #include "Parameter.h" #include "SurgeStorage.h" #include "SurgeJUCEHelpers.h" +#include "juce_gui_basics/juce_gui_basics.h" + namespace Surge { namespace Widgets diff --git a/src/gui/widgets/WidgetBaseMixin.h b/src/gui/widgets/WidgetBaseMixin.h index 8bcc3754a64..923e9153ac1 100644 --- a/src/gui/widgets/WidgetBaseMixin.h +++ b/src/gui/widgets/WidgetBaseMixin.h @@ -16,11 +16,13 @@ #ifndef SURGE_XT_WIDGETBASEMIXIN_H #define SURGE_XT_WIDGETBASEMIXIN_H -#include #include "SkinSupport.h" -#include #include "SurgeGUICallbackInterfaces.h" +#include "juce_gui_basics/juce_gui_basics.h" + +#include + class SurgeGUIEditor; namespace Surge diff --git a/src/gui/widgets/XMLConfiguredMenus.h b/src/gui/widgets/XMLConfiguredMenus.h index 4b24d2a1255..7847ef124e1 100644 --- a/src/gui/widgets/XMLConfiguredMenus.h +++ b/src/gui/widgets/XMLConfiguredMenus.h @@ -16,13 +16,14 @@ #ifndef SURGE_XT_XMLCONFIGUREDMENUS_H #define SURGE_XT_XMLCONFIGUREDMENUS_H -#include - -#include #include "WidgetBaseMixin.h" #include "SurgeJUCEHelpers.h" #include "FxPresetAndClipboardManager.h" +#include "juce_gui_basics/juce_gui_basics.h" + +#include + class SurgeStorage; class SurgeGUIEditor; class SurgeImage; diff --git a/src/surge_effects_bank/SurgeFXEditor.cpp b/src/surge_effects_bank/SurgeFXEditor.cpp index 2fedca680e1..62e726d8db7 100644 --- a/src/surge_effects_bank/SurgeFXEditor.cpp +++ b/src/surge_effects_bank/SurgeFXEditor.cpp @@ -58,9 +58,10 @@ SurgefxAudioProcessorEditor::SurgefxAudioProcessorEditor(SurgefxAudioProcessor & { fxParamSliders[i].setRange(0.0, 1.0, 0.0001); fxParamSliders[i].setValue(processor.getFXStorageValue01(i), - NotificationType::dontSendNotification); - fxParamSliders[i].setSliderStyle(Slider::SliderStyle::RotaryHorizontalVerticalDrag); - fxParamSliders[i].setTextBoxStyle(Slider::TextEntryBoxPosition::NoTextBox, true, 0, 0); + juce::NotificationType::dontSendNotification); + fxParamSliders[i].setSliderStyle(juce::Slider::SliderStyle::RotaryHorizontalVerticalDrag); + fxParamSliders[i].setTextBoxStyle(juce::Slider::TextEntryBoxPosition::NoTextBox, true, 0, + 0); juce::Rectangle position{(i / 6) * getWidth() / 2 + 5, (i % 6) * 60 + ypos0, 55, 55}; fxParamSliders[i].setBounds(position); fxParamSliders[i].setChangeNotificationOnlyOnRelease(false); @@ -88,7 +89,7 @@ SurgefxAudioProcessorEditor::SurgefxAudioProcessorEditor(SurgefxAudioProcessor & fxTempoSync[i].setBounds(tsPos); fxTempoSync[i].setEnabled(processor.canTempoSync(i)); fxTempoSync[i].setToggleState(processor.getFXStorageTempoSync(i), - NotificationType::dontSendNotification); + juce::NotificationType::dontSendNotification); fxTempoSync[i].onClick = [i, this]() { this->processor.setUserEditingParamFeature(i, true); this->processor.setFXParamTempoSync(i, this->fxTempoSync[i].getToggleState()); @@ -107,7 +108,7 @@ SurgefxAudioProcessorEditor::SurgefxAudioProcessorEditor(SurgefxAudioProcessor & fxDeactivated[i].setBounds(daPos); fxDeactivated[i].setEnabled(processor.canDeactitvate(i)); fxDeactivated[i].setToggleState(processor.getFXStorageDeactivated(i), - NotificationType::dontSendNotification); + juce::NotificationType::dontSendNotification); fxDeactivated[i].onClick = [i, this]() { this->processor.setUserEditingParamFeature(i, true); this->processor.setFXParamDeactivated(i, this->fxDeactivated[i].getToggleState()); @@ -127,7 +128,7 @@ SurgefxAudioProcessorEditor::SurgefxAudioProcessorEditor(SurgefxAudioProcessor & fxExtended[i].setBounds(exPos); fxExtended[i].setEnabled(processor.canExtend(i)); fxExtended[i].setToggleState(processor.getFXStorageExtended(i), - NotificationType::dontSendNotification); + juce::NotificationType::dontSendNotification); fxExtended[i].onClick = [i, this]() { this->processor.setUserEditingParamFeature(i, true); this->processor.setFXParamExtended(i, this->fxExtended[i].getToggleState()); @@ -147,7 +148,7 @@ SurgefxAudioProcessorEditor::SurgefxAudioProcessorEditor(SurgefxAudioProcessor & fxAbsoluted[i].setBounds(abPos); fxAbsoluted[i].setEnabled(processor.canAbsolute(i)); fxAbsoluted[i].setToggleState(processor.getFXParamAbsolute(i), - NotificationType::dontSendNotification); + juce::NotificationType::dontSendNotification); fxAbsoluted[i].onClick = [i, this]() { this->processor.setUserEditingParamFeature(i, true); this->processor.setFXParamAbsolute(i, this->fxAbsoluted[i].getToggleState()); @@ -251,11 +252,11 @@ SurgefxAudioProcessorEditor::SurgefxAudioProcessorEditor(SurgefxAudioProcessor & if (ty == en) { - selectType[i].setToggleState(true, NotificationType::dontSendNotification); + selectType[i].setToggleState(true, juce::NotificationType::dontSendNotification); } else { - selectType[i].setToggleState(false, NotificationType::dontSendNotification); + selectType[i].setToggleState(false, juce::NotificationType::dontSendNotification); } addAndMakeVisible(selectType[i]); @@ -278,7 +279,7 @@ void SurgefxAudioProcessorEditor::resetLabels() for (int i = 0; i < n_fx_params; ++i) { fxParamSliders[i].setValue(processor.getFXStorageValue01(i), - NotificationType::dontSendNotification); + juce::NotificationType::dontSendNotification); fxParamDisplay[i].setDisplay(processor.getParamValue(i).c_str()); fxParamDisplay[i].setGroup(processor.getParamGroup(i).c_str()); fxParamDisplay[i].setName(processor.getParamName(i).c_str()); @@ -288,18 +289,18 @@ void SurgefxAudioProcessorEditor::resetLabels() !processor.getFXStorageAppearsDeactivated(i)); fxTempoSync[i].setEnabled(processor.canTempoSync(i)); fxTempoSync[i].setToggleState(processor.getFXStorageTempoSync(i), - NotificationType::dontSendNotification); + juce::NotificationType::dontSendNotification); fxDeactivated[i].setEnabled(false); fxExtended[i].setEnabled(processor.canExtend(i)); fxExtended[i].setToggleState(processor.getFXStorageExtended(i), - NotificationType::dontSendNotification); + juce::NotificationType::dontSendNotification); fxAbsoluted[i].setEnabled(processor.canAbsolute(i)); fxAbsoluted[i].setToggleState(processor.getFXStorageAbsolute(i), - NotificationType::dontSendNotification); + juce::NotificationType::dontSendNotification); fxDeactivated[i].setEnabled(processor.canDeactitvate(i)); fxDeactivated[i].setToggleState(processor.getFXStorageDeactivated(i), - NotificationType::dontSendNotification); + juce::NotificationType::dontSendNotification); } int row = 0, col = 0; @@ -341,7 +342,7 @@ void SurgefxAudioProcessorEditor::paramsChangedCallback() { if (i < n_fx_params) { - fxParamSliders[i].setValue(fv[i], NotificationType::dontSendNotification); + fxParamSliders[i].setValue(fv[i], juce::NotificationType::dontSendNotification); fxParamDisplay[i].setDisplay(processor.getParamValue(i)); } else @@ -358,12 +359,12 @@ void SurgefxAudioProcessorEditor::blastToggleState(int w) for (auto i = 0; i < n_fx_types; ++i) { selectType[i].setToggleState(typeByButtonIndex[i] == w + 1, - NotificationType::dontSendNotification); + juce::NotificationType::dontSendNotification); } } //============================================================================== -void SurgefxAudioProcessorEditor::paint(Graphics &g) +void SurgefxAudioProcessorEditor::paint(juce::Graphics &g) { surgeLookFeel->paintComponentBackground(g, getWidth(), getHeight()); } diff --git a/src/surge_effects_bank/SurgeFXEditor.h b/src/surge_effects_bank/SurgeFXEditor.h index 626087cdf65..bde2632b751 100644 --- a/src/surge_effects_bank/SurgeFXEditor.h +++ b/src/surge_effects_bank/SurgeFXEditor.h @@ -10,21 +10,22 @@ #pragma once -#include "../JuceLibraryCode/JuceHeader.h" #include "SurgeFXProcessor.h" #include "SurgeLookAndFeel.h" +#include "juce_gui_basics/juce_gui_basics.h" + //============================================================================== /** */ -class SurgefxAudioProcessorEditor : public AudioProcessorEditor, AsyncUpdater +class SurgefxAudioProcessorEditor : public juce::AudioProcessorEditor, juce::AsyncUpdater { public: SurgefxAudioProcessorEditor(SurgefxAudioProcessor &); ~SurgefxAudioProcessorEditor(); //============================================================================== - void paint(Graphics &) override; + void paint(juce::Graphics &) override; void resized() override; void paramsChangedCallback(); @@ -42,14 +43,14 @@ class SurgefxAudioProcessorEditor : public AudioProcessorEditor, AsyncUpdater // access the processor object that created it. SurgefxAudioProcessor &processor; - Slider fxParamSliders[n_fx_params]; + juce::Slider fxParamSliders[n_fx_params]; SurgeFXParamDisplay fxParamDisplay[n_fx_params]; SurgeTempoSyncSwitch fxTempoSync[n_fx_params]; SurgeTempoSyncSwitch fxDeactivated[n_fx_params]; SurgeTempoSyncSwitch fxExtended[n_fx_params]; SurgeTempoSyncSwitch fxAbsoluted[n_fx_params]; - TextButton + juce::TextButton selectType[n_fx_types]; // this had better match the list of fxnames in the constructor int typeByButtonIndex[n_fx_types]; diff --git a/src/surge_effects_bank/SurgeFXProcessor.cpp b/src/surge_effects_bank/SurgeFXProcessor.cpp index 6a539189a6e..377ac240f1a 100644 --- a/src/surge_effects_bank/SurgeFXProcessor.cpp +++ b/src/surge_effects_bank/SurgeFXProcessor.cpp @@ -15,9 +15,9 @@ //============================================================================== SurgefxAudioProcessor::SurgefxAudioProcessor() : AudioProcessor(BusesProperties() - .withInput("Input", AudioChannelSet::stereo(), true) - .withOutput("Output", AudioChannelSet::stereo(), true) - .withInput("Sidechain", AudioChannelSet::stereo(), true)) + .withInput("Input", juce::AudioChannelSet::stereo(), true) + .withOutput("Output", juce::AudioChannelSet::stereo(), true) + .withInput("Sidechain", juce::AudioChannelSet::stereo(), true)) { effectNum = fxt_delay; storage.reset(new SurgeStorage()); @@ -35,13 +35,13 @@ SurgefxAudioProcessor::SurgefxAudioProcessor() snprintf(lb, 256, "fx_parm_%d", i); snprintf(nm, 256, "FX Parameter %d", i); - addParameter(fxParams[i] = - new AudioParameterFloat(lb, nm, juce::NormalisableRange(0.0, 1.0), - fxstorage->p[fx_param_remap[i]].get_value_f01())); + addParameter(fxParams[i] = new juce::AudioParameterFloat( + lb, nm, juce::NormalisableRange(0.0, 1.0), + fxstorage->p[fx_param_remap[i]].get_value_f01())); fxBaseParams[i] = fxParams[i]; } - addParameter( - fxType = new AudioParameterInt("fxtype", "FX Type", fxt_delay, n_fx_types - 1, effectNum)); + addParameter(fxType = new juce::AudioParameterInt("fxtype", "FX Type", fxt_delay, + n_fx_types - 1, effectNum)); fxBaseParams[n_fx_params] = fxType; for (int i = 0; i < n_fx_params; ++i) @@ -52,7 +52,7 @@ SurgefxAudioProcessor::SurgefxAudioProcessor() // if you change this 0xFF also change the divide in the setValueNotifyingHost in // setFXParamExtended etc - addParameter(fxParamFeatures[i] = new AudioParameterInt(lb, nm, 0, 0xFF, 0)); + addParameter(fxParamFeatures[i] = new juce::AudioParameterInt(lb, nm, 0, 0xFF, 0)); *(fxParamFeatures[i]) = paramFeatureFromParam(&(fxstorage->p[fx_param_remap[i]])); fxBaseParams[i + n_fx_params + 1] = fxParamFeatures[i]; } @@ -76,7 +76,7 @@ SurgefxAudioProcessor::SurgefxAudioProcessor() SurgefxAudioProcessor::~SurgefxAudioProcessor() {} //============================================================================== -const String SurgefxAudioProcessor::getName() const { return JucePlugin_Name; } +const juce::String SurgefxAudioProcessor::getName() const { return JucePlugin_Name; } bool SurgefxAudioProcessor::acceptsMidi() const { return false; } @@ -96,9 +96,9 @@ int SurgefxAudioProcessor::getCurrentProgram() { return 0; } void SurgefxAudioProcessor::setCurrentProgram(int index) {} -const String SurgefxAudioProcessor::getProgramName(int index) { return "Default"; } +const juce::String SurgefxAudioProcessor::getProgramName(int index) { return "Default"; } -void SurgefxAudioProcessor::changeProgramName(int index, const String &newName) {} +void SurgefxAudioProcessor::changeProgramName(int index, const juce::String &newName) {} //============================================================================== void SurgefxAudioProcessor::prepareToPlay(double sr, int samplesPerBlock) @@ -117,17 +117,18 @@ bool SurgefxAudioProcessor::isBusesLayoutSupported(const BusesLayout &layouts) c // the sidechain can take any layout, the main bus needs to be the same on the input and output return layouts.getMainInputChannelSet() == layouts.getMainOutputChannelSet() && !layouts.getMainInputChannelSet().isDisabled() && - layouts.getMainInputChannelSet() == AudioChannelSet::stereo(); + layouts.getMainInputChannelSet() == juce::AudioChannelSet::stereo(); } #define is_aligned(POINTER, BYTE_COUNT) (((uintptr_t)(const void *)(POINTER)) % (BYTE_COUNT) == 0) -void SurgefxAudioProcessor::processBlock(AudioBuffer &buffer, MidiBuffer &midiMessages) +void SurgefxAudioProcessor::processBlock(juce::AudioBuffer &buffer, + juce::MidiBuffer &midiMessages) { if (resettingFx || !surge_effect) return; - ScopedNoDenormals noDenormals; + juce::ScopedNoDenormals noDenormals; if (surge_effect->checkHasInvalidatedUI()) { @@ -138,7 +139,7 @@ void SurgefxAudioProcessor::processBlock(AudioBuffer &buffer, MidiBuffer auto playhead = getPlayHead(); if (playhead) { - AudioPlayHead::CurrentPositionInfo cp; + juce::AudioPlayHead::CurrentPositionInfo cp; playhead->getCurrentPosition(cp); thisBPM = cp.bpm; } @@ -217,15 +218,15 @@ bool SurgefxAudioProcessor::hasEditor() const return true; // (change this to false if you choose to not supply an editor) } -AudioProcessorEditor *SurgefxAudioProcessor::createEditor() +juce::AudioProcessorEditor *SurgefxAudioProcessor::createEditor() { return new SurgefxAudioProcessorEditor(*this); } //============================================================================== -void SurgefxAudioProcessor::getStateInformation(MemoryBlock &destData) +void SurgefxAudioProcessor::getStateInformation(juce::MemoryBlock &destData) { - std::unique_ptr xml(new XmlElement("surgefx")); + std::unique_ptr xml(new juce::XmlElement("surgefx")); xml->setAttribute("streamingVersion", (int)1); for (int i = 0; i < n_fx_params; ++i) { @@ -245,7 +246,7 @@ void SurgefxAudioProcessor::getStateInformation(MemoryBlock &destData) void SurgefxAudioProcessor::setStateInformation(const void *data, int sizeInBytes) { - std::unique_ptr xmlState(getXmlFromBinary(data, sizeInBytes)); + std::unique_ptr xmlState(getXmlFromBinary(data, sizeInBytes)); if (xmlState.get() != nullptr) { if (xmlState->hasTagName("surgefx")) @@ -426,4 +427,4 @@ void SurgefxAudioProcessor::setupStorageRanges(Parameter *start, Parameter *endI //============================================================================== // This creates new instances of the plugin.. -AudioProcessor *JUCE_CALLTYPE createPluginFilter() { return new SurgefxAudioProcessor(); } +juce::AudioProcessor *JUCE_CALLTYPE createPluginFilter() { return new SurgefxAudioProcessor(); } diff --git a/src/surge_effects_bank/SurgeFXProcessor.h b/src/surge_effects_bank/SurgeFXProcessor.h index 391cb03a4e0..5979948e581 100644 --- a/src/surge_effects_bank/SurgeFXProcessor.h +++ b/src/surge_effects_bank/SurgeFXProcessor.h @@ -10,11 +10,11 @@ #pragma once -#include "../JuceLibraryCode/JuceHeader.h" #include "SurgeStorage.h" -#include #include "Effect.h" +#include "juce_audio_processors/juce_audio_processors.h" + #if MAC #include #endif @@ -22,9 +22,9 @@ //============================================================================== /** */ -class SurgefxAudioProcessor : public AudioProcessor, - public AudioProcessorParameter::Listener, - public AsyncUpdater +class SurgefxAudioProcessor : public juce::AudioProcessor, + public juce::AudioProcessorParameter::Listener, + public juce::AsyncUpdater { public: //============================================================================== @@ -37,14 +37,14 @@ class SurgefxAudioProcessor : public AudioProcessor, bool isBusesLayoutSupported(const BusesLayout &layouts) const override; - void processBlock(AudioBuffer &, MidiBuffer &) override; + void processBlock(juce::AudioBuffer &, juce::MidiBuffer &) override; //============================================================================== - AudioProcessorEditor *createEditor() override; + juce::AudioProcessorEditor *createEditor() override; bool hasEditor() const override; //============================================================================== - const String getName() const override; + const juce::String getName() const override; bool acceptsMidi() const override; bool producesMidi() const override; @@ -55,11 +55,11 @@ class SurgefxAudioProcessor : public AudioProcessor, int getNumPrograms() override; int getCurrentProgram() override; void setCurrentProgram(int index) override; - const String getProgramName(int index) override; - void changeProgramName(int index, const String &newName) override; + const juce::String getProgramName(int index) override; + void changeProgramName(int index, const juce::String &newName) override; //============================================================================== - void getStateInformation(MemoryBlock &destData) override; + void getStateInformation(juce::MemoryBlock &destData) override; void setStateInformation(const void *data, int sizeInBytes) override; int getEffectType() { return effectNum; } @@ -247,12 +247,12 @@ class SurgefxAudioProcessor : public AudioProcessor, private: //============================================================================== - AudioProcessorParameter *fxBaseParams[2 * n_fx_params + 1]; + juce::AudioProcessorParameter *fxBaseParams[2 * n_fx_params + 1]; // These are just copyes of the pointer from above with the cast done to make the code look // nicer - AudioParameterFloat *fxParams[n_fx_params]; - AudioParameterInt *fxType; + juce::AudioParameterFloat *fxParams[n_fx_params]; + juce::AudioParameterInt *fxType; enum ParamFeatureFlags { @@ -261,7 +261,7 @@ class SurgefxAudioProcessor : public AudioProcessor, kAbsolute = 1U << 2U, kDeactivated = 1U << 3U }; - AudioParameterInt *fxParamFeatures[n_fx_params]; + juce::AudioParameterInt *fxParamFeatures[n_fx_params]; std::atomic changedParams[2 * n_fx_params + 1]; std::atomic changedParamsValue[2 * n_fx_params + 1]; diff --git a/src/surge_effects_bank/SurgeLookAndFeel.h b/src/surge_effects_bank/SurgeLookAndFeel.h index 497967a8625..3801cf9caec 100644 --- a/src/surge_effects_bank/SurgeLookAndFeel.h +++ b/src/surge_effects_bank/SurgeLookAndFeel.h @@ -1,12 +1,14 @@ // -*- mode: c++-mode -*- -#include "../JuceLibraryCode/JuceHeader.h" #include "version.h" -class SurgeLookAndFeel : public LookAndFeel_V4 +#include "juce_gui_basics/juce_gui_basics.h" +#include "BinaryData.h" + +class SurgeLookAndFeel : public juce::LookAndFeel_V4 { private: - std::unique_ptr surgeLogo; + std::unique_ptr surgeLogo; public: enum SurgeColourIds @@ -47,13 +49,13 @@ class SurgeLookAndFeel : public LookAndFeel_V4 SurgeLookAndFeel() { - Colour surgeGrayBg = Colour(205, 206, 212); - Colour surgeOrange = Colour(255, 144, 0); - Colour surgeBlue = Colour(18, 52, 99); - Colour white = Colour(255, 255, 255); - Colour black = Colour(0, 0, 0); - Colour surgeOrangeDark = Colour(101, 50, 3); - Colour surgeOrangeMedium = Colour(227, 112, 8); + juce::Colour surgeGrayBg = juce::Colour(205, 206, 212); + juce::Colour surgeOrange = juce::Colour(255, 144, 0); + juce::Colour surgeBlue = juce::Colour(18, 52, 99); + juce::Colour white = juce::Colour(255, 255, 255); + juce::Colour black = juce::Colour(0, 0, 0); + juce::Colour surgeOrangeDark = juce::Colour(101, 50, 3); + juce::Colour surgeOrangeMedium = juce::Colour(227, 112, 8); setColour(SurgeColourIds::componentBgStart, surgeGrayBg.interpolatedWith(surgeOrangeMedium, 0.1)); @@ -86,13 +88,13 @@ class SurgeLookAndFeel : public LookAndFeel_V4 setColour(SurgeColourIds::paramDisabledEdge, juce::Colour(150, 150, 150)); setColour(SurgeColourIds::paramDisplay, white); - surgeLogo = Drawable::createFromImageData(BinaryData::SurgeLogoOnlyBlue_svg, - BinaryData::SurgeLogoOnlyBlue_svgSize); + surgeLogo = juce::Drawable::createFromImageData(BinaryData::SurgeLogoOnlyBlue_svg, + BinaryData::SurgeLogoOnlyBlue_svgSize); } - virtual void drawRotarySlider(Graphics &g, int x, int y, int width, int height, float sliderPos, - float rotaryStartAngle, float rotaryEndAngle, - Slider &slider) override + virtual void drawRotarySlider(juce::Graphics &g, int x, int y, int width, int height, + float sliderPos, float rotaryStartAngle, float rotaryEndAngle, + juce::Slider &slider) override { auto fill = findColour(SurgeColourIds::knobBg); auto edge = findColour(SurgeColourIds::knobEdge); @@ -111,14 +113,16 @@ class SurgeLookAndFeel : public LookAndFeel_V4 g.setColour(edge); g.drawEllipse(bounds, 1.0); - auto radius = jmin(bounds.getWidth(), bounds.getHeight()) / 2.0f; + auto radius = juce::jmin(bounds.getWidth(), bounds.getHeight()) / 2.0f; auto arcRadius = radius; auto toAngle = rotaryStartAngle + sliderPos * (rotaryEndAngle - rotaryStartAngle); auto thumbWidth = 5; juce::Point thumbPoint( - bounds.getCentreX() + arcRadius * std::cos(toAngle - MathConstants::halfPi), - bounds.getCentreY() + arcRadius * std::sin(toAngle - MathConstants::halfPi)); + bounds.getCentreX() + + arcRadius * std::cos(toAngle - juce::MathConstants::halfPi), + bounds.getCentreY() + + arcRadius * std::sin(toAngle - juce::MathConstants::halfPi)); g.setColour(tick); g.fillEllipse(juce::Rectangle(thumbWidth, thumbWidth).withCentre(thumbPoint)); @@ -128,11 +132,12 @@ class SurgeLookAndFeel : public LookAndFeel_V4 g.fillEllipse( juce::Rectangle(thumbWidth, thumbWidth).withCentre(bounds.getCentre())); - auto l = Line(thumbPoint, bounds.getCentre()); + auto l = juce::Line(thumbPoint, bounds.getCentre()); g.drawLine(l, thumbWidth); } - virtual void drawButtonBackground(Graphics &g, Button &button, const Colour &backgroundColour, + virtual void drawButtonBackground(juce::Graphics &g, juce::Button &button, + const juce::Colour &backgroundColour, bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) override { @@ -175,27 +180,29 @@ class SurgeLookAndFeel : public LookAndFeel_V4 g.drawRoundedRectangle(bounds, 3, edgeThickness); } - virtual void drawButtonText(Graphics &g, TextButton &button, bool shouldDrawButtonAsHighlighted, + virtual void drawButtonText(juce::Graphics &g, juce::TextButton &button, + bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) override { - button.setColour(TextButton::ColourIds::textColourOffId, + button.setColour(juce::TextButton::ColourIds::textColourOffId, findColour(SurgeColourIds::fxButtonTextUnselected)); - button.setColour(TextButton::ColourIds::textColourOnId, + button.setColour(juce::TextButton::ColourIds::textColourOnId, findColour(SurgeColourIds::fxButtonTextSelected)); LookAndFeel_V4::drawButtonText(g, button, shouldDrawButtonAsHighlighted, shouldDrawButtonAsDown); } - void paintComponentBackground(Graphics &g, int w, int h) + void paintComponentBackground(juce::Graphics &g, int w, int h) { int orangeHeight = 40; g.fillAll(findColour(SurgeColourIds::componentBgStart)); - ColourGradient cg(findColour(SurgeColourIds::componentBgStart), 0, 0, - findColour(SurgeColourIds::componentBgEnd), 0, h - orangeHeight, false); + juce::ColourGradient cg(findColour(SurgeColourIds::componentBgStart), 0, 0, + findColour(SurgeColourIds::componentBgEnd), 0, h - orangeHeight, + false); g.setGradientFill(cg); g.fillRect(0, 0, w, h - orangeHeight); @@ -221,7 +228,7 @@ class SurgeLookAndFeel : public LookAndFeel_V4 } }; -class SurgeFXParamDisplay : public Component +class SurgeFXParamDisplay : public juce::Component { public: virtual void setGroup(std::string grp) @@ -246,7 +253,7 @@ class SurgeFXParamDisplay : public Component repaint(); } - virtual void paint(Graphics &g) + virtual void paint(juce::Graphics &g) { auto bounds = getLocalBounds().toFloat().reduced(2.f, 2.f); auto edge = findColour(SurgeLookAndFeel::SurgeColourIds::paramEnabledEdge); @@ -284,19 +291,19 @@ class SurgeFXParamDisplay : public Component bool appearsDeactivated = false; }; -class SurgeTempoSyncSwitch : public ToggleButton +class SurgeTempoSyncSwitch : public juce::ToggleButton { public: void setOnOffImage(const char *onimgData, size_t onimgSize, const char *offimgData, size_t offimgSize) { - onImg = Drawable::createFromImageData(onimgData, onimgSize); - offImg = Drawable::createFromImageData(offimgData, offimgSize); + onImg = juce::Drawable::createFromImageData(onimgData, onimgSize); + offImg = juce::Drawable::createFromImageData(offimgData, offimgSize); } std::unique_ptr onImg, offImg; protected: - virtual void paintButton(Graphics &g, bool shouldDrawButtonAsHighlighted, + virtual void paintButton(juce::Graphics &g, bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) override { if (isEnabled() && onImg && offImg) diff --git a/src/surge_synth_juce/LockFreeStack.h b/src/surge_synth_juce/LockFreeStack.h index 21dd4ac914e..e7a37e38c55 100644 --- a/src/surge_synth_juce/LockFreeStack.h +++ b/src/surge_synth_juce/LockFreeStack.h @@ -16,7 +16,8 @@ #ifndef SURGE_XT_LOCKFREESTACK_H #define SURGE_XT_LOCKFREESTACK_H -#include +#include "juce_core/juce_core.h" + #include template class LockFreeStack diff --git a/src/surge_synth_juce/SurgeSynthEditor.h b/src/surge_synth_juce/SurgeSynthEditor.h index f9a17d11219..8db25d95410 100644 --- a/src/surge_synth_juce/SurgeSynthEditor.h +++ b/src/surge_synth_juce/SurgeSynthEditor.h @@ -10,10 +10,10 @@ #pragma once -#include - #include "SurgeSynthProcessor.h" +#include "juce_audio_utils/juce_audio_utils.h" + class SurgeGUIEditor; class SurgeJUCELookAndFeel; diff --git a/src/surge_synth_juce/SurgeSynthProcessor.h b/src/surge_synth_juce/SurgeSynthProcessor.h index 44948e601a7..c15cc59ee9e 100644 --- a/src/surge_synth_juce/SurgeSynthProcessor.h +++ b/src/surge_synth_juce/SurgeSynthProcessor.h @@ -10,13 +10,12 @@ #pragma once -#include - #include "SurgeSynthesizer.h" #include "SurgeStorage.h" #include "LockFreeStack.h" -#include +#include "juce_audio_processors/juce_audio_processors.h" + #include #if MAC diff --git a/src/surge_synth_juce/SurgeSynthVST3Extensions.cpp b/src/surge_synth_juce/SurgeSynthVST3Extensions.cpp index 543017d1035..f4912243a96 100644 --- a/src/surge_synth_juce/SurgeSynthVST3Extensions.cpp +++ b/src/surge_synth_juce/SurgeSynthVST3Extensions.cpp @@ -13,7 +13,6 @@ ** open source in September 2018. */ -#include #include #include "SurgeSynthProcessor.h"