setup size entries in the order suggested by the GimpSizeEntry

2003-10-23  Sven Neumann  <sven@gimp.org>

	* app/widgets/gimppropwidgets.c: setup size entries in the order
	suggested by the GimpSizeEntry documentation.

	* libgimpwidgets/gimpsizeentry.c: added an internal flag so the
	size entry knows if the boundaries are set on the value or on the
	reference value.  Needed to make gimp_size_entry_update_unit() do
	the right thing.
This commit is contained in:
Sven Neumann 2003-10-23 17:35:18 +00:00 committed by Sven Neumann
parent d91f29383f
commit 1d370ebe1b
4 changed files with 32 additions and 9 deletions

View File

@ -1,3 +1,13 @@
2003-10-23 Sven Neumann <sven@gimp.org>
* app/widgets/gimppropwidgets.c: setup size entries in the order
suggested by the GimpSizeEntry documentation.
* libgimpwidgets/gimpsizeentry.c: added an internal flag so the
size entry knows if the boundaries are set on the value or on the
reference value. Needed to make gimp_size_entry_update_unit() do
the right thing.
2003-10-23 Henrik Brix Andersen <brix@gimp.org>
* gimp/app/display/gimpdisplayoptions.c

View File

@ -1626,6 +1626,8 @@ gimp_prop_size_entry_new (GObject *config,
set_param_spec (NULL,
GIMP_SIZE_ENTRY (sizeentry)->unitmenu, unit_param_spec);
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), unit_value);
if (update_policy == GIMP_SIZE_ENTRY_UPDATE_SIZE)
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 0,
resolution, FALSE);
@ -1633,7 +1635,6 @@ gimp_prop_size_entry_new (GObject *config,
gimp_size_entry_set_value_boundaries (GIMP_SIZE_ENTRY (sizeentry), 0,
lower, upper);
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), unit_value);
gimp_size_entry_set_value (GIMP_SIZE_ENTRY (sizeentry), 0, value);
g_object_set_data (G_OBJECT (sizeentry), "gimp-config-param-spec",
@ -1928,6 +1929,8 @@ gimp_prop_coordinates_connect (GObject *config,
set_param_spec (NULL,
GIMP_SIZE_ENTRY (sizeentry)->unitmenu, unit_param_spec);
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), unit_value);
switch (GIMP_SIZE_ENTRY (sizeentry)->update_policy)
{
case GIMP_SIZE_ENTRY_UPDATE_SIZE:
@ -1963,7 +1966,6 @@ gimp_prop_coordinates_connect (GObject *config,
break;
}
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), unit_value);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 0, x_value);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 1, y_value);

View File

@ -1626,6 +1626,8 @@ gimp_prop_size_entry_new (GObject *config,
set_param_spec (NULL,
GIMP_SIZE_ENTRY (sizeentry)->unitmenu, unit_param_spec);
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), unit_value);
if (update_policy == GIMP_SIZE_ENTRY_UPDATE_SIZE)
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 0,
resolution, FALSE);
@ -1633,7 +1635,6 @@ gimp_prop_size_entry_new (GObject *config,
gimp_size_entry_set_value_boundaries (GIMP_SIZE_ENTRY (sizeentry), 0,
lower, upper);
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), unit_value);
gimp_size_entry_set_value (GIMP_SIZE_ENTRY (sizeentry), 0, value);
g_object_set_data (G_OBJECT (sizeentry), "gimp-config-param-spec",
@ -1928,6 +1929,8 @@ gimp_prop_coordinates_connect (GObject *config,
set_param_spec (NULL,
GIMP_SIZE_ENTRY (sizeentry)->unitmenu, unit_param_spec);
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), unit_value);
switch (GIMP_SIZE_ENTRY (sizeentry)->update_policy)
{
case GIMP_SIZE_ENTRY_UPDATE_SIZE:
@ -1963,7 +1966,6 @@ gimp_prop_coordinates_connect (GObject *config,
break;
}
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), unit_value);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 0, x_value);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 1, y_value);

View File

@ -69,6 +69,7 @@ struct _GimpSizeEntryField
gdouble max_refval;
gint refval_digits;
gboolean value_boundaries;
gint stop_recursion;
};
@ -612,6 +613,8 @@ gimp_size_entry_set_size (GimpSizeEntry *gse,
* NOTE: In most cases you won't be interested in these values because the
* #GimpSizeEntry's purpose is to shield the programmer from unit
* calculations. Use gimp_size_entry_set_refval_boundaries() instead.
* Whatever you do, don't mix these calls. A size entry should either
* be clamped by the value or the reference value.
**/
void
gimp_size_entry_set_value_boundaries (GimpSizeEntry *gse,
@ -626,8 +629,9 @@ gimp_size_entry_set_value_boundaries (GimpSizeEntry *gse,
g_return_if_fail (lower <= upper);
gsef = (GimpSizeEntryField*) g_slist_nth_data (gse->fields, field);
gsef->min_value = lower;
gsef->max_value = upper;
gsef->min_value = lower;
gsef->max_value = upper;
gsef->value_boundaries = TRUE;
GTK_ADJUSTMENT (gsef->value_adjustment)->lower = gsef->min_value;
GTK_ADJUSTMENT (gsef->value_adjustment)->upper = gsef->max_value;
@ -1134,9 +1138,14 @@ gimp_size_entry_update_unit (GimpSizeEntry *gse,
gimp_size_entry_value_callback,
gsef);
gimp_size_entry_set_refval_boundaries (gse, i,
gsef->min_refval,
gsef->max_refval);
if (gsef->value_boundaries)
gimp_size_entry_set_value_boundaries (gse, i,
gsef->min_value,
gsef->max_value);
else
gimp_size_entry_set_refval_boundaries (gse, i,
gsef->min_refval,
gsef->max_refval);
g_signal_handlers_unblock_by_func (gsef->value_adjustment,
gimp_size_entry_value_callback,