Re: Gnome Canvas



>  1)  Is there any reason why the scale of the canvas doesn't use an
>  adjustment(or at least doesn't seem too?)

I don't think an adjustment is the right thing to use in this case.
The canvas pixels_per_unit value can be set to anything in (0, inf).

>  2)  When placing the canvas in a scrolled window things don't behave as
>  expected.  For example, when zooming the canvas doesn't update the
>  adjustment so the scrolled window modifies its scroll bars.  I think that
>  this may be my fault however.  I am letting the scrolled window generate
>  the adjustments and then just placing the canvas into the scrolled window,
>  is there a way to extract Adjustments from the canvas to feed to the
>  scrolled window?

Right now the canvas does not support the hack to place it inside a
GtkScrolledWindow.  I'll implement it soon, or I'll take patches to do
it:-)

>  3) There doesn't seem to be a way to make canvas groups "opaque".  By
>  opaque, I mean opaque to item queries.  In other words if someone asks,
>  which item is at x,y and there is an item there but it is in an opaque
>  group, only the group is returned as the item.  This is useful so that a
>  caller that wants to treat a group as a single object can easily do so,
>  instead of traversing the group heirarchy to find the macro object.  If
>  this is possible, how do you do it?  It doesn't look like groups support
>  this but it appears to be a trivial modification to do it.

Try using this little function :-)

/* Returns whether the item is an inferior of or is equal to the parent. */
static int
is_descendant (GnomeCanvasItem *item, GnomeCanvasItem *parent)
{
	for (; item; item = item->parent)
		if (item == parent)
			return TRUE;

	return FALSE;
}

On the other hand, you could derive a GnomeCanvasOpaqueGroupClass from
GnomeCanvasGroupClass and make its ::point method return the group
itself instead of the child item in its actual_item argument.  This
may be easier if you'll be doing this very often.

>  4) If I wish to not propogate events through a group to items within the
>  group, is it possible to simply attach to the groups "event" signal and
>  return TRUE from the handler?  Is there a better way to do this?

Um, I think you got it backwards.

Events are emitted for leaf items.  If an event is not handled, then
it is propagated to its parent.  Emission is stopped when the event is
handled, or when it reaches the root.

If you wish to trap all events for a group's children, simply connect
to the event signal of the group.

>  5) I noticed in the canvas TODO list that there is no method to get all
>  the items in a single area.  Is there any code hidden away to perform
>  this?  What selection modes are being planned? 

This is not implemented yet.  Originally I had planned having only
rectangular areas, like Tk does.  However, now that libart lets us do
all sorts of magic, this could be implemented so that it would handle
arbitrary vector paths.

  Federico



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