aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/e-table
diff options
context:
space:
mode:
Diffstat (limited to 'widgets/e-table')
-rw-r--r--widgets/e-table/ChangeLog11
-rw-r--r--widgets/e-table/e-cell-text.c4
-rw-r--r--widgets/e-table/e-cell-text.h4
-rw-r--r--widgets/e-table/e-table-group-leaf.c17
-rw-r--r--widgets/e-table/e-table-item.c34
5 files changed, 54 insertions, 16 deletions
diff --git a/widgets/e-table/ChangeLog b/widgets/e-table/ChangeLog
index 56fed29a0d..b8427c3679 100644
--- a/widgets/e-table/ChangeLog
+++ b/widgets/e-table/ChangeLog
@@ -1,5 +1,16 @@
2000-05-04 Christopher James Lahey <clahey@helixcode.com>
+ * e-cell-text.c, e-cell-text.h: Fix author information.
+
+ * e-table-group-leaf.c: Set a length threshold of 200.
+
+ * e-table-item.c: Height cache is now actually a map. Made
+ "length_threshold" argument work. If over the length threshold,
+ use the height cache to get a better estimate so that once the
+ height cache is full, height estimate is perfect.
+
+2000-05-04 Christopher James Lahey <clahey@helixcode.com>
+
* e-table-sorted-variable.c (qsort_callback): Add back in main
loop calls during sorting.
diff --git a/widgets/e-table/e-cell-text.c b/widgets/e-table/e-cell-text.c
index b128cf26ff..549e004825 100644
--- a/widgets/e-table/e-cell-text.c
+++ b/widgets/e-table/e-cell-text.c
@@ -2,8 +2,8 @@
/* e-cell-text.c - Text cell renderer
* Copyright (C) 2000 Helix Code, Inc.
*
- * Authors: Miguel de Icaza (miguel@kernel.org)
- * Chris Lahey <clahey@umich.edu>
+ * Authors: Miguel de Icaza <miguel@helixcode.com>
+ * Chris Lahey <clahey@helixcode.com>
*
*
* A majority of code taken from:
diff --git a/widgets/e-table/e-cell-text.h b/widgets/e-table/e-cell-text.h
index 7e42a1d276..997723b0d6 100644
--- a/widgets/e-table/e-cell-text.h
+++ b/widgets/e-table/e-cell-text.h
@@ -1,14 +1,14 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/* ECellText - Text item for e-table.
* Copyright (C) 2000 Helix Code, Inc.
- * Author: Chris Lahey <clahey@umich.edu>
+ * Author: Chris Lahey <clahey@helixcode.com>
*
* Drawing and event handling from:
*
* EText - Text item for evolution.
* Copyright (C) 2000 Helix Code, Inc.
*
- * Author: Chris Lahey <clahey@umich.edu>
+ * Author: Chris Lahey <clahey@helixcode.com>
*
* A majority of code taken from:
*
diff --git a/widgets/e-table/e-table-group-leaf.c b/widgets/e-table/e-table-group-leaf.c
index bfa72e86ab..54aa3748f3 100644
--- a/widgets/e-table/e-table-group-leaf.c
+++ b/widgets/e-table/e-table-group-leaf.c
@@ -97,14 +97,15 @@ etgl_realize (GnomeCanvasItem *item)
GNOME_CANVAS_ITEM_CLASS (etgl_parent_class)->realize (item);
etgl->item = E_TABLE_ITEM(gnome_canvas_item_new (GNOME_CANVAS_GROUP(etgl),
- e_table_item_get_type (),
- "ETableHeader", E_TABLE_GROUP(etgl)->header,
- "ETableModel", etgl->subset,
- "drawgrid", TRUE,
- "drawfocus", TRUE,
- "spreadsheet", TRUE,
- "width", etgl->width,
- NULL));
+ e_table_item_get_type (),
+ "ETableHeader", E_TABLE_GROUP(etgl)->header,
+ "ETableModel", etgl->subset,
+ "drawgrid", TRUE,
+ "drawfocus", TRUE,
+ "spreadsheet", TRUE,
+ "width", etgl->width,
+ "length_threshold", 200,
+ NULL));
gtk_signal_connect (GTK_OBJECT(etgl->item), "row_selection",
GTK_SIGNAL_FUNC(etgl_row_selection), etgl);
diff --git a/widgets/e-table/e-table-item.c b/widgets/e-table/e-table-item.c
index 0a243d470a..ccc1eba5d8 100644
--- a/widgets/e-table/e-table-item.c
+++ b/widgets/e-table/e-table-item.c
@@ -40,7 +40,7 @@ enum {
ARG_TABLE_DRAW_GRID,
ARG_TABLE_DRAW_FOCUS,
ARG_MODE_SPREADSHEET,
- ARG_LENGHT_THRESHOLD,
+ ARG_LENGTH_THRESHOLD,
ARG_WIDTH,
ARG_HEIGHT,
@@ -313,7 +313,7 @@ calculate_height_cache (ETableItem *eti)
free_height_cache(eti);
eti->height_cache = g_new(int, eti->rows);
for (i = 0; i < eti->rows; i++) {
- eti->height_cache[i] = eti_row_height_real(eti, i);
+ eti->height_cache[i] = -1;
}
}
@@ -327,10 +327,24 @@ calculate_height_cache (ETableItem *eti)
static int
eti_row_height (ETableItem *eti, int row)
{
+#if 1
if (!eti->height_cache) {
calculate_height_cache (eti);
}
+ if (eti->height_cache[row] == -1) {
+ eti->height_cache[row] = eti_row_height_real(eti, row);
+ if (row > 0 &&
+ eti->length_threshold != -1 &&
+ eti->rows > eti->length_threshold &&
+ eti->height_cache[row] != eti_row_height(eti, 0)) {
+ eti->needs_compute_height = 1;
+ e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(eti));
+ }
+ }
return eti->height_cache[row];
+#else
+ return eti_row_height_real(eti, row);
+#endif
}
/*
@@ -357,7 +371,17 @@ eti_get_height (ETableItem *eti)
if (eti->length_threshold != -1){
if (rows > eti->length_threshold){
- height = (eti_row_height (eti, 0) + 1) * rows;
+ int row_height = eti_row_height(eti, 0);
+ if (eti->height_cache) {
+ height = 0;
+ for (row = 0; row < rows; row++) {
+ if (eti->height_cache[row] == -1)
+ height += row_height + 1;
+ else
+ height += eti->height_cache[row] + 1;
+ }
+ } else
+ height = (eti_row_height (eti, 0) + 1) * rows;
/*
* 1 pixel at the top
@@ -628,7 +652,7 @@ eti_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
eti_add_table_model (eti, E_TABLE_MODEL(GTK_VALUE_OBJECT (*arg)));
break;
- case ARG_LENGHT_THRESHOLD:
+ case ARG_LENGTH_THRESHOLD:
eti->length_threshold = GTK_VALUE_INT (*arg);
break;
@@ -1234,6 +1258,8 @@ eti_class_init (GtkObjectClass *object_class)
GTK_ARG_WRITABLE, ARG_TABLE_DRAW_FOCUS);
gtk_object_add_arg_type ("ETableItem::spreadsheet", GTK_TYPE_BOOL,
GTK_ARG_WRITABLE, ARG_MODE_SPREADSHEET);
+ gtk_object_add_arg_type ("ETableItem::length_threshold", GTK_TYPE_INT,
+ GTK_ARG_WRITABLE, ARG_LENGTH_THRESHOLD);
gtk_object_add_arg_type ("ETableItem::width", GTK_TYPE_DOUBLE,
GTK_ARG_READWRITE, ARG_WIDTH);