Commit Graph

84 Commits

Author SHA1 Message Date
Michael Natterer 1c7028aaaa app, libgimp: add boolean "export-comment" gimprc property
export it to libgimp via GPConfig and add new API gimp_export_comment().
Bump the protocol version and improve variable names in both GPConfig
and libgimp/gimp.c.
2019-10-10 00:48:28 +02:00
Ell 5cc289b642 libgimpbase, libgimp, app: inherit swap-compression in plug-ins
Pass the swap-compression option set in the preferences down to
plug-ins, so that they use the same swap-compression algorithm as
the main app.
2019-09-22 18:05:24 +03:00
Michael Natterer a5ac3e45fe libgimpbase, libgimp, app: add libgimp support for passing GFiles
Which means support for GParamSpecObject with value_type ==
G_TYPE_FILE, and converting between GFile and its URI for wire
communication directly above the protocol layer.

This change requires passing a GParamSpec's value type as generic
member of GPParamDef, which in turn makes some members of its
sub-structures obsolete.
2019-09-11 21:40:17 +02:00
Michael Natterer 41fa670434 Rename all "nparams" and "nreturn_vals" members in the wire protocol
to "n_params" and "n_return_vals".
2019-09-09 01:00:54 +02:00
Michael Natterer 22a780c9d1 pdb: add gimp_pdb_set_proc_documentation() and _attribution()
and all the needed code in libgimp/ and app/ to set them on a
procedure using the new API. Remove the strings from GPProcInstall.
2019-09-09 00:36:24 +02:00
Michael Natterer 453b4f4aa2 pdb: add gimp_pdb_set_proc_menu_label()
and all the needed code in libgimp/ and app/ to set a plug-in
procedure's menu label using the new API. Remove the menu label from
GPProcInstall.
2019-09-08 17:30:54 +02:00
Michael Natterer 2a62287439 pdb: add gimp_pdb_set_proc_image_types()
and all the needed code in libgimp/ and app/ to set a plug-in
procedure's image types using the new API. Remove the image types from
GPProcInstall.
2019-09-08 16:54:08 +02:00
Michael Natterer 85591eb799 libgimpbase: add support for arrays of object IDs to gimpprotocol 2019-09-05 13:01:00 +02:00
Michael Natterer 7201d48231 Get rid of capitalized "ID" in function and variable names
and use "id" instead.
2019-08-23 22:23:23 +02:00
Michael Natterer d62e75a41f Move GimpParamSpecString from libgimp back to app
It's just too weird to be public. Remove its properties from the wire
protocol and from pluginrc. Instead, have all GParamSpecs' flags on
the wire and in pluginrc, so we can use stuff like
GIMP_PARAM_NO_VALIDATE.

Port the remaining few places to GIMP_PROC_ARG_STRING().

I'm sure something is broken now wrt UTF-8 validation,
will add tighter checks in the next commit.
2019-08-19 12:54:52 +02:00
Michael Natterer 299d657ff1 libgimpbase: change gimpprotocol GPParamDefInt's members to gint64
so the full range of any unsigned int param spec's values fits.
2019-08-10 16:25:22 +02:00
Michael Natterer d156028c8a libgimp*, app: add the help-id to the wire protocol
Pass the help-id specified by the procedure to the core, and use it in
the core if set instead of always using the procedure's name (which
was probably good enough for all eternity, but it's still more
consistent this way).
2019-08-08 09:57:56 +02:00
Michael Natterer 7764f8b34b libgimpbase: add support for GParamParam in GPParamDef too
to describe param specs that describe param specs, yay.
2019-08-05 14:12:19 +02:00
Michael Natterer aa505b43dc app, libgimp*: add protocol support for GValues holding a GParamSpec
so we can have PDB introspection procedures for the new plug-in API.
2019-08-05 09:07:45 +02:00
Michael Natterer 888c42fbb8 libgimpbase: remove the gimp protocol mutex and gp_lock()/gp_unlock()
The protocol is supposed to be used recursively, the locks just
deadlock in some situations. Threaded use of the wire protocol is
simply forbidden.
2019-08-04 22:42:15 +02:00
Michael Natterer ed86de48d2 app, libgimpbase: s/author/authors/ here too 2019-08-02 01:39:09 +02:00
Jehan c059839e78 libgimpbase: use g_try_new0() when allocating the parameters.
Basically the number of parameters comes from plug-ins which could write
whatever crap on the wire. I had a case (playing with Python plug-ins)
where GIMP tried to allocate insane amount of parameters. This is bad
as it allows third-party plug-ins to crash GIMP core.

