Re: BonoboZoomable - BonoboZoomLevel



Michael Meeks <michael helixcode com> writes:

> 	I have big misgivings about this function; I would like it split
> up thus:
> 
> 	set_level
> 	set_min (float min_zoom_level);  -- implies turning
> has_min_zoom_level on.
> 	etc.
> 	set_preferred_zoom_levels (...)

Well, you normally call this function only once when you created your
component and maybe each time you loaded a new file.

The big problem with splitting this up is that changing one value most
likely invalidates all the other ones, so you'll end up setting all of
them anyways (and a component also knows all of them anyways when it
call set_parameters()).

This is not really needed to set the initial zoom level; calling this
function just invalidates the current zoom level so you need to reset
it. If you just want to set the initial zoom level without caring about
the other values you can just call bonobo_zoomable_report_zoom_level_changed
instead.

Also, set_parameters() results in a callback being invoked on the
ZoomableFrame; we'd need to split up this callback as well.

> 	I think forcing the user to make all these difficult decisions
> just to set the initial zoom level is not easy and can obscure the
> optionality of the other arguments.

You don't need this, just call bonobo_zoomable_report_zoom_level_changed()
after creating the Zoomable.

> 	As for the preferred zoom levels etc. I dislike the
> num_preferred_zoom_levels; I assume you use it to allow a NULL value in
> the names; I'd prefer to NULL terminate the levels and their names and use
> "" as signifying no name [ we have to do this at the CORBA level anyway ].

No, I use it for another reason.

AFAIK it is wrong to use 0.0 as a termination of a float array - since,
depending on the floating point implementation, using a binary `==' operation
on a float may not always work as expected (the implementation can round the
number, for instance).

So we need this parameter to know how many elements that float array has.

We also cannot use NULL on the names for this since in this case the names
won't be optional any longer.

-- 
Martin Baulig
martin gnome org (private)
baulig suse de (work)




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]