diff options
author | Christopher James Lahey <clahey@helixcode.com> | 2000-10-19 04:58:34 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2000-10-19 04:58:34 +0800 |
commit | 199a9f60a0302679a2c9dd2142bc91e2f97457ae (patch) | |
tree | 7d0f96252107898c9adc70d3990dce284db6f306 | |
parent | 8fefb8df4b9f1901537ab31cefc3e44e86f4d099 (diff) | |
download | gsoc2013-evolution-199a9f60a0302679a2c9dd2142bc91e2f97457ae.tar gsoc2013-evolution-199a9f60a0302679a2c9dd2142bc91e2f97457ae.tar.gz gsoc2013-evolution-199a9f60a0302679a2c9dd2142bc91e2f97457ae.tar.bz2 gsoc2013-evolution-199a9f60a0302679a2c9dd2142bc91e2f97457ae.tar.lz gsoc2013-evolution-199a9f60a0302679a2c9dd2142bc91e2f97457ae.tar.xz gsoc2013-evolution-199a9f60a0302679a2c9dd2142bc91e2f97457ae.tar.zst gsoc2013-evolution-199a9f60a0302679a2c9dd2142bc91e2f97457ae.zip |
Sped up signal propogation.
2000-10-18 Christopher James Lahey <clahey@helixcode.com>
* e-table-subset.c, e-table-subset.h: Sped up signal propogation.
svn path=/trunk/; revision=6006
-rw-r--r-- | widgets/table/e-table-subset.c | 52 | ||||
-rw-r--r-- | widgets/table/e-table-subset.h | 2 |
2 files changed, 52 insertions, 2 deletions
diff --git a/widgets/table/e-table-subset.c b/widgets/table/e-table-subset.c index 6727243778..5b9a014afe 100644 --- a/widgets/table/e-table-subset.c +++ b/widgets/table/e-table-subset.c @@ -65,6 +65,7 @@ etss_value_at (ETableModel *etm, int col, int row) { ETableSubset *etss = (ETableSubset *)etm; + etss->last_access = row; return e_table_model_value_at (etss->source, col, etss->map_table [row]); } @@ -73,6 +74,7 @@ etss_set_value_at (ETableModel *etm, int col, int row, const void *val) { ETableSubset *etss = (ETableSubset *)etm; + etss->last_access = row; return e_table_model_set_value_at (etss->source, col, etss->map_table [row], val); } @@ -153,7 +155,13 @@ etss_class_init (GtkObjectClass *klass) table_class->value_to_string = etss_value_to_string; } -E_MAKE_TYPE(e_table_subset, "ETableSubset", ETableSubset, etss_class_init, NULL, PARENT_TYPE); +static void +etss_init (ETableSubset *etss) +{ + etss->last_access = 0; +} + +E_MAKE_TYPE(e_table_subset, "ETableSubset", ETableSubset, etss_class_init, etss_init, PARENT_TYPE); static void etss_proxy_model_pre_change (ETableModel *etm, ETableSubset *etss) @@ -170,13 +178,33 @@ etss_proxy_model_changed (ETableModel *etm, ETableSubset *etss) static void etss_proxy_model_row_changed (ETableModel *etm, int row, ETableSubset *etss) { + int limit; const int n = etss->n_map; const int * const map_table = etss->map_table; int i; - + + limit = MIN(n, etss->last_access + 10); + for (i = etss->last_access; i < limit; i++) { + if (map_table [i] == row){ + e_table_model_row_changed (E_TABLE_MODEL (etss), i); + etss->last_access = i; + return; + } + } + + limit = MAX(0, etss->last_access - 10); + for (i = etss->last_access - 1; i >= limit; i--) { + if (map_table [i] == row){ + e_table_model_row_changed (E_TABLE_MODEL (etss), i); + etss->last_access = i; + return; + } + } + for (i = 0; i < n; i++){ if (map_table [i] == row){ e_table_model_row_changed (E_TABLE_MODEL (etss), i); + etss->last_access = i; return; } } @@ -185,13 +213,33 @@ etss_proxy_model_row_changed (ETableModel *etm, int row, ETableSubset *etss) static void etss_proxy_model_cell_changed (ETableModel *etm, int col, int row, ETableSubset *etss) { + int limit; const int n = etss->n_map; const int * const map_table = etss->map_table; int i; + + limit = MIN(n, etss->last_access + 10); + for (i = etss->last_access; i < limit; i++) { + if (map_table [i] == row){ + e_table_model_cell_changed (E_TABLE_MODEL (etss), col, i); + etss->last_access = i; + return; + } + } + + limit = MAX(0, etss->last_access - 10); + 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); + etss->last_access = i; + return; + } + } for (i = 0; i < n; i++){ if (map_table [i] == row){ e_table_model_cell_changed (E_TABLE_MODEL (etss), col, i); + etss->last_access = i; return; } } diff --git a/widgets/table/e-table-subset.h b/widgets/table/e-table-subset.h index 1b32ea933e..763b0aa0b4 100644 --- a/widgets/table/e-table-subset.h +++ b/widgets/table/e-table-subset.h @@ -18,6 +18,8 @@ typedef struct { int n_map; int *map_table; + int last_access; + int table_model_pre_change_id; int table_model_changed_id; int table_model_row_changed_id; |