Commit 8c3616bd authored by Jean Bréfort's avatar Jean Bréfort Committed by Jean Bréfort
Browse files

use localized decimal separator [#80139].

2005-11-13  Jean Brefort  <jean.brefort@normalesup.org>

	* src/gnumeric-canvas.c: (gnm_canvas_key_press),
	(gnm_canvas_commit_cb): use localized decimal separator [#80139].
	* src/gnumeric-canvas.h:
	* src/widgets/gnumeric-expr-entry.c: (cb_gee_key_press_event): ditto.
parent e4fb4919
2005-11-13 Jean Brefort <jean.brefort@normalesup.org>
* src/gnumeric-canvas.c: (gnm_canvas_key_press),
(gnm_canvas_commit_cb): use localized decimal separator [#80139].
* src/gnumeric-canvas.h:
* src/widgets/gnumeric-expr-entry.c: (cb_gee_key_press_event): ditto.
2005-11-10 Morten Welinder <terra@gnome.org>
* src/application.c (gnumeric_application_finalize): Free
......
......@@ -3,6 +3,9 @@ Gnumeric 1.6.1
Allin Cottrell:
* Save configuration in non-gnome case. [#310354]
Jean Brefort:
* Use localized decimal separator. [#80139]
Jody:
* Unfreeze panes if the drag handles are pulled outwards.
* Adjust ctrl-~ vs ctrl-!
......
2005-11-13 Jean Brefort <jean.brefort@normalesup.org>
* src/gnumeric-canvas.c: (gnm_canvas_key_press),
(gnm_canvas_commit_cb): use localized decimal separator [#80139].
* src/gnumeric-canvas.h:
* src/widgets/gnumeric-expr-entry.c: (cb_gee_key_press_event): ditto.
2005-11-10 Morten Welinder <terra@gnome.org>
* src/application.c (gnumeric_application_finalize): Free
......
......@@ -445,6 +445,8 @@ gnm_canvas_key_press (GtkWidget *widget, GdkEventKey *event)
return TRUE;
gcanvas->mask_state = event->state;
gcanvas->insert_decimal = event->keyval == GDK_KP_Decimal ||
event->keyval == GDK_KP_Separator;
if (gtk_im_context_filter_keypress (gcanvas->im_context,event))
return TRUE;
switch (event->keyval) {
......@@ -595,12 +597,19 @@ gnm_canvas_commit_cb (GtkIMContext *context, const gchar *str, GnmCanvas *gcanva
{
WorkbookControlGUI *wbcg = gcanvas->simple.scg->wbcg;
GtkEditable *editable = GTK_EDITABLE (gnm_expr_entry_get_entry (wbcg_get_entry_logical (wbcg)));
gint tmp_pos;
gint tmp_pos, length;
if (!wbcg_is_editing (wbcg) &&
!wbcg_edit_start (wbcg, TRUE, TRUE))
return;
if (gcanvas->insert_decimal) {
GString const *s = format_get_decimal ();
str = s->str;
length = s->len;
} else
length = strlen (str);
if (gtk_editable_get_selection_bounds (editable, NULL, NULL))
gtk_editable_delete_selection (editable);
else {
......@@ -610,7 +619,7 @@ gnm_canvas_commit_cb (GtkIMContext *context, const gchar *str, GnmCanvas *gcanva
}
tmp_pos = gtk_editable_get_position (editable);
gtk_editable_insert_text (editable, str, strlen (str), &tmp_pos);
gtk_editable_insert_text (editable, str, length, &tmp_pos);
gtk_editable_set_position (editable, tmp_pos);
}
......
......@@ -43,6 +43,7 @@ struct _GnmCanvas {
guint preedit_length;
GtkIMContext *im_context;
PangoAttrList *preedit_attrs;
gboolean insert_decimal;
};
GType gnm_canvas_get_type (void);
......
......@@ -341,6 +341,20 @@ cb_gee_key_press_event (GtkEntry *entry,
return TRUE;
}
case GDK_KP_Separator:
case GDK_KP_Decimal: {
GtkEditable *editable = GTK_EDITABLE (entry);
gint start, end, l;
GString const* s = format_get_decimal ();
gchar const* decimal = s->str;
l = s->len;
gtk_editable_get_selection_bounds (editable, &start, &end);
gtk_editable_delete_text (editable, start, end);
gtk_editable_insert_text (editable, decimal, l, &start);
gtk_editable_set_position (editable, start);
return TRUE;
}
default:
break;
}
......
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