The purpose of this document is to describe the R3 GUI resizing subsystem.
The original resizing in R3 GUI had the following bugs and limitations:
What was needed, was to define an algorithm that would:
Since the idea to use the MAX-SIZE field to determine the expansion ratio was not accepted well, we needed to use a different approach, looking more "natural" to the user.
The most natural expansion principle seemed to be the principle to expand objects "evenly", i.e. proportionally to their original dimensions. The attribute used is called INIT-SIZE.
Let's consider two objects with no resizing limits, object A having INIT-SIZE 50x20, object B having INIT-SIZE 100x20. Moreover, let's suppose that the objects are in a hpanel consisting of just one row and containing no additional space.
view [ hpanel [ a: box red options [init-size: 50x20] b: box green options [init-size: 100x20] ] ]
Initially, both objects will have the dimensions 50x20 and 100x20, and the hpanel will have the dimensions 150x20. If it is needed to expand the hpanel to 300x20, the object A will be resized to 100x20, while the object B will be resized to 200x20, i.e. proportionally to their INIT-SIZE values.
For every object it is possible to specify the smallest dimensions the object is allowed to have after resizing. The attribute is called MIN-SIZE. When the size computed by the resizing algorithm would be smaller than the MIN-SIZE, the calculated size is clipped to the MIN-SIZE.
If we do not want to limit the object's ability to shrink, we can set the MIN-SIZE of the object to 0x0. That does not limit the object's ability to shrink.
For every object it is possible to specify the greatest dimensions the object is allowed to have after resizing. The attribute is called MAX-SIZE. When the size computed by the resizing algorithm would be greater than the MAX-SIZE, the calculated size is clipped to the MAX-SIZE.
view [ hpanel [ a: box red options [init-size: 50x20 min-size: 0x0] b: box green options [init-size: 100x20 min-size: 10x10 max-size: 150x150 ] ] ]
If we do not want to limit the object's ability to expand, we can set the MAX-SIZE of the object to GUIE/MAX-PAIR value, which is large enough to not limit the object's ability to expand.
The initial size is the size that is suggested as the size when the object is first displayed. Due to the dynamic nature of resizing, the actual dimensions of the object may differ.
For example, if the object is in a vpanel, and the column width of the vpanel is larger than the suggested initial size, the resizing algorithm automatically tries to magnify the object so that its width becomes as large as the column width if possible.
Another reason, why the object size might differ from its INIT-SIZE may be that the object dimensions are clipped to either its MIN-SIZE, or MAX-SIZE
There is not much sense (although it is not forbidden) to having the initial size equal to zero, since the object with zero initial size is invisible, and it cannot be enlarged to a nonzero size.
To specify that an object has a fixed size it suffices to specify that its minimal as well as maximal sizes are equal to its initial size.
To specify the way, how the dimensions of layouts, layout rows and columns are calculated, it is possible to use hints.
Every graphic object has a content area and optional surrounding padding, border, and margin areas.
For every object in a layout it is possible to specify that the object is:
In a hpanel, vpanel, hgroup, or vgroup the initial, minimal, and maximal sizes are computed using the dimensions of the graphic elements the layout contains and the hints user has given.