libgimp*: support having procedure arguments of generic type GimpResource.

This commit is contained in:
Jehan 2023-08-16 20:48:32 +02:00
parent f759c1e3d9
commit 6601e861c4
3 changed files with 16 additions and 33 deletions

View File

@ -214,6 +214,10 @@ _gimp_gp_param_def_to_param_spec (const GPParamDef *param_def)
param_def->meta.m_id.none_ok,
flags);
if (! strcmp (param_def->type_name, "GimpParamResource"))
return gimp_param_spec_resource (name, nick, blurb,
param_def->meta.m_id.none_ok, flags);
if (! strcmp (param_def->type_name, "GimpParamBrush"))
return gimp_param_spec_brush (name, nick, blurb,
param_def->meta.m_id.none_ok, flags);
@ -385,39 +389,7 @@ _gimp_param_spec_to_gp_param_def (GParamSpec *pspec,
param_def->meta.m_id.none_ok = ispec->none_ok;
}
else if (GIMP_IS_PARAM_SPEC_BRUSH (pspec))
{
GimpParamSpecResource *rspec = GIMP_PARAM_SPEC_RESOURCE (pspec);
param_def->param_def_type = GP_PARAM_DEF_TYPE_ID;
param_def->meta.m_id.none_ok = rspec->none_ok;
}
else if (GIMP_IS_PARAM_SPEC_PATTERN (pspec))
{
GimpParamSpecResource *rspec = GIMP_PARAM_SPEC_RESOURCE (pspec);
param_def->param_def_type = GP_PARAM_DEF_TYPE_ID;
param_def->meta.m_id.none_ok = rspec->none_ok;
}
else if (GIMP_IS_PARAM_SPEC_GRADIENT (pspec))
{
GimpParamSpecResource *rspec = GIMP_PARAM_SPEC_RESOURCE (pspec);
param_def->param_def_type = GP_PARAM_DEF_TYPE_ID;
param_def->meta.m_id.none_ok = rspec->none_ok;
}
else if (GIMP_IS_PARAM_SPEC_PALETTE (pspec))
{
GimpParamSpecResource *rspec = GIMP_PARAM_SPEC_RESOURCE (pspec);
param_def->param_def_type = GP_PARAM_DEF_TYPE_ID;
param_def->meta.m_id.none_ok = rspec->none_ok;
}
else if (GIMP_IS_PARAM_SPEC_FONT (pspec))
else if (GIMP_IS_PARAM_SPEC_RESOURCE (pspec))
{
GimpParamSpecResource *rspec = GIMP_PARAM_SPEC_RESOURCE (pspec);
@ -475,6 +447,10 @@ _gimp_param_spec_to_gp_param_def (GParamSpec *pspec,
{
type_name = "GimpParamVectors";
}
else if (value_type == GIMP_TYPE_RESOURCE)
{
type_name = "GimpParamResource";
}
else if (value_type == GIMP_TYPE_BRUSH)
{
type_name = "GimpParamBrush";

View File

@ -888,6 +888,12 @@ G_BEGIN_DECLS
/* Resource */
#define GIMP_PROC_ARG_RESOURCE(procedure, name, nick, blurb, flags) \
gimp_procedure_add_argument (procedure,\
gimp_param_spec_resource (name, nick, blurb,\
GIMP_TYPE_RESOURCE,\
flags))
#define GIMP_PROC_ARG_BRUSH(procedure, name, nick, blurb, flags) \
gimp_procedure_add_argument (procedure,\
gimp_param_spec_brush (name, nick, blurb,\

View File

@ -355,6 +355,7 @@ gimp_config_param_spec_duplicate (GParamSpec *pspec)
g_strcmp0 (type_name, "GimpLayer") == 0 ||
g_strcmp0 (type_name, "GimpChannel") == 0 ||
g_strcmp0 (type_name, "GimpSelection") == 0 ||
g_strcmp0 (type_name, "GimpResource") == 0 ||
g_strcmp0 (type_name, "GimpBrush") == 0 ||
g_strcmp0 (type_name, "GimpFont") == 0 ||
g_strcmp0 (type_name, "GimpGradient") == 0 ||