Commit Graph

24502 Commits

Author SHA1 Message Date
Alx Sa aa30b40fee core, xcf: Prevent copying tool-based NDE filters
For now, we can't keep certain GEGL ops
like Gradient as NDE filters, since they are
connected to tools. If the layer is copied
or saved as an .XCF while the tool is still
active, it attempts to save it and causes a
crash.
This patch adds a check to make sure the
copied filter has been commited and that
it's not a tool-based NDE filter before
being copied. It also adds some NULL
checks where gimp_drawable_filter_duplicate
is used to prevent NULL from being
added to the filter stack.
2024-05-14 04:05:06 +00:00
Simon Budig 1b142eb604 app: don't leak the GeglColor in GimpPaletteEntries. 2024-05-06 00:35:51 +02:00
Simon Budig 32336a2350 app: avoid uninitialized memory for color names 2024-05-06 00:35:51 +02:00
Simon Budig 6877a3cd43 app: use the logical rectangle for positioning the splash text.
This avoids jiggeling baselines for texts with/without descenders.
2024-05-05 16:55:41 +02:00
Alx Sa 3260299f4a libgimp, plug-ins: Remove n_drawables parameter from gimp_file_save () 2024-05-03 15:22:39 +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 0b171e9bae core: Copy NDE filters in layer group children
Resolves #10765
This allows us to retain any filters that a
layer group's children might have when
copied or exported. They were previously
lost when the group layer was duplicated.
Note that an OR condition was added to
GimpDrawableFilter creation, to allow
one to be created if the layer was 
attached to a parent layer rather than the
image.
2024-04-29 20:51:36 +00:00
Cheesequake 10cc33b28e widgets: Deleting effects now deletes the selected effect instead of the topmost effect
Resolves #11404
Since the GimpContainer selected function automatically updates which filter is the
"active" selected filter, we can remove the code that sets it to NULL after a filter
is deleted. This fixes a bug where the top effect was always deleted in subsequent
attempts rather than the highlighted one.
A now unnecessary gimp_drawable_remove_last_filter () function was also removed.
2024-04-29 11:34:59 +00:00
Alx Sa 9a4d365d59 core: Copy correct filters to new layers
Should resolve #11392

In dfb26f37, the NDE filters in the copied image are
retrieved with gimp_image_get_layer_iter (). This works
fine for single layer images or when all the layers are copied
at once. However, if a subset is copied then the filters are always
copied starting from the top level of the image. This can result
in an incorrect filter being copied to the wrong layer.
To fix this, we get the filters from the provided drawables list
instead. This matches the number of layers in the copied
image exactly, since it was used to create the copied image.
2024-04-26 04:17:08 +00:00
Jehan 9d93160de6 Issue #11384: new Image automatically uses comment from active image. 2024-04-25 00:20:32 +02:00
Jehan 390340b433 app: fix cases of missing data directories by always trying to mkdir them.
This happens in particular for in-build runs (or when using
GIMP3_DIRECTORY environment variable on an empty directory). In any
case, I don't see why we wouldn't try and create a directory which was
configured for data storage.
2024-04-24 19:48:59 +02:00
Jehan 768f871bc7 app, libgimp, pdb: new GimpVectorLoadProcedure class.
It's still basic but will help to share code for support of various vector-able
formats, such as the logic for dimensioning them, but also the generated GUI.

