Re: Canvas basics



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jody Goldberg <jody gnome org> writes:

On Thu, Dec 23, 2004 at 12:17:26AM +0000, Roger Leigh wrote:
Sorry; I'll try to explain a little more clearly.

Gnumeric displays a grid of cells in the canvas; the canvas itself is
in a ScrolledWindow.  The column and row labels (A-Z and 0-nnnn) are
also in the canvas, but these don't scroll with the rest of the sheet;
they stay fixed along the top and left edges.  If they behaved like
the other canvas items, they would scroll off the top so you couldn't
see them, so they are always visible.  I'd like to mimic this with the
headings on my canvas, but I don't know how Gnumeric achieves this.

We cheat :-)
There are 3 canvases for basic operation.
1 for the grid
1 the col header
1 the row header

Cheating is good :)  This gets rid of the horrible flickering I was
seeing when shifting all my GnomeCanvasItems around!  It's now silky
smooth and I'm really happy.

I've put the results here:
http://www.whinlatter.ukfsn.org/gtk/cse-0.1.1.tar.gz

If you don't mind, could I pick your brain about other bits of
Gnumeric?

I'd like to let the mouse wheel and Alt + mouse wheel scroll
horizontally and vertically when over any of the canvas widgets.  Do I
need to create synthetic scroll events or pass the events to the
scrollbars somehow?  Do I need to catch this through "event" in the
CanvasItems, or can I handle it as a proper GdkEvent in the Canvas
widget itself?

The other thing I'd like to do is set a GdkCursor to show when the
mouse moves over certain items, like the edge of the current selection
or the drag handle in the bottom right corner.  Is this simple to do?
I saw that there was a gnome_canvas_item_grab() method, but can this
only be called from the event handler?  If so, I'm a little unsure
when it's appropriate to grab() and ungrab().

When there are frozen panes we can have up to 4 canvases for the
grid.

That's pretty cool.  Just a thought: would it make sense to have a
view/model separation for the canvas?  This would allow one to have a
CanvasView displaying an underlying CanvasModel.  You would then be
able to manipulate the model like you can now, but you would be able
to have multiple view panes and magnifiactions of the same model
(though this would require text to scale properly--perhaps you could
draw using physical units of measurement instead of an abstract
scale?).

Some other minor things I've found I don't like about the current
implementation are:

- - once placed on the canvas, items (e.g. CanvasGroups) can only be
  moved relatively, rather than to absolute coordinates, AFAICT.
  This would be handy for when I want to move an item to a specific
  location.
- - gnome_canvas_item_new allows one to set object properties on the
  created item.  However, it does not pass them to g_object_new, so
  they can't be used as construction parameters.  (Though I can't
  remember why I wanted this now.)


Many thanks!
Roger

- -- 
Roger Leigh
                Printing on GNU/Linux?  http://gimp-print.sourceforge.net/
                Debian GNU/Linux        http://www.debian.org/
                GPG Public Key: 0x25BFB848.  Please sign and encrypt your mail.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>

iD8DBQFB4GwzVcFcaSW/uEgRAiA4AJ9DqctL5EIXPQrFJ1s23hScNeyAXgCg51Kz
phU9bbHqSUW4gZ5vxVQJlfQ=
=d7fR
-----END PGP SIGNATURE-----



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