Instead only *try* to allocate, then return as though there were no
parameters if allocation fails. I also print some info on stderr, but
don't output WARNING/CRITICAL (this is not a core error, but a plug-in
error). Fixes:

> GLib-ERROR **: 16:30:23.357: gmem.c:135: failed to allocate 187186442160 bytes
2019-08-01 18:09:14 +02:00
Michael Natterer e36028d2ac app, libgimp, libgimpbase: forgot to support GIMP_TYPE_UNIT on the wire
This commit can serve as an example how to add new types to
GimpProtocol, note that zero public API changes.
2019-07-30 15:04:06 +02:00
Michael Natterer 0a6f157d58 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 12:22:58 +02:00
Michael Natterer 624d091887 libgimpbase: use _gimp_write_read_color() and _write_color()
instead of dealing with the 4 doubles manually.
2019-07-28 18:00:42 +02:00
Michael Natterer 32ea28b6b1 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-28 17:34:40 +02:00
Ell c288b28ac8 libgimpbase, libgimp, app: pass misc. GEGL config to plug-ins
Pass the GEGL tile-cache size, swap path, and thread-count to plug-
ins as part of their config, and have libgimp set the plug-in's
GeglConfig accordingly upon initialization.
2018-11-19 17:03:15 -05:00
Ell 9afa42ab91 libgimpbase: don't leak GPConfig::icon_theme_dir 2018-11-19 16:51:23 -05:00
Michael Natterer 03feba0f35 libgimpbase, app: remove the plug-in menu_path compat code
Registering a full menu path as a procedure's menu label is now
forbidden and causes the procedure to be rejected.

Bump the plug-in protocol version so a pluginrc containing such cruft
is not used.
2018-07-13 14:07:44 +02:00
Michael Natterer 5f700549e7 Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
Michael Natterer 8c9c091021 Issue #701 - Add the ability to embed the GIMP built-in sRGB profile...
...upon exporting an image

Step 1: make it configurable just like "Export EXIF" etc.

app, libgimp: add "export-color-profile" config option

Add it to the preferences dialog, and pass it on to plug-ins in the
GPConfig message. Add gimp_export_color_profile() to libgimp.

Nothing uses this yet.
2018-06-18 02:19:41 +02:00
Michael Natterer b36205176e app, libgimp*: remove the config option to disable tooltips
Also remove all traces of it from the plug-in protocol and raise the
protocol version to 0x0100 (we now allow features and therefore
version bumps in stable, and the master protocol version should always
be higher). Fix the code that aborts plug-in startup on protocol
version mismatch, we can't use gimp_message() because we have no
protocol.
2018-06-06 19:23:30 +02:00
Ell 97925de8eb libgimpbase, libgimp, app: pass icon theme dir to plug-ins through config
Pass the current icon theme directory to plug-ins through the
config message, and add a gimp_icon_theme_dir() libgimp function
for retrieving it.  Note that we already have a similar
gimp_icon_get_theme_dir() PDB function, which we keep around, since
it can be used to dynamically query for the current icon dir,
unlike the former, and since it returns a dynamically-allocated
string, while the rest of the config-related functions return
statically allocated strings.

Use the new function, instead of gimp_get_icon_theme_dir(), in
gimp_ui_init().  This allows gimp_ui_init() to run without making
any PDB calls.  Consequently, this allows us to start plug-ins that
call gimp_ui_init() without entering the main loop in the main app.
We're going to add a plug-in that displays an interactive dialog
while the main app is blocking waiting for an operation to
complete, and we need to be able to start the plug-in without
entering the main loop, to avoid the possibility of arbitrary code
being executed during the wait.

