Commit Graph

46380 Commits

Author SHA1 Message Date
Jehan 3fb2ff1b9d libgimp: improvements to GimpProcedureDialog API.
- New gimp_procedure_dialog_fill_box(_list)() functions to create a
  GtkBox in the layout.
- Generating widgets for parameters of type double (and computing
  appropriate "ok defaults" digits for these, depending on the min-max
  range of the property).
2020-11-24 20:55:03 +01:00
Jehan e53ce2fde9 libgimp: output a "saving metadata failed" message when relevant.
Similar to the message present in file-jpeg. The latter will anyway
disappear when we will have finally ported file-jpeg to newer
GimpSaveProcedure API, and it's better to have it outputted here so that
it will work for every export formats.
2020-11-24 20:55:03 +01:00
Thomas Manni 5bbc7899bc menus: remove PaintSelect tool from the menus...
...as long as it stays in the playground.
2020-11-24 20:13:04 +01:00
Yuri Chornoivan 0b27fec6f9 Update Ukrainian translation 2020-11-24 19:07:24 +00:00
Yuri Chornoivan d3260b594b Update Ukrainian translation 2020-11-24 18:59:05 +00:00
Thomas Manni 9e391bc3b6 app: Paint Select tool, reflect changes applied to the gegl operation...
...related to fluctuations removal.
2020-11-24 19:02:30 +01:00
Thomas Manni e1cdb9f54e app, icons: add Paint Select tool in the playground
A -quick done- first step towards the addition of a smart selection tool.
Require the gegl:paint-select workshop operation.
Still LOT of work to do (wip):
- fluctuations removal (GEGL side)
- multilevels pyramid approach + banded graphcut for instant result on large
   image (GEGL ? GIMP ?)
- Gaussian Mixtures for color models (GEGL side)
- drawable offsets (GIMP side)
- undo / redo (GIMP side)
- scribbles edition mode (GIMP side)
- dedicated icons
- ...
2020-11-24 12:10:40 +01:00
Jehan 3e67d7d676 plug-ins: file-tiff using the new dialog generation. 2020-11-23 02:15:13 +01:00
Jehan 56bfda3dd3 plug-ins: update file-png to new metadata handling.
The plug-in GUI code keeps slimming down. :-)
2020-11-23 02:15:13 +01:00
Jehan 3918a0a04c libgimp: new metadata support concept in GimpSaveProcedure and new…
… class GimpSaveProcedureDialog.
The idea is that we have basically the same code in most file format
plug-ins to handle various generic metadata, yet usually with slight
differences here and there. Even behavior is sometimes a bit different
even though there is no reason for the logics to be different from one
format to another.

So I move the metadata support logics into GimpSaveProcedure (and
GimpProcedureConfig still keeps the main export logics). The GUI logics
is now in a new GimpSaveProcedureDialog. So export plug-ins will now get
the creation of generic metadata nearly for free. All they have to do is
to tell what kind of metadata the GimpSaveProcedure supports with the
gimp_save_procedure_set_support_*() functions.

Then consistency will apply:
- If a format supports a given metadata, they will always have an
  auxiliary argument with the same name across plug-ins.
- The label and tooltips will also be always the same in the GUI.
- Order of metadata widgets will also stay consistent.
- The widgets will work the same (no more "Comment" text view missing in
  one plug-in but present in another, or with an entry here, and a text
  view there, and so on).

Also adding gimp_save_procedure_dialog_add_metadata() to allow plug-ins
to "declare" one of their options as a metadata option, and therefore
have it packed within the "Metadata" block which is now created (for
instance for PNG/TIFF/JPEG specific metadata). This allows a nicer
organization of dialogs.
2020-11-23 02:15:13 +01:00
Piotr Drąg ae4daf9465 Update Polish translation 2020-11-22 13:42:42 +01:00
Jehan f9f516a99a libgimpwidgets: fix missing doc comments and annotations. 2020-11-20 11:36:11 +01:00
Jehan 9f03bdce30 libgimpwidgets: fix the def file. 2020-11-20 10:10:47 +01:00
Jehan c58b7ad80b libgimp: mnemonic duplicate verification in GimpProcedureDialog.
A very common issue we have with dialog creation is good mnemonics. In
particular, we want to:
* Keep consistent mnemonics for common features (basically the core
  buttons) common to all plug-in dialogs.
* Have mnemonics for all options.
* Avoid duplicate mnemonics if possible.

Mnemonics are a usability/accessibility feature which can be important
for people using the keyboard a lot (not necessarily only because they
prefer keyboard, but also possibly because of various disorders).

