Commit 486aed8e authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

added "gboolean allow_percent" to gimp_param_spec_unit() and to the

2003-07-17  Michael Natterer  <mitch@gimp.org>

	* app/config/gimpconfig-params.[ch]: added "gboolean allow_percent"
	to gimp_param_spec_unit() and to the GIMP_CONFIG_INSTALL_PROP_UNIT()
	macro. Changed value validation accordingly.

	* app/config/gimpconfig-types.c (string_to_unit): parse "percent"
	correctly.

	* app/widgets/gimppropwidgets.c (gimp_prop_unit_menu_new): show
	the "Percent" menu entry if the param_spec allows percent.

	* app/config/gimpcoreconfig.c
	* app/core/gimpgrid.c
	* app/core/gimptemplate.c
	* app/text/gimptext.c: pass FALSE to disallow percent.

	* app/paint/gimppaintoptions.c
	* app/tools/gimpselectionoptions.c: pass TRUE. Brings back the
	percent feature for fade_length, gradient_length and fixed_size
	rect/ellipse select.

	* app/tools/gimpbucketfilloptions.c
	* app/tools/gimpmagnifyoptions.c
	* app/tools/gimpselectionoptions.c
	* app/tools/gimptransformoptions.c: don't call the the reset()
	functions from the GUI constructors (and reset the options just
	deserialized from disk). Instead, added set_defaults() functions
	which do everything the old reset() functions did (except
	upchaining) and call set_defaults() from reset() and from the GUI
	constructors.
