DPF

DISTRHO Plugin Framework
Log | Files | Refs | Submodules | README | LICENSE

commit a21bf9934e37e000d4a4778f843da9ed0f8755c5
parent 8a31a58740e634846f6dcb96df04c34958eba183
Author: falkTX <falktx@falktx.com>
Date:   Fri, 13 Aug 2021 21:53:18 +0100

Add host scale factor text to d_info gui

Diffstat:
Mexamples/Info/InfoExampleUI.cpp | 14+++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/examples/Info/InfoExampleUI.cpp b/examples/Info/InfoExampleUI.cpp @@ -35,6 +35,7 @@ public: fSampleRate(getSampleRate()), fResizable(isResizable()), fScale(1.0f), + fScaleFactor(getScaleFactor()), fResizeHandle(this) { std::memset(fParameters, 0, sizeof(float)*kParameterCount); @@ -139,6 +140,11 @@ protected: drawRight(x, y, fResizable ? "Yes" : "No", 40); y+=lineHeight; + // host scale factor + drawLeft(x, y, "Host scale factor:", 20); + drawRight(x, y, getTextBufFloat(fScaleFactor), 40); + y+=lineHeight; + // BBT x = 200.0f * fScale; y = 15.0f * fScale; @@ -191,6 +197,11 @@ protected: UI::onResize(ev); } + void uiScaleFactorChanged(const double scaleFactor) override + { + fScaleFactor = scaleFactor; + } + // ------------------------------------------------------------------------------------------------------- private: @@ -200,7 +211,8 @@ private: // UI stuff bool fResizable; - float fScale; + float fScale; // our internal scaling + double fScaleFactor; // host reported scale factor ResizeHandle fResizeHandle; // temp buf for text