From 4273e3adbe22aa8dbb34b9eaeeb206811d497646 Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Sun, 22 Oct 2000 06:03:03 +0000 Subject: Made it so that it doesn't recalculate all the rows if a row is changed, 2000-10-22 Christopher James Lahey * e-table-item.c: Made it so that it doesn't recalculate all the rows if a row is changed, inserted or deleted. * e-table-subset.c: Added debugging code (turned off). svn path=/trunk/; revision=6102 --- widgets/table/e-table-item.c | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) (limited to 'widgets/table/e-table-item.c') diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c index 20259b0ed7..0c9551f60c 100644 --- a/widgets/table/e-table-item.c +++ b/widgets/table/e-table-item.c @@ -672,7 +672,9 @@ eti_request_region_show (ETableItem *eti, static void eti_table_model_row_changed (ETableModel *table_model, int row, ETableItem *eti) { - if (eti->renderers_can_change_size) { + if (eti->renderers_can_change_size && + eti->height_cache && eti->height_cache[row] != -1 && + eti_row_height_real(eti, row) != eti->height_cache[row]) { eti_table_model_changed (table_model, eti); return; } @@ -683,7 +685,9 @@ eti_table_model_row_changed (ETableModel *table_model, int row, ETableItem *eti) static void eti_table_model_cell_changed (ETableModel *table_model, int col, int row, ETableItem *eti) { - if (eti->renderers_can_change_size) { + if (eti->renderers_can_change_size && + eti->height_cache && eti->height_cache[row] != -1 && + eti_row_height_real(eti, row) != eti->height_cache[row]) { eti_table_model_changed (table_model, eti); return; } @@ -694,13 +698,32 @@ eti_table_model_cell_changed (ETableModel *table_model, int col, int row, ETable static void eti_table_model_row_inserted (ETableModel *table_model, int row, ETableItem *eti) { - eti_table_model_changed (table_model, eti); + eti->rows = e_table_model_row_count (eti->table_model); + + if (eti->height_cache) { + eti->height_cache = g_renew(int, eti->height_cache, eti->rows); + memmove(eti->height_cache + row + 1, eti->height_cache + row, (eti->rows - 1 - row) * sizeof(int)); + eti->height_cache[row] = -1; + } + + eti->needs_compute_height = 1; + e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (eti)); + eti->needs_redraw = 1; + gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti)); } static void eti_table_model_row_deleted (ETableModel *table_model, int row, ETableItem *eti) { - eti_table_model_changed (table_model, eti); + eti->rows = e_table_model_row_count (eti->table_model); + + if (eti->height_cache) + memmove(eti->height_cache + row, eti->height_cache + row + 1, (eti->rows - row) * sizeof(int)); + + eti->needs_compute_height = 1; + e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (eti)); + eti->needs_redraw = 1; + gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti)); } void -- cgit