2019-09-04 22:42:41 +08:00
|
|
|
/* LIBGIMP - The GIMP Library
|
|
|
|
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
|
|
|
|
*
|
|
|
|
* gimpparamspecs-body.c
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* this file is included by both
|
|
|
|
*
|
|
|
|
* libgimp/gimpparamspecs.c
|
|
|
|
* app/core/gimpparamspecs.c
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* GIMP_TYPE_PARAM_IMAGE
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void gimp_param_image_class_init (GParamSpecClass *klass);
|
|
|
|
static void gimp_param_image_init (GParamSpec *pspec);
|
|
|
|
static gboolean gimp_param_image_validate (GParamSpec *pspec,
|
|
|
|
GValue *value);
|
|
|
|
|
|
|
|
GType
|
|
|
|
gimp_param_image_get_type (void)
|
|
|
|
{
|
|
|
|
static GType type = 0;
|
|
|
|
|
|
|
|
if (! type)
|
|
|
|
{
|
|
|
|
const GTypeInfo info =
|
|
|
|
{
|
|
|
|
sizeof (GParamSpecClass),
|
|
|
|
NULL, NULL,
|
|
|
|
(GClassInitFunc) gimp_param_image_class_init,
|
|
|
|
NULL, NULL,
|
|
|
|
sizeof (GimpParamSpecImage),
|
|
|
|
0,
|
|
|
|
(GInstanceInitFunc) gimp_param_image_init
|
|
|
|
};
|
|
|
|
|
|
|
|
type = g_type_register_static (G_TYPE_PARAM_OBJECT,
|
|
|
|
"GimpParamImage", &info, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_param_image_class_init (GParamSpecClass *klass)
|
|
|
|
{
|
|
|
|
klass->value_type = GIMP_TYPE_IMAGE;
|
|
|
|
klass->value_validate = gimp_param_image_validate;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_param_image_init (GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
GimpParamSpecImage *ispec = GIMP_PARAM_SPEC_IMAGE (pspec);
|
|
|
|
|
|
|
|
ispec->none_ok = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gimp_param_image_validate (GParamSpec *pspec,
|
|
|
|
GValue *value)
|
|
|
|
{
|
|
|
|
GimpParamSpecImage *ispec = GIMP_PARAM_SPEC_IMAGE (pspec);
|
|
|
|
GimpImage *image = value->data[0].v_pointer;
|
|
|
|
|
|
|
|
if (! ispec->none_ok && image == NULL)
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
if (image && (! GIMP_IS_IMAGE (image) ||
|
|
|
|
! gimp_image_is_valid (image)))
|
|
|
|
{
|
|
|
|
g_object_unref (image);
|
|
|
|
value->data[0].v_pointer = NULL;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_param_spec_image:
|
|
|
|
* @name: Canonical name of the property specified.
|
|
|
|
* @nick: Nick name of the property specified.
|
|
|
|
* @blurb: Description of the property specified.
|
|
|
|
* @none_ok: Whether no is a valid value.
|
|
|
|
* @flags: Flags for the property specified.
|
|
|
|
*
|
|
|
|
* Creates a new #GimpParamSpecImage specifying a
|
2023-07-29 18:36:21 +08:00
|
|
|
* [type@Image] property.
|
2019-09-04 22:42:41 +08:00
|
|
|
*
|
|
|
|
* See g_param_spec_internal() for details on property names.
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): The newly created #GimpParamSpecImage.
|
|
|
|
*
|
|
|
|
* Since: 3.0
|
|
|
|
**/
|
|
|
|
GParamSpec *
|
|
|
|
gimp_param_spec_image (const gchar *name,
|
|
|
|
const gchar *nick,
|
|
|
|
const gchar *blurb,
|
|
|
|
gboolean none_ok,
|
|
|
|
GParamFlags flags)
|
|
|
|
{
|
|
|
|
GimpParamSpecImage *ispec;
|
|
|
|
|
|
|
|
ispec = g_param_spec_internal (GIMP_TYPE_PARAM_IMAGE,
|
|
|
|
name, nick, blurb, flags);
|
|
|
|
|
2019-12-28 02:53:08 +08:00
|
|
|
g_return_val_if_fail (ispec, NULL);
|
|
|
|
|
2019-09-04 22:42:41 +08:00
|
|
|
ispec->none_ok = none_ok ? TRUE : FALSE;
|
|
|
|
|
|
|
|
return G_PARAM_SPEC (ispec);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* GIMP_TYPE_PARAM_ITEM
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void gimp_param_item_class_init (GParamSpecClass *klass);
|
|
|
|
static void gimp_param_item_init (GParamSpec *pspec);
|
|
|
|
static gboolean gimp_param_item_validate (GParamSpec *pspec,
|
|
|
|
GValue *value);
|
|
|
|
|
|
|
|
GType
|
|
|
|
gimp_param_item_get_type (void)
|
|
|
|
{
|
|
|
|
static GType type = 0;
|
|
|
|
|
|
|
|
if (! type)
|
|
|
|
{
|
|
|
|
const GTypeInfo info =
|
|
|
|
{
|
|
|
|
sizeof (GParamSpecClass),
|
|
|
|
NULL, NULL,
|
|
|
|
(GClassInitFunc) gimp_param_item_class_init,
|
|
|
|
NULL, NULL,
|
|
|
|
sizeof (GimpParamSpecItem),
|
|
|
|
0,
|
|
|
|
(GInstanceInitFunc) gimp_param_item_init
|
|
|
|
};
|
|
|
|
|
|
|
|
type = g_type_register_static (G_TYPE_PARAM_OBJECT,
|
|
|
|
"GimpParamItem", &info, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_param_item_class_init (GParamSpecClass *klass)
|
|
|
|
{
|
|
|
|
klass->value_type = GIMP_TYPE_ITEM;
|
|
|
|
klass->value_validate = gimp_param_item_validate;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_param_item_init (GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
GimpParamSpecItem *ispec = GIMP_PARAM_SPEC_ITEM (pspec);
|
|
|
|
|
|
|
|
ispec->none_ok = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gimp_param_item_validate (GParamSpec *pspec,
|
|
|
|
GValue *value)
|
|
|
|
{
|
|
|
|
GimpParamSpecItem *ispec = GIMP_PARAM_SPEC_ITEM (pspec);
|
|
|
|
GimpItem *item = value->data[0].v_pointer;
|
|
|
|
|
|
|
|
if (! ispec->none_ok && item == NULL)
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
if (item && (! g_type_is_a (G_OBJECT_TYPE (item), pspec->value_type) ||
|
|
|
|
! gimp_item_is_valid (item)))
|
|
|
|
{
|
|
|
|
g_object_unref (item);
|
|
|
|
value->data[0].v_pointer = NULL;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_param_spec_item:
|
|
|
|
* @name: Canonical name of the property specified.
|
|
|
|
* @nick: Nick name of the property specified.
|
|
|
|
* @blurb: Description of the property specified.
|
|
|
|
* @none_ok: Whether no is a valid value.
|
|
|
|
* @flags: Flags for the property specified.
|
|
|
|
*
|
|
|
|
* Creates a new #GimpParamSpecItem specifying a
|
2023-07-29 18:36:21 +08:00
|
|
|
* [type@Item] property.
|
2019-09-04 22:42:41 +08:00
|
|
|
*
|
|
|
|
* See g_param_spec_internal() for details on property names.
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): The newly created #GimpParamSpecItem.
|
|
|
|
*
|
|
|
|
* Since: 3.0
|
|
|
|
**/
|
|
|
|
GParamSpec *
|
|
|
|
gimp_param_spec_item (const gchar *name,
|
|
|
|
const gchar *nick,
|
|
|
|
const gchar *blurb,
|
|
|
|
gboolean none_ok,
|
|
|
|
GParamFlags flags)
|
|
|
|
{
|
|
|
|
GimpParamSpecItem *ispec;
|
|
|
|
|
|
|
|
ispec = g_param_spec_internal (GIMP_TYPE_PARAM_ITEM,
|
|
|
|
name, nick, blurb, flags);
|
|
|
|
|
2019-12-28 02:53:08 +08:00
|
|
|
g_return_val_if_fail (ispec, NULL);
|
|
|
|
|
2019-09-04 22:42:41 +08:00
|
|
|
ispec->none_ok = none_ok;
|
|
|
|
|
|
|
|
return G_PARAM_SPEC (ispec);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* GIMP_TYPE_PARAM_DRAWABLE
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void gimp_param_drawable_class_init (GParamSpecClass *klass);
|
|
|
|
static void gimp_param_drawable_init (GParamSpec *pspec);
|
|
|
|
|
|
|
|
GType
|
|
|
|
gimp_param_drawable_get_type (void)
|
|
|
|
{
|
|
|
|
static GType type = 0;
|
|
|
|
|
|
|
|
if (! type)
|
|
|
|
{
|
|
|
|
const GTypeInfo info =
|
|
|
|
{
|
|
|
|
sizeof (GParamSpecClass),
|
|
|
|
NULL, NULL,
|
|
|
|
(GClassInitFunc) gimp_param_drawable_class_init,
|
|
|
|
NULL, NULL,
|
|
|
|
sizeof (GimpParamSpecDrawable),
|
|
|
|
0,
|
|
|
|
(GInstanceInitFunc) gimp_param_drawable_init
|
|
|
|
};
|
|
|
|
|
|
|
|
type = g_type_register_static (GIMP_TYPE_PARAM_ITEM,
|
|
|
|
"GimpParamDrawable", &info, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_param_drawable_class_init (GParamSpecClass *klass)
|
|
|
|
{
|
|
|
|
klass->value_type = GIMP_TYPE_DRAWABLE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_param_drawable_init (GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_param_spec_drawable:
|
|
|
|
* @name: Canonical name of the property specified.
|
|
|
|
* @nick: Nick name of the property specified.
|
|
|
|
* @blurb: Description of the property specified.
|
|
|
|
* @none_ok: Whether no is a valid value.
|
|
|
|
* @flags: Flags for the property specified.
|
|
|
|
*
|
|
|
|
* Creates a new #GimpParamSpecDrawable specifying a
|
2023-07-29 18:36:21 +08:00
|
|
|
* [type@Drawable] property.
|
2019-09-04 22:42:41 +08:00
|
|
|
*
|
|
|
|
* See g_param_spec_internal() for details on property names.
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): The newly created #GimpParamSpecDrawable.
|
|
|
|
*
|
|
|
|
* Since: 3.0
|
|
|
|
**/
|
|
|
|
GParamSpec *
|
|
|
|
gimp_param_spec_drawable (const gchar *name,
|
|
|
|
const gchar *nick,
|
|
|
|
const gchar *blurb,
|
|
|
|
gboolean none_ok,
|
|
|
|
GParamFlags flags)
|
|
|
|
{
|
|
|
|
GimpParamSpecItem *ispec;
|
|
|
|
|
|
|
|
ispec = g_param_spec_internal (GIMP_TYPE_PARAM_DRAWABLE,
|
|
|
|
name, nick, blurb, flags);
|
|
|
|
|
2019-12-28 02:53:08 +08:00
|
|
|
g_return_val_if_fail (ispec, NULL);
|
|
|
|
|
2019-09-04 22:42:41 +08:00
|
|
|
ispec->none_ok = none_ok ? TRUE : FALSE;
|
|
|
|
|
|
|
|
return G_PARAM_SPEC (ispec);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* GIMP_TYPE_PARAM_LAYER
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void gimp_param_layer_class_init (GParamSpecClass *klass);
|
|
|
|
static void gimp_param_layer_init (GParamSpec *pspec);
|
|
|
|
|
|
|
|
GType
|
|
|
|
gimp_param_layer_get_type (void)
|
|
|
|
{
|
|
|
|
static GType type = 0;
|
|
|
|
|
|
|
|
if (! type)
|
|
|
|
{
|
|
|
|
const GTypeInfo info =
|
|
|
|
{
|
|
|
|
sizeof (GParamSpecClass),
|
|
|
|
NULL, NULL,
|
|
|
|
(GClassInitFunc) gimp_param_layer_class_init,
|
|
|
|
NULL, NULL,
|
|
|
|
sizeof (GimpParamSpecLayer),
|
|
|
|
0,
|
|
|
|
(GInstanceInitFunc) gimp_param_layer_init
|
|
|
|
};
|
|
|
|
|
|
|
|
type = g_type_register_static (GIMP_TYPE_PARAM_DRAWABLE,
|
|
|
|
"GimpParamLayer", &info, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_param_layer_class_init (GParamSpecClass *klass)
|
|
|
|
{
|
|
|
|
klass->value_type = GIMP_TYPE_LAYER;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_param_layer_init (GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_param_spec_layer:
|
|
|
|
* @name: Canonical name of the property specified.
|
|
|
|
* @nick: Nick name of the property specified.
|
|
|
|
* @blurb: Description of the property specified.
|
|
|
|
* @none_ok: Whether no is a valid value.
|
|
|
|
* @flags: Flags for the property specified.
|
|
|
|
*
|
|
|
|
* Creates a new #GimpParamSpecLayer specifying a
|
2023-07-29 18:36:21 +08:00
|
|
|
* [type@Layer] property.
|
2019-09-04 22:42:41 +08:00
|
|
|
*
|
|
|
|
* See g_param_spec_internal() for details on property names.
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): The newly created #GimpParamSpecLayer.
|
|
|
|
*
|
|
|
|
* Since: 3.0
|
|
|
|
**/
|
|
|
|
GParamSpec *
|
|
|
|
gimp_param_spec_layer (const gchar *name,
|
|
|
|
const gchar *nick,
|
|
|
|
const gchar *blurb,
|
|
|
|
gboolean none_ok,
|
|
|
|
GParamFlags flags)
|
|
|
|
{
|
|
|
|
GimpParamSpecItem *ispec;
|
|
|
|
|
|
|
|
ispec = g_param_spec_internal (GIMP_TYPE_PARAM_LAYER,
|
|
|
|
name, nick, blurb, flags);
|
2019-12-28 02:53:08 +08:00
|
|
|
|
2019-12-24 09:05:19 +08:00
|
|
|
g_return_val_if_fail (ispec, NULL);
|
2019-09-04 22:42:41 +08:00
|
|
|
|
|
|
|
ispec->none_ok = none_ok ? TRUE : FALSE;
|
|
|
|
|
|
|
|
return G_PARAM_SPEC (ispec);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-09-30 22:21:47 +08:00
|
|
|
/*
|
|
|
|
* GIMP_TYPE_PARAM_TEXT_LAYER
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void gimp_param_text_layer_class_init (GParamSpecClass *klass);
|
|
|
|
static void gimp_param_text_layer_init (GParamSpec *pspec);
|
|
|
|
|
|
|
|
GType
|
|
|
|
gimp_param_text_layer_get_type (void)
|
|
|
|
{
|
|
|
|
static GType type = 0;
|
|
|
|
|
|
|
|
if (! type)
|
|
|
|
{
|
|
|
|
const GTypeInfo info =
|
|
|
|
{
|
|
|
|
sizeof (GParamSpecClass),
|
|
|
|
NULL, NULL,
|
|
|
|
(GClassInitFunc) gimp_param_text_layer_class_init,
|
|
|
|
NULL, NULL,
|
|
|
|
sizeof (GimpParamSpecTextLayer),
|
|
|
|
0,
|
|
|
|
(GInstanceInitFunc) gimp_param_text_layer_init
|
|
|
|
};
|
|
|
|
|
|
|
|
type = g_type_register_static (GIMP_TYPE_PARAM_LAYER,
|
|
|
|
"GimpParamTextLayer", &info, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_param_text_layer_class_init (GParamSpecClass *klass)
|
|
|
|
{
|
|
|
|
klass->value_type = GIMP_TYPE_TEXT_LAYER;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_param_text_layer_init (GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_param_spec_text_layer:
|
|
|
|
* @name: Canonical name of the property specified.
|
|
|
|
* @nick: Nick name of the property specified.
|
|
|
|
* @blurb: Description of the property specified.
|
|
|
|
* @none_ok: Whether no is a valid value.
|
|
|
|
* @flags: Flags for the property specified.
|
|
|
|
*
|
|
|
|
* Creates a new #GimpParamSpecTextLayer specifying a
|
2023-07-29 18:36:21 +08:00
|
|
|
* [type@TextLayer] property.
|
2022-09-30 22:21:47 +08:00
|
|
|
*
|
|
|
|
* See g_param_spec_internal() for details on property names.
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): The newly created #GimpParamSpecTextLayer.
|
|
|
|
*
|
|
|
|
* Since: 3.0
|
|
|
|
**/
|
|
|
|
GParamSpec *
|
|
|
|
gimp_param_spec_text_layer (const gchar *name,
|
2023-05-31 22:12:04 +08:00
|
|
|
const gchar *nick,
|
|
|
|
const gchar *blurb,
|
|
|
|
gboolean none_ok,
|
|
|
|
GParamFlags flags)
|
2022-09-30 22:21:47 +08:00
|
|
|
{
|
|
|
|
GimpParamSpecItem *ispec;
|
|
|
|
|
|
|
|
ispec = g_param_spec_internal (GIMP_TYPE_PARAM_TEXT_LAYER,
|
|
|
|
name, nick, blurb, flags);
|
|
|
|
|
|
|
|
g_return_val_if_fail (ispec, NULL);
|
|
|
|
|
|
|
|
ispec->none_ok = none_ok ? TRUE : FALSE;
|
|
|
|
|
|
|
|
return G_PARAM_SPEC (ispec);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
app, libgimp, pdb, plug-ins: new GimpGroupLayer class in libgimp.
Also:
- renaming gimp_layer_group_new() to gimp_group_layer_new() in order to keep the
same name as in core code (i.e. GimpGroupLayer, not GimpLayerGroup).
- renaming gimp_image_merge_layer_group() to gimp_group_layer_merge()
- new functions: gimp_procedure_add_group_layer_argument(),
gimp_procedure_add_group_layer_aux_argument() and
gimp_procedure_add_group_layer_return_value().
This can be tested, e.g. in Python with these calls:
```py
i = Gimp.get_images()[0]
g = Gimp.GroupLayer.new(i, "hello")
i.insert_layer(g, None, 1)
g2 = Gimp.GroupLayer.new(i, "world")
i.insert_layer(g2, g, 1)
g.merge()
```
This was work started long ago, stored in an old stash which I finally
finish now! :-)
2024-07-06 23:24:11 +08:00
|
|
|
/*
|
|
|
|
* GIMP_TYPE_PARAM_GROUP_LAYER
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void gimp_param_group_layer_class_init (GParamSpecClass *klass);
|
|
|
|
static void gimp_param_group_layer_init (GParamSpec *pspec);
|
|
|
|
|
|
|
|
GType
|
|
|
|
gimp_param_group_layer_get_type (void)
|
|
|
|
{
|
|
|
|
static GType type = 0;
|
|
|
|
|
|
|
|
if (! type)
|
|
|
|
{
|
|
|
|
const GTypeInfo info =
|
|
|
|
{
|
|
|
|
sizeof (GParamSpecClass),
|
|
|
|
NULL, NULL,
|
|
|
|
(GClassInitFunc) gimp_param_group_layer_class_init,
|
|
|
|
NULL, NULL,
|
|
|
|
sizeof (GimpParamSpecGroupLayer),
|
|
|
|
0,
|
|
|
|
(GInstanceInitFunc) gimp_param_group_layer_init
|
|
|
|
};
|
|
|
|
|
|
|
|
type = g_type_register_static (GIMP_TYPE_PARAM_LAYER,
|
|
|
|
"GimpParamGroupLayer", &info, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_param_group_layer_class_init (GParamSpecClass *klass)
|
|
|
|
{
|
|
|
|
klass->value_type = GIMP_TYPE_GROUP_LAYER;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_param_group_layer_init (GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_param_spec_group_layer:
|
|
|
|
* @name: Canonical name of the property specified.
|
|
|
|
* @nick: Nick name of the property specified.
|
|
|
|
* @blurb: Description of the property specified.
|
|
|
|
* @none_ok: Whether %NULL is a valid value.
|
|
|
|
* @flags: Flags for the property specified.
|
|
|
|
*
|
|
|
|
* Creates a new #GimpParamSpecGroupLayer specifying a
|
|
|
|
* [type@GroupLayer] property.
|
|
|
|
*
|
|
|
|
* See g_param_spec_internal() for details on property names.
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): The newly created #GimpParamSpecGroupLayer.
|
|
|
|
*
|
|
|
|
* Since: 3.0
|
|
|
|
**/
|
|
|
|
GParamSpec *
|
|
|
|
gimp_param_spec_group_layer (const gchar *name,
|
|
|
|
const gchar *nick,
|
|
|
|
const gchar *blurb,
|
|
|
|
gboolean none_ok,
|
|
|
|
GParamFlags flags)
|
|
|
|
{
|
|
|
|
GimpParamSpecItem *ispec;
|
|
|
|
|
|
|
|
ispec = g_param_spec_internal (GIMP_TYPE_PARAM_GROUP_LAYER,
|
|
|
|
name, nick, blurb, flags);
|
|
|
|
|
|
|
|
g_return_val_if_fail (ispec, NULL);
|
|
|
|
|
|
|
|
ispec->none_ok = none_ok ? TRUE : FALSE;
|
|
|
|
|
|
|
|
return G_PARAM_SPEC (ispec);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-09-04 22:42:41 +08:00
|
|
|
/*
|
|
|
|
* GIMP_TYPE_PARAM_CHANNEL
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void gimp_param_channel_class_init (GParamSpecClass *klass);
|
|
|
|
static void gimp_param_channel_init (GParamSpec *pspec);
|
|
|
|
|
|
|
|
GType
|
|
|
|
gimp_param_channel_get_type (void)
|
|
|
|
{
|
|
|
|
static GType type = 0;
|
|
|
|
|
|
|
|
if (! type)
|
|
|
|
{
|
|
|
|
const GTypeInfo info =
|
|
|
|
{
|
|
|
|
sizeof (GParamSpecClass),
|
|
|
|
NULL, NULL,
|
|
|
|
(GClassInitFunc) gimp_param_channel_class_init,
|
|
|
|
NULL, NULL,
|
|
|
|
sizeof (GimpParamSpecChannel),
|
|
|
|
0,
|
|
|
|
(GInstanceInitFunc) gimp_param_channel_init
|
|
|
|
};
|
|
|
|
|
|
|
|
type = g_type_register_static (GIMP_TYPE_PARAM_DRAWABLE,
|
|
|
|
"GimpParamChannel", &info, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_param_channel_class_init (GParamSpecClass *klass)
|
|
|
|
{
|
|
|
|
klass->value_type = GIMP_TYPE_CHANNEL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_param_channel_init (GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_param_spec_channel:
|
|
|
|
* @name: Canonical name of the property specified.
|
|
|
|
* @nick: Nick name of the property specified.
|
|
|
|
* @blurb: Description of the property specified.
|
|
|
|
* @none_ok: Whether no is a valid value.
|
|
|
|
* @flags: Flags for the property specified.
|
|
|
|
*
|
|
|
|
* Creates a new #GimpParamSpecChannel specifying a
|
2023-07-29 18:36:21 +08:00
|
|
|
* [type@Channel] property.
|
2019-09-04 22:42:41 +08:00
|
|
|
*
|
|
|
|
* See g_param_spec_internal() for details on property names.
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): The newly created #GimpParamSpecChannel.
|
|
|
|
*
|
|
|
|
* Since: 3.0
|
|
|
|
**/
|
|
|
|
GParamSpec *
|
|
|
|
gimp_param_spec_channel (const gchar *name,
|
|
|
|
const gchar *nick,
|
|
|
|
const gchar *blurb,
|
|
|
|
gboolean none_ok,
|
|
|
|
GParamFlags flags)
|
|
|
|
{
|
|
|
|
GimpParamSpecItem *ispec;
|
|
|
|
|
|
|
|
ispec = g_param_spec_internal (GIMP_TYPE_PARAM_CHANNEL,
|
|
|
|
name, nick, blurb, flags);
|
|
|
|
|
2019-12-28 02:53:08 +08:00
|
|
|
g_return_val_if_fail (ispec, NULL);
|
|
|
|
|
2019-09-04 22:42:41 +08:00
|
|
|
ispec->none_ok = none_ok ? TRUE : FALSE;
|
|
|
|
|
|
|
|
return G_PARAM_SPEC (ispec);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* GIMP_TYPE_PARAM_LAYER_MASK
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void gimp_param_layer_mask_class_init (GParamSpecClass *klass);
|
|
|
|
static void gimp_param_layer_mask_init (GParamSpec *pspec);
|
|
|
|
|
|
|
|
GType
|
|
|
|
gimp_param_layer_mask_get_type (void)
|
|
|
|
{
|
|
|
|
static GType type = 0;
|
|
|
|
|
|
|
|
if (! type)
|
|
|
|
{
|
|
|
|
const GTypeInfo info =
|
|
|
|
{
|
|
|
|
sizeof (GParamSpecClass),
|
|
|
|
NULL, NULL,
|
|
|
|
(GClassInitFunc) gimp_param_layer_mask_class_init,
|
|
|
|
NULL, NULL,
|
|
|
|
sizeof (GimpParamSpecLayerMask),
|
|
|
|
0,
|
|
|
|
(GInstanceInitFunc) gimp_param_layer_mask_init
|
|
|
|
};
|
|
|
|
|
|
|
|
type = g_type_register_static (GIMP_TYPE_PARAM_CHANNEL,
|
|
|
|
"GimpParamLayerMask", &info, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_param_layer_mask_class_init (GParamSpecClass *klass)
|
|
|
|
{
|
|
|
|
klass->value_type = GIMP_TYPE_LAYER_MASK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_param_layer_mask_init (GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_param_spec_layer_mask:
|
|
|
|
* @name: Canonical name of the property specified.
|
|
|
|
* @nick: Nick name of the property specified.
|
|
|
|
* @blurb: Description of the property specified.
|
|
|
|
* @none_ok: Whether no is a valid value.
|
|
|
|
* @flags: Flags for the property specified.
|
|
|
|
*
|
|
|
|
* Creates a new #GimpParamSpecLayerMask specifying a
|
2023-07-29 18:36:21 +08:00
|
|
|
* [type@LayerMask] property.
|
2019-09-04 22:42:41 +08:00
|
|
|
*
|
|
|
|
* See g_param_spec_internal() for details on property names.
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): The newly created #GimpParamSpecLayerMask.
|
|
|
|
*
|
|
|
|
* Since: 3.0
|
|
|
|
**/
|
|
|
|
GParamSpec *
|
|
|
|
gimp_param_spec_layer_mask (const gchar *name,
|
|
|
|
const gchar *nick,
|
|
|
|
const gchar *blurb,
|
|
|
|
gboolean none_ok,
|
|
|
|
GParamFlags flags)
|
|
|
|
{
|
|
|
|
GimpParamSpecItem *ispec;
|
|
|
|
|
|
|
|
ispec = g_param_spec_internal (GIMP_TYPE_PARAM_LAYER_MASK,
|
|
|
|
name, nick, blurb, flags);
|
|
|
|
|
2019-12-28 02:53:08 +08:00
|
|
|
g_return_val_if_fail (ispec, NULL);
|
|
|
|
|
2019-09-04 22:42:41 +08:00
|
|
|
ispec->none_ok = none_ok ? TRUE : FALSE;
|
|
|
|
|
|
|
|
return G_PARAM_SPEC (ispec);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* GIMP_TYPE_PARAM_SELECTION
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void gimp_param_selection_class_init (GParamSpecClass *klass);
|
|
|
|
static void gimp_param_selection_init (GParamSpec *pspec);
|
|
|
|
|
|
|
|
GType
|
|
|
|
gimp_param_selection_get_type (void)
|
|
|
|
{
|
|
|
|
static GType type = 0;
|
|
|
|
|
|
|
|
if (! type)
|
|
|
|
{
|
|
|
|
const GTypeInfo info =
|
|
|
|
{
|
|
|
|
sizeof (GParamSpecClass),
|
|
|
|
NULL, NULL,
|
|
|
|
(GClassInitFunc) gimp_param_selection_class_init,
|
|
|
|
NULL, NULL,
|
|
|
|
sizeof (GimpParamSpecSelection),
|
|
|
|
0,
|
|
|
|
(GInstanceInitFunc) gimp_param_selection_init
|
|
|
|
};
|
|
|
|
|
|
|
|
type = g_type_register_static (GIMP_TYPE_PARAM_CHANNEL,
|
|
|
|
"GimpParamSelection", &info, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_param_selection_class_init (GParamSpecClass *klass)
|
|
|
|
{
|
|
|
|
klass->value_type = GIMP_TYPE_SELECTION;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_param_selection_init (GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_param_spec_selection:
|
|
|
|
* @name: Canonical name of the property specified.
|
|
|
|
* @nick: Nick name of the property specified.
|
|
|
|
* @blurb: Description of the property specified.
|
|
|
|
* @none_ok: Whether no is a valid value.
|
|
|
|
* @flags: Flags for the property specified.
|
|
|
|
*
|
|
|
|
* Creates a new #GimpParamSpecSelection specifying a
|
2023-07-29 18:36:21 +08:00
|
|
|
* [type@Selection] property.
|
2019-09-04 22:42:41 +08:00
|
|
|
*
|
|
|
|
* See g_param_spec_internal() for details on property names.
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): The newly created #GimpParamSpecSelection.
|
|
|
|
*
|
|
|
|
* Since: 3.0
|
|
|
|
**/
|
|
|
|
GParamSpec *
|
|
|
|
gimp_param_spec_selection (const gchar *name,
|
|
|
|
const gchar *nick,
|
|
|
|
const gchar *blurb,
|
|
|
|
gboolean none_ok,
|
|
|
|
GParamFlags flags)
|
|
|
|
{
|
|
|
|
GimpParamSpecItem *ispec;
|
|
|
|
|
|
|
|
ispec = g_param_spec_internal (GIMP_TYPE_PARAM_SELECTION,
|
|
|
|
name, nick, blurb, flags);
|
|
|
|
|
2019-12-28 02:53:08 +08:00
|
|
|
g_return_val_if_fail (ispec, NULL);
|
|
|
|
|
2019-09-04 22:42:41 +08:00
|
|
|
ispec->none_ok = none_ok ? TRUE : FALSE;
|
|
|
|
|
|
|
|
return G_PARAM_SPEC (ispec);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2024-07-12 14:16:25 +08:00
|
|
|
* GIMP_TYPE_PARAM_PATH
|
2019-09-04 22:42:41 +08:00
|
|
|
*/
|
|
|
|
|
2024-07-12 14:16:25 +08:00
|
|
|
static void gimp_param_path_class_init (GParamSpecClass *klass);
|
|
|
|
static void gimp_param_path_init (GParamSpec *pspec);
|
2019-09-04 22:42:41 +08:00
|
|
|
|
|
|
|
GType
|
2024-07-12 14:16:25 +08:00
|
|
|
gimp_param_path_get_type (void)
|
2019-09-04 22:42:41 +08:00
|
|
|
{
|
|
|
|
static GType type = 0;
|
|
|
|
|
|
|
|
if (! type)
|
|
|
|
{
|
|
|
|
const GTypeInfo info =
|
|
|
|
{
|
|
|
|
sizeof (GParamSpecClass),
|
|
|
|
NULL, NULL,
|
2024-07-12 14:16:25 +08:00
|
|
|
(GClassInitFunc) gimp_param_path_class_init,
|
2019-09-04 22:42:41 +08:00
|
|
|
NULL, NULL,
|
2024-07-12 14:16:25 +08:00
|
|
|
sizeof (GimpParamSpecPath),
|
2019-09-04 22:42:41 +08:00
|
|
|
0,
|
2024-07-12 14:16:25 +08:00
|
|
|
(GInstanceInitFunc) gimp_param_path_init
|
2019-09-04 22:42:41 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
type = g_type_register_static (GIMP_TYPE_PARAM_ITEM,
|
2024-07-12 14:16:25 +08:00
|
|
|
"GimpParamPath", &info, 0);
|
2019-09-04 22:42:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2024-07-12 14:16:25 +08:00
|
|
|
gimp_param_path_class_init (GParamSpecClass *klass)
|
2019-09-04 22:42:41 +08:00
|
|
|
{
|
2024-07-12 14:16:25 +08:00
|
|
|
klass->value_type = GIMP_TYPE_PATH;
|
2019-09-04 22:42:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2024-07-12 14:16:25 +08:00
|
|
|
gimp_param_path_init (GParamSpec *pspec)
|
2019-09-04 22:42:41 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2024-07-12 14:16:25 +08:00
|
|
|
* gimp_param_spec_path:
|
2019-09-04 22:42:41 +08:00
|
|
|
* @name: Canonical name of the property specified.
|
|
|
|
* @nick: Nick name of the property specified.
|
|
|
|
* @blurb: Description of the property specified.
|
2024-07-12 14:16:25 +08:00
|
|
|
* @none_ok: Whether no is a valid value.
|
2019-09-04 22:42:41 +08:00
|
|
|
* @flags: Flags for the property specified.
|
|
|
|
*
|
2024-07-12 14:16:25 +08:00
|
|
|
* Creates a new #GimpParamSpecPath specifying a
|
|
|
|
* [type@Path] property.
|
2019-09-04 22:42:41 +08:00
|
|
|
*
|
|
|
|
* See g_param_spec_internal() for details on property names.
|
|
|
|
*
|
2024-07-12 14:16:25 +08:00
|
|
|
* Returns: (transfer full): The newly created #GimpParamSpecPath.
|
2019-09-04 22:42:41 +08:00
|
|
|
*
|
|
|
|
* Since: 3.0
|
|
|
|
**/
|
|
|
|
GParamSpec *
|
2024-07-12 14:16:25 +08:00
|
|
|
gimp_param_spec_path (const gchar *name,
|
|
|
|
const gchar *nick,
|
|
|
|
const gchar *blurb,
|
|
|
|
gboolean none_ok,
|
|
|
|
GParamFlags flags)
|
2019-09-04 22:42:41 +08:00
|
|
|
{
|
|
|
|
GimpParamSpecItem *ispec;
|
|
|
|
|
2024-07-12 14:16:25 +08:00
|
|
|
ispec = g_param_spec_internal (GIMP_TYPE_PARAM_PATH,
|
2019-09-04 22:42:41 +08:00
|
|
|
name, nick, blurb, flags);
|
|
|
|
|
2019-12-28 02:53:08 +08:00
|
|
|
g_return_val_if_fail (ispec, NULL);
|
|
|
|
|
2019-09-04 22:42:41 +08:00
|
|
|
ispec->none_ok = none_ok ? TRUE : FALSE;
|
|
|
|
|
|
|
|
return G_PARAM_SPEC (ispec);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* GIMP_TYPE_PARAM_DISPLAY
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void gimp_param_display_class_init (GParamSpecClass *klass);
|
|
|
|
static void gimp_param_display_init (GParamSpec *pspec);
|
|
|
|
static gboolean gimp_param_display_validate (GParamSpec *pspec,
|
|
|
|
GValue *value);
|
|
|
|
|
|
|
|
GType
|
|
|
|
gimp_param_display_get_type (void)
|
|
|
|
{
|
|
|
|
static GType type = 0;
|
|
|
|
|
|
|
|
if (! type)
|
|
|
|
{
|
|
|
|
const GTypeInfo info =
|
|
|
|
{
|
|
|
|
sizeof (GParamSpecClass),
|
|
|
|
NULL, NULL,
|
|
|
|
(GClassInitFunc) gimp_param_display_class_init,
|
|
|
|
NULL, NULL,
|
|
|
|
sizeof (GimpParamSpecDisplay),
|
|
|
|
0,
|
|
|
|
(GInstanceInitFunc) gimp_param_display_init
|
|
|
|
};
|
|
|
|
|
|
|
|
type = g_type_register_static (G_TYPE_PARAM_OBJECT,
|
|
|
|
"GimpParamDisplay", &info, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_param_display_class_init (GParamSpecClass *klass)
|
|
|
|
{
|
|
|
|
klass->value_type = GIMP_TYPE_DISPLAY;
|
|
|
|
klass->value_validate = gimp_param_display_validate;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_param_display_init (GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
GimpParamSpecDisplay *dspec = GIMP_PARAM_SPEC_DISPLAY (pspec);
|
|
|
|
|
|
|
|
dspec->none_ok = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gimp_param_display_validate (GParamSpec *pspec,
|
|
|
|
GValue *value)
|
|
|
|
{
|
|
|
|
GimpParamSpecDisplay *dspec = GIMP_PARAM_SPEC_DISPLAY (pspec);
|
|
|
|
GimpDisplay *display = value->data[0].v_pointer;
|
|
|
|
|
|
|
|
if (! dspec->none_ok && display == NULL)
|
2023-05-31 22:12:04 +08:00
|
|
|
return TRUE;
|
2019-09-04 22:42:41 +08:00
|
|
|
|
|
|
|
if (display && (! GIMP_IS_DISPLAY (display) ||
|
|
|
|
! gimp_display_is_valid (display)))
|
|
|
|
{
|
|
|
|
g_object_unref (display);
|
|
|
|
value->data[0].v_pointer = NULL;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_param_spec_display:
|
|
|
|
* @name: Canonical name of the property specified.
|
|
|
|
* @nick: Nick name of the property specified.
|
|
|
|
* @blurb: Description of the property specified.
|
|
|
|
* @none_ok: Whether no is a valid value.
|
|
|
|
* @flags: Flags for the property specified.
|
|
|
|
*
|
|
|
|
* Creates a new #GimpParamSpecDisplay specifying a
|
2023-07-29 18:36:21 +08:00
|
|
|
* [type@Display] property.
|
2019-09-04 22:42:41 +08:00
|
|
|
*
|
|
|
|
* See g_param_spec_internal() for details on property names.
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): The newly created #GimpParamSpecDisplay.
|
|
|
|
*
|
|
|
|
* Since: 3.0
|
|
|
|
**/
|
|
|
|
GParamSpec *
|
|
|
|
gimp_param_spec_display (const gchar *name,
|
|
|
|
const gchar *nick,
|
|
|
|
const gchar *blurb,
|
|
|
|
gboolean none_ok,
|
|
|
|
GParamFlags flags)
|
|
|
|
{
|
|
|
|
GimpParamSpecDisplay *dspec;
|
|
|
|
|
|
|
|
dspec = g_param_spec_internal (GIMP_TYPE_PARAM_DISPLAY,
|
|
|
|
name, nick, blurb, flags);
|
|
|
|
|
2019-12-28 02:53:08 +08:00
|
|
|
g_return_val_if_fail (dspec, NULL);
|
|
|
|
|
2019-09-04 22:42:41 +08:00
|
|
|
dspec->none_ok = none_ok ? TRUE : FALSE;
|
|
|
|
|
|
|
|
return G_PARAM_SPEC (dspec);
|
|
|
|
}
|
2023-05-31 22:12:04 +08:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* GIMP_TYPE_PARAM_RESOURCE
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void gimp_param_resource_class_init (GParamSpecClass *klass);
|
|
|
|
static void gimp_param_resource_init (GParamSpec *pspec);
|
|
|
|
static gboolean gimp_param_resource_validate (GParamSpec *pspec,
|
|
|
|
GValue *value);
|
|
|
|
|
|
|
|
GType
|
|
|
|
gimp_param_resource_get_type (void)
|
|
|
|
{
|
|
|
|
static GType type = 0;
|
|
|
|
|
|
|
|
if (! type)
|
|
|
|
{
|
|
|
|
const GTypeInfo info =
|
|
|
|
{
|
|
|
|
sizeof (GParamSpecClass),
|
|
|
|
NULL, NULL,
|
|
|
|
(GClassInitFunc) gimp_param_resource_class_init,
|
|
|
|
NULL, NULL,
|
|
|
|
sizeof (GimpParamSpecResource),
|
|
|
|
0,
|
|
|
|
(GInstanceInitFunc) gimp_param_resource_init
|
|
|
|
};
|
|
|
|
|
|
|
|
type = g_type_register_static (G_TYPE_PARAM_OBJECT,
|
|
|
|
"GimpParamResource", &info, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_param_resource_class_init (GParamSpecClass *klass)
|
|
|
|
{
|
|
|
|
klass->value_type = GIMP_TYPE_RESOURCE;
|
|
|
|
klass->value_validate = gimp_param_resource_validate;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_param_resource_init (GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
GimpParamSpecResource *rspec = GIMP_PARAM_SPEC_RESOURCE (pspec);
|
|
|
|
|
|
|
|
rspec->none_ok = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gimp_param_resource_validate (GParamSpec *pspec,
|
|
|
|
GValue *value)
|
|
|
|
{
|
|
|
|
GimpParamSpecResource *rspec = GIMP_PARAM_SPEC_RESOURCE (pspec);
|
|
|
|
GObject *resource = value->data[0].v_pointer;
|
|
|
|
|
|
|
|
if (! rspec->none_ok && resource == NULL)
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
if (resource && (! g_type_is_a (G_OBJECT_TYPE (resource), pspec->value_type) ||
|
|
|
|
! gimp_resource_is_valid ((gpointer) resource)))
|
|
|
|
{
|
|
|
|
g_object_unref (resource);
|
|
|
|
value->data[0].v_pointer = NULL;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_param_spec_resource:
|
|
|
|
* @name: Canonical name of the property specified.
|
|
|
|
* @nick: Nick name of the property specified.
|
|
|
|
* @blurb: Description of the property specified.
|
2024-07-06 04:19:34 +08:00
|
|
|
* @none_ok: Whether %NULL is a valid value.
|
2023-05-31 22:12:04 +08:00
|
|
|
* @flags: Flags for the property specified.
|
|
|
|
*
|
|
|
|
* Creates a new #GimpParamSpecResource specifying a
|
2023-07-29 18:36:21 +08:00
|
|
|
* [type@Resource] property.
|
2023-05-31 22:12:04 +08:00
|
|
|
*
|
|
|
|
* See g_param_spec_internal() for details on property names.
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): The newly created #GimpParamSpecResource.
|
|
|
|
*
|
|
|
|
* Since: 3.0
|
|
|
|
**/
|
|
|
|
GParamSpec *
|
|
|
|
gimp_param_spec_resource (const gchar *name,
|
|
|
|
const gchar *nick,
|
|
|
|
const gchar *blurb,
|
|
|
|
gboolean none_ok,
|
|
|
|
GParamFlags flags)
|
|
|
|
{
|
|
|
|
GimpParamSpecResource *rspec;
|
|
|
|
|
|
|
|
rspec = g_param_spec_internal (GIMP_TYPE_PARAM_RESOURCE,
|
|
|
|
name, nick, blurb, flags);
|
|
|
|
|
|
|
|
g_return_val_if_fail (rspec, NULL);
|
|
|
|
|
|
|
|
rspec->none_ok = none_ok ? TRUE : FALSE;
|
|
|
|
|
|
|
|
return G_PARAM_SPEC (rspec);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* GIMP_TYPE_PARAM_BRUSH
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void gimp_param_brush_class_init (GParamSpecClass *klass);
|
|
|
|
static void gimp_param_brush_init (GParamSpec *pspec);
|
|
|
|
|
|
|
|
GType
|
|
|
|
gimp_param_brush_get_type (void)
|
|
|
|
{
|
|
|
|
static GType type = 0;
|
|
|
|
|
|
|
|
if (! type)
|
|
|
|
{
|
|
|
|
const GTypeInfo info =
|
|
|
|
{
|
|
|
|
sizeof (GParamSpecClass),
|
|
|
|
NULL, NULL,
|
|
|
|
(GClassInitFunc) gimp_param_brush_class_init,
|
|
|
|
NULL, NULL,
|
|
|
|
sizeof (GimpParamSpecBrush),
|
|
|
|
0,
|
|
|
|
(GInstanceInitFunc) gimp_param_brush_init
|
|
|
|
};
|
|
|
|
|
|
|
|
type = g_type_register_static (GIMP_TYPE_PARAM_RESOURCE,
|
|
|
|
"GimpParamBrush", &info, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_param_brush_class_init (GParamSpecClass *klass)
|
|
|
|
{
|
|
|
|
klass->value_type = GIMP_TYPE_BRUSH;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_param_brush_init (GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_param_spec_brush:
|
|
|
|
* @name: Canonical name of the property specified.
|
|
|
|
* @nick: Nick name of the property specified.
|
|
|
|
* @blurb: Description of the property specified.
|
2024-07-06 04:19:34 +08:00
|
|
|
* @none_ok: Whether %NULL is a valid value.
|
2023-05-31 22:12:04 +08:00
|
|
|
* @flags: Flags for the property specified.
|
|
|
|
*
|
|
|
|
* Creates a new #GimpParamSpecBrush specifying a
|
2023-07-29 18:36:21 +08:00
|
|
|
* [type@Brush] property.
|
2023-05-31 22:12:04 +08:00
|
|
|
*
|
|
|
|
* See g_param_spec_internal() for details on property names.
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): The newly created #GimpParamSpecBrush.
|
|
|
|
*
|
|
|
|
* Since: 3.0
|
|
|
|
**/
|
|
|
|
GParamSpec *
|
|
|
|
gimp_param_spec_brush (const gchar *name,
|
|
|
|
const gchar *nick,
|
|
|
|
const gchar *blurb,
|
|
|
|
gboolean none_ok,
|
|
|
|
GParamFlags flags)
|
|
|
|
{
|
|
|
|
GimpParamSpecResource *rspec;
|
|
|
|
|
|
|
|
rspec = g_param_spec_internal (GIMP_TYPE_PARAM_BRUSH,
|
|
|
|
name, nick, blurb, flags);
|
|
|
|
|
|
|
|
g_return_val_if_fail (rspec, NULL);
|
|
|
|
|
|
|
|
rspec->none_ok = none_ok ? TRUE : FALSE;
|
|
|
|
|
|
|
|
return G_PARAM_SPEC (rspec);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2023-06-05 19:06:01 +08:00
|
|
|
* GIMP_TYPE_PARAM_PATTERN
|
2023-05-31 22:12:04 +08:00
|
|
|
*/
|
|
|
|
|
2023-06-05 19:06:01 +08:00
|
|
|
static void gimp_param_pattern_class_init (GParamSpecClass *klass);
|
|
|
|
static void gimp_param_pattern_init (GParamSpec *pspec);
|
2023-05-31 22:12:04 +08:00
|
|
|
|
|
|
|
GType
|
2023-06-05 19:06:01 +08:00
|
|
|
gimp_param_pattern_get_type (void)
|
2023-05-31 22:12:04 +08:00
|
|
|
{
|
|
|
|
static GType type = 0;
|
|
|
|
|
|
|
|
if (! type)
|
|
|
|
{
|
|
|
|
const GTypeInfo info =
|
|
|
|
{
|
|
|
|
sizeof (GParamSpecClass),
|
|
|
|
NULL, NULL,
|
2023-06-05 19:06:01 +08:00
|
|
|
(GClassInitFunc) gimp_param_pattern_class_init,
|
2023-05-31 22:12:04 +08:00
|
|
|
NULL, NULL,
|
2023-06-05 19:06:01 +08:00
|
|
|
sizeof (GimpParamSpecPattern),
|
2023-05-31 22:12:04 +08:00
|
|
|
0,
|
2023-06-05 19:06:01 +08:00
|
|
|
(GInstanceInitFunc) gimp_param_pattern_init
|
2023-05-31 22:12:04 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
type = g_type_register_static (GIMP_TYPE_PARAM_RESOURCE,
|
2023-06-05 19:06:01 +08:00
|
|
|
"GimpParamPattern", &info, 0);
|
2023-05-31 22:12:04 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2023-06-05 19:06:01 +08:00
|
|
|
gimp_param_pattern_class_init (GParamSpecClass *klass)
|
2023-05-31 22:12:04 +08:00
|
|
|
{
|
2023-06-05 19:06:01 +08:00
|
|
|
klass->value_type = GIMP_TYPE_PATTERN;
|
2023-05-31 22:12:04 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2023-06-05 19:06:01 +08:00
|
|
|
gimp_param_pattern_init (GParamSpec *pspec)
|
2023-05-31 22:12:04 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2023-06-05 19:06:01 +08:00
|
|
|
* gimp_param_spec_pattern:
|
2023-05-31 22:12:04 +08:00
|
|
|
* @name: Canonical name of the property specified.
|
|
|
|
* @nick: Nick name of the property specified.
|
|
|
|
* @blurb: Description of the property specified.
|
2024-07-06 04:19:34 +08:00
|
|
|
* @none_ok: Whether %NULL is a valid value.
|
2023-05-31 22:12:04 +08:00
|
|
|
* @flags: Flags for the property specified.
|
|
|
|
*
|
2023-06-05 19:06:01 +08:00
|
|
|
* Creates a new #GimpParamSpecPattern specifying a
|
2023-07-29 18:36:21 +08:00
|
|
|
* [type@Pattern] property.
|
2023-05-31 22:12:04 +08:00
|
|
|
*
|
|
|
|
* See g_param_spec_internal() for details on property names.
|
|
|
|
*
|
2023-06-05 19:06:01 +08:00
|
|
|
* Returns: (transfer full): The newly created #GimpParamSpecPattern.
|
2023-05-31 22:12:04 +08:00
|
|
|
*
|
|
|
|
* Since: 3.0
|
|
|
|
**/
|
|
|
|
GParamSpec *
|
2023-06-05 19:06:01 +08:00
|
|
|
gimp_param_spec_pattern (const gchar *name,
|
|
|
|
const gchar *nick,
|
|
|
|
const gchar *blurb,
|
|
|
|
gboolean none_ok,
|
|
|
|
GParamFlags flags)
|
2023-05-31 22:12:04 +08:00
|
|
|
{
|
|
|
|
GimpParamSpecResource *rspec;
|
|
|
|
|
2023-06-05 19:06:01 +08:00
|
|
|
rspec = g_param_spec_internal (GIMP_TYPE_PARAM_PATTERN,
|
2023-05-31 22:12:04 +08:00
|
|
|
name, nick, blurb, flags);
|
|
|
|
|
|
|
|
g_return_val_if_fail (rspec, NULL);
|
|
|
|
|
|
|
|
rspec->none_ok = none_ok ? TRUE : FALSE;
|
|
|
|
|
|
|
|
return G_PARAM_SPEC (rspec);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* GIMP_TYPE_PARAM_GRADIENT
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void gimp_param_gradient_class_init (GParamSpecClass *klass);
|
|
|
|
static void gimp_param_gradient_init (GParamSpec *pspec);
|
|
|
|
|
|
|
|
GType
|
|
|
|
gimp_param_gradient_get_type (void)
|
|
|
|
{
|
|
|
|
static GType type = 0;
|
|
|
|
|
|
|
|
if (! type)
|
|
|
|
{
|
|
|
|
const GTypeInfo info =
|
|
|
|
{
|
|
|
|
sizeof (GParamSpecClass),
|
|
|
|
NULL, NULL,
|
|
|
|
(GClassInitFunc) gimp_param_gradient_class_init,
|
|
|
|
NULL, NULL,
|
|
|
|
sizeof (GimpParamSpecGradient),
|
|
|
|
0,
|
|
|
|
(GInstanceInitFunc) gimp_param_gradient_init
|
|
|
|
};
|
|
|
|
|
|
|
|
type = g_type_register_static (GIMP_TYPE_PARAM_RESOURCE,
|
|
|
|
"GimpParamGradient", &info, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_param_gradient_class_init (GParamSpecClass *klass)
|
|
|
|
{
|
|
|
|
klass->value_type = GIMP_TYPE_GRADIENT;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_param_gradient_init (GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_param_spec_gradient:
|
|
|
|
* @name: Canonical name of the property specified.
|
|
|
|
* @nick: Nick name of the property specified.
|
|
|
|
* @blurb: Description of the property specified.
|
2024-07-06 04:19:34 +08:00
|
|
|
* @none_ok: Whether %NULL is a valid value.
|
2023-05-31 22:12:04 +08:00
|
|
|
* @flags: Flags for the property specified.
|
|
|
|
*
|
|
|
|
* Creates a new #GimpParamSpecGradient specifying a
|
2023-07-29 18:36:21 +08:00
|
|
|
* [type@Gradient] property.
|
2023-05-31 22:12:04 +08:00
|
|
|
*
|
|
|
|
* See g_param_spec_internal() for details on property names.
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): The newly created #GimpParamSpecGradient.
|
|
|
|
*
|
|
|
|
* Since: 3.0
|
|
|
|
**/
|
|
|
|
GParamSpec *
|
|
|
|
gimp_param_spec_gradient (const gchar *name,
|
|
|
|
const gchar *nick,
|
|
|
|
const gchar *blurb,
|
|
|
|
gboolean none_ok,
|
|
|
|
GParamFlags flags)
|
|
|
|
{
|
|
|
|
GimpParamSpecResource *rspec;
|
|
|
|
|
|
|
|
rspec = g_param_spec_internal (GIMP_TYPE_PARAM_GRADIENT,
|
|
|
|
name, nick, blurb, flags);
|
|
|
|
|
|
|
|
g_return_val_if_fail (rspec, NULL);
|
|
|
|
|
|
|
|
rspec->none_ok = none_ok ? TRUE : FALSE;
|
|
|
|
|
|
|
|
return G_PARAM_SPEC (rspec);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* GIMP_TYPE_PARAM_PALETTE
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void gimp_param_palette_class_init (GParamSpecClass *klass);
|
|
|
|
static void gimp_param_palette_init (GParamSpec *pspec);
|
|
|
|
|
|
|
|
GType
|
|
|
|
gimp_param_palette_get_type (void)
|
|
|
|
{
|
|
|
|
static GType type = 0;
|
|
|
|
|
|
|
|
if (! type)
|
|
|
|
{
|
|
|
|
const GTypeInfo info =
|
|
|
|
{
|
|
|
|
sizeof (GParamSpecClass),
|
|
|
|
NULL, NULL,
|
|
|
|
(GClassInitFunc) gimp_param_palette_class_init,
|
|
|
|
NULL, NULL,
|
|
|
|
sizeof (GimpParamSpecPalette),
|
|
|
|
0,
|
|
|
|
(GInstanceInitFunc) gimp_param_palette_init
|
|
|
|
};
|
|
|
|
|
|
|
|
type = g_type_register_static (GIMP_TYPE_PARAM_RESOURCE,
|
|
|
|
"GimpParamPalette", &info, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_param_palette_class_init (GParamSpecClass *klass)
|
|
|
|
{
|
|
|
|
klass->value_type = GIMP_TYPE_PALETTE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_param_palette_init (GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_param_spec_palette:
|
|
|
|
* @name: Canonical name of the property specified.
|
|
|
|
* @nick: Nick name of the property specified.
|
|
|
|
* @blurb: Description of the property specified.
|
2024-07-06 04:19:34 +08:00
|
|
|
* @none_ok: Whether %NULL is a valid value.
|
2023-05-31 22:12:04 +08:00
|
|
|
* @flags: Flags for the property specified.
|
|
|
|
*
|
|
|
|
* Creates a new #GimpParamSpecPalette specifying a
|
2023-07-29 18:36:21 +08:00
|
|
|
* [type@Palette] property.
|
2023-05-31 22:12:04 +08:00
|
|
|
*
|
|
|
|
* See g_param_spec_internal() for details on property names.
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): The newly created #GimpParamSpecPalette.
|
|
|
|
*
|
|
|
|
* Since: 3.0
|
|
|
|
**/
|
|
|
|
GParamSpec *
|
|
|
|
gimp_param_spec_palette (const gchar *name,
|
|
|
|
const gchar *nick,
|
|
|
|
const gchar *blurb,
|
|
|
|
gboolean none_ok,
|
|
|
|
GParamFlags flags)
|
|
|
|
{
|
|
|
|
GimpParamSpecResource *rspec;
|
|
|
|
|
|
|
|
rspec = g_param_spec_internal (GIMP_TYPE_PARAM_PALETTE,
|
|
|
|
name, nick, blurb, flags);
|
|
|
|
|
|
|
|
g_return_val_if_fail (rspec, NULL);
|
|
|
|
|
|
|
|
rspec->none_ok = none_ok ? TRUE : FALSE;
|
|
|
|
|
|
|
|
return G_PARAM_SPEC (rspec);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2023-06-05 19:06:01 +08:00
|
|
|
* GIMP_TYPE_PARAM_FONT
|
2023-05-31 22:12:04 +08:00
|
|
|
*/
|
|
|
|
|
2023-06-05 19:06:01 +08:00
|
|
|
static void gimp_param_font_class_init (GParamSpecClass *klass);
|
|
|
|
static void gimp_param_font_init (GParamSpec *pspec);
|
2023-05-31 22:12:04 +08:00
|
|
|
|
|
|
|
GType
|
2023-06-05 19:06:01 +08:00
|
|
|
gimp_param_font_get_type (void)
|
2023-05-31 22:12:04 +08:00
|
|
|
{
|
|
|
|
static GType type = 0;
|
|
|
|
|
|
|
|
if (! type)
|
|
|
|
{
|
|
|
|
const GTypeInfo info =
|
|
|
|
{
|
|
|
|
sizeof (GParamSpecClass),
|
|
|
|
NULL, NULL,
|
2023-06-05 19:06:01 +08:00
|
|
|
(GClassInitFunc) gimp_param_font_class_init,
|
2023-05-31 22:12:04 +08:00
|
|
|
NULL, NULL,
|
2023-06-05 19:06:01 +08:00
|
|
|
sizeof (GimpParamSpecFont),
|
2023-05-31 22:12:04 +08:00
|
|
|
0,
|
2023-06-05 19:06:01 +08:00
|
|
|
(GInstanceInitFunc) gimp_param_font_init
|
2023-05-31 22:12:04 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
type = g_type_register_static (GIMP_TYPE_PARAM_RESOURCE,
|
2023-06-05 19:06:01 +08:00
|
|
|
"GimpParamFont", &info, 0);
|
2023-05-31 22:12:04 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2023-06-05 19:06:01 +08:00
|
|
|
gimp_param_font_class_init (GParamSpecClass *klass)
|
2023-05-31 22:12:04 +08:00
|
|
|
{
|
2023-06-05 19:06:01 +08:00
|
|
|
klass->value_type = GIMP_TYPE_FONT;
|
2023-05-31 22:12:04 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2023-06-05 19:06:01 +08:00
|
|
|
gimp_param_font_init (GParamSpec *pspec)
|
2023-05-31 22:12:04 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2023-06-05 19:06:01 +08:00
|
|
|
* gimp_param_spec_font:
|
2023-05-31 22:12:04 +08:00
|
|
|
* @name: Canonical name of the property specified.
|
|
|
|
* @nick: Nick name of the property specified.
|
|
|
|
* @blurb: Description of the property specified.
|
2024-07-06 04:19:34 +08:00
|
|
|
* @none_ok: Whether %NULL is a valid value.
|
2023-05-31 22:12:04 +08:00
|
|
|
* @flags: Flags for the property specified.
|
|
|
|
*
|
2023-06-05 19:06:01 +08:00
|
|
|
* Creates a new #GimpParamSpecFont specifying a
|
2023-07-29 18:36:21 +08:00
|
|
|
* [type@Font] property.
|
2023-05-31 22:12:04 +08:00
|
|
|
*
|
|
|
|
* See g_param_spec_internal() for details on property names.
|
|
|
|
*
|
2023-06-05 19:06:01 +08:00
|
|
|
* Returns: (transfer full): The newly created #GimpParamSpecFont.
|
2023-05-31 22:12:04 +08:00
|
|
|
*
|
|
|
|
* Since: 3.0
|
|
|
|
**/
|
|
|
|
GParamSpec *
|
2023-06-05 19:06:01 +08:00
|
|
|
gimp_param_spec_font (const gchar *name,
|
|
|
|
const gchar *nick,
|
|
|
|
const gchar *blurb,
|
|
|
|
gboolean none_ok,
|
|
|
|
GParamFlags flags)
|
2023-05-31 22:12:04 +08:00
|
|
|
{
|
|
|
|
GimpParamSpecResource *rspec;
|
|
|
|
|
2023-06-05 19:06:01 +08:00
|
|
|
rspec = g_param_spec_internal (GIMP_TYPE_PARAM_FONT,
|
2023-05-31 22:12:04 +08:00
|
|
|
name, nick, blurb, flags);
|
|
|
|
|
|
|
|
g_return_val_if_fail (rspec, NULL);
|
|
|
|
|
|
|
|
rspec->none_ok = none_ok ? TRUE : FALSE;
|
|
|
|
|
|
|
|
return G_PARAM_SPEC (rspec);
|
|
|
|
}
|