Commit Graph

108 Commits

Author SHA1 Message Date
Alx Sa 899b45366e libgimp, plug-ins: Run gimp_export_image ()...
...in non-interactive cases.
gimp_export_image () handles various
tasks like rasterizing NDE filters. It only
runs in interactive cases however, so if the
users calls gimp-file-save the filters are
not exported.
Since Jehan removed the hidden dialogue
in 0dc9ff7c, we can now safely call
gimp_export_image () in all cases to make
image export more consistent. This step is
also preparation for setting up the new
API with GimpExportOptions.
2024-07-14 20:12:57 +00:00
Alx Sa 4bf5dc7b97 plug-ins: Port argument macros to functions
With the new API introduced int d1c4457f,
we next need to port all plug-ins using
the argument macros to functions.
This will allow us to remove the macros
as part of the 3.0 API clean-up.
2024-06-13 23:17:48 +00:00
Alx Sa 443947c6aa plug-ins: Remove n_drawables parameter
Port all plug-ins to retrieve the layers
directly from the image rather than
having them passed in. This resolves some
issues with introspection and sets the
foundation for future API work.
2024-05-03 15:22:39 +00:00
Alx Sa bb3c28689a libgimp, plug-ins: Remove GIMP_EXPORT_CANCEL
Per Jehan, as of 0dc9ff7c we can't
cancel gimp_export_image, so we can
safely remove this enum.
2024-05-03 15:22:39 +00:00
Jehan c65aca8b17 plug-ins: rename various '*-save.[ch]' files to '*-export.[ch]'.
Though it's not visible and could happily wait for after GIMP 3 release, this
was annoying when grepping. Just did a quick cleanup.

I also removed gimprc.common which is a forgotten remnant from the autotools
build.
2024-04-21 16:48:58 +02:00
Alx Sa a0d040bddc libgimp: GimpSaveProcedure to GimpExportProcedure
This patch continues porting save API to
export for the 3.0 release.
2024-04-20 07:50:42 -04:00
Jehan a78c41d2a3 meson: on macOS temporarily update rpath to find libraries of non-installed GIMP.
The DYLD_LIBRARY_PATH trick was working fine on CI, but not on local builds for
Lukas. Apparently there are security measures disabling the environment
variable. Instead let's temporarily add then remove libgimp libraries folders
from rpath.

See: https://gitlab.gnome.org/Infrastructure/gimp-macos-build/-/merge_requests/292#note_2075291
2024-04-16 17:43:15 +00:00
Alx Sa c92cf7e8f2 plug-ins: Convert file_*_save to file_*_export
Resolves #10932

Since GIMP distinguishes between saving
XCF and exporting image like PNG,
we should change the PDB to show
export rather than save in the function
calls.
2024-04-16 16:07:10 +00:00
Jehan bf8ee69570 plug-ins: fix some broken macros with a massive search-and-replace.
If we leave a space between the macro name and opening parenthese for argument
lists, the args are not considered macro args (which will be discovered when
using it). I experienced this issue while testing code on some plug-in
yesterday, so thought I might as well fix all these broken macros for casting to
the specific GimpPlugIn subclass, so that we won't have a next time.
2023-10-18 18:29:37 +02:00
Jehan 9e2a7e8759 libgimp, plug-ins: rename gimp_load_procedure_new2() as gimp_load_procedure_new().
All C load procedures are now moved to the new API.
2023-10-01 21:02:32 +02:00
Jehan 4a3fd7423a plug-ins: port various plug-ins to gimp_load_procedure_new2(). 2023-10-01 20:52:02 +02:00
Jehan fcc810d7d3 libgimp, plug-ins: rename to gimp_save_procedure_new().
Also the mimetype is already set by gimp_file_procedure_set_mime_types() so
transform the mimetype argument into an export_metadata argument.
2023-10-01 20:52:02 +02:00
Jehan b23519a401 plug-ins: port to gimp_save_procedure_new2() all export procedures…
… which were using gimp_procedure_config_begin_export().
2023-10-01 20:52:01 +02:00
Jehan 5cc1c898d7 libgimp, plug-ins: enhance gimp_procedure_dialog_get_label() with markup and…
… mnemonic abilities.
2023-10-01 20:52:01 +02:00
Øyvind Kolås 21411047ee app,pdb,plug-ins: %s/gegl_node_connect_to/gegl_node_connect/ 2023-06-13 19:58:42 +02:00
Michael Natterer 26dce72d2c Remove autotools 2023-05-27 00:03:52 +02:00
Alx Sa 0bc38d9df2 plug-ins: Make WebP preset names translatable
Resolves #9252
2023-03-21 00:48:25 +00:00
Jehan 4f1d0fb53b plug-ins: get rid of various gimp_image_set_file() calls.
- This is unneeded in all import procedures. See previous commit. Note though
  that this is not because of a change in previous commit. This was already
  useless previously. The file set with this PDB function was overridden by the
  core anyway (i.e. even before the previous commits).
  In app/file/file-import.c:file_import_image(), the imported file is correctly
  set (so there is no need to set it from plug-in, which anyway libgimp's
  gimp_image_set_file() was not doing) and the XCF file is reset to NULL
  (rendering the call to gimp_image_set_file() in a GimpLoadProcedure useless).
- Similarly, this is a useless call in export procedures because
  app/file/file-save.c:file_save() overrides such call too. I could only see one
  such case for JPEG export, which was quite useless.
- Finally in other types of plug-ins, setting a non-XCF file extension was
  interfering with the save feature (similarly to commit e6e73e14c7). I only
  fixed the screenshot implementations doing such a thing.
- I left a few usages which will have to be looked at more in details later.
2023-02-13 22:54:16 +01:00
Jehan ca230cb770 meson: fix warnings of deprecated features.
Now that we bumped our meson requirement, meson is complaining about
several features now deprecated even in the minimum required meson
version:

s/meson.source_root/meson.project_source_root/ to fix:

> WARNING: Project targets '>=0.56.0' but uses feature deprecated since '0.56.0': meson.source_root. use meson.project_source_root() or meson.global_source_root() instead.

s/meson.build_root/meson.project_build_root/ to fix:

> WARNING: Project targets '>=0.56.0' but uses feature deprecated since '0.56.0': meson.build_root. use meson.project_build_root() or meson.global_build_root() instead.

Fixing using path() on xdg_email and python ExternalProgram variables:

> WARNING: Project targets '>=0.56.0' but uses feature deprecated since '0.55.0': ExternalProgram.path. use ExternalProgram.full_path() instead

s/get_pkgconfig_variable *(\([^)]*\))/get_variable(pkgconfig: \1)/ to
fix:

> WARNING: Project targets '>=0.56.0' but uses feature deprecated since '0.56.0': dependency.get_pkgconfig_variable. use dependency.get_variable(pkgconfig : ...) instead
2022-08-31 01:29:37 +02:00
Jehan dfb7d2543a Issue #8505: WEBP, be more informative with error.
Add the info about max dimension of WebP with WEBP_MAX_DIMENSION macro.

There is also a test about (picture->width / 4 > INT_MAX / 4), resp.
height, but this should anyway never happen as the C spec says the
smaller range for int is [-32767, 32767], which is an order bigger than
the current WEBP_MAX_DIMENSION (16383).
So we are probably fine assuming all VP8_ENC_ERROR_BAD_DIMENSION errors
will happen because of WEBP_MAX_DIMENSION.
2022-08-19 14:10:15 +02:00
Jehan df074bfe09 plug-ins: label and documentation of plug-ins localized plug-in side.
This is the consequence of previous commit. Plug-ins' label and
documentation are now localized before sending these data to GIMP core.
In other words, we replace N_() macros with basic gettext calls.
2022-07-05 12:23:51 +02:00
Jehan 5b22cef644 plug-ins: do not unref anymore int stores given to…
… gimp_procedure_dialog_get_int_combo().

See previous commit.
2022-06-17 17:59:54 +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 b5fbe84b09 plug-ins: localize file-webp parameters' titles/docs.
Also changing "RGB->YUV" by using a real Unicode rightward arrow encoded
in UTF-8 since GTK functions (such as `gtk_widget_set_tooltip_text()`)
explicitly uses UTF-8 encoded strings as argument. This renders much
more nicely than an ASCII-made arrow.
2022-04-26 19:09:04 +02:00
Jehan ada64be8cd plug-ins: new "use-sharp-yuv" param only relevant when non "lossless".
Cf. question to libwebp devs and also grepping the code directly:
https://bugs.chromium.org/p/webp/issues/detail?id=567#c6
2022-04-26 17:18:40 +02:00
Nikc df402522ef Plug-ins: Add "Use Sharp YUV" for webp export 2022-04-26 12:46:33 +00:00
Jehan 657911ce48 plug-ins: using a GimpSpinScale instead of a GimpScaleEntry in…
… various plug-ins.
2022-02-19 02:26:11 +01:00
Jehan 2ddc2ab7be plug-ins: some cleanup in file-webp.
- use g_file_peek_path() instead of g_file_get_path() in various places.
  Less prone to memory management bugs (not forgetting to free in all
  cases). Also it is often more efficient, especially for local files
  where the _peek_ variant does not even need to allocate any memory as
  path is already hanging around (and local files are the most common
  use cases, I believe!).
- Also gets rid of one GFile creation with g_file_new_for_path() from
  the path returned from another GFile! We can just use the same GFile
  as it is not freed and perfectly usable.
