Commit Graph

2286 Commits

Author SHA1 Message Date
Michael Natterer 34f848bb69 libgimp: actually unref the global GimpPDB and GimpPlugIn instances
in gimp_close().
2019-09-05 13:01:00 +02:00
Michael Natterer 747fce7260 libgimp: gimp_plug_in_destroy_proxies() never checked for too much refs
because we were simply destroying the proxy hashes when the last
procedure is done. Now we run gimp_plug_in_destroy_proxies() with the
right flag from gimp_plug_in_pop_procedure() before destroying the
hashes and get the proper debug warnings.
2019-09-05 13:01:00 +02:00
Michael Natterer 7d3427e91d libgimp: gimp_pdb_run_procedure_array() was leaking proc_run.params 2019-09-05 13:01:00 +02:00
Michael Natterer b4f698e78c libgimp: add object array convenience macros to gimpprocedure-params.h 2019-09-05 13:01:00 +02:00
Michael Natterer 56772d4f4d libgimp: add support for object arrays to gimpgpparams-body.c 2019-09-05 13:01:00 +02:00
Michael Natterer 7019eaa56b app, libgimp: share the code of libgimp/gimpparamspecs.c with app/
move the code to gimpparamspecs-body.c and include it from both app/
and libgimp/. They are the same apart from a minor difference which we

Also share the entire libgimp/gimpparamspecs.h header with the core.
2019-09-04 16:48:26 +02:00
Michael Natterer 18bdf52a0b libgimp: remove redundant validation code from gimpparamspecs.c
No GimpParamSpecItem subclass needs its own validate function,
checking against pspec->value_type and gimp_item_is_vaid() in
gimp_param_item_validate() is good enough, no item ID can change its
type during the lifetime of the proxy.
2019-09-04 16:34:24 +02:00
Michael Natterer b92dd2c8e3 app: split GimpDisplay in two classes: GimpDisplay and GimpDisplayImpl
GimpDisplay contains only the ID logic and the "gimp" and "config"
pointers, and lives in the core.

GimpDisplayImpl is a subclass and contains all the actual display
stuff. The subclass is only an implementation detail and doesn't
appear in any API.

