diff options
author | Christopher James Lahey <clahey@ximian.com> | 2002-01-16 06:33:13 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2002-01-16 06:33:13 +0800 |
commit | 1d68f8289f5686820da5ed0cecec586bc50e445c (patch) | |
tree | 661788cafb05bb83d9ac482979eba5cb57ce6875 /widgets/table/e-cell-text.c | |
parent | 33748a64453cf5bcbde73ec7bf0a983ecfa49ff4 (diff) | |
download | gsoc2013-evolution-1d68f8289f5686820da5ed0cecec586bc50e445c.tar.gz 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-cell-text.c')
-rw-r--r-- | widgets/table/e-cell-text.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c index 9f57710d81..63a78a5a98 100644 --- a/widgets/table/e-cell-text.c +++ b/widgets/table/e-cell-text.c @@ -1093,6 +1093,50 @@ ect_leave_edit (ECellView *ecell_view, int model_col, int view_col, int row, voi } } +/* + * ECellView::save_state method + */ +static void * +ect_save_state (ECellView *ecell_view, int model_col, int view_col, int row, void *edit_context) +{ + ECellTextView *text_view = (ECellTextView *) ecell_view; + CellEdit *edit = text_view->edit; + + int *save_state = g_new (int, 2); + + save_state[0] = edit->selection_start; + save_state[1] = edit->selection_end; + return save_state; +} + +/* + * ECellView::load_state method + */ +static void +ect_load_state (ECellView *ecell_view, int model_col, int view_col, int row, void *edit_context, void *save_state) +{ + ECellTextView *text_view = (ECellTextView *) ecell_view; + CellEdit *edit = text_view->edit; + int length; + int *selection = save_state; + + length = strlen (edit->cell.text); + + edit->selection_start = MIN (selection[0], length); + edit->selection_end = MIN (selection[1], length); + + ect_queue_redraw (text_view, view_col, row); +} + +/* + * ECellView::free_state method + */ +static void +ect_free_state (ECellView *ecell_view, int model_col, int view_col, int row, void *save_state) +{ + g_free (save_state); +} + static void ect_print (ECellView *ecell_view, GnomePrintContext *context, int model_col, int view_col, int row, @@ -1455,6 +1499,9 @@ e_cell_text_class_init (GtkObjectClass *object_class) ecc->height = ect_height; ecc->enter_edit = ect_enter_edit; ecc->leave_edit = ect_leave_edit; + ecc->save_state = ect_save_state; + ecc->load_state = ect_load_state; + ecc->free_state = ect_free_state; ecc->print = ect_print; ecc->print_height = ect_print_height; ecc->max_width = ect_max_width; |