Browse Source

Auto-scale carla-vst plugin GUI

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.5.6
falkTX 1 year ago
parent
commit
03a537e4b9
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
3 changed files with 23 additions and 5 deletions
  1. +4
    -3
      source/plugin/carla-vst.cpp
  2. +6
    -1
      source/plugin/carla-vst.hpp
  3. +13
    -1
      source/plugin/ui_launcher.cpp

+ 4
- 3
source/plugin/carla-vst.cpp View File

@@ -1,6 +1,6 @@
/*
* Carla Native Plugins
* Copyright (C) 2013-2022 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2013-2023 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -398,7 +398,7 @@ public:
break;

case effEditGetRect:
*(ERect**)ptr = &fVstRect;
*(VstRect**)ptr = &fVstRect;
ret = 1;
break;

@@ -409,6 +409,7 @@ public:
{
destoryUILauncher(fUiLauncher);
fUiLauncher = createUILauncher((uintptr_t)ptr, fDescriptor, fHandle);
getUILauncherSize(fUiLauncher, &fVstRect);
}
else
{
@@ -833,7 +834,7 @@ private:
NativeMidiEvent fMidiEvents[kMaxMidiEvents];
char fProgramName[32+1];
NativeTimeInfo fTimeInfo;
ERect fVstRect;
VstRect fVstRect;

// UI button
CarlaUILauncher* fUiLauncher;


+ 6
- 1
source/plugin/carla-vst.hpp View File

@@ -1,6 +1,6 @@
/*
* Carla Native Plugins
* Copyright (C) 2013-2022 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2013-2023 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -32,7 +32,12 @@ struct VstObject {
NativePlugin* plugin;
};

struct VstRect {
int16_t top, left, bottom, right;
};

CarlaUILauncher* createUILauncher(uintptr_t winId, const NativePluginDescriptor* d, NativePluginHandle h);
void getUILauncherSize(CarlaUILauncher* ui, VstRect* rect);
void idleUILauncher(CarlaUILauncher* ui);
void destoryUILauncher(CarlaUILauncher* ui);



+ 13
- 1
source/plugin/ui_launcher.cpp View File

@@ -1,6 +1,6 @@
/*
* Carla Native Plugin UI launcher
* Copyright (C) 2018-2022 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2018-2023 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -90,6 +90,12 @@ public:
handle(h),
pluginWindow(parent)
{
const uint width = ui_launcher_res::carla_uiWidth;
const uint height = ui_launcher_res::carla_uiHeight;

Widget::setSize(width, height);
setGeometryConstraints(width, height, true, true, true);

startButton.setCallback(this);

pluginWindow.leaveContextAfterCreation();
@@ -148,6 +154,12 @@ CarlaUILauncher* createUILauncher(const uintptr_t winId,
return new CarlaUILauncher(winId, d, h);
}

void getUILauncherSize(CarlaUILauncher* const ui, VstRect* const rect)
{
rect->right = ui->window.getWidth();
rect->bottom = ui->window.getHeight();
}

void idleUILauncher(CarlaUILauncher* const ui)
{
ui->app.idle();


Loading…
Cancel
Save