aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/e-table
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-06-21 12:48:58 +0800
committerChris Lahey <clahey@src.gnome.org>2000-06-21 12:48:58 +0800
commite1416310daf21611b8c54823a10a7121140383bb (patch)
treeea49a3e6e1b9dd76779c144819358d675bcad33f /widgets/e-table
parent85c6449e90f4b61cee33aae16962d9bea86ab53a (diff)
downloadgsoc2013-evolution-e1416310daf21611b8c54823a10a7121140383bb.tar
gsoc2013-evolution-e1416310daf21611b8c54823a10a7121140383bb.tar.gz
gsoc2013-evolution-e1416310daf21611b8c54823a10a7121140383bb.tar.bz2
gsoc2013-evolution-e1416310daf21611b8c54823a10a7121140383bb.tar.lz
gsoc2013-evolution-e1416310daf21611b8c54823a10a7121140383bb.tar.xz
gsoc2013-evolution-e1416310daf21611b8c54823a10a7121140383bb.tar.zst
gsoc2013-evolution-e1416310daf21611b8c54823a10a7121140383bb.zip
Fix a minor warning.
2000-06-20 Christopher James Lahey <clahey@helixcode.com> * e-table-group-leaf.c: Fix a minor warning. * e-table-item.c: Add to the selection if shift is held down. Show cursor when changing sort (or if table changes majorly.) svn path=/trunk/; revision=3667
Diffstat (limited to 'widgets/e-table')
-rw-r--r--widgets/e-table/ChangeLog7
-rw-r--r--widgets/e-table/e-table-group-leaf.c2
-rw-r--r--widgets/e-table/e-table-item.c26
3 files changed, 27 insertions, 8 deletions
diff --git a/widgets/e-table/ChangeLog b/widgets/e-table/ChangeLog
index 4c7f1ef6f8..0c690320eb 100644
--- a/widgets/e-table/ChangeLog
+++ b/widgets/e-table/ChangeLog
@@ -1,5 +1,12 @@
2000-06-20 Christopher James Lahey <clahey@helixcode.com>
+ * e-table-group-leaf.c: Fix a minor warning.
+
+ * e-table-item.c: Add to the selection if shift is held down.
+ Show cursor when changing sort (or if table changes majorly.)
+
+2000-06-20 Christopher James Lahey <clahey@helixcode.com>
+
* e-table-defines.h: Fix HEADER_PADDING.
2000-06-20 Christopher James Lahey <clahey@helixcode.com>
diff --git a/widgets/e-table/e-table-group-leaf.c b/widgets/e-table/e-table-group-leaf.c
index ea3400ceb9..e16a3d5d6d 100644
--- a/widgets/e-table/e-table-group-leaf.c
+++ b/widgets/e-table/e-table-group-leaf.c
@@ -217,7 +217,7 @@ static void
etgl_select_row (ETableGroup *etg, gint row)
{
ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg);
- gnome_canvas_item_set(GTK_OBJECT(etgl->item),
+ gnome_canvas_item_set(GNOME_CANVAS_ITEM(etgl->item),
"cursor_row", row,
NULL);
}
diff --git a/widgets/e-table/e-table-item.c b/widgets/e-table/e-table-item.c
index 8f0adc29d8..3f60485cbe 100644
--- a/widgets/e-table/e-table-item.c
+++ b/widgets/e-table/e-table-item.c
@@ -62,7 +62,11 @@ 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 void e_table_item_focus (ETableItem *eti, int col, int row);
+static void e_table_item_focus (ETableItem *eti, int col, int row, gboolean add_selection);
+static void
+eti_request_region_show (ETableItem *eti,
+ int start_col, int start_row,
+ int end_col, int end_row);
#define ETI_ROW_HEIGHT(eti,row) ((eti)->height_cache && (eti)->height_cache[(row)] != -1 ? (eti)->height_cache[(row)] : eti_row_height((eti),(row)))
static gint
@@ -522,6 +526,7 @@ eti_item_region_redraw (ETableItem *eti, int x0, int y0, int x1, int y1)
static void
eti_table_model_changed (ETableModel *table_model, ETableItem *eti)
{
+ int view_row;
eti->rows = e_table_model_row_count (eti->table_model);
free_height_cache(eti);
@@ -530,6 +535,9 @@ eti_table_model_changed (ETableModel *table_model, ETableItem *eti)
e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (eti));
eti->needs_redraw = 1;
gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti));
+ view_row = model_to_view_row(eti, eti->cursor_row);
+ if (view_row >= 0 && eti->cursor_col >= 0)
+ eti_request_region_show (eti, eti->cursor_col, view_row, eti->cursor_col, view_row);
}
/*
@@ -813,7 +821,7 @@ eti_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (eti));
break;
case ARG_CURSOR_ROW:
- e_table_item_focus (eti, eti->cursor_col != -1 ? eti->cursor_col : 0, view_to_model_row(eti, GTK_VALUE_INT (*arg)));
+ e_table_item_focus (eti, eti->cursor_col != -1 ? eti->cursor_col : 0, view_to_model_row(eti, GTK_VALUE_INT (*arg)), FALSE);
break;
}
eti->needs_redraw = 1;
@@ -1191,7 +1199,7 @@ static void
eti_cursor_move (ETableItem *eti, gint row, gint column)
{
e_table_item_leave_edit (eti);
- e_table_item_focus (eti, column, view_to_model_row(eti, row));
+ e_table_item_focus (eti, column, view_to_model_row(eti, row), FALSE);
}
static void
@@ -1232,6 +1240,7 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e)
case GDK_BUTTON_RELEASE: {
double x1, y1;
int col, row;
+ gint shifted = e->button.state & GDK_SHIFT_MASK;
switch (e->button.button) {
case 1: /* Fall through. */
@@ -1247,7 +1256,7 @@ 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));
+ 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){
@@ -1545,11 +1554,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));
+ e_table_item_focus(eti, col, view_to_model_row(eti, row), FALSE);
}
static void
-e_table_item_focus (ETableItem *eti, int col, int row)
+e_table_item_focus (ETableItem *eti, int col, int row, gboolean add_selection)
{
g_return_if_fail (eti != NULL);
g_return_if_fail (E_IS_TABLE_ITEM (eti));
@@ -1567,7 +1576,10 @@ e_table_item_focus (ETableItem *eti, int col, int row)
nums = g_new(int, 2);
nums[0] = row;
nums[1] = col;
- e_canvas_item_set_cursor(GNOME_CANVAS_ITEM(eti), nums);
+ if (add_selection)
+ e_canvas_item_add_selection(GNOME_CANVAS_ITEM(eti), nums);
+ else
+ e_canvas_item_set_cursor(GNOME_CANVAS_ITEM(eti), nums);
}
}