2019-07-26 08:05:11 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2019-07-31 06:12:36 +08:00
|
|
|
* gimpprocedure.h
|
|
|
|
* Copyright (C) 2019 Michael Natterer <mitch@gimp.org>
|
|
|
|
*
|
2019-07-26 08:05:11 +08:00
|
|
|
* This library is free software: you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 3 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
|
|
|
|
#error "Only <libgimp/gimp.h> can be included directly."
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __GIMP_PROCEDURE_H__
|
|
|
|
#define __GIMP_PROCEDURE_H__
|
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
/* For information look into the C source or the html documentation */
|
|
|
|
|
|
|
|
|
2019-08-02 05:46:25 +08:00
|
|
|
/**
|
|
|
|
* GimpRunFunc:
|
|
|
|
* @procedure: the #GimpProcedure that runs.
|
|
|
|
* @args: the @procedure's arguments.
|
2020-05-05 03:31:30 +08:00
|
|
|
* @run_data: (closure): the run_data given in gimp_procedure_new().
|
2019-08-02 05:46:25 +08:00
|
|
|
*
|
|
|
|
* The run function is run during the lifetime of the GIMP session,
|
|
|
|
* each time a plug-in procedure is called.
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): the @procedure's return values.
|
|
|
|
*
|
|
|
|
* Since: 3.0
|
|
|
|
**/
|
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 22:37:55 +08:00
|
|
|
typedef GimpValueArray * (* GimpRunFunc) (GimpProcedure *procedure,
|
2019-08-02 04:45:49 +08:00
|
|
|
const GimpValueArray *args,
|
|
|
|
gpointer run_data);
|
2019-07-26 08:05:11 +08:00
|
|
|
|
|
|
|
|
2020-06-16 04:55:58 +08:00
|
|
|
/**
|
|
|
|
* GimpArgumentSync:
|
|
|
|
* @GIMP_ARGUMENT_SYNC_NONE: Don't sync this argument
|
|
|
|
* @GIMP_ARGUMENT_SYNC_PARASITE: Sync this argument with an image parasite
|
|
|
|
*
|
|
|
|
* Methods of syncing procedure arguments.
|
|
|
|
*
|
|
|
|
* Since: 3.0
|
|
|
|
**/
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
GIMP_ARGUMENT_SYNC_NONE,
|
|
|
|
GIMP_ARGUMENT_SYNC_PARASITE
|
|
|
|
} GimpArgumentSync;
|
|
|
|
|
|
|
|
|
2019-07-26 08:05:11 +08:00
|
|
|
#define GIMP_TYPE_PROCEDURE (gimp_procedure_get_type ())
|
|
|
|
#define GIMP_PROCEDURE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_PROCEDURE, GimpProcedure))
|
|
|
|
#define GIMP_PROCEDURE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PROCEDURE, GimpProcedureClass))
|
|
|
|
#define GIMP_IS_PROCEDURE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_PROCEDURE))
|
|
|
|
#define GIMP_IS_PROCEDURE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_PROCEDURE))
|
|
|
|
#define GIMP_PROCEDURE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_PROCEDURE, GimpProcedureClass))
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct _GimpProcedureClass GimpProcedureClass;
|
|
|
|
typedef struct _GimpProcedurePrivate GimpProcedurePrivate;
|
|
|
|
|
|
|
|
struct _GimpProcedure
|
|
|
|
{
|
|
|
|
GObject parent_instance;
|
|
|
|
|
|
|
|
GimpProcedurePrivate *priv;
|
|
|
|
};
|
|
|
|
|
2019-09-10 17:17:12 +08:00
|
|
|
/**
|
|
|
|
* GimpProcedureClass:
|
|
|
|
* @install: called to install the procedure with the main GIMP
|
|
|
|
* application. This is an implementation detail and must never
|
|
|
|
* be called by any plug-in code.
|
|
|
|
* @uninstall: called to uninstall the procedure from the main GIMP
|
|
|
|
* application. This is an implementation detail and must never
|
|
|
|
* be called by any plug-in code.
|
2019-12-28 02:56:21 +08:00
|
|
|
* @run: called when the procedure is executed via gimp_procedure_run().
|
2019-09-10 17:17:12 +08:00
|
|
|
* the default implementation simply calls the procedure's #GimpRunFunc,
|
|
|
|
* #GimpProcedure subclasses are free to modify the passed @args and
|
|
|
|
* call their own, subclass-specific run functions.
|
2019-12-28 02:56:21 +08:00
|
|
|
* @create_config: called when a #GimpConfig object is created using
|
|
|
|
* gimp_procedure_create_config().
|
2019-09-10 17:17:12 +08:00
|
|
|
*
|
|
|
|
* Since: 3.0
|
|
|
|
**/
|
2019-07-26 08:05:11 +08:00
|
|
|
struct _GimpProcedureClass
|
|
|
|
{
|
|
|
|
GObjectClass parent_class;
|
2019-08-06 18:17:27 +08:00
|
|
|
|
2021-04-30 05:53:35 +08:00
|
|
|
void (* install) (GimpProcedure *procedure);
|
|
|
|
void (* uninstall) (GimpProcedure *procedure);
|
2019-08-11 02:25:37 +08:00
|
|
|
|
2021-04-30 05:53:35 +08:00
|
|
|
GimpValueArray * (* run) (GimpProcedure *procedure,
|
|
|
|
const GimpValueArray *args);
|
2019-09-20 18:31:11 +08:00
|
|
|
|
2021-04-30 05:53:35 +08:00
|
|
|
GimpProcedureConfig * (* create_config) (GimpProcedure *procedure,
|
|
|
|
GParamSpec **args,
|
|
|
|
gint n_args);
|
|
|
|
|
|
|
|
gboolean (* set_sensitivity) (GimpProcedure *procedure,
|
|
|
|
gint sensitivity_mask);
|
2019-08-06 18:17:27 +08:00
|
|
|
|
|
|
|
/* Padding for future expansion */
|
2019-12-28 02:56:21 +08:00
|
|
|
/*< private >*/
|
2019-08-06 18:17:27 +08:00
|
|
|
void (*_gimp_reserved1) (void);
|
|
|
|
void (*_gimp_reserved2) (void);
|
|
|
|
void (*_gimp_reserved3) (void);
|
|
|
|
void (*_gimp_reserved4) (void);
|
|
|
|
void (*_gimp_reserved5) (void);
|
|
|
|
void (*_gimp_reserved6) (void);
|
|
|
|
void (*_gimp_reserved7) (void);
|
|
|
|
void (*_gimp_reserved8) (void);
|
2019-07-26 08:05:11 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
GType gimp_procedure_get_type (void) G_GNUC_CONST;
|
|
|
|
|
2019-08-07 06:02:29 +08:00
|
|
|
GimpProcedure * gimp_procedure_new (GimpPlugIn *plug_in,
|
|
|
|
const gchar *name,
|
|
|
|
GimpPDBProcType proc_type,
|
|
|
|
GimpRunFunc run_func,
|
|
|
|
gpointer run_data,
|
|
|
|
GDestroyNotify run_data_destroy);
|
|
|
|
|
|
|
|
GimpPlugIn * gimp_procedure_get_plug_in (GimpProcedure *procedure);
|
|
|
|
const gchar * gimp_procedure_get_name (GimpProcedure *procedure);
|
|
|
|
GimpPDBProcType gimp_procedure_get_proc_type (GimpProcedure *procedure);
|
|
|
|
|
|
|
|
void gimp_procedure_set_image_types (GimpProcedure *procedure,
|
|
|
|
const gchar *image_types);
|
|
|
|
const gchar * gimp_procedure_get_image_types (GimpProcedure *procedure);
|
|
|
|
|
2021-04-02 05:49:11 +08:00
|
|
|
void gimp_procedure_set_sensitivity_mask (GimpProcedure *procedure,
|
|
|
|
gint sensitivity_mask);
|
|
|
|
gint gimp_procedure_get_sensitivity_mask (GimpProcedure *procedure);
|
|
|
|
|
|
|
|
|
2019-08-07 06:02:29 +08:00
|
|
|
void gimp_procedure_set_menu_label (GimpProcedure *procedure,
|
|
|
|
const gchar *menu_label);
|
|
|
|
const gchar * gimp_procedure_get_menu_label (GimpProcedure *procedure);
|
|
|
|
|
|
|
|
void gimp_procedure_add_menu_path (GimpProcedure *procedure,
|
|
|
|
const gchar *menu_path);
|
|
|
|
GList * gimp_procedure_get_menu_paths (GimpProcedure *procedure);
|
|
|
|
|
2019-08-18 20:04:45 +08:00
|
|
|
void gimp_procedure_set_icon_name (GimpProcedure *procedure,
|
|
|
|
const gchar *icon_name);
|
|
|
|
void gimp_procedure_set_icon_file (GimpProcedure *procedure,
|
|
|
|
GFile *file);
|
|
|
|
void gimp_procedure_set_icon_pixbuf (GimpProcedure *procedure,
|
|
|
|
GdkPixbuf *pixbuf);
|
|
|
|
|
|
|
|
GimpIconType gimp_procedure_get_icon_type (GimpProcedure *procedure);
|
|
|
|
const gchar * gimp_procedure_get_icon_name (GimpProcedure *procedure);
|
|
|
|
GFile * gimp_procedure_get_icon_file (GimpProcedure *procedure);
|
|
|
|
GdkPixbuf * gimp_procedure_get_icon_pixbuf (GimpProcedure *procedure);
|
|
|
|
|
2019-08-07 06:02:29 +08:00
|
|
|
void gimp_procedure_set_documentation (GimpProcedure *procedure,
|
|
|
|
const gchar *blurb,
|
|
|
|
const gchar *help,
|
|
|
|
const gchar *help_id);
|
|
|
|
const gchar * gimp_procedure_get_blurb (GimpProcedure *procedure);
|
|
|
|
const gchar * gimp_procedure_get_help (GimpProcedure *procedure);
|
|
|
|
const gchar * gimp_procedure_get_help_id (GimpProcedure *procedure);
|
|
|
|
|
|
|
|
void gimp_procedure_set_attribution (GimpProcedure *procedure,
|
|
|
|
const gchar *authors,
|
|
|
|
const gchar *copyright,
|
|
|
|
const gchar *date);
|
|
|
|
const gchar * gimp_procedure_get_authors (GimpProcedure *procedure);
|
|
|
|
const gchar * gimp_procedure_get_copyright (GimpProcedure *procedure);
|
|
|
|
const gchar * gimp_procedure_get_date (GimpProcedure *procedure);
|
|
|
|
|
2020-06-12 18:15:22 +08:00
|
|
|
GParamSpec * gimp_procedure_add_argument (GimpProcedure *procedure,
|
2019-08-07 06:02:29 +08:00
|
|
|
GParamSpec *pspec);
|
2020-06-12 18:15:22 +08:00
|
|
|
GParamSpec * gimp_procedure_add_argument_from_property
|
2019-08-07 06:02:29 +08:00
|
|
|
(GimpProcedure *procedure,
|
|
|
|
GObject *config,
|
|
|
|
const gchar *prop_name);
|
2020-06-16 04:55:58 +08:00
|
|
|
|
2020-06-12 18:15:22 +08:00
|
|
|
GParamSpec * gimp_procedure_add_aux_argument (GimpProcedure *procedure,
|
2019-09-24 18:39:02 +08:00
|
|
|
GParamSpec *pspec);
|
2020-06-12 18:15:22 +08:00
|
|
|
GParamSpec * gimp_procedure_add_aux_argument_from_property
|
2019-09-24 18:39:02 +08:00
|
|
|
(GimpProcedure *procedure,
|
|
|
|
GObject *config,
|
|
|
|
const gchar *prop_name);
|
2020-06-16 04:55:58 +08:00
|
|
|
|
2020-06-12 18:15:22 +08:00
|
|
|
GParamSpec * gimp_procedure_add_return_value (GimpProcedure *procedure,
|
2019-08-07 06:02:29 +08:00
|
|
|
GParamSpec *pspec);
|
2020-06-12 18:15:22 +08:00
|
|
|
GParamSpec * gimp_procedure_add_return_value_from_property
|
2019-08-07 06:02:29 +08:00
|
|
|
(GimpProcedure *procedure,
|
|
|
|
GObject *config,
|
|
|
|
const gchar *prop_name);
|
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 22:37:55 +08:00
|
|
|
|
2019-10-12 18:49:32 +08:00
|
|
|
GParamSpec * gimp_procedure_find_argument (GimpProcedure *procedure,
|
|
|
|
const gchar *name);
|
|
|
|
GParamSpec * gimp_procedure_find_aux_argument (GimpProcedure *procedure,
|
|
|
|
const gchar *name);
|
|
|
|
GParamSpec * gimp_procedure_find_return_value (GimpProcedure *procedure,
|
|
|
|
const gchar *name);
|
|
|
|
|
2019-08-07 06:02:29 +08:00
|
|
|
GParamSpec ** gimp_procedure_get_arguments (GimpProcedure *procedure,
|
2019-09-24 18:39:02 +08:00
|
|
|
gint *n_arguments);
|
|
|
|
GParamSpec ** gimp_procedure_get_aux_arguments (GimpProcedure *procedure,
|
2019-08-07 06:02:29 +08:00
|
|
|
gint *n_arguments);
|
|
|
|
GParamSpec ** gimp_procedure_get_return_values (GimpProcedure *procedure,
|
|
|
|
gint *n_return_values);
|
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 22:37:55 +08:00
|
|
|
|
2020-06-16 04:55:58 +08:00
|
|
|
void gimp_procedure_set_argument_sync (GimpProcedure *procedure,
|
|
|
|
const gchar *arg_name,
|
|
|
|
GimpArgumentSync sync);
|
|
|
|
GimpArgumentSync gimp_procedure_get_argument_sync (GimpProcedure *procedure,
|
|
|
|
const gchar *arg_name);
|
|
|
|
|
2019-08-07 06:02:29 +08:00
|
|
|
GimpValueArray * gimp_procedure_new_arguments (GimpProcedure *procedure);
|
|
|
|
GimpValueArray * gimp_procedure_new_return_values (GimpProcedure *procedure,
|
|
|
|
GimpPDBStatusType status,
|
|
|
|
GError *error);
|
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 22:37:55 +08:00
|
|
|
|
2019-08-07 06:02:29 +08:00
|
|
|
GimpValueArray * gimp_procedure_run (GimpProcedure *procedure,
|
2019-08-13 18:34:09 +08:00
|
|
|
GimpValueArray *args);
|
2019-07-26 08:05:11 +08:00
|
|
|
|
2019-08-07 06:02:29 +08:00
|
|
|
void gimp_procedure_extension_ready (GimpProcedure *procedure);
|
2019-08-02 05:24:49 +08:00
|
|
|
|
2019-09-20 18:31:11 +08:00
|
|
|
GimpProcedureConfig *
|
|
|
|
gimp_procedure_create_config (GimpProcedure *procedure);
|
|
|
|
|
2019-07-26 08:05:11 +08:00
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __GIMP_PROCEDURE_H__ */
|