parent 03bc1fd4
2003-07-17 Michael Natterer <mitch@gimp.org>
* app/config/gimpconfig-params.[ch]: added "gboolean allow_percent"
to gimp_param_spec_unit() and to the GIMP_CONFIG_INSTALL_PROP_UNIT()
macro. Changed value validation accordingly.
* app/config/gimpconfig-types.c (string_to_unit): parse "percent"
correctly.
* app/widgets/gimppropwidgets.c (gimp_prop_unit_menu_new): show
the "Percent" menu entry if the param_spec allows percent.
* app/config/gimpcoreconfig.c
* app/core/gimpgrid.c
* app/core/gimptemplate.c
* app/text/gimptext.c: pass FALSE to disallow percent.
* app/paint/gimppaintoptions.c
* app/tools/gimpselectionoptions.c: pass TRUE. Brings back the
percent feature for fade_length, gradient_length and fixed_size
rect/ellipse select.
* app/tools/gimpbucketfilloptions.c
* app/tools/gimpmagnifyoptions.c
* app/tools/gimpselectionoptions.c
* app/tools/gimptransformoptions.c: don't call the the reset()
functions from the GUI constructors (and reset the options just
deserialized from disk). Instead, added set_defaults() functions
which do everything the old reset() functions did (except
upchaining) and call set_defaults() from reset() and from the GUI
constructors.
2003-07-17 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpdevicestatus.c (gimp_device_status_init):
......@@ -65,11 +65,11 @@ gimp_param_color_get_type (void)
if (!spec_type)
{
static const GTypeInfo type_info =
static const GTypeInfo type_info =
{
sizeof (GParamSpecClass),
NULL, NULL,
(GClassInitFunc) gimp_param_color_class_init,
NULL, NULL,
(GClassInitFunc) gimp_param_color_class_init,
NULL, NULL,
sizeof (GimpParamSpecColor),
0,
......@@ -77,10 +77,10 @@ gimp_param_color_get_type (void)
};
spec_type = g_type_register_static (G_TYPE_PARAM_BOXED,
"GimpParamColor",
"GimpParamColor",
&type_info, 0);
}
return spec_type;
}
......@@ -221,11 +221,11 @@ gimp_param_matrix2_get_type (void)
if (!spec_type)
{
static const GTypeInfo type_info =
static const GTypeInfo type_info =
{
sizeof (GParamSpecClass),
NULL, NULL,
(GClassInitFunc) gimp_param_matrix2_class_init,
NULL, NULL,
(GClassInitFunc) gimp_param_matrix2_class_init,
NULL, NULL,
sizeof (GimpParamSpecMatrix2),
0,
......@@ -233,10 +233,10 @@ gimp_param_matrix2_get_type (void)
};
spec_type = g_type_register_static (G_TYPE_PARAM_BOXED,
"GimpParamMatrix2",
"GimpParamMatrix2",
&type_info, 0);
}
return spec_type;
}
......@@ -325,21 +325,21 @@ gimp_param_memsize_get_type (void)
if (!spec_type)
{
static const GTypeInfo type_info =
static const GTypeInfo type_info =
{
sizeof (GParamSpecClass),
NULL, NULL,
(GClassInitFunc) gimp_param_memsize_class_init,
NULL, NULL,
(GClassInitFunc) gimp_param_memsize_class_init,
NULL, NULL,
sizeof (GParamSpecULong),
0, NULL, NULL
};
spec_type = g_type_register_static (G_TYPE_PARAM_ULONG,
"GimpParamMemsize",
spec_type = g_type_register_static (G_TYPE_PARAM_ULONG,
"GimpParamMemsize",
&type_info, 0);
}
return spec_type;
}
......@@ -362,11 +362,11 @@ gimp_param_spec_memsize (const gchar *name,
pspec = g_param_spec_internal (GIMP_TYPE_PARAM_MEMSIZE,
name, nick, blurb, flags);
pspec->minimum = minimum;
pspec->maximum = maximum;
pspec->default_value = default_value;
return G_PARAM_SPEC (pspec);
}
......@@ -395,21 +395,21 @@ gimp_param_path_get_type (void)
if (!spec_type)
{
static const GTypeInfo type_info =
static const GTypeInfo type_info =
{
sizeof (GParamSpecClass),
NULL, NULL,
(GClassInitFunc) gimp_param_path_class_init,
NULL, NULL,
(GClassInitFunc) gimp_param_path_class_init,
NULL, NULL,
sizeof (GimpParamSpecPath),
0, NULL, NULL
};
spec_type = g_type_register_static (G_TYPE_PARAM_STRING,
"GimpParamPath",
"GimpParamPath",
&type_info, 0);
}
return spec_type;
}
......@@ -431,8 +431,8 @@ gimp_param_spec_path (const gchar *name,
pspec = g_param_spec_internal (GIMP_TYPE_PARAM_PATH,
name, nick, blurb, flags);
pspec->default_value = default_value;
GIMP_PARAM_SPEC_PATH (pspec)->type = type;
......@@ -453,6 +453,17 @@ gimp_param_spec_path_type (GParamSpec *pspec)
* GIMP_TYPE_PARAM_UNIT
*/
#define GIMP_PARAM_SPEC_UNIT(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), GIMP_TYPE_PARAM_UNIT, GimpParamSpecUnit))
typedef struct _GimpParamSpecUnit GimpParamSpecUnit;
struct _GimpParamSpecUnit
{
GParamSpecInt parent_instance;
gboolean allow_percent;
};
static void gimp_param_unit_class_init (GParamSpecClass *class);
static gboolean gimp_param_unit_value_validate (GParamSpec *pspec,
GValue *value);
......@@ -464,21 +475,21 @@ gimp_param_unit_get_type (void)
if (!spec_type)
{
static const GTypeInfo type_info =
static const GTypeInfo type_info =
{
sizeof (GParamSpecClass),
NULL, NULL,
(GClassInitFunc) gimp_param_unit_class_init,
NULL, NULL,
sizeof (GParamSpecInt),
(GClassInitFunc) gimp_param_unit_class_init,
NULL, NULL,
sizeof (GimpParamSpecUnit),
0, NULL, NULL
};
spec_type = g_type_register_static (G_TYPE_PARAM_INT,
"GimpParamUnit",
"GimpParamUnit",
&type_info, 0);
}
return spec_type;
}
......@@ -493,13 +504,21 @@ static gboolean
gimp_param_unit_value_validate (GParamSpec *pspec,
GValue *value)
{
GParamSpecInt *ispec = G_PARAM_SPEC_INT (pspec);
gint oval = value->data[0].v_int;
value->data[0].v_int = CLAMP (value->data[0].v_int,
ispec->minimum,
gimp_unit_get_number_of_units () - 1);
GParamSpecInt *ispec = G_PARAM_SPEC_INT (pspec);
GimpParamSpecUnit *uspec = GIMP_PARAM_SPEC_UNIT (pspec);
gint oval = value->data[0].v_int;
if (uspec->allow_percent && value->data[0].v_int == GIMP_UNIT_PERCENT)
{
value->data[0].v_int = value->data[0].v_int;
}
else
{
value->data[0].v_int = CLAMP (value->data[0].v_int,
ispec->minimum,
gimp_unit_get_number_of_units () - 1);
}
return value->data[0].v_int != oval;
}
......@@ -508,17 +527,23 @@ gimp_param_spec_unit (const gchar *name,
const gchar *nick,
const gchar *blurb,
gboolean allow_pixels,
gboolean allow_percent,
GimpUnit default_value,
GParamFlags flags)
{
GParamSpecInt *pspec;
GimpParamSpecUnit *pspec;
GParamSpecInt *ispec;
pspec = g_param_spec_internal (GIMP_TYPE_PARAM_UNIT,
name, nick, blurb, flags);
pspec->default_value = default_value;
pspec->minimum = allow_pixels ? GIMP_UNIT_PIXEL : GIMP_UNIT_INCH;
pspec->maximum = G_MAXINT;
ispec = G_PARAM_SPEC_INT (pspec);
ispec->default_value = default_value;
ispec->minimum = allow_pixels ? GIMP_UNIT_PIXEL : GIMP_UNIT_INCH;
ispec->maximum = GIMP_UNIT_PERCENT - 1;
pspec->allow_percent = allow_percent;
return G_PARAM_SPEC (pspec);
}
......@@ -124,6 +124,7 @@ GParamSpec * gimp_param_spec_unit (const gchar *name,
const gchar *nick,
const gchar *blurb,
gboolean allow_pixels,
gboolean allow_percent,
GimpUnit default_value,
GParamFlags flags);
......@@ -191,10 +192,10 @@ GParamSpec * gimp_param_spec_unit (const gchar *name,
min, max, default,\
flags | GIMP_CONFIG_PARAM_FLAGS))
#define GIMP_CONFIG_INSTALL_PROP_UNIT(class, id,\
name, blurb, pixels, default, flags)\
name, blurb, pixels, percent, default, flags)\
g_object_class_install_property (class, id,\
gimp_param_spec_unit (name, NULL, blurb,\
pixels, default,\
pixels, percent, default,\
flags | GIMP_CONFIG_PARAM_FLAGS))
......
......@@ -88,7 +88,7 @@ gimp_memsize_get_type (void)
{
static const GTypeInfo type_info = { 0, };
memsize_type = g_type_register_static (G_TYPE_ULONG, "GimpMemsize",
memsize_type = g_type_register_static (G_TYPE_ULONG, "GimpMemsize",
&type_info, 0);
g_value_register_transform_func (memsize_type, G_TYPE_STRING,
......@@ -96,7 +96,7 @@ gimp_memsize_get_type (void)
g_value_register_transform_func (G_TYPE_STRING, memsize_type,
string_to_memsize);
}
return memsize_type;
}
......@@ -118,7 +118,7 @@ gimp_memsize_set_from_string (GValue *value,
if (end && *end)
{
guint shift;
switch (g_ascii_tolower (*end))
{
case 'b':
......@@ -141,16 +141,16 @@ gimp_memsize_set_from_string (GValue *value,
if (shift)
{
gulong limit = G_MAXULONG >> (shift);
if (size != (size & limit))
return FALSE;
size <<= shift;
}
}
g_value_set_ulong (value, size);
return TRUE;
}
......@@ -163,10 +163,10 @@ gimp_path_get_type (void)
{
static const GTypeInfo type_info = { 0, };
path_type = g_type_register_static (G_TYPE_STRING, "GimpPath",
path_type = g_type_register_static (G_TYPE_STRING, "GimpPath",
&type_info, 0);
}
return path_type;
}
......@@ -179,7 +179,7 @@ gimp_unit_get_type (void)
{
static const GTypeInfo type_info = { 0, };
unit_type = g_type_register_static (G_TYPE_INT, "GimpUnit",
unit_type = g_type_register_static (G_TYPE_INT, "GimpUnit",
&type_info, 0);
g_value_register_transform_func (unit_type, G_TYPE_STRING,
......@@ -187,7 +187,7 @@ gimp_unit_get_type (void)
g_value_register_transform_func (G_TYPE_STRING, unit_type,
string_to_unit);
}
return unit_type;
}
......@@ -279,8 +279,13 @@ string_to_unit (const GValue *src_value,
break;
if (i == num_units)
goto error;
{
if (strcmp (str, gimp_unit_get_identifier (GIMP_UNIT_PERCENT)) == 0)
i = GIMP_UNIT_PERCENT;
else
goto error;
}
g_value_set_int (dest_value, i);
return;
......
......@@ -218,7 +218,7 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
0);
GIMP_CONFIG_INSTALL_PROP_UNIT (object_class, PROP_DEFAULT_UNIT,
"default-unit", DEFAULT_UNIT_BLURB,
FALSE, GIMP_UNIT_INCH,
FALSE, FALSE, GIMP_UNIT_INCH,
0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_DEFAULT_XRESOLUTION,
"default-xresolution",
......@@ -235,7 +235,7 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
GIMP_CONFIG_INSTALL_PROP_UNIT (object_class, PROP_DEFAULT_RESOLUTION_UNIT,
"default-resolution-unit",
DEFAULT_RESOLUTION_UNIT_BLURB,
FALSE, GIMP_UNIT_INCH,
FALSE, FALSE, GIMP_UNIT_INCH,
0);
GIMP_CONFIG_INSTALL_PROP_INT (object_class, PROP_UNDO_LEVELS,
"undo-levels", UNDO_LEVELS_BLURB,
......
......@@ -84,10 +84,10 @@ gimp_grid_get_type (void)
0, /* n_preallocs */
NULL /* instance_init */
};
static const GInterfaceInfo grid_iface_info =
static const GInterfaceInfo grid_iface_info =
{
NULL, /* iface_init */
NULL, /* iface_finalize */
NULL, /* iface_finalize */
NULL /* iface_data */
};
......@@ -130,7 +130,7 @@ gimp_grid_class_init (GimpGridClass *klass)
0);
GIMP_CONFIG_INSTALL_PROP_UNIT (object_class, PROP_SPACING_UNIT,
"spacing-unit", NULL,
FALSE, GIMP_UNIT_INCH,
FALSE, FALSE, GIMP_UNIT_INCH,
0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_XOFFSET,
"xoffset", NULL,
......@@ -144,7 +144,7 @@ gimp_grid_class_init (GimpGridClass *klass)
0);
GIMP_CONFIG_INSTALL_PROP_UNIT (object_class, PROP_OFFSET_UNIT,
"offset-unit", NULL,
FALSE, GIMP_UNIT_INCH,
FALSE, FALSE, GIMP_UNIT_INCH,
0);
GIMP_CONFIG_INSTALL_PROP_COLOR (object_class, PROP_FGCOLOR,
"fgcolor", NULL,
......
......@@ -153,7 +153,7 @@ gimp_template_class_init (GimpTemplateClass *klass)
0);
GIMP_CONFIG_INSTALL_PROP_UNIT (object_class, PROP_UNIT, "unit",
NULL,
FALSE, GIMP_UNIT_INCH,
FALSE, FALSE, GIMP_UNIT_INCH,
0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_XRESOLUTION,
......@@ -171,7 +171,7 @@ gimp_template_class_init (GimpTemplateClass *klass)
GIMP_CONFIG_INSTALL_PROP_UNIT (object_class, PROP_RESOLUTION_UNIT,
"resolution-unit",
NULL,
FALSE, GIMP_UNIT_INCH,
FALSE, FALSE, GIMP_UNIT_INCH,
0);
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_IMAGE_TYPE,
......
......@@ -173,7 +173,7 @@ gimp_paint_options_class_init (GimpPaintOptionsClass *klass)
0);
GIMP_CONFIG_INSTALL_PROP_UNIT (object_class, PROP_FADE_UNIT,
"fade-unit", NULL,
TRUE, DEFAULT_FADE_UNIT,
TRUE, TRUE, DEFAULT_FADE_UNIT,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_USE_GRADIENT,
......@@ -185,7 +185,7 @@ gimp_paint_options_class_init (GimpPaintOptionsClass *klass)
0);
GIMP_CONFIG_INSTALL_PROP_UNIT (object_class, PROP_GRADIENT_UNIT,
"gradient-unit", NULL,
TRUE, DEFAULT_GRADIENT_UNIT,
TRUE, TRUE, DEFAULT_GRADIENT_UNIT,
0);
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_GRADIENT_TYPE,
"gradient-type", NULL,
......
......@@ -155,7 +155,7 @@ gimp_text_class_init (GimpTextClass *klass)
0);
GIMP_CONFIG_INSTALL_PROP_UNIT (object_class, PROP_FONT_SIZE_UNIT,
"font-size-unit", NULL,
TRUE, GIMP_UNIT_PIXEL,
TRUE, FALSE, GIMP_UNIT_PIXEL,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_HINTING,
"hinting",
......@@ -222,7 +222,7 @@ gimp_text_class_init (GimpTextClass *klass)
0);
GIMP_CONFIG_INSTALL_PROP_UNIT (object_class, PROP_BOX_UNIT,
"box-unit", NULL,
TRUE, GIMP_UNIT_PIXEL,
TRUE, FALSE, GIMP_UNIT_PIXEL,
0);
GIMP_CONFIG_INSTALL_PROP_MATRIX2 (object_class, PROP_TRANSFORMATION,
"transformation", NULL,
......
......@@ -55,16 +55,17 @@ enum
static void gimp_bucket_fill_options_init (GimpBucketFillOptions *options);
static void gimp_bucket_fill_options_class_init (GimpBucketFillOptionsClass *options_class);
static void gimp_bucket_fill_options_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_bucket_fill_options_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_bucket_fill_options_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_bucket_fill_options_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_bucket_fill_options_reset (GimpToolOptions *tool_options);
static void gimp_bucket_fill_options_reset (GimpToolOptions *tool_options);
static void gimp_bucket_fill_options_set_defaults (GimpToolOptions *tool_options);
static GimpPaintOptionsClass *parent_class = NULL;
......@@ -98,7 +99,7 @@ gimp_bucket_fill_options_get_type (void)
return type;
}
static void
static void
gimp_bucket_fill_options_class_init (GimpBucketFillOptionsClass *klass)
{
GObjectClass *object_class;
......@@ -205,6 +206,14 @@ gimp_bucket_fill_options_get_property (GObject *object,
static void
gimp_bucket_fill_options_reset (GimpToolOptions *tool_options)
{
gimp_bucket_fill_options_set_defaults (tool_options);
GIMP_TOOL_OPTIONS_CLASS (parent_class)->reset (tool_options);
}
static void
gimp_bucket_fill_options_set_defaults (GimpToolOptions *tool_options)
{
GParamSpec *pspec;
......@@ -214,8 +223,6 @@ gimp_bucket_fill_options_reset (GimpToolOptions *tool_options)
if (pspec)
G_PARAM_SPEC_DOUBLE (pspec)->default_value =
GIMP_GUI_CONFIG (tool_options->tool_info->gimp->config)->default_threshold;
GIMP_TOOL_OPTIONS_CLASS (parent_class)->reset (tool_options);
}
GtkWidget *
......@@ -274,7 +281,7 @@ gimp_bucket_fill_options_gui (GimpToolOptions *tool_options)
1.0, 16.0, 1,
FALSE, 0.0, 0.0);
gimp_bucket_fill_options_reset (tool_options);
gimp_bucket_fill_options_set_defaults (tool_options);
return vbox;
}
......@@ -61,6 +61,7 @@ static void gimp_magnify_options_get_property (GObject *object,
GParamSpec *pspec);
static void gimp_magnify_options_reset (GimpToolOptions *tool_options);
static void gimp_magnify_options_set_defaults (GimpToolOptions *tool_options);
static GimpToolOptionsClass *parent_class = NULL;
......@@ -94,7 +95,7 @@ gimp_magnify_options_get_type (void)
return type;
}
static void
static void
gimp_magnify_options_class_init (GimpMagnifyOptionsClass *klass)
{
GObjectClass *object_class;
......@@ -186,6 +187,14 @@ gimp_magnify_options_get_property (GObject *object,
static void
gimp_magnify_options_reset (GimpToolOptions *tool_options)
{
gimp_magnify_options_set_defaults (tool_options);
GIMP_TOOL_OPTIONS_CLASS (parent_class)->reset (tool_options);
}
static void
gimp_magnify_options_set_defaults (GimpToolOptions *tool_options)
{
GParamSpec *pspec;
......@@ -193,12 +202,8 @@ gimp_magnify_options_reset (GimpToolOptions *tool_options)
"allow-resize");
if (pspec)
{
G_PARAM_SPEC_BOOLEAN (pspec)->default_value =
GIMP_DISPLAY_CONFIG (tool_options->tool_info->gimp->config)->resize_windows_on_zoom;
}
GIMP_TOOL_OPTIONS_CLASS (parent_class)->reset (tool_options);
G_PARAM_SPEC_BOOLEAN (pspec)->default_value =
GIMP_DISPLAY_CONFIG (tool_options->tool_info->gimp->config)->resize_windows_on_zoom;
}
GtkWidget *
......@@ -243,7 +248,7 @@ gimp_magnify_options_gui (GimpToolOptions *tool_options)
1.0, 3.0, 1,
FALSE, 0.0, 0.0);
gimp_magnify_options_reset (tool_options);
gimp_magnify_options_set_defaults (tool_options);
return vbox;
}
......@@ -75,7 +75,7 @@ static void gimp_selection_options_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
static void gimp_selection_options_reset (GimpToolOptions *tool_options);
static void gimp_selection_options_reset (GimpToolOptions *tool_options);static void gimp_selection_options_set_defaults (GimpToolOptions *tool_options);
static void selection_options_fixed_mode_notify (GimpSelectionOptions *options,
GParamSpec *pspec,
......@@ -113,7 +113,7 @@ gimp_selection_options_get_type (void)
return type;
}
static void
static void
gimp_selection_options_class_init (GimpSelectionOptionsClass *klass)
{
GObjectClass *object_class;
......@@ -191,7 +191,7 @@ gimp_selection_options_class_init (GimpSelectionOptionsClass *klass)
0);
GIMP_CONFIG_INSTALL_PROP_UNIT (object_class, PROP_FIXED_UNIT,
"fixed-unit", NULL,
TRUE, GIMP_UNIT_PIXEL,
TRUE, TRUE, GIMP_UNIT_PIXEL,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_INTERACTIVE,
......@@ -338,32 +338,29 @@ gimp_selection_options_get_property (GObject *object,
static void
gimp_selection_options_reset (GimpToolOptions *tool_options)
{
GimpSelectionOptions *options;
GParamSpec *pspec;
gimp_selection_options_set_defaults (tool_options);
options = GIMP_SELECTION_OPTIONS (tool_options);
GIMP_TOOL_OPTIONS_CLASS (parent_class)->reset (tool_options);
}
static void
gimp_selection_options_set_defaults (GimpToolOptions *tool_options)
{
GParamSpec *pspec;
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (tool_options),
"antialias");
if (pspec)
{
if (tool_options->tool_info->tool_type == GIMP_TYPE_RECT_SELECT_TOOL)
G_PARAM_SPEC_BOOLEAN (pspec)->default_value = FALSE;
else
G_PARAM_SPEC_BOOLEAN (pspec)->default_value = TRUE;
}
G_PARAM_SPEC_BOOLEAN (pspec)->default_value =
(tool_options->tool_info->tool_type != GIMP_TYPE_RECT_SELECT_TOOL);
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (tool_options),
"threshold");
if (pspec)
{
G_PARAM_SPEC_DOUBLE (pspec)->default_value =
GIMP_GUI_CONFIG (tool_options->tool_info->gimp->config)->default_threshold;
}
GIMP_TOOL_OPTIONS_CLASS (parent_class)->reset (tool_options);
G_PARAM_SPEC_DOUBLE (pspec)->default_value =
GIMP_GUI_CONFIG (tool_options->tool_info->gimp->config)->default_threshold;
}
GtkWidget *
......@@ -432,7 +429,7 @@ gimp_selection_options_gui (GimpToolOptions *tool_options)
gtk_widget_set_sensitive (table, options->feather);
g_object_set_data (G_OBJECT (button), "set_sensitive", table);
/* the feather radius scale */
gimp_prop_scale_entry_new (config, "feather-radius",
GTK_TABLE (table), 0, 0,
......@@ -588,7 +585,7 @@ gimp_selection_options_gui (GimpToolOptions *tool_options)
gtk_widget_show (table);
}
gimp_selection_options_reset (tool_options);
gimp_selection_options_set_defaults (tool_options);
return vbox;
}
......
......@@ -68,7 +68,7 @@ static void gimp_transform_options_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
static void gimp_transform_options_reset (GimpToolOptions *tool_options);
static void gimp_transform_options_reset (GimpToolOptions *tool_options);static void gimp_transform_options_set_defaults (GimpToolOptions *tool_options);
static void gimp_transform_options_grid_notify (GimpTransformOptions *options,
GParamSpec *pspec,
......@@ -106,7 +106,7 @@ gimp_transform_options_get_type (void)
return type;
}
static void
static void
gimp_transform_options_class_init (GimpTransformOptionsClass *klass)
{
GObjectClass *object_class;
......@@ -252,21 +252,22 @@ gimp_transform_options_get_property (GObject *object,
static void
gimp_transform_options_reset (GimpToolOptions *tool_options)
{
GimpTransformOptions *options;
GParamSpec *pspec;
gimp_transform_options_set_defaults (tool_options);
options = GIMP_TRANSFORM_OPTIONS (tool_options);
GIMP_TOOL_OPTIONS_CLASS (parent_class)->reset (tool_options);
}
static void
gimp_transform_options_set_defaults (GimpToolOptions *tool_options)
{
GParamSpec *pspec;
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (tool_options),
"interpolation");
if (pspec)
{
G_PARAM_SPEC_ENUM (pspec)->default_value =
tool_options->tool_info->gimp->config->interpolation_type;
}
GIMP_TOOL_OPTIONS_CLASS (parent_class)->reset (tool_options);
G_PARAM_SPEC_ENUM (pspec)->default_value =
tool_options->tool_info->gimp->config->interpolation_type;
}
GtkWidget *
......@@ -405,7 +406,7 @@ gimp_transform_options_gui (GimpToolOptions *tool_options)
}
}
gimp_transform_options_reset (tool_optio