Commit Graph

50666 Commits

Author SHA1 Message Date
Jehan 44e2bab9ad plug-ins: remove "num-images" argument and improve error feedback.
The arg "num-images" is clearly redundant as the "images" array already has this
information. Moreover it is bug-prone, for instance running 'Repeat "Filmstrip"'
would crash the plug-in which was defaulting to NULL "images" and 1 "num-images"
(without any GimpItem serialization ability yet).
Of course, we could just fix this, but better remove the redundant arg and all
possibilities of future similar bugs.

Also I now display a proper error message when running without input images
which says: "\"Filmstrip\" cannot be run without any input images"
2023-10-01 20:52:01 +02:00
Jehan df6ccf390f plug-ins: fix possibly unreffing a NULL pointer. 2023-10-01 20:52:01 +02:00
Jehan 48f0ac3ad5 libgimp: release leaked reference to resource object.
The widget_creator_func() given to gimp_prop_chooser_factory() will create an
object which will take its own reference. We must release the one we got with
g_object_get().
2023-10-01 20:52:01 +02:00
Jehan dac29b17a8 libgimp: some memory leak fixed. 2023-10-01 20:52:01 +02:00
Jehan 14bcaa717b plug-ins: a bunch of more plug-ins ported to gimp_save_procedure_new2(). 2023-10-01 20:52:01 +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 da7e8f3388 libgimp: new gimp_save_procedure_new2() meant to replace gimp_save_procedure_new().
Metadata handling is also integrated in this API:

* while giving a possibility to disable metadata saving if you want to do it
  yourself (e.g. in file-heif), by setting a NULL MimeType;
* and the GimpMetadata object is added as run() argument, allowing one to edit
  the metadata during the run, while still letting the infrastucture handle the
  save (e.g. in file-jpeg);
* or to save intermediate metadata with gimp_procedure_config_save_metadata()
  (e.g. in file-tiff).
2023-10-01 20:52:01 +02:00
Jehan 602345143f libgimp: more removal of over-refing. 2023-10-01 20:52:01 +02:00
Jehan f37c3c42c7 libgimp: simplify GimpFileProcedure public API with G_DECLARE_DERIVABLE_TYPE().
While we definitely should not use this inside app/, because having the private
structure easily accessible as a member is very convenient, it is clear that it
makes for a much nicer public signature. Also the priv member is of no help to
third-party developers using this API to make plug-ins and is better hidden in
such a case.
2023-10-01 20:52:01 +02:00
Alx Sa e79de5db86 plug-ins: port small-tile to gimp_image_procedure_new2()
The dialog itself is ported to GimpProcedureDialog, but the original 
plug-in only had one config parameter (Number of Tiles).
Some of the other options might make sense as config parameters 
such as the horizontal/vertical toggles and opacity.
2023-10-01 20:52:01 +02:00
Jehan 3c1ecd53ff plug-ins: port film to GimpProcedureDialog.
I needed a few more GimpProcedureDialog widgets, which I now have. The only part
still not generated in this plug-in is the image selection. This is hundreds of
lines less!

It now has arguments for every usable setting (except "keep-height" which is an
aux arg because it is simulated with a 0 "film-height" in non-interactive mode).

Also the film-height/keep-height default in interactive mode is now much better.
I override the film-height default and set it to be the image's height. This
makes for a much better default at all time.

