[PD-dev] Iem_gui objects in vanilla and zoom

Fred Jan Kraan fjkraan at xs4all.nl
Fri Nov 25 17:44:17 CET 2016


Hi,

It is a good thing I haven't shared any of the code that should fix bang 
and toggle, as studying and modifying more objects revealed more 
situations not accounted for.


The current analysis is based on studying and modifying bang, toggle and 
numbox.

In the current implementation, the x and y coordinates are controlled by 
the system, the object width(*) and height by the iem_gui framework 
(controlled by the zoom message). The properties box sets the number of 
digits (and box width), box height and label font type, size and position.
Other GUI dimensions are only present inside GUI functions and 
influenced by the zoom factor (via the IEMGUI_ZOOM(x) macro).
The fact that the zoom status is reflected in the object state variables 
(x_h, x_w and x_numwidth) and that those is exposed in the properties 
box makes it difficult to control the behaviour. One illustration is the 
test scenario "open properties, zoom out, apply" used on bang or toggle.

The effects of these scenario's can be corrected with more code. But as 
the code is already over-complicated, a probably better solution would 
be to isolate the zoom factor in the GUI routines. These are the 
*_draw_* and the *_getrect functions. The iemgui->x_glist->gl_zoom would 
be the only location where the current zoom factor is present.
In this model, the x_h, x_w and x_numwidth variables would not change 
while zooming. All zoom factoring is done in the GUI functions, when the 
sys_gui messages are send to the pd-core.

* for numbox the width is mainly controlled by the number of digits and 
the fontsize with minor corrections based om font type, object height 
and width settings.

basic test scenario's for zoom behaviour:
- create object normal mode and zoom in,
- create object zoomed mode and zoom out,
- apply properties normal mode (iem_gui only),
- apply properties zoomed mode (iem_gui only),
- save in normal mode and load,
- save in zoomed mode and load,
- open properties, zoom in, apply properties (iem_gui only),
- open properties, zoom out, apply properties (iem_gui only).

Greetings,

Fred Jan

On 24-11-16 20:32, Fred Jan Kraan wrote:
> Hi,
>
> While trying to understand the zoom function to apply it to other GUI
> objects, I studied the bng and tgl objects, and in the process came up
> with a solution that fixed both.
>
> For the iem_gui objects only the basic generic GUI parameters are
> available in a struct; x & y position coordinates, height and width. All
> other GUI dimensions are not accessible outside the drawing functions.
> The only option to get a correct zoom is to apply the zoom-factor to all
> appropriate dimension values in all GUI functions.
>
> At least for bng I have this working. With some more refactoring this
> could be applied without adding too much to the declared mess in the
> objects code.
>
> Greetings,
>
> Fred Jan
>
> _______________________________________________
> Pd-dev mailing list
> Pd-dev at lists.iem.at
> https://lists.puredata.info/listinfo/pd-dev



More information about the Pd-dev mailing list