Commit Graph

43975 Commits

Author SHA1 Message Date
Michael Natterer c08186e6fe libgimp*: fix some parameter inconsistencies to silence GI warnings 2019-08-07 22:05:12 +02:00
Michael Natterer f90e19091d libgimpconfig: make GimpConfigWriter a boxed type 2019-08-07 21:51:30 +02:00
Jehan faf2db71cd plug-ins: improve Makefile.am of python/ subdir.
The old rules were crap and basically copying the scripts in build
folder before installing. Get proper/simpler rules.
2019-08-07 19:52:09 +02:00
Jehan 863c0849c8 desktop, plug-ins, tools: update various .gitignore. 2019-08-07 19:20:52 +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 7f0c801559 plug-ins: link goat-exercise against GTK 2019-08-07 18:47:24 +02:00
Piotr Drąg 3f5b435941 Update POTFILES.in and POTFILES.skip 2019-08-07 18:38:24 +02:00
Niels De Graef 39e4aa3c57 app/core: Use NULL for "simple" signals
Apart from being less code, this actually gives us a nice performance
improvement. Up until a few years ago, if you pass `NULL` as the
marshaller for a signal, GLib would fall back to
`g_cclosure_marshal_generic` which uses libffi to pack/unpack its
arguments. One could avoid this by specifying a more specific
marshaller which would then be used to immediately pack and unpack into
GValues with the correct type.

Lately however, as a way of optimizing signal emission (which can be
quite expensive), GLib added a possibility to set a va_marshaller, which
skips the unnecessary GValue packing and unpacking and just uses a
valist variant.

Since the performance difference is big enough, if the marshaller
argument is NULL, `g_signal_new()` will now check for the simple
marshallers (return type NONE and a single argument) and set both the
generic and the valist marshaller. In other words, less code for us with
bigger optimizations.

In case you also want va_marshallers for more complex signals, you can
use `g_signal_set_va_marshaller()`.
2019-08-07 16:33:10 +00:00
Ell 07b7d63a7d app: limit color-history palette size
Limit the color-history palette size (currently, to 256 colors), to
avoid slowdowns, especially during loading.
2019-08-07 19:20:52 +03:00
Ell e60829767e Issue #3718 - Large colorrc file causes lag when painting with a new color
In gimp_palette_mru_add(), if the added color doesn't match an
existing color, don't look for two duplicate existing colors (which
has quadratic complexity), since there shouldn't be any under
normal circumstances (as we're not adding duplicates to begin
with).
2019-08-07 19:20:52 +03:00
Jehan 6ed3b4898c plug-ins: goat-exercise improved to show a dialog.
This just adds a dialog before running the actual processing of data.
- it also shows what the run-mode is for;
- the purpose of the plug-in becomes explicit (plug-in creation
  documentation);
- it shows some GTK+ code too.
- last but not least, the code is actually shown for people to study,
  with a button to access the last version of the code on gitlab.

This makes the plug-in a lot more useful and understandable this way.
Other exercise plug-ins in other languages will have to do the same
thing.
2019-08-07 16:13:49 +02:00
Jehan fc620ee67e libgimp: read and write channel should be boxed properties.
gpointer is not introspectable, and we should always prefer boxed types
over generic pointer types (thanks nielsdg!).
This also fixes gjs (JavaScript) binding of our API which was dropping
our properties even though they didn't need to be handled in JS.

