Commit Graph

2636 Commits

Author SHA1 Message Date
Jehan 1b4834126f libgimp: better organization of gimp_image_metadata_*() API.
gimpimagemetadata.[ch] was built into libgimpui because GTK+ was used
for dialog query for rotation metadata. gimpimagemetadata-save.c only
was built into libgimp, which made no sense as the declaration for its
public function was inside gimpimagemetadata.h!
That was a weird situation and somehow only made visible in the build
system because GIR build was complaining about missing annotations to
gimp_image_metadata_save_prepare() (the annotation was actually present
but in the implementation which was not in the same library as the
header, how weird!):

> Warning: GimpUi: gimp_image_metadata_save_prepare: return value: Missing (transfer) annotation

Moreover it means that only plug-ins linking libgimpui had access to the
gimp_image_metadata*() API, which is obviously not cool (that should be
a core API).

Instead I moved everything into libgimp and replaced
gimp_image_metadata_load_finish() with
gimp_image_metadata_load_finish_batch(), which is essentially the same
function except that it's not interactive (it will proceed to rotate the
image without user confirmation, provided the right flag is present).
Then I add gimpimagemetadata-interactive.[ch] which contains only
gimp_image_metadata_load_finish() and is the alternative interactive
version of gimp_image_metadata_load_finish_batch(). Most plug-ins won't
even have to be changed (at least none in core GIMP) and would still
work as before, whereas now a non-interactive version exists, which
doesn't mandate to link GTK+.
2020-09-13 13:36:51 +02:00
Ell 25aefa972e libgimp: link libgimpui against GEGL
Needed since commit 4c8ee413eb.
2020-09-13 10:25:30 +03:00
Jehan d93d7effb2 libgimp: gimp_vectors_stroke_reverse missing in def file.
First bug found by our new distcheck CI step!
2020-08-03 03:19:49 +02:00
Jehan e21db99333 libgimp: fix documentation comment.
No need "See Also: gimp_drawable_get_shadow_buffer()" from within
gimp_drawable_get_shadow_buffer() documentation itself!
2020-07-01 11:09:52 +02:00
Jehan 3edcaa4baa libgimp: do not assume there are selected layers.
The list of selected layers may be empty, which doesn't matter much
because we don't actually do much with this list in current export code.
In the code modified in this commit, we were only using existing layers
to set the type of a new layer (which seems very useless right now as
anyway the layer type has to be the image base type with or without
alpha, so a with_alpha boolean parameter would be just as good, unless
we plan to support different color model layers in a same image).
2020-06-27 18:17:15 +02:00
Ell 4c8ee413eb libgimp: add GIMP_EXPORT_NEEDS_CROP export capability
Add a new GIMP_EXPORT_NEEDS_CROP export capability, which causes
gimp_export_image() to crop the exported image content to the image
bounds; this is useful for formats that support layers, but have no
concept of global image bounds, hence cropping is the only way to
enforce the image bounds.

When showing the export dialog, give an option to either crop the
layers to the image bounds, or to resize the image to fit the
layers.
2020-06-25 18:20:47 +03:00
Jehan 33520a547d app, libgimp: protect a bit GDK X Window calls.
The GDK_WINDOWING_X11 build-time macro check is not enough as GDK can be
built with both X11 and Wayland backends. We need to add a runtime check
of the type of display.
2020-06-21 12:54:13 +02:00
Michael Natterer 48b04e7257 libgimp: implement argument sync in GimpProcedureConfig
In begin_run() and end_run(), sync string properties set to
GIMP_ARGUMENT_SYNC_PARASITE with image parasites of the same name,
exactly the way "gimp-comment" was handled by begin_export() and
end_export(). Remove the "gimp-comment" handling code from
begin_export() and end_export().
2020-06-17 21:56:31 +02:00
Michael Natterer 5a235fae69 libgimp: add the concept of "argument sync" to GimpProcedure
which can be set to GIMP_ARGUMENT_SYNC_NONE (the default) or
GIMP_ARGUMENT_SYNC_PARASITE, which indicates that the argument should
be synced with an image parasite of the same name.
2020-06-17 21:56:31 +02:00
Michael Natterer b814ea95a1 libgimp: return the added GParamSpec from all GimpProcedure...
...functions which add arguments or return values.

So code can do stuff with them without an additional lookup call.
2020-06-17 21:56:31 +02:00
Michael Natterer afe98c5c70 libgimp: add gimp_procedure_config_save_metadata()
so the export's GimpMetadata can be written at any time during the
export process, which is for example needed for TIFF export.
2020-06-08 14:28:47 +02:00
Michael Natterer 1ef5f816aa libgimp: change ARG_OFFSET define in GimpSaveProcedure from 4 to 5
the procedure's signature changed which broke marshalling of
additional arguments and creation of GimpProcedureConfig object.
2020-06-08 14:28:47 +02:00
Jehan 647ebffe7b app: GimpTransformTool multi-layer aware.
This implied a lot of other core changes, which also pushed me into
improving some of the edit actions and PDB calls to be multi-layer aware
in the same time.

Note that it is still work-in-progress, but I just had to commit
something in an acceptable intermediate state otherwise I was just going
crazy.

In particular now the various transform tools are multi-layer aware and
work simultaneously on all selected layers (and the linked layers if any
of the selected layers is linked too). Both preview and final transform
processing works.
In the limitations, preview doesn't work well (only one layer in the
preview) when there is a selection (though the actual transform works).

