From da7642bf16fed0c8dcca619f8a02243e723140bd Mon Sep 17 00:00:00 2001 From: falkTX Date: Thu, 29 Dec 2022 00:49:44 +0000 Subject: [PATCH] Define and use DISTRHO_UI_DEFAULT_WIDTH/HEIGHT in info example Signed-off-by: falkTX --- examples/Info/DistrhoPluginInfo.h | 2 ++ examples/Info/InfoExampleUI.cpp | 9 +++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/examples/Info/DistrhoPluginInfo.h b/examples/Info/DistrhoPluginInfo.h index 0305639b..d0c4583d 100644 --- a/examples/Info/DistrhoPluginInfo.h +++ b/examples/Info/DistrhoPluginInfo.h @@ -27,6 +27,8 @@ #define DISTRHO_PLUGIN_NUM_INPUTS 2 #define DISTRHO_PLUGIN_NUM_OUTPUTS 2 #define DISTRHO_PLUGIN_WANT_TIMEPOS 1 +#define DISTRHO_UI_DEFAULT_WIDTH 405 +#define DISTRHO_UI_DEFAULT_HEIGHT 256 #define DISTRHO_UI_FILE_BROWSER 0 #define DISTRHO_UI_USER_RESIZABLE 1 #define DISTRHO_UI_USE_NANOVG 1 diff --git a/examples/Info/InfoExampleUI.cpp b/examples/Info/InfoExampleUI.cpp index d0ef002c..24f37320 100644 --- a/examples/Info/InfoExampleUI.cpp +++ b/examples/Info/InfoExampleUI.cpp @@ -26,12 +26,9 @@ using DGL_NAMESPACE::ResizeHandle; class InfoExampleUI : public UI { - static const uint kInitialWidth = 405; - static const uint kInitialHeight = 256; - public: InfoExampleUI() - : UI(kInitialWidth, kInitialHeight), + : UI(DISTRHO_UI_DEFAULT_WIDTH, DISTRHO_UI_DEFAULT_HEIGHT), fSampleRate(getSampleRate()), fResizable(isResizable()), fScale(1.0f), @@ -47,7 +44,7 @@ public: loadSharedResources(); #endif - setGeometryConstraints(kInitialWidth, kInitialHeight, true); + setGeometryConstraints(DISTRHO_UI_DEFAULT_WIDTH, DISTRHO_UI_DEFAULT_HEIGHT, true); // no need to show resize handle if window is user-resizable if (fResizable) @@ -192,7 +189,7 @@ protected: void onResize(const ResizeEvent& ev) override { - fScale = static_cast(ev.size.getHeight())/static_cast(kInitialHeight); + fScale = static_cast(ev.size.getHeight())/static_cast(DISTRHO_UI_DEFAULT_HEIGHT); UI::onResize(ev); }