setGlobalScaleFactor in Plugins


#1

Hi, calling this from a standalone and even inside the pluginhost does what’s expected - the content is scaled and the window resized - calling this inside a plugin scales the content but doesn’t resize the plugin window…

The issue isn’t really resizing as this is easy to do myself, it’s more that the content no longer appears to be anchored to the top left corner, i.e as if it is scrolled down a bit.

Any ideas? thx


#2

I have something like this in the constructor of my plugin editor:

    // the base size of my plugin window
    #define kTotalWidth 1000
    #define kTotalHeight 700

    // uiScale is an int in the range of 70-200
    float realScale = (float)globals.uiScale / 100.0f;     
    setSize((int)(kTotalWidth * realScale), (int)(kTotalHeight * realScale));      
    
    // container is just a blank Component
    container.setBounds(0, 0, kTotalWidth, kTotalHeight);
    container.setTransform(AffineTransform::scale(realScale));
    addAndMakeVisible(container);
    // every component is then added to container as if the container were kTotalWidth x kTotalHeight

I also have a menu handler where the user can select the scale:

   void scaleInterface(int scale)    // scale is in the range 70-200
   {
       float realScale = (float)scale / 100.0f;
       globals.uiScale = scale; 
       container.setTransform(AffineTransform::scale(realScale));
       setSize((int)(kTotalWidth * realScale), (int)(kTotalHeight * realScale));
   }

And that handles it all for me. Hope that helps.


#3

hi thx for that. I’ve been trying to avoid the affinetransform route as it doesn’t scale combos, tho someone else has posted a snippet for handling that. perhaps it’s time to give up on the setglobalscalefactor and piece these bits together… cheers!