Commit 5709dcc2 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

keep the current scale value, beep and reset the entry when the user input

2008-04-28  Sven Neumann  <sven@gimp.org>

	* app/display/gimpscalecombobox.c: keep the current scale value,
	beep and reset the entry when the user input cannot be parsed.
	Also changed the input parser to interpret a single number as a
	percentage.


svn path=/trunk/; revision=25547
parent e8214c2c
2008-04-28 Joao S. O. Bueno <gwidion@mpc.com.br>
2008-04-28 Sven Neumann <sven@gimp.org>
* app/display/gimpscalecombobox.c: keep the current scale value,
beep and reset the entry when the user input cannot be parsed.
Also changed the input parser to interpret a single number as a
percentage.
2008-04-28 Joao S. O. Bueno <gwidion@mpc.com.br>
* app/pdb/drawable-transform-cmds.c
* app/pdb/vectors-cmds.c: regenerated
......@@ -29,7 +36,7 @@
* menus/image-menu.xml.in: removed GEGL tool from the Colors menu
and also moved it out of the color tools menu.
2008-04-26 João S. O. Bueno <gwidion@mpc.com.br>
2008-04-26 João S. O. Bueno <gwidion@mpc.com.br>
* AUTHORS
* authors.xml
......@@ -4243,7 +4250,7 @@
pygimp_set_foreground): restore support for passing in 3 args for
color components, for backward compatibility.
2008-01-26 Joao S. O. Bueno <gwidion@mpc.com.br>
2008-01-26 Joao S. O. Bueno <gwidion@mpc.com.br>
* plug-ins/pygimp/pygimp-colors.c (pygimp_rgb_from_pyobject): fix
subsequent error (calculated parameters where not used)
......@@ -4980,7 +4987,7 @@
* app/tools/gimpcolorbalancetool.c: use it.
2008-01-09 Joao S. O. Bueno <gwidion@mpc.com.br>
2008-01-09 Joao S. O. Bueno <gwidion@mpc.com.br>
* plug-ins/pygimp/pygimp-vectors.c: Allow Vectors.remove_stroke
method to accept VectorStroke objects besides stroke IDs. Fix
......
......@@ -94,6 +94,7 @@ gimp_scale_combo_box_init (GimpScaleComboBox *combo_box)
GtkTreeIter iter;
gint i;
combo_box->scale = 1.0;
combo_box->last_path = NULL;
store = gtk_list_store_new (NUM_COLUMNS,
......@@ -108,8 +109,11 @@ gimp_scale_combo_box_init (GimpScaleComboBox *combo_box)
entry = gtk_bin_get_child (GTK_BIN (combo_box));
gtk_entry_set_alignment (GTK_ENTRY (entry), 1.0);
gtk_entry_set_width_chars (GTK_ENTRY (entry), 7);
g_object_set (entry,
"xalign", 1.0,
"width-chars", 7,
"truncate-multiline", TRUE,
NULL);
layout = GTK_CELL_LAYOUT (combo_box);
......@@ -215,6 +219,8 @@ gimp_scale_combo_box_changed (GimpScaleComboBox *combo_box)
-1);
if (scale > 0.0)
{
combo_box->scale = scale;
if (combo_box->last_path)
gtk_tree_path_free (combo_box->last_path);
......@@ -243,7 +249,7 @@ gimp_scale_combo_box_parse_text (const gchar *text,
while (g_unichar_isspace (g_utf8_get_char (text)))
text = g_utf8_next_char (text);
if (*text == '%')
if (*text == '\0' || *text == '%')
{
*scale = left_number / 100.0;
return TRUE;
......@@ -287,6 +293,12 @@ gimp_scale_combo_box_entry_activate (GtkEntry *entry,
{
gimp_scale_combo_box_set_scale (combo_box, scale);
}
else
{
gtk_widget_error_bell (GTK_WIDGET (combo_box));
gimp_scale_combo_box_set_scale (combo_box, combo_box->scale);
}
}
static void
......@@ -396,6 +408,7 @@ gimp_scale_combo_box_set_scale (GimpScaleComboBox *combo_box,
gboolean persistent;
g_return_if_fail (GIMP_IS_SCALE_COMBO_BOX (combo_box));
g_return_if_fail (scale > 0.0);
model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo_box));
store = GTK_LIST_STORE (model);
......@@ -453,18 +466,7 @@ gimp_scale_combo_box_set_scale (GimpScaleComboBox *combo_box,
gdouble
gimp_scale_combo_box_get_scale (GimpScaleComboBox *combo_box)
{
GtkTreeIter iter;
gdouble scale = 1.0;
g_return_val_if_fail (GIMP_IS_SCALE_COMBO_BOX (combo_box), FALSE);
if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (combo_box), &iter))
{
gtk_tree_model_get (gtk_combo_box_get_model (GTK_COMBO_BOX (combo_box)),
&iter,
SCALE, &scale,
-1);
}
g_return_val_if_fail (GIMP_IS_SCALE_COMBO_BOX (combo_box), 1.0);
return scale;
return combo_box->scale;
}
......@@ -44,6 +44,7 @@ struct _GimpScaleComboBox
{
GtkComboBoxEntry parent_instance;
gdouble scale;
GtkTreePath *last_path;
GList *mru;
};
......
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