Bump the protocol version.
2018-05-29 16:04:28 -04:00
Michael Natterer 7549b6efe4 Bug 794132 - Make the plug-in protocol version part of the plug-in command line
Also clean GPConfig struct from deprecated members and bump the
plug-in protocol version number.
2018-05-20 21:06:30 +02:00
Jehan 4c4fa84f85 app, libgimp, libgimpbase: new gimp_export_(exif|xmp|iptc)() functions.
These allows plug-ins to know the preferences regarding metadata.
2018-01-11 22:17:32 +01:00
Jehan 15f7344038 libgimp, libgimpbase: allow multi-threaded plugins by locking...
...protocol calls.
Some calls are waiting for answers, for instance plugin procedures, and
tiles which expects data and acknoledgement.
This would result in error messages such as:
"expected tile ack and received: 5" (5 is GP_PROC_RUN)
Typically because a thread would run a procedure while another would
receive tiles.
2017-08-16 12:09:56 +02:00
Jehan 7999cfbeef libgimp*: tab cleaning. 2017-06-17 11:38:18 +02:00
Michael Natterer 57da340f78 app, libgimp: pass "use-opencl" to plug-ins
and configure Gegl on the plug-in side accordingly. This bumps
the GIMP protocol version.
2014-02-25 21:25:40 +01:00
Michael Natterer 0a5059da51 Bug 685445 - color-to-alpha plugin crashes (use-after-free)
gimp_tile_put(): make sure we don't free libgimp's tile data twice in
the non-SHM case. I could never reproduce the bug, but I'm pretty sure
this fixes it. The change in gimpprotocol.c is just cleanup.
2012-10-22 19:03:00 +02:00
Michael Natterer 2d6f808ff8 pdb: add a new PDB group "item" and move lots of functions to it
The item groups has all the duplicated functionality from drawable
and vectors (name, visible, linked etc).

Hijack the unused GIMP_PDB_REGION and turn it into GIMP_PDB_ITEM;
change all protocol aware files accordingly and bump the protocol
version number. Change script-fu to handle the new type.
2010-07-09 09:34:44 +02:00
Michael Natterer d9b5207aa2 Change licence to GPLv3 (and to LGPLv3 for libgimp).
2009-01-17  Michael Natterer  <mitch@gimp.org>

	* all files with a GPL header and all COPYING files:

	Change licence to GPLv3 (and to LGPLv3 for libgimp).

	Cleaned up some copyright headers and regenerated the parsers in
	the ImageMap plugin.


svn path=/trunk/; revision=27913
2009-01-17 22:28:01 +00:00
Sven Neumann 81131c0bb4 Add new PDB data type PDB_COLORARRAY for using arrays of GimpRGB colors as
2008-07-14  Sven Neumann  <sven@gimp.org>

	Add new PDB data type PDB_COLORARRAY for using arrays of GimpRGB
	colors as argument or return value.

	* libgimpbase/gimpbaseenums.[ch] (enum GimpPDBArgType): replaced
	the unused GIMP_PDB_BOUNDARY with GIMP_PDB_COLORARRAY.

	* libgimpbase/gimpprotocol.h: increased GIMP_PROTOCOL_VERSION.
	(struct _GPParam): added d_colorarray entry to the union.

	* libgimpbase/gimpprotocol.c
	* libgimp/gimp.[ch]
	* app/pdb/gimp-pdb-compat.c
	* app/plug-in/plug-in-params.c
	* app/plug-in/gimpplugin-message.c
	* tools/pdbgen/pdb.pl: deal with the new data type.

	* tools/pdbgen/enums.pl: regenerated.

	* plug-ins/pygimp/pygimp-pdb.c
	* plug-ins/script-fu/scheme-wrapper.c: handle the new data type.


