Commit Graph

52 Commits

Author SHA1 Message Date
Michael Natterer c8bf85cc54 pdb: item.pdb: '3,0' is not a version, it's '3.0' 2019-10-27 18:56:53 +01:00
Michael Natterer 46608393c3 pdb, libgimp: add a HORRIBLE hack to make sure objects arrays don't leak
In the generated libgimp wrappers, we can't return object arrays
from a call to GIMP_VALUES_DUP_OBJECT_ARRAY() because it returns
a deep copy and adds a reference to all objects, which the caller
would have to unref.

But we want a shallow (transfer container) copy because we don't want
libgimp proxy objects to be refed or unrefed by any user code.

Therefore, add a HACK that simply memdup()s and returns the
GimpObjectArray's array memory, and leaves the contained object
pointers alone.
2019-09-05 15:03:14 +02:00
Michael Natterer f764fd0f82 pdb, libgimp: change all generated ID array return values to object arrays
and remove the manual libgimp wrappers which now have the same
signature as the generated functions.
2019-09-05 13:01:00 +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 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 08849a584c libgimp: GimpItem now also belong to libgimp. 2019-08-22 15:54:36 +02:00
Jehan cfd30ec62a libgimp: s/gimp_image_new_by_id()/gimp_image_get_by_id()/
This means that images' ownership is not given to caller in particular.
libgimp will now keep a reference of all GimpImage-s it creates and
return this same reference if called again. It also means that you can
now compare images by pointer comparison (as 2 GimpImage objects
representing the same image ID will be equal).
Obviously as a side effect, gimp_image_list() is changed to (transfer
container) as you must only free the container now, not the elements.
Also various other functions creating new images are now (transfer none)
too.

Long-time plug-ins will have to be taken in consideration in a further
step (we currently never free GimpImage for destroyed images in
particular).
2019-08-22 15:54:36 +02:00
Jehan 75f8a3804d libgimp: nicer API for functions returning a list.
I.e.: gimp_image_get_(layers|channels|vectors)(), gimp_image_list() and
gimp_item_get_children().
Instead of returning an array of IDs, these will now return a GList with
the right objects ready to use.
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 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 688c3230d0 libgimp: create and use gimp_image_new_by_id().
Simpler than using g_object_new() in a bunch of places.
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 449e84c108 pdb: use guint for tatoo, guide, sample point, which they are
and initialize GimpUnit with PIXEL instead of just 0.
2019-08-15 16:41:39 +02:00
Michael Natterer 5a09523214 Remove GIMP_TYPE_INT32 and GimpParamSpecInt32
Use gint and GParamSpecInt instead.
2019-08-15 14:04:56 +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 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 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
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 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
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 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
Ell 4db000a522 pdb, libgimp: add gimp-item-{get,set}-expanded()
... which call gimp_viewable_{get,set}_expanded()
2017-10-22 12:30:21 -04:00
Hartmut Kuhse 66bc98d299 Revert "New GimpMetadata as subclass of GExiv2Metadata"
This reverts commit 3ab08c8bfd.
2017-01-03 19:36:22 +01:00
Hartmut Kuhse 3ab08c8bfd New GimpMetadata as subclass of GExiv2Metadata 2017-01-03 19:26:35 +01:00
Michael Natterer 31fcd79dd9 Bug 769738 - Add color tags/labels for layers/channels/paths
Add property "color-tag" of type enum GimpColorTag to GimpItem so all
layers, channels and paths can be tagged with a color.

For interoperability, use the color list from Krita which is a
superset of Photoshop's colors.

Features a "Color Tag" submenu in the layers, channels and paths
menus, a row of color radio buttons in the properties dialogs,
undo and PDB API.

As a side effect, some common code is now factores out into
items-actions.[ch] and items-commands.[ch] which adds visible, linked
and lock actions for layers and channels.
2016-10-29 17:02:16 +02:00
Michael Natterer 02d1192753 pdb: return NULL for string arrays with zero elements
In e61b1f76 things were changed to return string arrays that can be
freed with g_strfreev(), but that returned a one-element array
containing a NULL pointer for zero-length arrays. Fix the code
to return NULL again for zero-length arrays. See bug #751584.
2015-09-14 01:12:57 +02:00
Michael Natterer 8005eea835 Remove the "GIMP" from all "Since: GIMP 2.x" API doc comments
because it confuses gtk-doc and breaks some links. Also change the
"Index of new symbols in GIMP 2.x" sections to be what seems to be the
modern standard (looked at the GLib and GTK+ docs), and update some
other stuff.
2015-05-31 21:18:09 +02:00
Mukund Sivaraman b1dbfd2567 pdbgen: Regenerate C code 2012-12-05 08:48:54 +05:30
Sven Neumann 9b2e301c87 pdbgen: programmatically add hint about using g_strfreev()
Add the note about the need to free the returned string array
to the generated libgimp code. This way it will show up in the
libgimp documentation but not in the general PDB API.
2012-12-04 21:07:34 +01:00
Sven Neumann c8209ddb4c Revert "pdb: update documentation for all pdb functions whose return can be freed with g_strfreev()."
Such comment should not be included in the general PDB
documentation as it is specific to the C bindings and can
be easily added by the pdbgen infrastructure.

This reverts commit c9888f2222.
2012-12-04 21:07:34 +01:00
Jehan c9888f2222 pdb: update documentation for all pdb functions whose return can be freed with g_strfreev(). 2012-12-04 00:16:08 +09:00
Michael Natterer e61b1f7603 pdb: return NULL terminated stringarrays from libgimp PDB wrappers
so they can be freed with g_strfreev().
2012-11-27 20:50:21 +01:00
Michael Natterer d4933b3052 Bug 674160 - Redesign of "Lock panel"
Apply and heavily modify patch from remyDev which adds "lock position"
to GimpItem, similar to "lock content". Lock position disables all
sorts of translation and transform, from the GUI and the PDB.

Cleaned up some aspects of the lock content code as well because a
second instance of similar code always shows what went wrong the first
time.
2012-11-09 11:17:25 +01:00
Michael Natterer 7faaf4df41 libgimp: rename the newly added item parasite functions
gimp-item-find-parasite -> gimp-item-get-parasite
gimp-item-list-parasites -> gimp-item-get-parasite-list

Also changed the signature of gimp-item-get-parasite-list's C wrapper
in libgimp to be sane.
2011-03-01 22:19:48 +01:00
Michael Natterer b4c9987de6 libgimp: move the item parasite functions to the parasites files
and rename them yet again to be gimp_item_foo_parasite() instead of
gimp_item_parasite_foo() because the latter is just a misnaming (they
are not GimpItemParasites, they are GimpParasites attached to
GimpItems, just as layers are attached to images).
2011-02-13 17:28:30 +01:00
Michael Natterer 29d63afbb7 pdb: remove gimp-item-to-selection again 2010-10-30 22:19:22 +02:00
Michael Natterer c6e93e4f5a pdb: generate nicer gtk-doc comments (no doc contents changed) 2010-09-15 22:07:36 +02:00
Michael Natterer 38b9b4117e pdb: deprecate gimp-drawable-is-text-layer and add gimp-item-is-text-layer 2010-09-15 21:51:53 +02:00
Michael Natterer e7475c1d52 pdb: add new procedure gimp-item-to-selection
and deprecate all old to-selection APIs. The new procedure uses the
newly added GimpPDBContext properties, so it only has an "operation"
parameter.
2010-09-05 22:38:07 +02:00
Michael Natterer 4e2289f736 libgimp: add API to access item groups
A layer tree can be traversed completely now. Tree manipulating
functions still missing.
2010-08-28 18:49:15 +02:00