Commit 47d3133f authored by Arturo Espinosa's avatar Arturo Espinosa

Ok, the new display engine is now in place.



Ok, the new display engine is now in place.

The design bug with the exposures has now been fixed.

Now, back to more mundane tasks.

Miguel.
parent e49e86a5
1998-09-04 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/item-grid.c (item_grid_draw): Redone the cell draw driver.
* src/cell.c (cell_draw): Now it returns the number of cells it
draw on top of.
(cell_calc_dimensions): Unregister the spans when entering,
register the span at exit.
1998-09-03 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/utils.c (int_get_from_range): Bug fix, we were not doing the
......
1998-09-04 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/item-grid.c (item_grid_draw): Redone the cell draw driver.
* src/cell.c (cell_draw): Now it returns the number of cells it
draw on top of.
(cell_calc_dimensions): Unregister the spans when entering,
register the span at exit.
1998-09-03 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/utils.c (int_get_from_range): Bug fix, we were not doing the
......
1998-09-04 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/item-grid.c (item_grid_draw): Redone the cell draw driver.
* src/cell.c (cell_draw): Now it returns the number of cells it
draw on top of.
(cell_calc_dimensions): Unregister the spans when entering,
register the span at exit.
1998-09-03 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/utils.c (int_get_from_range): Bug fix, we were not doing the
......
1998-09-04 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/item-grid.c (item_grid_draw): Redone the cell draw driver.
* src/cell.c (cell_draw): Now it returns the number of cells it
draw on top of.
(cell_calc_dimensions): Unregister the spans when entering,
register the span at exit.
1998-09-03 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/utils.c (int_get_from_range): Bug fix, we were not doing the
......
......@@ -137,6 +137,14 @@
<para>Cells are stored in a hash table inside the Sheet data
structure for quick retrieval and they are also linked properly in
their respective columns. </para>
<para>A cell might display information in more than one column, so
Gnumeric needs to keep track of which cells (column, row pairs)
are being managed by which cell. This information is kept in a
per-row fashion in the data pointer in the ColRowInfo structure
for the rows. The registration and unregistration of the view
areas code is on the cellspan.c file.
</sect1>
<sect1>
......
......@@ -137,6 +137,14 @@
<para>Cells are stored in a hash table inside the Sheet data
structure for quick retrieval and they are also linked properly in
their respective columns. </para>
<para>A cell might display information in more than one column, so
Gnumeric needs to keep track of which cells (column, row pairs)
are being managed by which cell. This information is kept in a
per-row fashion in the data pointer in the ColRowInfo structure
for the rows. The registration and unregistration of the view
areas code is on the cellspan.c file.
</sect1>
<sect1>
......
......@@ -834,44 +834,44 @@ gnumeric_pi (Value *argv [], char **error_string)
}
FunctionDefinition math_functions [] = {
{ "abs", "f", "number", NULL, NULL, gnumeric_abs },
{ "acos", "f", "number", NULL, NULL, gnumeric_acos },
{ "acosh", "f", "number", NULL, NULL, gnumeric_acosh },
{ "abs", "f", "number", &help_abs, NULL, gnumeric_abs },
{ "acos", "f", "number", NULL, NULL, gnumeric_acos },
{ "acosh", "f", "number", NULL, NULL, gnumeric_acosh },
{ "and", 0, "", &help_and, gnumeric_and, NULL },
{ "asin", "f", "number", NULL, NULL, gnumeric_asin },
{ "asinh", "f", "number", NULL, NULL, gnumeric_asinh },
{ "atan", "f", "number", NULL, NULL, gnumeric_atan },
{ "atanh", "f", "number", NULL, NULL, gnumeric_atanh },
{ "atan2", "ff", "xnum,ynum", NULL, NULL, gnumeric_atan2 },
{ "asin", "f", "number", NULL, NULL, gnumeric_asin },
{ "asinh", "f", "number", NULL, NULL, gnumeric_asinh },
{ "atan", "f", "number", NULL, NULL, gnumeric_atan },
{ "atanh", "f", "number", NULL, NULL, gnumeric_atanh },
{ "atan2", "ff", "xnum,ynum", NULL, NULL, gnumeric_atan2 },
/* avedev */
{ "average", 0, "", &help_average, gnumeric_average, NULL },
/* besseli */
/* besselj */
/* besselk */
/* bessely */
{ "bin2dec", "?", "number", NULL, NULL, gnumeric_bin2dec },
{ "cos", "f", "number", NULL, NULL, gnumeric_cos },
{ "cosh", "f", "number", NULL, NULL, gnumeric_cosh },
{ "count", 0, "", NULL, gnumeric_count, NULL },
{ "ceil", "f", "number", NULL, NULL, gnumeric_ceil },
{ "degrees", "f", "number", NULL, NULL, gnumeric_degrees },
{ "exp", "f", "number", NULL, NULL, gnumeric_exp },
{ "fact", "f", "number", NULL, NULL, gnumeric_fact },
{ "floor", "f", "number", NULL, NULL, gnumeric_floor },
{ "int", "f", "number", NULL, NULL, gnumeric_int },
{ "log", "f", "number", NULL, NULL, gnumeric_log },
{ "log2", "f", "number", NULL, NULL, gnumeric_log2 },
{ "log10", "f", "number", NULL, NULL, gnumeric_log10 },
{ "min", 0, "", NULL, gnumeric_min, NULL },
{ "max", 0, "", NULL, gnumeric_max, NULL },
{ "or", 0, "", &help_or, gnumeric_or, NULL },
{ "radians", "f", "number", NULL, NULL, gnumeric_radians },
{ "sin", "f", "number", NULL, NULL, gnumeric_sin },
{ "sinh", "f", "number", NULL, NULL, gnumeric_sinh },
{ "sum", 0, "number", NULL, gnumeric_sum, NULL },
{ "tan", "f", "number", NULL, NULL, gnumeric_tan },
{ "tanh", "f", "number", NULL, NULL, gnumeric_tanh },
{ "pi", "", "", NULL, NULL, gnumeric_pi },
{ "bin2dec", "?", "number", NULL, NULL, gnumeric_bin2dec },
{ "cos", "f", "number", NULL, NULL, gnumeric_cos },
{ "cosh", "f", "number", NULL, NULL, gnumeric_cosh },
{ "count", 0, "", NULL, gnumeric_count, NULL },
{ "ceil", "f", "number", &help_ceil, NULL, gnumeric_ceil },
{ "degrees", "f", "number", NULL, NULL, gnumeric_degrees },
{ "exp", "f", "number", NULL, NULL, gnumeric_exp },
{ "fact", "f", "number", NULL, NULL, gnumeric_fact },
{ "floor", "f", "number", &help_floor,NULL, gnumeric_floor },
{ "int", "f", "number", NULL, NULL, gnumeric_int },
{ "log", "f", "number", NULL, NULL, gnumeric_log },
{ "log2", "f", "number", NULL, NULL, gnumeric_log2 },
{ "log10", "f", "number", NULL, NULL, gnumeric_log10 },
{ "min", 0, "", NULL, gnumeric_min, NULL },
{ "max", 0, "", NULL, gnumeric_max, NULL },
{ "or", 0, "", &help_or, gnumeric_or, NULL },
{ "radians", "f", "number", NULL, NULL, gnumeric_radians },
{ "sin", "f", "number", NULL, NULL, gnumeric_sin },
{ "sinh", "f", "number", NULL, NULL, gnumeric_sinh },
{ "sum", 0, "number", NULL, gnumeric_sum, NULL },
{ "tan", "f", "number", NULL, NULL, gnumeric_tan },
{ "tanh", "f", "number", NULL, NULL, gnumeric_tanh },
{ "pi", "", "", NULL, NULL, gnumeric_pi },
{ NULL, NULL },
};
......@@ -72,7 +72,7 @@ cell_set_alignment (Cell *cell, int halign, int valign, int orient, int auto_ret
cell->style->fit_in_cell = auto_return;
cell_calc_dimensions (cell);
cell_queue_redraw (cell);
}
......@@ -176,7 +176,7 @@ cell_set_text (Cell *cell, char *text)
g_return_if_fail (text != NULL);
cell_queue_redraw (cell);
/* The value entered */
if (cell->entered_text)
string_unref (cell->entered_text);
......@@ -628,9 +628,12 @@ void
cell_calc_dimensions (Cell *cell)
{
char *rendered_text;
int left, right;
g_return_if_fail (cell != NULL);
cell_unregister_span (cell);
if (cell->text){
Style *style = cell->style;
int h, w;
......@@ -650,6 +653,11 @@ cell_calc_dimensions (Cell *cell)
sheet_row_set_internal_height (cell->sheet, cell->row, h);
} else
cell->width = cell->col->margin_a + cell->col->margin_b;
/* Register the span */
cell_get_span (cell, &left, &right);
if (left != right)
cell_register_span (cell, left, right);
}
static void
......@@ -731,7 +739,10 @@ cell_split_text (GdkFont *font, char *text, int width)
return list;
}
void
/*
* Returns the number of columns used for the draw
*/
int
cell_draw (Cell *cell, void *sv, GdkGC *gc, GdkDrawable *drawable, int x1, int y1)
{
Style *style = cell->style;
......@@ -753,8 +764,6 @@ cell_draw (Cell *cell, void *sv, GdkGC *gc, GdkDrawable *drawable, int x1, int y
width = COL_INTERNAL_WIDTH (cell->col);
height = ROW_INTERNAL_HEIGHT (cell->row);
gdk_gc_set_function (gc, GDK_COPY);
font_height = font->ascent + font->descent;
halign = cell_get_horizontal_align (cell);
......@@ -768,7 +777,7 @@ cell_draw (Cell *cell, void *sv, GdkGC *gc, GdkDrawable *drawable, int x1, int y
if (width < cell->width && cell_is_number (cell)){
draw_overflow (drawable, gc, font, x1 + cell->col->margin_a, y1, text_base,
width, height);
return;
return 1;
}
if (halign == HALIGN_JUSTIFY || style->valign == VALIGN_JUSTIFY || style->fit_in_cell)
......@@ -905,5 +914,7 @@ cell_draw (Cell *cell, void *sv, GdkGC *gc, GdkDrawable *drawable, int x1, int y
total += len;
} while (halign == HALIGN_FILL && total < rect.width);
}
return end_col - start_col + 1;
}
......@@ -82,7 +82,7 @@ void cell_formula_changed (Cell *cell);
void cell_queue_redraw (Cell *cell);
int cell_get_horizontal_align (Cell *cell);
void cell_draw (Cell *cell, void *sheet_view,
int cell_draw (Cell *cell, void *sheet_view,
GdkGC *gc, GdkDrawable *drawable,
int x, int y);
......
......@@ -87,12 +87,12 @@ cell_register_span (Cell *cell, int left, int right)
ri = cell->row;
col = cell->col->pos;
for (i = left; i <= right; i++){
int *key;
/* Do not register our column, as we already keep this on the main hash */
if (i != col)
if (i == col)
continue;
key = g_new (int, 1);
......@@ -157,8 +157,8 @@ row_cell_get_displayed_at (ColRowInfo *ri, int col)
Cell *cell;
g_return_val_if_fail (ri != NULL, NULL);
/* Ok, cell was not found, check the registered span regions */
cell = g_hash_table_lookup (ri->data, &col);
return cell;
}
......@@ -834,44 +834,44 @@ gnumeric_pi (Value *argv [], char **error_string)
}
FunctionDefinition math_functions [] = {
{ "abs", "f", "number", NULL, NULL, gnumeric_abs },
{ "acos", "f", "number", NULL, NULL, gnumeric_acos },
{ "acosh", "f", "number", NULL, NULL, gnumeric_acosh },
{ "abs", "f", "number", &help_abs, NULL, gnumeric_abs },
{ "acos", "f", "number", NULL, NULL, gnumeric_acos },
{ "acosh", "f", "number", NULL, NULL, gnumeric_acosh },
{ "and", 0, "", &help_and, gnumeric_and, NULL },
{ "asin", "f", "number", NULL, NULL, gnumeric_asin },
{ "asinh", "f", "number", NULL, NULL, gnumeric_asinh },
{ "atan", "f", "number", NULL, NULL, gnumeric_atan },
{ "atanh", "f", "number", NULL, NULL, gnumeric_atanh },
{ "atan2", "ff", "xnum,ynum", NULL, NULL, gnumeric_atan2 },
{ "asin", "f", "number", NULL, NULL, gnumeric_asin },
{ "asinh", "f", "number", NULL, NULL, gnumeric_asinh },
{ "atan", "f", "number", NULL, NULL, gnumeric_atan },
{ "atanh", "f", "number", NULL, NULL, gnumeric_atanh },
{ "atan2", "ff", "xnum,ynum", NULL, NULL, gnumeric_atan2 },
/* avedev */
{ "average", 0, "", &help_average, gnumeric_average, NULL },
/* besseli */
/* besselj */
/* besselk */
/* bessely */
{ "bin2dec", "?", "number", NULL, NULL, gnumeric_bin2dec },
{ "cos", "f", "number", NULL, NULL, gnumeric_cos },
{ "cosh", "f", "number", NULL, NULL, gnumeric_cosh },
{ "count", 0, "", NULL, gnumeric_count, NULL },
{ "ceil", "f", "number", NULL, NULL, gnumeric_ceil },
{ "degrees", "f", "number", NULL, NULL, gnumeric_degrees },
{ "exp", "f", "number", NULL, NULL, gnumeric_exp },
{ "fact", "f", "number", NULL, NULL, gnumeric_fact },
{ "floor", "f", "number", NULL, NULL, gnumeric_floor },
{ "int", "f", "number", NULL, NULL, gnumeric_int },
{ "log", "f", "number", NULL, NULL, gnumeric_log },
{ "log2", "f", "number", NULL, NULL, gnumeric_log2 },
{ "log10", "f", "number", NULL, NULL, gnumeric_log10 },
{ "min", 0, "", NULL, gnumeric_min, NULL },
{ "max", 0, "", NULL, gnumeric_max, NULL },
{ "or", 0, "", &help_or, gnumeric_or, NULL },
{ "radians", "f", "number", NULL, NULL, gnumeric_radians },
{ "sin", "f", "number", NULL, NULL, gnumeric_sin },
{ "sinh", "f", "number", NULL, NULL, gnumeric_sinh },
{ "sum", 0, "number", NULL, gnumeric_sum, NULL },
{ "tan", "f", "number", NULL, NULL, gnumeric_tan },
{ "tanh", "f", "number", NULL, NULL, gnumeric_tanh },
{ "pi", "", "", NULL, NULL, gnumeric_pi },
{ "bin2dec", "?", "number", NULL, NULL, gnumeric_bin2dec },
{ "cos", "f", "number", NULL, NULL, gnumeric_cos },
{ "cosh", "f", "number", NULL, NULL, gnumeric_cosh },
{ "count", 0, "", NULL, gnumeric_count, NULL },
{ "ceil", "f", "number", &help_ceil, NULL, gnumeric_ceil },
{ "degrees", "f", "number", NULL, NULL, gnumeric_degrees },
{ "exp", "f", "number", NULL, NULL, gnumeric_exp },
{ "fact", "f", "number", NULL, NULL, gnumeric_fact },
{ "floor", "f", "number", &help_floor,NULL, gnumeric_floor },
{ "int", "f", "number", NULL, NULL, gnumeric_int },
{ "log", "f", "number", NULL, NULL, gnumeric_log },
{ "log2", "f", "number", NULL, NULL, gnumeric_log2 },
{ "log10", "f", "number", NULL, NULL, gnumeric_log10 },
{ "min", 0, "", NULL, gnumeric_min, NULL },
{ "max", 0, "", NULL, gnumeric_max, NULL },
{ "or", 0, "", &help_or, gnumeric_or, NULL },
{ "radians", "f", "number", NULL, NULL, gnumeric_radians },
{ "sin", "f", "number", NULL, NULL, gnumeric_sin },
{ "sinh", "f", "number", NULL, NULL, gnumeric_sinh },
{ "sum", 0, "number", NULL, gnumeric_sum, NULL },
{ "tan", "f", "number", NULL, NULL, gnumeric_tan },
{ "tanh", "f", "number", NULL, NULL, gnumeric_tanh },
{ "pi", "", "", NULL, NULL, gnumeric_pi },
{ NULL, NULL },
};
......@@ -834,44 +834,44 @@ gnumeric_pi (Value *argv [], char **error_string)
}
FunctionDefinition math_functions [] = {
{ "abs", "f", "number", NULL, NULL, gnumeric_abs },
{ "acos", "f", "number", NULL, NULL, gnumeric_acos },
{ "acosh", "f", "number", NULL, NULL, gnumeric_acosh },
{ "abs", "f", "number", &help_abs, NULL, gnumeric_abs },
{ "acos", "f", "number", NULL, NULL, gnumeric_acos },
{ "acosh", "f", "number", NULL, NULL, gnumeric_acosh },
{ "and", 0, "", &help_and, gnumeric_and, NULL },
{ "asin", "f", "number", NULL, NULL, gnumeric_asin },
{ "asinh", "f", "number", NULL, NULL, gnumeric_asinh },
{ "atan", "f", "number", NULL, NULL, gnumeric_atan },
{ "atanh", "f", "number", NULL, NULL, gnumeric_atanh },
{ "atan2", "ff", "xnum,ynum", NULL, NULL, gnumeric_atan2 },
{ "asin", "f", "number", NULL, NULL, gnumeric_asin },
{ "asinh", "f", "number", NULL, NULL, gnumeric_asinh },
{ "atan", "f", "number", NULL, NULL, gnumeric_atan },
{ "atanh", "f", "number", NULL, NULL, gnumeric_atanh },
{ "atan2", "ff", "xnum,ynum", NULL, NULL, gnumeric_atan2 },
/* avedev */
{ "average", 0, "", &help_average, gnumeric_average, NULL },
/* besseli */
/* besselj */
/* besselk */
/* bessely */
{ "bin2dec", "?", "number", NULL, NULL, gnumeric_bin2dec },
{ "cos", "f", "number", NULL, NULL, gnumeric_cos },
{ "cosh", "f", "number", NULL, NULL, gnumeric_cosh },
{ "count", 0, "", NULL, gnumeric_count, NULL },
{ "ceil", "f", "number", NULL, NULL, gnumeric_ceil },
{ "degrees", "f", "number", NULL, NULL, gnumeric_degrees },
{ "exp", "f", "number", NULL, NULL, gnumeric_exp },
{ "fact", "f", "number", NULL, NULL, gnumeric_fact },
{ "floor", "f", "number", NULL, NULL, gnumeric_floor },
{ "int", "f", "number", NULL, NULL, gnumeric_int },
{ "log", "f", "number", NULL, NULL, gnumeric_log },
{ "log2", "f", "number", NULL, NULL, gnumeric_log2 },
{ "log10", "f", "number", NULL, NULL, gnumeric_log10 },
{ "min", 0, "", NULL, gnumeric_min, NULL },
{ "max", 0, "", NULL, gnumeric_max, NULL },
{ "or", 0, "", &help_or, gnumeric_or, NULL },
{ "radians", "f", "number", NULL, NULL, gnumeric_radians },
{ "sin", "f", "number", NULL, NULL, gnumeric_sin },
{ "sinh", "f", "number", NULL, NULL, gnumeric_sinh },
{ "sum", 0, "number", NULL, gnumeric_sum, NULL },
{ "tan", "f", "number", NULL, NULL, gnumeric_tan },
{ "tanh", "f", "number", NULL, NULL, gnumeric_tanh },
{ "pi", "", "", NULL, NULL, gnumeric_pi },
{ "bin2dec", "?", "number", NULL, NULL, gnumeric_bin2dec },
{ "cos", "f", "number", NULL, NULL, gnumeric_cos },
{ "cosh", "f", "number", NULL, NULL, gnumeric_cosh },
{ "count", 0, "", NULL, gnumeric_count, NULL },
{ "ceil", "f", "number", &help_ceil, NULL, gnumeric_ceil },
{ "degrees", "f", "number", NULL, NULL, gnumeric_degrees },
{ "exp", "f", "number", NULL, NULL, gnumeric_exp },
{ "fact", "f", "number", NULL, NULL, gnumeric_fact },
{ "floor", "f", "number", &help_floor,NULL, gnumeric_floor },
{ "int", "f", "number", NULL, NULL, gnumeric_int },
{ "log", "f", "number", NULL, NULL, gnumeric_log },
{ "log2", "f", "number", NULL, NULL, gnumeric_log2 },
{ "log10", "f", "number", NULL, NULL, gnumeric_log10 },
{ "min", 0, "", NULL, gnumeric_min, NULL },
{ "max", 0, "", NULL, gnumeric_max, NULL },
{ "or", 0, "", &help_or, gnumeric_or, NULL },
{ "radians", "f", "number", NULL, NULL, gnumeric_radians },
{ "sin", "f", "number", NULL, NULL, gnumeric_sin },
{ "sinh", "f", "number", NULL, NULL, gnumeric_sinh },
{ "sum", 0, "number", NULL, gnumeric_sum, NULL },
{ "tan", "f", "number", NULL, NULL, gnumeric_tan },
{ "tanh", "f", "number", NULL, NULL, gnumeric_tanh },
{ "pi", "", "", NULL, NULL, gnumeric_pi },
{ NULL, NULL },
};
......@@ -153,79 +153,58 @@ item_grid_find_row (ItemGrid *item_grid, int y, int *row_origin)
} while (1);
}
typedef struct {
ItemGrid *item_grid;
GdkDrawable *drawable;
GnumericSheet *gsheet;
int x_paint; /* the offsets */
int y_paint;
} paint_data;
/*
* Sets the gc appropiately for inverting the color of a region
* in the ItemGrid.
*
* We are mainly interested in getting accurrated black/white
* inversion.
*
* On palleted displays, we play the trick of XORing the value
* (this will render other colors sometimes randomly, depending on the
* pallette contents). On non-palleted displays, we can use the
* GDK_INVERT operation to invert the pixel value.
*/
static void
item_grid_invert_gc (ItemGrid *item_grid)
{
GdkGC *gc;
gc = item_grid->gc;
gdk_gc_set_clip_rectangle (gc, NULL);
if (item_grid->visual_is_paletted){
gdk_gc_set_function (gc, GDK_XOR);
gdk_gc_set_foreground (gc, &gs_white);
} else {
gdk_gc_set_function (gc, GDK_INVERT);
gdk_gc_set_foreground (gc, &gs_black);
}
}
/*
* Draw a cell. It gets pixel level coordinates
*
* Returns the number of columns used by the cell.
*/
static void
item_grid_draw_cell (GdkDrawable *drawable, ItemGrid *item_grid, Cell *cell,
int x1, int y1, ColRowInfo *ci, ColRowInfo *ri, int col, int row)
static int
item_grid_draw_cell (GdkDrawable *drawable, ItemGrid *item_grid, Cell *cell, int x1, int y1)
{
GnomeCanvas *canvas = GNOME_CANVAS_ITEM (item_grid)->canvas;
GdkGC *gc = item_grid->gc;
Sheet *sheet = item_grid->sheet;
int cell_is_selected;
int width = ci->pixels;
int height = ri->pixels;
int count;
cell_is_selected = sheet_selection_is_cell_selected (sheet, col, row);
#if 0
/* Debugging code for testing the stipples */
gdk_gc_set_stipple (gc, GNUMERIC_SHEET (canvas)->patterns [col % 8]);
gdk_gc_set_foreground (gc, &gs_black);
gdk_gc_set_background (gc, &gs_white);
gdk_gc_set_fill (gc, GDK_STIPPLED);
gdk_draw_rectangle (drawable, gc, TRUE,
x1+1, y1+1, width-2, height-2);
#endif
/*
* If the cell does not exist, there is little to do: only
* check if we should paint it as a selected cell
*/
if (!cell){
if (cell_is_selected){
GdkGC *black_gc = GTK_WIDGET (canvas)->style->black_gc;
if (!(sheet->cursor_col == col && sheet->cursor_row == row))
gdk_draw_rectangle (drawable, black_gc, TRUE,
x1+1, y1+1, width - 2, height - 2);
}
return;
}
gdk_gc_set_foreground (gc, &item_grid->default_color);
cell_draw (cell, item_grid->sheet_view, gc, drawable, x1, y1);
/*
* If the cell is selected, turn the inverse video on
*/
if (cell_is_selected){
if (sheet->cursor_col == col && sheet->cursor_row == row)
return;
if (item_grid->visual_is_paletted){
gdk_gc_set_function (gc, GDK_XOR);
gdk_gc_set_foreground (gc, &gs_white);
} else {
gdk_gc_set_function (gc, GDK_INVERT);
gdk_gc_set_foreground (gc, &gs_black);
}
gdk_draw_rectangle (drawable, gc, TRUE,
x1 + 1,
y1 + 1,
width - 1, height - 1);
}
count = cell_draw (cell, item_grid->sheet_view, gc, drawable, x1, y1);
return count;
}
static void
......@@ -238,9 +217,8 @@ item_grid_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int
int end_x, end_y;
int paint_col, paint_row, max_paint_col, max_paint_row;
int col, row;
int x_paint, y_paint;
int x_paint, y_paint, real_x;
int diff_x, diff_y;
paint_data pd;
if (x < 0){
g_warning ("x < 0\n");
......@@ -290,44 +268,115 @@ item_grid_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int
max_paint_row = row;
}
/* The cells */
pd.x_paint = -diff_x;
pd.y_paint = -diff_y;
pd.drawable = drawable;
pd.item_grid = item_grid;
pd.gsheet = GNUMERIC_SHEET (item->canvas);
gdk_gc_set_function (item_grid->gc, GDK_COPY);
#if 0
printf ("Painting the (%d,%d)-(%d,%d) region\n",
paint_col, paint_row, max_paint_col, max_paint_row);
#endif
row = paint_row;
for (y_paint = -diff_y; y_paint < end_y; row++){
ColRowInfo *ri;
ri = sheet_row_get_info (sheet, row);
col = paint_col;
for (x_paint = -diff_x; x_paint < end_x; col++){
ColRowInfo *ci;
ci = sheet_col_get_info (sheet, col);
cell = sheet_cell_get (sheet, col, row);
item_grid_draw_cell (drawable, item_grid, cell,
x_paint, y_paint,
ci,
ri,
col, row);
if (cell){
item_grid_draw_cell (drawable, item_grid, cell,
x_paint, y_paint);
} else if (ri->pos != -1){
/*
* If there was no cell, and the row has any cell allocated
* (indicated by ri->pos != -1)
*/
real_x = x_paint;
cell = row_cell_get_displayed_at (ri, col);
/*
* We found the cell that paints over this
* cell, adjust x to point to the beginning
* of that cell.
*/
if (cell){
int i, count, end_col;
/*
* Either adjust the left part
*/
for (i = cell->col->pos; i < col; i++){
ColRowInfo *tci;
tci = sheet_col_get_info (sheet, i);
real_x -= tci->pixels;
}
/*
* Or adjust the right part
*/
for (i = col; i < cell->col->pos; i++){