DPF

DISTRHO Plugin Framework
Log | Files | Refs | Submodules | README | LICENSE

commit da7642bf16fed0c8dcca619f8a02243e723140bd
parent 3b9652a476082dc1fc0f4267012f22d7b996a682
Author: falkTX <falktx@falktx.com>
Date:   Thu, 29 Dec 2022 00:49:17 +0000

Define and use DISTRHO_UI_DEFAULT_WIDTH/HEIGHT in info example

Signed-off-by: falkTX <falktx@falktx.com>

Diffstat:
Mexamples/Info/DistrhoPluginInfo.h | 2++
Mexamples/Info/InfoExampleUI.cpp | 9+++------
2 files changed, 5 insertions(+), 6 deletions(-)

diff --git 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 @@ -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<float>(ev.size.getHeight())/static_cast<float>(kInitialHeight); + fScale = static_cast<float>(ev.size.getHeight())/static_cast<float>(DISTRHO_UI_DEFAULT_HEIGHT); UI::onResize(ev); }