aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table
diff options
context:
space:
mode:
Diffstat (limited to 'widgets/table')
-rw-r--r--widgets/table/ChangeLog13
-rw-r--r--widgets/table/e-table-group-container.c21
-rw-r--r--widgets/table/e-table-group-leaf.c11
-rw-r--r--widgets/table/e-table-group.c8
-rw-r--r--widgets/table/e-table-group.h6
-rw-r--r--widgets/table/e-table.c12
-rw-r--r--widgets/table/e-table.h2
7 files changed, 46 insertions, 27 deletions
diff --git a/widgets/table/ChangeLog b/widgets/table/ChangeLog
index d2de4354a2..c33ff9eba7 100644
--- a/widgets/table/ChangeLog
+++ b/widgets/table/ChangeLog
@@ -1,3 +1,16 @@
+2009-02-16 Milan Crha <mcrha@redhat.com>
+
+ ** Part of fix for bug #550114
+
+ * e-table-group.h:
+ * e-table-group.c:
+ * e-table-group-container.c:
+ * e-table-group-leaf.c:
+ Replaced 'compute_mouse_over' with 'get_mouse_over', now works
+ with cached values 'motion_row', 'motion_col'.
+ * e-table.c: (e_table_get_mouse_over_cell):
+ Mouse position not required anymore, remove it too then.
+
2008-12-15 Milan Crha <mcrha@redhat.com>
** Fix for bug #557176
diff --git a/widgets/table/e-table-group-container.c b/widgets/table/e-table-group-container.c
index 0066b8b482..592cd1eee5 100644
--- a/widgets/table/e-table-group-container.c
+++ b/widgets/table/e-table-group-container.c
@@ -688,7 +688,7 @@ etgc_compute_location (ETableGroup *etg, int *x, int *y, int *row, int *col)
}
static void
-etgc_compute_mouse_over (ETableGroup *etg, int x, int y, int *row, int *col)
+etgc_get_mouse_over (ETableGroup *etg, int *row, int *col)
{
ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg);
@@ -697,18 +697,23 @@ etgc_compute_mouse_over (ETableGroup *etg, int x, int y, int *row, int *col)
if (col)
*col = -1;
- x -= GROUP_INDENT;
- y -= TITLE_HEIGHT;
-
- if (x >= 0 && y >= 0 && etgc->children) {
+ if (etgc->children) {
+ int row_plus = 0;
GList *list;
+
for (list = etgc->children; list; list = list->next) {
ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data;
ETableGroup *child = child_node->child;
- e_table_group_compute_mouse_over (child, x, y, row, col);
- if ((*row != -1) && (*col != -1))
+ e_table_group_get_mouse_over (child, row, col);
+
+ if ((!row || *row != -1) && (!col || *col != -1)) {
+ if (row)
+ *row += row_plus;
return;
+ }
+
+ row_plus += e_table_group_row_count (child);
}
}
}
@@ -914,7 +919,7 @@ etgc_class_init (ETableGroupContainerClass *klass)
e_group_class->get_focus_column = etgc_get_focus_column;
e_group_class->get_printable = etgc_get_printable;
e_group_class->compute_location = etgc_compute_location;
- e_group_class->compute_mouse_over = etgc_compute_mouse_over;
+ e_group_class->get_mouse_over = etgc_get_mouse_over;
e_group_class->get_cell_geometry = etgc_get_cell_geometry;
g_object_class_install_property (object_class, PROP_TABLE_ALTERNATING_ROW_COLORS,
diff --git a/widgets/table/e-table-group-leaf.c b/widgets/table/e-table-group-leaf.c
index 95dc312b0a..dc4c8ba11e 100644
--- a/widgets/table/e-table-group-leaf.c
+++ b/widgets/table/e-table-group-leaf.c
@@ -408,11 +408,16 @@ etgl_compute_location (ETableGroup *etg, int *x, int *y, int *row, int *col)
}
static void
-etgl_compute_mouse_over (ETableGroup *etg, int x, int y, int *row, int *col)
+etgl_get_mouse_over (ETableGroup *etg, int *row, int *col)
{
ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg);
- e_table_item_compute_mouse_over (etgl->item, x, y, row, col);
+ if (etgl->item && etgl->item->motion_row > -1 && etgl->item->motion_col > -1) {
+ if (row)
+ *row = etgl->item->motion_row;
+ if (col)
+ *col = etgl->item->motion_col;
+ }
}
static void
@@ -573,7 +578,7 @@ etgl_class_init (ETableGroupLeafClass *klass)
e_group_class->get_focus_column = etgl_get_focus_column;
e_group_class->get_printable = etgl_get_printable;
e_group_class->compute_location = etgl_compute_location;
- e_group_class->compute_mouse_over = etgl_compute_mouse_over;
+ e_group_class->get_mouse_over = etgl_get_mouse_over;
e_group_class->get_cell_geometry = etgl_get_cell_geometry;
g_object_class_install_property (object_class, PROP_TABLE_ALTERNATING_ROW_COLORS,
diff --git a/widgets/table/e-table-group.c b/widgets/table/e-table-group.c
index cbbd02c839..9e558bcb3f 100644
--- a/widgets/table/e-table-group.c
+++ b/widgets/table/e-table-group.c
@@ -382,13 +382,13 @@ e_table_group_compute_location (ETableGroup *etg, int *x, int *y, int *row, int
}
void
-e_table_group_compute_mouse_over (ETableGroup *etg, int x, int y, int *row, int *col)
+e_table_group_get_mouse_over (ETableGroup *etg, int *row, int *col)
{
g_return_if_fail (etg != NULL);
g_return_if_fail (E_IS_TABLE_GROUP (etg));
- g_return_if_fail (ETG_CLASS (etg)->compute_mouse_over != NULL);
- ETG_CLASS (etg)->compute_mouse_over (etg, x, y, row, col);
+ g_return_if_fail (ETG_CLASS (etg)->get_mouse_over != NULL);
+ ETG_CLASS (etg)->get_mouse_over (etg, row, col);
}
/**
@@ -648,7 +648,7 @@ etg_class_init (ETableGroupClass *klass)
klass->get_focus = etg_get_focus;
klass->get_printable = NULL;
klass->compute_location = NULL;
- klass->compute_mouse_over = NULL;
+ klass->get_mouse_over = NULL;
klass->get_cell_geometry = NULL;
etg_signals [CURSOR_CHANGE] =
diff --git a/widgets/table/e-table-group.h b/widgets/table/e-table-group.h
index 10591e4113..ee225c2471 100644
--- a/widgets/table/e-table-group.h
+++ b/widgets/table/e-table-group.h
@@ -90,7 +90,7 @@ typedef struct {
gint (*get_focus_column) (ETableGroup *etg);
EPrintable *(*get_printable) (ETableGroup *etg);
void (*compute_location) (ETableGroup *etg, int *x, int *y, int *row, int *col);
- void (*compute_mouse_over) (ETableGroup *etg, int x, int y, int *row, int *col);
+ void (*get_mouse_over) (ETableGroup *etg, int *row, int *col);
void (*get_cell_geometry) (ETableGroup *etg, int *row, int *col, int *x, int *y, int *width, int *height);
} ETableGroupClass;
@@ -123,9 +123,7 @@ void e_table_group_compute_location (ETableGroup *etg,
int *y,
int *row,
int *col);
-void e_table_group_compute_mouse_over(ETableGroup *etg,
- int x,
- int y,
+void e_table_group_get_mouse_over(ETableGroup *etg,
int *row,
int *col);
void e_table_group_get_cell_geometry (ETableGroup *etg,
diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c
index bd2926c682..b2e6b0ecaf 100644
--- a/widgets/table/e-table.c
+++ b/widgets/table/e-table.c
@@ -2416,20 +2416,18 @@ e_table_get_cell_geometry (ETable *table,
/**
* e_table_get_mouse_over_cell:
- * Similar to e_table_get_cell_at, only here we recalculate x,y relatively to each item.
+ * Similar to e_table_get_cell_at, only here we check based on the mouse motion information in the group.
**/
void
-e_table_get_mouse_over_cell (ETable *table, int x, int y, int *row, int *col)
+e_table_get_mouse_over_cell (ETable *table, int *row, int *col)
{
g_return_if_fail (table != NULL);
g_return_if_fail (E_IS_TABLE (table));
- x += GTK_LAYOUT (table->table_canvas)->hadjustment->value;
- y += GTK_LAYOUT (table->table_canvas)->vadjustment->value;
-
- y -= E_TABLE_HEADER_ITEM (table->header_item)->height;
+ if (!table->group)
+ return;
- e_table_group_compute_mouse_over (table->group, x, y, row, col);
+ e_table_group_get_mouse_over (table->group, row, col);
}
/**
diff --git a/widgets/table/e-table.h b/widgets/table/e-table.h
index 1a681e9eca..6b2a698d5c 100644
--- a/widgets/table/e-table.h
+++ b/widgets/table/e-table.h
@@ -282,7 +282,7 @@ void e_table_get_cell_at (ETable *table,
int y,
int *row_return,
int *col_return);
-void e_table_get_mouse_over_cell (ETable *table, int x, int y, int *row, int *col);
+void e_table_get_mouse_over_cell (ETable *table, int *row, int *col);
void e_table_get_cell_geometry (ETable *table,
int row,
int col,