2019-09-14 23:34:06 +08:00
|
|
|
/* LIBGIMP - The GIMP Library
|
|
|
|
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
|
2009-01-26 02:01:47 +08:00
|
|
|
*
|
2019-09-14 23:34:06 +08:00
|
|
|
* gimpconfig-params.c
|
|
|
|
* Copyright (C) 2008-2019 Michael Natterer <mitch@gimp.org>
|
2009-01-26 02:01:47 +08:00
|
|
|
*
|
2019-09-14 23:34:06 +08:00
|
|
|
* This library is free software: you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 3 of the License, or (at your option) any later version.
|
2009-01-26 02:01:47 +08:00
|
|
|
*
|
2019-09-14 23:34:06 +08:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
2009-01-26 02:01:47 +08:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2019-09-14 23:34:06 +08:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2009-01-26 02:01:47 +08:00
|
|
|
*
|
2019-09-14 23:34:06 +08:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library. If not, see
|
|
|
|
* <https://www.gnu.org/licenses/>.
|
2009-01-26 02:01:47 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2011-04-28 21:50:39 +08:00
|
|
|
#include <cairo.h>
|
2019-09-14 23:34:06 +08:00
|
|
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
|
|
|
|
2009-01-26 02:01:47 +08:00
|
|
|
#include <gegl.h>
|
|
|
|
#include <gegl-paramspecs.h>
|
|
|
|
|
2019-09-15 00:29:38 +08:00
|
|
|
#include "libgimpbase/gimpbase.h"
|
2009-01-26 02:01:47 +08:00
|
|
|
#include "libgimpcolor/gimpcolor.h"
|
|
|
|
#include "libgimpconfig/gimpconfig.h"
|
|
|
|
|
2019-09-14 23:34:06 +08:00
|
|
|
#include "gimpconfig.h"
|
2009-01-26 02:01:47 +08:00
|
|
|
|
2014-05-17 06:19:20 +08:00
|
|
|
|
2019-09-17 02:24:06 +08:00
|
|
|
/**
|
|
|
|
* SECTION: gimpconfig-params
|
|
|
|
* @title: GimpConfig-params
|
|
|
|
* @short_description: Macros and defines to install config properties.
|
|
|
|
*
|
|
|
|
* Macros and defines to install config properties.
|
|
|
|
**/
|
|
|
|
|
|
|
|
|
2019-09-14 23:34:06 +08:00
|
|
|
static gboolean
|
|
|
|
gimp_gegl_param_spec_has_key (GParamSpec *pspec,
|
|
|
|
const gchar *key,
|
|
|
|
const gchar *value)
|
|
|
|
{
|
|
|
|
const gchar *v = gegl_param_spec_get_property_key (pspec, key);
|
|
|
|
|
|
|
|
if (v && ! strcmp (v, value))
|
|
|
|
return TRUE;
|
2009-01-26 02:01:47 +08:00
|
|
|
|
2019-09-14 23:34:06 +08:00
|
|
|
return FALSE;
|
|
|
|
}
|
2009-01-26 02:01:47 +08:00
|
|
|
|
|
|
|
|
2019-09-14 23:34:06 +08:00
|
|
|
/**
|
|
|
|
* gimp_config_param_spec_duplicate:
|
|
|
|
* @pspec: the #GParamSpec to duplicate
|
|
|
|
*
|
|
|
|
* Creates an exact copy of @pspec, with all its properties, returns
|
|
|
|
* %NULL if @pspec is of an unknown type that can't be duplicated.
|
|
|
|
*
|
|
|
|
* Return: (transfer full): The new #GParamSpec, or %NULL.
|
|
|
|
*
|
|
|
|
* Since: 3.0
|
|
|
|
**/
|
2009-01-26 02:01:47 +08:00
|
|
|
GParamSpec *
|
2019-09-14 23:34:06 +08:00
|
|
|
gimp_config_param_spec_duplicate (GParamSpec *pspec)
|
2009-01-26 02:01:47 +08:00
|
|
|
{
|
2014-05-15 04:50:59 +08:00
|
|
|
GParamSpec *copy = NULL;
|
2019-09-14 23:52:54 +08:00
|
|
|
const gchar *name;
|
|
|
|
const gchar *nick;
|
|
|
|
const gchar *blurb;
|
2014-05-15 04:50:59 +08:00
|
|
|
GParamFlags flags;
|
|
|
|
|
2009-01-26 02:01:47 +08:00
|
|
|
g_return_val_if_fail (pspec != NULL, NULL);
|
|
|
|
|
2019-09-14 23:52:54 +08:00
|
|
|
name = pspec->name;
|
|
|
|
nick = g_param_spec_get_nick (pspec);
|
|
|
|
blurb = g_param_spec_get_blurb (pspec);
|
2014-05-17 06:19:20 +08:00
|
|
|
flags = pspec->flags;
|
|
|
|
|
2019-09-14 23:34:06 +08:00
|
|
|
/* this special case exists for the GEGL tool, we don't want this
|
|
|
|
* property serialized
|
|
|
|
*/
|
2014-05-17 06:19:20 +08:00
|
|
|
if (! gimp_gegl_param_spec_has_key (pspec, "role", "output-extent"))
|
|
|
|
flags |= GIMP_CONFIG_PARAM_SERIALIZE;
|
2014-05-15 04:50:59 +08:00
|
|
|
|
2009-01-26 02:01:47 +08:00
|
|
|
if (G_IS_PARAM_SPEC_STRING (pspec))
|
|
|
|
{
|
2019-09-15 00:07:06 +08:00
|
|
|
GParamSpecString *spec = G_PARAM_SPEC_STRING (pspec);
|
2009-01-26 02:01:47 +08:00
|
|
|
|
|
|
|
if (GEGL_IS_PARAM_SPEC_FILE_PATH (pspec))
|
|
|
|
{
|
2019-09-14 23:52:54 +08:00
|
|
|
copy = gimp_param_spec_config_path (name, nick, blurb,
|
2009-01-26 02:01:47 +08:00
|
|
|
GIMP_CONFIG_PATH_FILE,
|
2019-09-15 00:07:06 +08:00
|
|
|
spec->default_value,
|
2019-09-14 23:56:23 +08:00
|
|
|
flags);
|
|
|
|
}
|
|
|
|
else if (GIMP_IS_PARAM_SPEC_CONFIG_PATH (pspec))
|
|
|
|
{
|
|
|
|
copy = gimp_param_spec_config_path (name, nick, blurb,
|
|
|
|
gimp_param_spec_config_path_type (pspec),
|
2019-09-15 00:07:06 +08:00
|
|
|
spec->default_value,
|
2014-05-15 04:50:59 +08:00
|
|
|
flags);
|
2009-01-26 02:01:47 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-09-14 23:52:54 +08:00
|
|
|
copy = g_param_spec_string (name, nick, blurb,
|
2019-09-15 00:07:06 +08:00
|
|
|
spec->default_value,
|
2014-05-15 04:50:59 +08:00
|
|
|
flags);
|
2009-01-26 02:01:47 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (G_IS_PARAM_SPEC_BOOLEAN (pspec))
|
|
|
|
{
|
|
|
|
GParamSpecBoolean *spec = G_PARAM_SPEC_BOOLEAN (pspec);
|
|
|
|
|
2019-09-14 23:52:54 +08:00
|
|
|
copy = g_param_spec_boolean (name, nick, blurb,
|
2009-01-26 02:01:47 +08:00
|
|
|
spec->default_value,
|
2014-05-15 04:50:59 +08:00
|
|
|
flags);
|
2009-01-26 02:01:47 +08:00
|
|
|
}
|
|
|
|
else if (G_IS_PARAM_SPEC_ENUM (pspec))
|
|
|
|
{
|
|
|
|
GParamSpecEnum *spec = G_PARAM_SPEC_ENUM (pspec);
|
|
|
|
|
2019-09-14 23:52:54 +08:00
|
|
|
copy = g_param_spec_enum (name, nick, blurb,
|
2009-01-26 02:01:47 +08:00
|
|
|
G_TYPE_FROM_CLASS (spec->enum_class),
|
|
|
|
spec->default_value,
|
2014-05-15 04:50:59 +08:00
|
|
|
flags);
|
2009-01-26 02:01:47 +08:00
|
|
|
}
|
|
|
|
else if (G_IS_PARAM_SPEC_DOUBLE (pspec))
|
|
|
|
{
|
|
|
|
GParamSpecDouble *spec = G_PARAM_SPEC_DOUBLE (pspec);
|
|
|
|
|
2019-09-15 00:07:06 +08:00
|
|
|
if (GEGL_IS_PARAM_SPEC_DOUBLE (pspec))
|
|
|
|
{
|
|
|
|
GeglParamSpecDouble *gspec = GEGL_PARAM_SPEC_DOUBLE (pspec);
|
|
|
|
|
|
|
|
copy = gegl_param_spec_double (name, nick, blurb,
|
|
|
|
spec->minimum,
|
|
|
|
spec->maximum,
|
|
|
|
spec->default_value,
|
|
|
|
gspec->ui_minimum,
|
|
|
|
gspec->ui_maximum,
|
|
|
|
gspec->ui_gamma,
|
|
|
|
flags);
|
|
|
|
gegl_param_spec_double_set_steps (GEGL_PARAM_SPEC_DOUBLE (copy),
|
|
|
|
gspec->ui_step_small,
|
|
|
|
gspec->ui_step_big);
|
|
|
|
gegl_param_spec_double_set_digits (GEGL_PARAM_SPEC_DOUBLE (copy),
|
|
|
|
gspec->ui_digits);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
copy = g_param_spec_double (name, nick, blurb,
|
|
|
|
spec->minimum,
|
|
|
|
spec->maximum,
|
|
|
|
spec->default_value,
|
|
|
|
flags);
|
|
|
|
}
|
2009-01-26 02:01:47 +08:00
|
|
|
}
|
|
|
|
else if (G_IS_PARAM_SPEC_FLOAT (pspec))
|
|
|
|
{
|
|
|
|
GParamSpecFloat *spec = G_PARAM_SPEC_FLOAT (pspec);
|
|
|
|
|
2019-09-14 23:52:54 +08:00
|
|
|
copy = g_param_spec_float (name, nick, blurb,
|
2009-01-26 02:01:47 +08:00
|
|
|
spec->minimum,
|
|
|
|
spec->maximum,
|
|
|
|
spec->default_value,
|
2014-05-15 04:50:59 +08:00
|
|
|
flags);
|
2009-01-26 02:01:47 +08:00
|
|
|
}
|
|
|
|
else if (G_IS_PARAM_SPEC_INT (pspec))
|
|
|
|
{
|
|
|
|
GParamSpecInt *spec = G_PARAM_SPEC_INT (pspec);
|
|
|
|
|
2019-09-15 00:07:06 +08:00
|
|
|
if (GEGL_IS_PARAM_SPEC_INT (pspec))
|
|
|
|
{
|
|
|
|
GeglParamSpecInt *gspec = GEGL_PARAM_SPEC_INT (pspec);
|
|
|
|
|
|
|
|
copy = gegl_param_spec_int (name, nick, blurb,
|
|
|
|
spec->minimum,
|
|
|
|
spec->maximum,
|
|
|
|
spec->default_value,
|
|
|
|
gspec->ui_minimum,
|
|
|
|
gspec->ui_maximum,
|
|
|
|
gspec->ui_gamma,
|
|
|
|
flags);
|
|
|
|
gegl_param_spec_int_set_steps (GEGL_PARAM_SPEC_INT (copy),
|
|
|
|
gspec->ui_step_small,
|
|
|
|
gspec->ui_step_big);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
copy = g_param_spec_int (name, nick, blurb,
|
|
|
|
spec->minimum,
|
|
|
|
spec->maximum,
|
|
|
|
spec->default_value,
|
|
|
|
flags);
|
|
|
|
}
|
2009-01-26 02:01:47 +08:00
|
|
|
}
|
|
|
|
else if (G_IS_PARAM_SPEC_UINT (pspec))
|
|
|
|
{
|
|
|
|
GParamSpecUInt *spec = G_PARAM_SPEC_UINT (pspec);
|
|
|
|
|
2019-09-15 00:07:06 +08:00
|
|
|
if (GEGL_IS_PARAM_SPEC_SEED (pspec))
|
|
|
|
{
|
|
|
|
GeglParamSpecSeed *gspec = GEGL_PARAM_SPEC_SEED (pspec);
|
|
|
|
|
|
|
|
copy = gegl_param_spec_seed (name, nick, blurb,
|
|
|
|
flags);
|
|
|
|
|
|
|
|
G_PARAM_SPEC_UINT (copy)->minimum = spec->minimum;
|
|
|
|
G_PARAM_SPEC_UINT (copy)->maximum = spec->maximum;
|
|
|
|
G_PARAM_SPEC_UINT (copy)->default_value = spec->default_value;
|
|
|
|
|
|
|
|
GEGL_PARAM_SPEC_SEED (copy)->ui_minimum = gspec->ui_minimum;
|
|
|
|
GEGL_PARAM_SPEC_SEED (copy)->ui_maximum = gspec->ui_maximum;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
copy = g_param_spec_uint (name, nick, blurb,
|
|
|
|
spec->minimum,
|
|
|
|
spec->maximum,
|
|
|
|
spec->default_value,
|
|
|
|
flags);
|
|
|
|
}
|
2009-01-26 02:01:47 +08:00
|
|
|
}
|
2023-08-03 05:55:33 +08:00
|
|
|
else if (GIMP_IS_PARAM_SPEC_CHOICE (pspec))
|
|
|
|
{
|
|
|
|
GimpParamSpecChoice *spec = GIMP_PARAM_SPEC_CHOICE (pspec);
|
|
|
|
|
|
|
|
copy = gimp_param_spec_choice (name, nick, blurb,
|
|
|
|
g_object_ref (spec->choice),
|
|
|
|
spec->default_value,
|
|
|
|
flags);
|
|
|
|
}
|
app, libgimp*, pdb: new GimpParamSpecObject abstract spec type.
This abstract spec type is basically a GParamSpecObject with a default
value. It will be used by various object spec with default values, such
as GimpParamSpecColor, GimpParamSpecUnit and all GimpParamSpecResource
subtypes. Also it has a duplicate() class method so that every spec type
can implement the proper way to duplicate itself.
This fixes the fact that in gimp_config_param_spec_duplicate(), all
unknown object spec types (because they are implemented in libgimp,
which is invisible to libgimpconfig) are just copied as
GParamSpecObject, hence losing default values and other parameters.
As a second enhancement, it also makes it easier to detect the object
spec types for which we have default value support in
gimp_config_reset_properties().
As a side fix, gimp_param_spec_color() now just always duplicates the
passed default color, making it hence much easier to avoid bugs when
reusing a GeglColor.
2024-09-03 05:38:13 +08:00
|
|
|
else if (GIMP_IS_PARAM_SPEC_OBJECT (pspec))
|
2024-04-20 05:02:29 +08:00
|
|
|
{
|
app, libgimp*, pdb: new GimpParamSpecObject abstract spec type.
This abstract spec type is basically a GParamSpecObject with a default
value. It will be used by various object spec with default values, such
as GimpParamSpecColor, GimpParamSpecUnit and all GimpParamSpecResource
subtypes. Also it has a duplicate() class method so that every spec type
can implement the proper way to duplicate itself.
This fixes the fact that in gimp_config_param_spec_duplicate(), all
unknown object spec types (because they are implemented in libgimp,
which is invisible to libgimpconfig) are just copied as
GParamSpecObject, hence losing default values and other parameters.
As a second enhancement, it also makes it easier to detect the object
spec types for which we have default value support in
gimp_config_reset_properties().
As a side fix, gimp_param_spec_color() now just always duplicates the
passed default color, making it hence much easier to avoid bugs when
reusing a GeglColor.
2024-09-03 05:38:13 +08:00
|
|
|
/* GimpParamSpecColor, GimpParamSpecUnit and all GimpParamSpecResource types. */
|
|
|
|
copy = gimp_param_spec_object_duplicate (pspec);
|
|
|
|
copy->flags = flags;
|
2024-04-20 05:02:29 +08:00
|
|
|
}
|
2009-01-26 02:01:47 +08:00
|
|
|
else if (GEGL_IS_PARAM_SPEC_COLOR (pspec))
|
|
|
|
{
|
2023-12-23 22:11:43 +08:00
|
|
|
GeglColor *color;
|
2009-01-26 02:01:47 +08:00
|
|
|
|
app, libgimp*, pdb: new GimpParamSpecObject abstract spec type.
This abstract spec type is basically a GParamSpecObject with a default
value. It will be used by various object spec with default values, such
as GimpParamSpecColor, GimpParamSpecUnit and all GimpParamSpecResource
subtypes. Also it has a duplicate() class method so that every spec type
can implement the proper way to duplicate itself.
This fixes the fact that in gimp_config_param_spec_duplicate(), all
unknown object spec types (because they are implemented in libgimp,
which is invisible to libgimpconfig) are just copied as
GParamSpecObject, hence losing default values and other parameters.
As a second enhancement, it also makes it easier to detect the object
spec types for which we have default value support in
gimp_config_reset_properties().
As a side fix, gimp_param_spec_color() now just always duplicates the
passed default color, making it hence much easier to avoid bugs when
reusing a GeglColor.
2024-09-03 05:38:13 +08:00
|
|
|
color = gegl_param_spec_color_get_default (pspec);
|
|
|
|
color = gegl_color_duplicate (color);
|
2009-01-26 02:01:47 +08:00
|
|
|
|
app, libgimp*, pdb: new GimpParamSpecObject abstract spec type.
This abstract spec type is basically a GParamSpecObject with a default
value. It will be used by various object spec with default values, such
as GimpParamSpecColor, GimpParamSpecUnit and all GimpParamSpecResource
subtypes. Also it has a duplicate() class method so that every spec type
can implement the proper way to duplicate itself.
This fixes the fact that in gimp_config_param_spec_duplicate(), all
unknown object spec types (because they are implemented in libgimp,
which is invisible to libgimpconfig) are just copied as
GParamSpecObject, hence losing default values and other parameters.
As a second enhancement, it also makes it easier to detect the object
spec types for which we have default value support in
gimp_config_reset_properties().
As a side fix, gimp_param_spec_color() now just always duplicates the
passed default color, making it hence much easier to avoid bugs when
reusing a GeglColor.
2024-09-03 05:38:13 +08:00
|
|
|
copy = gegl_param_spec_color (name, nick, blurb, color, flags);
|
2024-02-25 23:18:05 +08:00
|
|
|
g_clear_object (&color);
|
|
|
|
}
|
|
|
|
else if (G_IS_PARAM_SPEC_OBJECT (pspec) &&
|
|
|
|
G_PARAM_SPEC_VALUE_TYPE (pspec) == GEGL_TYPE_COLOR)
|
|
|
|
{
|
|
|
|
GValue *value;
|
|
|
|
GeglColor *color;
|
|
|
|
|
|
|
|
value = (GValue *) g_param_spec_get_default_value (pspec);
|
app, libgimp*, pdb: new GimpParamSpecObject abstract spec type.
This abstract spec type is basically a GParamSpecObject with a default
value. It will be used by various object spec with default values, such
as GimpParamSpecColor, GimpParamSpecUnit and all GimpParamSpecResource
subtypes. Also it has a duplicate() class method so that every spec type
can implement the proper way to duplicate itself.
This fixes the fact that in gimp_config_param_spec_duplicate(), all
unknown object spec types (because they are implemented in libgimp,
which is invisible to libgimpconfig) are just copied as
GParamSpecObject, hence losing default values and other parameters.
As a second enhancement, it also makes it easier to detect the object
spec types for which we have default value support in
gimp_config_reset_properties().
As a side fix, gimp_param_spec_color() now just always duplicates the
passed default color, making it hence much easier to avoid bugs when
reusing a GeglColor.
2024-09-03 05:38:13 +08:00
|
|
|
color = g_value_get_object (value);
|
|
|
|
if (color)
|
|
|
|
color = gegl_color_duplicate (color);
|
2024-02-25 23:18:05 +08:00
|
|
|
|
2023-12-23 22:11:43 +08:00
|
|
|
copy = gegl_param_spec_color (name, nick, blurb,
|
|
|
|
/*TRUE,*/
|
|
|
|
color, flags);
|
2024-02-13 23:07:24 +08:00
|
|
|
g_clear_object (&color);
|
2009-01-26 02:01:47 +08:00
|
|
|
}
|
2019-09-15 00:29:38 +08:00
|
|
|
else if (G_IS_PARAM_SPEC_PARAM (pspec))
|
|
|
|
{
|
|
|
|
copy = g_param_spec_param (name, nick, blurb,
|
|
|
|
G_PARAM_SPEC_VALUE_TYPE (pspec),
|
|
|
|
flags);
|
|
|
|
}
|
|
|
|
else if (GIMP_IS_PARAM_SPEC_PARASITE (pspec))
|
|
|
|
{
|
|
|
|
copy = gimp_param_spec_parasite (name, nick, blurb,
|
|
|
|
flags);
|
|
|
|
}
|
|
|
|
else if (GIMP_IS_PARAM_SPEC_ARRAY (pspec))
|
|
|
|
{
|
2023-05-24 05:37:46 +08:00
|
|
|
if (GIMP_IS_PARAM_SPEC_INT32_ARRAY (pspec))
|
2019-09-15 00:29:38 +08:00
|
|
|
{
|
|
|
|
copy = gimp_param_spec_int32_array (name, nick, blurb,
|
|
|
|
flags);
|
|
|
|
}
|
|
|
|
else if (GIMP_IS_PARAM_SPEC_FLOAT_ARRAY (pspec))
|
|
|
|
{
|
|
|
|
copy = gimp_param_spec_float_array (name, nick, blurb,
|
|
|
|
flags);
|
|
|
|
}
|
2022-02-12 00:31:30 +08:00
|
|
|
}
|
2024-10-23 04:46:21 +08:00
|
|
|
else if (GIMP_IS_PARAM_SPEC_CORE_OBJECT_ARRAY (pspec))
|
|
|
|
{
|
|
|
|
GimpParamSpecCoreObjectArray *spec = GIMP_PARAM_SPEC_CORE_OBJECT_ARRAY (pspec);
|
|
|
|
|
|
|
|
copy = gimp_param_spec_core_object_array (name, nick, blurb,
|
|
|
|
spec->object_type,
|
|
|
|
flags);
|
|
|
|
}
|
2024-05-07 02:38:12 +08:00
|
|
|
else if (GIMP_IS_PARAM_SPEC_EXPORT_OPTIONS (pspec))
|
|
|
|
{
|
|
|
|
GimpParamSpecExportOptions *spec = GIMP_PARAM_SPEC_EXPORT_OPTIONS (pspec);
|
|
|
|
|
|
|
|
copy = gimp_param_spec_export_options (name, nick, blurb,
|
|
|
|
spec->capabilities,
|
|
|
|
flags);
|
|
|
|
}
|
2019-09-16 16:14:39 +08:00
|
|
|
else if (G_IS_PARAM_SPEC_OBJECT (pspec))
|
|
|
|
{
|
2022-02-12 00:31:30 +08:00
|
|
|
GType value_type = G_PARAM_SPEC_VALUE_TYPE (pspec);
|
|
|
|
const gchar *type_name = g_type_name (value_type);
|
|
|
|
|
|
|
|
if (value_type == G_TYPE_FILE ||
|
|
|
|
/* These types are not visibile in libgimpconfig so we compare
|
|
|
|
* with type names instead.
|
|
|
|
*/
|
2024-07-15 19:20:11 +08:00
|
|
|
g_strcmp0 (type_name, "GimpImage") == 0 ||
|
|
|
|
g_strcmp0 (type_name, "GimpDisplay") == 0 ||
|
|
|
|
g_strcmp0 (type_name, "GimpDrawable") == 0 ||
|
|
|
|
g_strcmp0 (type_name, "GimpLayer") == 0 ||
|
|
|
|
g_strcmp0 (type_name, "GimpGroupLayer") == 0 ||
|
|
|
|
g_strcmp0 (type_name, "GimpTextLayer") == 0 ||
|
|
|
|
g_strcmp0 (type_name, "GimpChannel") == 0 ||
|
|
|
|
g_strcmp0 (type_name, "GimpItem") == 0 ||
|
|
|
|
g_strcmp0 (type_name, "GimpLayerMask") == 0 ||
|
|
|
|
g_strcmp0 (type_name, "GimpSelection") == 0 ||
|
|
|
|
g_strcmp0 (type_name, "GimpPath") == 0)
|
2019-09-16 16:14:39 +08:00
|
|
|
{
|
|
|
|
copy = g_param_spec_object (name, nick, blurb,
|
|
|
|
value_type,
|
|
|
|
flags);
|
|
|
|
}
|
|
|
|
}
|
2020-12-24 04:15:43 +08:00
|
|
|
else if (G_IS_PARAM_SPEC_BOXED (pspec))
|
|
|
|
{
|
|
|
|
GType value_type = G_PARAM_SPEC_VALUE_TYPE (pspec);
|
|
|
|
|
2023-05-24 05:37:46 +08:00
|
|
|
if (value_type == G_TYPE_BYTES ||
|
|
|
|
value_type == G_TYPE_STRV)
|
2020-12-24 04:15:43 +08:00
|
|
|
{
|
2023-05-24 05:37:46 +08:00
|
|
|
copy = g_param_spec_boxed (name, nick, blurb, value_type, flags);
|
2020-12-24 04:15:43 +08:00
|
|
|
}
|
|
|
|
}
|
2009-01-26 02:01:47 +08:00
|
|
|
|
2014-05-16 08:30:41 +08:00
|
|
|
if (copy)
|
|
|
|
{
|
2020-06-12 22:52:26 +08:00
|
|
|
GQuark quark = 0;
|
|
|
|
GHashTable *keys;
|
|
|
|
|
|
|
|
if (G_UNLIKELY (! quark))
|
|
|
|
quark = g_quark_from_static_string ("gegl-property-keys");
|
|
|
|
|
|
|
|
keys = g_param_spec_get_qdata (pspec, quark);
|
2014-05-16 08:30:41 +08:00
|
|
|
|
|
|
|
if (keys)
|
2014-06-20 15:00:46 +08:00
|
|
|
g_param_spec_set_qdata_full (copy, quark, g_hash_table_ref (keys),
|
|
|
|
(GDestroyNotify) g_hash_table_unref);
|
2014-05-16 08:30:41 +08:00
|
|
|
}
|
|
|
|
|
2014-05-15 04:50:59 +08:00
|
|
|
return copy;
|
2009-01-26 02:01:47 +08:00
|
|
|
}
|