This code will check at runtime that there are no missing or duplicate
mnemonics and simply print to stderr. We don't want to bother overly the
users about these, but we want developers and translators to be aware
about these so that they can easily spot and fix them.
2020-11-20 09:37:26 +01:00
Jehan 4511de4268 plug-ins: file-tiff dialog now generated too.
72 lines smaller according to git stats. And once again, this is WIP and
may even get smaller with the new ideas I got.
2020-11-20 01:47:18 +01:00
Jehan cd0ac72314 libgimp: generated text buffer should also have a tooltip taken from…
… the property blurb.
2020-11-20 01:47:18 +01:00
Jehan bc3602a787 libgimpwidgets: new gimp_label_int_widget_get_widget() function. 2020-11-20 01:47:18 +01:00
Jacob Boerema 3128047a0b plug-ins: in metadata editor and viewer only convert values to UTF-8 if they are not.
Certain metadata is already UTF-8. Converting them from locale
to UTF-8 again leads to incorrectly shown strings.
2020-11-19 23:25:27 +00:00
Jacob Boerema d004305019 plug-ins: fix metadata-editor not saving Xmp.photoshop.Urgency and Xmp.xmpRights.Marked.
The values of Description tab - Copyright Status and IPTC tab - Urgency were not saved.
We are fixing that with this commit. Urgency is also saved to Iptc.Application2.Urgency.
2020-11-19 23:25:27 +00:00
Jacob Boerema 47065df53c plug-ins: let metadata-editor also save Iptc tags. 2020-11-19 23:25:27 +00:00
Jacob Boerema 96c5d1c1a1 plug-ins: add missing Iptc equivalents of Xmp tags in metadata-editor.
Also added a comment to Xmp.photoshop.CaptionWriter which
occurs twice in the list.
2020-11-19 23:25:27 +00:00
Jacob Boerema 7cce45b377 plug-ins: In metadata-editor always read iptc equivalent values of xmp tags.
Iptc equivalent tags of Xmp tags were only read if the Xmp tag had no value
which doesn't make sense since there is no guarantee that they are the same.

We changed this to always read the Iptc tags too and if the value differs
from the Xmp tag we add both values. That way the user can decide
which values are relevant.
2020-11-19 23:25:27 +00:00
Jacob Boerema 879b3745d2 plug-ins: fix not showing all values of iptc tags that appear more than once.
This is one of the problems mentioned in issue #5863. This commit fixes
this problem in the metadata-editor by using gexiv2_metadata_get_tag_multiple.
Empty string values will be skipped.
2020-11-19 23:25:27 +00:00
Jacob Boerema bd2f43bf20 plug-ins: Refactor cleaning xmp values into a separate function in metadata-editor.
The same code was used several times so we move it to  its own function.
2020-11-19 23:25:27 +00:00
Jacob Boerema c855590ffa plug-ins: fix incorrect struct used for comparison in metadata-editor. 2020-11-19 23:25:27 +00:00
Jacob Boerema 786aaec2a3 plug-ins: fix incorrect single/multi(ple) values for certain iptc tags used in metadata editor. 2020-11-19 23:25:27 +00:00
Jacob Boerema 26db975a84 plug-ins: fix incorrect reading of iptc tags that appear more than once.
This is one of the problems mentioned in issue #5863. This commit only fixes
this problem in the metadata-viewer.
2020-11-19 23:25:27 +00:00
Jacob Boerema 599d91db54 plug-ins: Refactor certain string handling into separate functions in metadata-viewer. 2020-11-19 23:25:27 +00:00
Jacob Boerema d0f67faf29 libgimpbase: fix incorrect reading of iptc tags that appear more than once.
This is one of the problems mentioned in issue #5863. This commit only fixes
our loading (and saving) of this metadata.
Certain iptc tags like "Keywords" can appear multiple times. We were using
gexiv2_metadata_get_tag_string to get the value but that always returns
the first value so we replaced that by gexiv2_metadata_get_tag_multiple.
2020-11-19 23:25:27 +00:00
Jehan 501675b8a3 plug-ins: file-png now uses generated dialog.
Basically the same design as before (but a bit prettier, by using a
2 columns flowbox rather than a grid), yet 80 lines smaller according to
git stats. Also still the exact same code logics as before. No feature
loss (and actually a feature gain as there was the "Save comment"
checkbox but no text field to edit the comment as we get in other
plug-ins).

