aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table/e-table-item.c
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2002-01-16 06:33:13 +0800
committerChris Lahey <clahey@src.gnome.org>2002-01-16 06:33:13 +0800
commit1d68f8289f5686820da5ed0cecec586bc50e445c (patch)
tree661788cafb05bb83d9ac482979eba5cb57ce6875 /widgets/table/e-table-item.c
parent33748a64453cf5bcbde73ec7bf0a983ecfa49ff4 (diff)
downloadgsoc2013-evolution-1d68f8289f5686820da5ed0cecec586bc50e445c.tar
gsoc2013-evolution-1d68f8289f5686820da5ed0cecec586bc50e445c.tar.gz
gsoc2013-evolution-1d68f8289f5686820da5ed0cecec586bc50e445c.tar.bz2
gsoc2013-evolution-1d68f8289f5686820da5ed0cecec586bc50e445c.tar.lz
gsoc2013-evolution-1d68f8289f5686820da5ed0cecec586bc50e445c.tar.xz
gsoc2013-evolution-1d68f8289f5686820da5ed0cecec586bc50e445c.tar.zst
gsoc2013-evolution-1d68f8289f5686820da5ed0cecec586bc50e445c.zip
New functions for saving selection state and such.
2002-01-15 Christopher James Lahey <clahey@ximian.com> * e-cell.c, e-cell.h (e_cell_save_state, e_cell_load_state, e_cell_free_state): New functions for saving selection state and such. * e-cell-text.c (ect_save_state): Implemented the new state functions. * e-table-item.c, e-table-item.h: Use the new cell state functions when focusing in or out. Fixes Ximian bug #14968. svn path=/trunk/; revision=15335
Diffstat (limited to 'widgets/table/e-table-item.c')
-rw-r--r--widgets/table/e-table-item.c45
1 files changed, 42 insertions, 3 deletions
diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c
index 0d947a942f..927e0f434b 100644
--- a/widgets/table/e-table-item.c
+++ b/widgets/table/e-table-item.c
@@ -280,6 +280,20 @@ eti_get_cell_foreground_color (ETableItem *eti, int row, int col, gboolean selec
return foreground;
}
+static void
+eti_free_save_state (ETableItem *eti)
+{
+ if (eti->save_row == -1 ||
+ !eti->cell_views_realized)
+ return;
+
+ e_cell_free_state (eti->cell_views [eti->save_col], view_to_model_col(eti, eti->save_col),
+ eti->save_col, eti->save_row, eti->save_state);
+ eti->save_row = -1;
+ eti->save_col = -1;
+ eti->save_state = NULL;
+}
+
/*
* During realization, we have to invoke the per-ecell realize routine
* (On our current setup, we have one e-cell per column.
@@ -342,6 +356,8 @@ eti_unrealize_cell_views (ETableItem *eti)
if (eti->cell_views_realized == 0)
return;
+ eti_free_save_state (eti);
+
for (i = 0; i < eti->n_cells; i++)
e_cell_unrealize (eti->cell_views [i]);
eti->cell_views_realized = 0;
@@ -352,6 +368,8 @@ eti_detach_cell_views (ETableItem *eti)
{
int i;
+ eti_free_save_state (eti);
+
for (i = 0; i < eti->n_cells; i++){
e_cell_kill_view (eti->cell_views [i]);
eti->cell_views [i] = NULL;
@@ -911,7 +929,7 @@ eti_check_cursor_bounds (ETableItem *eti)
eti->cursor_y1 = -1;
eti->cursor_x2 = -1;
eti->cursor_y2 = -1;
- eti->cursor_on_screen = FALSE;
+ eti->cursor_on_screen = TRUE;
return;
}
@@ -1499,6 +1517,10 @@ eti_init (GnomeCanvasItem *item)
eti->width = 0;
eti->minimum_width = 0;
+ eti->save_col = -1;
+ eti->save_row = -1;
+ eti->save_state = NULL;
+
eti->click_count = 0;
eti->height_cache = NULL;
@@ -2689,9 +2711,26 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e)
case GDK_FOCUS_CHANGE:
d(g_print("%s: GDK_FOCUS_CHANGE received, %s\n", __FUNCTION__, e->focus_change.in ? "in": "out"));
- if (! e->focus_change.in) {
- if (eti_editing (eti))
+ if (e->focus_change.in) {
+ if (eti->save_row != -1 &&
+ eti->save_col != -1 &&
+ !eti_editing (eti) &&
+ e_table_model_is_cell_editable(eti->table_model, view_to_model_col (eti, eti->save_col), eti->save_row)) {
+ e_table_item_enter_edit (eti, eti->save_col, eti->save_row);
+ e_cell_load_state (eti->cell_views [eti->editing_col], view_to_model_col(eti, eti->save_col),
+ eti->save_col, eti->save_row, eti->edit_ctx, eti->save_state);
+ eti_free_save_state (eti);
+ }
+ } else {
+ if (eti_editing (eti)) {
+ eti_free_save_state (eti);
+
+ eti->save_row = eti->editing_row;
+ eti->save_col = eti->editing_col;
+ eti->save_state = e_cell_save_state (eti->cell_views [eti->editing_col], view_to_model_col(eti, eti->editing_col),
+ eti->editing_col, eti->editing_row, eti->edit_ctx);
e_table_item_leave_edit_(eti);
+ }
}
default: