diff --git a/source/modules/distrho/DistrhoUI.hpp b/source/modules/distrho/DistrhoUI.hpp index e6c831104..2832db0b6 100644 --- a/source/modules/distrho/DistrhoUI.hpp +++ b/source/modules/distrho/DistrhoUI.hpp @@ -140,6 +140,12 @@ protected: */ virtual void d_uiIdle() {} + /** + File browser selected function. + @see Window::fileBrowserSelected(const char*) + */ + virtual void d_uiFileBrowserSelected(const char* filename); + /** OpenGL window reshape function, called when parent window is resized. You can reimplement this function for a custom OpenGL state. diff --git a/source/modules/distrho/src/DistrhoPluginLV2export.cpp b/source/modules/distrho/src/DistrhoPluginLV2export.cpp index c362d4147..f777bd10d 100644 --- a/source/modules/distrho/src/DistrhoPluginLV2export.cpp +++ b/source/modules/distrho/src/DistrhoPluginLV2export.cpp @@ -44,6 +44,11 @@ # define DISTRHO_PLUGIN_MINIMUM_BUFFER_SIZE 2048 #endif +#if DISTRHO_PLUGIN_HAS_UI && ! defined(HAVE_DGL) +# undef DISTRHO_PLUGIN_HAS_UI +# define DISTRHO_PLUGIN_HAS_UI 0 +#endif + #define DISTRHO_LV2_USE_EVENTS_IN (DISTRHO_PLUGIN_HAS_MIDI_INPUT || DISTRHO_PLUGIN_WANT_TIMEPOS || (DISTRHO_PLUGIN_WANT_STATE && DISTRHO_PLUGIN_HAS_UI)) #define DISTRHO_LV2_USE_EVENTS_OUT (DISTRHO_PLUGIN_HAS_MIDI_OUTPUT || (DISTRHO_PLUGIN_WANT_STATE && DISTRHO_PLUGIN_HAS_UI)) diff --git a/source/modules/distrho/src/DistrhoPluginVST.cpp b/source/modules/distrho/src/DistrhoPluginVST.cpp index 430c81f09..eaabd1dd4 100644 --- a/source/modules/distrho/src/DistrhoPluginVST.cpp +++ b/source/modules/distrho/src/DistrhoPluginVST.cpp @@ -16,6 +16,11 @@ #include "DistrhoPluginInternal.hpp" +#if DISTRHO_PLUGIN_HAS_UI && ! defined(HAVE_DGL) +# undef DISTRHO_PLUGIN_HAS_UI +# define DISTRHO_PLUGIN_HAS_UI 0 +#endif + #if DISTRHO_PLUGIN_HAS_UI # include "DistrhoUIInternal.hpp" #endif @@ -371,8 +376,10 @@ public: case effSetSampleRate: fPlugin.setSampleRate(opt, true); +#if DISTRHO_PLUGIN_HAS_UI if (fVstUI != nullptr) fVstUI->setSampleRate(opt); +#endif break; case effSetBlockSize: @@ -583,7 +590,7 @@ public: case effCanDo: if (const char* const canDo = (const char*)ptr) { -# if DISTRHO_OS_MAC +# if DISTRHO_OS_MAC && DISTRHO_PLUGIN_HAS_UI if (std::strcmp(canDo, "hasCockosViewAsConfig") == 0) { fUsingNsView = true; diff --git a/source/modules/distrho/src/DistrhoUI.cpp b/source/modules/distrho/src/DistrhoUI.cpp index 82ea7a565..49e8c3e62 100644 --- a/source/modules/distrho/src/DistrhoUI.cpp +++ b/source/modules/distrho/src/DistrhoUI.cpp @@ -90,6 +90,10 @@ void UI::d_sampleRateChanged(double) {} /* ------------------------------------------------------------------------------------------------------------ * UI Callbacks (optional) */ +void UI::d_uiFileBrowserSelected(const char*) +{ +} + void UI::d_uiReshape(uint width, uint height) { glEnable(GL_BLEND); diff --git a/source/modules/distrho/src/DistrhoUIInternal.hpp b/source/modules/distrho/src/DistrhoUIInternal.hpp index a17e2aae1..a07719cad 100644 --- a/source/modules/distrho/src/DistrhoUIInternal.hpp +++ b/source/modules/distrho/src/DistrhoUIInternal.hpp @@ -170,16 +170,23 @@ public: } protected: + // custom window reshape void onReshape(uint width, uint height) override { DISTRHO_SAFE_ASSERT_RETURN(fUI != nullptr,); - // custom window reshape fUI->d_uiReshape(width, height); - fIsReady = true; } + // custom file-browser selected + void fileBrowserSelected(const char* filename) override + { + DISTRHO_SAFE_ASSERT_RETURN(fUI != nullptr,); + + fUI->d_uiFileBrowserSelected(filename); + } + private: UI* const fUI; bool fIsReady;