From ef46478b1c9801a141e24a8a4b43897ee5b0ff82 Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Tue, 11 Dec 2001 09:56:14 +0000 Subject: Merging changes: 2001-12-05 Christopher James Lahey * e-table-header-item.c (ethi_find_col_by_x, ethi_find_col_by_x_nearest): Made these return 0 to the left of all columns and ethi_find_col_by_x return cols - 1 if to the right of all columns. Fixes Ximian bug #14414. svn path=/trunk/; revision=14971 --- widgets/table/e-table-header-item.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'widgets/table/e-table-header-item.c') diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c index de0b1bb407..617b438dd9 100644 --- a/widgets/table/e-table-header-item.c +++ b/widgets/table/e-table-header-item.c @@ -71,6 +71,7 @@ static guint ethi_signals [LAST_SIGNAL] = { 0, }; #define PARENT_OBJECT_TYPE gnome_canvas_item_get_type () #define ELEMENTS(x) (sizeof (x) / sizeof (x[0])) +#define d(x) static GnomeCanvasItemClass *ethi_parent_class; @@ -384,21 +385,28 @@ ethi_find_col_by_x (ETableHeaderItem *ethi, int x) const int cols = e_table_header_count (ethi->eth); int x1 = 0; int col; - - if (x < x1) - return -1; + + d(g_print ("%s:%d: x = %d, x1 = %d\n", __FUNCTION__, __LINE__, x, x1)); x1 += ethi->group_indent_width; + if (x < x1) { + d(g_print ("%s:%d: Returning 0\n", __FUNCTION__, __LINE__)); + return 0; + } + for (col = 0; col < cols; col++){ ETableCol *ecol = e_table_header_get_column (ethi->eth, col); - if ((x >= x1) && (x <= x1 + ecol->width)) + if ((x >= x1) && (x <= x1 + ecol->width)) { + d(g_print ("%s:%d: Returning %d\n", __FUNCTION__, __LINE__, col)); return col; + } x1 += ecol->width; } - return -1; + d(g_print ("%s:%d: Returning %d\n", __FUNCTION__, __LINE__, cols - 1)); + return cols - 1; } static int @@ -408,11 +416,11 @@ ethi_find_col_by_x_nearest (ETableHeaderItem *ethi, int x) int x1 = 0; int col; - if (x < x1) - return -1; - x1 += ethi->group_indent_width; + if (x < x1) + return 0; + for (col = 0; col < cols; col++){ ETableCol *ecol = e_table_header_get_column (ethi->eth, col); -- cgit v1.2.3