Re: GnomeCanvas




> 1.) What about a highlight function, that will highlight the item in
> the near of the cursor. I figured out that you call the (point)
> function to determine the nearest item whithe every mouse move.	I´m
> not sure if this can be done via the drawable of the (draw) function,
> or a new (highlight) function, which will copy most of the (draw)
> algorithm. 
> And naturally a flag, whether this item should be highlighted or not.

Well, the first question is: what does "highlighting an item" mean to
you?  The fact is that different programmers might have different
needs for a highlighting routine.  

I do believe that a feature like highlighting belongs somewhere else,
it can be achieved pretty easily by having a helper routine that would
implement the kind of highlighting you want in a  per-object basis,
basically:

int maybe_highlight (GtkObject *item, GdkEvent *event)
{
	if (event->type = GDK_ENTER_NOTIFY){
		do_highlight ();
		return TRUE;
	} 

	if (event->type == GDK_LEAVE_NOTIFY){
		do_unhighlight ();
		return TRUE;
	}
	return FALSE;
}

make_highlightable (GnomeCanvasItem *item)
{
	gtk_signal_connect (item, "event", GTK_SIGNAL_FUNC (maybe_highlight));
}

We could provide a number of these "default" handlers for objects as
part of the gnome libraries (I am thinking specifically, that I want
to have the control points added automatically for me when editing
objects in Gnumeric for example).

> 3.) Wouldn´t the functionality of the Stipples in gnumeric be better
>     placed into GnomeCanvas?

We have discussed that a little.  Basically, yes, the idea of letting
the canvas manage the stipples is good, but then you run into a number
of issues:

	- You either need to define more parameters to specify how the
	  bitmap for the stipple is created.

	  or you have to pass the stipple to the canvas and then we
	  run into "ownership" problems: Who should release the bitmap
	  when done?  I think the Canvas Item should own the stipple.

	- Stipple alignment:  It is not clear yet how to set the
	  alignment of the stipple manually. 

So, we are trying to figure these out before we implement the stipples
code in the canvas.

> 4.) Is the GnomeCanvas thought as an all purpose Canvas, or is it
> thought as a spezialiced drawing widget? 

An all purpose Canvas.  Just look at Gnumeric: it has about four
specialized Items that only Gnumeric has a use for that extend the
canvas.

> E.g. am I able to insert a baboon object within the canvas, to build
> up a document processor?

Yes.  This works like this:  embedding of applications is done trough
Owen Taylor's GtkPlug and GtkSocket widgets.  So, what you do is
create a GnomeCanvasWidgetItem (ie, an item that can contain an
arbitrary widget) and plug in there your GtkPlug/GtkSocket widget.

> 5.) Is somebody working on the spline interpolation in the
> gnome-canvas-line item? I would like to do this. I thought about
> computing the interpolated pixels within the realize phase and to hold 
> a second list of GnomeCanvasPoints within the GnomeCanvasLine
> structure.

I would appreciate if you told me what spline interpolation in
gnome-canvas-line item means, as I am pretty much clueless regarding
graphics.

> 6.) Is it possible to build up a generic widget from the item arguments, 
> so that one can change the arguments from a properties entry in the
> right click menu. The generic widget could be replaced by the item
> programmer with a specialized widget.

I am not sure if I understand this question.  Can you be more
explicit?

> 7.) Last but not least a question about inheritance: What if I would
> like to produce a small drawing application with lines, circles,
> rectangles, polygons and variable fill style, line width, color? 

Yes, you can do that.  

If you are thinking seriously about writing a drawing application, let
us know (federico@nuclecu.unam.mx, raph@acm.org, and myself) as we are
interested in helping you (and Raph and Federico are going to merge
Raph's extraordinary Caanvas (double-a) code into the regular Canvas,
so we will get stuff like transparency, operations, splines,
postscript fonts and some more :-).

> I do not understand the whole GtkObject way of arguments and neither
> have a deep inside knowledge about all that Object Oriented stuff in
> Gtk+ and Gnome. But wouldn´t it be better to use argument names like:
> 
> GnomeCanvasItem::Fill::color instead of GnomeCanvasLine::fill_color
> 					  GnomeCanvasRE::fill_color

The only issue here is that not every item needs/wants a fill-color,
so I do not think the Fill color belongs to GnomeCanvasItem.  

best wishes,
Miguel.



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