@@ -140,6 +140,12 @@ protected: | |||||
*/ | */ | ||||
virtual void d_uiIdle() {} | 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. | OpenGL window reshape function, called when parent window is resized. | ||||
You can reimplement this function for a custom OpenGL state. | You can reimplement this function for a custom OpenGL state. | ||||
@@ -44,6 +44,11 @@ | |||||
# define DISTRHO_PLUGIN_MINIMUM_BUFFER_SIZE 2048 | # define DISTRHO_PLUGIN_MINIMUM_BUFFER_SIZE 2048 | ||||
#endif | #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_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)) | #define DISTRHO_LV2_USE_EVENTS_OUT (DISTRHO_PLUGIN_HAS_MIDI_OUTPUT || (DISTRHO_PLUGIN_WANT_STATE && DISTRHO_PLUGIN_HAS_UI)) | ||||
@@ -16,6 +16,11 @@ | |||||
#include "DistrhoPluginInternal.hpp" | #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 | #if DISTRHO_PLUGIN_HAS_UI | ||||
# include "DistrhoUIInternal.hpp" | # include "DistrhoUIInternal.hpp" | ||||
#endif | #endif | ||||
@@ -371,8 +376,10 @@ public: | |||||
case effSetSampleRate: | case effSetSampleRate: | ||||
fPlugin.setSampleRate(opt, true); | fPlugin.setSampleRate(opt, true); | ||||
#if DISTRHO_PLUGIN_HAS_UI | |||||
if (fVstUI != nullptr) | if (fVstUI != nullptr) | ||||
fVstUI->setSampleRate(opt); | fVstUI->setSampleRate(opt); | ||||
#endif | |||||
break; | break; | ||||
case effSetBlockSize: | case effSetBlockSize: | ||||
@@ -583,7 +590,7 @@ public: | |||||
case effCanDo: | case effCanDo: | ||||
if (const char* const canDo = (const char*)ptr) | 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) | if (std::strcmp(canDo, "hasCockosViewAsConfig") == 0) | ||||
{ | { | ||||
fUsingNsView = true; | fUsingNsView = true; | ||||
@@ -90,6 +90,10 @@ void UI::d_sampleRateChanged(double) {} | |||||
/* ------------------------------------------------------------------------------------------------------------ | /* ------------------------------------------------------------------------------------------------------------ | ||||
* UI Callbacks (optional) */ | * UI Callbacks (optional) */ | ||||
void UI::d_uiFileBrowserSelected(const char*) | |||||
{ | |||||
} | |||||
void UI::d_uiReshape(uint width, uint height) | void UI::d_uiReshape(uint width, uint height) | ||||
{ | { | ||||
glEnable(GL_BLEND); | glEnable(GL_BLEND); | ||||
@@ -170,16 +170,23 @@ public: | |||||
} | } | ||||
protected: | protected: | ||||
// custom window reshape | |||||
void onReshape(uint width, uint height) override | void onReshape(uint width, uint height) override | ||||
{ | { | ||||
DISTRHO_SAFE_ASSERT_RETURN(fUI != nullptr,); | DISTRHO_SAFE_ASSERT_RETURN(fUI != nullptr,); | ||||
// custom window reshape | |||||
fUI->d_uiReshape(width, height); | fUI->d_uiReshape(width, height); | ||||
fIsReady = true; | fIsReady = true; | ||||
} | } | ||||
// custom file-browser selected | |||||
void fileBrowserSelected(const char* filename) override | |||||
{ | |||||
DISTRHO_SAFE_ASSERT_RETURN(fUI != nullptr,); | |||||
fUI->d_uiFileBrowserSelected(filename); | |||||
} | |||||
private: | private: | ||||
UI* const fUI; | UI* const fUI; | ||||
bool fIsReady; | bool fIsReady; | ||||