The "Reset" button in Advanced section is not useful anymore since we now have
the generic "Reset" (to Initial/Factory) of GimpProcedureDialog, though it
actually doesn't work right for the time being, as it fails serializing
GimpFont.
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
Jehan 2f1c569249 libgimp: new gimp_procedure_dialog_fill_paned() function. 2023-10-01 20:52:01 +02:00
Jehan 334febdebb libgimp: new gimp_procedure_dialog_fill_notebook*() functions. 2023-10-01 20:52:01 +02:00
Jehan fc9a720b31 libgimp: some debug printing for plug-in developers.
This will be useful for plug-in developers but also for us. Seeing we leak the
config object is often a good indication that something is wrong in our handling
of internal references (since everything relies on the config object in plug-ins
now, in particular all the GUI).
2023-10-01 20:52:01 +02:00
Jehan e6e3545959 libgimp: all the over-reffing was wrong.
I was clearly confused when I wrote this. The sinking part matters to take
ownership of a reference in the widgets table, but we don't need to ref widgets
again before inserting them in containers. We were leaking widgets and as a
consequence the config object (and as a second consequence, some objects such as
resources for resource-selection widgets).
2023-10-01 20:52:01 +02:00
Jehan 99d4c504d0 plug-ins: port film to gimp_image_procedure_new2().
The dialog is not ported to GimpProcedureDialog yet. It will be worth doing it
as a second step.
2023-10-01 20:52:01 +02:00
Jehan f5183cbd7b plug-ins: port warp to gimp_image_procedure_new2().
It would be worth porting when GimpDrawableComboBox widgets can be used as
GimpProcedureDialog generated widgets. Or even better, if the GimpPickableButton
were ported to libgimp to be used by plug-ins (since it's actually a lot more
usable).
2023-10-01 20:52:01 +02:00
Jehan 2f91e45b4f plug-ins: port easy plug-ins to gimp_image_procedure_new2().
These were the plug-ins already using gimp_procedure_config_*() API.
2023-10-01 20:52:01 +02:00
Jehan 2a21d45ada plug-ins: port grid to gimp_image_procedure_new2().
I didn't port to GimpProcedureDialog because we'd need first a GimpSizeEntry
generatable widget, which can map to several properties (here for instance 3
width properties).
2023-10-01 20:52:01 +02:00
Jehan 3c658789a6 plug-ins: now port to gimp_image_procedure_new2() all plug-ins without args. 2023-10-01 20:52:01 +02:00
Jehan 4f14f620c4 plug-ins: port to gimp_image_procedure_new2() all plug-ins which were already…
… working with a GimpProcedureConfig.

These are the easiest ones to port as most of the work was already done (mostly
just some now useless calls to remove).
2023-10-01 20:52:01 +02:00
Jehan 96b3302e65 plug-ins: port gradient-flare to gimp_image_procedure_new2() and GimpProcedureDialog.
The port to GimpProcedureDialog is partial as there are still quite a few pieces
which can be improved. But it's a good start.
2023-10-01 20:52:01 +02:00
Jehan 7da0db9e88 plug-ins: port tile to gimp_image_procedure_new2() and GimpProcedureDialog. 2023-10-01 20:52:01 +02:00
Jehan 8c8c64a9ee libgimp: temporary gimp_image_procedure_new2() until port is over.
Same as with gimp_procedure_new2(), I will end up renaming the function to
gimp_image_procedure_new() once all usage of this function will have been ported
to the new function using GimpProcedureConfig instead of GimpValueArray
arguments.
2023-10-01 20:52:01 +02:00
Jehan 3806b46fc5 plug-ins: forgotten Python plug-ins had to be ported to new Gimp.Procedure.new().
There was also one case of port to updated GimpResource API to get the name of a
palette.
2023-10-01 20:52:01 +02:00
Jehan 2b38a2df86 libgimp, plug-ins: rename gimp_procedure_new2() as gimp_procedure_new() and…
… remove the latter.

Now all GimpProcedure use this new implementation with use a config object.
2023-10-01 20:52:01 +02:00
Jehan f6f622b93d libgimp: port 2 usages of gimp_procedure_new() to gimp_procedure_new2().
The one in GimpResourceSelect is a very nice example of why using config objects
is much nicer, getting arguments by their name instead of an index (which in
this case had to be tracked down by a private function to handle different
cases).
2023-10-01 20:52:01 +02:00
Jehan a2acf24ecb libgimp, plug-ins: Script-fu scripts now use gimp_procedure_new2() too.
Also in gimp_procedure_config_begin_run(), make sure we sync the arguments with
the config object first thing, even in interactive and with-last-vals case
(where the args may be further overridden). This was especially important for
Script-fu scripts as the image and drawable were not provided separately, so we
need to make sure that the config file has the right values.
2023-10-01 20:52:01 +02:00
Jehan 5d3112a2f1 plug-ins, libgimp: move GimpBatchProcedure's run function to use config objects.
Also port more script-fu procedures to gimp_procedure_new2(), which were sharing
some code with the script-fu batch procedure.
2023-10-01 20:52:01 +02:00
Jehan af00b66914 plug-ins: port the easy script-fu procedures to gimp_procedure_new2(). 2023-10-01 20:52:01 +02:00
Jehan 38ecbfc762 plug-ins: more plug-ins ported to gimp_procedure_new2(). 2023-10-01 20:52:01 +02:00
Jehan c09711beaa libgimp: the default run (if no run-mode parameter) should be non-interactive.
Otherwise we will always try to reuse previous values or use the default,
bypassing the actual passed values.

I encountered this issue while porting file-glob and realizing that the
"pattern" argument was always passed to NULL, ignoring the explicitly set
pattern.