svn path=/trunk/; revision=26189
2008-07-14 14:09:16 +00:00
Sven Neumann 26d1021e77 Properly pass the focus from the core to plug-in dialogs:
2008-03-27  Sven Neumann  <sven@gimp.org>

	Properly pass the focus from the core to plug-in dialogs:

	* libgimpbase/gimpprotocol.[ch]: added a user_time member to the
	GimpConfig struct. Bumped the protocol version to 0x0012.

	* app/core/gimp-gui.[ch]
	* app/gui/gui-vtable.c: added gimp_get_user_time() to get the
	timestamp of the last user interaction.

	* app/plug-in/gimppluginmanager-call.c
	(gimp_plug_in_manager_call_run): pass the timestamp to in the
	GimpConfig message.

	* libgimp/gimp.[ch]:
	* libgimp/gimp.def: added method to access the timestamp as set
	in the config message.

	* libgimp/gimpui.c (gimp_ui_init): construct a fake startup ID and
	set the DESKTOP_STARTUP_ID environment variable.

svn path=/trunk/; revision=25263
2008-03-27 16:30:29 +00:00
Sven Neumann cc44a68902 made the code more robust against errors on the wire protocol level.
2007-12-11  Sven Neumann  <sven@gimp.org>

	* libgimpbase/gimpprotocol.c: made the code more robust against
	errors on the wire protocol level.

	* app/plug-in/gimpplugin-message.c: added sanity checks to message
	handlers. This doesn't keep us from crashing on invalid input, but
	we will at least get some warnings before that happens.

svn path=/trunk/; revision=24317
2007-12-11 09:40:10 +00:00
Sven Neumann 4d77d9a2d1 plugged memory leaks.
2007-09-28  Sven Neumann  <sven@gimp.org>

	* plug-ins/script-fu/scheme-wrapper.c: plugged memory leaks.

	* libgimpbase/gimpprotocol.c (gp_params_destroy): formatting.

svn path=/trunk/; revision=23683
2007-09-28 14:20:35 +00:00
Sven Neumann 203930da11 allocate structs using GSlice.
2007-05-22  Sven Neumann  <sven@gimp.org>

	* libgimpbase/gimpprotocol.c: allocate structs using GSlice.

	* libgimpmodule/gimpmodule.c: allocate GimpModuleInfo using GSlice.

svn path=/trunk/; revision=22564
2007-05-22 13:09:56 +00:00
Sven Neumann fb095cf281 don't redefine the GimpParasite struct, just use it.
2007-04-12  Sven Neumann  <sven@gimp.org>

	* libgimpbase/gimpprotocol.[ch] (struct _GPParam): don't redefine
	the GimpParasite struct, just use it.

	* libgimp/gimp.c: include gimpparasite.h.

	* libgimp/gimpitemcombobox.c (gimp_item_combo_box_new): initialize
	combo_box_type to suppress a compiler warning.

	* libgimpwidgets/gimpmemsizeentry.c (gimp_memsize_entry_new):
	avoid dereferencing a type-punned pointer.


svn path=/trunk/; revision=22237
2007-04-12 14:32:44 +00:00
Manish Singh f1e54be89d app/plug-in/plug-in-params.c libgimp/gimp.[ch]
2006-06-25  Manish Singh  <yosh@gimp.org>

        * app/plug-in/plug-in-params.c
        * libgimp/gimp.[ch]
        * libgimpbase/gimpprotocol.[ch]
        * plug-ins/common/colormap-remap.c
        * plug-ins/common/curve_bend.c
        * plug-ins/common/grid.c
        * plug-ins/pygimp/pygimp-pdb.c
        * plug-ins/script-fu/siod-wrapper.c
        * tools/pdbgen/pdb.pl: turn d_int8 and d_int8array into guint8.
        Fixes bug #344431.
