Commit Graph

43 Commits

Author SHA1 Message Date
Jehan 78108cc3c8 pdb: getting rid of some warnings in a perl script.
Fixing:

> Scalar value @inargs[...] better written as $inargs[...] at pdb/lib.pl line 247.
> Scalar value @outargs[...] better written as $outargs[...] at pdb/lib.pl line 386.
2023-12-08 20:58:59 +09:00
Jehan 475dafcee4 libgimp, pdb: make gimp_pdb_run_procedure_array() internal.
Apart from all regenerated PDB files, this commit fixes the few manual usages in
libgimp too.
2023-10-16 22:12:08 +02:00
Jehan 15ec254148 Issue #5946: skip gimp_*get_*() API from GObject Introspection.
The get() API are sometimes nicer in C code because it's just simpler to
loop through C arrays, but they end up with similar API to the list()
variants for binding, or with a useless size return value (since most
higher level languages have length-aware array types, which is what
GList are transformed into).

So let's use the list() variants as the main ones and skip the get()
variants. I hesitated to rename the list() variants to get() with
`(rename-to)` annotations but since I am unsure if the get() bindings
are absolutely useless, I don't think it's the best idea. Maybe on some
other language usable as GI binding, the get() variant might be
different again and nicer to use. So if we shadowed these by renaming
list() ones, the day we change our mind, we'd have to rename get() ones
too (which would be very confusing), or else break bindings' API. To
avoid this, I just skip the get() ones altogether in bindings but leave
their name available in the bindings.
2022-06-27 21:20:06 +02:00
Jehan f9cf16f46f Issue #4201: meson: pdbgen not working.
Fix the dependency by making the stamp an actual (yet empty/no-op)
header file which is included by all generated source file. This way, we
ensure that meson rebuild .o files when the .pdb sources are changed.

This is the second solution proposed by eli-schwartz here:
https://github.com/mesonbuild/meson/issues/10196#issuecomment-1080053413
2022-03-28 15:25:23 +02:00
Niels De Graef 8eb7f6df9e Remove GimpStringArray in favor of GStrv
GLib has a specific type of NULL-terminated string arrays:
`G_TYPE_STRV`, which is the `GType` of `char**` aka `GStrv`.

By using this type, we can avoid having a `GimpStringArray` which is a
bit cumbersome to use for both the C API, as well as bindings. By using
`GStrv`, we allow other languages to pass on string lists as they are
used to, while the bindings will make sure to do the right thing.

In the end, it makes the API a little bit simpler for everyone, and
reduces confusion for people who are used to working with string arrays
in other C/GLib based code (and not having 2 different types to denote
the same thing).

Related: https://gitlab.gnome.org/GNOME/gimp/-/issues/5919
2022-02-12 00:07:53 +00: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 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 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 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
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
Jehan c409829be5 libgimp, pdb: no need to create deprecated versions for private API. 2019-08-22 15:54:36 +02:00
Jehan 8c95499e14 pdb, libgimp: now make all ID types classes of their own.
No need of is_id_arg() anymore in pdb/lib.pl. Let's reuse the {id}
value. Also I had to add an additional trick for GimpDisplay which we
will now generate as such in libgimp PDB files, but still need to show
as GimpObject on app/pdb/.

As previously, only the new classes and the PDB generation for a first
step.
2019-08-22 15:54:36 +02:00
Jehan 79b319cf9d libgimp, pdb: add GimpItem > GimpDrawable > GimpLayer classes.
Only class and subclasses creation and PDB generation for this first
step.
I'll later do other types of items.
2019-08-22 15:54:36 +02:00
Jehan fec6034c7a pdb: keep both the old and new API alive.
By default the new API will be used. But if we build with
GIMP_DEPRECATED_REPLACE_NEW_API macro, then the same function names will
call the old API with ids.

This way, we don't have to update all our plug-ins at once (which I
tried and is very tedious work).

Note that bindings won't have access to the deprecated API at all.
2019-08-22 15:54:36 +02:00
Jehan 17a40b049f libgimp: generate functions both for old and new GimpImage APIs.
This way, it would still be possible to use the old API. WIP.
2019-08-22 15:54:36 +02:00
Jehan 4db8cda24e app, pdb, libgimp: add a new GimpImage class for plug-ins.
This means that all functions which were returning or taking as
parameter an image id (as gint32) are now taking a GimpImage object
instead.
The PDB is still passing around an id only over the wire. But we create
an object for plug-ins to work on.

