Commit 17eb0c69 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

honor the "show-pixels" and "show-percent" properties of the unit param

2007-10-16  Michael Natterer  <mitch@gimp.org>

	* libgimpwidgets/gimppropwidgets.c (gimp_prop_size_entry_new):
	honor the "show-pixels" and "show-percent" properties of the unit
	param spec.

	* app/tools/gimprectangletool.c (gimp_rectangle_tool_start): set
	the image's width/height on the size entries so the percent unit
	works correctly.


svn path=/trunk/; revision=23852
parent c612cd37
2007-10-16 Michael Natterer <mitch@gimp.org>
* libgimpwidgets/gimppropwidgets.c (gimp_prop_size_entry_new):
honor the "show-pixels" and "show-percent" properties of the unit
param spec.
* app/tools/gimprectangletool.c (gimp_rectangle_tool_start): set
the image's width/height on the size entries so the percent unit
works correctly.
2007-10-16 Sven Neumann <sven@gimp.org> 2007-10-16 Sven Neumann <sven@gimp.org>
* app/tools/gimpselectionoptions.c (gimp_selection_options_gui): * app/tools/gimpselectionoptions.c (gimp_selection_options_gui):
...@@ -1941,28 +1941,52 @@ gimp_rectangle_tool_start (GimpRectangleTool *rectangle, ...@@ -1941,28 +1941,52 @@ gimp_rectangle_tool_start (GimpRectangleTool *rectangle,
gimp_draw_tool_start (GIMP_DRAW_TOOL (tool), tool->display); gimp_draw_tool_start (GIMP_DRAW_TOOL (tool), tool->display);
if (options_private->fixed_width_entry) if (options_private->fixed_width_entry)
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (options_private->fixed_width_entry), {
0, display->image->xresolution, FALSE); gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (options_private->fixed_width_entry),
0, display->image->xresolution, FALSE);
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (options_private->fixed_width_entry),
0, 0, display->image->width);
}
if (options_private->fixed_height_entry) if (options_private->fixed_height_entry)
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (options_private->fixed_height_entry), {
0, display->image->yresolution, FALSE); gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (options_private->fixed_height_entry),
0, display->image->yresolution, FALSE);
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (options_private->fixed_height_entry),
0, 0, display->image->height);
}
if (options_private->x_entry) if (options_private->x_entry)
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (options_private->x_entry), {
0, display->image->xresolution, FALSE); gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (options_private->x_entry),
0, display->image->xresolution, FALSE);
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (options_private->x_entry),
0, 0, display->image->width);
}
if (options_private->y_entry) if (options_private->y_entry)
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (options_private->y_entry), {
0, display->image->yresolution, FALSE); gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (options_private->y_entry),
0, display->image->yresolution, FALSE);
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (options_private->y_entry),
0, 0, display->image->height);
}
if (options_private->width_entry) if (options_private->width_entry)
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (options_private->width_entry), {
0, display->image->xresolution, FALSE); gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (options_private->width_entry),
0, display->image->xresolution, FALSE);
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (options_private->width_entry),
0, 0, display->image->width);
}
if (options_private->height_entry) if (options_private->height_entry)
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (options_private->height_entry), {
0, display->image->yresolution, FALSE); gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (options_private->height_entry),
0, display->image->yresolution, FALSE);
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (options_private->height_entry),
0, 0, display->image->height);
}
if (options_private->auto_shrink_button) if (options_private->auto_shrink_button)
{ {
......
...@@ -2635,6 +2635,7 @@ gimp_prop_size_entry_new (GObject *config, ...@@ -2635,6 +2635,7 @@ gimp_prop_size_entry_new (GObject *config,
GParamSpec *param_spec; GParamSpec *param_spec;
GParamSpec *unit_param_spec; GParamSpec *unit_param_spec;
gboolean show_pixels; gboolean show_pixels;
gboolean show_percent;
gdouble value; gdouble value;
gdouble lower; gdouble lower;
gdouble upper; gdouble upper;
...@@ -2658,9 +2659,13 @@ gimp_prop_size_entry_new (GObject *config, ...@@ -2658,9 +2659,13 @@ gimp_prop_size_entry_new (GObject *config,
return NULL; return NULL;
g_value_init (&value, unit_param_spec->value_type); g_value_init (&value, unit_param_spec->value_type);
g_value_set_int (&value, GIMP_UNIT_PIXEL); g_value_set_int (&value, GIMP_UNIT_PIXEL);
show_pixels = show_pixels = (g_param_value_validate (unit_param_spec, &value) == FALSE);
(g_param_value_validate (unit_param_spec, &value) == FALSE);
g_value_set_int (&value, GIMP_UNIT_PERCENT);
show_percent = (g_param_value_validate (unit_param_spec, &value) == FALSE);
g_value_unset (&value); g_value_unset (&value);
g_object_get (config, g_object_get (config,
...@@ -2672,10 +2677,11 @@ gimp_prop_size_entry_new (GObject *config, ...@@ -2672,10 +2677,11 @@ gimp_prop_size_entry_new (GObject *config,
unit_param_spec = NULL; unit_param_spec = NULL;
unit_value = GIMP_UNIT_INCH; unit_value = GIMP_UNIT_INCH;
show_pixels = FALSE; show_pixels = FALSE;
show_percent = FALSE;
} }
sizeentry = gimp_size_entry_new (1, unit_value, unit_format, sizeentry = gimp_size_entry_new (1, unit_value, unit_format,
TRUE, FALSE, FALSE, show_pixels, show_percent, FALSE,
ceil (log (upper) / log (10) + 2), ceil (log (upper) / log (10) + 2),
update_policy); update_policy);
gtk_table_set_col_spacing (GTK_TABLE (sizeentry), 1, 4); gtk_table_set_col_spacing (GTK_TABLE (sizeentry), 1, 4);
......
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