aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2001-07-05 18:42:36 +0800
committerChris Lahey <clahey@src.gnome.org>2001-07-05 18:42:36 +0800
commit6d4840cae85e64b40af1a8da70fb600d3220c108 (patch)
tree029d1b2ab492ce7f8a90fa970ee4c52b15435532 /widgets
parent228991b3170bd7a2e824706818544d93b9406559 (diff)
downloadgsoc2013-evolution-6d4840cae85e64b40af1a8da70fb600d3220c108.tar.gz
gsoc2013-evolution-6d4840cae85e64b40af1a8da70fb600d3220c108.tar.zst
gsoc2013-evolution-6d4840cae85e64b40af1a8da70fb600d3220c108.zip
Changed the variable names here to make it clear that these are view model
2001-07-05 Christopher James Lahey <clahey@ximian.com> * e-table-item.c, e-table-item.h (find_cell): Changed the variable names here to make it clear that these are view model and row. (eti_event): Added click_count to make it so that if we get two clicks in different rows we don't send a double click event. (eti_event, view_to_model_row): Set row_guess in a few extra places. svn path=/trunk/; revision=10791
Diffstat (limited to 'widgets')
-rw-r--r--widgets/table/e-table-item.c71
-rw-r--r--widgets/table/e-table-item.h2
2 files changed, 52 insertions, 21 deletions
diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c
index cb8287d282..20c5d5bb36 100644
--- a/widgets/table/e-table-item.c
+++ b/widgets/table/e-table-item.c
@@ -116,9 +116,10 @@ view_to_model_row(ETableItem *eti, int row)
{
if (eti->uses_source_model) {
ETableSubset *etss = E_TABLE_SUBSET(eti->table_model);
- if (row >= 0 && row < etss->n_map)
+ if (row >= 0 && row < etss->n_map) {
+ eti->row_guess = row;
return etss->map_table[row];
- else
+ } else
return -1;
} else
return row;
@@ -1155,6 +1156,8 @@ eti_init (GnomeCanvasItem *item)
eti->width = 0;
eti->minimum_width = 0;
+ eti->click_count = 0;
+
eti->height_cache = NULL;
eti->height_cache_idle_id = 0;
eti->height_cache_idle_count = 0;
@@ -1505,7 +1508,7 @@ eti_point (GnomeCanvasItem *item, double x, double y, int cx, int cy,
}
static gboolean
-find_cell (ETableItem *eti, double x, double y, int *col_res, int *row_res, double *x1_res, double *y1_res)
+find_cell (ETableItem *eti, double x, double y, int *view_col_res, int *view_row_res, double *x1_res, double *y1_res)
{
const int cols = eti->cols;
const int rows = eti->rows;
@@ -1517,8 +1520,8 @@ find_cell (ETableItem *eti, double x, double y, int *col_res, int *row_res, doub
/* FIXME: this routine is inneficient, fix later */
if (eti->grabbed_col >= 0 && eti->grabbed_row >= 0) {
- *col_res = eti->grabbed_col;
- *row_res = eti->grabbed_row;
+ *view_col_res = eti->grabbed_col;
+ *view_row_res = eti->grabbed_row;
*x1_res = x - eti->x1 - e_table_header_col_diff (eti->header, 0, eti->grabbed_col);
*y1_res = y - eti->y1 - e_table_item_row_diff (eti, 0, eti->grabbed_row);
return TRUE;
@@ -1553,10 +1556,10 @@ find_cell (ETableItem *eti, double x, double y, int *col_res, int *row_res, doub
if (y <= y2)
break;
}
- *col_res = col;
+ *view_col_res = col;
if (x1_res)
*x1_res = x - x1;
- *row_res = row;
+ *view_row_res = row;
if (y1_res)
*y1_res = y - y1;
return TRUE;
@@ -1735,6 +1738,15 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e)
if (return_val)
return TRUE;
+ gtk_object_get(GTK_OBJECT(eti->selection),
+ "cursor_row", &cursor_row,
+ "cursor_col", &cursor_col,
+ NULL);
+
+ if (cursor_row != view_to_model_row(eti, row) || cursor_col != view_to_model_col(eti, col)) {
+ eti->click_count = 0;
+ }
+
e_selection_model_do_something(E_SELECTION_MODEL (eti->selection), view_to_model_row(eti, row), view_to_model_col(eti, col), button.state);
gtk_object_get(GTK_OBJECT(eti->selection),
@@ -1744,6 +1756,9 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e)
if (cursor_row == view_to_model_row(eti, row) && cursor_col == view_to_model_col(eti, col)){
+ eti->click_count ++;
+ eti->row_guess = row;
+
if ((!eti_editing(eti)) && e_table_model_is_cell_editable(eti->table_model, col, row)) {
e_table_item_enter_edit (eti, col, row);
}
@@ -1828,34 +1843,48 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e)
case GDK_2BUTTON_PRESS: {
int col, row;
+#if 0
+ double x1, y1;
+#endif
GdkEventButton button;
if (e->button.button == 5 ||
e->button.button == 4)
return FALSE;
- gnome_canvas_item_w2i (item, &e->button.x, &e->button.y);
+ /*
+ * click_count is so that if you click on two
+ * different rows we don't send a double click signal.
+ */
+
+ if (eti->click_count >= 2) {
+
+ gnome_canvas_item_w2i (item, &e->button.x, &e->button.y);
#if 0
- if (!find_cell (eti, e->button.x, e->button.y, &col, &row, &x1, &y1))
- return TRUE;
+ if (!find_cell (eti, e->button.x, e->button.y, &current_col, &current_row, &x1, &y1))
+ return TRUE;
#endif
- gtk_object_get(GTK_OBJECT(eti->selection),
- "cursor_row", &row,
- "cursor_col", &col,
- NULL);
+ gtk_object_get(GTK_OBJECT(eti->selection),
+ "cursor_row", &row,
+ "cursor_col", &col,
+ NULL);
+
+ button.x -= e_table_header_col_diff (eti->header, 0, model_to_view_col (eti, col));
+ button.y -= e_table_item_row_diff (eti, 0, model_to_view_row (eti, row));
#if 0
- button = *(GdkEventButton *)e;
- button.x = x1;
- button.y = y1;
+ button = *(GdkEventButton *)e;
+ button.x = x1;
+ button.y = y1;
#endif
- if (row != -1 && col != -1) {
- gtk_signal_emit (GTK_OBJECT (eti), eti_signals [DOUBLE_CLICK],
- row, col, &button);
- d(g_print("Double click\n"));
+ if (row != -1 && col != -1) {
+ gtk_signal_emit (GTK_OBJECT (eti), eti_signals [DOUBLE_CLICK],
+ row, col, &button);
+ d(g_print("Double click\n"));
+ }
}
break;
}
diff --git a/widgets/table/e-table-item.h b/widgets/table/e-table-item.h
index ff785e0068..87394dc26d 100644
--- a/widgets/table/e-table-item.h
+++ b/widgets/table/e-table-item.h
@@ -30,6 +30,8 @@ typedef struct {
int minimum_width, width, height;
int cols, rows;
+
+ int click_count;
/*
* Ids for the signals we connect to
href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/commit/misc?h=gnome-3.28&id=9e5a63cd71947b5363d11ae865fc5330aad15528'>Trim the headers in the ports I maintain.eadler2012-10-064-21/+3 * Don't try to display a file that doesn't exist.des2012-10-061-3/+0 * pkg-message was saying to add COMPAT_FREEBSD8 to kernel, this was supposed to begarga2012-10-052-9/+1 * Change headers of all ports maintained by me to new formatgarga2012-10-053-15/+0 * lower a bit more the minimal version to install it.bapt2012-10-043-6/+6 * Lower OSVERSION checking for compat[789]x. This was requested by bapt@ and igarga2012-10-043-3/+3 * KDE thumbnail generator for the CHM file format.makc2012-10-034-0/+28 * This port needs pkgconf.kwm2012-10-031-0/+1 * - Fix typos (LICENSE is correct form inside bsd.licenses.mk).az2012-10-031-1/+1 * Fix clang build.fjoe2012-10-021-0/+1 * - Update to 0.8.2olivierd2012-09-283-4/+7 * - Update to 17.12culot2012-09-252-10/+5 * - update to 1.7.0rm2012-09-233-10/+72 * - Reassign to the heap due to mail bouncestabthorpe2012-09-221-6/+2 * Deprecate a bunch a ports with no more public distfiles (thanks ehaupt's dist...bapt2012-09-213-0/+9 * Update to 1.2.3flo2012-09-214-6/+6 * - Fix with Tcl/Tk > 8.2 [1]beat2012-09-207-27/+42 * - use OPTIONS_DEFINEdinoex2012-09-171-11/+11 * Remove pointless header lines from ports I created once upon a time.naddy2012-09-161-5/+0 * Revert r302983. It cause another bug.sumikawa2012-09-142-50/+1 * - Update to 0.29sunpoet2012-09-142-4/+6 * - Update to 1.40.12sunpoet2012-09-142-3/+3 * Fix build with clang.zeising2012-09-131-0/+11 * Update to tzdata2012f:edwin2012-09-132-3/+3 * - Update MAINTAINER to my new FreeBSD.org addressjhale2012-09-131-1/+1 * Fix cut-and-paste error.linimon2012-09-121-1/+1 * Add compat9x after some people ask to itgarga2012-09-117-0/+127 * Update compat8x to 8.3-RELEASEgarga2012-09-113-8/+7 * - Move libxul 1.9.2 to www/libxul19beat2012-09-111-1/+1 * - Use OPTIONSngehaupt2012-09-091-13/+16 * - Update to 20120906sunpoet2012-09-082-3/+3 * Chase Emacs updatesashish2012-09-052-2/+2 * - Update to 1.3.1eadler2012-09-042-4/+10 * Fix bug: alt+h command input line not updatedfjoe2012-08-292-0/+11 * DAHDI 2.6.1 development version:fjoe2012-08-297-0/+243 * Fix CONFLICTS definition.fjoe2012-08-291-3/+1 * This port conflicts with dahdi-kmod26-*.fjoe2012-08-291-0/+2 * Fix portlint error: use a tab (not space) after a variable namefjoe2012-08-291-1/+1 * Update to 4.8.1.4.fjoe2012-08-292-4/+3 * Distfile got re-rolled, only difference is modification time onadamw2012-08-272-3/+3 * Fix URL for primary MASTER_SITE. Server was producing a botchedadamw2012-08-271-1/+1 * - Update to 20120719.001leeym2012-08-263-3/+5 * Fix build with clangbapt2012-08-241-0/+11 * Fix post r302141: The files in USE_RC_SUBR are already included in SUB_FILESdougb2012-08-24