See https://gitlab.gnome.org/GNOME/gjs/issues/266
2019-08-07 12:31:17 +02:00
Michael Natterer 0ef65bc647 pdb: move gimp_plugin_set,get_pdb_error_handler() to gimplegacy.[ch]
Hide the PDB wrappers and add the same API to GimpPlugIn.
2019-08-07 11:01:53 +02:00
Michael Natterer 1e6abab1d3 libgimp: name parameters "procedure_name" not just "name"
and some random cleanup.
2019-08-07 10:43:07 +02:00
Jehan 6b17c942cf plug-ins: adding a hello-world plug-in in javascript.
It is not installed yet, I am just committing my first version. Further
version should look like goat-exercise as an example of what must be
done in javascript.
Also the plug-in stopped working with one of the recent libgimp commits,
without any change in the plug-in code. This will need to be
investigated before installing.
2019-08-07 00:53:17 +02:00
Michael Natterer 7b58cb1d28 libgimp: move most old gimp_pdb functions to gimplegacy.[ch] 2019-08-07 00:27:34 +02:00
Michael Natterer 64d880f1fe libgimp: add gimp_pdb_temp_procedure_name() and hide the PDB wrapper 2019-08-07 00:19:38 +02:00
Michael Natterer 2599c6e071 libgimp: add some const to input parameters, like const GimpValueArray*
for procedure arguments. This implies creating a new value array in
gimp_procedure_run() if the passed array is too short, instead of
just appending to the passed array, which was ugly anyway.
2019-08-07 00:04:58 +02:00
Jehan fc33489223 plug-ins: move goat-exercise to a goat-exercises/ directory.
We will fill this up with more examples of plug-ins in other languages.
Also we will improve a bit the examples to redirect people to source
code so that they understand what these plug-ins are.
2019-08-07 00:00:20 +02:00
Michael Natterer 877a116667 libgimp: fix typo in G_OS_WIN32 code 2019-08-06 23:54:34 +02:00
Michael Natterer 500a840f50 libgimp: forgot to add gimplegacy-private.h 2019-08-06 23:28:29 +02:00
Michael Natterer 3a943f4853 po-python, po-script-fu: update for new python plug-ins 2019-08-06 23:24:32 +02:00
Jehan f16ad87f2d plug-ins: add .gitignore files. 2019-08-06 23:22:18 +02:00
Michael Natterer cc5e9240d2 libgmp: move the remaining legacy code to gimplegacy, even PLUG_IN_INFO
Add gimplegacy-private.h to keep it separate from gimp-private.h.

The legacy code could now be removed and GimpPlugIn-ported plug-ins
would not notice.
2019-08-06 23:06:15 +02:00
Michael Natterer 3c001a6123 libgimp: separate legacy from GimpPlugIn wire communication
Move all old wire code to gimplegacy.c and add wire code to
GimpPlugIn, which now talks with the GIMP core all by itself.

Add some more ASSERT_NO_PLUG_IN_EXISTS assertions to gimplegacy.c and
fix new code that was still using legacy API.
2019-08-06 22:21: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 9a027140c8 libgimp: add read- and write-channel construct properties to GimpPlugIn
and change all GimpPlugIn-based code to get the channels from the
plug-in singleton instead of from the global variables.
2019-08-06 21:29:48 +02:00
Stas Solovey c65b507416 Update Russian translation 2019-08-06 19:01:13 +00:00
Jehan b20aab0236 libgimp: add annotations to gimp_pdb_run_procedure_array().
Especially as an example of setting a (rename-to) since variable
arguments are not introspectable, hence gimp_pdb_run_procedure() won't
be available for non-C plug-ins.
2019-08-06 19:29:00 +02:00
Michael Natterer d6d987ebac plug-ins: port plugin-browser to GimpPlugIn 2019-08-06 19:13:06 +02:00
Michael Natterer 84cb07f995 libgimp: add more comfortable ways to run procedures to GimpPDB
return_vals = gimp_pdb_run_procedure (pdb, "procedure-name",
                                      G_TYPE_STRING,  "string arg",
				      G_TYPE_INT      23,
				      G_TYPE_BOOLEAN, FALSE,
				      G_TYPE_NONE);
2019-08-06 19:13:06 +02:00
Michael Natterer 8860d78979 libgimp: more progress on the GimpPDB object
- add gimp_pdb_run_procedure()
- hide more functions in gimppdb_pdb.[ch], and add proper API
- add gimp_get_pdb() which returns the singleton
2019-08-06 19:13:06 +02:00
Jehan bfda31a67e configure: fix the Python checks.
1/ First I realize we were still using AM_PATH_PYTHON() and not
   AM_PATH_PYTHON3().
2/ We don't need to check anymore for pygtk, pycairo, nor do we need
   Python headers. Everything is now taken care of by GObject
   Introspection and we have nothing else to build GIMP-side.
3/ Change --enable-python into --with-python. We don't actually build
   anything now. There is no Python support to enable or disable
   anymore. We simply install Python plug-ins or not. The 3 values are
   "yes" (default, configure breaks if a Python 3 interpreter is not
   found), "no" (Python plug-ins are not installed, not recommended) and
   "force" (install Python plug-ins anyway even if an interpreter is not
   found; this can be useful especially for cross-compilation since
   Python is not useful at build-time anymore).

   Note that --with-python=force, if an interpreter is not found, the
   file `pygimp.interp` won't be installed. This is not a problem at all
   if the interpreter can be found at runtime the standard way.
   Otherwise packagers should add themselves a pygimp.interp file with
   the known interpreter path.
