gimp/libgimp/gimpprocedure.h

169 lines
7.9 KiB
C
Raw Normal View History

/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimpprocedure.h
* Copyright (C) 2019 Michael Natterer <mitch@gimp.org>
*
* 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 */
/**
* GimpRunFunc:
* @procedure: the #GimpProcedure that runs.
* @args: the @procedure's arguments.
* @run_data: the run_data given in gimp_procedure_new().
*
* 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,
const GimpValueArray *args,
gpointer run_data);
#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;
};
struct _GimpProcedureClass
{
GObjectClass parent_class;
GimpValueArray * (* run) (GimpProcedure *procedure,
const GimpValueArray *args);
/* Padding for future expansion */
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);
};
GType gimp_procedure_get_type (void) G_GNUC_CONST;
GimpProcedure * gimp_procedure_new (GimpPlugIn *plug_in,
const gchar *name,
GimpPDBProcType proc_type,
GimpRunFunc run_func,
gpointer run_data,
GDestroyNotify run_data_destroy);
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
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);
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);
void gimp_procedure_set_documentation (GimpProcedure *procedure,
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
const gchar *blurb,
const gchar *help,
const gchar *help_id);
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
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);
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
const gchar * gimp_procedure_get_copyright (GimpProcedure *procedure);
const gchar * gimp_procedure_get_date (GimpProcedure *procedure);
void gimp_procedure_set_icon (GimpProcedure *procedure,
GimpIconType icon_type,
const guint8 *icon_data);
GimpIconType gimp_procedure_get_icon (GimpProcedure *procedure,
const guint8 **icon_data,
gint *icon_data_length);
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
void gimp_procedure_add_argument (GimpProcedure *procedure,
GParamSpec *pspec);
void gimp_procedure_add_argument_from_property
(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
void gimp_procedure_add_return_value (GimpProcedure *procedure,
GParamSpec *pspec);
void gimp_procedure_add_return_value_from_property
(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
GParamSpec ** gimp_procedure_get_arguments (GimpProcedure *procedure,
gint *n_arguments);
GParamSpec ** gimp_procedure_get_return_values (GimpProcedure *procedure,
gint *n_return_values);
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
GimpValueArray * gimp_procedure_run (GimpProcedure *procedure,
GimpValueArray *args);
void gimp_procedure_extension_ready (GimpProcedure *procedure);
G_END_DECLS
#endif /* __GIMP_PROCEDURE_H__ */