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> 1998-09-03 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/utils.c (int_get_from_range): Bug fix, we were not doing the * 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> 1998-09-03 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/utils.c (int_get_from_range): Bug fix, we were not doing the * 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> 1998-09-03 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/utils.c (int_get_from_range): Bug fix, we were not doing the * 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> 1998-09-03 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/utils.c (int_get_from_range): Bug fix, we were not doing the * src/utils.c (int_get_from_range): Bug fix, we were not doing the
......
...@@ -137,6 +137,14 @@ ...@@ -137,6 +137,14 @@
<para>Cells are stored in a hash table inside the Sheet data <para>Cells are stored in a hash table inside the Sheet data
structure for quick retrieval and they are also linked properly in structure for quick retrieval and they are also linked properly in
their respective columns. </para> 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>
<sect1> <sect1>
......
...@@ -137,6 +137,14 @@ ...@@ -137,6 +137,14 @@
<para>Cells are stored in a hash table inside the Sheet data <para>Cells are stored in a hash table inside the Sheet data
structure for quick retrieval and they are also linked properly in structure for quick retrieval and they are also linked properly in
their respective columns. </para> 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>
<sect1> <sect1>
......
...@@ -834,44 +834,44 @@ gnumeric_pi (Value *argv [], char **error_string) ...@@ -834,44 +834,44 @@ gnumeric_pi (Value *argv [], char **error_string)
} }
FunctionDefinition math_functions [] = { FunctionDefinition math_functions [] = {
{ "abs", "f", "number", NULL, NULL, gnumeric_abs }, { "abs", "f", "number", &help_abs, NULL, gnumeric_abs },
{ "acos", "f", "number", NULL, NULL, gnumeric_acos }, { "acos", "f", "number", NULL, NULL, gnumeric_acos },
{ "acosh", "f", "number", NULL, NULL, gnumeric_acosh }, { "acosh", "f", "number", NULL, NULL, gnumeric_acosh },
{ "and", 0, "", &help_and, gnumeric_and, NULL }, { "and", 0, "", &help_and, gnumeric_and, NULL },
{ "asin", "f", "number", NULL, NULL, gnumeric_asin }, { "asin", "f", "number", NULL, NULL, gnumeric_asin },
{ "asinh", "f", "number", NULL, NULL, gnumeric_asinh }, { "asinh", "f", "number", NULL, NULL, gnumeric_asinh },
{ "atan", "f", "number", NULL, NULL, gnumeric_atan }, { "atan", "f", "number", NULL, NULL, gnumeric_atan },
{ "atanh", "f", "number", NULL, NULL, gnumeric_atanh }, { "atanh", "f", "number", NULL, NULL, gnumeric_atanh },
{ "atan2", "ff", "xnum,ynum", NULL, NULL, gnumeric_atan2 }, { "atan2", "ff", "xnum,ynum", NULL, NULL, gnumeric_atan2 },
/* avedev */ /* avedev */
{ "average", 0, "", &help_average, gnumeric_average, NULL }, { "average", 0, "", &help_average, gnumeric_average, NULL },
/* besseli */ /* besseli */
/* besselj */ /* besselj */
/* besselk */ /* besselk */
/* bessely */ /* bessely */
{ "bin2dec", "?", "number", NULL, NULL, gnumeric_bin2dec }, { "bin2dec", "?", "number", NULL, NULL, gnumeric_bin2dec },
{ "cos", "f", "number", NULL, NULL, gnumeric_cos }, { "cos", "f", "number", NULL, NULL, gnumeric_cos },
{ "cosh", "f", "number", NULL, NULL, gnumeric_cosh }, { "cosh", "f", "number", NULL, NULL, gnumeric_cosh },
{ "count", 0, "", NULL, gnumeric_count, NULL }, { "count", 0, "", NULL, gnumeric_count, NULL },
{ "ceil", "f", "number", NULL, NULL, gnumeric_ceil }, { "ceil", "f", "number", &help_ceil, NULL, gnumeric_ceil },
{ "degrees", "f", "number", NULL, NULL, gnumeric_degrees }, { "degrees", "f", "number", NULL, NULL, gnumeric_degrees },
{ "exp", "f", "number", NULL, NULL, gnumeric_exp }, { "exp", "f", "number", NULL, NULL, gnumeric_exp },
{ "fact", "f", "number", NULL, NULL, gnumeric_fact }, { "fact", "f", "number", NULL, NULL, gnumeric_fact },
{ "floor", "f", "number", NULL, NULL, gnumeric_floor }, { "floor", "f", "number", &help_floor,NULL, gnumeric_floor },
{ "int", "f", "number", NULL, NULL, gnumeric_int }, { "int", "f", "number", NULL, NULL, gnumeric_int },
{ "log", "f", "number", NULL, NULL, gnumeric_log }, { "log", "f", "number", NULL, NULL, gnumeric_log },
{ "log2", "f", "number", NULL, NULL, gnumeric_log2 }, { "log2", "f", "number", NULL, NULL, gnumeric_log2 },
{ "log10", "f", "number", NULL, NULL, gnumeric_log10 }, { "log10", "f", "number", NULL, NULL, gnumeric_log10 },
{ "min", 0, "", NULL, gnumeric_min, NULL }, { "min", 0, "", NULL, gnumeric_min, NULL },
{ "max", 0, "", NULL, gnumeric_max, NULL }, { "max", 0, "", NULL, gnumeric_max, NULL },
{ "or", 0, "", &help_or, gnumeric_or, NULL }, { "or", 0, "", &help_or, gnumeric_or, NULL },
{ "radians", "f", "number", NULL, NULL, gnumeric_radians }, { "radians", "f", "number", NULL, NULL, gnumeric_radians },
{ "sin", "f", "number", NULL, NULL, gnumeric_sin }, { "sin", "f", "number", NULL, NULL, gnumeric_sin },
{ "sinh", "f", "number", NULL, NULL, gnumeric_sinh }, { "sinh", "f", "number", NULL, NULL, gnumeric_sinh },
{ "sum", 0, "number", NULL, gnumeric_sum, NULL }, { "sum", 0, "number", NULL, gnumeric_sum, NULL },
{ "tan", "f", "number", NULL, NULL, gnumeric_tan }, { "tan", "f", "number", NULL, NULL, gnumeric_tan },
{ "tanh", "f", "number", NULL, NULL, gnumeric_tanh }, { "tanh", "f", "number", NULL, NULL, gnumeric_tanh },
{ "pi", "", "", NULL, NULL, gnumeric_pi }, { "pi", "", "", NULL, NULL, gnumeric_pi },
{ NULL, NULL }, { NULL, NULL },
}; };
...@@ -72,7 +72,7 @@ cell_set_alignment (Cell *cell, int halign, int valign, int orient, int auto_ret ...@@ -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->style->fit_in_cell = auto_return;
cell_calc_dimensions (cell); cell_calc_dimensions (cell);
cell_queue_redraw (cell); cell_queue_redraw (cell);
} }
...@@ -176,7 +176,7 @@ cell_set_text (Cell *cell, char *text) ...@@ -176,7 +176,7 @@ cell_set_text (Cell *cell, char *text)
g_return_if_fail (text != NULL); g_return_if_fail (text != NULL);
cell_queue_redraw (cell); cell_queue_redraw (cell);
/* The value entered */ /* The value entered */
if (cell->entered_text) if (cell->entered_text)
string_unref (cell->entered_text); string_unref (cell->entered_text);
...@@ -628,9 +628,12 @@ void ...@@ -628,9 +628,12 @@ void
cell_calc_dimensions (Cell *cell) cell_calc_dimensions (Cell *cell)
{ {
char *rendered_text; char *rendered_text;
int left, right;
g_return_if_fail (cell != NULL); g_return_if_fail (cell != NULL);
cell_unregister_span (cell);
if (cell->text){ if (cell->text){
Style *style = cell->style; Style *style = cell->style;
int h, w; int h, w;
...@@ -650,6 +653,11 @@ cell_calc_dimensions (Cell *cell) ...@@ -650,6 +653,11 @@ cell_calc_dimensions (Cell *cell)
sheet_row_set_internal_height (cell->sheet, cell->row, h); sheet_row_set_internal_height (cell->sheet, cell->row, h);
} else } else
cell->width = cell->col->margin_a + cell->col->margin_b; 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 static void
...@@ -731,7 +739,10 @@ cell_split_text (GdkFont *font, char *text, int width) ...@@ -731,7 +739,10 @@ cell_split_text (GdkFont *font, char *text, int width)
return list; 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) cell_draw (Cell *cell, void *sv, GdkGC *gc, GdkDrawable *drawable, int x1, int y1)
{ {
Style *style = cell->style; Style *style = cell->style;
...@@ -753,8 +764,6 @@ cell_draw (Cell *cell, void *sv, GdkGC *gc, GdkDrawable *drawable, int x1, int y ...@@ -753,8 +764,6 @@ cell_draw (Cell *cell, void *sv, GdkGC *gc, GdkDrawable *drawable, int x1, int y
width = COL_INTERNAL_WIDTH (cell->col); width = COL_INTERNAL_WIDTH (cell->col);
height = ROW_INTERNAL_HEIGHT (cell->row); height = ROW_INTERNAL_HEIGHT (cell->row);
gdk_gc_set_function (gc, GDK_COPY);
font_height = font->ascent + font->descent; font_height = font->ascent + font->descent;
halign = cell_get_horizontal_align (cell); halign = cell_get_horizontal_align (cell);
...@@ -768,7 +777,7 @@ cell_draw (Cell *cell, void *sv, GdkGC *gc, GdkDrawable *drawable, int x1, int y ...@@ -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)){ if (width < cell->width && cell_is_number (cell)){
draw_overflow (drawable, gc, font, x1 + cell->col->margin_a, y1, text_base, draw_overflow (drawable, gc, font, x1 + cell->col->margin_a, y1, text_base,
width, height); width, height);
return; return 1;
} }
if (halign == HALIGN_JUSTIFY || style->valign == VALIGN_JUSTIFY || style->fit_in_cell) 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 ...@@ -905,5 +914,7 @@ cell_draw (Cell *cell, void *sv, GdkGC *gc, GdkDrawable *drawable, int x1, int y
total += len; total += len;
} while (halign == HALIGN_FILL && total < rect.width); } while (halign == HALIGN_FILL && total < rect.width);
} }
return end_col - start_col + 1;
} }
...@@ -82,7 +82,7 @@ void cell_formula_changed (Cell *cell); ...@@ -82,7 +82,7 @@ void cell_formula_changed (Cell *cell);
void cell_queue_redraw (Cell *cell); void cell_queue_redraw (Cell *cell);
int cell_get_horizontal_align (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, GdkGC *gc, GdkDrawable *drawable,
int x, int y); int x, int y);
......
...@@ -87,12 +87,12 @@ cell_register_span (Cell *cell, int left, int right) ...@@ -87,12 +87,12 @@ cell_register_span (Cell *cell, int left, int right)
ri = cell->row; ri = cell->row;
col = cell->col->pos; col = cell->col->pos;
for (i = left; i <= right; i++){ for (i = left; i <= right; i++){
int *key; int *key;
/* Do not register our column, as we already keep this on the main hash */ /* Do not register our column, as we already keep this on the main hash */
if (i != col) if (i == col)
continue; continue;
key = g_new (int, 1); key = g_new (int, 1);
...@@ -157,8 +157,8 @@ row_cell_get_displayed_at (ColRowInfo *ri, int col) ...@@ -157,8 +157,8 @@ row_cell_get_displayed_at (ColRowInfo *ri, int col)
Cell *cell; Cell *cell;
g_return_val_if_fail (ri != NULL, NULL); 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); cell = g_hash_table_lookup (ri->data, &col);
return cell; return cell;
} }
...@@ -834,44 +834,44 @@ gnumeric_pi (Value *argv [], char **error_string) ...@@ -834,44 +834,44 @@ gnumeric_pi (Value *argv [], char **error_string)
} }
FunctionDefinition math_functions [] = { FunctionDefinition math_functions [] = {
{ "abs", "f", "number", NULL, NULL, gnumeric_abs }, { "abs", "f", "number", &help_abs, NULL, gnumeric_abs },
{ "acos", "f", "number", NULL, NULL, gnumeric_acos }, { "acos", "f", "number", NULL, NULL, gnumeric_acos },
{ "acosh", "f", "number", NULL, NULL, gnumeric_acosh }, { "acosh", "f", "number", NULL, NULL, gnumeric_acosh },
{ "and", 0, "", &help_and, gnumeric_and, NULL }, { "and", 0, "", &help_and, gnumeric_and, NULL },
{ "asin", "f", "number", NULL, NULL, gnumeric_asin }, { "asin", "f", "number", NULL, NULL, gnumeric_asin },
{ "asinh", "f", "number", NULL, NULL, gnumeric_asinh }, { "asinh", "f", "number", NULL, NULL, gnumeric_asinh },
{ "atan", "f", "number", NULL, NULL, gnumeric_atan }, { "atan", "f", "number", NULL, NULL, gnumeric_atan },
{ "atanh", "f", "number", NULL, NULL, gnumeric_atanh }, { "atanh", "f", "number", NULL, NULL, gnumeric_atanh },
{ "atan2", "ff", "xnum,ynum", NULL, NULL, gnumeric_atan2 }, { "atan2", "ff", "xnum,ynum", NULL, NULL, gnumeric_atan2 },
/* avedev */ /* avedev */
{ "average", 0, "", &help_average, gnumeric_average, NULL }, { "average", 0, "", &help_average, gnumeric_average, NULL },
/* besseli */ /* besseli */
/* besselj */ /* besselj */
/* besselk */ /* besselk */
/* bessely */ /* bessely */
{ "bin2dec", "?", "number", NULL, NULL, gnumeric_bin2dec }, { "bin2dec", "?", "number", NULL, NULL, gnumeric_bin2dec },
{ "cos", "f", "number", NULL, NULL, gnumeric_cos }, { "cos", "f", "number", NULL, NULL, gnumeric_cos },
{ "cosh", "f", "number", NULL, NULL, gnumeric_cosh }, { "cosh", "f", "number", NULL, NULL, gnumeric_cosh },
{ "count", 0, "", NULL, gnumeric_count, NULL }, { "count", 0, "", NULL, gnumeric_count, NULL },
{ "ceil", "f", "number", NULL, NULL, gnumeric_ceil }, { "ceil", "f", "number", &help_ceil, NULL, gnumeric_ceil },
{ "degrees", "f", "number", NULL, NULL, gnumeric_degrees }, { "degrees", "f", "number", NULL, NULL, gnumeric_degrees },
{ "exp", "f", "number", NULL, NULL, gnumeric_exp }, { "exp", "f", "number", NULL, NULL, gnumeric_exp },
{ "fact", "f", "number", NULL, NULL, gnumeric_fact }, { "fact", "f", "number", NULL, NULL, gnumeric_fact },
{ "floor", "f", "number", NULL, NULL, gnumeric_floor }, { "floor", "f", "number", &help_floor,NULL, gnumeric_floor },
{ "int", "f", "number", NULL, NULL, gnumeric_int }, { "int", "f", "number", NULL, NULL, gnumeric_int },
{ "log", "f", "number", NULL, NULL, gnumeric_log }, { "log", "f", "number", NULL, NULL, gnumeric_log },
{ "log2", "f", "number", NULL, NULL, gnumeric_log2 }, { "log2", "f", "number", NULL, NULL, gnumeric_log2 },
{ "log10", "f", "number", NULL, NULL, gnumeric_log10 }, { "log10", "f", "number", NULL, NULL, gnumeric_log10 },
{ "min", 0, "", NULL, gnumeric_min, NULL }, { "min", 0, "", NULL, gnumeric_min, NULL },
{ "max", 0, "", NULL, gnumeric_max, NULL }, { "max", 0, "", NULL, gnumeric_max, NULL },
{ "or", 0, "", &help_or, gnumeric_or, NULL }, { "or", 0, "", &help_or, gnumeric_or, NULL },
{ "radians", "f", "number", NULL, NULL, gnumeric_radians }, { "radians", "f", "number", NULL, NULL, gnumeric_radians },
{ "sin", "f", "number", NULL, NULL, gnumeric_sin }, { "sin", "f", "number", NULL, NULL, gnumeric_sin },
{ "sinh", "f", "number", NULL, NULL, gnumeric_sinh }, { "sinh", "f", "number", NULL, NULL, gnumeric_sinh },
{ "sum", 0, "number", NULL, gnumeric_sum, NULL }, { "sum", 0, "number", NULL, gnumeric_sum, NULL },
{ "tan", "f", "number", NULL, NULL, gnumeric_tan }, { "tan", "f", "number", NULL, NULL, gnumeric_tan },
{ "tanh", "f", "number", NULL, NULL, gnumeric_tanh }, { "tanh", "f", "number", NULL, NULL, gnumeric_tanh },
{ "pi", "", "", NULL, NULL, gnumeric_pi }, { "pi", "", "", NULL, NULL, gnumeric_pi },
{ NULL, NULL }, { NULL, NULL },
}; };
...@@ -834,44 +834,44 @@ gnumeric_pi (Value *argv [], char **error_string) ...@@ -834,44 +834,44 @@ gnumeric_pi (Value *argv [], char **error_string)
} }
FunctionDefinition math_functions [] = { FunctionDefinition math_functions [] = {
{ "abs", "f", "number", NULL, NULL, gnumeric_abs }, { "abs", "f", "number", &help_abs, NULL, gnumeric_abs },
{ "acos", "f", "number", NULL, NULL, gnumeric_acos }, { "acos", "f", "number", NULL, NULL, gnumeric_acos },
{ "acosh", "f", "number", NULL, NULL, gnumeric_acosh }, { "acosh", "f", "number", NULL, NULL, gnumeric_acosh },
{ "and", 0, "", &help_and, gnumeric_and, NULL }, { "and", 0, "", &help_and, gnumeric_and, NULL },
{ "asin", "f", "number", NULL, NULL, gnumeric_asin }, { "asin", "f", "number", NULL, NULL, gnumeric_asin },
{ "asinh", "f", "number", NULL, NULL, gnumeric_asinh }, { "asinh", "f", "number", NULL, NULL, gnumeric_asinh },
{ "atan", "f", "number", NULL, NULL, gnumeric_atan }, { "atan", "f", "number", NULL, NULL, gnumeric_atan },
{ "atanh", "f", "number", NULL, NULL, gnumeric_atanh }, { "atanh", "f", "number", NULL, NULL, gnumeric_atanh },
{ "atan2", "ff", "xnum,ynum", NULL, NULL, gnumeric_atan2 }, { "atan2", "ff", "xnum,ynum", NULL, NULL, gnumeric_atan2 },
/* avedev */ /* avedev */
{ "average", 0, "", &help_average, gnumeric_average, NULL }, { "average", 0, "", &help_average, gnumeric_average, NULL },
/* besseli */ /* besseli */
/* besselj */ /* besselj */
/* besselk */ /* besselk */
/* bessely */ /* bessely */
{ "bin2dec", "?", "number", NULL, NULL, gnumeric_bin2dec }, { "bin2dec", "?", "number", NULL, NULL, gnumeric_bin2dec },
{ "cos", "f", "number", NULL, NULL, gnumeric_cos }, { "cos", "f", "number", NULL, NULL, gnumeric_cos },
{ "cosh", "f", "number", NULL, NULL, gnumeric_cosh }, { "cosh", "f", "number", NULL, NULL, gnumeric_cosh },
{ "count", 0, "", NULL, gnumeric_count, NULL }, { "count", 0, "", NULL, gnumeric_count, NULL },
{ "ceil", "f", "number", NULL, NULL, gnumeric_ceil }, { "ceil", "f", "number", &help_ceil, NULL, gnumeric_ceil },
{ "degrees", "f", "number", NULL, NULL, gnumeric_degrees }, { "degrees", "f", "number", NULL, NULL, gnumeric_degrees },
{ "exp", "f", "number", NULL, NULL, gnumeric_exp }, { "exp", "f", "number", NULL, NULL, gnumeric_exp },
{ "fact", "f", "number", NULL, NULL, gnumeric_fact }, { "fact", "f", "number", NULL, NULL, gnumeric_fact },
{ "floor", "f", "number", NULL, NULL, gnumeric_floor }, { "floor", "f", "number", &help_floor,NULL, gnumeric_floor },
{ "int", "f", "number", NULL, NULL, gnumeric_int }, { "int", "f", "number", NULL, NULL, gnumeric_int },
{ "log", "f", "number", NULL, NULL, gnumeric_log }, { "log", "f", "number", NULL, NULL, gnumeric_log },
{ "log2", "f", "number", NULL, NULL, gnumeric_log2 }, { "log2", "f", "number", NULL, NULL, gnumeric_log2 },
{ "log10", "f", "number", NULL, NULL, gnumeric_log10 }, { "log10", "f", "number", NULL, NULL, gnumeric_log10 },
{ "min", 0, "", NULL, gnumeric_min, NULL }, { "min", 0, "", NULL, gnumeric_min, NULL },
{ "max", 0, "", NULL, gnumeric_max, NULL }, { "max", 0, "", NULL, gnumeric_max, NULL },
{ "or", 0, "", &help_or, gnumeric_or, NULL }, { "or", 0, "", &help_or, gnumeric_or, NULL },
{ "radians", "f", "number", NULL, NULL, gnumeric_radians }, { "radians", "f", "number", NULL, NULL, gnumeric_radians },
{ "sin", "f", "number", NULL, NULL, gnumeric_sin }, { "sin", "f", "number", NULL, NULL, gnumeric_sin },
{ "sinh", "f", "number", NULL, NULL, gnumeric_sinh }, { "sinh", "f", "number", NULL, NULL, gnumeric_sinh },
{ "sum", 0, "number", NULL, gnumeric_sum, NULL }, { "sum", 0, "number", NULL, gnumeric_sum, NULL },
{ "tan", "f", "number", NULL, NULL, gnumeric_tan }, { "tan", "f", "number", NULL, NULL, gnumeric_tan },
{ "tanh", "f", "number", NULL, NULL, gnumeric_tanh }, { "tanh", "f", "number", NULL, NULL, gnumeric_tanh },
{ "pi", "", "", NULL, NULL, gnumeric_pi }, { "pi", "", "", NULL, NULL, gnumeric_pi },
{ NULL, NULL }, { NULL, NULL },
}; };
...@@ -153,79 +153,58 @@ item_grid_find_row (ItemGrid *item_grid, int y, int *row_origin) ...@@ -153,79 +153,58 @@ item_grid_find_row (ItemGrid *item_grid, int y, int *row_origin)
} while (1); } while (1);
} }
typedef struct { /*
ItemGrid *item_grid; * Sets the gc appropiately for inverting the color of a region
GdkDrawable *drawable; * in the ItemGrid.
GnumericSheet *gsheet; *
int x_paint; /* the offsets */ * We are mainly interested in getting accurrated black/white
int y_paint; * inversion.
} paint_data; *
* 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 * Draw a cell. It gets pixel level coordinates
*
* Returns the number of columns used by the cell.
*/ */
static void static int
item_grid_draw_cell (GdkDrawable *drawable, ItemGrid *item_grid, Cell *cell, item_grid_draw_cell (GdkDrawable *drawable, ItemGrid *item_grid, Cell *cell, int x1, int y1)
int x1, int y1, ColRowInfo *ci, ColRowInfo *ri, int col, int row)
{ {
GnomeCanvas *canvas = GNOME_CANVAS_ITEM (item_grid)->canvas;
GdkGC *gc = item_grid->gc; GdkGC *gc = item_grid->gc;
Sheet *sheet = item_grid->sheet; int count;
int cell_is_selected;
int width = ci->pixels;
int height = ri->pixels;
cell_is_selected = sheet_selection_is_cell_selected (sheet, col, row);
#if 0 #if 0
/* Debugging code for testing the stipples */ /* Debugging code for testing the stipples */
gdk_gc_set_stipple (gc, GNUMERIC_SHEET (canvas)->patterns [col % 8]); gdk_gc_set_stipple (gc, GNUMERIC_SHEET (canvas)->patterns [col % 8]);
gdk_gc_set_foreground (gc, &gs_black); gdk_gc_set_foreground (gc, &gs_black);
gdk_gc_set_background (gc, &gs_white); gdk_gc_set_background (gc, &gs_white);
gdk_gc_set_fill (gc, GDK_STIPPLED); gdk_gc_set_fill (gc, GDK_STIPPLED);
gdk_draw_rectangle (drawable, gc, TRUE,
x1+1, y1+1, width-2, height-2);
#endif #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); gdk_gc_set_foreground (gc, &item_grid->default_color);
cell_draw (cell, item_grid->sheet_view, gc, drawable, x1, y1);