2019-08-06 18:35:53 +02:00
Jehan 079027fd03 m4macros: fix python3dev.
A quote in the comment section of the Python 3 test program was breaking
the AM_PYTHON3_CHECK_VERSION macro.
2019-08-06 18:20:37 +02:00
Jehan dc8f9dd168 plug-ins: add interactive run mode for palette-offset.
In interactive run-mode, the offset amount can be selected through a
small dialog box.
Only a WITH_LAST_VALS mode is still to be done.
2019-08-06 17:31:30 +02:00
Michael Natterer d8640d5b59 plug-ins: port procedure-browser to GimpPlugIn 2019-08-06 16:30:41 +02:00
Jehan 61c11b04c1 m4macros: Windows may have a versioned directory for headers.
Cf !84. We don't want to just replace the old path without versionned
python, because I assume it has been set for a reason. So there may be
machines with a versionned python path, others without. Let's test both
on Windows.
2019-08-06 16:26:27 +02:00
lillolollo 4d74452444 fix gtk version 2019-08-06 13:46:53 +00:00
Michael Natterer 468276e4d2 pdb: remove the section docs from unit.pdb
The functions are all private and the section is already documented in
libgimpbase.
2019-08-06 12:55:34 +02:00
Michael Natterer 05baadcd1d pdb: rename the "procedural_db" PDB group to just "pdb" 2019-08-06 12:51:56 +02:00
Michael Natterer 450a9f90b4 libgimp: add a GimpPDB class and subclass GimpProcedure as GimpPDBProcedure
The idea is that we already have a GimpProcedure object in libgimp
which has name, help, blurb, arguments, return values and everything,
so we really don't need a parallel API to query PDB procedures for
their properties.

- make run() a virtual function of GimpProcedure
- move GIMP_PDB_ERROR to GimpPDB
- GimpPDBProcedure is a trivial subblass which populates
  GimpProcedure's members by querying the PDB.
- make "plug-in", "procedure-type" and "name" construct-only
  properties of GimpProcedure.

This is all work in progress.
2019-08-06 12:22:23 +02:00
Jehan 82ada55b99 plug-ins: port palette-offset to Python 3.
Oups, I left the plug-in as Python 2. This was still a good
proof-of-concept that GIMP 3 will support as well Python 2 and Python 3
(even though Python 2 is end-of-life soon anyway).
2019-08-06 01:03:31 +02:00
Jehan dca353f8cd plug-ins: port palette-offset to new API.
This first version will just offset by 1 in interactive mode, by
default. The GIMP 2 version used to have a GUI, but it was not created
by the plug-in itself. I am guessing that maybe our Python wrapper used
to create GUI by default.
If so, this will have to change. Python plug-ins will be responsible of
their own GUI, just like C plug-ins.
2019-08-06 00:40:37 +02:00
Jehan 35d4b68edc plug-ins: add a "palette" argument to palette-to-gradient.
Older palette-to-gradient used to have a palette argument. Bring it
back. The logics is that if the string is empty or None, the procedure
will use the currently selected palette. Otherwise it will try to
transform the named palette into a gradient and will fail with an error
if this palette does not exist.
2019-08-06 00:29:33 +02:00
Kristjan SCHMIDT 718941a567 Update Esperanto translation 2019-08-05 21:47:11 +00:00
Jehan 17eb4c551f Revert "libgimpbase: fix/improve docs/annotations."
This partly reverts commit d999248d70.

The GimpStringArray is still very weirdly handled, in particular
regarding the difference of processing with static_data set or not.
Still this g_return_val_if_fail() was making more problems. It may come
back but will need more coding to handle the side effects.
2019-08-05 23:43:44 +02:00
Michael Natterer eacda4bb50 libgimp: remove includes and add "Since: 3.0" in gimpprocecure.c 2019-08-05 23:33:49 +02:00
Michael Natterer eaefe4f9d9 libgimp: fail gimp_procedure_new() on non-canonical procedure names 2019-08-05 23:22:39 +02:00