Re: [racket-users] GUI zoom and normal-control-font

2020-08-20 Thread James Platt


On Aug 19, 2020, at 8:53 PM, George Neuner wrote:

> Sorry, it was not clear to me that you wanted to resize widgets (child 
> windows).  Typically when one speaks about a window's "content" they are 
> referring to text or imagery drawn onto the window's backing bitmap.

I was going by Macintosh terminology where there are two different kinds of 
zoom.  A window zoom is activated, currently, by double clicking on the top bar 
of a window.  Previously, it was the green button on the window bar but that 
now activates full screen mode.  It toggles between the last custom dragged 
size of the window and a size of its contents.  Unfortunately, this has never 
worked as well in Mac OS X and macOS as well as it did in Classic Mac OS which 
might be part of the reason they switched the green button to full screen mode. 
 The zoom I want is the one activated by the zoom menu item (or command - / 
command =).  This resizes contents of the window, including text and imagery as 
well as widgets.  I would really like to have the full functionality but, for 
now, just resizing widgets would be a major improvement.  

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/1F4FEE9B-83AD-4E10-A850-4341F0AA935D%40biomantica.com.


Re: [racket-users] GUI zoom and normal-control-font

2020-08-19 Thread George Neuner

On 8/19/2020 1:37 PM, James Platt wrote:
> 
> 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.


If I understand correctly, I would do that like in the Stackoverflow post 
below.   Note the need for using the bitmap% version of the button label.   The 
advantage of this approach is that you can change the label dynamically with a 
send.  The drawback is that I would have to create a modified version of every 
widget.  I was just hoping for a solution which would not require so much 
customization of a standard Racket package.

https://stackoverflow.com/questions/48414363/how-to-change-the-color-of-text-in-a-racket-gui-button/48468797#48468797


Sorry, it was not clear to me that you wanted to resize widgets (child 
windows).  Typically when one speaks about a window's "content" they are 
referring to text or imagery drawn onto the window's backing bitmap.


Basically, you need to push a resize message to every child.  I'm not 
sure the best way to do that, but my first thought would be something 
involving panels (or panes).  When a panel gets resized, all its 
children are resized as well.

https://docs.racket-lang.org/gui/windowing-overview.html#%28part._containeroverview%29
https://docs.racket-lang.org/gui/panel_.html
https://docs.racket-lang.org/gui/pane_.html

The trick is that normally a panel would be sized relative to its 
parent.  To effect a "zoom" you would have to override that behavior so 
at least the (Z-stack) bottom panel can be made larger than the 
application window's viewing area.


George

--
You received this message because you are subscribed to the Google Groups "Racket 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/65bbe973-c309-1f92-620a-76d4708f32c7%40comcast.net.


Re: [racket-users] GUI zoom and normal-control-font

2020-08-19 Thread James Platt
> 
> 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.

If I understand correctly, I would do that like in the Stackoverflow post 
below.   Note the need for using the bitmap% version of the button label.   The 
advantage of this approach is that you can change the label dynamically with a 
send.  The drawback is that I would have to create a modified version of every 
widget.  I was just hoping for a solution which would not require so much 
customization of a standard Racket package.  

https://stackoverflow.com/questions/48414363/how-to-change-the-color-of-text-in-a-racket-gui-button/48468797#48468797


-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/08CD0FAF-AFCD-4B43-87C4-422C79AA2361%40biomantica.com.


Re: [racket-users] GUI zoom and normal-control-font

2020-08-18 Thread George Neuner



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

--
You received this message because you are subscribed to the Google Groups "Racket 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/c9f51d94-3b70-83fc-14b8-f858fcfed32c%40comcast.net.


[racket-users] GUI zoom and normal-control-font

2020-08-18 Thread James Platt
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?

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/62C9C1F2-D9D7-4EE2-92AC-1E222428C974%40biomantica.com.