Commit 3575f4a1 authored by Andreas J. Guelzow's avatar Andreas J. Guelzow Committed by Andreas J. Guelzow

link to the expr-entry changed signal rather than its gtkentry changed

2002-04-05  Andreas J. Guelzow <aguelzow@taliesin.ca>

	* src/item-edit.c : link to the expr-entry changed signal rather than its
	  gtkentry changed signal.

2002-04-05  Andreas J. Guelzow <aguelzow@taliesin.ca>

	* gnumeric-expr-entry.c (gnm_expr_entry_rangesel_start) : set
	  rangesel::is_valid even for empty text
	(gee_init) : initialize rangesel::scg
	(cb_gee_button_press_event) : new
	(cb_gee_key_press_event) : move some code into cb_entry_changed
	(cb_entry_changed) : also handle key press induced changes
parent bd6ed899
2002-04-05 Andreas J. Guelzow <aguelzow@taliesin.ca>
* src/item-edit.c : link to the expr-entry changed signal rather than its
gtkentry changed signal.
2002-04-05 Andreas J. Guelzow <aguelzow@taliesin.ca>
* src/item-edit.c (point_is_inside_range) : rather than parsing
......
2002-04-05 Andreas J. Guelzow <aguelzow@taliesin.ca>
* src/item-edit.c : link to the expr-entry changed signal rather than its
gtkentry changed signal.
2002-04-05 Andreas J. Guelzow <aguelzow@taliesin.ca>
* src/item-edit.c (point_is_inside_range) : rather than parsing
......
2002-04-05 Andreas J. Guelzow <aguelzow@taliesin.ca>
* src/item-edit.c : link to the expr-entry changed signal rather than its
gtkentry changed signal.
2002-04-05 Andreas J. Guelzow <aguelzow@taliesin.ca>
* src/item-edit.c (point_is_inside_range) : rather than parsing
......
......@@ -420,7 +420,7 @@ item_edit_init (ItemEdit *item_edit)
* We use this to sync up the GtkEntry with our display on the screen.
*/
static void
entry_changed (GtkEntry *entry, void *data)
entry_changed (GnumericExprEntry *ignore, void *data)
{
GnomeCanvasItem *item = GNOME_CANVAS_ITEM (data);
ItemEdit *item_edit = ITEM_EDIT (item);
......@@ -445,7 +445,9 @@ item_edit_destroy (GtkObject *o)
entry_destroy_feedback_range (item_edit);
if (item_edit->signal_changed != 0) {
g_signal_handler_disconnect (GTK_OBJECT (entry), item_edit->signal_changed);
g_signal_handler_disconnect
(G_OBJECT (gtk_widget_get_parent (GTK_WIDGET (entry))),
item_edit->signal_changed);
g_signal_handler_disconnect (GTK_OBJECT (entry), item_edit->signal_key_press);
g_signal_handler_disconnect (GTK_OBJECT (entry), item_edit->signal_button_press);
item_edit->signal_changed = 0;
......@@ -458,14 +460,14 @@ item_edit_destroy (GtkObject *o)
static int
entry_event (GtkEntry *entry, GdkEvent *event, GnomeCanvasItem *item)
{
entry_changed (entry, item);
entry_changed (NULL, item);
return TRUE;
}
static int
entry_cursor_event (GtkEntry *entry, GParamSpec *pspec, GnomeCanvasItem *item)
{
entry_changed (entry, item);
entry_changed (NULL, item);
return TRUE;
}
......@@ -488,7 +490,8 @@ item_edit_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
item_edit->pos = sheet->edit_pos;
entry = item_edit->entry;
item_edit->signal_changed = g_signal_connect (G_OBJECT (entry),
item_edit->signal_changed = g_signal_connect (G_OBJECT (gtk_widget_get_parent (
GTK_WIDGET (entry))),
"changed",
G_CALLBACK (entry_changed), item_edit);
item_edit->signal_key_press = g_signal_connect_after (G_OBJECT (entry),
......
2002-04-05 Andreas J. Guelzow <aguelzow@taliesin.ca>
* gnumeric-expr-entry.c (gnm_expr_entry_rangesel_start) : set
rangesel::is_valid even for empty text
(gee_init) : initialize rangesel::scg
(cb_gee_button_press_event) : new
(cb_gee_key_press_event) : move some code into cb_entry_changed
(cb_entry_changed) : also handle key press induced changes
2002-04-05 Andreas J. Guelzow <aguelzow@taliesin.ca>
* gnumeric-expr-entry.c : add rangesel::is_valid
......
......@@ -209,6 +209,7 @@ gee_init (GnumericExprEntry *entry)
entry->editing_canceled = FALSE;
entry->is_cell_renderer = FALSE;
entry->rangesel.is_valid = FALSE;
entry->scg = NULL;
}
static void
......@@ -371,6 +372,7 @@ gnm_expr_entry_rangesel_start (GnumericExprEntry *gee)
rs->abs_col = (gee->flags & GNUM_EE_ABS_COL) != 0;
rs->abs_row = (gee->flags & GNUM_EE_ABS_ROW) != 0;
rs->sheet = gee->target_sheet;
rs->is_valid = FALSE;
if (text == NULL)
return;
last = strlen (text);
......@@ -404,8 +406,6 @@ gnm_expr_entry_rangesel_start (GnumericExprEntry *gee)
return;
}
rs->is_valid = FALSE;
if (single) {
rs->text_start = 0;
rs->text_end = last;
......@@ -524,6 +524,21 @@ gee_destroy (GtkObject *object)
GTK_OBJECT_CLASS (gnumeric_expr_entry_parent_class)->destroy (object);
}
static gboolean
cb_gee_button_press_event (GtkEntry *entry, GdkEventButton *event, GnumericExprEntry *gee)
{
g_return_val_if_fail (IS_GNUMERIC_EXPR_ENTRY (gee), FALSE);
if (gee->scg) {
scg_rangesel_stop (gee->scg, FALSE);
gnm_expr_entry_rangesel_start (gee);
g_signal_emit (G_OBJECT (gee), signals [CHANGED], 0);
}
return FALSE;
}
static gboolean
cb_gee_key_press_event (GtkEntry *entry,
GdkEventKey *event,
......@@ -623,19 +638,10 @@ cb_gee_key_press_event (GtkEntry *entry,
wbcg_edit_finish (wbcg, FALSE);
return TRUE;
}
case GDK_Shift_L:
case GDK_Shift_R:
case GDK_Alt_L:
case GDK_Alt_R:
return FALSE;
default:
break;
}
if (!gee->is_cell_renderer && !gnm_expr_entry_can_rangesel (gee))
scg_rangesel_stop (gee->scg, FALSE);
return FALSE;
}
......@@ -708,6 +714,9 @@ gee_get_property (GObject *object,
static void
cb_entry_changed (GtkEntry *ignored, GnumericExprEntry *gee)
{
if (!gee->is_cell_renderer && !gnm_expr_entry_can_rangesel (gee))
scg_rangesel_stop (gee->scg, FALSE);
g_signal_emit (G_OBJECT (gee), signals [CHANGED], 0);
}
......@@ -735,7 +744,9 @@ gnumeric_expr_entry_new (WorkbookControlGUI *wbcg, gboolean with_icon)
g_signal_connect (G_OBJECT (gee->entry),
"key_press_event",
G_CALLBACK (cb_gee_key_press_event), gee);
g_signal_connect (G_OBJECT (gee->entry),
"button_press_event",
G_CALLBACK (cb_gee_button_press_event), gee);
g_signal_connect (G_OBJECT (gee->entry),
"notify::cursor-position",
G_CALLBACK (gee_notify_cursor_position), gee);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment