Commit Graph

48560 Commits

Author SHA1 Message Date
Jacob Boerema 7231ea54f8 libgimp: fix #1632 GIMP should not write to IPTC tag DateCreated
GIMP was saving the last changed/saved date to IPTC tag DateCreated,
which should only be used for the original creating date of the image
and thus should not be changed by GIMP.

After discussion in the cited issue, there is no tag in IPTC that we can
use, so we remove saving modified date from the IPTC metadata.

Instead we add two XMP tags, one for modified date and the other for the
date that metadata was changed. Since we do both when exporting, both are
saved with the same date/time in ISO 8601 format.

This also fixes another issue where we were not storing the timezone offset
for Xmp.tiff.DateTime. Since this has the same format as the other
XMP tags, we fix this together with this issue.
2022-06-06 19:03:13 -04:00
Anders Jonsson 5e16ef5ae3 Update Swedish translation 2022-06-06 21:20:54 +00:00
Yuri Chornoivan 26859e1ef6 Update Ukrainian translation 2022-06-06 17:02:26 +00:00
Alan Mortensen 8bfb2d65d9 Update Danish translation 2022-06-06 15:18:44 +00:00
Jehan 9ef10c8764 app: allow to disable the new version check altogether through a key…
… in the gimp-release file.

This will be useful to disable the update check for the Windows Store
even though we use the same build as the installer. All it will take
will be to append the line `check-update=false` to the file
`share/gimp/2.10/gimp-release` and it will behave as though the update
check is disabled (even though it is actually built-in).
2022-06-06 01:09:08 +02:00
Jacob Boerema a842869247 app: check for invalid offsets when loading XCF files
More safety checks for detecting broken xcf files, also based on examining
issue #8230.

After reading an offset where layer, channel, etc. data is stored, we
add a check to make sure that offset is not before where we read the
offset value. Because the data is always written after the offset that
points to it.
2022-06-05 18:52:15 -04:00
Jacob Boerema 24c962b95e app: check max dimensions when loading xcf files
Improvements in loading broken xcf files, based on examining issue #8230.
Besides checking for a minimum width and height, GIMP also has a maximum
size we can and should check.

In the case of the image itself, we change invalid dimensions to a size of
1 in hope that the individual layers etc will have the correct size.
For layer, we will also try to go on, but for channel and layer mask, we
will give up.
2022-06-05 18:52:15 -04:00
Jacob Boerema 22af0bcfe6 app: fix #8230 crash in gimp_layer_invalidate_boundary when channel is NULL
gimp_channel_is_empty returns FALSE if channel is NULL. This causes
gimp_layer_invalidate_boundary to crash if the mask channel is NULL.

With a NULL channel gimp_channel_is_empty should return TRUE, just like
the similar gimp_image_is_empty does, because returning FALSE here
suggests we have a non empty channel.
2022-06-05 18:52:15 -04:00
Nikc 93b9876405 plug-ins: fix #1106 Add CMYK/A loading for TIFFs
Adds support for loading 8 and 16 bit CMYK/A TIFF files with
attached color profiles.
2022-06-05 17:49:54 -04:00
Yuri Chornoivan d3cee62a3a Update Ukrainian translation 2022-06-05 08:43:34 +00:00
Yuri Chornoivan ebdb57a51c Update Ukrainian translation 2022-06-05 08:28:20 +00:00
Jehan b8d1046aa9 plug-ins: fix file-jp2-load build.
I guess I missed this one as I was not building it locally.
Fixes:

> In file included from ../plug-ins/common/file-jp2-load.c:86:
> ../plug-ins/common/file-jp2-load.c: In function ‘jp2_class_init’:
> ../libgimp/stdplugins-intl.h:42:22: error: ‘set_i18n’ undeclared (first use in this function)
2022-06-05 02:32:38 +02:00
Jehan 9905981471 NEWS: better localization API for plug-ins (#8124).
The logic now is not core plug-ins first, but rather any plug-in first.
2022-06-05 02:08:27 +02:00
Jehan 95abf39066 app, libgimp: reverse internal l10n logic of plug-in labels in core app.
I hesitated a lot whether we should just drop the whole localization of
plug-ins' label and description (blurb) within the core. Actually the
commit messages I wrote a few days ago were moving towards this logic.
It really looks to me like plug-in localization can happen fully within
plug-in themselves. As far as I can see, the only advantage which the
current logic has theoretically is that if we needed, we have access to
both the original strings and their translations (e.g. it could be
useful for text search). Nevertheless I am not sure if we will ever make
use of this, and this is limited cases as all filters turned GEGL ops
don't have such ability anyway.

Nevertheless since previous contributors clearly put quite a lot of work
on this code of localizing the plug-in's label and description within
the main binary, I want to give myself a little more time to think and
study the whole thing because doing anything rash.

In the meantime, what changes is that by default now, a plug-in without
a local gettext catalog is simply not localized. In particular, the core
process doesn't try to localize it using the default catalog, a.k.a.
GETTEXT_PACKAGE"-std-plug-ins" ("gimp30-std-plug-ins"). It just doesn't
make sense and the worst which could happen would be to get unexpected
and wrong translations.
Now by default, plug-ins will try to find a catalog in their main
folder, named as this folder. If it fails to find it, a message is
printed to stderr and localization is disabled (rather than falling back
to a default catalog). It is up to plug-in developers to either install
a catalog, or implement set_i18n() to give the right catalog, folder, or
disable localization with gettext, as handled by libgimp.
2022-06-05 01:57:02 +02:00
Jehan 01e9253d7e app, pdb: fix PDB string wrapping in generated calls of…
gimp_procedure_set_static_help().

The indentation was wrong, probably because of changes to function
names. Fix the generation scripts and regenerate the PDB C files.
2022-06-05 01:57:02 +02:00
Jehan bdd22cd95b app, libgimp, pdb: change docs of _gimp_plug_in_domain_register().
We changed the logic of _gimp_plug_in_domain_register() which is now
only called when a domain is explicitly registered (which is not the
case by default anymore). Let's update the function documentation and
also make it clear that third-party developers in particular should not
play with it if they want their plug-ins to be properly localized.
2022-06-05 01:57:02 +02:00
Jehan 3e57f2f482 extensions, po-plug-ins: demo extensions use the new i18n logic.
Since these are demos, for the sake of showing how the localization
works, let's localize the goat-exercises with a locally installed
catalog.
Note that actually use the gimp30-std-plug-ins catalog, simply I copy it
in the plug-in folder and rename it as org.gimp.extension.goat-exercises
domain.

As a consequence:

- The C plug-in does not need the INIT_I18N anymore, which was
  specifically for the centrally installed catalog and cannot be used by
  third-party plug-in developers (so it's not a good demo code).
- I now use GLib.dgettext() for Python instead of the gettext Python
  module, because the later won't "catch" the catalog declared in
  libgimp.
- The other Goat exercises are now localized correctly, unlike before.
- Just setting GETTEXT_PACKAGE is apparently enough for the Vala
  plug-in.
- Lua is untested. Hopefully the code will work.
2022-06-05 01:57:02 +02:00
Jehan 18c37f7084 plug-ins, libgimp: override set_i18n() for all our core plug-ins.
Hence avoiding the stderr messages. These are going to be localized with
centrally installed catalogs "gimp*-std-plugins", "gimp*-script-fu" and
"gimp*-python".

We now handle core plug-in localizations differently and in particular,
with kind of a reverse logic:

- We don't consider "gimp*-std-plugins" to be the default catalog
  anymore. It made sense in the old world where we would consider the
  core plug-ins to be the most important and numerous ones. But we want
  to push a world where people are even more encouraged to develop their
  own plug-ins. These won't use the standard catalog anymore (because
  there are nearly no reasons that the strings are the same, it's only a
  confusing logic). So let's explicitly set the standard catalogs with
  DEFINE_STD_SET_I18N macro (which maps to a different catalog for
  script-fu plug-ins).
- Doing something similar for Python plug-ins which have again their own
  catalog.
- Getting rid of the INIT_I18N macro since now all the locale domain
  binding is done automatically by libgimp when using the set_i18n()
  method infrastructure.
2022-06-05 01:57:02 +02:00
Jehan 4b9d8a56cb libgimp: add a new set_i18n() method to GimpPlugIn class.
Clearly the old logic for localizing plug-ins was "core plug-ins first":

* In particular, we were defaulting to the "gimp*-std-plugins" domain,
  asking plug-ins to override it with libgimp function
  gimp_plug_in_set_translation_domain(). Obviously any third-party
  plug-in would have to call this function since their strings are most
  likely not the same as GIMP core plug-ins.
* Moreover this was only for the localization of menu items, which means
  we had to duplicate work anyway (simplified for core C plug-ins only
  with the INIT_I18N macro).
* Also plug-ins had to manage the location of the Gettext catalogs,
  which is simpler for core plug-ins with gimp_locale_directory(), but
  more annoying for third-party plug-ins which can be installed
  basically anywhere (assuming their message catalogs are in their
  directory, not centrally installed on the system, especially for
  non-UNIX-like packages, with relocatable GIMP, no central package
  system and so on).
* Finally in this logic of centrally installed catalogs, we were
  requesting that the domain name is unique, which makes sense in a
  Linux world with well maintained packages to avoid name clashes, not
  in a world with people making plug-ins without knowing too much what's
  done by their neighbour.

So now the new logic is:

- By default, GIMP will search for a folder called locale/ on the same
  level as the plug-in executable. The Gettext domain will be the name
  of the executable folder (and it doesn't matter too much if it's not
  unique in such configuration).
- This can be disabled by overriding set_i18n() to NULL or
  reimplementing it. All our core plug-ins will do this since they will
  continue to use the centrally installed "gimp*-std-plugins" domain (or
  "gimp*-python" for Python plug-ins).
- When not disabled while the folder is not available, warning messages
  will be outputted to stderr, so that plug-in developers can easily
  detect what is missing and how to handle it (and how to easily support
  internationalization of their plug-in).
- gimp_plug_in_set_translation_domain() is removed and a future commit
  is going to get rid of _gimp_plug_in_domain_register() because we are
  going to get rid of the core-side localization of menu items (with
  logic explained in the upcoming commit).
2022-06-05 01:16:19 +02:00
Jehan 208d415a1a plug-ins: properly localize core Python plug-ins.
- Set the "gimp30-python" Gettext domain and bind it to the proper
  locale directory as installed by GIMP.
- Localize various strings with gettext.
- Remove calls to self.set_translation_domain() in
  do_query_procedures(). This is technically wrong right now but I am
  going to get rid of the menu item localization for plug-ins done by
  the core.
2022-06-04 14:52:14 +02:00
Jacob Boerema b6d5707816 plug-ins: fix possible overflow in computation
FLI/FLC width x height is 16-bit unsigned, so theoretically it could
overflow a 32-bit signed int.
We fix this by making it a 64-bit signed int.
2022-06-03 12:52:17 -04:00
Jacob Boerema 862c54ec94 plug-ins: fix resource leak
In case of a certain error condition we forgot to free our resources.
This would only happen if we had a corrupt FLI/FLC image.
2022-06-03 12:48:19 -04:00
Jacob Boerema 6a8299d989 plug-ins: simplify adding tags to store in metadata-viewer
We were using parameter iter in metadata_dialog_add_tag and
metadata_dialog_add_translated_tag.

However, iter is only ever set inside metadata_dialog_add_tag by calling
gtk_list_store_append. So, there is no need to pass this parameter around.

For this reason, let's remove parameter iter from the above two functions
and replace with a local variable.
2022-06-02 21:45:27 -04:00
Jacob Boerema 5cf1ec62b4 libgimpbase: fix crash caused by the previous commit
In other cases we need to free value, but in this case it was used and
trying to free it caused a GIMP to crash.
Let's duplicate value, so we don't need to special case our g_free.
2022-06-02 17:45:13 -04:00
Jacob Boerema 3138fe5158 libgimpbase: fix resource leak in gimpmetadata
Variable value was not always freed. Move it outside the else block.
2022-06-02 15:14:33 -04:00
Jacob Boerema b130349935 app: fix incorrect order of parameters horizontally and vertically
There was one case where horizontally and vertically were mixed up in a
call to gimp_display_shell_scale_image_stops_to_fit.

The more usual order of parameters is first horizontal and then vertical.
So, let's fix the actual functions that have the illogical order
of vertically, horizontally instead of fixing the one call.

This brings it in line with the order in other functions and makes it less
likely we mistakenly mess up the parameters.

Besides that gimp_display_shell_scale_image_stops_to_fit also was not
declared as a local function, so we add that too.
2022-06-02 13:26:05 -04:00
Kevin Cozens 38e4d5490b Eliminated possible compiler warning. From r130 of TinyScheme in SourceForge. 2022-05-31 19:31:05 -04:00
Kevin Cozens 0af582f309 Allow only one exponent in numbers. From r129 of TinyScheme in SourceForge. 2022-05-31 19:31:05 -04:00
Kevin Cozens 4772f57827 Use trunc() from C99. From revision 128 of TinyScheme in SourceForge. 2022-05-31 19:31:05 -04:00
Kevin Cozens afca1926f1 Use x and y at top of opexe_2 to save repeating some car() and cadr() calls.
From SVN version 127 of offical version of TinyScheme.
2022-05-31 19:31:05 -04:00
Kevin Cozens 511ada844e Syncing TinyScheme with the 1.42 version in the SourceForge repository.
This picks up changes applied in SVN revisions 120 and 124 which
both clean up compiler warnings.
2022-05-31 19:31:05 -04:00
Kevin Cozens 73e5ef394f R5RS compliance fix. Return proper type for remainder and modulo.
Also fixed quotient to only take two arguments. Applied minor
optimization in execution of quotient, remainder, and modulo.
From revision 122 of the TinyScheme repository in SourceForge.
2022-05-31 19:31:05 -04:00
Kevin Cozens 53b7a0935e String-ref, string-set!, vector-ref, and vector-set! index must be integer.
R5RS compliance fix. From bug #42 reported in the SourgeForge bug tracker.
2022-05-31 19:31:04 -04:00
Kevin Cozens e0b6a9cab2 Syncing TinyScheme with the 1.42 version in the SourceForge repository.
This picks up changes applied in SVN revisions 100, 103, 106, and 113.
The TinyScheme version number has been updated.
2022-05-31 19:31:04 -04:00
Aleksandr Melman 977cf00f3d Update Russian translation 2022-05-30 16:25:37 +00:00
lloyd konneker a3b242b2c5 ScriptFu: Break mutual includes between script-fu-server and scheme-wrapper
Instead, make outer script-fu-server register callbacks with inner scheme-wrapper.

Why? the inner scheme-wrapper should not know about the outer script-fu-server.
The change will allow a future, smaller scriptfu shared library,
that does not contain networking code.
We want a scriptfu library shared by separate script-fu-server,
future gimp-scheme-interpreter (!647), and script-fu executables.

This change does not alter observable functioning of the script-fu-server.
Except that I also changing the logging by script-fu-server,
so that I could test the changes.
I put a test plan in the comments.
2022-05-29 08:48:17 -04:00
MohammadSaleh Kamyab 1fc5289405 Update Persian translation 2022-05-29 08:00:40 +00:00
Jacob Boerema ba841a98da app: fix #6961 Scaled image bug
With large image sizes a 32-bit int is not enough for the intermediate
computations, which byte per pixel, width and height are.

So, just like the function below it does: gimp_gegl_pyramid_get_memsize,
we will cast these to gint64.

Thanks to Massimo Valentini for finding the cause.
2022-05-28 12:14:54 -04:00
Luming Zh dbd4751a0a Update Chinese (China) translation 2022-05-28 02:41:30 +00:00
Jordi Mas e301f2e1a3 Update Catalan translation 2022-05-27 07:42:12 +02:00
Jehan c02b4836dd extensions: remove call to gettext.bind_textdomain_codeset().
I added this call originally, mimicking the C plug-ins. Yet in Python,
this function is deprecated since Python 3.8 and removed in 3.10.
Looking closer in the docs, it looks like Python's gettext module works
differently.

While all the *gettext() functions return strings in the locale's
encoding in C, unless overriden by bind_textdomain_codeset() (therefore
we need this call, in order to have locale-independent string encoding),
this is not the case in Python, whose gettext() call is already
locale-independent. The gettext.bind_textdomain_codeset() function only
applies to the specific l*gettext() functions which are deprecated too.

Fixes the warning:

> goat-exercise-py3.py:37: DeprecationWarning: bind_textdomain_codeset() is deprecated
2022-05-25 10:59:12 +02:00
Jehan a773e1cdc8 libgimp: minor nitpick fixes.
- Use GLib types even if it's the same thing here.
- Remove one redundant test (`*sp` is already tested by the for() loop).
2022-05-24 23:52:15 +02:00
Jehan 2d192ae804 app: fix GStrv argument validation in PDB calls.
Bugs introduced in commit 8eb7f6df9e9:

- The type test was wrong.
- The UTF-8 validation test was also wrong since it was still working on
  a GimpArray even though the data was now a GStrv.

Also I stop at the first invalid UTF-8 string element, otherwise later
valid strings may hide previous invalid ones.

This bug was mostly invisible since we don't have any core PDB API with
GStrv parameter so far, only GStrv return value.
2022-05-24 19:48:36 +02:00
Jehan 8c43e641e3 app: gimp_container_get_name_array() should always return a GStrv.
Even if the container is empty, then we return a GStrv of length 1 (i.e.
an array of length 1, terminating with NULL).

In particular, it improves gimp_container_get_filtered_name_array() as
well, and in turn various list-returning functions in libgimp. This
makes the API more consistent after changes from commit 8eb7f6df9e.

Note that a NULL return can be acceptable for error cases, but an empty
list because this is the expected result for the request should be an
empty GStrv, not NULL.
2022-05-24 17:56:49 +02:00
Jehan a6fab71a9a app: gimp_pdb_query() returns a GStrv.
In particular, since commit 8eb7f6df9e, even if it returns an empty
array of procedure, it still means an array of size 1 (with the unique
value being NULL).

This also fixes the public API gimp_pdb_query_procedures() which returns
a GStrv using gimp_pdb_query() internally.

Finally don't keep track of the array size, just recompute it with
g_strv_length(), which will be much less bug-prone.
2022-05-24 17:26:50 +02:00
Jehan 8c1414eb02 app: fix gimp_g_value_get_memsize() with GStrv value.
Since GStrv are NULL-terminated arrays, there is always one additional
pointer (NULL).
This is a detail, but still, wrong since commit 8eb7f6df9e which
replaced GimpStringArray by GStrv usage.
2022-05-24 15:56:03 +02:00
Luming Zh 3fd21f98cf Update Chinese (China) translation 2022-05-23 22:16:41 +00:00
Martin b02b5147ac Update Slovenian translation 2022-05-23 15:48:48 +00:00
Martin cf737a703f Update Slovenian translation 2022-05-23 15:47:06 +00:00
Martin a0401340ea Update Slovenian translation 2022-05-23 15:42:49 +00:00