Commit Graph

43975 Commits

Author SHA1 Message Date
Jehan c822350fb3 plug-ins: forgot to change run() signature to new API in python-console. 2019-08-04 12:22:01 +02:00
Michael Natterer cc8fc0f90f libgimp*: add GI's .dirstamp to .gitigore 2019-08-03 19:50:17 +02:00
Michael Natterer 9549be2539 libgimp: kill the plug-in when old API is used while a GimpPlugIn exists 2019-08-03 18:20:28 +02:00
Niels De Graef 529aa743dd Start using g_object_notify_by_pspec()
`g_object_notify()` actually takes a global lock to look up the property
by its name, which means there is a performance hit (albeit tiny) every
time this function is called. For this reason, always try to use
`g_object_notify_by_pspec()` instead.
2019-08-03 15:57:10 +00:00
Michael Natterer 910828bf51 app: better error reporting in gimp_pdb_dialog_run_callback()
Display the error returned from trying to run the temp procedure.
2019-08-03 17:29:34 +02:00
Michael Natterer 38089bb61f libgmp: more useless includes 2019-08-03 17:12:27 +02:00
Michael Natterer e705ab050e libgimp: remove useless includes 2019-08-03 17:11:30 +02:00
Michael Natterer eaf5c792bf plug-ins: port pagecurl to the new API, to have a GUI plug-in to test 2019-08-03 17:10:33 +02:00
Michael Natterer 20d04e029f app, libgimp: support normal GParamInt for plug-in procedures 2019-08-03 17:00:43 +02:00
Michael Natterer 5b8deb68b4 libgimp: make sure GimpProcedures always get all their arguments
gimp_procedure_run(): fill the value array with default values so a
procedure's run callback always gets a complete value array. No more
number-of-arguments checking in any new-style plug-in.
2019-08-03 17:00:43 +02:00
Jehan 5cd09366e1 libgimp: fix gimp_procedure_add_*_from_property().
Argh I changed the signature and added a new parameter, but forgot to
update the implementation!
2019-08-03 16:42:19 +02:00
Michael Natterer ad8dcff199 libgimp: add _gimp_plug_in_read_expect_msg()
and make the places who need it dispatch between it and
_gimp_read_expect_msg() depending on whether there is a GimpPlugIn
instance. Also clean up some includes.
2019-08-03 12:52:22 +02:00
Michael Natterer 3dd79f42c3 Revert "libgimp: move _gimp_read_expect_msg() back to gimp.c"
This reverts commit 366047f423.
2019-08-03 12:37:32 +02:00
Michael Natterer 992f4b0e8a libgimp: add gimp_get_plug_in() which returns the GimpPlugIn singleton 2019-08-03 12:20:22 +02:00
Niels De Graef 5f92ced1f3 Add (nullable) if applicable
Basically this commit makes sure that all return values that are marked
as "Returns:" also have a `(nullable)` annotation if it is mentioned on
the same line that NULL can also be returned.