2006-06-25 23:30:15 +00:00
Sven Neumann 6c25ae9374 Added basic framework for plug-ins to access the use_cpu_accel
2006-06-01  Sven Neumann  <sven@gimp.org>

	Added basic framework for plug-ins to access the use_cpu_accel
	configuration (bug #342860):

	* app/composite/gimp-composite.[ch]: added new function
	gimp_composite_use_cpu_accel().

	* libgimpbase/gimpprotocol.[ch]: added use_cpu_accel to the config
	message.

	* app/plug-in/gimppluginmanager-call.c: pass the return value of
	gimp_composite_use_cpu_accel() for config.use_cpu_accel.

	* libgimp/gimp.[ch]: make the config value accessible by means of
	a new function gimp_use_cpu_accel().

	* libgimp/gimp.def: updated.
2006-06-01 15:34:58 +00:00
Sven Neumann f2df31a50e converted tabs to spaces.
2006-04-12  Sven Neumann  <sven@gimp.org>

	* libgimp*/gimp*.[ch]: converted tabs to spaces.
2006-04-12 10:53:28 +00:00
Sven Neumann 872d9506e5 factored out some code to a utility function.
2006-03-10  Sven Neumann  <ven@gimp.org>

	* app/widgets/gimpaction.c: factored out some code to a utility
	function.

	* app/config/gimpguiconfig.[ch]
	* app/config/gimprc-blurbs.h
	* app/dialogs/preferences-dialog.c
	* app/gui/gui.c
	* app/plug-in/plug-in-run.c
	* libgimp/gimp.c
	* libgimpbase/gimpprotocol.[ch]: renamed tool_tips to tooltips in
	variables and in the gimprc.

	* app/config/gimpbaseconfig.[ch]: removed stingy_memory_use from
	the GimpBaseConfig struct.
2006-03-10 16:40:09 +00:00
Sven Neumann 3343baa84c added utility functions to send GimpRGB values over the wire.
2006-02-23  Sven Neumann  <sven@gimp.org>

	* libgimpbase/gimpwire.[ch]: added utility functions to send
	GimpRGB values over the wire.

	* libgimpbase/gimpprotocol.c: use the functions.
2006-02-23 13:53:32 +00:00
Michael Natterer a0d231b33c renamed GIMP_PDB_PATH to GIMP_PDB_VECTORS and add the former as an alias
2005-12-29  Michael Natterer  <mitch@gimp.org>

	* libgimpbase/gimpbaseenums.[ch] (enum GimpPDBArgType): renamed
	GIMP_PDB_PATH to GIMP_PDB_VECTORS and add the former as an alias
	for the latter.

	* libgimp/gimp.h (union _GimpParamData): added back d_path member
	to maintian source compatibility.

	* tools/pdbgen/pdb.pl
	* libgimp/gimp.c
	* app/pdb/procedural_db.c
	* app/plug-in/plug-in-params.c
	* libgimpbase/gimpprotocol.[ch]
	* plug-ins/pygimp/pygimp-pdb.c
	* plug-ins/script-fu/siod-wrapper.c: s/GIMP_PDB_PATH/GIMP_PDB_VECTORS/

	* app/pdb/image_cmds.c
	* app/pdb/procedural_db_cmds.c
	* app/pdb/vectors_cmds.c
	* libgimp/gimpimage_pdb.c
	* libgimp/gimpvectors_pdb.c
	* tools/pdbgen/enums.pl: regenerated.
2005-12-29 01:07:02 +00:00
Sven Neumann 4ec5642b50 declare gp_params_destroy() in the private header file.
2005-12-14  Sven Neumann  <sven@gimp.org>

	* libgimpbase/gimpprotocol.[ch]: declare gp_params_destroy() in
	the private header file.

	* libgimp/gimp.c (gimp_destroy_params): removed extern declaration.
2005-12-14 13:19:18 +00:00
Sven Neumann 4467e1cd4b let the private wire methods live in the GIMP namespace. Declare internal
2005-12-13  Sven Neumann  <sven@gimp.org>

        * libgimpbase/gimpwire.[ch]: let the private wire methods live in
        the GIMP namespace. Declare internal functions as such and prefix
        them with an underscore.

        * libgimp/gimp.c
        * libgimp/gimptile.c
        * libgimpbase/gimpbase.def
        * libgimpbase/gimpprotocol.c
        * app/plug-in/plug-in-message.[ch]
        * app/plug-in/plug-in-run.c
        * app/plug-in/plug-in.c: changed accordingly.
2005-12-13 14:11:56 +00:00