2021-10-01 18:47:30 +02:00
Mayank Suman d8062d1d77 plug-in, libgimp: Fixes #6753: redesign of WebP Export dialog
Added an option for exporting thumbnail in WebP Export dialogbox.

Additionally, introduced a function gimp_procedure_dialog_fill_expander.
The function is similar to gimp_procedure_dialog_fill_frame but allows
adding GtkExpander instead of GtkFrame.
2021-06-18 16:42:08 +05:30
Jehan 2ea5dec56e libgimpwidgets: improved gimp_prop_scale_entry_new(), new function…
… gimp_label_spin_set_digits() and deleted gimp_prop_opacity_entry_new()

- The "digits" argument for the number of decimal places in
  gimp_prop_scale_entry_new() is now mostly useless since GimpLabelSpin
  (hence GimpScaleEntry too) got a nice estimation algorithm of sensible
  values.
- Add gimp_label_spin_set_digits() function to manually set the digits
  property when we don't like the estimated value.
- Also add a new "factor" argument to gimp_prop_scale_entry_new(). Its
  role is to allow a GimpScaleEntry showing a factored range, typically
  a [0, 100] range for some types of [0, 1] properties.
- Remove gimp_prop_opacity_entry_new() which was basically a
  special-case of gimp_prop_scale_entry_new() and which can now be
  easily reproduced by simply set factor=100.0.
- Update all usage of gimp_prop_scale_entry_new() in app/ and plug-ins/
  with updated arguments. It is interesting to note that all existing
  usage were either integers (digits=1) or when double, the estimated
  decimal places are the same as the ones which were manually set (hence
  showing the generic estimation is not too bad). So the new function
  gimp_label_spin_set_digits() was not even needed once in current code.
2020-11-25 02:32:22 +01:00
Jehan 0f05825a29 app, libgimpwidgets, plug-ins: default increments for GimpScaleEntry.
Instead of setting always manually the step and page increments when
creating a GimpScaleEntry, let's just generate some common cases
automatically. Indeed the increments are rarely something you want to
care about. The algorithm used is:
- For a range under 1.0, use a hundredth and a tenth (typically a [0,
  1.0] range will step-increment of 0.01 and page-increment of 0.1).
- For small ranges (under 40), step-increment by 1, page-increment by 2.
- For bigger ranges, step-increment by 1, page-increment by 10.

For use cases when you absolutely want specific increment values, I add
the gimp_scale_entry_set_increments() function. It is much better to
have a small and understandable constructor call followed by
configuration calls (only when needed) rather than a constructor with a
crazy amount of parameters. Hence gimp_scale_entry_new() went from 17
arguments (absolutely unreadable calls) to now 5.
2020-10-30 12:33:46 +01:00
Jehan d81b151e79 app, plug-ins: use the updated gimp_prop_scale_entry_new() API. 2020-10-30 11:02:20 +01:00
Jehan 67e2e1b5bb app, libgimp, plug-ins: move Orientation metadata handling into core.
Orientation is now handled by core code, just next to profile conversion
handling.

One of the first consequence is that we don't need to have a non-GUI
version gimp_image_metadata_load_finish_batch() in libgimp, next to a
GUI version of the gimp_image_metadata_load_finish() function in
libgimpui. This makes for simpler API.
Also a plug-in which wishes to get access to the rotation dialog
provided by GIMP without loading ligimpui/GTK+ (for whatever reason)
will still have the feature.

The main advantage is that the "Don't ask me again" feature is now
handled by a settings in `Preferences > Image Import & Export` as the
"Metadata rotation policy". Until now it was saved as a global parasite,
which made it virtually non-editable once you checked it once (no easy
way to edit parasites except by scripts). So say you refused the
rotation once while checking "Don't ask again", and GIMP will forever
discard the rotation metadata without giving you a sane way to change
your mind. Of course, I could have passed the settings to plug-ins
through the PDB, but I find it a lot better to simply handle such
settings core-side.

The dialog code is basically the same as an app/dialogs/ as it was in
libgimp, with the minor improvement that it now takes the scale ratio
into account (basically the maximum thumbnail size will be bigger on
higher density displays).

Only downside of the move to the core is that this rotation dialog is
raised only when you open an image from the core, not as a PDB call. So
a plug-in which makes say a "file-jpeg-load" PDB call, even in
INTERACTIVE run mode, won't have rotation processed. Note that this was
already the same for embedded color profile conversion. This can be
wanted or not. Anyway some additional libgimp calls might be of interest
to explicitly call the core dialogs.
2020-09-24 12:43:41 +02:00
Jehan d3139e0f7c app: support saving/exporting with multi-selection.
This commit just changes our saving API (i.e. the GimpSaveProcedure
class) to take an array of drawables as argument instead of a single
drawable.