Basically better and prettier dialog in just a few lines. Moreover it's
still work-in-progress. We can even do better, but this is things to
come.
2020-11-20 00:22:21 +01:00
Jehan 5fa38d5765 libgimp: bug fixes and design improvements for generated widgets. 2020-11-20 00:06:27 +01:00
luz paz bb322d94d7 Fix typos
Found via:
```
codespell -q 3 -S ./ChangeLog*,*.po,./.git,./NEWS* -L als,ang,ba,chello,daa,doubleclick,foto,hist,iff,inport,klass,mut,nd,ower,paeth,params,pard,pevent,sinc,thru,tim,uint
```
2020-11-19 21:56:25 +01:00
Милош Поповић 0b040dc109 Update Serbian translation 2020-11-18 20:39:29 +00:00
Tim Sabsch 02142e92f7 Update German translation 2020-11-17 16:06:14 +00:00
Jehan de91d84906 meson: libjpeg and libtiff are not optional dependencies! 2020-11-17 04:08:15 +01:00
Jehan 3f59769120 INSTALL: update GEGL build instructions.
Recently updated my distrib, so it's a good time to see what is wrong in
our instructions. In particular, we must build GEGL with Cairo,
otherwise gegl:npd is not built (and it's a mandatory operation for
GIMP).
2020-11-17 03:55:42 +01:00
Yuri Chornoivan 22534f71b3 Update Ukrainian translation 2020-11-16 18:33:50 +00:00
Jehan 9a90eefe1f plug-ins: improvement of TIFF loading when TIFFNumberOfDirectories()…
… fails.
My previous commit was just assuming there is one page when the libtiff
function fails. But thinking a bit more on this, there are 2 edge cases
even here:

- If the image is actually really corrupted to the point there are no
  TIFF directories to read.
- If there are actually more available directories. It would be much
  better if GIMP were able to salvage them from a broken file.

To handle these cases, I actually count manually the number of
directories by looping with TIFFSetDirectory() (which still works fine
on our minimal image). I use 65535 as a max value because in libtiff's
TIFFNumberOfDirectories() implementation, it says this is the max value
(even though I couldn't confirm this in the spec; there is a "Number of
Directory Entries" on 2 bytes, but this is about various fields for each
directories, not a number of directories; still anyway this is already a
huge number and since libtiff won't likely be able to handle directories
over this limit, not need to go over either).

