aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-08-04 22:14:44 +0800
committerChris Lahey <clahey@src.gnome.org>2000-08-04 22:14:44 +0800
commit660a75cc995f416ecc018b6ee278582651240631 (patch)
tree072f90be0799fef5baf18e87383fbbd9155cf343
parentce5a8e3224fad1c20760809198a508e28eeb4c04 (diff)
downloadgsoc2013-evolution-660a75cc995f416ecc018b6ee278582651240631.tar
gsoc2013-evolution-660a75cc995f416ecc018b6ee278582651240631.tar.gz
gsoc2013-evolution-660a75cc995f416ecc018b6ee278582651240631.tar.bz2
gsoc2013-evolution-660a75cc995f416ecc018b6ee278582651240631.tar.lz
gsoc2013-evolution-660a75cc995f416ecc018b6ee278582651240631.tar.xz
gsoc2013-evolution-660a75cc995f416ecc018b6ee278582651240631.tar.zst
gsoc2013-evolution-660a75cc995f416ecc018b6ee278582651240631.zip
Made drag events calculate a row and column and signal that information.
2000-08-04 Christopher James Lahey <clahey@helixcode.com> * e-table-group-container.c, e-table-group-leaf.c, e-table-group.c, e-table-group.h, e-table-item.c, e-table-item.h: Made drag events calculate a row and column and signal that information. * e-table-selection-model.c, e-table-selection-model.h: Changed do_something to take a GdkModifierType. svn path=/trunk/; revision=4529
-rw-r--r--widgets/e-table/ChangeLog10
-rw-r--r--widgets/e-table/e-table-group-container.c26
-rw-r--r--widgets/e-table/e-table-group-leaf.c8
-rw-r--r--widgets/e-table/e-table-group.c11
-rw-r--r--widgets/e-table/e-table-group.h6
-rw-r--r--widgets/e-table/e-table-item.c30
-rw-r--r--widgets/e-table/e-table-item.h38
-rw-r--r--widgets/e-table/e-table-selection-model.c9
-rw-r--r--widgets/e-table/e-table-selection-model.h3
-rw-r--r--widgets/table/e-table-group-container.c26
-rw-r--r--widgets/table/e-table-group-leaf.c8
-rw-r--r--widgets/table/e-table-group.c11
-rw-r--r--widgets/table/e-table-group.h6
-rw-r--r--widgets/table/e-table-item.c30
-rw-r--r--widgets/table/e-table-item.h38
-rw-r--r--widgets/table/e-table-selection-model.c9
-rw-r--r--widgets/table/e-table-selection-model.h3
17 files changed, 208 insertions, 64 deletions
diff --git a/widgets/e-table/ChangeLog b/widgets/e-table/ChangeLog
index aa46b56441..c71a663f88 100644
--- a/widgets/e-table/ChangeLog
+++ b/widgets/e-table/ChangeLog
@@ -1,3 +1,13 @@
+2000-08-04 Christopher James Lahey <clahey@helixcode.com>
+
+ * e-table-group-container.c, e-table-group-leaf.c,
+ e-table-group.c, e-table-group.h, e-table-item.c, e-table-item.h:
+ Made drag events calculate a row and column and signal that
+ information.
+
+ * e-table-selection-model.c, e-table-selection-model.h: Changed
+ do_something to take a GdkModifierType.
+
2000-08-02 Christopher James Lahey <clahey@helixcode.com>
* e-table-item.c, e-table-item.h: Add a handler for
diff --git a/widgets/e-table/e-table-group-container.c b/widgets/e-table/e-table-group-container.c
index f3788f154f..dbf492d091 100644
--- a/widgets/e-table/e-table-group-container.c
+++ b/widgets/e-table/e-table-group-container.c
@@ -542,6 +542,31 @@ etgc_get_focus_column (ETableGroup *etg)
return 0;
}
+static void
+etgc_compute_location (ETableGroup *etg, int *x, int *y, int *row, int *col)
+{
+ ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg);
+
+ if (row)
+ *row = -1;
+ if (col)
+ *col = -1;
+
+ *x -= GROUP_INDENT;
+ *y -= TITLE_HEIGHT;
+
+ if (*x >= 0 && *y >= 0 && etgc->children) {
+ 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_location (child, x, y, row, col);
+ if ((*row != -1) && (*col != -1))
+ return;
+ }
+ }
+}
static void etgc_thaw (ETableGroup *etg)
{
@@ -684,6 +709,7 @@ etgc_class_init (GtkObjectClass *object_class)
e_group_class->get_cursor_row = etgc_get_cursor_row;
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;
gtk_object_add_arg_type ("ETableGroupContainer::drawgrid", GTK_TYPE_BOOL,
GTK_ARG_WRITABLE, ARG_TABLE_DRAW_GRID);
diff --git a/widgets/e-table/e-table-group-leaf.c b/widgets/e-table/e-table-group-leaf.c
index f6b540cdae..fa52e91d9d 100644
--- a/widgets/e-table/e-table-group-leaf.c
+++ b/widgets/e-table/e-table-group-leaf.c
@@ -240,6 +240,13 @@ etgl_get_printable (ETableGroup *etg)
}
static void
+etgl_compute_location (ETableGroup *etg, int *x, int *y, int *row, int *col)
+{
+ ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg);
+ e_table_item_compute_location (etgl->item, x, y, row, col);
+}
+
+static void
etgl_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
{
ETableGroup *etg = E_TABLE_GROUP (object);
@@ -362,6 +369,7 @@ etgl_class_init (GtkObjectClass *object_class)
e_group_class->get_cursor_row = etgl_get_cursor_row;
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;
gtk_object_add_arg_type ("ETableGroupLeaf::drawgrid", GTK_TYPE_BOOL,
GTK_ARG_WRITABLE, ARG_TABLE_DRAW_GRID);
diff --git a/widgets/e-table/e-table-group.c b/widgets/e-table/e-table-group.c
index d3c6e2e08d..b47d01e151 100644
--- a/widgets/e-table/e-table-group.c
+++ b/widgets/e-table/e-table-group.c
@@ -239,6 +239,16 @@ e_table_group_get_printable (ETableGroup *etg)
}
void
+e_table_group_compute_location (ETableGroup *etg, int *x, int *y, int *row, int *col)
+{
+ g_return_if_fail (etg != NULL);
+ g_return_if_fail (E_IS_TABLE_GROUP (etg));
+
+ if (ETG_CLASS (etg)->compute_location)
+ ETG_CLASS (etg)->compute_location (etg, x, y, row, col);
+}
+
+void
e_table_group_cursor_change (ETableGroup *e_table_group, gint row)
{
g_return_if_fail (e_table_group != NULL);
@@ -355,6 +365,7 @@ etg_class_init (GtkObjectClass *object_class)
klass->get_focus = etg_get_focus;
klass->get_ecol = NULL;
klass->get_printable = NULL;
+ klass->compute_location = NULL;
etg_parent_class = gtk_type_class (PARENT_TYPE);
diff --git a/widgets/e-table/e-table-group.h b/widgets/e-table/e-table-group.h
index f4fd25a779..7714e18e9a 100644
--- a/widgets/e-table/e-table-group.h
+++ b/widgets/e-table/e-table-group.h
@@ -64,6 +64,7 @@ typedef struct {
gint (*get_focus_column) (ETableGroup *etg);
ETableCol *(*get_ecol) (ETableGroup *etg);
EPrintable *(*get_printable) (ETableGroup *etg);
+ void (*compute_location) (ETableGroup *etg, int *x, int *y, int *row, int *col);
} ETableGroupClass;
@@ -89,6 +90,11 @@ gint e_table_group_get_focus_column (ETableGroup *etg);
ETableHeader *e_table_group_get_header (ETableGroup *etg);
ETableCol *e_table_group_get_ecol (ETableGroup *etg);
EPrintable *e_table_group_get_printable (ETableGroup *etg);
+void e_table_group_compute_location (ETableGroup *etg,
+ int *x,
+ int *y,
+ int *row,
+ int *col);
ETableGroup *e_table_group_new (GnomeCanvasGroup *parent,
ETableHeader *full_header,
diff --git a/widgets/e-table/e-table-item.c b/widgets/e-table/e-table-item.c
index 1ecd119133..baee6586f7 100644
--- a/widgets/e-table/e-table-item.c
+++ b/widgets/e-table/e-table-item.c
@@ -58,7 +58,7 @@ enum {
static int eti_get_height (ETableItem *eti);
static int eti_get_minimum_width (ETableItem *eti);
static int eti_row_height (ETableItem *eti, int row);
-static void e_table_item_focus (ETableItem *eti, int col, int row, gboolean shift_p, gboolean ctrl_p);
+static void e_table_item_focus (ETableItem *eti, int col, int row, GdkModifierType state);
static void eti_cursor_change (ETableSelectionModel *selection, int row, int col, ETableItem *eti);
static void eti_selection_change (ETableSelectionModel *selection, ETableItem *eti);
#if 0
@@ -924,7 +924,7 @@ eti_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
"cursor_col", &cursor_col,
NULL);
- e_table_item_focus (eti, cursor_col != -1 ? cursor_col : 0, view_to_model_row(eti, GTK_VALUE_INT (*arg)), FALSE, FALSE);
+ e_table_item_focus (eti, cursor_col != -1 ? cursor_col : 0, view_to_model_row(eti, GTK_VALUE_INT (*arg)), 0);
break;
}
eti->needs_redraw = 1;
@@ -1314,7 +1314,7 @@ static void
eti_cursor_move (ETableItem *eti, gint row, gint column)
{
e_table_item_leave_edit (eti);
- e_table_item_focus (eti, view_to_model_col(eti, column), view_to_model_row(eti, row), FALSE, FALSE);
+ e_table_item_focus (eti, view_to_model_col(eti, column), view_to_model_row(eti, row), 0);
}
static void
@@ -1377,8 +1377,6 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e)
case GDK_BUTTON_PRESS: {
double x1, y1;
int col, row;
- gint shifted = e->button.state & GDK_SHIFT_MASK;
- gint ctrled = e->button.state & GDK_CONTROL_MASK;
gint cursor_row, cursor_col;
e_canvas_item_grab_focus(GNOME_CANVAS_ITEM(eti));
@@ -1391,7 +1389,7 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e)
if (!find_cell (eti, e->button.x, e->button.y, &col, &row, &x1, &y1))
return TRUE;
- e_table_selection_model_do_something(eti->selection, view_to_model_row(eti, row), view_to_model_col(eti, col), shifted, ctrled);
+ e_table_selection_model_do_something(eti->selection, view_to_model_row(eti, row), view_to_model_col(eti, col), e->button.state);
gtk_object_get(GTK_OBJECT(eti->selection),
"cursor_row", &cursor_row,
@@ -1769,11 +1767,11 @@ e_table_item_get_type (void)
void
e_table_item_set_cursor (ETableItem *eti, int col, int row)
{
- e_table_item_focus(eti, col, view_to_model_row(eti, row), FALSE, FALSE);
+ e_table_item_focus(eti, col, view_to_model_row(eti, row), 0);
}
static void
-e_table_item_focus (ETableItem *eti, int col, int row, gboolean shift_p, gboolean ctrl_p)
+e_table_item_focus (ETableItem *eti, int col, int row, GdkModifierType state)
{
g_return_if_fail (eti != NULL);
g_return_if_fail (E_IS_TABLE_ITEM (eti));
@@ -1789,8 +1787,7 @@ e_table_item_focus (ETableItem *eti, int col, int row, gboolean shift_p, gboolea
if (row != -1) {
e_table_selection_model_do_something(eti->selection,
row, col,
- shift_p,
- ctrl_p);
+ state);
}
}
@@ -1886,6 +1883,19 @@ e_table_item_leave_edit (ETableItem *eti)
col, row, edit_ctx);
}
+void
+e_table_item_compute_location (ETableItem *eti,
+ int *x,
+ int *y,
+ int *row,
+ int *col)
+{
+ if (!find_cell (eti, *x, *y, col, row, NULL, NULL)) {
+ *y -= eti_get_height(eti);
+ }
+
+}
+
typedef struct {
ETableItem *item;
int rows_printed;
diff --git a/widgets/e-table/e-table-item.h b/widgets/e-table/e-table-item.h
index b6b441c9d4..2d81bca758 100644
--- a/widgets/e-table/e-table-item.h
+++ b/widgets/e-table/e-table-item.h
@@ -108,30 +108,36 @@ GtkType e_table_item_get_type (void);
/*
* Focus
*/
-void e_table_item_set_cursor (ETableItem *eti, int col, int row);
+void e_table_item_set_cursor (ETableItem *eti, int col, int row);
-gint e_table_item_get_focused_column (ETableItem *eti);
+gint e_table_item_get_focused_column (ETableItem *eti);
/*
* Handling the selection
*/
-gboolean e_table_item_is_row_selected (ETableItem *e_table_Item,
- int row);
+gboolean e_table_item_is_row_selected (ETableItem *e_table_Item,
+ int row);
void e_table_item_selected_row_foreach (ETableItem *eti,
ETableForeachFunc func,
gpointer closure);
-
-void e_table_item_leave_edit (ETableItem *eti);
-void e_table_item_enter_edit (ETableItem *eti, int col, int row);
-
-void e_table_item_redraw_range (ETableItem *eti,
- int start_col, int start_row,
- int end_col, int end_row);
-
-EPrintable *e_table_item_get_printable (ETableItem *eti);
-void e_table_item_print_height (ETableItem *eti,
- GnomePrintContext *context,
- gdouble width);
+
+void e_table_item_leave_edit (ETableItem *eti);
+void e_table_item_enter_edit (ETableItem *eti, int col, int row);
+
+void e_table_item_redraw_range (ETableItem *eti,
+ int start_col, int start_row,
+ int end_col, int end_row);
+
+EPrintable *e_table_item_get_printable (ETableItem *eti);
+void e_table_item_print_height (ETableItem *eti,
+ GnomePrintContext *context,
+ gdouble width);
+void e_table_item_compute_location (ETableItem *eti,
+ int *x,
+ int *y,
+ int *row,
+ int *col);
+
#endif /* _E_TABLE_ITEM_H_ */
diff --git a/widgets/e-table/e-table-selection-model.c b/widgets/e-table/e-table-selection-model.c
index 6dbba501a1..9bd3cb38ac 100644
--- a/widgets/e-table/e-table-selection-model.c
+++ b/widgets/e-table/e-table-selection-model.c
@@ -195,11 +195,11 @@ etsm_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
break;
case ARG_CURSOR_ROW:
- e_table_selection_model_do_something(etsm, GTK_VALUE_INT(*arg), etsm->cursor_col, FALSE, FALSE);
+ e_table_selection_model_do_something(etsm, GTK_VALUE_INT(*arg), etsm->cursor_col, 0);
break;
case ARG_CURSOR_COL:
- e_table_selection_model_do_something(etsm, etsm->cursor_row, GTK_VALUE_INT(*arg), FALSE, FALSE);
+ e_table_selection_model_do_something(etsm, etsm->cursor_row, GTK_VALUE_INT(*arg), 0);
break;
}
}
@@ -321,9 +321,10 @@ change_selection(ETableSelectionModel *selection, int start, int end, gboolean g
void e_table_selection_model_do_something (ETableSelectionModel *selection,
guint row,
guint col,
- gboolean shift_p,
- gboolean ctrl_p)
+ GdkModifierType state)
{
+ gint shift_p = state & GDK_SHIFT_MASK;
+ gint ctrl_p = state & GDK_CONTROL_MASK;
if (selection->row_count < 0) {
if (selection->model) {
selection->row_count = e_table_model_row_count(selection->model);
diff --git a/widgets/e-table/e-table-selection-model.h b/widgets/e-table/e-table-selection-model.h
index a0493c6c02..a1ccb41353 100644
--- a/widgets/e-table/e-table-selection-model.h
+++ b/widgets/e-table/e-table-selection-model.h
@@ -55,8 +55,7 @@ void e_table_selection_model_foreach (ETableSelectionModel *
void e_table_selection_model_do_something (ETableSelectionModel *selection,
guint row,
guint col,
- gboolean shift_p,
- gboolean ctrl_p);
+ GdkModifierType state);
void e_table_selection_model_clear (ETableSelectionModel *selection);
ETableSelectionModel *e_table_selection_model_new (void);
diff --git a/widgets/table/e-table-group-container.c b/widgets/table/e-table-group-container.c
index f3788f154f..dbf492d091 100644
--- a/widgets/table/e-table-group-container.c
+++ b/widgets/table/e-table-group-container.c
@@ -542,6 +542,31 @@ etgc_get_focus_column (ETableGroup *etg)
return 0;
}
+static void
+etgc_compute_location (ETableGroup *etg, int *x, int *y, int *row, int *col)
+{
+ ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg);
+
+ if (row)
+ *row = -1;
+ if (col)
+ *col = -1;
+
+ *x -= GROUP_INDENT;
+ *y -= TITLE_HEIGHT;
+
+ if (*x >= 0 && *y >= 0 && etgc->children) {
+ 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_location (child, x, y, row, col);
+ if ((*row != -1) && (*col != -1))
+ return;
+ }
+ }
+}
static void etgc_thaw (ETableGroup *etg)
{
@@ -684,6 +709,7 @@ etgc_class_init (GtkObjectClass *object_class)
e_group_class->get_cursor_row = etgc_get_cursor_row;
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;
gtk_object_add_arg_type ("ETableGroupContainer::drawgrid", GTK_TYPE_BOOL,
GTK_ARG_WRITABLE, ARG_TABLE_DRAW_GRID);
diff --git a/widgets/table/e-table-group-leaf.c b/widgets/table/e-table-group-leaf.c
index f6b540cdae..fa52e91d9d 100644
--- a/widgets/table/e-table-group-leaf.c
+++ b/widgets/table/e-table-group-leaf.c
@@ -240,6 +240,13 @@ etgl_get_printable (ETableGroup *etg)
}
static void
+etgl_compute_location (ETableGroup *etg, int *x, int *y, int *row, int *col)
+{
+ ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg);
+ e_table_item_compute_location (etgl->item, x, y, row, col);
+}
+
+static void
etgl_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
{
ETableGroup *etg = E_TABLE_GROUP (object);
@@ -362,6 +369,7 @@ etgl_class_init (GtkObjectClass *object_class)
e_group_class->get_cursor_row = etgl_get_cursor_row;
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;
gtk_object_add_arg_type ("ETableGroupLeaf::drawgrid", GTK_TYPE_BOOL,
GTK_ARG_WRITABLE, ARG_TABLE_DRAW_GRID);
diff --git a/widgets/table/e-table-group.c b/widgets/table/e-table-group.c
index d3c6e2e08d..b47d01e151 100644
--- a/widgets/table/e-table-group.c
+++ b/widgets/table/e-table-group.c
@@ -239,6 +239,16 @@ e_table_group_get_printable (ETableGroup *etg)
}
void
+e_table_group_compute_location (ETableGroup *etg, int *x, int *y, int *row, int *col)
+{
+ g_return_if_fail (etg != NULL);
+ g_return_if_fail (E_IS_TABLE_GROUP (etg));
+
+ if (ETG_CLASS (etg)->compute_location)
+ ETG_CLASS (etg)->compute_location (etg, x, y, row, col);
+}
+
+void
e_table_group_cursor_change (ETableGroup *e_table_group, gint row)
{
g_return_if_fail (e_table_group != NULL);
@@ -355,6 +365,7 @@ etg_class_init (GtkObjectClass *object_class)
klass->get_focus = etg_get_focus;
klass->get_ecol = NULL;
klass->get_printable = NULL;
+ klass->compute_location = NULL;
etg_parent_class = gtk_type_class (PARENT_TYPE);
diff --git a/widgets/table/e-table-group.h b/widgets/table/e-table-group.h
index f4fd25a779..7714e18e9a 100644
--- a/widgets/table/e-table-group.h
+++ b/widgets/table/e-table-group.h
@@ -64,6 +64,7 @@ typedef struct {
gint (*get_focus_column) (ETableGroup *etg);
ETableCol *(*get_ecol) (ETableGroup *etg);
EPrintable *(*get_printable) (ETableGroup *etg);
+ void (*compute_location) (ETableGroup *etg, int *x, int *y, int *row, int *col);
} ETableGroupClass;
@@ -89,6 +90,11 @@ gint e_table_group_get_focus_column (ETableGroup *etg);
ETableHeader *e_table_group_get_header (ETableGroup *etg);
ETableCol *e_table_group_get_ecol (ETableGroup *etg);
EPrintable *e_table_group_get_printable (ETableGroup *etg);
+void e_table_group_compute_location (ETableGroup *etg,
+ int *x,
+ int *y,
+ int *row,
+ int *col);
ETableGroup *e_table_group_new (GnomeCanvasGroup *parent,
ETableHeader *full_header,
diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c
index 1ecd119133..baee6586f7 100644
--- a/widgets/table/e-table-item.c
+++ b/widgets/table/e-table-item.c
@@ -58,7 +58,7 @@ enum {
static int eti_get_height (ETableItem *eti);
static int eti_get_minimum_width (ETableItem *eti);
static int eti_row_height (ETableItem *eti, int row);
-static void e_table_item_focus (ETableItem *eti, int col, int row, gboolean shift_p, gboolean ctrl_p);
+static void e_table_item_focus (ETableItem *eti, int col, int row, GdkModifierType state);
static void eti_cursor_change (ETableSelectionModel *selection, int row, int col, ETableItem *eti);
static void eti_selection_change (ETableSelectionModel *selection, ETableItem *eti);
#if 0
@@ -924,7 +924,7 @@ eti_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
"cursor_col", &cursor_col,
NULL);
- e_table_item_focus (eti, cursor_col != -1 ? cursor_col : 0, view_to_model_row(eti, GTK_VALUE_INT (*arg)), FALSE, FALSE);
+ e_table_item_focus (eti, cursor_col != -1 ? cursor_col : 0, view_to_model_row(eti, GTK_VALUE_INT (*arg)), 0);
break;
}
eti->needs_redraw = 1;
@@ -1314,7 +1314,7 @@ static void
eti_cursor_move (ETableItem *eti, gint row, gint column)
{
e_table_item_leave_edit (eti);
- e_table_item_focus (eti, view_to_model_col(eti, column), view_to_model_row(eti, row), FALSE, FALSE);
+ e_table_item_focus (eti, view_to_model_col(eti, column), view_to_model_row(eti, row), 0);
}
static void
@@ -1377,8 +1377,6 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e)
case GDK_BUTTON_PRESS: {
double x1, y1;
int col, row;
- gint shifted = e->button.state & GDK_SHIFT_MASK;
- gint ctrled = e->button.state & GDK_CONTROL_MASK;
gint cursor_row, cursor_col;
e_canvas_item_grab_focus(GNOME_CANVAS_ITEM(eti));
@@ -1391,7 +1389,7 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e)
if (!find_cell (eti, e->button.x, e->button.y, &col, &row, &x1, &y1))
return TRUE;
- e_table_selection_model_do_something(eti->selection, view_to_model_row(eti, row), view_to_model_col(eti, col), shifted, ctrled);
+ e_table_selection_model_do_something(eti->selection, view_to_model_row(eti, row), view_to_model_col(eti, col), e->button.state);
gtk_object_get(GTK_OBJECT(eti->selection),
"cursor_row", &cursor_row,
@@ -1769,11 +1767,11 @@ e_table_item_get_type (void)
void
e_table_item_set_cursor (ETableItem *eti, int col, int row)
{
- e_table_item_focus(eti, col, view_to_model_row(eti, row), FALSE, FALSE);
+ e_table_item_focus(eti, col, view_to_model_row(eti, row), 0);
}
static void
-e_table_item_focus (ETableItem *eti, int col, int row, gboolean shift_p, gboolean ctrl_p)
+e_table_item_focus (ETableItem *eti, int col, int row, GdkModifierType state)
{
g_return_if_fail (eti != NULL);
g_return_if_fail (E_IS_TABLE_ITEM (eti));
@@ -1789,8 +1787,7 @@ e_table_item_focus (ETableItem *eti, int col, int row, gboolean shift_p, gboolea
if (row != -1) {
e_table_selection_model_do_something(eti->selection,
row, col,
- shift_p,
- ctrl_p);
+ state);
}
}
@@ -1886,6 +1883,19 @@ e_table_item_leave_edit (ETableItem *eti)
col, row, edit_ctx);
}
+void
+e_table_item_compute_location (ETableItem *eti,
+ int *x,
+ int *y,
+ int *row,
+ int *col)
+{
+ if (!find_cell (eti, *x, *y, col, row, NULL, NULL)) {
+ *y -= eti_get_height(eti);
+ }
+
+}
+
typedef struct {
ETableItem *item;
int rows_printed;
diff --git a/widgets/table/e-table-item.h b/widgets/table/e-table-item.h
index b6b441c9d4..2d81bca758 100644
--- a/widgets/table/e-table-item.h
+++ b/widgets/table/e-table-item.h
@@ -108,30 +108,36 @@ GtkType e_table_item_get_type (void);
/*
* Focus
*/
-void e_table_item_set_cursor (ETableItem *eti, int col, int row);
+void e_table_item_set_cursor (ETableItem *eti, int col, int row);
-gint e_table_item_get_focused_column (ETableItem *eti);
+gint e_table_item_get_focused_column (ETableItem *eti);
/*
* Handling the selection
*/
-gboolean e_table_item_is_row_selected (ETableItem *e_table_Item,
- int row);
+gboolean e_table_item_is_row_selected (ETableItem *e_table_Item,
+ int row);
void e_table_item_selected_row_foreach (ETableItem *eti,
ETableForeachFunc func,
gpointer closure);
-
-void e_table_item_leave_edit (ETableItem *eti);
-void e_table_item_enter_edit (ETableItem *eti, int col, int row);
-
-void e_table_item_redraw_range (ETableItem *eti,
- int start_col, int start_row,
- int end_col, int end_row);
-
-EPrintable *e_table_item_get_printable (ETableItem *eti);
-void e_table_item_print_height (ETableItem *eti,
- GnomePrintContext *context,
- gdouble width);
+
+void e_table_item_leave_edit (ETableItem *eti);
+void e_table_item_enter_edit (ETableItem *eti, int col, int row);
+
+void e_table_item_redraw_range (ETableItem *eti,
+ int start_col, int start_row,
+ int end_col, int end_row);
+
+EPrintable *e_table_item_get_printable (ETableItem *eti);
+void e_table_item_print_height (ETableItem *eti,
+ GnomePrintContext *context,
+ gdouble width);
+void e_table_item_compute_location (ETableItem *eti,
+ int *x,
+ int *y,
+ int *row,
+ int *col);
+
#endif /* _E_TABLE_ITEM_H_ */
diff --git a/widgets/table/e-table-selection-model.c b/widgets/table/e-table-selection-model.c
index 6dbba501a1..9bd3cb38ac 100644
--- a/widgets/table/e-table-selection-model.c
+++ b/widgets/table/e-table-selection-model.c
@@ -195,11 +195,11 @@ etsm_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
break;
case ARG_CURSOR_ROW:
- e_table_selection_model_do_something(etsm, GTK_VALUE_INT(*arg), etsm->cursor_col, FALSE, FALSE);
+ e_table_selection_model_do_something(etsm, GTK_VALUE_INT(*arg), etsm->cursor_col, 0);
break;
case ARG_CURSOR_COL:
- e_table_selection_model_do_something(etsm, etsm->cursor_row, GTK_VALUE_INT(*arg), FALSE, FALSE);
+ e_table_selection_model_do_something(etsm, etsm->cursor_row, GTK_VALUE_INT(*arg), 0);
break;
}
}
@@ -321,9 +321,10 @@ change_selection(ETableSelectionModel *selection, int start, int end, gboolean g
void e_table_selection_model_do_something (ETableSelectionModel *selection,
guint row,
guint col,
- gboolean shift_p,
- gboolean ctrl_p)
+ GdkModifierType state)
{
+ gint shift_p = state & GDK_SHIFT_MASK;
+ gint ctrl_p = state & GDK_CONTROL_MASK;
if (selection->row_count < 0) {
if (selection->model) {
selection->row_count = e_table_model_row_count(selection->model);
diff --git a/widgets/table/e-table-selection-model.h b/widgets/table/e-table-selection-model.h
index a0493c6c02..a1ccb41353 100644
--- a/widgets/table/e-table-selection-model.h
+++ b/widgets/table/e-table-selection-model.h
@@ -55,8 +55,7 @@ void e_table_selection_model_foreach (ETableSelectionModel *
void e_table_selection_model_do_something (ETableSelectionModel *selection,
guint row,
guint col,
- gboolean shift_p,
- gboolean ctrl_p);
+ GdkModifierType state);
void e_table_selection_model_clear (ETableSelectionModel *selection);
ETableSelectionModel *e_table_selection_model_new (void);