Commit 0b4cdc20 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg
Browse files

Bug 5490.

2000-01-24  Jody Goldberg <jgoldberg@home.com>

	* src/cell-draw.c (cell_draw) : Take the style as an argument, no need
	  to recompute something that is already available.

	* src/xml-io.c (xml_sheet_read) : Move the {freeze,thaw}_redraws here.
	(xml_read_cell) : Remove the sillyness about removing newlines and
	  trailing spaces.  Remove the {freeze,thaw}_redraws.

	* src/cell.c (cell_set_text_simple) : Store the rendered value.
	(cell_set_text) : Store the entered value.
parent 55ef8972
2000-01-24 Jody Goldberg <jgoldberg@home.com>
* src/cell-draw.c (cell_draw) : Take the style as an argument, no need
to recompute something that is already available.
* src/xml-io.c (xml_sheet_read) : Move the {freeze,thaw}_redraws here.
(xml_read_cell) : Remove the sillyness about removing newlines and
trailing spaces. Remove the {freeze,thaw}_redraws.
* src/cell.c (cell_set_text_simple) : Store the rendered value.
(cell_set_text) : Store the entered value.
2000-01-24 Jon K Hellan <hellan@acm.org>
* src/dialogs/autocorrect.glade: Really commit the changes I
......
2000-01-24 Jody Goldberg <jgoldberg@home.com>
* src/cell-draw.c (cell_draw) : Take the style as an argument, no need
to recompute something that is already available.
* src/xml-io.c (xml_sheet_read) : Move the {freeze,thaw}_redraws here.
(xml_read_cell) : Remove the sillyness about removing newlines and
trailing spaces. Remove the {freeze,thaw}_redraws.
* src/cell.c (cell_set_text_simple) : Store the rendered value.
(cell_set_text) : Store the entered value.
2000-01-24 Jon K Hellan <hellan@acm.org>
* src/dialogs/autocorrect.glade: Really commit the changes I
......
......@@ -1642,7 +1642,7 @@ ms_excel_sheet_insert (ExcelSheet *sheet, int xfidx,
if (text)
cell_set_text_simple (cell, text);
else
cell_set_text_simple (cell, "");
cell_set_value (cell, value_new_empty ());
}
/* Shared formula support functions */
......@@ -1986,7 +1986,7 @@ ms_excel_sheet_set_comment (ExcelSheet *sheet, int col, int row, char *text)
Cell *cell = sheet_cell_get (sheet->gnum_sheet, col, row);
if (!cell) {
cell = sheet_cell_fetch (sheet->gnum_sheet, col, row);
cell_set_text_simple (cell, "");
cell_set_value (cell, value_new_empty ());
}
cell_set_comment (cell, text);
}
......
......@@ -114,10 +114,10 @@ sheet_get_style_font (const Sheet *sheet, MStyle *mstyle)
* Returns the number of columns used for the draw
*/
int
cell_draw (Cell *cell, SheetView *sheet_view, GdkGC *gc,
cell_draw (Cell *cell, MStyle *mstyle,
SheetView *sheet_view, GdkGC *gc,
GdkDrawable *drawable, int x1, int y1)
{
MStyle *mstyle = cell_get_mstyle (cell);
GdkFont *font;
StyleFont *style_font;
GdkColor *col;
......@@ -158,7 +158,6 @@ cell_draw (Cell *cell, SheetView *sheet_view, GdkGC *gc,
y1, text_base,
width, height);
style_font_unref (style_font);
mstyle_unref (mstyle);
return 1;
}
......@@ -343,7 +342,6 @@ cell_draw (Cell *cell, SheetView *sheet_view, GdkGC *gc,
}
style_font_unref (style_font);
mstyle_unref (mstyle);
return end_col - start_col + 1;
}
......@@ -473,6 +473,8 @@ cell_set_value (Cell *cell, Value *v)
*
* - It does not queue any recomputations. You have to queue the recompute
* yourself.
*
* - It stores the rendered value of the text as if that is what was entered.
*/
void
cell_set_text_simple (Cell *cell, const char *text)
......@@ -515,7 +517,9 @@ cell_set_text_simple (Cell *cell, const char *text)
}
cell_render_value (cell);
cell->entered_text = string_get (text);
cell->entered_text = (cell->text != NULL)
? string_ref (cell->text)
: string_get (text);
}
}
......@@ -542,7 +546,8 @@ cell_content_changed (Cell *cell)
/*
* cell_set_text
*
* Changes the content of a cell
* Changes the content of a cell and stores
* the actual entered text.
*/
void
cell_set_text (Cell *cell, const char *text)
......@@ -568,6 +573,12 @@ cell_set_text (Cell *cell, const char *text)
cell_queue_redraw (cell);
cell_set_text_simple (cell, text);
/* Store the real entered text */
if (cell->text != NULL) {
string_unref (cell->text);
cell->entered_text = string_get (text);
}
cell_content_changed (cell);
cell_queue_redraw (cell);
......
......@@ -157,7 +157,8 @@ int cell_get_horizontal_align (const Cell *cell, int align);
gboolean cell_is_number (const Cell *cell);
gboolean cell_is_zero (const Cell *cell);
int cell_draw (Cell *cell, SheetView *sheet_view,
int cell_draw (Cell *cell, MStyle *mstyle,
SheetView *sheet_view,
GdkGC *gc, GdkDrawable *drawable,
int x, int y);
......
......@@ -311,7 +311,7 @@ item_grid_draw_cell (GdkDrawable *drawable, ItemGrid *item_grid, Cell *cell, int
/* Draw cell contents BEFORE border */
if (cell->sheet->display_zero || !cell_is_zero (cell))
count = cell_draw (cell, item_grid->sheet_view, gc, drawable, x1, y1);
count = cell_draw (cell, mstyle, item_grid->sheet_view, gc, drawable, x1, y1);
item_grid_draw_border (drawable, mstyle, x1, y1, w, h, count > 1, FALSE);
......
......@@ -1558,18 +1558,11 @@ xml_read_cell (parse_xml_context_t *ctxt, xmlNodePtr tree)
xml_get_value_int (tree, "Col", &col);
xml_get_value_int (tree, "Row", &row);
cell_deep_freeze_redraws ();
/* cell_deep_freeze_dependencies (); */
ret = sheet_cell_get (ctxt->sheet, col, row);
if (ret == NULL)
ret = sheet_cell_new (ctxt->sheet, col, row);
if (ret == NULL) {
cell_deep_thaw_redraws ();
/* cell_deep_thaw_dependencies (); */
if (ret == NULL)
return NULL;
}
/*
* This style code is a gross anachronism that slugs performance
......@@ -1622,15 +1615,6 @@ xml_read_cell (parse_xml_context_t *ctxt, xmlNodePtr tree)
if (content == NULL)
content = xmlNodeGetContent (tree);
if (content != NULL) {
char *p = content + strlen (content);
while (p > content) {
p--;
if (*p != ' ' && *p != '\n')
break;
*p = 0;
}
/*
* Handle special case of a non corner element of an array
* that has already been created.
......@@ -1639,12 +1623,8 @@ xml_read_cell (parse_xml_context_t *ctxt, xmlNodePtr tree)
OPER_ARRAY != ret->parsed_node->oper)
cell_set_text_simple (ret, content);
xmlFree (content);
} else {
} else
cell_set_value (ret, value_new_empty ());
}
cell_deep_thaw_redraws ();
/* cell_deep_thaw_dependencies (); */
return ret;
}
......@@ -1960,6 +1940,9 @@ xml_sheet_read (parse_xml_context_t *ctxt, xmlNodePtr tree)
objects = objects->next;
}
}
cell_deep_freeze_redraws ();
child = xml_search_child (tree, "Cells");
if (child != NULL){
cells = child->childs;
......@@ -1968,6 +1951,9 @@ xml_sheet_read (parse_xml_context_t *ctxt, xmlNodePtr tree)
cells = cells->next;
}
}
cell_deep_thaw_redraws ();
xml_dispose_read_cell_styles (ctxt);
/* Initialize the ColRowInfo's ->pixels data */
......
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