Re: GNOME spreadsheet work in progress

>  - scatter plots, this can be a couple hundred or even thousand markers,
>     splattered all over the screen. They come in colors and shapes to 
>     distinguish different data. Can an item be mostly transparent and let
>     other items show through?

Yes, most definetly.  If there is not an existing item that does
exacly what you want, you can create new items (they are just
gtkobjects, this, btw, was a very good suggestion from Marius Volmer).

>  - Select an area with rubberbanding and zoom in on that area (it isn't
>     clear to me looking at the canvas how you'd do this). 

You have to implement the code for rubberbanding yourself.  Basically,
you have to hook to the "event" signal, and then you handle the
your handlers, what you do is insert a rectangle item which you
manipulate for doing the rubber banding thing.

>  - Have the rubberband communicate with the plot items. i.e., if you're
>    selecting a curve, you want one dimension of the rubberband to be 
>    "automatic" and conform to the extents of the curve, and the other
>    is user-controlled.

That is also the responsability of your code.  

> For some reason I remembered the canvas items not being GtkObjects, which
> would have made them harder to wrap. Since they're GtkObjects I guess the
> existing Gtk-- stuff will work just fine.

Yeah, it was a brokeness in the original design.  Marius insisted in
doing the right thing and Federico did as suggested.

> By raw mode I mean drawing directly on the canvas rather than via an item.
> I guess creating a new item is the way to do this, which is fine as long
> as it can be done quickly in C++. However if requires writing a GtkObject
> that is pretty painful if it has to be done for every type of plot.

Well, not really.  You can have an ItemPlot that does all the plotting
for you: every single plotting mode can be handled here.  At the Item
level, you are passed a GdkDrawable, where you use the regular
gdk_draw_* routines.  

The nice thing is that by doing it as an item you avoid the flicker
and you can layer other items on top of it (like your rubber banding,
labels, or cursors).

For example, Gnumeric is right now made of three items: the ItemGrid
which implements the grid display and cell display; The ItemCursor
which implements various cursor modes (selection, walking-ants
selection) and the ItemEdit (which does on-cell editing and hooks to
an existing GtkEntry).  

Now, the nice thing is that adding Excel-like features for drawing
circles, lines and arrows with this model is trivial.  You just use
one of the existing items that Federico has been writing (rectangles,
images, and soon lines and widgets).

> It is essentially a much simpler kind of canvas, but then I'm implementing
> zooming and the equivalent of CanvasItem outside of it.

The canvas does zooming for you :-)

> One trivial thing I'm doing now I notice the canvas doesn't permit is
> grabbing the pointer with the "confine" option on while rubberbanding;

There is a new gnome_canvas_grab routine just for this purpose (I
needed this for the spreadsheet as well).  If your specific option is
not handled, we can make changes to the canvas to deal with it.

> The bad thing is that it would cost some time right now because we'd
> have to learn how to use it and how to write our own items, and then
> re-do some code.

Yes, that is a disadvantage.  I learned to do my own items in about 2
days (ie, to figure out that I was doing it all wrong in attempt #1

> On another note, if you can stand a tangent on the end of an already-long
> mail, I think it would be really neat if the Canvas could make itself into
> a text file and then reconstitute. Each object could have stringify and
> unstringify (serialize?) methods. Then you could load and save in
> GnomeCanvas format and have a GnomeCanvas viewer. 

Interesting idea.  Probably using that Metafile format that Windows
uses (every time I mention this, someone kindly points me out that the
Metafile format is some kind of standard that Microsoft did not

Best wishes,


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