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
This commit is contained in:

committed by
Chris Lahey

parent
33748a6445
commit
1d68f8289f
@ -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
|
static void
|
||||||
ect_print (ECellView *ecell_view, GnomePrintContext *context,
|
ect_print (ECellView *ecell_view, GnomePrintContext *context,
|
||||||
int model_col, int view_col, int row,
|
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->height = ect_height;
|
||||||
ecc->enter_edit = ect_enter_edit;
|
ecc->enter_edit = ect_enter_edit;
|
||||||
ecc->leave_edit = ect_leave_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 = ect_print;
|
||||||
ecc->print_height = ect_print_height;
|
ecc->print_height = ect_print_height;
|
||||||
ecc->max_width = ect_max_width;
|
ecc->max_width = ect_max_width;
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
|
|
||||||
#define PARENT_TYPE gtk_object_get_type ()
|
#define PARENT_TYPE gtk_object_get_type ()
|
||||||
|
|
||||||
|
#define ECVIEW_EC_CLASS(v) (E_CELL_CLASS (GTK_OBJECT ((v)->ecell)->klass))
|
||||||
|
|
||||||
static ECellView *
|
static ECellView *
|
||||||
ec_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view)
|
ec_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view)
|
||||||
{
|
{
|
||||||
@ -104,6 +106,22 @@ ec_leave_edit (ECellView *ecell_view, int model_col, int view_col, int row, void
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void *
|
||||||
|
ec_save_state (ECellView *ecell_view, int model_col, int view_col, int row, void *context)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
ec_load_state (ECellView *ecell_view, int model_col, int view_col, int row, void *context, void *save_state)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
ec_free_state (ECellView *ecell_view, int model_col, int view_col, int row, void *save_state)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ec_show_tooltip (ECellView *ecell_view, int model_col, int view_col, int row, int col_width, ETableTooltip *tooltip)
|
ec_show_tooltip (ECellView *ecell_view, int model_col, int view_col, int row, int col_width, ETableTooltip *tooltip)
|
||||||
{
|
{
|
||||||
@ -126,6 +144,9 @@ e_cell_class_init (GtkObjectClass *object_class)
|
|||||||
ecc->height = ec_height;
|
ecc->height = ec_height;
|
||||||
ecc->enter_edit = ec_enter_edit;
|
ecc->enter_edit = ec_enter_edit;
|
||||||
ecc->leave_edit = ec_leave_edit;
|
ecc->leave_edit = ec_leave_edit;
|
||||||
|
ecc->save_state = ec_save_state;
|
||||||
|
ecc->load_state = ec_load_state;
|
||||||
|
ecc->free_state = ec_free_state;
|
||||||
ecc->print = NULL;
|
ecc->print = NULL;
|
||||||
ecc->print_height = NULL;
|
ecc->print_height = NULL;
|
||||||
ecc->max_width = NULL;
|
ecc->max_width = NULL;
|
||||||
@ -156,7 +177,7 @@ E_MAKE_TYPE(e_cell, "ECell", ECell, e_cell_class_init, e_cell_init, PARENT_TYPE)
|
|||||||
gint
|
gint
|
||||||
e_cell_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row, ECellFlags flags, ECellActions *actions)
|
e_cell_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row, ECellFlags flags, ECellActions *actions)
|
||||||
{
|
{
|
||||||
return E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->event (
|
return ECVIEW_EC_CLASS(ecell_view)->event (
|
||||||
ecell_view, event, model_col, view_col, row, flags, actions);
|
ecell_view, event, model_col, view_col, row, flags, actions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,7 +214,7 @@ e_cell_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view
|
|||||||
void
|
void
|
||||||
e_cell_realize (ECellView *ecell_view)
|
e_cell_realize (ECellView *ecell_view)
|
||||||
{
|
{
|
||||||
E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->realize (ecell_view);
|
ECVIEW_EC_CLASS(ecell_view)->realize (ecell_view);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -205,7 +226,7 @@ e_cell_realize (ECellView *ecell_view)
|
|||||||
void
|
void
|
||||||
e_cell_kill_view (ECellView *ecell_view)
|
e_cell_kill_view (ECellView *ecell_view)
|
||||||
{
|
{
|
||||||
E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->kill_view (ecell_view);
|
ECVIEW_EC_CLASS(ecell_view)->kill_view (ecell_view);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -219,7 +240,7 @@ e_cell_kill_view (ECellView *ecell_view)
|
|||||||
void
|
void
|
||||||
e_cell_unrealize (ECellView *ecell_view)
|
e_cell_unrealize (ECellView *ecell_view)
|
||||||
{
|
{
|
||||||
E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->unrealize (ecell_view);
|
ECVIEW_EC_CLASS(ecell_view)->unrealize (ecell_view);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -250,8 +271,7 @@ e_cell_draw (ECellView *ecell_view, GdkDrawable *drawable,
|
|||||||
g_return_if_fail (row >= 0);
|
g_return_if_fail (row >= 0);
|
||||||
g_return_if_fail (row < e_table_model_row_count(ecell_view->e_table_model));
|
g_return_if_fail (row < e_table_model_row_count(ecell_view->e_table_model));
|
||||||
|
|
||||||
E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->draw (
|
ECVIEW_EC_CLASS(ecell_view)->draw (ecell_view, drawable, model_col, view_col, row, flags, x1, y1, x2, y2);
|
||||||
ecell_view, drawable, model_col, view_col, row, flags, x1, y1, x2, y2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -271,8 +291,7 @@ e_cell_print (ECellView *ecell_view, GnomePrintContext *context,
|
|||||||
int model_col, int view_col, int row,
|
int model_col, int view_col, int row,
|
||||||
double width, double height)
|
double width, double height)
|
||||||
{
|
{
|
||||||
E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->print
|
ECVIEW_EC_CLASS(ecell_view)->print (ecell_view, context, model_col, view_col, row, width, height);
|
||||||
(ecell_view, context, model_col, view_col, row, width, height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -285,8 +304,8 @@ e_cell_print_height (ECellView *ecell_view, GnomePrintContext *context,
|
|||||||
int model_col, int view_col, int row,
|
int model_col, int view_col, int row,
|
||||||
double width)
|
double width)
|
||||||
{
|
{
|
||||||
if (E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->print_height)
|
if (ECVIEW_EC_CLASS(ecell_view)->print_height)
|
||||||
return E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->print_height
|
return ECVIEW_EC_CLASS(ecell_view)->print_height
|
||||||
(ecell_view, context, model_col, view_col, row, width);
|
(ecell_view, context, model_col, view_col, row, width);
|
||||||
else
|
else
|
||||||
return 0.0;
|
return 0.0;
|
||||||
@ -305,8 +324,7 @@ e_cell_print_height (ECellView *ecell_view, GnomePrintContext *context,
|
|||||||
int
|
int
|
||||||
e_cell_height (ECellView *ecell_view, int model_col, int view_col, int row)
|
e_cell_height (ECellView *ecell_view, int model_col, int view_col, int row)
|
||||||
{
|
{
|
||||||
return E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->height (
|
return ECVIEW_EC_CLASS(ecell_view)->height (ecell_view, model_col, view_col, row);
|
||||||
ecell_view, model_col, view_col, row);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -322,8 +340,7 @@ e_cell_height (ECellView *ecell_view, int model_col, int view_col, int row)
|
|||||||
void *
|
void *
|
||||||
e_cell_enter_edit (ECellView *ecell_view, int model_col, int view_col, int row)
|
e_cell_enter_edit (ECellView *ecell_view, int model_col, int view_col, int row)
|
||||||
{
|
{
|
||||||
return E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->enter_edit (
|
return ECVIEW_EC_CLASS(ecell_view)->enter_edit (ecell_view, model_col, view_col, row);
|
||||||
ecell_view, model_col, view_col, row);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -340,8 +357,66 @@ e_cell_enter_edit (ECellView *ecell_view, int model_col, int view_col, int row)
|
|||||||
void
|
void
|
||||||
e_cell_leave_edit (ECellView *ecell_view, int model_col, int view_col, int row, void *edit_context)
|
e_cell_leave_edit (ECellView *ecell_view, int model_col, int view_col, int row, void *edit_context)
|
||||||
{
|
{
|
||||||
E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->leave_edit (
|
ECVIEW_EC_CLASS(ecell_view)->leave_edit (ecell_view, model_col, view_col, row, edit_context);
|
||||||
ecell_view, model_col, view_col, row, edit_context);
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* e_cell_save_state:
|
||||||
|
* @ecell_view: the ECellView to save
|
||||||
|
* @model_col: the column in the model
|
||||||
|
* @view_col: the column in the view
|
||||||
|
* @row: the row
|
||||||
|
* @edit_context: the editing context
|
||||||
|
*
|
||||||
|
* Returns: The save state.
|
||||||
|
*
|
||||||
|
* Requests that the ECellView return a void * representing the state
|
||||||
|
* of the ECell. This is primarily intended for things like selection
|
||||||
|
* or scrolling.
|
||||||
|
*/
|
||||||
|
void *
|
||||||
|
e_cell_save_state (ECellView *ecell_view, int model_col, int view_col, int row, void *edit_context)
|
||||||
|
{
|
||||||
|
if (ECVIEW_EC_CLASS(ecell_view)->save_state)
|
||||||
|
return ECVIEW_EC_CLASS(ecell_view)->save_state (ecell_view, model_col, view_col, row, edit_context);
|
||||||
|
else
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* e_cell_load_state:
|
||||||
|
* @ecell_view: the ECellView to load
|
||||||
|
* @model_col: the column in the model
|
||||||
|
* @view_col: the column in the view
|
||||||
|
* @row: the row
|
||||||
|
* @edit_context: the editing context
|
||||||
|
* @save_state: the save state to load from
|
||||||
|
*
|
||||||
|
* Requests that the ECellView load from the given save state.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
e_cell_load_state (ECellView *ecell_view, int model_col, int view_col, int row, void *edit_context, void *save_state)
|
||||||
|
{
|
||||||
|
if (ECVIEW_EC_CLASS(ecell_view)->load_state)
|
||||||
|
ECVIEW_EC_CLASS(ecell_view)->load_state (ecell_view, model_col, view_col, row, edit_context, save_state);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* e_cell_load_state:
|
||||||
|
* @ecell_view: the ECellView
|
||||||
|
* @model_col: the column in the model
|
||||||
|
* @view_col: the column in the view
|
||||||
|
* @row: the row
|
||||||
|
* @edit_context: the editing context
|
||||||
|
* @save_state: the save state to free
|
||||||
|
*
|
||||||
|
* Requests that the ECellView free the given save state.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
e_cell_free_state (ECellView *ecell_view, int model_col, int view_col, int row, void *save_state)
|
||||||
|
{
|
||||||
|
if (ECVIEW_EC_CLASS(ecell_view)->free_state)
|
||||||
|
ECVIEW_EC_CLASS(ecell_view)->free_state (ecell_view, model_col, view_col, row, save_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -356,7 +431,7 @@ e_cell_leave_edit (ECellView *ecell_view, int model_col, int view_col, int row,
|
|||||||
int
|
int
|
||||||
e_cell_max_width (ECellView *ecell_view, int model_col, int view_col)
|
e_cell_max_width (ECellView *ecell_view, int model_col, int view_col)
|
||||||
{
|
{
|
||||||
return E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->max_width
|
return ECVIEW_EC_CLASS(ecell_view)->max_width
|
||||||
(ecell_view, model_col, view_col);
|
(ecell_view, model_col, view_col);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -364,15 +439,15 @@ void
|
|||||||
e_cell_show_tooltip (ECellView *ecell_view, int model_col, int view_col,
|
e_cell_show_tooltip (ECellView *ecell_view, int model_col, int view_col,
|
||||||
int row, int col_width, ETableTooltip *tooltip)
|
int row, int col_width, ETableTooltip *tooltip)
|
||||||
{
|
{
|
||||||
E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->show_tooltip
|
ECVIEW_EC_CLASS(ecell_view)->show_tooltip
|
||||||
(ecell_view, model_col, view_col, row, col_width, tooltip);
|
(ecell_view, model_col, view_col, row, col_width, tooltip);
|
||||||
}
|
}
|
||||||
|
|
||||||
gchar *
|
gchar *
|
||||||
e_cell_get_bg_color(ECellView *ecell_view, int row)
|
e_cell_get_bg_color(ECellView *ecell_view, int row)
|
||||||
{
|
{
|
||||||
if (E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->get_bg_color)
|
if (ECVIEW_EC_CLASS(ecell_view)->get_bg_color)
|
||||||
return E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->get_bg_color (ecell_view, row);
|
return ECVIEW_EC_CLASS(ecell_view)->get_bg_color (ecell_view, row);
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -97,6 +97,9 @@ typedef struct {
|
|||||||
|
|
||||||
void *(*enter_edit) (ECellView *ecell_view, int model_col, int view_col, int row);
|
void *(*enter_edit) (ECellView *ecell_view, int model_col, int view_col, int row);
|
||||||
void (*leave_edit) (ECellView *ecell_view, int model_col, int view_col, int row, void *context);
|
void (*leave_edit) (ECellView *ecell_view, int model_col, int view_col, int row, void *context);
|
||||||
|
void *(*save_state) (ECellView *ecell_view, int model_col, int view_col, int row, void *context);
|
||||||
|
void (*load_state) (ECellView *ecell_view, int model_col, int view_col, int row, void *context, void *save_state);
|
||||||
|
void (*free_state) (ECellView *ecell_view, int model_col, int view_col, int row, void *save_state);
|
||||||
void (*print) (ECellView *ecell_view, GnomePrintContext *context,
|
void (*print) (ECellView *ecell_view, GnomePrintContext *context,
|
||||||
int model_col, int view_col, int row,
|
int model_col, int view_col, int row,
|
||||||
gdouble width, gdouble height);
|
gdouble width, gdouble height);
|
||||||
@ -185,6 +188,26 @@ void e_cell_leave_edit (ECellView *ecell_view,
|
|||||||
int row,
|
int row,
|
||||||
void *edit_context);
|
void *edit_context);
|
||||||
|
|
||||||
|
void *e_cell_save_state (ECellView *ecell_view,
|
||||||
|
int model_col,
|
||||||
|
int view_col,
|
||||||
|
int row,
|
||||||
|
void *edit_context);
|
||||||
|
|
||||||
|
void e_cell_load_state (ECellView *ecell_view,
|
||||||
|
int model_col,
|
||||||
|
int view_col,
|
||||||
|
int row,
|
||||||
|
void *edit_context,
|
||||||
|
void *state);
|
||||||
|
|
||||||
|
void e_cell_free_state (ECellView *ecell_view,
|
||||||
|
int model_col,
|
||||||
|
int view_col,
|
||||||
|
int row,
|
||||||
|
void *state);
|
||||||
|
|
||||||
|
|
||||||
END_GNOME_DECLS
|
END_GNOME_DECLS
|
||||||
|
|
||||||
#endif /* _E_CELL_H_ */
|
#endif /* _E_CELL_H_ */
|
||||||
|
@ -280,6 +280,20 @@ eti_get_cell_foreground_color (ETableItem *eti, int row, int col, gboolean selec
|
|||||||
return foreground;
|
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
|
* During realization, we have to invoke the per-ecell realize routine
|
||||||
* (On our current setup, we have one e-cell per column.
|
* (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)
|
if (eti->cell_views_realized == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
eti_free_save_state (eti);
|
||||||
|
|
||||||
for (i = 0; i < eti->n_cells; i++)
|
for (i = 0; i < eti->n_cells; i++)
|
||||||
e_cell_unrealize (eti->cell_views [i]);
|
e_cell_unrealize (eti->cell_views [i]);
|
||||||
eti->cell_views_realized = 0;
|
eti->cell_views_realized = 0;
|
||||||
@ -352,6 +368,8 @@ eti_detach_cell_views (ETableItem *eti)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
eti_free_save_state (eti);
|
||||||
|
|
||||||
for (i = 0; i < eti->n_cells; i++){
|
for (i = 0; i < eti->n_cells; i++){
|
||||||
e_cell_kill_view (eti->cell_views [i]);
|
e_cell_kill_view (eti->cell_views [i]);
|
||||||
eti->cell_views [i] = NULL;
|
eti->cell_views [i] = NULL;
|
||||||
@ -911,7 +929,7 @@ eti_check_cursor_bounds (ETableItem *eti)
|
|||||||
eti->cursor_y1 = -1;
|
eti->cursor_y1 = -1;
|
||||||
eti->cursor_x2 = -1;
|
eti->cursor_x2 = -1;
|
||||||
eti->cursor_y2 = -1;
|
eti->cursor_y2 = -1;
|
||||||
eti->cursor_on_screen = FALSE;
|
eti->cursor_on_screen = TRUE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1499,6 +1517,10 @@ eti_init (GnomeCanvasItem *item)
|
|||||||
eti->width = 0;
|
eti->width = 0;
|
||||||
eti->minimum_width = 0;
|
eti->minimum_width = 0;
|
||||||
|
|
||||||
|
eti->save_col = -1;
|
||||||
|
eti->save_row = -1;
|
||||||
|
eti->save_state = NULL;
|
||||||
|
|
||||||
eti->click_count = 0;
|
eti->click_count = 0;
|
||||||
|
|
||||||
eti->height_cache = NULL;
|
eti->height_cache = NULL;
|
||||||
@ -2689,9 +2711,26 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e)
|
|||||||
|
|
||||||
case GDK_FOCUS_CHANGE:
|
case GDK_FOCUS_CHANGE:
|
||||||
d(g_print("%s: GDK_FOCUS_CHANGE received, %s\n", __FUNCTION__, e->focus_change.in ? "in": "out"));
|
d(g_print("%s: GDK_FOCUS_CHANGE received, %s\n", __FUNCTION__, e->focus_change.in ? "in": "out"));
|
||||||
if (! e->focus_change.in) {
|
if (e->focus_change.in) {
|
||||||
if (eti_editing (eti))
|
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);
|
e_table_item_leave_edit_(eti);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -153,6 +153,9 @@ typedef struct {
|
|||||||
int editing_col, editing_row;
|
int editing_col, editing_row;
|
||||||
void *edit_ctx;
|
void *edit_ctx;
|
||||||
|
|
||||||
|
int save_col, save_row;
|
||||||
|
void *save_state;
|
||||||
|
|
||||||
int grabbed_col, grabbed_row;
|
int grabbed_col, grabbed_row;
|
||||||
int grabbed_count;
|
int grabbed_count;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user