Commit Graph

48110 Commits

Author SHA1 Message Date
Jehan 3e1c914358 plug-ins: fix file-gih.
"sel" argument was wrongly numbered.
2022-02-12 00:07:53 +00:00
Jehan a9e443fe4a plug-ins: fixing "file-glob" with the new GStrv return value.
Tested with:

> c = Gimp.get_pdb().lookup_procedure('file-glob').create_config()
> c.set_property('pattern', '/home/jehan/*.png')
> r = Gimp.get_pdb().run_procedure_config('file-glob', c)
> r.index(1)
2022-02-12 00:07:53 +00:00
Jehan 87916e5069 libgimpbase: pass a NULL GStrv as an empty GStrv.
NULL is not a proper value for GStrv yet we cannot escape it in the PDB
since we generate default values for non-passed arguments (especially in
interactive case where most procedure arguments aren't set). And for
such boxed type, it will be NULL.

So when we see a NULL GStrv parameter, let's not ignore it (which will
just crash the plug-in). Simply transform it to a GStrv of size 0.
2022-02-12 00:07:53 +00:00
Niels De Graef 1e34a95db7 app, libgimp: pdbgen for previous commit. 2022-02-12 00:07:53 +00:00
Niels De Graef 8eb7f6df9e Remove GimpStringArray in favor of GStrv
GLib has a specific type of NULL-terminated string arrays:
`G_TYPE_STRV`, which is the `GType` of `char**` aka `GStrv`.

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

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

Related: https://gitlab.gnome.org/GNOME/gimp/-/issues/5919
2022-02-12 00:07:53 +00:00
Hugo Carvalho 406247a1d1 Update Portuguese translation 2022-02-11 23:29:20 +00:00
Jehan 6c5a3d96b3 NEWS: update. 2022-02-11 18:05:59 +01:00
Jehan 43f44288ef libgimp: new gimp_pdb_run_procedure_config() function.
While we do have quite a few gimp_pdb_run_procedure*() functions now, I
always felt that one based on a config file was missing, even more as we
are getting further and further into using config objects in plug-ins.

In C, the gimp_pdb_run_procedure() function is without a doubt the
easiest one. But such variable arg functions are not available on
bindings, and having to deal with GValue and GimpValueArray is a real
pain.

Also using a config file has the very great advantage that we don't need
to care about order. For instance, if I need to set the 10th argument of
a PDB call (and leave the rest to default values), I don't have to set
all 9 previous arguments. I can set only this one if I want. This
advantage is useful also for C code by the way.

For the record, here is how you could load then export an image with the
"file-png-*" PDB procedures in Python:

> c = Gimp.get_pdb().lookup_procedure('file-png-load').create_config()
> c.set_property('file', Gio.file_new_for_path('/path/sample.png'))
> r = Gimp.get_pdb().run_procedure_config('file-png-load', c)
> d = Gimp.Display.new(r.index(1)) # Give it a display to work on it.

Now exporting:

> img = r.index(1)
> c = Gimp.get_pdb().lookup_procedure('file-png-save').create_config()
> c.set_property('image', img)
> c.set_property('file', Gio.file_new_for_path('/path/exported.png'))
> layers = img.get_layers()
> c.set_property('drawables', Gimp.ObjectArray.new(Gimp.Drawable, layers, False))
> c.set_property('num-drawables', len(layers))
> r = Gimp.get_pdb().run_procedure_config('file-png-save', c)
2022-02-11 17:56:42 +01:00
Jehan 0734ac2aec libgimp: fix gimp_procedure_config_get_values().
The config object has one additional property per construction, which is
the "procedure" property.
2022-02-11 17:42:39 +01:00
Jehan e7a7edd29c libgimpconfig: fix gimp_config_param_spec_duplicate() for objects and…
… object arrays.

We were not supporting duplicating object pspec for no good reason. Well
maybe the reason was that libgimpconfig does not see these types which
are in libgimp. But then the trick is to compare by name.

As for object array, they are present as subtypes of GimpArray specs.
Yet most GimpParamSpec*Array-s are subclass of GimpParamSpecArray but
GimpParamSpecObjectArray are their own GParamSpecBoxed subclass (same as
the Gimp*Array-s are just typedef-s of GimpArray but GimpObjectArray is
its own boxed type).
So I had to move the object array test as its own case to fix support.

