Commit Graph

43816 Commits

Author SHA1 Message Date
Ell 3afdd7c5c2 app: in GimpDrawable::set_buffer(), take bounds rect instead of offset only
In GimpDrawable::set_buffer(), and the corresponding
gimp_drawable_set_buffer_full() function, take a bounds rectangle,
which specifies both the drawable's new offset and its new size,
instead of only taking the new offset.  In
gimp_drawable_real_set_buffer(), set the item size according to the
rect dimensions, instead of the buffer dimensions.  The rect's
width/height may be 0, in which case the buffer's dimensions are
used.

Adapt the rest of the code.

We do this in preparation for maintaining the drawable's bounding
box separately from its logical bounds, allowing the drawable
content to extend beyond its bounds.
2019-08-02 00:40:01 +03:00
Michael Natterer 0601b7f9a8 libgimp: add gimp_procedure_extension_ready()
which must be called by GIMP_EXTENSION procedures when they are ready
to run their temporary procedures. Move gimp_extension_ack() to
gimpobsolete.[ch].
2019-08-01 23:24:49 +02:00
Michael Natterer a841e0fb06 libgimp: add gimp_procedure_set_image_types()
and remove the "image_types" parameter from gimp_procedure_set_strings(),
which is only a bad hack copied from the core procedure class.
2019-08-01 23:09:01 +02:00
Michael Natterer e0a6eb38da libgimp: add run_data and run_data_destroy parameters to procedure_new()
so bindings work properly. Change plug-ins accordingly.
2019-08-01 22:45:49 +02:00
Jehan 71d0251d2c app: do not assume procedures always have a run mode.
This is especially true since procedures are defined by plug-ins,
possibly third-party. So they may not have a first run mode parameter.
Also we don't want plug-ins to generate CRITICALs in the core
application.
Therefore before trying to get and/or set the run mode parameter, always
check that this first parameter exists, and if so, is it a GimpRunMode
enum?

Fixes similar errors:
> GIMP-CRITICAL: gimp_value_array_index: assertion 'index < value_array->n_values' failed

Moreover it also makes sense to allow plug-ins to not have such
parameter. What if you make a plug-in which always work in a single mode
and don't ever plan/want to make it work interactively for instance?

Lastly old Python 2 plug-ins didn't even have a run mode parameter (I
guess our old Python 2 wrapper was getting rid of it?).
2019-08-01 18:27:33 +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 0cfaeb7a90 pdb: remove the section docs for the plug-in group
it was duplicated with the GimpPlugIn class section docs.
2019-08-01 16:15:27 +02:00
Jehan 67a0451ac5 libgimp: transfer ownership of @error parameter to...
... gimp_procedure_new_return_values().
When we see how this has been used in help or goat-exercise plug-ins so
far, we clearly see that we expect this function to be used as last call
in a run callback. Well we could save the result, free the error, then
return the result, but it's cumbersome.
So instead let's officially expect gimp_procedure_new_return_values() to
take ownership of the GError (i.e. it will free it in the end).
For this reason, remove the `const`.
2019-08-01 16:04:58 +02:00
Michael Natterer 254dee3b11 devel-docs: update the libgimp docs 2019-08-01 16:01:39 +02:00
Michael Natterer c9d6f93188 devel-docs: update the libgimpbase docs 2019-08-01 16:01:15 +02:00
Michael Natterer c12c031f2d pdb, libgimp*: add (out caller-allocates) to all GimpRGB* return values 2019-08-01 15:39:13 +02:00
Michael Natterer bdac38a854 libgimpwidgets: add and fix some annotations 2019-08-01 14:10:50 +02:00
Jehan ea53089545 libgimpwidgets: add a bunch of missing (transfer) annotations. 2019-08-01 13:10:39 +02:00
Michael Natterer 9926e3fd96 app: forgot to add support for GP_PARAM_DEF_TYPE_UNIT to plug-in-rc.c 2019-08-01 13:02:33 +02:00
Michael Natterer 498d478b61 libgimp: fix annotation for gimp_procedure_add_argument()
and _add_return_value(), the GParamSpecs are (transfer full).
2019-08-01 12:58:39 +02:00
Michael Natterer bbf4270437 libgimpcolor: fix "Since:" on gimp_param_spec_rgb_get_default() 2019-08-01 12:49:56 +02:00
Michael Natterer d66b845bac libgimpbase: capitalize some docs section titles 2019-08-01 12:48:41 +02:00
Michael Natterer 0ec7534607 devel-docs: update the libgimpcolor docs 2019-08-01 12:47:57 +02:00
Michael Natterer acf36738b6 devel-docs: update the libgimpbase docs 2019-08-01 12:37:32 +02:00
Michael Natterer 0ccb40f89b pdb, libgimp: hide more functions that have new API in gimplegacy.[ch]
Also reorder some functions in plug_in.pdb
2019-08-01 12:28:01 +02:00
Jehan 1627aacaa5 libgimp, libgimpbase: add some documentation for new functions.
Just for a few of them just now as I needed these for my binding plug-in
tests, and without the proper annotations, these functions were
unavailable.
2019-08-01 12:24:06 +02:00
Michael Natterer e7f041492a libgimpwidgets: fix a doc glitch in GimpStringComboBox 2019-08-01 12:23:05 +02:00
Michael Natterer 83ecbc8e39 libgimpwidgets: fix GimpScaleEntry annotations 2019-08-01 10:22:20 +02:00
Michael Natterer 1099d609af libgimpmodule: annotate one function, now warning-free 2019-08-01 10:21:47 +02:00
Jehan 3016dfb347 libgimpwidgets: add many missing (transfer) annotations. 2019-08-01 02:04:28 +02:00
Jehan 6fe2508301 libgimp*: fix various missing (transfer) annotations. 2019-08-01 01:52:07 +02:00
Jehan 8c978f4301 libgimpcolor: some more (transfer) annotations. 2019-07-31 23:55:07 +02:00
Jehan f7fbdc89b1 libgimpwidgets: add a bunch of (transfer) values. 2019-07-31 23:48:32 +02:00
Jehan ac0c3cf532 pdb: remove some formerly manually added annotations.
From the time when I was just manually editing these even in the PDB!
2019-07-31 22:56:43 +02:00
Jehan a87104fffb pdb, libgimp: fix missing colons at end of annotations. 2019-07-31 22:51:35 +02:00
Michael Natterer 05e68da4d4 pdb, libgimp: add (array length=foo) annotations for out args 2019-07-31 19:19:06 +02:00
Michael Natterer a40f139fdc pdb, libgimp: annotate input arrays with (array length=foo) 2019-07-31 19:08:01 +02:00
Michael Natterer e73916eab8 pdb, libgimp: annotate input arrays with (element-type foo) 2019-07-31 18:58:52 +02:00
Jehan 1ab62fa220 po-plug-ins, po-python: skip/add new python plug-in files. 2019-07-31 16:02:01 +02:00
Jehan 4a0f60d265 libgimp: fix GimpPlugin virtual method documentation.
The GimpPlugInClass:: prefix is important, otherwise GObject
Introspection tools don't take these docs/annotations into account (and
most methods ended up not introspected at all with annotations).