Not only this, but we are paving the way for the link layers (though it'll be
after GIMP 3, we want plug-in procedures' API to stay stable) by giving a way
for a plug-in procedure to advertize a vector format support. This way, the core
will know when a source file is vector and can be directly reloaded at any
target size (right now, in my MR for link layers, the list of "vector" formats
is hardcoded, which is not reliable).
2024-04-24 01:16:46 +02:00
cheesequake 5c646830a5 Fixes #11338: Layers do not teleport to the bottom of the list if dragged onto the headers 2024-04-24 00:23:40 +05:30
Anders Jonsson 83dee0e43a app: translate link labels and tooltip in Welcome dialog 2024-04-23 14:57:25 +00:00
Alx Sa 47aabfc93a core, libgimpcolor: CMKY & HSL to float
Continuing 32d64ab1, this converts the
few instances of CMYK and HSL/A double
to float to match babl's precision.
2024-04-23 13:38:59 +00:00
Alx Sa c691bd2a0b actions: Prevent crash due to non-existent editors
Resolves #10914

Some dockables such as "gimp-pattern-editor" and
"gimp-mybrush-editor" are listed as Editors even though
we don't yet have dedicated GimpDataEditors for them.
This causes problems when using certain features like
duplicating. To resolve for now, we check if
gimp_window_strategy_show_dockable_dialog () returns a
valid GimpDataEditor before trying to use it.
Per Jehan, we also verify that an edit button exists
and is visible before we try to call the edit command.
2024-04-22 01:24:36 +00:00
Bruno Lopes 3f0532ba86 app, devel-docs: add a bit of MS Store documentation
See also: Infrastructure/gimp-web-devel!46
2024-04-21 18:18:35 -03:00
Alx Sa 32d64ab1c9 core, widgets: Convert HSV/A to float
Per Pippin, the only color model that can
have double precision is RGB/A.
Therefore, we need to switch all others to
use float instead. This patch converts the
HSV and HSVA double babl formats.
2024-04-21 03:42:27 +00:00
Jehan 106d18605a libgimpcolor, app: gimp_color_parse_(css|hex|name)() renamed with _substring() suffix.
New functions with the same name as these functions are created, except without
the length argument (i.e. it's equivalent to calling these with -1).

The reason for this is that using strings with a length variant which may be
negative to switch to NUL-terminated strings are not bindable. At least in our
case, when testing in Python, the input string ended up as corrupted garbage and
GObject Introspection docs warns about such interfaces:

> In particular, avoid functions taking a const char * with a signed length that
> can be set to a negative value to let the function compute the string length
> in bytes. These functions are hard to bind, and require manual overrides.

(see: https://gi.readthedocs.io/en/latest/writingbindableapis.html#strings)

So instead, I create a simple version which runs on NUL-terminated strings only
and which is bound, whereas unbinding the generic length-version (making it
C-only, or maybe usable in some other bindings which ignore the (skip)
annotation; apparently some do this).
2024-04-20 12:37:20 +02:00
Jehan 2b27feb2fd app, libgimp*, modules, pdb, plug-ins: new GimpParamColor.
This is meant to obsolete GeglParamColor with at least an additional argument
has_alpha which we need in GIMP. It allows to advertize when a parameter wants
an opaque color, which in particular means we know when displaying a GUI to pick
colors with alpha or not.
2024-04-19 23:25:13 +02:00
Jehan cbb333c220 app: accept a NULL default color in plug-ins.
Our pluginrc code is already able to output NULL for a default NULL color, but
reading was failing with the following error:

> GIMP-Error: Error while parsing '/home/jehan/.config/GIMP/2.99/pluginrc' in line 289: unexpected identifier 'NULL', expected number (integer) - fatal parse error

Let's support reading such a value now, especially as for Python plug-ins, we
are not even able to add a default value to GeglColor arguments (cf. previous
commit).
2024-04-19 19:13:53 +02:00
Jehan e7b7efafe9 app, libgimpcolor: no GValue GimpRGB anymore! 2024-04-19 14:42:08 +02:00
Jehan a50759cda8 app, libgimp*, pdb, plug-ins: remove GimpRGB support in GIMP protocol.
There are no plug-ins which uses GimpRGB for procedure argument, nor is there
any base PDB procedure. We don't pass this type anymore through from/to
core/plug-ins. So let's clean the whole code out as a next step to get rid of
GimpRGB from our codebase!
2024-04-19 14:34:22 +02:00
Alx Sa 97d6aa5904 widgets: Close Layer Effects popover when changing images
Resolves #11347

In multi-window mode, it is possible to change images without
causing the layer effects popover to close. This results in the prior
image's layer effects being shown over the new image, which is
confusing. This patch causes the popover to automatically close
when the image is changed to prevent this problem.
2024-04-19 01:58:56 +00:00
Jehan 2434c41a12 app, plug-ins: renaming the `file-*-save-internal` procs to `file-*-export-internal`. 2024-04-18 16:02:00 +02:00
Jehan 9f149ef3a2 app, libgimp*, plug-ins: get rid of GimpRGB arrays now that we have GeglColor arrays. 2024-04-18 16:00:42 +02:00
megakite e961ff0fe2 app/menus: update tool options menu while initializing menus 2024-04-18 10:22:11 +00:00
Alx Sa dbbdbb45e1 core: Fix filter mask when copied to new image
Switch to using gimp_item_convert ()
instead of gimp_item_duplicate () so that
the filter mask can be properly associated
with a new image when copy/pasted.
2024-04-18 02:25:14 +00:00
Alx Sa dfb26f37e7 core: Allow copy/pasting NDE filters
Previously, filters were lost when copying
individual layers. This patch copies them
to the clipboard image on cut or copy,
then copies them back to the pasted
image.
It also fixes an issue where filters would
be merged down if a selection was
copied instead of the entire layer.
2024-04-18 02:25:14 +00:00
Jehan 252f991cfb app: swapping gimp_prop_color_button_new() and gimp_prop_gegl_color_button_new().
Color propwidgets now use GeglColor only.
2024-04-18 00:37:20 +02:00
Jehan 80334f0eba app: gimp_gegl_color_new() is not used anywhere anymore.
We don't need to convert GimpRGB to GeglColor now as we work directly with
GeglColor!
2024-04-18 00:25:14 +02:00
Alx Sa 2af0218d23 widgets: Do not show internal procedures as search actions
Resolves #11334

GBR, GIH, and PAT have internal save functions which are not meant
to be run directly. However, they were showing up in the Search dialogue
as valid options. This patch adds an additional check for "-internal" to
prevent users from accidentally running them, as they only give a warning.
2024-04-17 17:10:18 +00:00
Jehan 88d4033b98 Issue #9578: crash accessing tab menu.
The whole action name prefixing will definitely need to be straightened up in
our codebase at some point (differenciating the global actions and the local
ones).
2024-04-17 18:22:53 +02: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 bf91e454fd app: fix build warnings.
Fix 2 "discards ‘const’ qualifier from pointer target type" warnings.
2024-04-16 16:40:36 +02:00
Jehan f10d9a706d app: keep image reference with weak pointer in GimpStatusBar.
Unlike the previous 2 commits, this was not making an error but was the reason
why our code was keeping the last closed GimpImage alive a bit longer than it
should. In particular, the status bar code was keeping a hard reference to the
image until the focus changed, hence preventing the object to get finalized
longer than necessary.

Now it will also be a weak reference, so the image is immediately freed when the
view is closed.
2024-04-16 15:48:54 +02:00
Jehan d888e95cfa app: keep track of image with a weak pointer.
Similar to the previous commit, but this time for the GimpAlignOptions.
2024-04-16 15:43:40 +02:00
Jehan 9abda0ab00 Issue #10826: crash when closing view.
Using weak pointers to make sure that the previously pointed image is still a
valid GimpImage.
2024-04-16 15:43:40 +02:00
Jacob Boerema af8ef61a04 app, pdb: fix incorrect group checks for edit-cut and edit-named-cut
As a follow up to the previous commit, I noticed that the pdb functions
gimp-edit-cut and gimp-edit-named-cut also incorrectly used
gimp_pdb_item_is_group.

This can be seen by calling Filters/Blur/Tileable blur when a group
layer is selected. The error message was incorrect.
We replace the call here also to `! gimp_pdb_item_is_not_group`.
2024-04-15 18:13:32 -04:00
Jacob Boerema 7aa33bf771 app, pdb: fix #8363 gimp_selection_float() crash
Calling gimp_selection_float from a Python plug-in could make it crash
with an error like Calling error for procedure 'gimp-selection-float':
Item x cannot be used because it is not a group item.

This is caused by an incorrect check for group layers.
gimp_pdb_item_is_group returns an error when the condition is False,
while we only want an error when a group layer is selected (True).
Thus we need to use gimp_pdb_item_is_not_group, which returns an error
when the item is a group, which is what we want.

These function names are a little confusing, we might need to think
about better naming sometime.

I added C/Python tests for this function, so that we can test whether
this works correctly.
2024-04-15 18:13:32 -04:00
Alx Sa 2ee847d8d0 actions: Hide Preview Size dockable option if not needed
Resolves #11250

In 2.10, we explicitly hid "dockable-preview-size-menu", the submenu
for Preview Size, if there were no previews to set sizes for in the
dockable dialogue. In 2.99, this code was removed as part of the
GAction port and code clean-up.
As a result, the Preview Size submenu is always visible even if the
options have no effect on the display. To restore the 2.10 behavior,
we set each Preview Size option's visibility. If all options are hidden,
the submenu does not appear.
2024-04-13 01:43:31 +00:00
Jehan ef9de3c263 app: initialize font to NULL.
In case there are no fonts loaded (which may happen in particular when starting
with --no-fonts), we need to make sure that font is initialized to NULL so that
we can return the standard GimpFont object and not a broken pointer.

Thanks to Idriss for the additional diagnosis, which would hopefully complete
commit 5dc86277e6 and take care of #11219.
2024-04-12 12:23:00 +02:00
Cheesequake 702d5e1e80 Issue #11071: Changed detailed_signal from "map" to "realize" to enable opening animations 2024-04-11 14:59:15 +00:00
Jehan 5dc86277e6 app: set font factory as GimpFont class member regardless of fonts being loaded.
Previous code would only set the class member when we were actually
loading fonts, so we ended with code paths where the member was NULL.

Fixes:

> GIMP-CRITICAL: gimp_container_get_n_children: assertion 'GIMP_IS_CONTAINER (container)' failed

It should hopefully also fix #11219 (though I couldn't reproduce this
failure).
2024-04-11 12:15:59 +02:00
Alx Sa 49c820e620 dialogs: Use error variable in Welcome Dialog
Resolves #11256

A GError variable was created but not passed to
file_open_with_display () when opening recent files.
As a result, if an error did occur the variable would be
used while it was still NULL. This patch fixes this
by passing a reference to error as the last parameter
of file_open_with_display ().
2024-04-11 01:25:42 +00:00
Alx Sa f346b1783b widgets: Disable DrawableChooser if no layer/channel selected
Resolves #11075

In the DrawableChooser pop-up, choosing an image without
also picking a layer or channel causes the pop-up not to
reappear on subsequent attempts to click it. This is because
the callback is only recreated when the drawable is updated,
and choosing just an image does not update the drawable.
For 3.0, we'll set the Okay button to insensitive unless a layer
or channel is picked.
2024-04-09 12:51:30 +00:00
Alx Sa cc74d40769 libgimpwidgets: Port GimpPickButton to GeglColor
Also have "color-picked" signal send a
GeglColor object rather than GimpRGB.
2024-04-09 00:48:35 +00:00
Luca Bacci d7228727d7 QuitDialog: disconnect signal handler on dialog destroy
...rather than finalize.

Fixes #10785
2024-04-04 20:18:56 +00:00
Anders Jonsson 134c354a9e app, pdb, plug-ins: lower Spread limit for Distort
Distort can call plug-in-spread with Spread of 1000 which causes an error.
This limits it to 512 which is the highest allowed by gegl:noise-spread
2024-04-04 12:04:12 +00:00
cheesequake 63a134a2b2 Issue #11021: cairo-ARGB32 uses "associated alpha", so changed the new formats accordingly. 2024-04-03 03:12:12 +05:30