jtackaberry / rtk

REAPER Toolkit - a GUI and utility library for REAPER scripts
https://reapertoolkit.dev
Apache License 2.0
30 stars 2 forks source link

Scaling with rtk? #21

Open tompad2 opened 1 year ago

tompad2 commented 1 year ago

Hi!

I have a user that use 200% scaling on windows desktop and that makes my script not showing up the right way. How can I make my script looking good independent of scaling?

jtackaberry commented 1 year ago

The general advice is similar to building responsive websites: absolute fixed geometry (absolute coordinates and width/height) and instead use containers (particularly rtk.VBox/rtk.HBox and where applicable rtk.FlexBox) with cells that specify minimum width (minw) and (where needed) max width (maxw) to constrain the containers and how they reflow.

Can you point me at your script? I can try it out on Windows with scaling and make some more specific suggestions. Or perhaps there's a legit issue that I should be fixing as well.

tompad2 commented 1 year ago

Oh, it would be great if you can look at it!! I had a hard time putting it together, I guess I missed some important things. ;-) The script is FX Chain A-B in ReaPack.

Thanks tack!

exscape commented 10 months ago

I have similar issues with the hello world script provided here when REAPER has scaling enabled. Specifically, under Preferences > General > Advanced UI/system tweaks I have "Scale UI elements of track/mixer panels, transport etc. by" set to 1.4x.
It looks great with that option disabled.

jtackaberry commented 10 months ago

@exscape would you be able to attach a screenshot here? Also, what OS are you using? Thanks!

exscape commented 10 months ago

Hmm, so this is interesting... I just copy-pasted the hello world script to a new ReaScript again, ran it with Ctrl+S in the integrated editor, and it looked great.
I then shut down REAPER, started it again, and it's bugged again. Here's a screenshot of the window with 1.4x scaling:

Screenshot 2023-11-18 223823

If I just resize the window, it looks great. The button is correctly sized and all.
After a manual window resize:

Screenshot 2023-11-18 224140

I can't get it to be properly sized again, so now I'm questioning myself whether it actually looked the same the entire time or not...
I've used rtk a fair bit now since my previous comment, and I haven't had any scaling-related issues (nor any other issues) during that time, and that's with far more complex layout of nested containers (Window > Viewport > dozens of VBox/HBox combinations). I really think the only issue here is the window size.

jtackaberry commented 10 months ago

@exscape hm, yes, this could well be a corner case the with the window autosizing logic. The scale detection that rtk does is working properly (even though truncated, the first screenshot is scaled properly), but the automatic size of the window looks as though it was calculated based on a 1.0 scale factor.

I'm so far not able to reproduce it though, even after restarting REAPER and loading the Hello World script.

Are you by any chance combining REAPER's internal UI scaling with OS display scaling in Windows?

exscape commented 10 months ago

Nope, Windows scaling is at 100% (on a 1440p monitor). I've had it at 200% on my 4K TV in the past, but that hasn't been active since the last few reboots (and not since days before I first downloaded rtk).
This is on Windows 11 22H2, by the way, I realized I forgot to mention that in my last comment. Also, the REAPER version is 7.05.

I did some further testing with a clean install and narrowed it down to a file: REAPER.ini.
I'm not sure exactly what, but something in there is causing the issue. If I just move it out of the way and use clean settings, except for setting UI scaling of course, the script works as expected. Every time I put it back the window size is too small again. It's not related to my theme, at least, as it happens with the default themes, even after a REAPER restart.

Any ideas on what kinds of settings I should try changing to narrow it down further?