Also fix some typos/sillinesses (missing colon; useless (out) on Returns
value and useless (element-type) for easily scannable type).
2019-07-31 16:02:01 +02:00
Michael Natterer f02a218356 pdb, libgimp: add (out) annotations to everything returned via pointers 2019-07-31 13:12:46 +02:00
Michael Natterer e8c6ab7ce9 pdb: add (element-type foo) annotations to all returned arrays 2019-07-31 13:08:19 +02:00
Michael Natterer 5b6cfd9863 pdb, libgimp: generate (transfer full) annotations for libgimp
for all returned allocated memory.
2019-07-31 12:56:04 +02:00
Jehan 1291769cc7 libgimp: some fixes in GimpPlugin.
- We were leaking the result of query_procedures(). At least as far as
  the example port (help plug-in) shows, it returns a newly allocated
  array of strings, NULL-terminated. This needs to be freed by the
  calling code.
- Add documentations on GimpPlugIn virtual methods so that people know
  what to do with them, and what kind of data to return (like
  NULL-terminated array of procedure names for simple freeing).
- Fix _gimp_plug_in_init() which was registering the query procedures
  instead of the init ones. For this, I added a `init` boolean parameter
  to gimp_plug_in_register().
- Finally check the return value of gimp_plug_in_create_procedure(). It
  is possible that a plug-in not properly implemented returns NULL and
  we want to avoid the CRITICAL. Still output a warning as this is
  likely a plug-in development bug.
2019-07-31 12:51:54 +02:00
Michael Natterer cd1ba1cd17 pdb, libgimp: add proper support for multiline section comments
and move the "Gimp" section docs to the generated file.
2019-07-31 12:18:44 +02:00
Jordi Mas 076fc4ed23 Update Catalan translation 2019-07-31 11:44:03 +02:00
Jehan 32c6c2ae43 libgimp: add some annotations.
Annotations reverted by commit 0a02855a59 were not all in PDB files.
Bring back the non-PDB annotations part.
2019-07-31 11:21:55 +02:00
Jehan 826c09b629 libgimp: keep gimplegacy as introspectable, at least temporarily.
Recent commits broke the Python plug-ins again because the old API is
not introspected anymore. Of course, by release of GIMP 3, we should
probably remove this deprecated API from introspection. But first, we
have to figure out how and if the new API can be used in bindings.
2019-07-31 11:18:00 +02:00
Michael Natterer 63695b4b21 libgimbase: merge gimpparam.h into gimpparamspecs.h
which means that it's now included normally via gimpbase.h
and not any longer via gimpbasetypes.h which we only did out
of lazyness. A *lot* of files in libgimp* and app/ now need to
2019-07-31 10:16:21 +02:00
Michael Natterer 16043cec5e Revert "pdb, libgimp: append _pdb for gtk-doc SECTION names of pdb files."
This reverts commit 833666d462.

The _pdb files are an implementation detail and we do not want
separate doc sections for them, the conflicts need so be resolved in
another way.
2019-07-31 10:04:43 +02:00
Daniel Mustieles c4ff1d085a Update Spanish translation 2019-07-31 06:50:31 +00:00
Jehan a198b5a948 libgimpwidgets: fix annotation.
Fixes:
> Warning: Gimp: missing ":" at column 36:
2019-07-31 01:53:55 +02:00
Jehan 833666d462 pdb, libgimp: append _pdb for gtk-doc SECTION names of pdb files.
Otherwise we get a few duplicate sections since some of the non-PDB
files are named similarly.
Fix this GObject introspection warning and other similar warnings:

> libgimp/gimp_pdb.c:28: Warning: Gimp: multiple comment blocks
> documenting 'SECTION:gimp:' identifier (already seen at gimp.c:129).
2019-07-31 01:39:42 +02:00
Michael Natterer 8c4f73df8d app, libgimp: add copyright notices to the new stuff, minor cleanup 2019-07-31 00:13:49 +02:00
Michael Natterer 7dec3aa792 libgimp: move gimp_plugin_icon_register() to gimplegacy.[ch] 2019-07-30 23:59:13 +02:00