This will prevent a few problems in GObject-introspection.
2019-08-03 07:53:47 +00:00
Niels De Graef 1dda60154c Use "Returns:" to annotate return values
To be able to annotate return values through GObject-introspection, you
need to make sure it is tagged with `Returns:` and not something else.
2019-08-03 07:53:47 +00:00
Niels De Graef 746a72b956 Make sure to use % for constants
Documentation-wise in C, this doesn't matter a lot, but it allows
GObject-Introspection based bindings to use their built-in versions when
they want to render any kind of documentation (for example, docs for
Python plugins can render `%NULL` as `None`).
2019-08-03 07:53:47 +00:00
Jehan b6e6f0b71b libgimp: gimplegacy not introspected anymore.
Also remove several functions which never made it to a GIMP release.
They were really meant as temporary anyway from the start, waiting for
the new API to be usable.
And GimpParam is not boxed anymore. This is made useless by the fact it
is not an introspected type now.
2019-08-03 09:46:56 +02:00
Jehan 58b3ca816a plug-ins: port python-console to new API. 2019-08-03 09:46:52 +02:00
Jehan 6a1df5be31 libgimpwidgets: fix a copy-paste bug in function docs. 2019-08-03 09:38:46 +02:00
Jehan 04598b1522 plug-ins: use new gimp_procedure_add_*_from_property() in Python.
Since GParamSpec are not working fine (cf. pygobject#227), we have this
trick of initializing new arguments or return values with properties.
Use this trick in the palette-to-gradient plug-in.
2019-08-03 09:38:46 +02:00
Jehan 2c4a8c89ed libgimp, app: allow usage of GParamSpecString procedure arguments.
Just consider these as a GimpParamSpecString with default allow_non_utf8
and non_empty values (FALSE).
2019-08-03 09:38:46 +02:00
Jehan 0787510810 libgimp: add gimp_procedure_add_(argument|return_value)_from_property().
This will be used at least for the Python plug-ins. There is currently a
bug preventing to set a GParamSpec in a binded API.
See pygobject#227.

Please don't revert this. At least it allows to use the new GimpPlugIn
API for Python plug-ins. Anyway even with the old API, I had to add ugly
temporary API for the introspection (which I will now remove as they
never made it to release). So we are trading an ugly situation for a
less ugly one.
We can always remove these 2 new functions before release if we find or
implement better solutions before.
2019-08-03 09:38:21 +02:00
Ell 95429ad704 Issue #3723 - Symmetry Painting with random colour isn't symmetrical
In GimpPaintbrush, calculate grad_point in
_gimp_paintbrush_motion() independently of any stroke, and pass
its value down to GimpPaintbrush::get_paint_params() at each
stroke, so that the color is the same for all strokes, even when
using a color/random dynamics.
2019-08-02 22:28:59 +03:00
Michael Natterer 219fa33eb2 libgimp: create the GimpPlugIn much later in gimp_main_internal()
it will soon get some construct properties that are not known earlier.
2019-08-02 20:53:43 +02:00
Michael Natterer a50069e176 libgimp: change the return values of GimpPlugIn::init_procedures()
and ::query_procedures() to a GList* of strings.
2019-08-02 19:10:13 +02:00
Michael Natterer e3374e7d4e libgimp: make gimp_close() static to gimp.c again
Instead of calling _gimp_close() and returning from both the main
plug-in loop variants, simply only return and call gimp_close() from
where both loops return to, at the end of gimp_main_internal().
2019-08-02 18:48:07 +02:00
Øyvind Kolås 05d47f197a build: require babl-0.1.70 2019-08-02 18:44:15 +02:00
Michael Natterer 366047f423 libgimp: move _gimp_read_expect_msg() back to gimp.c
and make it distinguish between old and new plug-in running.
2019-08-02 18:26:52 +02:00
Michael Natterer 856fe16070 libgimp: add _gimp_plug_in_run() and copy the main plug-in loop to GimpPlugIn
Move the legacy loop code to gimplegacy.c. Also remove some more stuff
from gimp.c, old and new are now completely separate apart from one
glitch which wll go next...
2019-08-02 17:05:51 +02:00
Jehan bc7b358802 libgimp, plug-ins: remove n_procedures from (init|query)_procedures().
The way currently implemented plug-ins are, they are already
NULL-terminating the returned arrays. Since a procedure name cannot be
NULL itself by definition, defining the array length by a terminal NULL
is enough. There is no need to also add a n_procedures parameters which
is just one more possible bug source, even more as we were already
expecting the NULL termination by using g_strfreev() to free the memory.

Anyway a length parameter does not bring any advantage since a plug-in
can still "lie" about its array size (just as it can forget to
NULL-terminate it) and when this happens, the plug-in will segfault.
That's it, it's just a plug-in programming error.

Last but not least, some binding seem to have issues with returned array
setting an (out) parameter as the length. In pygobject at least, the
length parameter doesn't disappear and we end up with this ugly
signature:

> In [3]: Gimp.PlugIn.do_query_procedures.__doc__
> Out[3]: 'query_procedures(self) -> list, n_procedures:int'

See bug report pygobject#352.
To avoid this, we should either set both the array and the length as
(out) parameters or just set the returned array as NULL-terminated
(which is the solution I chose).
2019-08-02 13:50:38 +02:00
Jehan 3945701bd6 plug-ins: localization calls must happens inside query().
It's a bit weird because this has to happen during the query() step, but
plug-ins don't have access to this step anymore, apart from
query_procedures(), which then turns out to be badly named.
2019-08-02 12:58:37 +02:00
Jehan ed619d9ebd libgimpbase: add documentations on gimpparasite public functions.
Once again, the "Since:" is the result of a bit of `git log` archeology.
Hopefully it's right (should be according to tags. Still…).
2019-08-02 12:22:25 +02:00
Michael Natterer 1e2efcf95e libgmp: reorder GimpPlugIn's query(), init(), quit()
in plug-in lifecycle order.
2019-08-02 12:05:28 +02:00
Michael Natterer 5f8d0ef27b libgimp: add gimp_plug_in_extension_enable() and _extension_process()
Start copying all the actual wire communication to GimpPlugIn, and
move the legacy versions to gimplegacy.c.

This implies having the entire protocol code twice, but without any
if(PLUG_IN) { plug_in_stuff(); } else { legacy_stuff(); }

At the moment it is a wild mixture of old and new, but when finished
the wire code in gimplegacy.c will be entirely separate from the wire
code in GimpPlugIn, which will make it easy to g_assert() that only
one API is used by a plug-in.
2019-08-02 12:02:20 +02:00
Jehan 19fbb1d9a8 libgimpwidgets: add documentation for many functions and fix...
... an annotation.
s/(transfer-none)/(transfer none)/
For the "Since:" value, I did some git log archeology. Hopefully I got
these right.
2019-08-02 11:46:39 +02:00
Jehan 3a4b17e8b5 libgimpmath: make GimpVector[23] boxed types.
This way, all functions using these types are now introspectable.
2019-08-02 03:47:23 +02:00
Jehan 0411c7ef97 libgimp: fix some annotations. 2019-08-02 03:21:59 +02:00
Jehan 512d2279af libgimp: fix various docs typos or small errors. 2019-08-02 03:03:52 +02:00
Jehan 17667b7ddf plug-ins: start porting palette-to-gradient to new GimpPlugIn API.
Several aspects of the new API are kind of broken in the Python binding,
especially the arguments. So this first version has no arguments at all.
This also means it cannot be installed in "<Palettes>" menu for the time
being. This is work-in-progress and the missing parts will be
uncommented later when we figure out how to fix the problems.
2019-08-02 03:03:47 +02:00
Michael Natterer ed86de48d2 app, libgimpbase: s/author/authors/ here too 2019-08-02 01:39:09 +02:00
Michael Natterer f86279fd1f libgimp: more GimpPlugIn and GimpProcedure docs and annotations
They are now GI-warning-free.
2019-08-02 01:32:16 +02:00
Michael Natterer 0bec2bcdec libgimp: add gimp_procedure_set_menu_label() and _set_documentation()
which replace _set_strings(). Add more docs.
2019-08-02 00:56:00 +02:00
Michael Natterer d1d56f136e libgimp: set a procedure's arguments and return values to defaults
We need this for named parameters, and it's cleaner anyway.
2019-08-02 00:39:22 +02:00
Michael Natterer b511cf34cf libgimp: add gimp_procedure_set_attribution()
Also rename "author" to "authors" and add some docs.
2019-08-02 00:35:17 +02:00
Michael Natterer 53ca87d693 libgimp: cleanup and more docs for GimpProcedure 2019-08-01 23:46:55 +02:00
Michael Natterer 82afcf5c85 plug-ins: help: use gimp_procedure_extension_ready() 2019-08-01 23:46:55 +02:00
Ell eaec9443c3 app: in GimpFilterTool, add "clipping" option
In GimpFilterTool, add a new "clipping" option, which can be either
Adjust or Clip.  This option is controllable for layers, when
there's no selection mask.

When set to Adjust, which is used by default, the filter's output
may extent past the drawable's boundary, and the drawable will be
resized to match the output when committed.
2019-08-02 00:40:01 +03:00
Ell b7f53262fc app: add gimp_drawable_filter_set_clip()
In GimpDrawableFilter, add a new gimp_drawable_filter_set_clip()
function, which controls whether the filter clips the result to the
drawable's boundary, or extends it past it.  The latter is only
possible for layers, when the selection mask is empty.
2019-08-02 00:40:01 +03:00
Ell 89a9cf7e49 app: add "clip" parameter to gimp_drawable_merge_filter()
Add a new "clip" parameter to gimp_drawable_merge_filter().  When
set to FALSE, the function resizes the drawable to the bounding box
of the filter's output, instead of clipping the output to the
drawable's boundary.
2019-08-02 00:40:01 +03:00