aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorRusty Conover <rconover@zootweb.com>2001-02-17 15:29:22 +0800
committerRusty Conover <rconover@src.gnome.org>2001-02-17 15:29:22 +0800
commite76ecc31c5922b4a89ebcac0a48c11c9d6fe0fa7 (patch)
tree19a8c7711cb8e92bbe528de9225a0ddaafdc33d6 /widgets
parent249be89c95b7c990155c0e5ceb24ab26253ada4f (diff)
downloadgsoc2013-evolution-e76ecc31c5922b4a89ebcac0a48c11c9d6fe0fa7.tar
gsoc2013-evolution-e76ecc31c5922b4a89ebcac0a48c11c9d6fe0fa7.tar.gz
gsoc2013-evolution-e76ecc31c5922b4a89ebcac0a48c11c9d6fe0fa7.tar.bz2
gsoc2013-evolution-e76ecc31c5922b4a89ebcac0a48c11c9d6fe0fa7.tar.lz
gsoc2013-evolution-e76ecc31c5922b4a89ebcac0a48c11c9d6fe0fa7.tar.xz
gsoc2013-evolution-e76ecc31c5922b4a89ebcac0a48c11c9d6fe0fa7.tar.zst
gsoc2013-evolution-e76ecc31c5922b4a89ebcac0a48c11c9d6fe0fa7.zip
Change the calculation of the maximum with of tree cell, from O(n^2) to
2001-02-17 Rusty Conover <rconover@zootweb.com> * e-cell-tree.c (ect_max_width): Change the calculation of the maximum with of tree cell, from O(n^2) to O(n), we don't need to continually recalculate the maximum width of the subcells when calculating the width of every row. svn path=/trunk/; revision=8264
Diffstat (limited to 'widgets')
-rw-r--r--widgets/table/e-cell-tree.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/widgets/table/e-cell-tree.c b/widgets/table/e-cell-tree.c
index 97c6215056..f056cde271 100644
--- a/widgets/table/e-cell-tree.c
+++ b/widgets/table/e-cell-tree.c
@@ -386,8 +386,11 @@ ect_max_width (ECellView *ecell_view, int model_col, int view_col)
int number_of_rows;
int max_width = 0;
int width = 0;
+ int subcell_max_width;
number_of_rows = e_table_model_row_count (ecell_view->e_table_model);
+
+ subcell_max_width = e_cell_max_width (tree_view->subcell_view, model_col, view_col);
for (row = 0; row < number_of_rows; row++) {
ETreeModel *tree_model = e_cell_tree_get_tree_model(ecell_view->e_table_model, row);
@@ -412,7 +415,7 @@ ect_max_width (ECellView *ecell_view, int model_col, int view_col)
node_image_height = gdk_pixbuf_get_height (node_image);
}
- width = subcell_offset + node_image_width;
+ width = subcell_max_width + subcell_offset + node_image_width;
if (expandable) {
GdkPixbuf *image;
@@ -424,9 +427,6 @@ ect_max_width (ECellView *ecell_view, int model_col, int view_col)
width += gdk_pixbuf_get_width(image);
}
- width += e_cell_max_width (tree_view->subcell_view, model_col,
- view_col);
-
max_width = MAX (max_width, width);
}