I am also adding a test in the end so that we can output an appropriate
message if we actually failed to read any data from the TIFF (whether or
not TIFFNumberOfDirectories() succeeded, when we actually tried to read
the contents, we couldn't).
2020-11-16 16:21:50 +01:00
Jehan 9ff0204230 Issue #5837: TIFF file not recognized.
On a provided minimal 1×1px TIFF file, TIFFNumberOfDirectories() seems
to choke on some missing field and returns 0. I am not sure if the file
is actually valid or not, but let's make some kind of exception
(outputting a warning of our own when we do) by assuming there is at
least 1 page/image in the file when TIFFNumberOfDirectories() returns 0.

Other than this minimal file (which probably has no other interest than
being a test case), it could actually help salvage corrupted TIFF file
by attempting to read more data.
2020-11-16 15:10:07 +01:00
Jehan 2a439ba21e NEWS: update. 2020-11-16 11:01:44 +01:00
Yuri Chornoivan 5d639dcd97 Update Ukrainian translation 2020-11-16 07:24:48 +00:00
Jehan 9c52af21ea app: better translatable text for "Indexed color" color space text…
… in Image properties window.

Basically using non-translatable "%s (%d %s)" and filling it with
"Indexed color" base type name and translatable _("colors") is very bad
practice (localization-wise):

- First it assumes everyone uses round brackets.
- It also assumes the order of words (number before word it determines
  but even the image type before detail brackets).
- And finally it doesn't handle plurals. Of course, we could say that
  the 1 color case is a very edge impractical case, but plural is not
  only about 1 vs other numbers. Some languages have more cases, and
  using ngettext allows translators to handle these.
2020-11-16 01:04:42 +01:00
Jehan b7796b0bfb app: improve sample text logics for CJK fonts.
First of all, "CJK Unified Ideographs" block should not be the highest
priority to determine showing an ideograph. Indeed most fonts for a
Korean and Japanese audience would also contain at least the main
ideographs. So instead, look first for Korean alphabet (Hangul) and
Japanese syllabaries to determine if it's a Korean or Japanese-targetted
font. Only then Chinese.
Also check Korean before Japanese because most of the Korean fonts I saw
actually also include Japanese syllabaries (but not the other way
around).
This way, it will be much easier for CJK graphists to skim through the
font list and detect fonts made for the needed language in a glance.

Also modifying the Korean display text. KIYEOK and SSANGKIYEOK were
obviously chosen because they were the first in the block. But they are
very bad choice. We hesitated with 가 at first, as it is considered the
first in the syllabary form (가나다라 is kind of similar to our ABCD).
But it wouldn't show a form with a second consonant (below) which is a
good stylistic indication. So we hesitated between 한 (han) and 글
(geul, which also means text so it's a nice sample), and finally went
with 한 because of the circle shape in ㅎ (hieut) but also its small
"hat" which has many stylistic variants. So it's quite a good hint of
stylistic choices made by a font designer from just the sample box.

Moreover I switched the block check from "Hangul Jamo" to "Hangul
Syllables" block. "Hangul Jamo" are positional forms of the letters to
dynamically compose syllables (in particular legacy syllables not in use
anymore). Though a feature-full Korean font set would design these, it
is less important than "Hangul Syllables" (pre-composed syllables
design) or "Hangul Compatibility Jamo" (basically the same letters as
"Hangul Jamo" but for standalone usage). Also I actually saw some fonts
made for Korean without "Hangul Syllables" support.

Finally I also added a test for Japanese. I check the Hiragana block
which is most likely the most basic which has to be in any
Japanese-targetted font and use 'あ' (a) as sample text, which is the
first Hiragana syllable and here definitely a good sample text in my
opinion.

I believe that this can still be improved though. Checking only a single
block to determine the probable target language is not necessarily
enough. For instance very complete fonts for Chinese may also design
Korean and Japanese characters, but will also have most CJK blocks and
more ideographs (whereas Japanese/Korean will likely have less). Yet
let's say this is good for now, at least better than before!
2020-11-15 21:55:32 +01:00
Jehan b19e7796b2 app: s/pango_fc_font_has_char/pango_font_has_char/ (undeprecation). 2020-11-15 17:25:49 +01:00
Jehan 7a50b0940e app: undeprecate some Pango/Harfbuzz calls.
pango_fc_font_lock_face() is deprecated since Pango 1.44.

This may hopefully also fix #5922 as I completely changed the code where
the CRITICAL happened. Yet I left g_return_val_if_fail() to check if the
Harfbuzz font and FreeType face variables are not NULL (because looking
at the code, it looks like these functions returning NULL actually means
there is a bug in the code).

Nevertheless if it turned out that there are non-bug cases where these
could return NULL (for instance a broken font file?), then probably we
should not use g_return_val_if_fail(), but instead address the data
issue in a nicer way.

Bumping harfbuzz dependency to 1.0.5 for hb_ft_font_set_funcs(). Without
configuring the Harfbuzz font with it, hb_ft_font_get_face() always
returns NULL.
Note that it looks like hb_ft_font_lock_face() would actually be better,
but this requires harfbuzz 2.6.5 from last April which is quite recent.
So let's just use the get_face() variant for now.
2020-11-15 17:15:45 +01:00
Cristian Secară 4dd64e75c3 Update Romanian translation 2020-11-15 12:15:54 +00:00
Jehan 4485296bdc libgimp: fix timezone in IPTC tag Iptc.Application2.TimeCreated.
Existing implementation was repeating the hours and minutes. This was
obviously not what the format asked. The last hour and minutes are the
ones from the timezone offset. Also rather than playing with snprintf()
and various calls to get each component, let's use g_date_time_format()
which is done exactly for such use case.

It is to be noted that there seems to be a bug in Exiv2 such that the
date and time set through Exiv2 return an error when read back, still
with Exiv2. Read and write use different format. I have reported this
issue, together with a patch (hopefully a good one).
https://dev.exiv2.org/issues/1380

So once this patch (or another) gets merged upstream, the following
warnings (e.g. when reopening a PNG created by GIMP) should disappear:

> ** (file-png:176245): WARNING **: 02:43:25.204: Unsupported date format
> ** (file-png:176245): WARNING **: 02:43:25.204: Unsupported time format
2020-11-15 02:44:47 +01:00
Jehan 435d5ce83a libgimpbase: do not use g_snprintf() with same source and buffer.
`man snprintf` clearly says (in NOTES) that when source and target
overlap, the result in undefined.

g_snprintf() conforms to the same standard hence would not get the
expected result. In my case, the result was just tzstr (e.g. "+01:00").
2020-11-14 21:22:12 +01:00
Jehan 74eb2b1f8a libgimp, libgimpwidgets: re-argh - fix the def files too.
Should fix distcheck and Windows builds.
2020-11-14 17:29:50 +01:00
Jehan e16f5bc1a1 libgimpwidgets: argh forgot to edit the autotools Makefile too! 2020-11-14 16:50:13 +01:00