Signed-off-by: falkTX <falktx@falktx.com>pull/517/head
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * DISTRHO Plugin Framework (DPF) | |||
| * Copyright (C) 2012-2022 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2012-2026 Filipe Coelho <falktx@falktx.com> | |||
| * | |||
| * Permission to use, copy, modify, and/or distribute this software for any purpose with | |||
| * or without fee is hereby granted, provided that the above copyright notice and this | |||
| @@ -84,9 +84,34 @@ public: | |||
| Application& getApp() const noexcept { return Window::getApp(); } | |||
| const GraphicsContext& getGraphicsContext() const noexcept { return Window::getGraphicsContext(); } | |||
| double getScaleFactor() const noexcept { return Window::getScaleFactor(); } | |||
| void setGeometryConstraints(uint minimumWidth, uint minimumHeight, | |||
| bool keepAspectRatio = false, bool automaticallyScale = false) | |||
| { Window::setGeometryConstraints(minimumWidth, minimumHeight, keepAspectRatio, automaticallyScale); } | |||
| void setGeometryConstraints(uint minimumWidth, uint minimumHeight, bool keepAspectRatio = false) | |||
| { Window::setGeometryConstraints(minimumWidth, minimumHeight, keepAspectRatio); } | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| DISTRHO_DEPRECATED_BY("setGeometryConstraints(uint, uint, bool)") | |||
| void setGeometryConstraints(uint minimumWidth, uint minimumHeight, bool keepAspectRatio, bool automaticallyScale) | |||
| { | |||
| #if defined(_MSC_VER) | |||
| #pragma warning(push) | |||
| #pragma warning(disable:4996) | |||
| #elif defined(__clang__) | |||
| #pragma clang diagnostic push | |||
| #pragma clang diagnostic ignored "-Wdeprecated-declarations" | |||
| #elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 460 | |||
| #pragma GCC diagnostic push | |||
| #pragma GCC diagnostic ignored "-Wdeprecated-declarations" | |||
| #endif | |||
| Window::setGeometryConstraints(minimumWidth, minimumHeight, keepAspectRatio, automaticallyScale, false); | |||
| #if defined(_MSC_VER) | |||
| #pragma warning(pop) | |||
| #elif defined(__clang__) | |||
| #pragma clang diagnostic pop | |||
| #elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 460 | |||
| #pragma GCC diagnostic pop | |||
| #endif | |||
| } | |||
| #endif | |||
| private: | |||
| ScopedGraphicsContext sgc; | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * DISTRHO Plugin Framework (DPF) | |||
| * Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2012-2026 Filipe Coelho <falktx@falktx.com> | |||
| * | |||
| * Permission to use, copy, modify, and/or distribute this software for any purpose with | |||
| * or without fee is hereby granted, provided that the above copyright notice and this | |||
| @@ -107,17 +107,27 @@ public: | |||
| bool addIdleCallback(IdleCallback* callback, uint timerFrequencyInMs = 0); | |||
| bool removeIdleCallback(IdleCallback* callback); | |||
| double getScaleFactor() const noexcept; | |||
| void setGeometryConstraints(uint minimumWidth, uint minimumHeight, bool keepAspectRatio = false); | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| /** DEPRECATED DO NOT USE. | |||
| * The old deprecated constructor allowed for an optional `bool automaticallyScaleAndSetAsMinimumSize`. | |||
| * This turned out to be not be a good idea; now the scaling is done automatically while minimum size is not. | |||
| */ | |||
| DISTRHO_DEPRECATED_BY("setGeometryConstraints(uint, uint, bool)") | |||
| void setGeometryConstraints(uint minimumWidth, | |||
| uint minimumHeight, | |||
| bool keepAspectRatio = false, | |||
| bool automaticallyScale = false, | |||
| bool resizeNowIfAutoScaling = true); | |||
| bool keepAspectRatio, | |||
| bool automaticallyScale, | |||
| bool resizeNowIfAutoScaling); | |||
| DISTRHO_DEPRECATED_BY("getApp()") | |||
| Application& getParentApp() const noexcept { return getApp(); } | |||
| DISTRHO_DEPRECATED_BY("getWindow()") | |||
| Window& getParentWindow() const noexcept { return getWindow(); } | |||
| #endif | |||
| protected: | |||
| bool onKeyboard(const KeyboardEvent&) override; | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * DISTRHO Plugin Framework (DPF) | |||
| * Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2012-2026 Filipe Coelho <falktx@falktx.com> | |||
| * | |||
| * Permission to use, copy, modify, and/or distribute this software for any purpose with | |||
| * or without fee is hereby granted, provided that the above copyright notice and this | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * DISTRHO Plugin Framework (DPF) | |||
| * Copyright (C) 2012-2025 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2012-2026 Filipe Coelho <falktx@falktx.com> | |||
| * | |||
| * Permission to use, copy, modify, and/or distribute this software for any purpose with | |||
| * or without fee is hereby granted, provided that the above copyright notice and this | |||
| @@ -463,13 +463,23 @@ public: | |||
| Size<uint> getGeometryConstraints(bool& keepAspectRatio); | |||
| /** | |||
| Set geometry constraints for the Window when resized by the user, and optionally scale contents automatically. | |||
| Set geometry constraints for the Window when resized by the user. | |||
| Also whether to keep aspect ratio based on this size. | |||
| */ | |||
| void setGeometryConstraints(uint minimumWidth, uint minimumHeight, bool keepAspectRatio = false); | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| /** DEPRECATED DO NOT USE. | |||
| * The old deprecated function allowed for optional `bool automaticallyScale` and `bool resizeNowIfAutoScaling`. | |||
| * This turned out to be not be a good idea; now the scaling on constraints is never done automatically. | |||
| */ | |||
| DISTRHO_DEPRECATED_BY("setGeometryConstraints(uint, uint, bool)") | |||
| void setGeometryConstraints(uint minimumWidth, | |||
| uint minimumHeight, | |||
| bool keepAspectRatio = false, | |||
| bool automaticallyScale = false, | |||
| bool resizeNowIfAutoScaling = true); | |||
| bool keepAspectRatio, | |||
| bool automaticallyScale, | |||
| bool resizeNowIfAutoScaling); | |||
| #endif | |||
| /** | |||
| Set the transient parent of the window. | |||
| @@ -1,7 +1,7 @@ | |||
| /* | |||
| * DISTRHO Plugin Framework (DPF) | |||
| * Copyright (C) 2012-2025 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2019-2021 Jean Pierre Cimalando <jp-dev@inbox.ru> | |||
| * Copyright (C) 2012-2026 Filipe Coelho <falktx@falktx.com> | |||
| * | |||
| * Permission to use, copy, modify, and/or distribute this software for any purpose with | |||
| * or without fee is hereby granted, provided that the above copyright notice and this | |||
| @@ -736,7 +736,11 @@ template class ImageBaseSwitch<CairoImage>; | |||
| // ----------------------------------------------------------------------- | |||
| void SubWidget::PrivateData::display(const uint width, const uint height, const double autoScaleFactor) | |||
| void SubWidget::PrivateData::display(const uint width, const uint height | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| , const double autoScaleFactor | |||
| #endif | |||
| ) | |||
| { | |||
| cairo_t* const handle = static_cast<const CairoGraphicsContext&>(self->getGraphicsContext()).handle; | |||
| @@ -754,10 +758,13 @@ void SubWidget::PrivateData::display(const uint width, const uint height, const | |||
| { | |||
| // full viewport size | |||
| cairo_translate(handle, 0, 0); | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| cairo_scale(handle, autoScaleFactor, autoScaleFactor); | |||
| #endif | |||
| } | |||
| else | |||
| { | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| // set viewport pos | |||
| cairo_translate(handle, absolutePos.getX() * autoScaleFactor, absolutePos.getY() * autoScaleFactor); | |||
| @@ -767,12 +774,21 @@ void SubWidget::PrivateData::display(const uint width, const uint height, const | |||
| 0, | |||
| std::round(self->getWidth() * autoScaleFactor), | |||
| std::round(self->getHeight() * autoScaleFactor)); | |||
| #else | |||
| // set viewport pos | |||
| cairo_translate(handle, absolutePos.getX(), absolutePos.getY()); | |||
| // then cut the outer bounds | |||
| cairo_rectangle(handle, 0, 0, self->getWidth(), self->getHeight()); | |||
| #endif | |||
| cairo_clip(handle); | |||
| needsResetClip = true; | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| // set viewport scaling | |||
| cairo_scale(handle, autoScaleFactor, autoScaleFactor); | |||
| #endif | |||
| } | |||
| // display widget | |||
| @@ -783,7 +799,11 @@ void SubWidget::PrivateData::display(const uint width, const uint height, const | |||
| cairo_set_matrix(handle, &matrix); | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| selfw->pData->displaySubWidgets(width, height, autoScaleFactor); | |||
| #else | |||
| selfw->pData->displaySubWidgets(width, height); | |||
| #endif | |||
| } | |||
| // ----------------------------------------------------------------------- | |||
| @@ -799,7 +819,9 @@ void TopLevelWidget::PrivateData::display() | |||
| const uint width = size.getWidth(); | |||
| const uint height = size.getHeight(); | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| const double autoScaleFactor = window.pData->autoScaleFactor; | |||
| #endif | |||
| cairo_matrix_t matrix; | |||
| cairo_get_matrix(handle, &matrix); | |||
| @@ -807,10 +829,12 @@ void TopLevelWidget::PrivateData::display() | |||
| // full viewport size | |||
| cairo_translate(handle, 0, 0); | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| if (window.pData->autoScaling) | |||
| cairo_scale(handle, autoScaleFactor, autoScaleFactor); | |||
| else | |||
| cairo_scale(handle, 1.0, 1.0); | |||
| #endif | |||
| // main widget drawing | |||
| self->onDisplay(); | |||
| @@ -818,7 +842,11 @@ void TopLevelWidget::PrivateData::display() | |||
| cairo_set_matrix(handle, &matrix); | |||
| // now draw subwidgets if there are any | |||
| selfw->pData->displaySubWidgets(width, height, autoScaleFactor); | |||
| selfw->pData->displaySubWidgets(width, height | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| , autoScaleFactor | |||
| #endif | |||
| ); | |||
| } | |||
| // ----------------------------------------------------------------------- | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * DISTRHO Plugin Framework (DPF) | |||
| * Copyright (C) 2012-2022 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2012-2026 Filipe Coelho <falktx@falktx.com> | |||
| * | |||
| * Permission to use, copy, modify, and/or distribute this software for any purpose with | |||
| * or without fee is hereby granted, provided that the above copyright notice and this | |||
| @@ -31,8 +31,9 @@ ImageBaseAboutWindow<ImageType>::ImageBaseAboutWindow(Window& transientParentWin | |||
| if (image.isValid()) | |||
| { | |||
| setSize(image.getSize()); | |||
| setGeometryConstraints(image.getWidth(), image.getHeight(), true, true); | |||
| const double scaleFactor = getScaleFactor(); | |||
| setSize(image.getSize() * scaleFactor); | |||
| setGeometryConstraints(image.getWidth() * scaleFactor, image.getHeight() * scaleFactor, true); | |||
| } | |||
| done(); | |||
| @@ -48,8 +49,9 @@ ImageBaseAboutWindow<ImageType>::ImageBaseAboutWindow(TopLevelWidget* const topL | |||
| if (image.isValid()) | |||
| { | |||
| setSize(image.getSize()); | |||
| setGeometryConstraints(image.getWidth(), image.getHeight(), true, true); | |||
| const double scaleFactor = getScaleFactor(); | |||
| setSize(image.getSize() * scaleFactor); | |||
| setGeometryConstraints(image.getWidth(), image.getHeight(), true); | |||
| } | |||
| done(); | |||
| @@ -71,8 +73,9 @@ void ImageBaseAboutWindow<ImageType>::setImage(const ImageType& image) | |||
| img = image; | |||
| setSize(image.getSize()); | |||
| setGeometryConstraints(image.getWidth(), image.getHeight(), true, true); | |||
| const double scaleFactor = getScaleFactor(); | |||
| setSize(image.getSize() * scaleFactor); | |||
| setGeometryConstraints(image.getWidth() * scaleFactor, image.getHeight() * scaleFactor, true); | |||
| done(); | |||
| } | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * DISTRHO Plugin Framework (DPF) | |||
| * Copyright (C) 2012-2025 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2012-2026 Filipe Coelho <falktx@falktx.com> | |||
| * | |||
| * Permission to use, copy, modify, and/or distribute this software for any purpose with | |||
| * or without fee is hereby granted, provided that the above copyright notice and this | |||
| @@ -157,7 +157,11 @@ OpenGLImage::OpenGLImage(const char* const rdata, const Size<uint>& s, const GLe | |||
| // -------------------------------------------------------------------------------------------------------------------- | |||
| void SubWidget::PrivateData::display(const uint width, const uint height, const double autoScaleFactor) | |||
| void SubWidget::PrivateData::display(const uint width, const uint height | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| , const double autoScaleFactor | |||
| #endif | |||
| ) | |||
| { | |||
| if (skipDrawing) | |||
| return; | |||
| @@ -191,6 +195,7 @@ void SubWidget::PrivateData::display(const uint width, const uint height, const | |||
| } | |||
| else | |||
| { | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| // set viewport pos | |||
| glViewport(d_roundToIntPositive(absolutePos.getX() * autoScaleFactor), | |||
| -d_roundToIntPositive(absolutePos.getY() * autoScaleFactor), | |||
| @@ -202,6 +207,16 @@ void SubWidget::PrivateData::display(const uint width, const uint height, const | |||
| d_roundToIntPositive(height - (static_cast<int>(self->getHeight()) + absolutePos.getY()) * autoScaleFactor), | |||
| d_roundToIntPositive(self->getWidth() * autoScaleFactor), | |||
| d_roundToIntPositive(self->getHeight() * autoScaleFactor)); | |||
| #else | |||
| // set viewport pos | |||
| glViewport(absolutePos.getX(), -absolutePos.getY(), static_cast<int>(width), static_cast<int>(height)); | |||
| // then cut the outer bounds | |||
| glScissor(absolutePos.getX(), | |||
| static_cast<int>(height) - self->getHeight() + absolutePos.getY(), | |||
| static_cast<int>(self->getWidth()), | |||
| static_cast<int>(self->getHeight())); | |||
| #endif | |||
| glEnable(GL_SCISSOR_TEST); | |||
| needsDisableScissor = true; | |||
| @@ -213,7 +228,11 @@ void SubWidget::PrivateData::display(const uint width, const uint height, const | |||
| if (needsDisableScissor) | |||
| glDisable(GL_SCISSOR_TEST); | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| selfw->pData->displaySubWidgets(width, height, autoScaleFactor); | |||
| #else | |||
| selfw->pData->displaySubWidgets(width, height); | |||
| #endif | |||
| } | |||
| // -------------------------------------------------------------------------------------------------------------------- | |||
| @@ -234,7 +253,11 @@ void TopLevelWidget::PrivateData::display() | |||
| self->onDisplay(); | |||
| // now draw subwidgets if there are any | |||
| selfw->pData->displaySubWidgets(width, height, window.pData->autoScaleFactor); | |||
| selfw->pData->displaySubWidgets(width, height | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| , window.pData->autoScaleFactor | |||
| #endif | |||
| ); | |||
| } | |||
| // -------------------------------------------------------------------------------------------------------------------- | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * DISTRHO Plugin Framework (DPF) | |||
| * Copyright (C) 2012-2025 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2012-2026 Filipe Coelho <falktx@falktx.com> | |||
| * | |||
| * Permission to use, copy, modify, and/or distribute this software for any purpose with | |||
| * or without fee is hereby granted, provided that the above copyright notice and this | |||
| @@ -172,9 +172,15 @@ void Rectangle<T>::drawOutline() | |||
| // -------------------------------------------------------------------------------------------------------------------- | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| void SubWidget::PrivateData::display(uint, uint, double) | |||
| { | |||
| } | |||
| #else | |||
| void SubWidget::PrivateData::display(uint, uint) | |||
| { | |||
| } | |||
| #endif | |||
| // -------------------------------------------------------------------------------------------------------------------- | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * DISTRHO Plugin Framework (DPF) | |||
| * Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2012-2026 Filipe Coelho <falktx@falktx.com> | |||
| * | |||
| * Permission to use, copy, modify, and/or distribute this software for any purpose with | |||
| * or without fee is hereby granted, provided that the above copyright notice and this | |||
| @@ -38,7 +38,11 @@ struct SubWidget::PrivateData { | |||
| ~PrivateData(); | |||
| // NOTE display function is different depending on build type, must call displaySubWidgets at the end | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| void display(uint width, uint height, double autoScaleFactor); | |||
| #else | |||
| void display(uint width, uint height); | |||
| #endif | |||
| DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(PrivateData) | |||
| }; | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * DISTRHO Plugin Framework (DPF) | |||
| * Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2012-2026 Filipe Coelho <falktx@falktx.com> | |||
| * | |||
| * Permission to use, copy, modify, and/or distribute this software for any purpose with | |||
| * or without fee is hereby granted, provided that the above copyright notice and this | |||
| @@ -100,18 +100,42 @@ void TopLevelWidget::repaint(const Rectangle<uint>& rect) noexcept | |||
| pData->window.repaint(rect); | |||
| } | |||
| void TopLevelWidget::setGeometryConstraints(const uint minimumWidth, const uint minimumHeight, const bool keepAspectRatio) | |||
| { | |||
| pData->window.setGeometryConstraints(minimumWidth, minimumHeight, keepAspectRatio); | |||
| } | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| void TopLevelWidget::setGeometryConstraints(const uint minimumWidth, | |||
| const uint minimumHeight, | |||
| const bool keepAspectRatio, | |||
| const bool automaticallyScale, | |||
| const bool resizeNowIfAutoScaling) | |||
| { | |||
| #if defined(_MSC_VER) | |||
| #pragma warning(push) | |||
| #pragma warning(disable:4996) | |||
| #elif defined(__clang__) | |||
| #pragma clang diagnostic push | |||
| #pragma clang diagnostic ignored "-Wdeprecated-declarations" | |||
| #elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 460 | |||
| #pragma GCC diagnostic push | |||
| #pragma GCC diagnostic ignored "-Wdeprecated-declarations" | |||
| #endif | |||
| pData->window.setGeometryConstraints(minimumWidth, | |||
| minimumHeight, | |||
| keepAspectRatio, | |||
| automaticallyScale, | |||
| resizeNowIfAutoScaling); | |||
| } | |||
| #if defined(_MSC_VER) | |||
| #pragma warning(pop) | |||
| #elif defined(__clang__) | |||
| #pragma clang diagnostic pop | |||
| #elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 460 | |||
| #pragma GCC diagnostic pop | |||
| #endif | |||
| } | |||
| #endif | |||
| // -------------------------------------------------------------------------------------------------------------------- | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * DISTRHO Plugin Framework (DPF) | |||
| * Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2012-2026 Filipe Coelho <falktx@falktx.com> | |||
| * | |||
| * Permission to use, copy, modify, and/or distribute this software for any purpose with | |||
| * or without fee is hereby granted, provided that the above copyright notice and this | |||
| @@ -75,6 +75,7 @@ bool TopLevelWidget::PrivateData::mouseEvent(const MouseEvent& ev) | |||
| MouseEvent rev = ev; | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| if (window.pData->autoScaling) | |||
| { | |||
| const double autoScaleFactor = window.pData->autoScaleFactor; | |||
| @@ -84,6 +85,7 @@ bool TopLevelWidget::PrivateData::mouseEvent(const MouseEvent& ev) | |||
| rev.absolutePos.setX(ev.absolutePos.getX() / autoScaleFactor); | |||
| rev.absolutePos.setY(ev.absolutePos.getY() / autoScaleFactor); | |||
| } | |||
| #endif | |||
| // propagate event to all subwidgets recursively | |||
| return selfw->pData->giveMouseEventForSubWidgets(rev); | |||
| @@ -97,6 +99,7 @@ bool TopLevelWidget::PrivateData::motionEvent(const MotionEvent& ev) | |||
| MotionEvent rev = ev; | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| if (window.pData->autoScaling) | |||
| { | |||
| const double autoScaleFactor = window.pData->autoScaleFactor; | |||
| @@ -106,6 +109,7 @@ bool TopLevelWidget::PrivateData::motionEvent(const MotionEvent& ev) | |||
| rev.absolutePos.setX(ev.absolutePos.getX() / autoScaleFactor); | |||
| rev.absolutePos.setY(ev.absolutePos.getY() / autoScaleFactor); | |||
| } | |||
| #endif | |||
| // propagate event to all subwidgets recursively | |||
| return selfw->pData->giveMotionEventForSubWidgets(rev); | |||
| @@ -119,6 +123,7 @@ bool TopLevelWidget::PrivateData::scrollEvent(const ScrollEvent& ev) | |||
| ScrollEvent rev = ev; | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| if (window.pData->autoScaling) | |||
| { | |||
| const double autoScaleFactor = window.pData->autoScaleFactor; | |||
| @@ -130,6 +135,7 @@ bool TopLevelWidget::PrivateData::scrollEvent(const ScrollEvent& ev) | |||
| rev.delta.setX(ev.delta.getX() / autoScaleFactor); | |||
| rev.delta.setY(ev.delta.getY() / autoScaleFactor); | |||
| } | |||
| #endif | |||
| // propagate event to all subwidgets recursively | |||
| return selfw->pData->giveScrollEventForSubWidgets(rev); | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * DISTRHO Plugin Framework (DPF) | |||
| * Copyright (C) 2012-2025 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2012-2026 Filipe Coelho <falktx@falktx.com> | |||
| * | |||
| * Permission to use, copy, modify, and/or distribute this software for any purpose with | |||
| * or without fee is hereby granted, provided that the above copyright notice and this | |||
| @@ -235,11 +235,19 @@ VulkanImage& VulkanImage::operator=(const VulkanImage& image) noexcept | |||
| // ----------------------------------------------------------------------- | |||
| void SubWidget::PrivateData::display(const uint width, const uint height, const double autoScaleFactor) | |||
| void SubWidget::PrivateData::display(const uint width, const uint height | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| , const double autoScaleFactor | |||
| #endif | |||
| ) | |||
| { | |||
| // TODO | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| selfw->pData->displaySubWidgets(width, height, autoScaleFactor); | |||
| #else | |||
| selfw->pData->displaySubWidgets(width, height); | |||
| #endif | |||
| } | |||
| // ----------------------------------------------------------------------- | |||
| @@ -253,15 +261,17 @@ void TopLevelWidget::PrivateData::display() | |||
| const uint width = size.getWidth(); | |||
| const uint height = size.getHeight(); | |||
| const double autoScaleFactor = window.pData->autoScaleFactor; | |||
| // TODO | |||
| // main widget drawing | |||
| self->onDisplay(); | |||
| // now draw subwidgets if there are any | |||
| selfw->pData->displaySubWidgets(width, height, autoScaleFactor); | |||
| selfw->pData->displaySubWidgets(width, height | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| , window.pData->autoScaleFactor | |||
| #endif | |||
| ); | |||
| } | |||
| // ----------------------------------------------------------------------- | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * DISTRHO Plugin Framework (DPF) | |||
| * Copyright (C) 2012-2022 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2012-2026 Filipe Coelho <falktx@falktx.com> | |||
| * | |||
| * Permission to use, copy, modify, and/or distribute this software for any purpose with | |||
| * or without fee is hereby granted, provided that the above copyright notice and this | |||
| @@ -56,7 +56,12 @@ Widget::PrivateData::~PrivateData() | |||
| std::free(name); | |||
| } | |||
| void Widget::PrivateData::displaySubWidgets(const uint width, const uint height, const double autoScaleFactor) | |||
| void Widget::PrivateData::displaySubWidgets(const uint width, | |||
| const uint height | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| , const double autoScaleFactor | |||
| #endif | |||
| ) | |||
| { | |||
| if (subWidgets.size() == 0) | |||
| return; | |||
| @@ -66,7 +71,11 @@ void Widget::PrivateData::displaySubWidgets(const uint width, const uint height, | |||
| SubWidget* const subwidget(*it); | |||
| if (subwidget->isVisible()) | |||
| subwidget->pData->display(width, height, autoScaleFactor); | |||
| subwidget->pData->display(width, height | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| , autoScaleFactor | |||
| #endif | |||
| ); | |||
| } | |||
| } | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * DISTRHO Plugin Framework (DPF) | |||
| * Copyright (C) 2012-2022 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2012-2026 Filipe Coelho <falktx@falktx.com> | |||
| * | |||
| * Permission to use, copy, modify, and/or distribute this software for any purpose with | |||
| * or without fee is hereby granted, provided that the above copyright notice and this | |||
| @@ -42,7 +42,12 @@ struct Widget::PrivateData { | |||
| explicit PrivateData(Widget* const s, Widget* const pw); | |||
| ~PrivateData(); | |||
| void displaySubWidgets(uint width, uint height, double autoScaleFactor); | |||
| void displaySubWidgets(uint width, | |||
| uint height | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| , double autoScaleFactor | |||
| #endif | |||
| ); | |||
| bool giveKeyboardEventForSubWidgets(const KeyboardEvent& ev); | |||
| bool giveCharacterInputEventForSubWidgets(const CharacterInputEvent& ev); | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * DISTRHO Plugin Framework (DPF) | |||
| * Copyright (C) 2012-2025 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2012-2026 Filipe Coelho <falktx@falktx.com> | |||
| * | |||
| * Permission to use, copy, modify, and/or distribute this software for any purpose with | |||
| * or without fee is hereby granted, provided that the above copyright notice and this | |||
| @@ -272,15 +272,18 @@ void Window::setSize(uint width, uint height) | |||
| if (pData->isEmbed) | |||
| { | |||
| const double scaleFactor = pData->scaleFactor; | |||
| uint minWidth = pData->minWidth; | |||
| uint minHeight = pData->minHeight; | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| const double scaleFactor = pData->scaleFactor; | |||
| if (pData->autoScaling && d_isNotEqual(scaleFactor, 1.0)) | |||
| { | |||
| minWidth = d_roundToUnsignedInt(minWidth * scaleFactor); | |||
| minHeight = d_roundToUnsignedInt(minHeight * scaleFactor); | |||
| } | |||
| #endif | |||
| // handle geometry constraints here | |||
| if (width < minWidth) | |||
| @@ -462,6 +465,7 @@ void Window::repaint(const Rectangle<uint>& rect) noexcept | |||
| uint width = rect.getWidth(); | |||
| uint height = rect.getHeight(); | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| if (pData->autoScaling) | |||
| { | |||
| const double autoScaleFactor = pData->autoScaleFactor; | |||
| @@ -471,6 +475,7 @@ void Window::repaint(const Rectangle<uint>& rect) noexcept | |||
| width = d_roundToUnsignedInt(width * autoScaleFactor); | |||
| height = d_roundToUnsignedInt(height * autoScaleFactor); | |||
| } | |||
| #endif | |||
| puglObscureRegion(pData->view, x, y, width, height); | |||
| } | |||
| @@ -491,6 +496,20 @@ Size<uint> Window::getGeometryConstraints(bool& keepAspectRatio) | |||
| return Size<uint>(pData->minWidth, pData->minHeight); | |||
| } | |||
| void Window::setGeometryConstraints(const uint minimumWidth, const uint minimumHeight, const bool keepAspectRatio) | |||
| { | |||
| DISTRHO_SAFE_ASSERT_RETURN(minimumWidth > 0,); | |||
| DISTRHO_SAFE_ASSERT_RETURN(minimumHeight > 0,); | |||
| pData->minWidth = minimumWidth; | |||
| pData->minHeight = minimumHeight; | |||
| pData->keepAspectRatio = keepAspectRatio; | |||
| if (pData->view != nullptr) | |||
| puglSetGeometryConstraints(pData->view, minimumWidth, minimumHeight, keepAspectRatio); | |||
| } | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| void Window::setGeometryConstraints(uint minimumWidth, | |||
| uint minimumHeight, | |||
| const bool keepAspectRatio, | |||
| @@ -530,6 +549,7 @@ void Window::setGeometryConstraints(uint minimumWidth, | |||
| d_roundToUnsignedInt(size.getHeight() * scaleFactor)); | |||
| } | |||
| } | |||
| #endif | |||
| void Window::setTransientParent(const uintptr_t transientParentWindowHandle) | |||
| { | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * DISTRHO Plugin Framework (DPF) | |||
| * Copyright (C) 2012-2025 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2012-2026 Filipe Coelho <falktx@falktx.com> | |||
| * | |||
| * Permission to use, copy, modify, and/or distribute this software for any purpose with | |||
| * or without fee is hereby granted, provided that the above copyright notice and this | |||
| @@ -116,8 +116,10 @@ Window::PrivateData::PrivateData(Application& a, Window* const s) | |||
| usesScheduledRepaints(false), | |||
| usesSizeRequest(false), | |||
| scaleFactor(DGL_NAMESPACE::getScaleFactor(view)), | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| autoScaling(false), | |||
| autoScaleFactor(1.0), | |||
| #endif | |||
| minWidth(0), | |||
| minHeight(0), | |||
| keepAspectRatio(false), | |||
| @@ -149,8 +151,10 @@ Window::PrivateData::PrivateData(Application& a, Window* const s, PrivateData* c | |||
| usesScheduledRepaints(false), | |||
| usesSizeRequest(false), | |||
| scaleFactor(ppData->scaleFactor), | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| autoScaling(false), | |||
| autoScaleFactor(1.0), | |||
| #endif | |||
| minWidth(0), | |||
| minHeight(0), | |||
| keepAspectRatio(false), | |||
| @@ -184,8 +188,10 @@ Window::PrivateData::PrivateData(Application& a, Window* const s, | |||
| usesScheduledRepaints(false), | |||
| usesSizeRequest(false), | |||
| scaleFactor(scale != 0.0 ? scale : DGL_NAMESPACE::getScaleFactor(view)), | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| autoScaling(false), | |||
| autoScaleFactor(1.0), | |||
| #endif | |||
| minWidth(0), | |||
| minHeight(0), | |||
| keepAspectRatio(false), | |||
| @@ -222,8 +228,10 @@ Window::PrivateData::PrivateData(Application& a, Window* const s, | |||
| usesScheduledRepaints(_usesScheduledRepaints), | |||
| usesSizeRequest(_usesSizeRequest), | |||
| scaleFactor(scale != 0.0 ? scale : DGL_NAMESPACE::getScaleFactor(view)), | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| autoScaling(false), | |||
| autoScaleFactor(1.0), | |||
| #endif | |||
| minWidth(0), | |||
| minHeight(0), | |||
| keepAspectRatio(false), | |||
| @@ -526,7 +534,10 @@ bool Window::PrivateData::openFileBrowser(const FileBrowserOptions& options) | |||
| fileBrowserHandle = fileBrowserCreate(isEmbed, | |||
| puglGetNativeView(view), | |||
| autoScaling ? autoScaleFactor : scaleFactor, | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| autoScaling ? autoScaleFactor : | |||
| #endif | |||
| scaleFactor, | |||
| options2); | |||
| return fileBrowserHandle != nullptr; | |||
| @@ -552,7 +563,10 @@ bool Window::PrivateData::createWebView(const char* const url, const DGL_NAMESPA | |||
| puglGetNativeView(view), | |||
| initialWidth, | |||
| initialHeight, | |||
| autoScaling ? autoScaleFactor : scaleFactor, | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| autoScaling ? autoScaleFactor : | |||
| #endif | |||
| scaleFactor, | |||
| options); | |||
| return webViewHandle != nullptr; | |||
| @@ -646,6 +660,7 @@ void Window::PrivateData::onPuglConfigure(const uint width, const uint height) | |||
| createContextIfNeeded(); | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| if (autoScaling) | |||
| { | |||
| const double scaleHorizontal = width / static_cast<double>(minWidth); | |||
| @@ -656,16 +671,22 @@ void Window::PrivateData::onPuglConfigure(const uint width, const uint height) | |||
| { | |||
| autoScaleFactor = 1.0; | |||
| } | |||
| const uint uwidth = d_roundToUnsignedInt(width / autoScaleFactor); | |||
| const uint uheight = d_roundToUnsignedInt(height / autoScaleFactor); | |||
| #else | |||
| const uint uwidth = width; | |||
| const uint uheight = height; | |||
| #endif | |||
| #ifdef DGL_USE_WEB_VIEW | |||
| if (webViewHandle != nullptr) | |||
| webViewResize(webViewHandle, | |||
| uwidth - webViewOffset.getX(), | |||
| uheight - webViewOffset.getY(), | |||
| autoScaling ? autoScaleFactor : scaleFactor); | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| autoScaling ? autoScaleFactor : | |||
| #endif | |||
| scaleFactor); | |||
| #endif | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| @@ -1089,12 +1110,14 @@ PuglStatus Window::PrivateData::puglEventCallback(PuglView* const view, const Pu | |||
| ev.time = d_roundToUnsignedInt(event->button.time * 1000.0); | |||
| ev.button = event->button.button + 1; | |||
| ev.press = event->type == PUGL_BUTTON_PRESS; | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| if (pData->autoScaling && 0) | |||
| { | |||
| const double scaleFactor = pData->autoScaleFactor; | |||
| ev.pos = Point<double>(event->button.x / scaleFactor, event->button.y / scaleFactor); | |||
| } | |||
| else | |||
| #endif | |||
| { | |||
| ev.pos = Point<double>(event->button.x, event->button.y); | |||
| } | |||
| @@ -1110,12 +1133,14 @@ PuglStatus Window::PrivateData::puglEventCallback(PuglView* const view, const Pu | |||
| ev.mod = event->motion.state; | |||
| ev.flags = event->motion.flags; | |||
| ev.time = d_roundToUnsignedInt(event->motion.time * 1000.0); | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| if (pData->autoScaling && 0) | |||
| { | |||
| const double scaleFactor = pData->autoScaleFactor; | |||
| ev.pos = Point<double>(event->motion.x / scaleFactor, event->motion.y / scaleFactor); | |||
| } | |||
| else | |||
| #endif | |||
| { | |||
| ev.pos = Point<double>(event->motion.x, event->motion.y); | |||
| } | |||
| @@ -1131,6 +1156,7 @@ PuglStatus Window::PrivateData::puglEventCallback(PuglView* const view, const Pu | |||
| ev.mod = event->scroll.state; | |||
| ev.flags = event->scroll.flags; | |||
| ev.time = d_roundToUnsignedInt(event->scroll.time * 1000.0); | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| if (pData->autoScaling && 0) | |||
| { | |||
| const double scaleFactor = pData->autoScaleFactor; | |||
| @@ -1138,6 +1164,7 @@ PuglStatus Window::PrivateData::puglEventCallback(PuglView* const view, const Pu | |||
| ev.delta = Point<double>(event->scroll.dx / scaleFactor, event->scroll.dy / scaleFactor); | |||
| } | |||
| else | |||
| #endif | |||
| { | |||
| ev.pos = Point<double>(event->scroll.x, event->scroll.y); | |||
| ev.delta = Point<double>(event->scroll.dx, event->scroll.dy); | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * DISTRHO Plugin Framework (DPF) | |||
| * Copyright (C) 2012-2025 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2012-2026 Filipe Coelho <falktx@falktx.com> | |||
| * | |||
| * Permission to use, copy, modify, and/or distribute this software for any purpose with | |||
| * or without fee is hereby granted, provided that the above copyright notice and this | |||
| @@ -73,9 +73,11 @@ struct Window::PrivateData : IdleCallback { | |||
| /** Scale factor to report to widgets on request, purely informational. */ | |||
| double scaleFactor; | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| /** Automatic scaling to apply on widgets, implemented internally. */ | |||
| bool autoScaling; | |||
| double autoScaleFactor; | |||
| #endif | |||
| /** Pugl geometry constraints access. */ | |||
| uint minWidth, minHeight; | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * DISTRHO Plugin Framework (DPF) | |||
| * Copyright (C) 2012-2025 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2012-2026 Filipe Coelho <falktx@falktx.com> | |||
| * | |||
| * Permission to use, copy, modify, and/or distribute this software for any purpose with | |||
| * or without fee is hereby granted, provided that the above copyright notice and this | |||
| @@ -55,7 +55,7 @@ START_NAMESPACE_DISTRHO | |||
| class PluginWindow; | |||
| /* ------------------------------------------------------------------------------------------------------------ | |||
| /* -------------------------------------------------------------------------------------------------------------------- | |||
| * DPF UI */ | |||
| /** | |||
| @@ -76,19 +76,29 @@ 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. | |||
| The @p width and @p height arguments are meant to be used without any OS-level UI scaling. | |||
| Scaling will be automatically done internally if needed, matching the OS and host. | |||
| @see getScaleFactor | |||
| @see setGeometryConstraints | |||
| */ | |||
| UI(uint width = 0, uint height = 0, bool automaticallyScaleAndSetAsMinimumSize = false); | |||
| UI(uint width = 0, uint height = 0); | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| /** DEPRECATED DO NOT USE. | |||
| * The old deprecated constructor allowed for an optional `bool automaticallyScaleAndSetAsMinimumSize`. | |||
| * This turned out to be not be a good idea; now the scaling is done automatically while minimum size is not. | |||
| */ | |||
| DISTRHO_DEPRECATED_BY("UI(width, height)") | |||
| UI(uint width, uint height, bool automaticallyScaleAndSetAsMinimumSize); | |||
| #endif | |||
| /** | |||
| Destructor. | |||
| */ | |||
| ~UI() override; | |||
| /* -------------------------------------------------------------------------------------------------------- | |||
| /* ----------------------------------------------------------------------------------------------------------------- | |||
| * Host state */ | |||
| /** | |||
| @@ -201,7 +211,7 @@ public: | |||
| #endif | |||
| #if DISTRHO_PLUGIN_WANT_DIRECT_ACCESS | |||
| /* -------------------------------------------------------------------------------------------------------- | |||
| /* ----------------------------------------------------------------------------------------------------------------- | |||
| * Direct DSP access - DO NOT USE THIS UNLESS STRICTLY NECESSARY!! */ | |||
| /** | |||
| @@ -212,7 +222,7 @@ public: | |||
| #endif | |||
| protected: | |||
| /* -------------------------------------------------------------------------------------------------------- | |||
| /* ----------------------------------------------------------------------------------------------------------------- | |||
| * DSP/Plugin Callbacks */ | |||
| /** | |||
| @@ -237,7 +247,7 @@ protected: | |||
| virtual void stateChanged(const char* key, const char* value); | |||
| #endif | |||
| /* -------------------------------------------------------------------------------------------------------- | |||
| /* ----------------------------------------------------------------------------------------------------------------- | |||
| * DSP/Plugin Callbacks (optional) */ | |||
| /** | |||
| @@ -246,7 +256,7 @@ protected: | |||
| */ | |||
| virtual void sampleRateChanged(double newSampleRate); | |||
| /* -------------------------------------------------------------------------------------------------------- | |||
| /* ----------------------------------------------------------------------------------------------------------------- | |||
| * UI Callbacks (optional) */ | |||
| /** | |||
| @@ -310,7 +320,7 @@ protected: | |||
| virtual void uiFileBrowserSelected(const char* filename); | |||
| #endif | |||
| /* -------------------------------------------------------------------------------------------------------- | |||
| /* ----------------------------------------------------------------------------------------------------------------- | |||
| * UI Resize Handling, internal */ | |||
| /** | |||
| @@ -320,7 +330,7 @@ protected: | |||
| */ | |||
| void onResize(const ResizeEvent& ev) override; | |||
| // ------------------------------------------------------------------------------------------------------- | |||
| // ---------------------------------------------------------------------------------------------------------------- | |||
| private: | |||
| struct PrivateData; | |||
| @@ -335,7 +345,7 @@ private: | |||
| /** @} */ | |||
| /* ------------------------------------------------------------------------------------------------------------ | |||
| /* -------------------------------------------------------------------------------------------------------------------- | |||
| * Create UI, entry point */ | |||
| /** | |||
| @@ -351,7 +361,7 @@ extern UI* createUI(); | |||
| /** @} */ | |||
| // ----------------------------------------------------------------------------------------------------------- | |||
| // -------------------------------------------------------------------------------------------------------------------- | |||
| END_NAMESPACE_DISTRHO | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * DISTRHO Plugin Framework (DPF) | |||
| * Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2012-2026 Filipe Coelho <falktx@falktx.com> | |||
| * | |||
| * Permission to use, copy, modify, and/or distribute this software for any purpose with | |||
| * or without fee is hereby granted, provided that the above copyright notice and this | |||
| @@ -322,6 +322,34 @@ void UI::PrivateData::webViewMessageCallback(void* const arg, char* const msg) | |||
| /* ------------------------------------------------------------------------------------------------------------ | |||
| * UI */ | |||
| UI::UI(const uint width, const uint height) | |||
| : UIWidget(UI::PrivateData::createNextWindow(this, | |||
| // width | |||
| #ifdef DISTRHO_UI_DEFAULT_WIDTH | |||
| width == 0 ? DISTRHO_UI_DEFAULT_WIDTH : | |||
| #endif | |||
| width, | |||
| // height | |||
| #ifdef DISTRHO_UI_DEFAULT_HEIGHT | |||
| height == 0 ? DISTRHO_UI_DEFAULT_HEIGHT : | |||
| #endif | |||
| height | |||
| )), | |||
| uiData(UI::PrivateData::s_nextPrivateData) | |||
| { | |||
| if (width != 0 && height != 0) | |||
| { | |||
| Widget::setSize(width, height); | |||
| } | |||
| #ifdef DISTRHO_UI_DEFAULT_WIDTH | |||
| else | |||
| { | |||
| Widget::setSize(DISTRHO_UI_DEFAULT_WIDTH, DISTRHO_UI_DEFAULT_HEIGHT); | |||
| } | |||
| #endif | |||
| } | |||
| #if DGL_ALLOW_DEPRECATED_METHODS | |||
| UI::UI(const uint width, const uint height, const bool automaticallyScaleAndSetAsMinimumSize) | |||
| : UIWidget(UI::PrivateData::createNextWindow(this, | |||
| // width | |||
| @@ -342,7 +370,26 @@ UI::UI(const uint width, const uint height, const bool automaticallyScaleAndSetA | |||
| Widget::setSize(width, height); | |||
| if (automaticallyScaleAndSetAsMinimumSize) | |||
| { | |||
| #if defined(_MSC_VER) | |||
| #pragma warning(push) | |||
| #pragma warning(disable:4996) | |||
| #elif defined(__clang__) | |||
| #pragma clang diagnostic push | |||
| #pragma clang diagnostic ignored "-Wdeprecated-declarations" | |||
| #elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 460 | |||
| #pragma GCC diagnostic push | |||
| #pragma GCC diagnostic ignored "-Wdeprecated-declarations" | |||
| #endif | |||
| setGeometryConstraints(width, height, true, true, true); | |||
| #if defined(_MSC_VER) | |||
| #pragma warning(pop) | |||
| #elif defined(__clang__) | |||
| #pragma clang diagnostic pop | |||
| #elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 460 | |||
| #pragma GCC diagnostic pop | |||
| #endif | |||
| } | |||
| } | |||
| #ifdef DISTRHO_UI_DEFAULT_WIDTH | |||
| else | |||
| @@ -351,6 +398,7 @@ UI::UI(const uint width, const uint height, const bool automaticallyScaleAndSetA | |||
| } | |||
| #endif | |||
| } | |||
| #endif | |||
| UI::~UI() | |||
| { | |||
| @@ -1,7 +1,7 @@ | |||
| /* | |||
| * DISTRHO Plugin Framework (DPF) | |||
| * Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2019-2021 Jean Pierre Cimalando <jp-dev@inbox.ru> | |||
| * Copyright (C) 2012-2026 Filipe Coelho <falktx@falktx.com> | |||
| * | |||
| * Permission to use, copy, modify, and/or distribute this software for any purpose with | |||
| * or without fee is hereby granted, provided that the above copyright notice and this | |||
| @@ -74,7 +74,9 @@ public: | |||
| fButton->setCallback(this); | |||
| fButton->setId(kParameterButton); | |||
| setGeometryConstraints(DISTRHO_UI_DEFAULT_WIDTH, DISTRHO_UI_DEFAULT_HEIGHT, true, true); | |||
| // set minimum UI size | |||
| const double scaleFactor = getScaleFactor(); | |||
| setGeometryConstraints(DISTRHO_UI_DEFAULT_WIDTH * scaleFactor, DISTRHO_UI_DEFAULT_HEIGHT * scaleFactor, true); | |||
| } | |||
| protected: | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * DISTRHO Plugin Framework (DPF) | |||
| * Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2012-2026 Filipe Coelho <falktx@falktx.com> | |||
| * | |||
| * Permission to use, copy, modify, and/or distribute this software for any purpose with | |||
| * or without fee is hereby granted, provided that the above copyright notice and this | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * DISTRHO Plugin Framework (DPF) | |||
| * Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2012-2026 Filipe Coelho <falktx@falktx.com> | |||
| * | |||
| * Permission to use, copy, modify, and/or distribute this software for any purpose with | |||
| * or without fee is hereby granted, provided that the above copyright notice and this | |||
| @@ -33,7 +33,7 @@ class ExampleUIParameters : public UI | |||
| public: | |||
| /* constructor */ | |||
| ExampleUIParameters() | |||
| : UI(DISTRHO_UI_DEFAULT_WIDTH, DISTRHO_UI_DEFAULT_HEIGHT) | |||
| : UI() | |||
| { | |||
| /** | |||
| Initialize all our parameters to their defaults. | |||
| @@ -41,8 +41,9 @@ public: | |||
| */ | |||
| std::memset(fParamGrid, 0, sizeof(bool)*9); | |||
| // TODO explain why this is here | |||
| setGeometryConstraints(128, 128, true, false); | |||
| // set minimum UI size | |||
| const double scaleFactor = getScaleFactor(); | |||
| setGeometryConstraints(DISTRHO_UI_DEFAULT_WIDTH * scaleFactor, DISTRHO_UI_DEFAULT_HEIGHT * scaleFactor, true); | |||
| } | |||
| protected: | |||
| @@ -21,6 +21,7 @@ FILES_UI = \ | |||
| # -------------------------------------------------------------- | |||
| # Do some magic | |||
| UI_TYPE = generic | |||
| include ../../Makefile.plugins.mk | |||
| # -------------------------------------------------------------- | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * DISTRHO Plugin Framework (DPF) | |||
| * Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2012-2026 Filipe Coelho <falktx@falktx.com> | |||
| * | |||
| * Permission to use, copy, modify, and/or distribute this software for any purpose with | |||
| * or without fee is hereby granted, provided that the above copyright notice and this | |||
| @@ -33,5 +33,7 @@ | |||
| #define DISTRHO_PLUGIN_WANT_MIDI_INPUT 1 | |||
| #define DISTRHO_PLUGIN_WANT_MIDI_OUTPUT 0 | |||
| #define DISTRHO_UI_FILE_BROWSER 0 | |||
| #define DISTRHO_UI_DEFAULT_WIDTH (64 * 12 + 8) | |||
| #define DISTRHO_UI_DEFAULT_HEIGHT (64 + 8) | |||
| #endif // DISTRHO_PLUGIN_INFO_H_INCLUDED | |||
| @@ -22,15 +22,13 @@ FILES_UI = \ | |||
| # -------------------------------------------------------------- | |||
| # Do some magic | |||
| UI_TYPE = generic | |||
| include ../../Makefile.plugins.mk | |||
| # -------------------------------------------------------------- | |||
| # Enable all possible plugin types | |||
| ifeq ($(HAVE_OPENGL),true) | |||
| TARGETS += jack | |||
| endif | |||
| TARGETS += lv2_sep | |||
| TARGETS += vst2 | |||
| TARGETS += vst3 | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * DISTRHO Plugin Framework (DPF) | |||
| * Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2012-2026 Filipe Coelho <falktx@falktx.com> | |||
| * | |||
| * Permission to use, copy, modify, and/or distribute this software for any purpose with | |||
| * or without fee is hereby granted, provided that the above copyright notice and this | |||
| @@ -35,10 +35,14 @@ class SendNoteExampleUI : public UI | |||
| { | |||
| public: | |||
| SendNoteExampleUI() | |||
| : UI(64*12+8, 64+8), | |||
| : UI(), | |||
| fLastKey(-1) | |||
| { | |||
| std::memset(fKeyState, 0, sizeof(fKeyState)); | |||
| // set minimum UI size | |||
| const double scaleFactor = getScaleFactor(); | |||
| setGeometryConstraints(DISTRHO_UI_DEFAULT_WIDTH * scaleFactor, DISTRHO_UI_DEFAULT_HEIGHT * scaleFactor, true); | |||
| } | |||
| protected: | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * DISTRHO Plugin Framework (DPF) | |||
| * Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2012-2026 Filipe Coelho <falktx@falktx.com> | |||
| * | |||
| * Permission to use, copy, modify, and/or distribute this software for any purpose with | |||
| * or without fee is hereby granted, provided that the above copyright notice and this | |||
| @@ -33,6 +33,8 @@ | |||
| #define DISTRHO_PLUGIN_WANT_STATE 1 | |||
| #define DISTRHO_UI_FILE_BROWSER 0 | |||
| #define DISTRHO_UI_USER_RESIZABLE 1 | |||
| #define DISTRHO_UI_DEFAULT_WIDTH 512 | |||
| #define DISTRHO_UI_DEFAULT_HEIGHT 512 | |||
| // states and presets together require this in order to function | |||
| #define DISTRHO_PLUGIN_WANT_FULL_STATE 1 | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * DISTRHO Plugin Framework (DPF) | |||
| * Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2012-2026 Filipe Coelho <falktx@falktx.com> | |||
| * | |||
| * Permission to use, copy, modify, and/or distribute this software for any purpose with | |||
| * or without fee is hereby granted, provided that the above copyright notice and this | |||
| @@ -54,15 +54,16 @@ public: | |||
| /* constructor */ | |||
| ExampleUIParameters() | |||
| : UI(512, 512) | |||
| : UI() | |||
| { | |||
| /** | |||
| Initialize the grid to all off per default. | |||
| */ | |||
| std::memset(fParamGrid, 0, sizeof(bool)*9); | |||
| // TODO explain why this is here | |||
| setGeometryConstraints(128, 128, true); | |||
| // set minimum UI size | |||
| const double scaleFactor = getScaleFactor(); | |||
| setGeometryConstraints(DISTRHO_UI_DEFAULT_WIDTH * scaleFactor, DISTRHO_UI_DEFAULT_HEIGHT * scaleFactor, true); | |||
| } | |||
| protected: | |||
| @@ -21,6 +21,7 @@ FILES_UI = \ | |||
| # -------------------------------------------------------------- | |||
| # Do some magic | |||
| UI_TYPE = generic | |||
| include ../../Makefile.plugins.mk | |||
| # -------------------------------------------------------------- | |||