When a procedure has no run-mode argument, we should simply not assume anything
and use the passed arguments (which is what the non-interactive mode does).
2023-10-01 20:52:01 +02:00
Jehan 9b2240f51e plug-ins: port web-page to GimpProcedureDialog and gimp_procedure_new2().
Again a lot less lines for more functionalities (e.g. now it should work fine in
WITH_LAST_VALS mode).
2023-10-01 20:52:01 +02:00
Jehan e92ef9d45a plug-ins: port several of the easy plug-ins to gimp_procedure_new2(). 2023-10-01 20:52:01 +02:00
Jehan f6da799c11 plug-ins: port screenshot to GimpProcedureDialog and gimp_procedure_new2().
A lot less lines for the same functionalities!
This includes improvements too:

* "include-pointer" as new PDB argument;
* settings storage thanks to GimpProcedureDialog;
* it should hopefully work better in non-interactive (though it's untested).

The macOS and Windows screenshots are untested after this change, though they
should still work the same. Please report if there is any problem!
2023-10-01 20:52:01 +02:00
Jehan 60aeff5623 libgimp: new gimp_procedure_dialog_set_ok_label() function.
This allows to set a custom label for the OK button.
2023-10-01 20:52:01 +02:00
Jehan 59edcde06f libgimp: new function gimp_procedure_dialog_set_sensitive_if_in().
This function allows to change the sensitivity of a widget depending on the
value of another property.
We already had gimp_procedure_dialog_set_sensitive() except it was only syncing
with a boolean property, whereas the new function can compare with any property
type.
2023-10-01 20:52:01 +02:00
Jehan edab39a868 libgimp: fix the sometimes wrong run-mode value in the config object. 2023-10-01 20:52:01 +02:00
Jehan 982764421f app: fixes the call to "plug-in-busy-dialog".
Fixes the following CRITICAL:

> g_value_set_int: assertion 'G_VALUE_HOLDS_INT (value)' failed
2023-10-01 20:52:01 +02:00
Jehan 7ab87d2b15 Issue #50: new gimp_procedure_new2() which automatically stores procedure config.
This new function is meant to replace gimp_procedure_new() when all plug-in
usage will have been switched.

This function creates the GimpProcedureConfig object on behalf of the plug-in
and calls gimp_procedure_config_begin_run() and gimp_procedure_config_end_run().
This way we ensure that all plug-in calls with successful result are properly
stored without asking the developer not to forget to call these (if a "good
practice" is in fact something we request to do every time, especially for good
user experience, we might as well make it rather a core process).

Advantages:

* Better interactive experience: using any plug-in will result in saved
  previously used settings.
* for developers, working on config objects is also much more comfortable than
  working on GValueArray;
* step forward for the future macro infrastructure: if we can ensure that all
  plug-in calls are properly logged, then we can replay plug-in actions, in
  NON_INTERACTIVE with the same settings.
2023-10-01 20:52:00 +02:00
Sabri Ünal 2003d26105 Update Turkish translation 2023-10-01 18:26:09 +00:00
Sabri Ünal 59fb6e0da5 Update Turkish translation 2023-10-01 18:26:01 +00:00
Alx Sa 6ad54ca3a3 plug-ins: Fix DDS vulnerability (ZDI-CAN-22093)
Resolves #10069

Currently, the DDS header information for the width, height, and bytes per scan line
are read in and assumed to be correct. As these values are used for memory allocation
and reading, it would be good to verify they do not exceed the file size.

This patch adds a condition after the header is read in to verify those values. If they exceed
the file size (mins an offset), the file is not read in and an error message is shown.
2023-10-01 17:06:25 +00:00
Jehan 0b307a3a1a NEWS: update. 2023-10-01 18:01:26 +02:00
Alx Sa a87afa7255 themes: Set default background-color for buttons
Resolves #9996.
While GIMP has background-colors set for specific buttons,
it did not have a default button background-color. This resulted
in "random" buttons showing system theme colors like the
[Reload Current Theme] button.
This patch defines a default background-color while leaving the
specific button themes intact.
2023-09-30 01:38:37 +00:00
Anders Jonsson 56256e2721 Update Swedish translation 2023-09-29 21:02:45 +00:00
Alx Sa 865cc56894 plug-ins: Fix vulnerability in file-psd
Resolves #10101.
This patch adds a missing break statement after an error condition
is detected to prevent the code from continuing afterwards.
2023-09-29 20:38:51 +00:00
Alx Sa e4c362a9c3 themes: Highlight when hovering over grid view icons
This adds a border when hovering over icons in various
grid views (brushes, gradients, etc). This makes it more
visually apparent which option you can click to select.
2023-09-28 19:01:05 +00:00
Vasil Pupkin f22935d3de Update Belarusian translation 2023-09-28 17:59:51 +00:00