On 8/18/2020 12:31 PM, James Platt wrote:
> I'm looking at implementing a zoom contents (not zoom window) feature in a GUI with lots of elements and I'm wondering about the best way to do this. Most, if not all, standard GUI widgets in Racket can be resized by changing the font size of their contents or label. Then redraw the widget and you have the whole thing in a new size. So zoom could be done by creating a function which handles each element individually but I would like a more general solution, if possible. Most widgets use the value normal-control-font for their default but it doesn't look like this can be changed at present. If there were a setter for normal-control-font, it looks like you could have a menu item change it, then recursively get the children of the frame it is attached to and redraw them. Would this actually work? Is there a better way to do it?
If you can access (or render) the contents as a 'pict', then it be
scaled somewhat arbitrarily (though a scaled version is not guaranteed
to look good).
https://docs.racket-lang.org/pict/Pict_Drawing_Adjusters.html
It is a form of BitBLT operation. I would search the docs for "blt" or
"blit" in addition to "scale" and "size". Sorry I can't point you more
directly to relevant functions: I've done a lot of GUI programming,
but, unfortunately, I know it from C++ using device contexts directly,
not from using Racket's graphics.
Hope this helps,
George