This is quite a huge API break, but is probably the best bet for the
future quality. It will make nicer API instrospection (and nicer API in
binding), will fix the issues with pspec on GimpImageID in Python
bindings (which makes the current Python API unusable as soon as we need
to work on images, which is most of our plug-ins!), etc.
Also it will allow to use signals on images, which will be a great asset
when we will finally have bi-directionnal communications (i.e. plug-ins
would be able to connect to image changes, destructions, and whatnot).
2019-08-22 15:54:36 +02:00
Michael Natterer 30d63111c3 libgimp*, pdb: gimp_value_array_new_from_types*() takes (type, value)
So a value array can now we created like this:

array = gimp_value_array_new_from_types (&error_msg,
                                         G_TYPE_STRING, "foo",
                                         G_TYPE_INT,    23,
                                         G_TYPE_NONE);

Change PDB generation to use this, which makes for much nicer code in
the libgimp wrappers, and only set arrays separately instead of all
values.
2019-08-08 13:01:50 +02:00
Michael Natterer 6584839bf2 pdb: add "lib_private" on procedures too, to make them private
This replaces the "wrap" field on proc args and values, this belongs
to the procedure not to its args or values.
2019-08-07 19:09:00 +02:00
Michael Natterer e437e00adf pdb, libgimp: hide gimpunit_pdb.h and gimpplugin_pdb.h from the API
They only contain private functions and don't need to be installed or
included by gimp_pdb_headers.h.

The PDB generation part is done by adding a "lib_private" variable
that can be set on PDB groups which should not be public API; the rest
is manual Makefile fiddling.
2019-08-07 18:47:24 +02:00
Michael Natterer caa61eef4f libgimp, pdb: remove gimp_run_procedure_with_array() from gimp.[ch]
and add it to gimplegacy.[ch] as gimp_run_procedure_array().
Regenerate all PDB wrapper accordingly.
2019-08-06 21:44:26 +02:00
Michael Natterer c2e5374845 pdb, libgimp: make all PDB wrappers use GimpPDB to run procedures 2019-08-06 21:34:00 +02:00
Michael Natterer c8f38810d1 pdb: add gimp_procedural_db_proc_argument() and _return_value()
Which return proper GParamSpecs. Incuding some useless testing code in
gimp_procedural_db_proc_info(), to make sure things work, will go away
again soon.
2019-08-05 10:48:23 +02:00
Michael Natterer 5ac8b70e47 pdb: generate the (array length=foo) annotation with less hacks
and more important: correctly.
2019-08-04 22:24:11 +02:00
Michael Natterer 360314eda7 pdb: fix generation of "Returns:" to not line-wrap annotations
Also generate comments like "Must be freed with g_free()" for all
return values instead of manually and inconsistently having them on
some return values only.
2019-08-04 22:09:04 +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
Michael Natterer c12c031f2d pdb, libgimp*: add (out caller-allocates) to all GimpRGB* return values 2019-08-01 15:39:13 +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
Michael Natterer f02a218356 pdb, libgimp: add (out) annotations to everything returned via pointers 2019-07-31 13:12:46 +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
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
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
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 271c656e2d pdb, libgimp: fix enum type generation in the libgimp PDB wrappers
Use the actual enum type not just G_TYPE_ENUM.
2019-07-30 18:45:10 +02:00
Michael Natterer 1a8d300994 pdb: remove an obsolete snippet from lib.pl 2019-07-30 12:16:04 +02:00
Michael Natterer af5c587e21 pdb, libgimp: port lib.pl to the new GType based libgimp API
All foo_pdb.c functions in libgimp regenerated. I have reviewed this a
dozen times, but please have a look, there might well be glitches and
our public API is sortof important...
2019-07-30 10:51:16 +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
luz.paz 147c09f19e Bug 795161 - Misc. typo fixes in source comments and doxygen
Found via `codespell`
Follow-up to  commit 7fdb963e01
2018-04-18 21:06:57 +02:00
Michael Natterer ef3edece9b pdb: improve docs of deprecated functions
Don't unconditionally overwrite all the proc's description, author
etc.  Instead, try to preserve them and append the "Deprecated" notes
to the help texts and generated comments.

Only affects one procedure because we killed the meta info of all
other deprecated procs so far, but now we don't have to do that any
longer.
2018-04-15 16:06:00 +02:00
Michael Natterer b05cfc6050 pdb: (try 3) move PDB generation and sources to toplevel/pdb
It never belonged inside "tools". Also rename its "pdb" subdirectory
to "groups". This had to happen before 2.10 so cherry-picking between
branches doesn't become a nightmare in the future.
2017-12-17 14:16:08 -05:00