Browse Source

Add automaticallyScale argument to UI constructor

Signed-off-by: falkTX <falktx@falktx.com>
pull/309/head
falkTX 3 years ago
parent
commit
1e029513f6
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
2 changed files with 12 additions and 2 deletions
  1. +6
    -1
      distrho/DistrhoUI.hpp
  2. +6
    -1
      distrho/src/DistrhoUI.cpp

+ 6
- 1
distrho/DistrhoUI.hpp View File

@@ -74,8 +74,13 @@ public:
/**
UI class constructor.
The UI should be initialized to a default state that matches the plugin side.

When @a automaticallyScale is set to true, DPF will automatically scale up the UI
to fit the host/desktop scale factor.@n
It assumes aspect ratio is meant to be kept.
Manually call setGeometryConstraints instead if keeping UI aspect ratio is not required.
*/
UI(uint width = 0, uint height = 0);
UI(uint width = 0, uint height = 0, bool automaticallyScale = false);

/**
Destructor.


+ 6
- 1
distrho/src/DistrhoUI.cpp View File

@@ -46,13 +46,18 @@ PluginWindow& UI::PrivateData::createNextWindow(UI* const ui, const uint width,
/* ------------------------------------------------------------------------------------------------------------
* UI */

UI::UI(const uint width, const uint height)
UI::UI(const uint width, const uint height, const bool automaticallyScale)
: UIWidget(UI::PrivateData::createNextWindow(this, width, height)),
uiData(UI::PrivateData::s_nextPrivateData)
{
#if !DISTRHO_PLUGIN_HAS_EXTERNAL_UI
if (width > 0 && height > 0)
{
Widget::setSize(width, height);

if (automaticallyScale)
setGeometryConstraints(width, height, true, true);
}
#endif
}



Loading…
Cancel
Save