aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table/e-table-item.c
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2001-12-05 05:03:28 +0800
committerChris Lahey <clahey@src.gnome.org>2001-12-05 05:03:28 +0800
commit410f3bc629f38cb76a5d16209a07e2c336ed1f9f (patch)
tree8ca2b834f5c5bff158d6e76ea2e27ef4826bf71c /widgets/table/e-table-item.c
parente508d293964edda19447e713a2503e3133e84161 (diff)
downloadgsoc2013-evolution-410f3bc629f38cb76a5d16209a07e2c336ed1f9f.tar.gz
gsoc2013-evolution-410f3bc629f38cb76a5d16209a07e2c336ed1f9f.tar.zst
gsoc2013-evolution-410f3bc629f38cb76a5d16209a07e2c336ed1f9f.zip
Merging changes:
2001-12-04 Christopher James Lahey <clahey@ximian.com> * configure.in (GAL_CURRENT): Bumped version number to 0.18.99.0 and CURRENT to 19. 2001-11-21 Christopher James Lahey <clahey@ximian.com> * gal/widgets/e-reflow.c, gal/widgets/e-reflow.h: Handle selection_row_changed signal. * gal/widgets/e-selection-model-array.c, gal/widgets/e-selection-model-array.h: Properly send selection_row_changed signals if changing from a single row selected to a single other row selected or if moving the selection_end by a single row. * gal/widgets/e-selection-model.c, gal/widgets/e-selection-model.h: Added selection_row_changed signal. (e_selection_model_select_as_key_press): Fixed the case statement here to make MULTIPLE and EXTENDED the same as BROWSE instead of as SINGLE. From gal/e-table/ChangeLog: 2001-11-21 Christopher James Lahey <clahey@ximian.com> * e-table-item.c, e-table-item.h: Handle selection_row_changed signal. Keep track of the old cursor row so that we only redraw two rows when the cursor changes. * e-table.c, e-tree.c: Handle selection_row_changed signal. * e-tree-selection-model.c: Properly send selection_row_changed signals if changing from a single row selected to a single other row selected or if moving the selection_end by a single row. svn path=/trunk/; revision=14870
Diffstat (limited to 'widgets/table/e-table-item.c')
-rw-r--r--widgets/table/e-table-item.c52
1 files changed, 46 insertions, 6 deletions
diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c
index 76be881ffd..c324d3a90c 100644
--- a/widgets/table/e-table-item.c
+++ b/widgets/table/e-table-item.c
@@ -41,6 +41,7 @@
#include "gal/widgets/e-canvas-utils.h"
#include "gal/util/e-util.h"
#include <string.h>
+#include <stdlib.h>
#define PARENT_OBJECT_TYPE gnome_canvas_item_get_type ()
@@ -104,6 +105,8 @@ static void e_table_item_focus (ETableItem *eti, int col, int row, GdkModifierTy
static void eti_cursor_change (ESelectionModel *selection, int row, int col, ETableItem *eti);
static void eti_cursor_activated (ESelectionModel *selection, int row, int col, ETableItem *eti);
static void eti_selection_change (ESelectionModel *selection, ETableItem *eti);
+static void eti_selection_row_change (ESelectionModel *selection, int row, ETableItem *eti);
+static void e_table_item_redraw_row (ETableItem *eti, int row);
#define ETI_SINGLE_ROW_HEIGHT(eti) ((eti)->uniform_row_height_cache != -1 ? (eti)->uniform_row_height_cache : eti_row_height((eti), -1))
#define ETI_MULTIPLE_ROW_HEIGHT(eti,row) ((eti)->height_cache && (eti)->height_cache[(row)] != -1 ? (eti)->height_cache[(row)] : eti_row_height((eti),(row)))
@@ -499,12 +502,15 @@ eti_remove_selection_model (ETableItem *eti)
gtk_signal_disconnect (GTK_OBJECT (eti->selection),
eti->selection_change_id);
gtk_signal_disconnect (GTK_OBJECT (eti->selection),
+ eti->selection_row_change_id);
+ gtk_signal_disconnect (GTK_OBJECT (eti->selection),
eti->cursor_change_id);
gtk_signal_disconnect (GTK_OBJECT (eti->selection),
eti->cursor_activated_id);
gtk_object_unref (GTK_OBJECT (eti->selection));
eti->selection_change_id = 0;
+ eti->selection_row_change_id = 0;
eti->cursor_activated_id = 0;
eti->selection = NULL;
}
@@ -973,13 +979,15 @@ static void
eti_freeze (ETableItem *eti)
{
eti->frozen_count ++;
+ d(g_print ("%s: %d\n", __FUNCTION__, eti->frozen_count));
}
static void
eti_unfreeze (ETableItem *eti)
{
- g_return_if_fail (eti->frozen_count != 0);
+ g_return_if_fail (eti->frozen_count > 0);
eti->frozen_count --;
+ d(g_print ("%s: %d\n", __FUNCTION__, eti->frozen_count));
if (eti->frozen_count == 0 && eti->queue_show_cursor) {
eti_show_cursor (eti, 0);
eti_check_cursor_bounds (eti);
@@ -1050,7 +1058,7 @@ eti_table_model_row_changed (ETableModel *table_model, int row, ETableItem *eti)
eti_unfreeze (eti);
- eti_request_region_redraw (eti, 0, row, eti->cols - 1, row, 0);
+ e_table_item_redraw_row (eti, row);
}
static void
@@ -1068,7 +1076,7 @@ eti_table_model_cell_changed (ETableModel *table_model, int col, int row, ETable
eti_unfreeze (eti);
- eti_request_region_redraw (eti, 0, row, eti->cols - 1, row, 0);
+ e_table_item_redraw_row (eti, row);
}
static void
@@ -1165,6 +1173,13 @@ e_table_item_redraw_range (ETableItem *eti,
}
static void
+e_table_item_redraw_row (ETableItem *eti,
+ int row)
+{
+ e_table_item_redraw_range (eti, 0, row, eti->cols - 1, row);
+}
+
+static void
eti_add_table_model (ETableItem *eti, ETableModel *table_model)
{
g_assert (eti->table_model == NULL);
@@ -1228,6 +1243,10 @@ eti_add_selection_model (ETableItem *eti, ESelectionModel *selection)
GTK_OBJECT (selection), "selection_changed",
GTK_SIGNAL_FUNC (eti_selection_change), eti);
+ eti->selection_row_change_id = gtk_signal_connect (
+ GTK_OBJECT (selection), "selection_row_changed",
+ GTK_SIGNAL_FUNC (eti_selection_row_change), eti);
+
eti->cursor_change_id = gtk_signal_connect (
GTK_OBJECT (selection), "cursor_changed",
GTK_SIGNAL_FUNC (eti_cursor_change), eti);
@@ -1494,10 +1513,13 @@ eti_init (GnomeCanvasItem *item)
eti->cursor_mode = E_CURSOR_SIMPLE;
eti->selection_change_id = 0;
+ eti->selection_row_change_id = 0;
eti->cursor_change_id = 0;
eti->cursor_activated_id = 0;
eti->selection = NULL;
+ eti->old_cursor_row = -1;
+
eti->needs_redraw = 0;
eti->needs_compute_height = 0;
@@ -2663,7 +2685,7 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e)
default:
return_val = FALSE;
}
- d(g_print("%s: returning: %s\n", __FUNCTION__, return_val?"true":"false"));
+ /* d(g_print("%s: returning: %s\n", __FUNCTION__, return_val?"true":"false"));*/
return return_val;
}
@@ -2880,6 +2902,7 @@ eti_cursor_change (ESelectionModel *selection, int row, int col, ETableItem *eti
if (view_row == -1 || view_col == -1) {
e_table_item_leave_edit_(eti);
+ eti->old_cursor_row = -1;
return;
}
@@ -2896,8 +2919,14 @@ eti_cursor_change (ESelectionModel *selection, int row, int col, ETableItem *eti
e_table_item_leave_edit_(eti);
gtk_signal_emit (GTK_OBJECT (eti), eti_signals [CURSOR_CHANGE],
view_row);
- eti->needs_redraw = TRUE;
- gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(eti));
+ if (eti->old_cursor_row != -1) {
+ e_table_item_redraw_row (eti, eti->old_cursor_row);
+ e_table_item_redraw_row (eti, view_row);
+ } else {
+ eti->needs_redraw = TRUE;
+ gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(eti));
+ }
+ eti->old_cursor_row = view_row;
}
static void
@@ -2939,6 +2968,17 @@ eti_selection_change (ESelectionModel *selection, ETableItem *eti)
gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(eti));
}
+static void
+eti_selection_row_change (ESelectionModel *selection, int row, ETableItem *eti)
+{
+ if (!(GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED))
+ return;
+
+ if (!eti->needs_redraw) {
+ e_table_item_redraw_row (eti, model_to_view_row(eti, row));
+ }
+}
+
/**
* e_table_item_enter_edit