aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-05-04 14:49:31 +0800
committerChris Lahey <clahey@src.gnome.org>2000-05-04 14:49:31 +0800
commite6f93efbadf410e6c9dcd9b4326562b27a8cfef0 (patch)
tree84c2889375c889723e5faf5955df328e64506ebe /widgets
parent5801d079852bd2e877d9511e4c3ea8083066c58c (diff)
downloadgsoc2013-evolution-e6f93efbadf410e6c9dcd9b4326562b27a8cfef0.tar.gz
gsoc2013-evolution-e6f93efbadf410e6c9dcd9b4326562b27a8cfef0.tar.zst
gsoc2013-evolution-e6f93efbadf410e6c9dcd9b4326562b27a8cfef0.zip
Fix author information.
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. svn path=/trunk/; revision=2791
Diffstat (limited to 'widgets')
-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
-rw-r--r--widgets/table/e-cell-text.c4
-rw-r--r--widgets/table/e-cell-text.h4
-rw-r--r--widgets/table/e-table-group-leaf.c17
-rw-r--r--widgets/table/e-table-item.c34
9 files changed, 97 insertions, 32 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);
diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c
index b128cf26ff..549e004825 100644
--- a/widgets/table/e-cell-text.c
+++ b/widgets/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/table/e-cell-text.h b/widgets/table/e-cell-text.h
index 7e42a1d276..997723b0d6 100644
--- a/widgets/table/e-cell-text.h
+++ b/widgets/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/table/e-table-group-leaf.c b/widgets/table/e-table-group-leaf.c
index bfa72e86ab..54aa3748f3 100644
--- a/widgets/table/e-table-group-leaf.c
+++ b/widgets/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/table/e-table-item.c b/widgets/table/e-table-item.c
index 0a243d470a..ccc1eba5d8 100644
--- a/widgets/table/e-table-item.c
+++ b/widgets/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);