Commit 352bf4dd authored by Arturo Espinosa's avatar Arturo Espinosa
Browse files

Change of strategy:



Change of strategy:

	- We dont do "smart" autoformat of numbers and strings.
	  That is what the "general" format is for.

MigueL
parent 9ad970d1
......@@ -51,8 +51,6 @@ cell_set_alignment (Cell *cell, int halign, int valign, int orient)
g_return_if_fail (cell != NULL);
g_return_if_fail (cell->style != NULL);
cell->flags &= ~CELL_DEFAULT_STYLE;
if ((cell->style->halign == halign) &&
(cell->style->halign == valign) &&
(cell->style->orientation == orient))
......@@ -65,41 +63,6 @@ cell_set_alignment (Cell *cell, int halign, int valign, int orient)
cell_queue_redraw (cell);
}
/*
* cell_auto_align:
* @cell: The cell to configure the alignment to
*
* This routine sets the alignemnt of a cell depending on the data
* represented in the cell. This routine does nothing if a style
* has been explicitly set
*/
static void
cell_auto_align (Cell *cell)
{
int align;
if (!(cell->flags & CELL_DEFAULT_STYLE))
return;
if (!cell->value)
align = HALIGN_LEFT;
else
switch (cell->value->type){
case VALUE_STRING:
align = HALIGN_LEFT;
break;
case VALUE_INTEGER:
case VALUE_FLOAT:
align = HALIGN_RIGHT;
break;
default:
return;
}
cell->style->halign = align;
cell_queue_redraw (cell);
}
/*
* cell_calc_dimensions
* @cell: The cell
......@@ -158,7 +121,6 @@ cell_render_value (Cell *cell)
g_return_if_fail (cell != NULL);
g_return_if_fail (cell->value != NULL);
cell_auto_align (cell);
str = format_value (cell->style->format, cell->value, NULL);
cell_set_rendered_text (cell, str);
g_free (str);
......@@ -209,8 +171,6 @@ cell_set_text (Cell *cell, char *text)
if (is_text){
v->type = VALUE_STRING;
v->v.str = string_get (text);
cell_set_rendered_text (cell, text);
} else {
if (is_float){
v->type = VALUE_FLOAT;
......
......@@ -23,9 +23,6 @@ cell_eval (Cell *cell)
g_return_if_fail (cell != NULL);
if (cell->text)
string_unref (cell->text);
v = eval_expr (cell->sheet, cell->parsed_node,
cell->col->pos,
cell->row->pos,
......
......@@ -23,9 +23,6 @@ cell_eval (Cell *cell)
g_return_if_fail (cell != NULL);
if (cell->text)
string_unref (cell->text);
v = eval_expr (cell->sheet, cell->parsed_node,
cell->col->pos,
cell->row->pos,
......
......@@ -161,6 +161,7 @@ item_grid_draw_cell (GdkDrawable *drawable, ItemGrid *item_grid,
Style *style;
int x_offset, y_offset, text_base, pixels;
GdkRectangle rect;
int halign;
#if 0
item_debug_cross (drawable, gc, x1, y1, x1+width, y1+height);
......@@ -209,14 +210,17 @@ item_grid_draw_cell (GdkDrawable *drawable, ItemGrid *item_grid,
break;
}
#endif
switch (style->halign){
case HALIGN_GENERAL:
if (col < SHEET_MAX_COLS-1)
clip_right = sheet_cell_get (sheet, col+1, row);
x_offset = cell->col->margin_a;
break;
halign = style->halign;
if (halign == HALIGN_GENERAL && cell->value){
if (cell->value->type == VALUE_FLOAT || cell->value->type == VALUE_INTEGER)
halign = HALIGN_RIGHT;
else
halign = HALIGN_LEFT;
}
switch (halign){
case HALIGN_LEFT:
if (col < SHEET_MAX_COLS-1)
clip_right = sheet_cell_get (sheet, col+1, row);
......
......@@ -1572,7 +1572,6 @@ sheet_cell_new (Sheet *sheet, int col, int row)
g_return_val_if_fail (IS_SHEET (sheet), NULL);
cell = g_new0 (Cell, 1);
cell->flags |= CELL_DEFAULT_STYLE;
sheet_cell_add (sheet, cell, col, row);
return cell;
......
......@@ -182,7 +182,7 @@ style_new (void)
style->font = style_font_new ("-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*", 14);
style->border = style_border_new_plain ();
style->halign = HALIGN_LEFT;
style->halign = HALIGN_GENERAL;
style->valign = VALIGN_CENTER;
style->orientation = ORIENT_HORIZ;
......
Markdown is supported
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