It actually doesn't matter much for exporting as the whole API seems
more or less bogus there and all formats plug-ins mostly care only
whether they will merge/flatten all visible layers (the selected ones
don't really matter) or if the format supports layers of some sort. It
may be worth later strengthening a bit this whole logics, and maybe
allow partial exports for instance.

As for saving, it was not even looking at the passed GimpDrawable either
and was simply re-querying the active layer anyway.
Note that I don't implement the multi-selection saving in XCF yet in
this commit. I only updated the API. The reason is that the current
commit won't be backportable to gimp-2-10 because it is an API break. On
the other hand, the code to save multi-selection can still be backported
even though the save() API will only pass a single drawable (as I said
anyway, this argument was mostly bogus until now, hence it doesn't
matter much for 2.10 logics).
2020-05-17 18:32:16 +02:00
Niels De Graef ae34e778fc meson: Use libgimp(ui)_dep in plug-ins meson files
This gives a big cleanup in the meson.build files of the plug-ins.

It's also quite a bit more maintainable, since anything that changes in
libgimp's dependencies, linkage, ... doesn't have to be copy-pasted into
each plug-in.
2020-05-11 07:01:37 +02:00
Jehan 2cd765c000 plug-ins: variable used after being freed.
Once again spotted by Massimo in #4449.
2020-01-03 19:57:59 +01:00
Jehan 189da39805 plug-ins: return value of gimp_procedure_config_begin_export() freed…
… twice.
It should not be freed by the caller since it is annotated as (transfer
none). It gets freed when calling gimp_procedure_config_end_export().
Thanks to Massimo for noticing.
2020-01-03 19:53:54 +01:00
Michael Natterer b5f10b6eda plug-ins: port file-heif and file-webp to the new export stuff 2019-10-09 23:50:14 +02:00
Michael Natterer 1b48c687ca plug-ins: port file-webp to GimpProcedureConfig 2019-09-27 16:24:16 +02:00
Michael Natterer 5cccad9867 plug-ins: move around and clean up some code in file-webp
as preparation for GimpProcedureConfig porting.
2019-09-27 12:07:20 +02:00
Michael Natterer df8d5b02ae libgimp, plug-ins: remove the "preview" parameter from gimp_ui_init()
It's dead since a looong time.
2019-09-20 19:56:00 +02:00
Michael Natterer 6bca8c4f89 pdb, app, libgimp, plug-ins: replace most PDB filenames/URIs by GFile
and in an attack of madness, changes almost all file plug-in
code to use GFile instead of filenames, which means passing
the GFile down to the bottom and get its filename at the very
end where it's actually needed.
2019-09-11 21:48:34 +02:00
Félix Piédallu 65eff6f150 Meson port. 2019-09-11 16:42:04 +02:00
Sabri Ünal a60ac57207 Missing mnemonics on several file dialogs
This path corrects missing mnemonics on several save/open/export dialogs.

save: file
open: file, dds, fits, tiff
export: bmp, dds, fli, gbr, gih, mng, pat, pnm, pdf, raw, sunras, sgi, webp
2019-09-09 18:06:29 +00:00
Michael Natterer 8a78203aed Properly prefix the values of enum GimpPDBProcType
to be GIMP_PDB_PROC_TYPE_PLUGIN, _EXTENSION etc.
2019-08-30 12:52:28 +02:00
Michael Natterer 0b3e02be10 libgimp: again, redo all APIs returning list of images, items, children
We now have both variants, one returning a GList, and another
returning an array. Turns out that while a list is often nicer,
sometimes a random-access array really keeps the code much simpler.

Adapt all plug-ins, and clean up a bit (like use g_list_reverse() once
instead of iterating the list reversed).
2019-08-27 13:26:27 +02:00
Michael Natterer 3636541b42 plug-ins: port file-webp to GimpPlugIn and libgimp objects 2019-08-24 11:45:01 +02:00
Jehan e0d50aa121 plug-ins: keep building all plug-ins with old API.
Build existing plug-ins with -DGIMP_DEPRECATED_REPLACE_NEW_API.
We will port the plug-ins one at a time to the new GimpImage API.
2019-08-22 15:54:36 +02:00
Michael Natterer de121374ef Change the "handles uri" flag of file procedures to "handle remote"
And always pass URIs to all file procedures, the ones what didn't
register as "handles remove" will only ever get local file:// URIs.

Change all file plug-ins (also legacy ones) to expect URIs instead
of filenames, and convert to local paths in the plug-in.

The wire protocol should now be almost 100% clean of non-UTF-8 strings.
2019-08-19 12:05:12 +02:00
Michael Natterer 169f98f915 libgimpwidgets: add GDestroyNotify to gimp_int_combo_box_connect() 2019-08-08 00:22:15 +02:00