Re: Spreadsheet Problem



On Sun, Dec 01, 2002 at 12:16:10PM +1000, grom capsicumcorp com wrote:
The reason for this problem is that I can not guarantee that all models
support the same number of rows and columns before repainting.
Gnumeric only supports a single model per worksheet.  There are
multiple views of the model (different selections, and different
positions) and multiple controls of the views (different displays of
the same view).  I suspect we're talking about different forms of
'model' in that sentence.

Anyway, the purpose of this email is to find out how the painting of the
cells in gnumeric is handled. In particular the painting of spanned cells.
I've download the source code, but I'm a bit lost by it all. If you could
point my in the right direction it would be appreciated.
Your best bet is to look at the code in
    gnumeric/src/item-grid.c:item_grid_draw

That is the core of the actual drawing for on screen display.
Ignoring rendering of the actual cell content (which is in
cell_draw) that routine handles singletons, spans, and merges.
It should be reasonably easy to read, although there are some
complications for efficency, and drawing borders.  The basic logic is

1) given a rectangle of display coordinates figure out which
   cols/rows to display.

2) Walk each _visible_ row
3)      invalidate any merged regions that have finished before this row
4)      find the next visible row
5)      generate spans for the current row if not cached
6)      paint merges that start on this row.  If this is the first
        row we paint also consider merges that started above.
7)      Walk each _visible_ column
8)              skip over any merges
9)              draw the cell background
10)             Handle spans and skip to the end of them
11)             Handle singletons
12)             draw borders

Obviously there is more to it than that, but its a rough overview.

Hope it helps
    Jody



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