Commit eb3b3858 authored by Miguel de Icaza's avatar Miguel de Icaza Committed by Arturo Espinosa
Browse files

Do not try to be smart about string content. Let the smartiness to other

1998-10-03  Miguel de Icaza  <miguel@nuclecu.unam.mx>

	* src/fn-math.c (callback_function_sum): Do not try to be smart
	about string content.  Let the smartiness to other layers.
	(gnumeric_average): Handle division by zero on average routine.

	* src/number-match.c (create_option_list): Small bug fix:  First
	translate, then move the pointer ahead.

	* src/cell.c (str_trim_spaces): Trim space routine was removing
	everything after the first space instead of removing only the
	trailing space.
	(cell_draw): Free the original string, not the modified copy.

	* src/sheet.c (sheet_set_text): Test if the format has been
	manually set by the user before trying to do format matching.

	* src/cell.h: New flag: CELL_FORMAT_SET, used if the user has
	manually specified a format. FIXME: This information should be
	saved and loaded.

	* src/cell.c (cell_set_format): Set the CELL_FORMAT_SET flag
parent 717cf9c4
1998-10-03 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/fn-math.c (callback_function_sum): Do not try to be smart
about string content. Let the smartiness to other layers.
(gnumeric_average): Handle division by zero on average routine.
* src/number-match.c (create_option_list): Small bug fix: First
translate, then move the pointer ahead.
* src/cell.c (str_trim_spaces): Trim space routine was removing
everything after the first space instead of removing only the
trailing space.
(cell_draw): Free the original string, not the modified copy.
* src/sheet.c (sheet_set_text): Test if the format has been
manually set by the user before trying to do format matching.
* src/cell.h: New flag: CELL_FORMAT_SET, used if the user has
manually specified a format. FIXME: This information should be
saved and loaded.
* src/cell.c (cell_set_format): Set the CELL_FORMAT_SET flag
1998-10-03 Nuno Ferreira <nmrf@rnl.ist.utl.pt>
* src/workbook.c: Added some more keys to navigate the menus.
......@@ -29,6 +52,7 @@
used for item_grid->selecting to avoid shutting down entirely the
formula selection range on mouse release.
>>>>>>> 1.164
1998-10-02 Vincent Renardias <vincent@waw.com>
* Changed 'es@mx' into 'es_MX' for locale stuff in
......
1998-10-03 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/fn-math.c (callback_function_sum): Do not try to be smart
about string content. Let the smartiness to other layers.
(gnumeric_average): Handle division by zero on average routine.
* src/number-match.c (create_option_list): Small bug fix: First
translate, then move the pointer ahead.
* src/cell.c (str_trim_spaces): Trim space routine was removing
everything after the first space instead of removing only the
trailing space.
(cell_draw): Free the original string, not the modified copy.
* src/sheet.c (sheet_set_text): Test if the format has been
manually set by the user before trying to do format matching.
* src/cell.h: New flag: CELL_FORMAT_SET, used if the user has
manually specified a format. FIXME: This information should be
saved and loaded.
* src/cell.c (cell_set_format): Set the CELL_FORMAT_SET flag
1998-10-03 Nuno Ferreira <nmrf@rnl.ist.utl.pt>
* src/workbook.c: Added some more keys to navigate the menus.
......@@ -29,6 +52,7 @@
used for item_grid->selecting to avoid shutting down entirely the
formula selection range on mouse release.
>>>>>>> 1.164
1998-10-02 Vincent Renardias <vincent@waw.com>
* Changed 'es@mx' into 'es_MX' for locale stuff in
......
1998-10-03 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/fn-math.c (callback_function_sum): Do not try to be smart
about string content. Let the smartiness to other layers.
(gnumeric_average): Handle division by zero on average routine.
* src/number-match.c (create_option_list): Small bug fix: First
translate, then move the pointer ahead.
* src/cell.c (str_trim_spaces): Trim space routine was removing
everything after the first space instead of removing only the
trailing space.
(cell_draw): Free the original string, not the modified copy.
* src/sheet.c (sheet_set_text): Test if the format has been
manually set by the user before trying to do format matching.
* src/cell.h: New flag: CELL_FORMAT_SET, used if the user has
manually specified a format. FIXME: This information should be
saved and loaded.
* src/cell.c (cell_set_format): Set the CELL_FORMAT_SET flag
1998-10-03 Nuno Ferreira <nmrf@rnl.ist.utl.pt>
* src/workbook.c: Added some more keys to navigate the menus.
......@@ -29,6 +52,7 @@
used for item_grid->selecting to avoid shutting down entirely the
formula selection range on mouse release.
>>>>>>> 1.164
1998-10-02 Vincent Renardias <vincent@waw.com>
* Changed 'es@mx' into 'es_MX' for locale stuff in
......
1998-10-03 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/fn-math.c (callback_function_sum): Do not try to be smart
about string content. Let the smartiness to other layers.
(gnumeric_average): Handle division by zero on average routine.
* src/number-match.c (create_option_list): Small bug fix: First
translate, then move the pointer ahead.
* src/cell.c (str_trim_spaces): Trim space routine was removing
everything after the first space instead of removing only the
trailing space.
(cell_draw): Free the original string, not the modified copy.
* src/sheet.c (sheet_set_text): Test if the format has been
manually set by the user before trying to do format matching.
* src/cell.h: New flag: CELL_FORMAT_SET, used if the user has
manually specified a format. FIXME: This information should be
saved and loaded.
* src/cell.c (cell_set_format): Set the CELL_FORMAT_SET flag
1998-10-03 Nuno Ferreira <nmrf@rnl.ist.utl.pt>
* src/workbook.c: Added some more keys to navigate the menus.
......@@ -29,6 +52,7 @@
used for item_grid->selecting to avoid shutting down entirely the
formula selection range on mouse release.
>>>>>>> 1.164
1998-10-02 Vincent Renardias <vincent@waw.com>
* Changed 'es@mx' into 'es_MX' for locale stuff in
......
......@@ -341,7 +341,7 @@ gnumeric_average (void *tsheet, GList *expr_node_list, int eval_col, int eval_ro
return NULL;
count = gnumeric_count (tsheet, expr_node_list, eval_col, eval_row, error_string);
if (!count){
if (!count || (count && count->v.v_int == 0)){
value_release (sum);
return NULL;
}
......@@ -1002,10 +1002,6 @@ callback_function_sum (Sheet *sheet, Value *value, char **error_string, void *cl
result->v.v_float += value->v.v_float;
break;
case VALUE_STRING:
result->v.v_float += atof (value->v.str->str);
break;
default:
g_warning ("Unknown VALUE type in callback_function_sum");
break;
......@@ -1131,3 +1127,4 @@ FunctionDefinition math_functions [] = {
{ NULL, NULL },
};
......@@ -496,6 +496,7 @@ cell_set_format_simple (Cell *cell, char *format)
/* Change the format */
style_format_unref (cell->style->format);
cell->style->format = style_format_new (format);
cell->flags |= CELL_FORMAT_SET;
}
/*
......@@ -519,7 +520,8 @@ cell_set_format (Cell *cell, char *format)
/* Change the format */
style_format_unref (cell->style->format);
cell->style->format = style_format_new (format);
cell->flags |= CELL_FORMAT_SET;
/* re-render the cell text */
cell_render_value (cell);
cell_queue_redraw (cell);
......@@ -1000,6 +1002,8 @@ str_trim_spaces (char *s)
while (p >= s){
if (*p == ' ')
*p = 0;
else
break;
p--;
}
return s;
......@@ -1148,7 +1152,7 @@ cell_draw (Cell *cell, void *sv, GdkGC *gc, GdkDrawable *drawable, int x1, int y
gdk_draw_text (drawable, font, gc, x1 + x_offset, y1 + y_offset, str, strlen (str));
y_offset += inter_space;
g_free (str);
g_free (l->data);
}
g_list_free (lines);
......
......@@ -23,6 +23,7 @@ typedef struct {
#define CELL_ERROR 1
#define CELL_HAS_COMMENT 2
#define CELL_FORMAT_SET 4
typedef struct {
void *sheet;
......@@ -51,8 +52,9 @@ typedef struct {
typedef GList CellList;
#define CELL_TEXT_GET(cell) ((cell)->text ? cell->text->str : cell->entered_text->str)
#define CELL_IS_FORMULA(cell) ((cell)->entered_text->str [0] == '=')
#define CELL_TEXT_GET(cell) ((cell)->text ? cell->text->str : cell->entered_text->str)
#define CELL_IS_FORMULA(cell) ((cell)->entered_text->str [0] == '=')
#define CELL_IS_FORMAT_SET(cell) ((cell)->flags & CELL_FORMAT_SET)
typedef enum {
CELL_COPY_TYPE_CELL,
......
......@@ -341,7 +341,7 @@ gnumeric_average (void *tsheet, GList *expr_node_list, int eval_col, int eval_ro
return NULL;
count = gnumeric_count (tsheet, expr_node_list, eval_col, eval_row, error_string);
if (!count){
if (!count || (count && count->v.v_int == 0)){
value_release (sum);
return NULL;
}
......@@ -1002,10 +1002,6 @@ callback_function_sum (Sheet *sheet, Value *value, char **error_string, void *cl
result->v.v_float += value->v.v_float;
break;
case VALUE_STRING:
result->v.v_float += atof (value->v.str->str);
break;
default:
g_warning ("Unknown VALUE type in callback_function_sum");
break;
......@@ -1131,3 +1127,4 @@ FunctionDefinition math_functions [] = {
{ NULL, NULL },
};
......@@ -341,7 +341,7 @@ gnumeric_average (void *tsheet, GList *expr_node_list, int eval_col, int eval_ro
return NULL;
count = gnumeric_count (tsheet, expr_node_list, eval_col, eval_row, error_string);
if (!count){
if (!count || (count && count->v.v_int == 0)){
value_release (sum);
return NULL;
}
......@@ -1002,10 +1002,6 @@ callback_function_sum (Sheet *sheet, Value *value, char **error_string, void *cl
result->v.v_float += value->v.v_float;
break;
case VALUE_STRING:
result->v.v_float += atof (value->v.str->str);
break;
default:
g_warning ("Unknown VALUE type in callback_function_sum");
break;
......@@ -1131,3 +1127,4 @@ FunctionDefinition math_functions [] = {
{ NULL, NULL },
};
......@@ -49,7 +49,7 @@ create_option_list (char **list)
res [0] = '(';
res [1] = 0;
for (p = list; *p; p++){
char *v = *p;
char *v = _(*p);
if (*v == '*')
v++;
......
......@@ -650,7 +650,7 @@ sheet_set_text (Sheet *sheet, int col, int row, char *str)
* a rendered version of the text, if they compare equally, then
* use that.
*/
if (*text != '=' && format_match (text, &v, &format)){
if (!CELL_IS_FORMAT_SET (cell) && (*text != '=' && format_match (text, &v, &format))){
StyleFormat *sf;
char *new_text;
char buffer [50];
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment