Browse Source

Define and use DISTRHO_UI_DEFAULT_WIDTH/HEIGHT in info example

Signed-off-by: falkTX <falktx@falktx.com>
pull/397/head
falkTX 3 years ago
parent
commit
da7642bf16
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
2 changed files with 5 additions and 6 deletions
  1. +2
    -0
      examples/Info/DistrhoPluginInfo.h
  2. +3
    -6
      examples/Info/InfoExampleUI.cpp

+ 2
- 0
examples/Info/DistrhoPluginInfo.h View File

@@ -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


+ 3
- 6
examples/Info/InfoExampleUI.cpp View File

@@ -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);
}


Loading…
Cancel
Save