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
This commit is contained in:
Michael Natterer 2007-10-16 15:39:56 +00:00 committed by Michael Natterer
parent c612cd379e
commit 17eb0c6934
3 changed files with 55 additions and 15 deletions

View File

@ -1,3 +1,13 @@
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>
* app/tools/gimpselectionoptions.c (gimp_selection_options_gui):

View File

@ -1941,28 +1941,52 @@ gimp_rectangle_tool_start (GimpRectangleTool *rectangle,
gimp_draw_tool_start (GIMP_DRAW_TOOL (tool), tool->display);
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)
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)
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)
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)
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)
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)
{

View File

@ -2635,6 +2635,7 @@ gimp_prop_size_entry_new (GObject *config,
GParamSpec *param_spec;
GParamSpec *unit_param_spec;
gboolean show_pixels;
gboolean show_percent;
gdouble value;
gdouble lower;
gdouble upper;
@ -2658,9 +2659,13 @@ gimp_prop_size_entry_new (GObject *config,
return NULL;
g_value_init (&value, unit_param_spec->value_type);
g_value_set_int (&value, GIMP_UNIT_PIXEL);
show_pixels =
(g_param_value_validate (unit_param_spec, &value) == FALSE);
show_pixels = (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_object_get (config,
@ -2672,10 +2677,11 @@ gimp_prop_size_entry_new (GObject *config,
unit_param_spec = NULL;
unit_value = GIMP_UNIT_INCH;
show_pixels = FALSE;
show_percent = FALSE;
}
sizeentry = gimp_size_entry_new (1, unit_value, unit_format,
TRUE, FALSE, FALSE,
show_pixels, show_percent, FALSE,
ceil (log (upper) / log (10) + 2),
update_policy);
gtk_table_set_col_spacing (GTK_TABLE (sizeentry), 1, 4);