Re: Canvas basics



Le mer 22/12/2004 �6:22, Roger Leigh a �it :
> [I originally posted this to gtk-app-devel-list, but I'm not sure that's
> the best place.]
> 
> Is the Canvas on-topic for this list?  If so, I have a few basic
> questions about it, which I hope are simple :)
> 
> Firstly, which Canvas implementation should I be using?  I've tried
> libgnomecanvas2, but I see there's also a FooCanvas, and a GtkCanvas
> (GTK+ 1.2 only?).  Is the AA canvas still experimental and not
> recommended?

I don't think there is still some development on the Gnome Canvas but it
seems there are some projects to rewrite it using Cairo.
Nonetheless, I have used the AA canvas in GCHemPaint for a while with
only some minor problems, essentially with the rich text item.

> I've been looking at George Lebl's "Piskvorky" canvas tutorial.
> (ftp://ftp.5z.com/pub/unix/gnome-piskvorky-1.tar.gz)  After
> tweaking the Makefile to use pkg-config, this built fine with
> GTK+ 2.4/GNOME 2.8.  However, I did find a problem: if I resize the
> window, the canvas viewable area becomes centred in the canvas widget,
> but the coordinates of button presses are still relative to the top left
> corner of the canvas widget, rather than the canvas view itself.  How
> should I compensate for this in the code?  Or is this a canvas bug,
> since the events are outside the drawable area?
> 
> What I really want to do with the canvas is create a grid display
> system, similar to Gnumeric, but probably much simpler.  What I want to
> do is achieve the same scroll behaviour as Gnumeric: the row and column
> labels scroll with the canvas, and scrolling is in discrete steps.  How
> should I do this.  I thought of two possible methods:
> - packing four canvas widgets into viewports in a GtkTable and tying
>   their adjustments to the same scrollbars.
> - overlaying the row/column headings on top of the canvas relative
>   to the scroll position.
> How does Gnumeric do this?  I had a look, but couldn't find the
> relevant source files.

Have a look at gnumeric-pane.c. I'm not quite sure it's the right file.
Jody should be able to tell you more about that when he'll be back from
sunny countries.

Regards,

Jean





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