Remove all hacks which pass displays as gpointer, GObject or
GimpObject through the core, or even lookup its type by name,
just use GimpDisplay.
2019-09-04 14:30:43 +02:00
Michael Natterer b3b3d8160c app, libgimp: don't duplicate _gimp_gp_param_def_to_param_spec()
they are virtually the same now (except GimpParamEnum, but that one is
still the same because its special feature doesn't go over the wire).
2019-09-04 10:41:19 +02:00
Michael Natterer 5e00decc13 pdb, libgimp: use GIMP_VALUES_GET,DUP_FOO() in the libgimp PDB wrappers 2019-09-04 02:49:33 +02:00
Michael Natterer c6082b37f8 libgimp: add missing stuff to gimpprocedure-params.h
Add some accessors, and the complete set of macros for GimpParasite
and GParamSpec.
2019-09-04 02:39:02 +02:00
Michael Natterer 90f9d551dc pdb, libgimp: use GIMP_VALLUES_GET_ENUM() in libgimp PDB wrappers
to get the procedure's return status.
2019-09-04 01:49:35 +02:00
Michael Natterer feaf96735f pdb: don't return any strings from _gimp_pdb_proc_info()
and instead add _gimp_pdb_proc_documentation() and
_gimp_pdb_proc_attribution().

Remove the gimp_pdb_proc_info() utility function in app/.
2019-09-04 01:38:31 +02:00
Michael Natterer a351ce9126 Remove the entire old plug-in interface 2019-09-04 00:03:12 +02:00
Jehan 71ccaa21ee pdb, libgimp: remove double API generation from PDB.
All plug-ins got ported. Let's remove support for the old API with IDs
instead of objects.
2019-09-03 13:31:27 +02:00
Michael Natterer 80340f2d47 libgimp: remove the last manual compat wrappers 2019-09-03 12:04:05 +02:00
Michael Natterer 9e771d8cd5 libgimp: remove more deprecated API 2019-09-03 11:10:43 +02:00
Michael Natterer 660ad6c41a libgimp: use the new get_by_id() functions
except in code that is about to go away.
2019-09-03 10:57:41 +02:00
Michael Natterer fd5740e70b libgimp: add gimp_layer,chanel,vectors,etc,_get_by_id()
which call gimp_item_get_by_id() and additionally check if the
returned item has the right type, and return NULL if not.

This is both shorter and more readable than

layer = GIMP_LAYER (gimp_item_get_by_id (id));

and additionally makes sure we don't cast e.g. a non-layer with
GIMP_LAYER(), which will give criticals but shouldn't, because the
wrong IDs can come from anywhere and are an input problem and not a
programming error (criticals are for programming errors).
2019-09-03 10:24:24 +02:00
Michael Natterer 86a99a942f libgimp: GimpProcedure args and return values must have have unique
and canonical names now.
2019-09-02 18:53:30 +02:00
Jehan 650d4b57ed libgimp: add a doc comment to gimp_drawable_get_sub_thumbnail_data().
This was added in commit e24375e64a together with "Since:" annotation
updates, which got reverted. Add back just the documentation comment.
2019-09-02 11:47:01 +02:00
Michael Natterer bba67bf6cc libgimp: don't request tiles beyond the drawable extents
GEGL handles read/write outside of existing buffers gracefully, so
should GimpTileBackendPlugin.
2019-08-31 16:44:10 +02:00
Michael Natterer d67eb6f438 libgimp: remove all deprecated stuff from gimpimage.[ch] 2019-08-31 12:10:06 +02:00
Michael Natterer a66945342d libgimp: remove some old API that is no longer needed 2019-08-30 18:58:16 +02:00
Michael Natterer 2fd35e77b5 Revert "libgimp: API with new object classes are since 3.0."
This reverts commit e24375e64a.

The API is semantically the same, and there is no danger of confusion,
no need to update the Since: tags.
2019-08-30 18:44:56 +02:00
Michael Natterer 02e27bdbc3 libgimp: fix gimp_item_combo_box_changed()
only checking positive IDs for validity had a purpose, put it back.
2019-08-30 17:58:18 +02:00
Jehan e24375e64a libgimp: API with new object classes are since 3.0.
Even when the function names may have stayed the same in most cases, the
API has changed. The "Since:" tag must therefore be bumped.

Also adding docs for gimp_drawable_get_sub_thumbnail_data() which had
none.
2019-08-30 16:42:08 +02:00
Michael Natterer 4364b78446 libgimp: remove the GIMP_DISABLE_COMPAT_CRUFT define
there is no legacy API left a ported plug-in could accidentially use.
2019-08-30 13:00:00 +02:00
Michael Natterer 8a78203aed Properly prefix the values of enum GimpPDBProcType
to be GIMP_PDB_PROC_TYPE_PLUGIN, _EXTENSION etc.
2019-08-30 12:52:28 +02:00
Jehan 2a640713e7 libgimp: fix GIMP_VALUES_(SET|TAKE)_*_ARRAY() macros.
A length argument is required by corresponding gimp_value_set_*_array()
functions.
2019-08-30 00:45:08 +02:00
Jehan bb0321fe5d libgimp: allow GObject plug-in parameters for known libgimp classes.
Basically creating a GParamSpecObject with type GimpImage would be
synonym to creating a GimpParamSpecImage (and similarly for items,
drawables, layers, and so on).
The only missing feature is therefore none_ok when using
GParamSpecObject (or to be more accurate: it implies none_ok=TRUE).

This is particularly needed for the Python API where a bug prevents to
manipulate GParamSpec types and pass them back to libgimp. Hence we want
to manipulate object specs using the binding specific API instead.

It used to work fine but this specific piece of code got removed by
commit 392f00baf5. This now works again fine.
2019-08-29 23:48:10 +02:00
Jehan 21a87d2b78 libgimp: too many arguments to g_error_new(). 2019-08-29 22:05:13 +02:00
Michael Natterer 37897b13fe libgimp: fix legacy plug-ins, which I broke with the big ID removal
- hand out and leak proxy object objects to legacy API like candy,
  bypassing the factory in GimpPlugIn, because there is no plug-in
  singleton.

- gimpgpcompat.c: image, item etc. are now objects, simply forgot this
  file.
2019-08-29 18:36:59 +02:00
Michael Natterer 33601f7a87 libgimp: argh, broke most plug-ins...
Need to push the current procedure around the entire body of
gimp_plug_in_proc_run_internal() because
_gimp_gp_params_to_value_array() needs access to proxy objects now.
2019-08-29 13:48:16 +02:00
Michael Natterer e9b4b7fa0d libgimp: update .gitignore 2019-08-29 12:08:24 +02:00
Michael Natterer 392f00baf5 app, libgimp: get rid of all ID GTypes and ID param specs
Turn all ID param specs into object param specs (e.g. GimpParamImageID
becomes GimpParamImage) and convert between IDs and objects in
gimpgpparams.c directly above the the wire protocol, so all of app/,
libgimp/ and plug-ins/ can deal directly with objects down to the
lowest level and not care about IDs.

Use the actual object param specs for procedure arguments and return
values again instead of a plain g_param_spec_object() and bring back
the none_ok parameter.

This implies changing the PDB type checking functions to work on pure
integers instead of IDs (one can't check whether object creation is
possible if performing that check requires the object to already
exist).

For example gimp_foo_is_valid() becomes gimp_foo_id_is_valid() and is
not involved in automatic object creation magic at the protocol
level. Added wrappers which still say gimp_foo_is_valid() and take the
respective objects.

Adapted all code, and it all becomes nicer and less convoluted, even
the generated PDB wrappers in app/ and libgimp/.
2019-08-29 11:39:34 +02:00
Michael Natterer f6a97c178c libgimp: remove gimp_layer_new_from_surface_deprecated() 2019-08-28 03:15:08 +02:00
Michael Natterer 91d9e4d08f libgimp: remove deprecated metadata functions 2019-08-27 18:41:22 +02:00
Michael Natterer fb9b315fd4 libgimp: fix type names: s/FooParamSpecString/FooParamString/ 2019-08-27 18:08:58 +02:00
Michael Natterer eb311be120 libgimp: add some debug code to warn about broken proxy handling
Add an additional ref count to all proxies handed out by
GimpPlugIn, and when destroying the proxies, warn about any
proxy that has been unrefed, or additionally refed.

This catches and warns about only one broken unref, any more will
simply crash like before.
2019-08-27 17:24:56 +02:00
Michael Natterer f57725a96a libgimp: add instance-private struct to all new objects
Just in case we need it later.
2019-08-27 16:47:17 +02:00
Michael Natterer 96c1f754ba libgimp: remove a ton of deprecated API that is unused 2019-08-27 16:32:25 +02:00
Michael Natterer 96ac0d0802 libgimp: remove the remining file procedure register API 2019-08-27 15:29:56 +02:00
Jehan e1e048a823 Issue #3852: Error compilation gimpimagecombobox MSYS2.
Seems underscored APIs are not visible on Win32. Anyway even if we fixed
this, this would only be temporary as all these deprecated APIs are only
meant to stay around temporarily, then be actually unavailable.

I hesitated to actually undeprecate the `_gimp_*_is_valid()` (like
making a `gimp_image_is_valid_id()` API for instance) but this is
actually quite similar to just create the GimpImage: if
gimp_image_get_by_id() returns NULL, then the ID was not valid.
2019-08-27 15:24:33 +02:00
Jehan 7963462429 libgimp: clean up some warnings when building with MSYS 64bit.
See #3852.
Fixes:
> warning: 'n_return_vals' may be used uninitialized in this function
> warning: 'n_args' may be used uninitialized in this function
2019-08-27 15:02:21 +02:00
Michael Natterer 2599d79292 libgimp: remove gimp_register_magic_load_handler() 2019-08-27 14:48:08 +02:00
Michael Natterer 0b3e02be10 libgimp: again, redo all APIs returning list of images, items, children
We now have both variants, one returning a GList, and another
returning an array. Turns out that while a list is often nicer,
sometimes a random-access array really keeps the code much simpler.

Adapt all plug-ins, and clean up a bit (like use g_list_reverse() once
instead of iterating the list reversed).
2019-08-27 13:26:27 +02:00
Jehan 24af759483 pdb: update a bunch of docs where s/-1/%NULL/
Also add a none_ok on gimp_text_fontname() outarg since it is clearly
noted as being able to return no layer with invalid parameters.
2019-08-25 12:01:41 +02:00
Jehan ac1c0ae3ce libgimp, pdb: annotate arguments with none_ok as (nullable).
Same for returned value though it seems we have no function with none_ok
as return value. At least we have the rule in the generation script for
when this will happen.
2019-08-25 12:01:41 +02:00
Michael Natterer 16abb690fd libgimp: remove gimp_register_file_handler_remote() 2019-08-24 17:07:19 +02:00