app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 16:37:55 +02:00
|
|
|
/* LIBGIMP - The GIMP Library
|
|
|
|
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
|
|
|
|
*
|
2019-07-31 00:12:36 +02:00
|
|
|
* gimpgpcompat.c
|
|
|
|
* Copyright (C) 2019 Michael Natterer <mitch@gimp.org>
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 16:37:55 +02: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.
|
|
|
|
*
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include "gimp.h"
|
2019-08-03 17:11:30 +02:00
|
|
|
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 16:37:55 +02:00
|
|
|
#include "gimpgpcompat.h"
|
|
|
|
|
|
|
|
|
app, libgimp, libgimpbase: big plug-in API refactoring part three
- libgimpbase: change GPParam to transfer all information about the
GValues we use, in the same way done for GPParamDef. GPParam is now
different from GimpParam from libgimp, pointers can't be casted any
longer. The protocol is now completely GimpPDBArgType-free. Remove
gp_params_destroy() from the public API.
- libgimp: add API to convert between an array of GPParams and
GimpValueArray, the latter is now the new official API for dealing
with procedure arguments and return values, GimpParam is cruft (the
wire now talks with GimpPlugIn more directly than with the members
of GimpPlugInInfo, which need additional compat conversions).
- libgimp, app: rename gimpgpparamspecs.[ch] to simply
gimpgpparams.[ch] which is also more accurate because they now
contain GValue functions too. The code that used to live in
app/plug-in/plug-in-params.h is now completely in libgimp.
- app: contains no protocol compat code any longer, the only place
that uses GimpPDBArgType is the PDB query procedure implementation,
which also needs to change.
- app: change some forgotten int32 run-modes to enums.
2019-07-29 01:56:58 +02:00
|
|
|
/* local function prototypes */
|
|
|
|
|
|
|
|
static gchar * _gimp_pdb_arg_type_to_string (GimpPDBArgType type);
|
|
|
|
|
|
|
|
|
|
|
|
/* public functions */
|
|
|
|
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 16:37:55 +02:00
|
|
|
GParamSpec *
|
|
|
|
_gimp_gp_compat_param_spec (GimpPDBArgType arg_type,
|
|
|
|
const gchar *name,
|
|
|
|
const gchar *nick,
|
|
|
|
const gchar *blurb)
|
|
|
|
{
|
|
|
|
GParamSpec *pspec = NULL;
|
|
|
|
|
|
|
|
g_return_val_if_fail (name != NULL, NULL);
|
|
|
|
|
|
|
|
switch (arg_type)
|
|
|
|
{
|
|
|
|
case GIMP_PDB_INT32:
|
2019-08-15 14:04:56 +02:00
|
|
|
pspec = g_param_spec_int (name, nick, blurb,
|
|
|
|
G_MININT32, G_MAXINT32, 0,
|
|
|
|
G_PARAM_READWRITE);
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 16:37:55 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_INT16:
|
2019-08-15 14:17:17 +02:00
|
|
|
pspec = g_param_spec_int (name, nick, blurb,
|
|
|
|
G_MININT16, G_MAXINT16, 0,
|
|
|
|
G_PARAM_READWRITE);
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 16:37:55 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_INT8:
|
2019-08-15 13:34:11 +02:00
|
|
|
pspec = g_param_spec_uchar (name, nick, blurb,
|
|
|
|
0, G_MAXUINT8, 0,
|
|
|
|
G_PARAM_READWRITE);
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 16:37:55 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_FLOAT:
|
|
|
|
pspec = g_param_spec_double (name, nick, blurb,
|
|
|
|
-G_MAXDOUBLE, G_MAXDOUBLE, 0.0,
|
|
|
|
G_PARAM_READWRITE);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_STRING:
|
2019-08-19 12:54:52 +02:00
|
|
|
pspec = g_param_spec_string (name, nick, blurb,
|
|
|
|
NULL,
|
|
|
|
G_PARAM_READWRITE);
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 16:37:55 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_INT32ARRAY:
|
|
|
|
pspec = gimp_param_spec_int32_array (name, nick, blurb,
|
|
|
|
G_PARAM_READWRITE);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_INT16ARRAY:
|
|
|
|
pspec = gimp_param_spec_int16_array (name, nick, blurb,
|
|
|
|
G_PARAM_READWRITE);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_INT8ARRAY:
|
2019-08-15 15:04:34 +02:00
|
|
|
pspec = gimp_param_spec_uint8_array (name, nick, blurb,
|
|
|
|
G_PARAM_READWRITE);
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 16:37:55 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_FLOATARRAY:
|
|
|
|
pspec = gimp_param_spec_float_array (name, nick, blurb,
|
|
|
|
G_PARAM_READWRITE);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_STRINGARRAY:
|
|
|
|
pspec = gimp_param_spec_string_array (name, nick, blurb,
|
|
|
|
G_PARAM_READWRITE);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_COLOR:
|
|
|
|
pspec = gimp_param_spec_rgb (name, nick, blurb,
|
|
|
|
TRUE, NULL,
|
|
|
|
G_PARAM_READWRITE);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_ITEM:
|
|
|
|
pspec = gimp_param_spec_item_id (name, nick, blurb,
|
|
|
|
TRUE,
|
|
|
|
G_PARAM_READWRITE);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_DISPLAY:
|
|
|
|
pspec = gimp_param_spec_display_id (name, nick, blurb,
|
|
|
|
TRUE,
|
|
|
|
G_PARAM_READWRITE);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_IMAGE:
|
|
|
|
pspec = gimp_param_spec_image_id (name, nick, blurb,
|
|
|
|
TRUE,
|
|
|
|
G_PARAM_READWRITE);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_LAYER:
|
|
|
|
pspec = gimp_param_spec_layer_id (name, nick, blurb,
|
|
|
|
TRUE,
|
|
|
|
G_PARAM_READWRITE);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_CHANNEL:
|
|
|
|
pspec = gimp_param_spec_channel_id (name, nick, blurb,
|
|
|
|
TRUE,
|
|
|
|
G_PARAM_READWRITE);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_DRAWABLE:
|
|
|
|
pspec = gimp_param_spec_drawable_id (name, nick, blurb,
|
|
|
|
TRUE,
|
|
|
|
G_PARAM_READWRITE);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_SELECTION:
|
|
|
|
pspec = gimp_param_spec_selection_id (name, nick, blurb,
|
|
|
|
TRUE,
|
|
|
|
G_PARAM_READWRITE);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_COLORARRAY:
|
|
|
|
pspec = gimp_param_spec_rgb_array (name, nick, blurb,
|
|
|
|
G_PARAM_READWRITE);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_VECTORS:
|
|
|
|
pspec = gimp_param_spec_vectors_id (name, nick, blurb,
|
|
|
|
TRUE,
|
|
|
|
G_PARAM_READWRITE);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_PARASITE:
|
|
|
|
pspec = gimp_param_spec_parasite (name, nick, blurb,
|
|
|
|
G_PARAM_READWRITE);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_STATUS:
|
|
|
|
pspec = g_param_spec_enum (name, nick, blurb,
|
|
|
|
GIMP_TYPE_PDB_STATUS_TYPE,
|
|
|
|
GIMP_PDB_EXECUTION_ERROR,
|
|
|
|
G_PARAM_READWRITE);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_END:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (! pspec)
|
|
|
|
g_warning ("%s: returning NULL for %s (%s)",
|
|
|
|
G_STRFUNC, name, _gimp_pdb_arg_type_to_string (arg_type));
|
|
|
|
|
|
|
|
return pspec;
|
|
|
|
}
|
|
|
|
|
|
|
|
GType
|
|
|
|
_gimp_pdb_arg_type_to_gtype (GimpPDBArgType type)
|
|
|
|
{
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case GIMP_PDB_INT32:
|
2019-08-15 14:04:56 +02:00
|
|
|
return G_TYPE_INT;
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 16:37:55 +02:00
|
|
|
|
|
|
|
case GIMP_PDB_INT16:
|
2019-08-15 14:17:17 +02:00
|
|
|
return G_TYPE_INT;
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 16:37:55 +02:00
|
|
|
|
|
|
|
case GIMP_PDB_INT8:
|
2019-08-15 13:34:11 +02:00
|
|
|
return G_TYPE_UCHAR;
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 16:37:55 +02:00
|
|
|
|
|
|
|
case GIMP_PDB_FLOAT:
|
|
|
|
return G_TYPE_DOUBLE;
|
|
|
|
|
|
|
|
case GIMP_PDB_STRING:
|
|
|
|
return G_TYPE_STRING;
|
|
|
|
|
|
|
|
case GIMP_PDB_INT32ARRAY:
|
|
|
|
return GIMP_TYPE_INT32_ARRAY;
|
|
|
|
|
|
|
|
case GIMP_PDB_INT16ARRAY:
|
|
|
|
return GIMP_TYPE_INT16_ARRAY;
|
|
|
|
|
|
|
|
case GIMP_PDB_INT8ARRAY:
|
2019-08-15 15:04:34 +02:00
|
|
|
return GIMP_TYPE_UINT8_ARRAY;
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 16:37:55 +02:00
|
|
|
|
|
|
|
case GIMP_PDB_FLOATARRAY:
|
|
|
|
return GIMP_TYPE_FLOAT_ARRAY;
|
|
|
|
|
|
|
|
case GIMP_PDB_STRINGARRAY:
|
|
|
|
return GIMP_TYPE_STRING_ARRAY;
|
|
|
|
|
|
|
|
case GIMP_PDB_COLOR:
|
|
|
|
return GIMP_TYPE_RGB;
|
|
|
|
|
|
|
|
case GIMP_PDB_ITEM:
|
|
|
|
return GIMP_TYPE_ITEM_ID;
|
|
|
|
|
|
|
|
case GIMP_PDB_DISPLAY:
|
|
|
|
return GIMP_TYPE_DISPLAY_ID;
|
|
|
|
|
|
|
|
case GIMP_PDB_IMAGE:
|
|
|
|
return GIMP_TYPE_IMAGE_ID;
|
|
|
|
|
|
|
|
case GIMP_PDB_LAYER:
|
|
|
|
return GIMP_TYPE_LAYER_ID;
|
|
|
|
|
|
|
|
case GIMP_PDB_CHANNEL:
|
|
|
|
return GIMP_TYPE_CHANNEL_ID;
|
|
|
|
|
|
|
|
case GIMP_PDB_DRAWABLE:
|
|
|
|
return GIMP_TYPE_DRAWABLE_ID;
|
|
|
|
|
|
|
|
case GIMP_PDB_SELECTION:
|
|
|
|
return GIMP_TYPE_SELECTION_ID;
|
|
|
|
|
|
|
|
case GIMP_PDB_COLORARRAY:
|
|
|
|
return GIMP_TYPE_RGB_ARRAY;
|
|
|
|
|
|
|
|
case GIMP_PDB_VECTORS:
|
|
|
|
return GIMP_TYPE_VECTORS_ID;
|
|
|
|
|
|
|
|
case GIMP_PDB_PARASITE:
|
|
|
|
return GIMP_TYPE_PARASITE;
|
|
|
|
|
|
|
|
case GIMP_PDB_STATUS:
|
|
|
|
return GIMP_TYPE_PDB_STATUS_TYPE;
|
|
|
|
|
|
|
|
case GIMP_PDB_END:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_warning ("%s: returning G_TYPE_NONE for %d (%s)",
|
|
|
|
G_STRFUNC, type, _gimp_pdb_arg_type_to_string (type));
|
|
|
|
|
|
|
|
return G_TYPE_NONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
GimpPDBArgType
|
|
|
|
_gimp_pdb_gtype_to_arg_type (GType type)
|
|
|
|
{
|
|
|
|
static GQuark pdb_type_quark = 0;
|
|
|
|
GimpPDBArgType pdb_type;
|
|
|
|
|
|
|
|
if (! pdb_type_quark)
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
GType g_type;
|
|
|
|
GimpPDBArgType pdb_type;
|
|
|
|
}
|
|
|
|
type_mapping[] =
|
|
|
|
{
|
|
|
|
{ G_TYPE_INT, GIMP_PDB_INT32 },
|
|
|
|
{ G_TYPE_UINT, GIMP_PDB_INT32 },
|
|
|
|
{ G_TYPE_ENUM, GIMP_PDB_INT32 },
|
|
|
|
{ G_TYPE_BOOLEAN, GIMP_PDB_INT32 },
|
|
|
|
|
2019-08-15 13:34:11 +02:00
|
|
|
{ G_TYPE_UCHAR, GIMP_PDB_INT8 },
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 16:37:55 +02:00
|
|
|
{ G_TYPE_DOUBLE, GIMP_PDB_FLOAT },
|
|
|
|
|
|
|
|
{ G_TYPE_STRING, GIMP_PDB_STRING },
|
|
|
|
|
|
|
|
{ GIMP_TYPE_RGB, GIMP_PDB_COLOR },
|
|
|
|
|
|
|
|
{ GIMP_TYPE_INT32_ARRAY, GIMP_PDB_INT32ARRAY },
|
|
|
|
{ GIMP_TYPE_INT16_ARRAY, GIMP_PDB_INT16ARRAY },
|
2019-08-15 15:04:34 +02:00
|
|
|
{ GIMP_TYPE_UINT8_ARRAY, GIMP_PDB_INT8ARRAY },
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 16:37:55 +02:00
|
|
|
{ GIMP_TYPE_FLOAT_ARRAY, GIMP_PDB_FLOATARRAY },
|
|
|
|
{ GIMP_TYPE_STRING_ARRAY, GIMP_PDB_STRINGARRAY },
|
|
|
|
{ GIMP_TYPE_RGB_ARRAY, GIMP_PDB_COLORARRAY },
|
|
|
|
|
|
|
|
{ GIMP_TYPE_ITEM_ID, GIMP_PDB_ITEM },
|
|
|
|
{ GIMP_TYPE_DISPLAY_ID, GIMP_PDB_DISPLAY },
|
|
|
|
{ GIMP_TYPE_IMAGE_ID, GIMP_PDB_IMAGE },
|
|
|
|
{ GIMP_TYPE_LAYER_ID, GIMP_PDB_LAYER },
|
|
|
|
{ GIMP_TYPE_CHANNEL_ID, GIMP_PDB_CHANNEL },
|
|
|
|
{ GIMP_TYPE_DRAWABLE_ID, GIMP_PDB_DRAWABLE },
|
|
|
|
{ GIMP_TYPE_SELECTION_ID, GIMP_PDB_SELECTION },
|
|
|
|
{ GIMP_TYPE_LAYER_MASK_ID, GIMP_PDB_CHANNEL },
|
|
|
|
{ GIMP_TYPE_VECTORS_ID, GIMP_PDB_VECTORS },
|
|
|
|
|
|
|
|
{ GIMP_TYPE_PARASITE, GIMP_PDB_PARASITE },
|
|
|
|
|
|
|
|
{ GIMP_TYPE_PDB_STATUS_TYPE, GIMP_PDB_STATUS }
|
|
|
|
};
|
|
|
|
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
pdb_type_quark = g_quark_from_static_string ("gimp-pdb-type");
|
|
|
|
|
|
|
|
for (i = 0; i < G_N_ELEMENTS (type_mapping); i++)
|
|
|
|
g_type_set_qdata (type_mapping[i].g_type, pdb_type_quark,
|
|
|
|
GINT_TO_POINTER (type_mapping[i].pdb_type));
|
|
|
|
}
|
|
|
|
|
|
|
|
pdb_type = GPOINTER_TO_INT (g_type_get_qdata (type, pdb_type_quark));
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
g_printerr ("%s: arg_type = %p (%s) -> %d (%s)\n",
|
|
|
|
G_STRFUNC,
|
|
|
|
(gpointer) type, g_type_name (type),
|
|
|
|
pdb_type, _gimp_pdb_arg_type_to_string (pdb_type));
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return pdb_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
GimpValueArray *
|
app, libgimp, libgimpbase: big plug-in API refactoring part three
- libgimpbase: change GPParam to transfer all information about the
GValues we use, in the same way done for GPParamDef. GPParam is now
different from GimpParam from libgimp, pointers can't be casted any
longer. The protocol is now completely GimpPDBArgType-free. Remove
gp_params_destroy() from the public API.
- libgimp: add API to convert between an array of GPParams and
GimpValueArray, the latter is now the new official API for dealing
with procedure arguments and return values, GimpParam is cruft (the
wire now talks with GimpPlugIn more directly than with the members
of GimpPlugInInfo, which need additional compat conversions).
- libgimp, app: rename gimpgpparamspecs.[ch] to simply
gimpgpparams.[ch] which is also more accurate because they now
contain GValue functions too. The code that used to live in
app/plug-in/plug-in-params.h is now completely in libgimp.
- app: contains no protocol compat code any longer, the only place
that uses GimpPDBArgType is the PDB query procedure implementation,
which also needs to change.
- app: change some forgotten int32 run-modes to enums.
2019-07-29 01:56:58 +02:00
|
|
|
_gimp_params_to_value_array (const GimpParam *params,
|
|
|
|
gint n_params,
|
|
|
|
gboolean full_copy)
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 16:37:55 +02:00
|
|
|
{
|
|
|
|
GimpValueArray *args;
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
g_return_val_if_fail ((params != NULL && n_params > 0) ||
|
|
|
|
(params == NULL && n_params == 0), NULL);
|
|
|
|
|
|
|
|
args = gimp_value_array_new (n_params);
|
|
|
|
|
|
|
|
for (i = 0; i < n_params; i++)
|
|
|
|
{
|
|
|
|
GValue value = G_VALUE_INIT;
|
app, libgimp, libgimpbase: big plug-in API refactoring part three
- libgimpbase: change GPParam to transfer all information about the
GValues we use, in the same way done for GPParamDef. GPParam is now
different from GimpParam from libgimp, pointers can't be casted any
longer. The protocol is now completely GimpPDBArgType-free. Remove
gp_params_destroy() from the public API.
- libgimp: add API to convert between an array of GPParams and
GimpValueArray, the latter is now the new official API for dealing
with procedure arguments and return values, GimpParam is cruft (the
wire now talks with GimpPlugIn more directly than with the members
of GimpPlugInInfo, which need additional compat conversions).
- libgimp, app: rename gimpgpparamspecs.[ch] to simply
gimpgpparams.[ch] which is also more accurate because they now
contain GValue functions too. The code that used to live in
app/plug-in/plug-in-params.h is now completely in libgimp.
- app: contains no protocol compat code any longer, the only place
that uses GimpPDBArgType is the PDB query procedure implementation,
which also needs to change.
- app: change some forgotten int32 run-modes to enums.
2019-07-29 01:56:58 +02:00
|
|
|
GType type = _gimp_pdb_arg_type_to_gtype (params[i].type);
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 16:37:55 +02:00
|
|
|
gint count;
|
|
|
|
|
|
|
|
g_value_init (&value, type);
|
|
|
|
|
|
|
|
switch (_gimp_pdb_gtype_to_arg_type (type))
|
|
|
|
{
|
|
|
|
case GIMP_PDB_INT32:
|
|
|
|
if (G_VALUE_HOLDS_INT (&value))
|
|
|
|
g_value_set_int (&value, params[i].data.d_int32);
|
|
|
|
else if (G_VALUE_HOLDS_UINT (&value))
|
|
|
|
g_value_set_uint (&value, params[i].data.d_int32);
|
|
|
|
else if (G_VALUE_HOLDS_ENUM (&value))
|
|
|
|
g_value_set_enum (&value, params[i].data.d_int32);
|
|
|
|
else if (G_VALUE_HOLDS_BOOLEAN (&value))
|
|
|
|
g_value_set_boolean (&value, params[i].data.d_int32 ? TRUE : FALSE);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_printerr ("%s: unhandled GIMP_PDB_INT32 type: %s\n",
|
|
|
|
G_STRFUNC, g_type_name (G_VALUE_TYPE (&value)));
|
|
|
|
g_return_val_if_reached (args);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_INT16:
|
|
|
|
g_value_set_int (&value, params[i].data.d_int16);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_INT8:
|
2019-08-15 13:34:11 +02:00
|
|
|
g_value_set_uchar (&value, params[i].data.d_int8);
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 16:37:55 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_FLOAT:
|
|
|
|
g_value_set_double (&value, params[i].data.d_float);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_STRING:
|
|
|
|
if (full_copy)
|
|
|
|
g_value_set_string (&value, params[i].data.d_string);
|
|
|
|
else
|
|
|
|
g_value_set_static_string (&value, params[i].data.d_string);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_INT32ARRAY:
|
2019-08-20 01:21:32 +02:00
|
|
|
count = GIMP_VALUES_GET_INT (args, i - 1);
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 16:37:55 +02:00
|
|
|
if (full_copy)
|
|
|
|
gimp_value_set_int32_array (&value,
|
|
|
|
params[i].data.d_int32array,
|
|
|
|
count);
|
|
|
|
else
|
|
|
|
gimp_value_set_static_int32_array (&value,
|
|
|
|
params[i].data.d_int32array,
|
|
|
|
count);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_INT16ARRAY:
|
2019-08-20 01:21:32 +02:00
|
|
|
count = GIMP_VALUES_GET_INT (args, i - 1);
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 16:37:55 +02:00
|
|
|
if (full_copy)
|
|
|
|
gimp_value_set_int16_array (&value,
|
|
|
|
params[i].data.d_int16array,
|
|
|
|
count);
|
|
|
|
else
|
|
|
|
gimp_value_set_static_int16_array (&value,
|
|
|
|
params[i].data.d_int16array,
|
|
|
|
count);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_INT8ARRAY:
|
2019-08-20 01:21:32 +02:00
|
|
|
count = GIMP_VALUES_GET_INT (args, i - 1);
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 16:37:55 +02:00
|
|
|
if (full_copy)
|
2019-08-15 15:04:34 +02:00
|
|
|
gimp_value_set_uint8_array (&value,
|
|
|
|
params[i].data.d_int8array,
|
|
|
|
count);
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 16:37:55 +02:00
|
|
|
else
|
2019-08-15 15:04:34 +02:00
|
|
|
gimp_value_set_static_uint8_array (&value,
|
|
|
|
params[i].data.d_int8array,
|
|
|
|
count);
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 16:37:55 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_FLOATARRAY:
|
2019-08-20 01:21:32 +02:00
|
|
|
count = GIMP_VALUES_GET_INT (args, i - 1);
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 16:37:55 +02:00
|
|
|
if (full_copy)
|
|
|
|
gimp_value_set_float_array (&value,
|
|
|
|
params[i].data.d_floatarray,
|
|
|
|
count);
|
|
|
|
else
|
|
|
|
gimp_value_set_static_float_array (&value,
|
|
|
|
params[i].data.d_floatarray,
|
|
|
|
count);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_STRINGARRAY:
|
2019-08-20 01:21:32 +02:00
|
|
|
count = GIMP_VALUES_GET_INT (args, i - 1);
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 16:37:55 +02:00
|
|
|
if (full_copy)
|
|
|
|
gimp_value_set_string_array (&value,
|
|
|
|
(const gchar **) params[i].data.d_stringarray,
|
|
|
|
count);
|
|
|
|
else
|
|
|
|
gimp_value_set_static_string_array (&value,
|
|
|
|
(const gchar **) params[i].data.d_stringarray,
|
|
|
|
count);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_COLOR:
|
|
|
|
gimp_value_set_rgb (&value, ¶ms[i].data.d_color);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_ITEM:
|
|
|
|
g_value_set_int (&value, params[i].data.d_item);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_DISPLAY:
|
|
|
|
g_value_set_int (&value, params[i].data.d_display);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_IMAGE:
|
|
|
|
g_value_set_int (&value, params[i].data.d_image);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_LAYER:
|
|
|
|
g_value_set_int (&value, params[i].data.d_layer);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_CHANNEL:
|
|
|
|
g_value_set_int (&value, params[i].data.d_channel);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_DRAWABLE:
|
|
|
|
g_value_set_int (&value, params[i].data.d_drawable);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_SELECTION:
|
|
|
|
g_value_set_int (&value, params[i].data.d_selection);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_COLORARRAY:
|
2019-08-20 01:21:32 +02:00
|
|
|
count = GIMP_VALUES_GET_INT (args, i - 1);
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 16:37:55 +02:00
|
|
|
if (full_copy)
|
|
|
|
gimp_value_set_rgb_array (&value,
|
|
|
|
params[i].data.d_colorarray,
|
|
|
|
count);
|
|
|
|
else
|
|
|
|
gimp_value_set_static_rgb_array (&value,
|
|
|
|
params[i].data.d_colorarray,
|
|
|
|
count);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_VECTORS:
|
|
|
|
g_value_set_int (&value, params[i].data.d_vectors);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_PARASITE:
|
|
|
|
if (full_copy)
|
|
|
|
g_value_set_boxed (&value, ¶ms[i].data.d_parasite);
|
|
|
|
else
|
|
|
|
g_value_set_static_boxed (&value, ¶ms[i].data.d_parasite);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_STATUS:
|
|
|
|
g_value_set_enum (&value, params[i].data.d_status);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_END:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
gimp_value_array_append (args, &value);
|
|
|
|
g_value_unset (&value);
|
|
|
|
}
|
|
|
|
|
|
|
|
return args;
|
|
|
|
}
|
|
|
|
|
|
|
|
GimpParam *
|
app, libgimp, libgimpbase: big plug-in API refactoring part three
- libgimpbase: change GPParam to transfer all information about the
GValues we use, in the same way done for GPParamDef. GPParam is now
different from GimpParam from libgimp, pointers can't be casted any
longer. The protocol is now completely GimpPDBArgType-free. Remove
gp_params_destroy() from the public API.
- libgimp: add API to convert between an array of GPParams and
GimpValueArray, the latter is now the new official API for dealing
with procedure arguments and return values, GimpParam is cruft (the
wire now talks with GimpPlugIn more directly than with the members
of GimpPlugInInfo, which need additional compat conversions).
- libgimp, app: rename gimpgpparamspecs.[ch] to simply
gimpgpparams.[ch] which is also more accurate because they now
contain GValue functions too. The code that used to live in
app/plug-in/plug-in-params.h is now completely in libgimp.
- app: contains no protocol compat code any longer, the only place
that uses GimpPDBArgType is the PDB query procedure implementation,
which also needs to change.
- app: change some forgotten int32 run-modes to enums.
2019-07-29 01:56:58 +02:00
|
|
|
_gimp_value_array_to_params (GimpValueArray *args,
|
|
|
|
gboolean full_copy)
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 16:37:55 +02:00
|
|
|
{
|
|
|
|
GimpParam *params;
|
|
|
|
gint length;
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
g_return_val_if_fail (args != NULL, NULL);
|
|
|
|
|
|
|
|
params = g_new0 (GimpParam, gimp_value_array_length (args));
|
|
|
|
|
|
|
|
length = gimp_value_array_length (args);
|
|
|
|
|
|
|
|
for (i = 0; i < length; i++)
|
|
|
|
{
|
|
|
|
GValue *value = gimp_value_array_index (args, i);
|
|
|
|
|
|
|
|
params[i].type = _gimp_pdb_gtype_to_arg_type (G_VALUE_TYPE (value));
|
|
|
|
|
|
|
|
switch (params[i].type)
|
|
|
|
{
|
|
|
|
case GIMP_PDB_INT32:
|
|
|
|
if (G_VALUE_HOLDS_INT (value))
|
|
|
|
params[i].data.d_int32 = g_value_get_int (value);
|
|
|
|
else if (G_VALUE_HOLDS_UINT (value))
|
|
|
|
params[i].data.d_int32 = g_value_get_uint (value);
|
|
|
|
else if (G_VALUE_HOLDS_ENUM (value))
|
|
|
|
params[i].data.d_int32 = g_value_get_enum (value);
|
|
|
|
else if (G_VALUE_HOLDS_BOOLEAN (value))
|
|
|
|
params[i].data.d_int32 = g_value_get_boolean (value);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_printerr ("%s: unhandled GIMP_PDB_INT32 type: %s\n",
|
|
|
|
G_STRFUNC, g_type_name (G_VALUE_TYPE (value)));
|
|
|
|
g_return_val_if_reached (params);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_INT16:
|
|
|
|
params[i].data.d_int16 = g_value_get_int (value);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_INT8:
|
2019-08-15 13:34:11 +02:00
|
|
|
params[i].data.d_int8 = g_value_get_uchar (value);
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 16:37:55 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_FLOAT:
|
|
|
|
params[i].data.d_float = g_value_get_double (value);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_STRING:
|
|
|
|
if (full_copy)
|
|
|
|
params[i].data.d_string = g_value_dup_string (value);
|
|
|
|
else
|
|
|
|
params[i].data.d_string = (gchar *) g_value_get_string (value);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_INT32ARRAY:
|
|
|
|
if (full_copy)
|
|
|
|
params[i].data.d_int32array = gimp_value_dup_int32_array (value);
|
|
|
|
else
|
|
|
|
params[i].data.d_int32array = (gint32 *) gimp_value_get_int32_array (value);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_INT16ARRAY:
|
|
|
|
if (full_copy)
|
|
|
|
params[i].data.d_int16array = gimp_value_dup_int16_array (value);
|
|
|
|
else
|
|
|
|
params[i].data.d_int16array = (gint16 *) gimp_value_get_int16_array (value);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_INT8ARRAY:
|
|
|
|
if (full_copy)
|
2019-08-15 15:04:34 +02:00
|
|
|
params[i].data.d_int8array = gimp_value_dup_uint8_array (value);
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 16:37:55 +02:00
|
|
|
else
|
2019-08-15 15:04:34 +02:00
|
|
|
params[i].data.d_int8array = (guint8 *) gimp_value_get_uint8_array (value);
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 16:37:55 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_FLOATARRAY:
|
|
|
|
if (full_copy)
|
|
|
|
params[i].data.d_floatarray = gimp_value_dup_float_array (value);
|
|
|
|
else
|
|
|
|
params[i].data.d_floatarray = (gdouble *) gimp_value_get_float_array (value);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_STRINGARRAY:
|
|
|
|
if (full_copy)
|
|
|
|
params[i].data.d_stringarray = gimp_value_dup_string_array (value);
|
|
|
|
else
|
|
|
|
params[i].data.d_stringarray = (gchar **) gimp_value_get_string_array (value);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_COLOR:
|
|
|
|
gimp_value_get_rgb (value, ¶ms[i].data.d_color);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_ITEM:
|
|
|
|
params[i].data.d_item = g_value_get_int (value);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_DISPLAY:
|
|
|
|
params[i].data.d_display = g_value_get_int (value);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_IMAGE:
|
|
|
|
params[i].data.d_image = g_value_get_int (value);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_LAYER:
|
|
|
|
params[i].data.d_layer = g_value_get_int (value);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_CHANNEL:
|
|
|
|
params[i].data.d_channel = g_value_get_int (value);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_DRAWABLE:
|
|
|
|
params[i].data.d_drawable = g_value_get_int (value);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_SELECTION:
|
|
|
|
params[i].data.d_selection = g_value_get_int (value);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_COLORARRAY:
|
|
|
|
if (full_copy)
|
|
|
|
params[i].data.d_colorarray = gimp_value_dup_rgb_array (value);
|
|
|
|
else
|
|
|
|
params[i].data.d_colorarray = (GimpRGB *) gimp_value_get_rgb_array (value);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_VECTORS:
|
|
|
|
params[i].data.d_vectors = g_value_get_int (value);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_PARASITE:
|
|
|
|
{
|
|
|
|
GimpParasite *parasite = (full_copy ?
|
|
|
|
g_value_dup_boxed (value) :
|
|
|
|
g_value_get_boxed (value));
|
|
|
|
|
|
|
|
if (parasite)
|
|
|
|
{
|
|
|
|
params[i].data.d_parasite.name = parasite->name;
|
|
|
|
params[i].data.d_parasite.flags = parasite->flags;
|
|
|
|
params[i].data.d_parasite.size = parasite->size;
|
|
|
|
params[i].data.d_parasite.data = parasite->data;
|
|
|
|
|
|
|
|
if (full_copy)
|
|
|
|
{
|
|
|
|
parasite->name = NULL;
|
|
|
|
parasite->flags = 0;
|
|
|
|
parasite->size = 0;
|
|
|
|
parasite->data = NULL;
|
|
|
|
|
|
|
|
gimp_parasite_free (parasite);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
params[i].data.d_parasite.name = NULL;
|
|
|
|
params[i].data.d_parasite.flags = 0;
|
|
|
|
params[i].data.d_parasite.size = 0;
|
|
|
|
params[i].data.d_parasite.data = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_STATUS:
|
|
|
|
params[i].data.d_status = g_value_get_enum (value);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_END:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return params;
|
|
|
|
}
|
app, libgimp, libgimpbase: big plug-in API refactoring part three
- libgimpbase: change GPParam to transfer all information about the
GValues we use, in the same way done for GPParamDef. GPParam is now
different from GimpParam from libgimp, pointers can't be casted any
longer. The protocol is now completely GimpPDBArgType-free. Remove
gp_params_destroy() from the public API.
- libgimp: add API to convert between an array of GPParams and
GimpValueArray, the latter is now the new official API for dealing
with procedure arguments and return values, GimpParam is cruft (the
wire now talks with GimpPlugIn more directly than with the members
of GimpPlugInInfo, which need additional compat conversions).
- libgimp, app: rename gimpgpparamspecs.[ch] to simply
gimpgpparams.[ch] which is also more accurate because they now
contain GValue functions too. The code that used to live in
app/plug-in/plug-in-params.h is now completely in libgimp.
- app: contains no protocol compat code any longer, the only place
that uses GimpPDBArgType is the PDB query procedure implementation,
which also needs to change.
- app: change some forgotten int32 run-modes to enums.
2019-07-29 01:56:58 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* private functions */
|
|
|
|
|
|
|
|
gchar *
|
|
|
|
_gimp_pdb_arg_type_to_string (GimpPDBArgType type)
|
|
|
|
{
|
|
|
|
const gchar *name;
|
|
|
|
|
|
|
|
if (! gimp_enum_get_value (GIMP_TYPE_PDB_ARG_TYPE, type,
|
|
|
|
&name, NULL, NULL, NULL))
|
|
|
|
{
|
|
|
|
return g_strdup_printf ("(PDB type %d unknown)", type);
|
|
|
|
}
|
|
|
|
|
|
|
|
return g_strdup (name);
|
|
|
|
}
|