Finally do not ignore anymore any type in gimp_config_class_init(). When
we create a GimpConfig, we want to know when a type is not implemented
as parameter (and if it's a well known type, we need to implement it).
2022-02-11 17:31:30 +01:00
Jehan e6350f9459 libgimpconfig: this is the appropriate fix for the previous assert.
Since the parsing failure I was experiencing was normal (not a bug), and
since I was not seeing error being passed down to deserialize(), I
assume this assert was always wrong. I hadn't realize that the GError
object was in fact populated by deserialized through g_scanner_error()
calls which were setting the GError passed at creation of the scanner
through a handler.

So there was indeed a bug in one of the functions called by our
deserialize() implementation. There was one failure case where the error
was just reported with g_warning() instead of g_scanner_error().

Now that it's fixed, I brought back the asserts (previous commits)
because the error object is actually always well populated.
2022-02-10 22:18:03 +01:00
Jehan f4c7ea7e02 Revert "libgimp, libgimpconfig: gimp_config_deserialize_file() should not…"
This reverts commit 73c0ee8da7.

Actually I was wrong, there was a bug in gimpconfig-deserialize.c. See
coming commit.
2022-02-10 22:18:03 +01:00
Jehan 1ed8ed8223 Revert "libgimpconfig: remove more g_assert()."
This reverts commit 40bebec273.

Actually I was wrong, there was a bug in gimpconfig-deserialize.c. See
coming commits.
2022-02-10 22:18:03 +01:00
Yuri Chornoivan 30b6d1ad0a Update Ukrainian translation 2022-02-10 20:46:35 +00:00
Yuri Chornoivan 1020e0544f Update Ukrainian translation 2022-02-10 20:43:27 +00:00
Jehan 40bebec273 libgimpconfig: remove more g_assert().
As discussed with mitch on IRC, these asserts make no sense. They can
happen if we fail to parse user-side data. Also currently deserialize()
does not even pass the GError down so we would always assert on failed
parsing.

What must be done instead if change the signature of deserialize() and
all its implementations, with a GError arg. Then this GError will
properly bubble up to the caller for appropriate handling.
2022-02-10 21:27:33 +01:00
Jehan 7131c220a8 NEWS: update. 2022-02-10 21:23:23 +01:00
Jehan b301dbee78 Issue #526: Import/Export Windows cursor files (.CUR).
MR !565 was only a partial implementation as it was assuming all cursors
had the same hot spot coordinates in the file, which is false more often
than not (since usually it's several sizes for the same image, hence
coordinates move). I should have realized this before merging.
With this new commit, we actually loads the hot spot coordinates per
cursor, stores them as per-layer parasites, then exports with per-cursor
coordinates.

Also it makes the procedure API use int32 array (should be int16 but we
removed the support, now I think it may have been a mistake) which shows
the ugliness of our array support once again with additional size args
per array (even if it's the same size). Also I realize that our support
of arrays with config object is not good. This is also something we'll
have to look at.
2022-02-10 18:44:44 +01:00
Jehan 73c0ee8da7 libgimp, libgimpconfig: gimp_config_deserialize_file() should not…
… assert the existence of GError.

This is even worse as deserialize() method does not even take a GError
parameter anyway so this assert will always go off when a
deserialization failed (which happened in my case as I was working on a
plug-in API, hence gimp_procedure_config_load_last() actually failed to
load a previous version of the plug-in-settings when I changed a
procedure arg's type).

Just fail the deserialization normally and let the calling code handling
this case. Nevertheless it is kind of useful to bubble-up the error to
calling code, so I add a TODO in the interface header (hopefully to see
and improve this before we release GIMP 3.0).
2022-02-10 18:44:44 +01:00
Hugo Carvalho ef3549648f Update Portuguese translation 2022-02-10 13:50:02 +00:00
Hugo Carvalho ef677336c5 Update Portuguese translation 2022-02-10 13:40:52 +00:00
Jehan d131c6a363 plug-ins: fix magics for .cur and .ico. 2022-02-10 13:27:24 +01:00
Nikc a22fd4f43a Issue #526 - Add Import/Export for Windows .CUR files 2022-02-10 12:09:40 +00:00
Jehan d25b7301d6 plug-ins: fix the ORA thumbnail load procedure.
- Fix return value in error case: s/GObject.Error/GLib.Error/ and anyway
  in this form, the error should be a string. Using the easier form
  procedure.new_return_values() instead.
- "file-png-load" uses a GFile now (like all load procedures).
2022-02-09 22:56:42 +01:00
Jehan 7b220257da app: GimpThumbnailProcedure expects a GFile too.
This was the reason why no thumbnail procedure was working on the dev
branch.
2022-02-09 22:31:24 +01:00
Jehan 5aae429cd6 app: properly report thumbnail creation errors.
There were some comments claiming we don't care about thumbnail creation
errors, only thumbnail saving. It's not true. Thumbnail creation errors
are probably even more important (in this specific usage). For instance,
trying to debug a thumbnail load procedure, I had no clue on the error
even though our system was able to report the issue. It's not cool for
plug-in developers.

Now we will check the thumbnail creation error, write down the error
message on stderr and clear the error for the fallback round (using the
normal file load proc). Then if it errors out again, we will keep this
error as the finale one because it's probably more important if we can't
even open images than the unrelated thumbnail saving error. We will
still return the saving error if the load proc failed without error.
2022-02-09 22:30:03 +01:00
Jehan 5b01290f94 all, libgimp, pdb: some alignment and param description fix. 2022-02-09 21:23:33 +01:00
Jehan 5e7bcc291b icons: add COPYING files for icon themes.
Our Symbolic icon theme comes from the art-libre theme now archived by
the GNOME design team. It had various authors, including originally
Jakub Steiner and Barbara Muraus, then jEsuSdA, Klaus Staedtler,
Alexandre Prokoudine and Aryeom Han. Various other people tweaked the
icons and may have contributed. See the git log for details.

The Color icon theme is more of an original work by Klaus Staedtler, as
I understand it, with some additional icons by Alexandre Prokoudine,
Aryeom Han and other contributors. See the git log for details.

This makes licensing clearer for these specific subsets of the project.
2022-02-09 16:31:22 +01:00
Jehan bcdb1cdb6a Issue #7837: gimp_installation_directory() in macOS doesn't know about…
… extensions yet.
2022-02-09 12:47:37 +01:00
Jehan 023ca21c96 NEWS: update. 2022-02-09 00:44:10 +01:00
Jehan 35cef54899 app: fix handling multi-drawables selected in bucket fill tool.
We were getting a critical when selecting multiple drawables (either
changing layer selection while the tool is ON, or starting with multiple
selection). We should not have assert code here, just handle the case
gracefully with a normal error message when trying to fill on several
layers at once.
2022-02-09 00:27:04 +01:00
Jehan e7668c03bd app: add some new feature to close line arts manually.
The line art algorithm is useful but not always accurate enough and
sometimes it can even be counter-productive to fast painters.

A technique of advanced painters which Aryeom uses and teaches when she
wants to close an area without actually closing the line art (i.e. the
non-closed line is a stylistic choice) is to close with a brush the area
on the color layer. It has also a great advantage over the line art
"smart" closing algorithm: you control the brush style and the exact
shape of the closure (therefore something you'd usually have to redo
with a closure made by an algorithm as you would likely not find it
pretty enough).
This new feature takes this technique into account. Basically rather
than relying on the closure algorithm, you would close yourself and the
tool is able to recognize closure pixels by the color proximity with the
fill color.

Final point is that this additional step is made after line art
computation i.e. in particular the target drawable is not added to the
sources for line art logics. This allows to stay fast otherwise the line
art would have to recompute itself after each fill.

This also shows why the previous commit of moving the line art object
was necessary, because a painter would likely want to move regularly
from bucket fill to a brush tool to create area closures and we want to
avoid recomputation every time.
2022-02-08 23:45:22 +01:00
Jehan 8a3ff1a7b6 devel-docs: move HACKING from root EXTRA_DIR to devel-docs one.
Also adding the CODING_STYLE.md. There is actually the question whether
we still want to track this docs files to package them in the tarballs.
It made sense 20 years ago when devs were working from tarballs, but
nowadays, devs are expected to work from git HEAD.

Anyway this fixes the CI.
2022-02-08 23:45:22 +01:00
Jehan 0db35973c8 app: temporarily move GimpLineArt ownership to context when bucket…
… fill tool finalizes.

The idea is that you may want to quickly switch tool to do something and
back to the bucket fill for line art selection. If the input drawable(s)
did not change, the previously computed data is still valid, so let's
hang on the line art object a little longer.
Since we are resetting the input when we get back, we would still
recompute anyway *if needed*, and the line art object does follow
changes on the input pickable so we would not get any deprecated data
anyway. Still we move around ownership a tiny bit to optimize for
common case of tool switching.

In order not to keep forever this data (buffer and distmap in
particular) forever just because one tried the line art once, I add a
timer to free it after a few minutes.

Moreover it will be useful for other cases, such as being able to share
the same line art object with the fuzzy select tool (if we end up adding
the line art option there). In a coming commit, the usage will be even
more obvious for use case where you want to edit the filled area with
other paint tools, then back to bucket fill while not touching the line
art source layer.
2022-02-08 23:45:22 +01:00
Lukas Oberhuber 5ad5f67ad0 goat-exercises: fix vala build problem
Problem appeared on mac and also on debian unstable. This is autotools
only as `--disable-since-check` is present
in meson.build.

Fix suggested by @nielsdg.

```
make[3]: Entering directory '/Users/distiller/.cache/jhbuild/build/gimp/extensions/goat-exercises'
  CC       goat-exercise-c.o
/Users/distiller/gtk/inst/bin/intltool-merge /Users/distiller/gtk/source/gimp/po-plug-ins org.gimp.extension.goat-exercises.metainfo.xml.in org.gimp.extension.goat-exercises.metainfo.xml -x -u -c ../../po-plug-ins/.intltool-merge-cache
  VALAC    goat_exercise_vala_vala.stamp
Generating and caching the translation database
  CCLD     goat-exercise-c
/Users/distiller/gtk/source/gimp/extensions/goat-exercises/goat-exercise-vala.vala:28.10-28.18: error: `Gimp.main' is not available in gimp-3.0 2.99.9. Use gimp-3.0 >= 3.0
  return Gimp.main(typeof(Goat), args);
         ^^^^^^^^^
```
2022-02-08 15:24:15 +00:00
Matej Urbančič 3e697596fb Update Slovenian translation 2022-02-07 18:21:55 +00:00
Matej Urbančič 6f31db5a4d Update Slovenian translation 2022-02-07 18:21:29 +00:00
Jehan bad465c681 README, devel-docs: reorganize a bit the main README and devel docs.
- ps-menurc removed in GIMP 2.7.2 (i.e. stable 2.8.0) according to
  NEWS.pre-2-8.
- in our main README, redirect now to devel-docs/README.md as entry
  point for contributors.
- move HACKING to devel-docs/ and specialize it into a "how to build
  from git and contributed" docs:
  * Make it markdown.
  * Remove some now obsolete or redundant recommendations (to be fair,
    we can probably clean up the file a bit more, but we'll see).
  * Add/improve relevant information.
  * Make more obvious when you want to build from tarball or git.
  * Just keep a single short paragraph about the coding style to
    redirect people to the appropriate CODING_STYLE.md file.
  * Don't recommend sending patches to the mailing list anymore.
- move CODING_STYLE.md to devel-docs/.
2022-02-07 15:45:28 +01:00
Lukas Oberhuber 6de9ea7022 macos: reduce frequency of coordinates refresh
This change reduces to 3.33 times a second, the updates to the
status bar coordinates widget.
This dramatically improves frame rate on macOS retina displays
because it reduces the frequency of full screen updates which
are triggered by this widget updating and are very slow.

This makes the statusbar refresh changes mac only where the
benefit will be felt keenly, rather than saddling all
platforms with the change.
2022-02-07 13:44:46 +00:00
Lukas Oberhuber dd6c104d2e macos: version 10.7 long no longer supported 2022-02-07 13:34:04 +00:00
Jehan 82899764a3 app, INSTALL: remove our Windows-only trick to add user-installed fonts.
This was added in commit 88f97aedef and only expected to last until
fontconfig had a fix **and** it got into a released version.
This is now done.

I could verify in the git repo that fontconfig's commit 55eb1ef is
included since their tagged release 2.13.95 which is now on MSYS2
(2.13.96 there even), so we will use it for our next release.

Thanks to frogonia (long time no see! \O) for following up on this!

See also fontconfig report:
https://gitlab.freedesktop.org/fontconfig/fontconfig/issues/144
2022-02-07 14:24:52 +01:00
Hugo Carvalho 0c9e7adf86 Update Portuguese translation 2022-02-06 21:52:43 +00:00
Hugo Carvalho 5a8d3d3b87 Update Portuguese translation 2022-02-06 21:50:49 +00:00
Anders Jonsson f119621dae Update Swedish translation 2022-02-06 20:12:35 +00:00
Luming Zh 590611a1c4 Update Chinese (China) translation 2022-02-06 03:17:08 +00:00
Jehan 1bc3fd4557 app: gimp_source_core_set|get_property() are now useless. 2022-02-05 14:25:33 +01:00
Jehan 4c8f50cb23 Issue #287: Impossible to stroke a path with the clone tool.
Actually we had half of the fix already with my recent change to source
tools giving the ability to clone from multiple source drawables where I
moved the source drawables from GimpSourceCore to GimpSourceOptions (see
commit 6ad00cdbba). The problem is that gimp_vectors_stroke() is using
the context paint options, but it is creating a brand new paint core
just to stroke the path. Hence with my recent changes, the drawable
sources were finally available to the path stroke, yet not the source
position. So stroking with clone was always starting on position (0, 0)
on the source.

This is now fixed by moving also the position properties "src-x" and
"src-y" on the GimpSourceOptions. This makes this info finally
accessible to the core when running the source tools this way.

Thanks to Eneko Castresana Vara for their initial contribution.
Unfortunately the code had diverged too much for it to be usable because
of our much too late review so a different fix had to be done.
2022-02-04 23:25:38 +01:00
Yuri Chornoivan 181e7de2c9 Update Ukrainian translation 2022-02-04 20:47:54 +00:00
Jehan 3e58869dbf libgimp: missing new API in def file.
Ahahah. So many years and I still forget this annoying def file! :P
2022-02-04 18:17:20 +01:00
Jehan d5f832d7a6 NEWS: update with the dynamics changes. 2022-02-04 15:31:55 +01:00