diff options
author | Christopher James Lahey <clahey@helixcode.com> | 2000-10-22 14:03:03 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2000-10-22 14:03:03 +0800 |
commit | 4273e3adbe22aa8dbb34b9eaeeb206811d497646 (patch) | |
tree | 4c74a102e3848b7c6c0015c0a551574aefb2f213 /widgets | |
parent | e4e6331ee588f6b72c9f98840f09d2eb41e23cb3 (diff) | |
download | gsoc2013-evolution-4273e3adbe22aa8dbb34b9eaeeb206811d497646.tar gsoc2013-evolution-4273e3adbe22aa8dbb34b9eaeeb206811d497646.tar.gz gsoc2013-evolution-4273e3adbe22aa8dbb34b9eaeeb206811d497646.tar.bz2 gsoc2013-evolution-4273e3adbe22aa8dbb34b9eaeeb206811d497646.tar.lz gsoc2013-evolution-4273e3adbe22aa8dbb34b9eaeeb206811d497646.tar.xz gsoc2013-evolution-4273e3adbe22aa8dbb34b9eaeeb206811d497646.tar.zst gsoc2013-evolution-4273e3adbe22aa8dbb34b9eaeeb206811d497646.zip |
Made it so that it doesn't recalculate all the rows if a row is changed,
2000-10-22 Christopher James Lahey <clahey@helixcode.com>
* 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
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/table/e-table-item.c | 31 | ||||
-rw-r--r-- | widgets/table/e-table-subset.c | 9 |
2 files changed, 36 insertions, 4 deletions
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 diff --git a/widgets/table/e-table-subset.c b/widgets/table/e-table-subset.c index 5b9a014afe..1d4f4038bd 100644 --- a/widgets/table/e-table-subset.c +++ b/widgets/table/e-table-subset.c @@ -14,6 +14,7 @@ #include "e-table-subset.h" #define PARENT_TYPE E_TABLE_MODEL_TYPE +#define d(x) static ETableModelClass *etss_parent_class; @@ -66,6 +67,7 @@ etss_value_at (ETableModel *etm, int col, int row) ETableSubset *etss = (ETableSubset *)etm; etss->last_access = row; + d(g_print("g) Setting last_access to %d\n", row)); return e_table_model_value_at (etss->source, col, etss->map_table [row]); } @@ -75,6 +77,7 @@ etss_set_value_at (ETableModel *etm, int col, int row, const void *val) ETableSubset *etss = (ETableSubset *)etm; etss->last_access = row; + d(g_print("h) Setting last_access to %d\n", row)); return e_table_model_set_value_at (etss->source, col, etss->map_table [row], val); } @@ -187,6 +190,7 @@ etss_proxy_model_row_changed (ETableModel *etm, int row, ETableSubset *etss) for (i = etss->last_access; i < limit; i++) { if (map_table [i] == row){ e_table_model_row_changed (E_TABLE_MODEL (etss), i); + d(g_print("a) Found %d from %d\n", i, etss->last_access)); etss->last_access = i; return; } @@ -196,6 +200,7 @@ etss_proxy_model_row_changed (ETableModel *etm, int row, ETableSubset *etss) for (i = etss->last_access - 1; i >= limit; i--) { if (map_table [i] == row){ e_table_model_row_changed (E_TABLE_MODEL (etss), i); + d(g_print("b) Found %d from %d\n", i, etss->last_access)); etss->last_access = i; return; } @@ -204,6 +209,7 @@ etss_proxy_model_row_changed (ETableModel *etm, int row, ETableSubset *etss) for (i = 0; i < n; i++){ if (map_table [i] == row){ e_table_model_row_changed (E_TABLE_MODEL (etss), i); + d(g_print("c) Found %d from %d\n", i, etss->last_access)); etss->last_access = i; return; } @@ -222,6 +228,7 @@ etss_proxy_model_cell_changed (ETableModel *etm, int col, int row, ETableSubset for (i = etss->last_access; i < limit; i++) { if (map_table [i] == row){ e_table_model_cell_changed (E_TABLE_MODEL (etss), col, i); + d(g_print("d) Found %d from %d\n", i, etss->last_access)); etss->last_access = i; return; } @@ -231,6 +238,7 @@ etss_proxy_model_cell_changed (ETableModel *etm, int col, int row, ETableSubset for (i = etss->last_access - 1; i >= limit; i--) { if (map_table [i] == row){ e_table_model_cell_changed (E_TABLE_MODEL (etss), col, i); + d(g_print("e) Found %d from %d\n", i, etss->last_access)); etss->last_access = i; return; } @@ -239,6 +247,7 @@ etss_proxy_model_cell_changed (ETableModel *etm, int col, int row, ETableSubset for (i = 0; i < n; i++){ if (map_table [i] == row){ e_table_model_cell_changed (E_TABLE_MODEL (etss), col, i); + d(g_print("f) Found %d from %d\n", i, etss->last_access)); etss->last_access = i; return; } |