aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-07-04 06:27:25 +0800
committerChris Lahey <clahey@src.gnome.org>2000-07-04 06:27:25 +0800
commite59563eb7d09bfcdbe80bf707c74afce82f04595 (patch)
treedfec204d8bad93d104e9875919087a88757b236c /widgets
parent40e24cdab6d294af61ca54a96b0b901181dc7751 (diff)
downloadgsoc2013-evolution-e59563eb7d09bfcdbe80bf707c74afce82f04595.tar
gsoc2013-evolution-e59563eb7d09bfcdbe80bf707c74afce82f04595.tar.gz
gsoc2013-evolution-e59563eb7d09bfcdbe80bf707c74afce82f04595.tar.bz2
gsoc2013-evolution-e59563eb7d09bfcdbe80bf707c74afce82f04595.tar.lz
gsoc2013-evolution-e59563eb7d09bfcdbe80bf707c74afce82f04595.tar.xz
gsoc2013-evolution-e59563eb7d09bfcdbe80bf707c74afce82f04595.tar.zst
gsoc2013-evolution-e59563eb7d09bfcdbe80bf707c74afce82f04595.zip
Added a reflow_compare callback and did removal if you do shift-click on a
2000-07-03 Christopher James Lahey <clahey@helixcode.com> * e-table-item.c: Added a reflow_compare callback and did removal if you do shift-click on a selected row that's not the cursor. svn path=/trunk/; revision=3873
Diffstat (limited to 'widgets')
-rw-r--r--widgets/e-table/ChangeLog5
-rw-r--r--widgets/e-table/e-table-item.c35
-rw-r--r--widgets/table/e-table-item.c35
3 files changed, 65 insertions, 10 deletions
diff --git a/widgets/e-table/ChangeLog b/widgets/e-table/ChangeLog
index 12235123a3..b515364c3c 100644
--- a/widgets/e-table/ChangeLog
+++ b/widgets/e-table/ChangeLog
@@ -1,3 +1,8 @@
+2000-07-03 Christopher James Lahey <clahey@helixcode.com>
+
+ * e-table-item.c: Added a reflow_compare callback and did removal
+ if you do shift-click on a selected row that's not the cursor.
+
2000-06-29 Christopher James Lahey <clahey@helixcode.com>
* e-table-click-to-add.c: Made this appear a bit better.
diff --git a/widgets/e-table/e-table-item.c b/widgets/e-table/e-table-item.c
index 6bf8bb702b..405bf20cb7 100644
--- a/widgets/e-table/e-table-item.c
+++ b/widgets/e-table/e-table-item.c
@@ -62,6 +62,7 @@ static int eti_row_height (ETableItem *eti, int row);
static void e_table_item_unselect_row (ETableItem *eti, int row);
static void e_table_item_select_row (ETableItem *eti, int row);
static void eti_selection (GnomeCanvasItem *item, int flags, gpointer user_data);
+static int eti_selection_compare (GnomeCanvasItem *item, gpointer data1, gpointer data2, int flags);
static void e_table_item_focus (ETableItem *eti, int col, int row, gboolean add_selection);
static void
eti_request_region_show (ETableItem *eti,
@@ -894,6 +895,7 @@ eti_init (GnomeCanvasItem *item)
e_canvas_item_set_reflow_callback (GNOME_CANVAS_ITEM (eti), eti_reflow);
e_canvas_item_set_selection_callback (GNOME_CANVAS_ITEM (eti), eti_selection);
+ e_canvas_item_set_selection_compare_callback (GNOME_CANVAS_ITEM (eti), eti_selection_compare);
}
#define gray50_width 2
@@ -1239,8 +1241,7 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e)
gint return_val = TRUE;
switch (e->type){
- case GDK_BUTTON_PRESS:
- case GDK_BUTTON_RELEASE: {
+ case GDK_BUTTON_PRESS: {
double x1, y1;
int col, row;
gint shifted = e->button.state & GDK_SHIFT_MASK;
@@ -1258,11 +1259,21 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e)
/*
* Focus the cell, and select the row
*/
- e_table_item_leave_edit (eti);
- e_table_item_focus (eti, col, view_to_model_row(eti, row), shifted);
+ if (e_table_item_is_row_selected(eti, view_to_model_row(eti, row))) {
+ int nums[2];
+ e_table_item_leave_edit (eti);
+ nums[0] = view_to_model_row(eti, row);
+ nums[1] = 0;
+ e_canvas_item_remove_selection(GNOME_CANVAS_ITEM(eti), nums);
+ } else {
+ e_table_item_leave_edit (eti);
+ e_table_item_focus (eti, col, view_to_model_row(eti, row), shifted);
+ }
}
if (eti->cursor_row == view_to_model_row(eti, row) && eti->cursor_col == col){
+
+ e_table_item_focus (eti, col, view_to_model_row(eti, row), shifted);
ecol = e_table_header_get_column (eti->header, col);
ecell_view = eti->cell_views [col];
@@ -1270,7 +1281,7 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e)
/*
* Adjust the event positions
*/
- e->button.x = x1;
+ e->button.x = x1;
e->button.y = y1;
e_cell_event (ecell_view, e, ecol->col_idx, col, row);
@@ -1682,6 +1693,20 @@ eti_selection (GnomeCanvasItem *item, int flags, gpointer data)
}
}
+static gint
+eti_selection_compare (GnomeCanvasItem *item, gpointer data1, gpointer data2, int flags)
+{
+ int *val1 = (int *) data1;
+ int *val2 = (int *) data2;
+ if (*val1 < *val2)
+ return -1;
+ else if (*val1 == *val2)
+ return 0;
+ else
+ return 1;
+}
+
+
void
e_table_item_enter_edit (ETableItem *eti, int col, int row)
{
diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c
index 6bf8bb702b..405bf20cb7 100644
--- a/widgets/table/e-table-item.c
+++ b/widgets/table/e-table-item.c
@@ -62,6 +62,7 @@ static int eti_row_height (ETableItem *eti, int row);
static void e_table_item_unselect_row (ETableItem *eti, int row);
static void e_table_item_select_row (ETableItem *eti, int row);
static void eti_selection (GnomeCanvasItem *item, int flags, gpointer user_data);
+static int eti_selection_compare (GnomeCanvasItem *item, gpointer data1, gpointer data2, int flags);
static void e_table_item_focus (ETableItem *eti, int col, int row, gboolean add_selection);
static void
eti_request_region_show (ETableItem *eti,
@@ -894,6 +895,7 @@ eti_init (GnomeCanvasItem *item)
e_canvas_item_set_reflow_callback (GNOME_CANVAS_ITEM (eti), eti_reflow);
e_canvas_item_set_selection_callback (GNOME_CANVAS_ITEM (eti), eti_selection);
+ e_canvas_item_set_selection_compare_callback (GNOME_CANVAS_ITEM (eti), eti_selection_compare);
}
#define gray50_width 2
@@ -1239,8 +1241,7 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e)
gint return_val = TRUE;
switch (e->type){
- case GDK_BUTTON_PRESS:
- case GDK_BUTTON_RELEASE: {
+ case GDK_BUTTON_PRESS: {
double x1, y1;
int col, row;
gint shifted = e->button.state & GDK_SHIFT_MASK;
@@ -1258,11 +1259,21 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e)
/*
* Focus the cell, and select the row
*/
- e_table_item_leave_edit (eti);
- e_table_item_focus (eti, col, view_to_model_row(eti, row), shifted);
+ if (e_table_item_is_row_selected(eti, view_to_model_row(eti, row))) {
+ int nums[2];
+ e_table_item_leave_edit (eti);
+ nums[0] = view_to_model_row(eti, row);
+ nums[1] = 0;
+ e_canvas_item_remove_selection(GNOME_CANVAS_ITEM(eti), nums);
+ } else {
+ e_table_item_leave_edit (eti);
+ e_table_item_focus (eti, col, view_to_model_row(eti, row), shifted);
+ }
}
if (eti->cursor_row == view_to_model_row(eti, row) && eti->cursor_col == col){
+
+ e_table_item_focus (eti, col, view_to_model_row(eti, row), shifted);
ecol = e_table_header_get_column (eti->header, col);
ecell_view = eti->cell_views [col];
@@ -1270,7 +1281,7 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e)
/*
* Adjust the event positions
*/
- e->button.x = x1;
+ e->button.x = x1;
e->button.y = y1;
e_cell_event (ecell_view, e, ecol->col_idx, col, row);
@@ -1682,6 +1693,20 @@ eti_selection (GnomeCanvasItem *item, int flags, gpointer data)
}
}
+static gint
+eti_selection_compare (GnomeCanvasItem *item, gpointer data1, gpointer data2, int flags)
+{
+ int *val1 = (int *) data1;
+ int *val2 = (int *) data2;
+ if (*val1 < *val2)
+ return -1;
+ else if (*val1 == *val2)
+ return 0;
+ else
+ return 1;
+}
+
+
void
e_table_item_enter_edit (ETableItem *eti, int col, int row)
{