Browse Source

Save and re-use last plugin UI pos when possible (runtime)

tags/1.9.4
falkTX 11 years ago
parent
commit
36afd24d19
6 changed files with 18 additions and 4 deletions
  1. +6
    -0
      source/backend/native/distrho/DistrhoPluginCarla.cpp
  2. +4
    -1
      source/backend/plugin/CarlaPluginGui.cpp
  3. +1
    -1
      source/backend/plugin/CarlaPluginGui.hpp
  4. +1
    -0
      source/backend/plugin/CarlaPluginInternal.hpp
  5. +3
    -1
      source/backend/plugin/Lv2Plugin.cpp
  6. +3
    -1
      source/backend/plugin/VstPlugin.cpp

+ 6
- 0
source/backend/native/distrho/DistrhoPluginCarla.cpp View File

@@ -401,6 +401,8 @@ protected:
{
if (show)
createUiIfNeeded();
else if (fUiPtr != nullptr)
fUiGeometry = fUiPtr->saveGeometry();

if (fUiPtr != nullptr)
fUiPtr->carla_show(show);
@@ -463,6 +465,7 @@ private:
#if DISTRHO_PLUGIN_HAS_UI
// UI
ScopedPointer<UICarla> fUiPtr;
QByteArray fUiGeometry;

void createUiIfNeeded()
{
@@ -470,6 +473,9 @@ private:
{
d_lastUiSampleRate = getSampleRate();
fUiPtr = new UICarla(getHostHandle(), &fPlugin);

if (! fUiGeometry.isNull())
fUiPtr->restoreGeometry(fUiGeometry);
}
}
#endif


+ 4
- 1
source/backend/plugin/CarlaPluginGui.cpp View File

@@ -30,7 +30,7 @@ CARLA_BACKEND_START_NAMESPACE
// -------------------------------------------------------------------
// CarlaPluginGUI

CarlaPluginGui::CarlaPluginGui(CarlaEngine* const engine, Callback* const callback, const Options& options)
CarlaPluginGui::CarlaPluginGui(CarlaEngine* const engine, Callback* const callback, const Options& options, const QByteArray& lastGeometry)
: QMainWindow(nullptr),
kCallback(callback),
fContainer(nullptr),
@@ -61,6 +61,9 @@ CarlaPluginGui::CarlaPluginGui(CarlaEngine* const engine, Callback* const callba

if (settings.value("Engine/UIsAlwaysOnTop", true).toBool())
setWindowFlags(windowFlags()|Qt::WindowStaysOnTopHint);

if (! lastGeometry.isNull())
restoreGeometry(lastGeometry);
}
}



+ 1
- 1
source/backend/plugin/CarlaPluginGui.hpp View File

@@ -47,7 +47,7 @@ public:
bool resizable;
};

CarlaPluginGui(CarlaEngine* const engine, Callback* const callback, const Options& options);
CarlaPluginGui(CarlaEngine* const engine, Callback* const callback, const Options& options, const QByteArray& lastGeometry);
~CarlaPluginGui();

void setSize(const int width, const int height);


+ 1
- 0
source/backend/plugin/CarlaPluginInternal.hpp View File

@@ -394,6 +394,7 @@ struct CarlaPluginProtectedData {
CarlaEngine* const engine;
CarlaEngineClient* client;
CarlaPluginGui* gui;
QByteArray guiGeometry;

bool active;
bool needsReset;


+ 3
- 1
source/backend/plugin/Lv2Plugin.cpp View File

@@ -1183,7 +1183,7 @@ public:
guiOptions.parented = (fUi.type == PLUGIN_UI_PARENT);
guiOptions.resizable = isUiResizable();

kData->gui = new CarlaPluginGui(kData->engine, this, guiOptions);
kData->gui = new CarlaPluginGui(kData->engine, this, guiOptions, kData->guiGeometry);
}

if (fUi.type == PLUGIN_UI_PARENT)
@@ -1206,6 +1206,7 @@ public:
fUi.handle = nullptr;
fUi.widget = nullptr;

kData->guiGeometry = kData->gui->saveGeometry();
kData->gui->close();
delete kData->gui;
kData->gui = nullptr;
@@ -1231,6 +1232,7 @@ public:

if (kData->gui != nullptr)
{
kData->guiGeometry = kData->gui->saveGeometry();
kData->gui->close();
delete kData->gui;
kData->gui = nullptr;


+ 3
- 1
source/backend/plugin/VstPlugin.cpp View File

@@ -405,7 +405,7 @@ public:
guiOptions.parented = true;
guiOptions.resizable = false;

kData->gui = new CarlaPluginGui(kData->engine, this, guiOptions);
kData->gui = new CarlaPluginGui(kData->engine, this, guiOptions, kData->guiGeometry);
}

int32_t value = 0;
@@ -440,6 +440,7 @@ public:
{
if (kData->gui != nullptr)
{
kData->guiGeometry = kData->gui->saveGeometry();
kData->gui->close();
delete kData->gui;
kData->gui = nullptr;
@@ -461,6 +462,7 @@ public:
fGui.lastWidth = kData->gui->width();
fGui.lastHeight = kData->gui->height();

kData->guiGeometry = kData->gui->saveGeometry();
kData->gui->close();
delete kData->gui;
kData->gui = nullptr;


Loading…
Cancel
Save