Also I am left to wonder how we should process this case of canvas
selection+transform on multi-layers. Indeed currently I am just creating
a floating selection (like we used to for the selection+transform case)
containing a transform result of the composited version of all selected
layers. This is a possible expected result, but another could be to get
several transformed layers (without composition). But then should the
"Floating Selection" concept allow for multiple Floating Selections?
Sooo many questions left to answer.
2020-05-28 14:28:01 +02:00
Niels De Graef 23d5ef2546 vala: Fix some metadata warnings
We were mentioning some symbols that aren't introspected, because they
are part of `app/*`.
2020-05-26 22:05:12 +02:00
Niels De Graef acf50009f8 Allow building vala plugins 2020-05-26 17:52:52 +00:00
Simon Budig 8839cb58bb pdb: update autogenerated files. 2020-05-25 22:55:01 +02:00
Niels De Graef 25e535b5e0 Fix missing includes
We're exposing symbols in our header files like `GType`, `GFile` and
others, without actually including the proper headers. This also gives
errors in the GIR scanner (who can't resolve those symbols).
2020-05-21 16:02:55 +02:00
Niels De Graef 842dc7535f gir: (skip) functions with varargs
Bindings can't handle these, so they are not introspectable.
2020-05-21 13:49:38 +02:00
Jehan 2956873740 app, libgimp, pdb: fix gimp_selection_float() usage.
This fixes bugs introduced in commit a7c59277fb where I obviously didn't
properly checked all the places where gimp_selection_float() was used
after its parameters changed.
2020-05-18 02:09:45 +02:00
Jehan bb7f94ce3b libgimp: add new functions to gimp.def.
This fixes the Windows build.
2020-05-17 22:44:02 +02:00
Jehan 5498adf50a app, libgimp, pdb: color picker multi-layer aware.
Color picking on a single layer still works as it used to. On multiple
layer, it will now pick on the composited color, similarly to sample
merged if only selected layers were made visible.

The PDB/libgimp function gimp_image_pick_color() is also updated to work
on multiple drawables too, giving the same ability to plug-ins (the only
call to this function in core plug-ins have been updated).
2020-05-17 18:57:32 +02:00
Jehan 98603c69c9 app, libgimp, pdb: "edit-copy" multi-layer aware.
When several layers are selected, select their render, similar to how
"edit-copy-visible" would have copied an image with only these layers
made visible.
Also apply the same logics to PDB function gimp_edit_copy() which can
now be used on several drawables at once.
2020-05-17 18:57:32 +02:00
Jehan d3139e0f7c app: support saving/exporting with multi-selection.
This commit just changes our saving API (i.e. the GimpSaveProcedure
class) to take an array of drawables as argument instead of a single
drawable.

It actually doesn't matter much for exporting as the whole API seems
more or less bogus there and all formats plug-ins mostly care only
whether they will merge/flatten all visible layers (the selected ones
don't really matter) or if the format supports layers of some sort. It
may be worth later strengthening a bit this whole logics, and maybe
allow partial exports for instance.

As for saving, it was not even looking at the passed GimpDrawable either
and was simply re-querying the active layer anyway.
Note that I don't implement the multi-selection saving in XCF yet in
this commit. I only updated the API. The reason is that the current
commit won't be backportable to gimp-2-10 because it is an API break. On
the other hand, the code to save multi-selection can still be backported
even though the save() API will only pass a single drawable (as I said
anyway, this argument was mostly bogus until now, hence it doesn't
matter much for 2.10 logics).
2020-05-17 18:32:16 +02:00
Jehan ac56b1ed14 app, libgimp, pdb: add PDB function gimp_image_get_selected_layers().
Also add gimp_image_list_selected_layers() which is the GList version.
2020-05-17 18:32:16 +02:00
Niels De Graef b14b93de14 Split GIR into Gimp-3.0 and GimpUi-3.0
Fixes https://gitlab.gnome.org/GNOME/gimp/-/issues/4065
2020-05-15 07:45:25 +00:00
Niels De Graef 0d9716a0a8 patternselect: Document pattern_name parameter
Fixes an annoying gtk-doc warning.
2020-05-12 20:03:56 +02:00
Niels De Graef 904a2e422d meson: Declare internal libgimp(ui) dependency
By using Meson's `declare_dependency()`, we can avoid specifying the
linked libraries, dependencies and includes we need over and over again.

Basically, this conceptually acts like an internal pkg-config.
2020-05-11 06:42:29 +02:00
Niels De Graef 57d3837e40 gir: More missing annotations
Especially need to watch out with forgetting `(array)` and `(out)`
annotations, as they can really give a different API in certain (if not
most) bindings.
2020-05-08 16:57:45 +02:00
Niels De Graef f23ada8c77 zoompreview: Add (array) gir annotation 2020-05-08 16:34:23 +02:00
Niels De Graef 09f8a3c922 zoompreview: Fix gtk-doc identifier
Also fix the (transfer full) annotation, which isn't correct.
2020-05-08 16:32:54 +02:00
Niels De Graef ed310dd48d Fix some gtk-doc comments and GIR annotations 2020-05-08 15:26:42 +02:00
Niels De Graef 693eeae96b gimpprogress: Add arg descriptions to vfuncs
That squashes some gtk-doc warnings.
2020-05-08 10:39:33 +02:00
Niels De Graef 2f94513df4 libgimp: Make sure GIR includes the right header
When using GIR-based bindings that will eventually include the header
files (like Vala), we need to make sure to tell the gir-scanner what
file that is. Otherwise tools like `vapigen` have to make an educated
guess (which will be wrong).
2020-05-08 10:15:08 +02:00
Niels De Graef b680945752 gir: Make use of typedefs for GimpProgressVtable vfuncs
GObject introspection has issues handling random vfuncs (i.e. not part
of a GObject). Most of all, it needs to be able to give these a name
(so they can be used to cast in some higher level languages for
example). As such, give each vfunc in `GimpProgressVtable` a separate
typedef.
2020-05-06 11:40:26 +00:00
Niels De Graef 58fecd7f8c gir: Make sure the GIR file includes the correct header
That way, bindings that still need to know the original C header that
needs to be included (like Vala) are pointed to the correct place.
2020-05-05 19:16:49 +02:00
Niels De Graef 83d6764e0e gir: Add (closure) tags 2020-05-04 21:31:30 +02:00
Niels De Graef 7f58f2d6e5 gir: Add more missing (array) and (out) annotations 2020-05-04 21:29:42 +02:00
Niels De Graef 9c9e310a67 gir: Add missing annotations
Otherwise we won't be able to generate proper API for our bindings
2020-05-04 02:11:57 +02:00
Niels De Graef db0493aa0d gir: Add more (out) annotations
This will change the API for some bindings, so we probably want to do it
before a release.
2020-05-03 17:57:23 +02:00
Niels De Graef 85d9730936 Add some missing (nullable) annotations
Fixes https://gitlab.gnome.org/GNOME/gimp/-/issues/4750
2020-05-01 15:34:56 +02:00
Jehan fdcf74ea72 libgimp: add gimp_param_spec_get_desc() in gimp.def. 2020-04-28 20:15:28 +02:00
Michael Natterer 15bedc9bf9 libgimp: revive parameter range descriptions in the procedure browser
Copy gimp_param_specs_get_desc() to libgimp and make it also mention
default values. Don't install its header for now, because it's pretty
much a utility function of GimpProcView. It also doesn't handle most
GParamSpec types yet.

As a side effect, this fixed issue #3947.
2020-04-28 19:14:11 +02:00
Jehan eafe90fa7c libgimp, po-python: fix missing header in distribution…
… and additional source from python POTFILES.

These 2 fixes allow `make distcheck` to work fine.
You'll notice that I just commented the pygimp files out instead of just
deleting them. That's because there have been discussions and a patch
proposal lately about porting the pygimp API to Python 3/master. We are
not sure we want this yet for maintainability reason (and I was supposed
to be the one to wipe these files out!) but we'll see.
2020-04-19 12:52:28 +02:00
Jehan ea0cc27c01 app, libgimp, pdb: update gimpfile PDB functions' documentation.
All file-related functions now uses a single GimpFile as argument.
Comments regarding path as entered vs full pathname are now obsolete.
2020-04-13 20:25:32 +02:00
Niels De Graef 878804fb01 Cleanup GObject signal marshallers
* Don't generate our own marshallers if they are available in GLib
  already
* Don't set the c_marshaller parameter in `g_signal_new()` if it's a
  default marshaller provided by GLib. See commit message of commit
  39e4aa3c57 on why this is the case.
2020-04-01 21:20:01 +00:00
Jehan 707d3c6f64 libgimp: fix wrong assert in gimp_procedure_config_set_values().
The first property of a GimpProcedureConfig is the related
GimpProcedure. All others are the procedure arguments.
Also fixing the pspecs index while looping since we want to start at 1
to loop through arguments for the same reason.

Among other things, this was breaking the calls to file_save() and
several unit tests.

(cherry picked from commit 48acb361a3)
2020-03-19 11:05:19 +01:00
bootchk 8d5afa76e7 issue 4669 2020-03-17 12:34:01 +00:00
Ell 3d0606a9be libgimp: fix range of "opacity" parameter in brush-select callback 2020-03-05 20:35:44 +02:00
Jehan 4a4359d3da libgimp: (meson) build GIR file silently.
In case of errors or warnings, they will still be displayed, but it is
better to not show outputs when everything is building fine.
2020-01-15 22:24:48 +01:00
Oleksii Samorukov 3e78c674d8 Return FALSE on gimp_osx_focus_window to avoid endless loop 2020-01-15 17:40:23 +01:00
Michael Natterer 97bbd4773e libgimp: fix writing empty array GValues in gimp_value_to_gp_param()
When g_value_get_boxed() returns a NULL array, we would encode
nonsense on the wire and run into warnings. Now we simply send a
zero-length array.
2020-01-06 16:16:18 +01:00
Michael Natterer afe19ff393 libgimp: GimpProcedureDialog: next time save before committing... 2020-01-05 18:57:17 +01:00
Michael Natterer f2cf791a25 libgimp: document GimpProcedureDialog's properties 2020-01-05 18:37:58 +01:00
Michael Natterer 7cd99086ba libgimp: some documentation fixes and improvements 2019-12-27 19:56:21 +01:00
Michael Natterer 1856990c2b libgimp*: check all return values of g_param_spec_internal()
like in the fix for issue #4392. Remove the reference to the issue
from gimp_param_spec_layer() because we can't have it in all places
that now do checks.
2019-12-27 19:53:08 +01:00
Jehan 9399c937df Issue #4392: Gimp Segmentation Fault triggered by Glib GParamSpec...
... property name validation.
Slightly different fix on master compared to the gimp-2-10 branch. Here
the GParamSpec creation will happen already on the plug-in process in
libgimp. Let's just make sure we abort before we segfault.

This will be enough for the plug-in developer to start debugging one's
code. At least the core process is not crashing when the plug-in dev
provides invalid param names.
2019-12-24 02:10:02 +01:00
Michael Natterer 1be4ec2100 libgimpbase: remove enum GimpBlendMode, it's not used any longer 2019-11-19 21:13:31 +01:00
Michael Natterer 5a37be083a libgimp: doc fixes and improvements in procedure subclasses 2019-10-29 22:15:58 +01:00
Michael Natterer 0da5f0ae7e libgimp: make GimpProcedureConfig handle the image comment automatically
in gimp_procedure_config_begin_export() and end_export(). It uses
both the "gimp-comment" parasite and gimp_get_default_comment() and
syncs them with the config's "comment" property if it has one.
2019-10-29 20:38:51 +01:00
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 f7c7924564 libgimp: automatically handle the image comment in GimpProcedureConfig
as in, sync it with a "comment" property on the config if one
exists. Also allow gimp_procedure_config_begin_export() and
end_export() to skip GimpMetadata handling, for file formats which
don't support it.
2019-10-23 19:08:33 +02:00
Michael Natterer c7c0397fbe libgimp: add gimp_procedure_find_argument(), aux_argument(), return_value() 2019-10-23 19:08:33 +02:00
Jehan 5fe20497c5 libgimp: (meson) set GIMP_DISABLE_DEPRECATED for introspection.
No need to introspect deprecated API, especially for the new non-C APIs
after a major version update.
This also sync both the autotools and meson-generated GIR files.
See also #4018.
2019-10-20 16:47:40 +02:00
Jehan b8d8424ae0 app, libgimp*: (meson) fix all the generated `*-enums.c`.
More of the files were wrong, or at least not absolutely identical to
the files generated by the autotools. I am not doing any code change
other than trying to make both build systems produce identical files
(except for slight differences on 2 files not worth the effort) even
though maybe some things can be improved (especially on the include
list). Maybe to be improved later.

Also fixing 2 of the previously autotools-generated files because of
space typos which should have been committed earlier.

Finally it is to be noted that there is no logics to copy the generated
files back to the source directory in the meson rules. I am not sure
anyway this is really worth it and maybe we should just stop tracking
these generated files eventually.
2019-10-19 22:32:29 +02:00
Jehan 69e993b24e libgimp: remove duplicate gimpprocedureconfig.c (meson).
This is listed twice and is not needed for libgimpui (not listed in
autotools build) and apparently it provokes introspection warnings on
MSYS2 builds.
Thanks to lillolollo and Massimo for debugging this.
2019-10-11 14:07:58 +02:00
Jehan cf6dae6f83 libgimp: fix a type cast warning (win32).
I had this warning when cross-building for Windows 64-bit:

> libgimp/gimpui.c:187:52: warning: passing argument 2 of
> 'gdk_win32_window_foreign_new_for_display' makes pointer from integer
> without a cast [-Wint-conversion]

> note: expected 'HWND' {aka 'struct HWND__ *'} but argument is of type 'guint32' {aka 'unsigned int'}
2019-10-10 14:13:49 +02:00
Jehan f59b0db0c8 app, libgimp: fix more unused function warning (Win32).
Similar to commit 9b328167ab. Apparently the same function is duplicated
into app/.
Also add some comments to detail a bit more where this Win32 different
comes from (i.e. bug 359538 on Bugzilla, commit eac61e1e12).

Moreover I tested the same steps as comment 4 in bug 359538 on master
code. The same hanging issue still exists with GTK+ 3.24.1 (in a Windows
VM at least). I have not investigated further, just wanted to check if
this ifndef could not simply be removed by now. Apparently not.
2019-10-10 14:11:40 +02:00
Jehan 590681434b libgimp: sync autotools and meson to the same list of introspectable…
… headers.
gimpitem.h was missing, as noted (again!) by Massimo, which resulted
into introspected plug-ins errors (breaking parenting of classes).
2019-10-10 12:39:07 +02:00
Jehan 8cf4b7a43a libgimp: reduce GObject Introspection warnings.
Thanks to Massimo for helping:

> To reduce the number of warnings down to 2, it is necessary to list
> gimptypes.h and gimpenums.h right after gimp.h and gimpui.h
> gimpuitypes.h at the start of libgimpui_headers_introspectable like
> they are in the corresponding list in Makefile.gi.
>
> Their order evidently matters

See #4018.
Some stuff are still wrong, but this is a first step in the right
direction.
2019-10-10 12:32:05 +02:00
Michael Natterer 2409b6f219 libgimp: manage boolean "save-comment" properties automatically
using the GimpProcedureConfig/GimpMetadata mechanism.
2019-10-10 01:30:29 +02:00
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
Michael Natterer 7f2995d568 libgimp: improve docs for gimp_image_metadata_save_prepare()/finish() 2019-10-10 00:05:49 +02:00
Michael Natterer 8219092a6c libgimp: start integrating image export with GimpProcedureConfig
Add gimp_procedure_config_begin_export() and end_export() which
are wrappers around begin_run() and end_run() and additionally
pretty much completely manage GimpMetadata handling.

A GimpProcedureConfig can provide boolean properties "save-exif",
"save-xmp" etc. in order to have them automatically managed by
begin_export() and end_export(). This also restores the feature of
overriding the procedure's saved default values with export
preferences, but not the values from the last export, like it
used to be in 2.10.

Move gimp_image_metadata_save_prepare() and save_finish() (which are
now completely handled by GimpProcedureConfig) from libgimpui to
libgimp, but keep their declarations in the libgimpui header. Not
perfect, but not finished either.

Also fix gimp_image_metadata_save_prepare() to set the affected
GimpMetadataSaveFlags to 0 when the image has no metadata at all.
2019-10-09 22:50:03 +02:00
Jehan 9b328167ab libgimp: fix unused function (Win32).
Fixes:
> libgimp/gimpui.c:402:1: warning: 'gimp_window_transient_realized' defined but not used [-Wunused-function]
2019-10-09 16:34:51 +02:00
Michael Natterer 68f9b540c7 libgimp: fix all GIMP_PROC_ARG,AUX_ARG,VAL_FOO() macros
They all had "class" as first argument (copied from gimpconfig-params.h)
and only worked accidentially because all functions they are used in
happen to have the right local "procedure" variable...
2019-10-02 22:17:37 +02:00
Ell d17dc3112f libgimp: fix segfault in gimp_procedure_config_load_default() with NULL error 2019-10-02 20:51:59 +03:00
Jehan f87ae8cc6c libgimp: fix meson build. 2019-09-30 23:05:01 +02:00
Michael Natterer e1a9b9242e libgimp: remove underscores from the procedure conifig load/save functions
They are needed by GimpProcedureDialog wich is in libgimp. Keep them
in the private header anyway for now.
2019-09-28 20:53:21 +02:00
Michael Natterer 45e96a0ff4 libgimp: improve handling of procedure default values a lot
Add internal GimpProcedureConfig API to load/save "default values"
which are to be treated as if they were the hardcoded GParamSpec
defaults, but user-configurable. Also make all other load/save
functions available to other libgimp files.

In gimp_procedure_run(), if incomplete arguments are passed, don't
just complete them with the GParamSpec defaults, but look up the
user-saved defaults and use them if they exist. This happens before
everything else and brings back the PNG export feature of using
user-saved defaults also in non-interactive mode (but for all
procedures not just PNG export).

In GimpProcedureDialog, add "Load Defaults" and "Save Defaults"
buttons, they are the only way of managing the user-configurable
procedure defaults.

When clicking "Reset", show a popover with the reset options "Initial
Values" and "Factory Defaults".
2019-09-26 19:26:23 +02:00
Michael Natterer 9cb62f5f9a libgimp: move "image" and "run_mode" from gimp_procedure_config_end_run()
and remember them internally between begin_run() and end_run().
Simplifies plug-in code even more.

Move the begin_run() before gimp_export_image() block in all export
plug-ins.
2019-09-26 00:44:52 +02:00
Michael Natterer cb40cfd10e Issue #3983 - gimp_get_images returns NULL pointer whilst num_images > 0
In libgimp/gimp.c: gimp_main() make sure that GIMP_TYPE_OBJECT_ARRAY
and GIMP_TYPE_PARAM_OBJECT_ARRAY are known to the type system and can
be looked up by name.
2019-09-25 20:47:25 +02:00
Michael Natterer 58bf1d431d libgimp: add a "status" parameter to gimp_procedure_config_end_run()
and require it to be always called paired with begin_run(), which is
more straightforward and makes the resulting code more future-proof.
2019-09-25 12:09:03 +02:00
Michael Natterer 191fcdf884 libgimp: add macros for adding aux args to gimpprocedure-params.h 2019-09-24 15:11:50 +02:00
Michael Natterer c3efeae31d libgimp: add the concept of "Auxiliary arguments" to GimpProcedure
Aux arguments are arbitrary values the procedure wants managed and
remembered across invocations in GimpProcedureConfig. They are not
passed to run() and are not known to the PDB, they only exist in the
procedure's config object.
2019-09-24 12:39:02 +02:00
Michael Natterer 70ac0e9d9a libgimp: fix gimp_image_metadata_save_prepare()'s check for IPTC flags
it was checking gimp_export_xmp() not gimp_export_iptc(), probably a
copy/paste error.
2019-09-24 12:11:59 +02:00
Michael Natterer aeef726044 libgimp: implement GimpProcedure::create_config() in all subclasses 2019-09-24 00:59:50 +02:00
Michael Natterer 247f99ce22 libgimp: change GimpProcedureDialog's "OK" with the procedure type
- "_Open" for GimpLoadProcedure
- "_Export" for GimpSaveProcedure
- "_OK" otherwise
2019-09-23 20:00:19 +02:00
Michael Natterer 243042730e libgimp: add "image" parameters to gimp_procedure_config_begin,end_run()
When non-NULL, the code tries to load/save image-specific last used
values from/to the image using a parasite. This is meant to be used by
file export plug-ins.
2019-09-23 19:28:04 +02:00
Jehan edd824ddef libgimp: disable GObject Introspection generation when cross-compiling.
This is hopefully a temporary setback since we want to consider the
introspected API as a core feature (otherwise we'd end up with third
party builds deactivating the feature, and get a very random experience
depending on where you got GIMP) hence don't want it to be optional
(note that I haven't added a configure option).
Anyway for now, it seems that cross-building introspected data is not
really supported (or I'm still figuring it out).
2019-09-22 20:03:29 +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
luzpaz 44d10e458c Fix various typos
Found via `codespell` (v1.17.0.dev0)
2019-09-21 17:10:46 +00:00
Michael Natterer 3ce2c7e3f9 libgimp: s/filename/file/ in docs 2019-09-21 19:02:40 +02:00
Michael Natterer dbd793d631 libgimpconfig: get rid of filenames in all config related APIs
and rename function names which say "gfile" to just "file".
2019-09-21 12:55:12 +02:00
Jehan 396d227436 libgimp: fix typo and libgimpui build.
Apart from some obvious typo, libgimpui link was failing with meson
because it now relies on a function from libgimpconfig (i.e.
gimp_config_reset()), since commit bfb7f43dbc. This fixes:
> /usr/bin/ld: libgimp/gimpproceduredialog.c:223: undefined reference to `gimp_config_reset'
2019-09-21 01:29:16 +02:00
Michael Natterer df8d5b02ae libgimp, plug-ins: remove the "preview" parameter from gimp_ui_init()
It's dead since a looong time.
2019-09-20 19:56:00 +02:00
Michael Natterer aa41baef1e libgimp: add gimp_procedure_config_get_procedure()
and use it in gimp_procedure_dialog_new() to make sure that the passed
config was created by the passed procedure.
2019-09-20 19:33:50 +02:00
Michael Natterer bfb7f43dbc libgimp: add GimpProcedureDialog, the new dialog class for plug-ins
It knows about the procedure and its config, and so far implements the
entire construction boilerplate and "Reset" on its own.
2019-09-20 19:24:40 +02:00
Michael Natterer b441d100ff libgimp: add GimpProcedureConfig which implements the GimpConfig interface
It's the base for bringing proper management of saved settings
(including the last used values) and generated GUI using prop_widgets
to plug-ins.
2019-09-20 12:34:03 +02:00
Jehan cf276ed972 libgimp: fix introspection of PDB functions in meson build.
PDB headers had been forgotten and therefore a whole bunch of functions
were not introspected.
2019-09-14 23:26:30 +02:00
Michael Natterer 73cd120a4c Issue #3912 - Object proxy management not happy with bindings
Don't drop references we do not own. Turns out bindings can have
things referenced even after all procedure code has returned. Keep the
old code there in #if 0 and keep the debug warning for now, maybe we
can do something generic about this.
2019-09-12 12:17:35 +02:00
Michael Natterer 83a936b8fe pdb: rename all functions in the "plug_in" group
from gimp_plugin_foo() to gimp_plug_in_foo() for consistency.
2019-09-11 23:58:47 +02:00
Michael Natterer 6de4af4ade pdb: change paths and URIs in the "plug_in" group to GFiles 2019-09-11 23:54:53 +02:00
Michael Natterer 77731d1e8e pdb: change the URIs in the color profile API to GFiles 2019-09-11 22:44:17 +02:00
Michael Natterer 14af676b51 pdb, libgimp: change "filename" to "file" in gimp_pdb_dump() 2019-09-11 22:37:40 +02:00
Michael Natterer 6468fa06c7 pdb, plug-ins: change gimp_temp_name() to gimp_temp_file() 2019-09-11 22:32:44 +02:00
lillolollo 4118fb6a76 Resolve implicit declaration of function 'getpid' 2019-09-11 19:55:16 +00:00
Michael Natterer 6bca8c4f89 pdb, app, libgimp, plug-ins: replace most PDB filenames/URIs by GFile
and in an attack of madness, changes almost all file plug-in
code to use GFile instead of filenames, which means passing
the GFile down to the bottom and get its filename at the very
end where it's actually needed.
2019-09-11 21:48:34 +02: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
Félix Piédallu ba6973e791 Fix Meson some changes not pulled from Autotools 2019-09-11 17:10:47 +02:00
Félix Piédallu 65eff6f150 Meson port. 2019-09-11 16:42:04 +02:00
Michael Natterer f3fb3d1a57 Remove the second "raw-filename"/"raw-uri" parameter from file procedures
It's an ancient concept from ancient times when we didn't have URIs
and only filenames (not to speak of GFile), and actually even from
before the ancient time before that ancient time when we first had
ones and zeros, and only had zeros.
2019-09-11 00:21:03 +02:00
Michael Natterer 6115d34fe8 Rename the "fileops" PDB group to just "file" 2019-09-10 21:38:11 +02:00
Michael Natterer 7c5cb29ca6 pdb: move the file procedure register API from "fileops" to "pdb"
because it has nothing to do with the other procedures in fileops and
only sets properties on procedures.
2019-09-10 21:24:09 +02:00
Michael Natterer 56fee73441 pdb: reorder stuff in the "pdb" group to make more sense 2019-09-10 20:23:19 +02:00
Michael Natterer fba010a642 libgimp: more GimpPlugIn docs
Mention and guarantee the order of procedure registration (see
previous thumbnail loader commit). Remove duplicate docs from the
GimpPlugIn class comments that are needed for introspection, it's too
cumbersome to keep two identical texts in sync, and the removed text
is used nowhere.
2019-09-10 20:00:42 +02:00
Jehan 5621de52fc libgimp: have both annotations for GObject Introspection and gtk-docs.
GTK-docs needs the struct member documentations in the main struct
comment. So let's get this back, while keeping the proper GI
introspection for each method this time.
As discussed with Mitch.
2019-09-10 18:13:26 +02:00
Jehan 183f00baf9 libgimp: fix GimpPlugInClass methods introspection.
Commit 005143a43e completely broke all the
introspected plug-ins, so I am reverting only the relevant changes.

If some things need to be improved in this part of the docs, let's do it
without breaking major stuff.
In particular: abstract methods must be properly documented (with
parameters, return values and annotations) like any function, and must
be named Class::method, e.g. GimpPlugInClass::query_procedures.
Other we break GObject Introspection, i.e. we break all plug-ins using
these.
2019-09-10 15:22:54 +02:00
Michael Natterer 0745043ddb pdb, libgimp: remove _gimp_register_load_handler()
and rename _gimp_register_magic_load_handler() to
_gimp_register_load_handler().
2019-09-10 12:29:17 +02:00
Michael Natterer a20fb094d9 libgimp: remove gimp_plug_in_create_procedure() from the API
no plug-in code ever needs to call it.
2019-09-10 12:11:32 +02:00
Michael Natterer 34489d1b13 libgimp: add section docs for GimpPlugIn with general information
and document the members of GimpProcedureClass. Also various
doc fixes.
2019-09-10 11:17:12 +02:00
Michael Natterer 005143a43e libgimp, devel-docs: fix docs for GimpPlugInClass and its members 2019-09-09 20:53:39 +02:00
Félix Piédallu 46f706a403 [libgimp,app] add missing includes for windows 2019-09-09 18:15:13 +00:00
Michael Natterer b587740a10 libgimp: make sure the GimpPlugIn and GimpPDB singletons get destroyed
Break reference cycles between the objects and the procedures they
keep by moving procedure destruction to dispose() and calling
g_object_run_dispose() before unrefing PLUG_IN and PDB in gimp.c.

Also some formatting and "Since: 3.0" annotation .
2019-09-09 11:16:39 +02:00
Michael Natterer d745dc86c5 libgimp: warn on attempts to install or uninstall a GimpPDBprocedure 2019-09-09 01:46:26 +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 5a57256a24 libgimp: no need to set NULL strings on GimpPDBProcedure 2019-09-09 00:35:56 +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 303ccbedad pdb: move gimp_plugin_icon_register_invoker() from "plugin" to "pdb"
and call it gimp_pdb_set_proc_icon(). Change icon registration code in
libgimp/ and app/ so it's now possible to register icons for temporary
procedures.
2019-09-08 16:22:32 +02:00
Michael Natterer d89adebff8 pdb: move gimp_plugin_menu_register() from the "plugin" to the "pdb" group
and call it gimp_pdb_add_proc_menu_path(). Move around and rename some
code in app/ to prepare for more procedure setters to work this way.
2019-09-08 15:53:37 +02:00
Michael Natterer e82c80bf5f pdb: rename all procedure query procedures to gimp-pdb-get-proc-foo 2019-09-08 15:07:24 +02:00
Michael Natterer 388776df07 Simplify the plug-in query API and fix plugin-browser
- remove the menu path and image types from "gimp-plugins-query",
  they are available via GimpProcedure, also reorder and rename
  its remaining return values to make sense
- remove the "menu_path" parameter to gimp_proc_view_new(),
  it can also ask GimpProcedure
- adapt plugin-browser to the new API and make it use GimpProcedure
- fix plugin-browser's tree view to show all menu hierarchies
  completely, it was still expecting menu paths that contain
  the menu label too
2019-09-08 14:59:09 +02:00
Michael Natterer d7e69b2bbb libgimp: show the newly introspectable stuff in GimpProcView 2019-09-07 21:12:01 +02:00
Michael Natterer 5c16fc205d libgimp: use the new API in GimpPDBProcedure
GimpProcedure should be the only API needed to introspect procedures.
2019-09-07 21:09:22 +02:00
Michael Natterer 48692e58c3 pdb: add pdb API to get a procedure's image types, menu label and menu paths 2019-09-07 21:08:13 +02:00
Ell 85704c6c46 pdb: add $since info to gimp-image-merge-layer-group 2019-09-07 10:55:09 +03:00
Ell 643279bd31 Issue #3893 - Error message when exporting to to TIF if there is a layer mask on a group
When exporting to a format that supports layers, but doesn't
support layer masks, merge layer groups with a mask before applying
their mask, since masks can't be applied to layer groups.
2019-09-07 10:36:53 +03:00
Ell 62a6023b27 pdb: add gimp-image-merge-layer-group procedure
Oddly, we didn't have this one yet :P
2019-09-07 10:33:43 +03:00
Michael Natterer 8ef87b0922 libgimp: fix crash introduced in commit bfe4a2f9
Freeing stuff is good, but freeing twice is not so good.
2019-09-06 17:25:30 +02:00
Michael Natterer 0123bb3389 libgimp: make sure gimpparamspecs-body.c gets introspected 2019-09-05 21:09:28 +02:00
Michael Natterer bfe4a2f9dd app, libgimp: add _gimp_gp_params_free() to gimpgpparams
which frees exactly what _gimp_value_array_to_gp_params() has
allocated, honors its "full_copy" parameter, and plugs the last
libgimp refactoring leaks I'm currently aware of.
2019-09-05 20:59:57 +02:00
Michael Natterer 0f7f322fa5 libgimp: _gimp_gp_params_to_value_array() remove "gboolean full_copy"
With all the GValue and GimpValueArray copying involved, we can't
really make a shallow copy anyway, so don't let the API pretend we
could.
2019-09-05 20:17:22 +02:00
Michael Natterer ee86e5630e libgimp: don't leak the GPParam array after writing procedure return values
Annotate all calls to g_free(GPParam*) with /* FIXME leaking object arrays */
because we now do, and it needs to be fixed.
2019-09-05 16:24:09 +02:00
Michael Natterer b812d6241a app, libgimp: make two functions of gimpgpparams private
and remove a "gimp" parameter that is no longer needed.
2019-09-05 16:07:15 +02: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 3dc354e848 libgimp: _gimp_gp_param_to_value() must ref object array elements
because the subsequent gimp_value_array_unref() unrefs them
again.
2019-09-05 14:40:05 +02:00
Michael Natterer c59eaa5e3d libgimp: fix copy/paste errors in GIMP_VALUES_FOO_OBJECT_ARRAY() 2019-09-05 14:38:20 +02:00
Michael Natterer 81ee690bbf libgimp: add convenience macros GIMP_VALUES_GET_FOO_ID()
becuse some plug-ins really want the ID for good reasons and not the
object, and code looks so much nicer when the entire list of arguments
is extracted using the macros.
2019-09-05 13:22:37 +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 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
Michael Natterer 33d7faf064 libgimp: don't iterate NULL hash tables in gimp_plug_in_pop_procedure() 2019-08-24 15:45:07 +02:00
Michael Natterer cb01f15f8c libgimp: gimpexport.c: must not unref proxy objects 2019-08-24 15:43:23 +02:00
Michael Natterer 56c8735f6f libgimp: remove gimp_register_load_handler() 2019-08-24 12:36:56 +02:00
Michael Natterer 75e708b319 libgimp: remove gimp_register_thumbnail_loader() 2019-08-24 02:38:09 +02:00
Michael Natterer 18c95e6fac libgimp: g_object_get() wants a pointer to the variable, gah... 2019-08-24 02:33:08 +02:00
Michael Natterer 773586f0c4 libgimp: make gimpgpparams-body.c identical for app/ and libgimp/ again
Use direct GType comparisons where possible, special case layer
because it has core subclasses but only one PDB type, special case
display because it's not visible from app/plug-in/, make code for
GPParamDef and GPParam look the same.
2019-08-23 23:31:19 +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 75bf3865b8 libgimp: memory/lifecycle manage the new libgmp proxy objects
Turn GimpPlugIn into the main factory for all proxies and keep the
main hash tables there. The hash tables keep the initial reference.

For each GimpProcedure::run(), have s "sub-factory" which hands out
proxies to the actual procedure code. Each run() has hash tables of
its own which hold additional references. When run() is done, get rid
of its hash tables and their references, *and* drop the main plug-in
reference counts from the global hashes if the proxies' refcount has
dropped to one.
2019-08-23 17:30:04 +02:00
Jehan de7447d828 libgimp: update def files. 2019-08-23 01:45:01 +02:00
Michael Natterer a04e287966 libgimp: fold gimpplugin-private.c into gimpplugin.c
having that separation was a bad idea in the first place. Private,
really private, totally private in a separate file? just merge them.
2019-08-22 22:24:33 +02:00
Jehan 899cf96ec5 libgimp: make sure gimp_item_get_by_id() allocates the right class.
It is theoretically possible for an id to be reused. Normally here this
should not happen, since the previous item would have been removed from
the hash table anyway, when it got destroyed. Let's still be thorough.
2019-08-22 15:54:37 +02:00
Jehan 08849a584c libgimp: GimpItem now also belong to libgimp. 2019-08-22 15:54:36 +02:00
Jehan d15388c8c9 libgimp: s/gimp_display_new_by_id/gimp_display_get_by_id/
GimpDisplay objects now also belongs 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 7f91f6bc25 libgimp: GimpImageProcedure now uses GimpImage/GimpDrawable too. 2019-08-22 15:54:36 +02:00
Jehan ee8b467e9f libgimp: GimpSaveProcedure() now uses GimpImage/GimpDrawable object...
... as parameters.
And GimpLoadProcedure() now expects the run() function to return a
GimpImage object.
2019-08-22 15:54:36 +02:00
Jehan a1eeca490f libgimp: support all GimpItem subclasses as argument and return values. 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 c409829be5 libgimp, pdb: no need to create deprecated versions for private API. 2019-08-22 15:54:36 +02:00
Jehan 5e6d4d8fbd libgimp: fix the non-generated API with the new class types. 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 8249afe2fc libgimp: allow object GParamSpec for GimpItem and child classes. 2019-08-22 15:54:36 +02:00
Jehan 3f1491e572 libgimp: update non-generated API using GimpItem/GimpDrawable/GimpLayer.
I did the same trick with GIMP_DEPRECATED_REPLACE_NEW_API macro, apart
for some minor widget API to preview drawable, which I will fix right
away in our plug-ins.
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 793cba6675 libgimp: allow object GimpImage as procedure parameter.
Though it is still possible to use an image ID as procedure parameter,
it is now possible to pass a GimpImage GParamSpecObject.

Over the wire, this will transform back and forth into a GimpImageID,
totally transparently for the plug-in which will only always get a
GimpImage.
2019-08-22 15:54:36 +02:00
Jehan 09f0530dab libgimp: update non-generated API to allow old and new API.
Same as previous commit: by default the new API will be used. But if a
plug-in builds with GIMP_DEPRECATED_REPLACE_NEW_API macro, then the same
function names will call the old API with ids.
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 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 bb72504ea9 libgimp: change all non-generated API to use GimpImage.
We shouldn't pass as parameter nor return gint32 anymore.
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
luz.paz 0340c4a904 libgimp/ documentation typo fixes
Found via `codespell -i 3 -w -S ./ChangeLog*,*.po -I ../gimp-word-whitelist.txt ./libgimp`
2019-08-20 08:40:58 +00:00
Michael Natterer 0f273a5959 app, libgimp: also UTF-8-validate all elements of PDB string arrays 2019-08-20 01:46:56 +02:00
Michael Natterer 6ed2d03c73 libgimp: use the new macros in all non-generated files 2019-08-20 01:21:32 +02:00
Michael Natterer 09eaf0295a libgimp: add a gazillion of macros to gimpprocedure-params.h
that make dealing with value arrays easier and shorter, e.g.

  g_value_get_boolean (gimp_value_array_index (args, n)):

becomes:

  GIMP_VALUES_GET_BOOLEAN (args, n);
2019-08-20 01:00:47 +02:00
Michael Natterer c4a973c30a libgimp: add GimpThumbnailProceudre
which handles the standard thmbnail procedure args and return values.
2019-08-19 14:02:34 +02:00
Michael Natterer fab806089a app, libgimp: UTF-8 validate all string arguments and return values
The only way for a plug-in to prevent this is now using
GIMP_PARAM_NO_VALIDATE.
2019-08-19 13:11:02 +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 de121374ef Change the "handles uri" flag of file procedures to "handle remote"
And always pass URIs to all file procedures, the ones what didn't
register as "handles remove" will only ever get local file:// URIs.

Change all file plug-ins (also legacy ones) to expect URIs instead
of filenames, and convert to local paths in the plug-in.

The wire protocol should now be almost 100% clean of non-UTF-8 strings.
2019-08-19 12:05:12 +02:00
Michael Natterer 9cabc8c8d0 libgimp, plug-ins: use the new macros everwhere
Except for gimp_param_spec_string() which is on its way back to the
core.
2019-08-19 10:02:07 +02:00
Michael Natterer 471285bda9 libgimp: add gimpprocedure-params.h
which looks much like gimpconfig-params.h and contains macros
(e.g. GIMP_PROC_ARG_BOOLEAN() and GIMP_PROC_VAL_BOOLEAN()) for all
GimpProcedure argument and return value types supported by the
protocol, and makes the boilerplate of setting up a procedure more
readable and much less indented.

This file is C-only and not introspected.
2019-08-19 09:56:20 +02:00
Michael Natterer d7e42b28e3 libgimp: move the GimpProcedure icon API next to the menu API 2019-08-18 14:04:45 +02:00
Michael Natterer 98bfe065e8 libgimp: add GimpImageProcedure with (run_mode, image, drawable) args
to save the boulerplate of handlin these 3 arguments in a lot of
plug-ins.
2019-08-18 12:46:07 +02:00
Michael Natterer f480d02823 libgimp: add precondition checks for gimp_is_canonical_identifier()
on all procedure name parameters.
2019-08-18 12:43:37 +02:00
Michael Natterer b610475122 libgimp: remove gimp_register_file_handler_priority() 2019-08-18 00:44:18 +02:00
Michael Natterer 515dcbb1ee libgimp: remove gimp_get_pdb_error() 2019-08-16 23:01:17 +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 652fd75891 Rename GIMP_TYPE_INT8_ARRAY to GIMP_TYPE_UINT8_ARRAY
and GimpParamSpecInt8Array to GimpParamSpecUInt8Array
2019-08-15 15:04:34 +02:00
Michael Natterer 350abba213 Remove GIMP_TYPE_INT16 and GimpParamSpecInt16
Use gint and GParamSpecInt with the right value range instead.
2019-08-15 14:17:17 +02:00
Michael Natterer 5a09523214 Remove GIMP_TYPE_INT32 and GimpParamSpecInt32
Use gint and GParamSpecInt instead.
2019-08-15 14:04:56 +02:00