Commit graph

6589 commits

Author SHA1 Message Date
Jehan
135ed4d2b6 app, libgimp, pdb: set all drawable selection functions as deprecated.
Also fix a bit of "Since:" annotations, some minor spacing fixing and
remove one useless test (if we test if a type is an item, we don't need
to test the children drawable type).
2025-11-17 12:14:56 +01:00
Alx Sa
37a0e37d25 widgets, pdb, libgimp: GimpProcedureDialog Item Widget
This patch adds a GimpItemChooser widget
for use in GimpProcedureDialog Item parameter
GUI creation.
This will deprecate the existing
GimpDrawableChooser, as it covers all the
same cases plus others such as GimpPath.
2025-11-16 16:42:24 +00:00
Alx Sa
bb9c3a85dc core: Fix copied channel naming
Per Jehan's note in the UX repo, we should
call copied channels "Floating Channels" rather
than the default "Floating Selection".
2025-11-16 14:07:55 +00:00
Jacob Boerema
5cc55d078b app: fix #15288 crash when loading malformed xcf
ZDI-CAN-28376 vulnerability

Add extra tests to not crash on a NULL g_class.
2025-11-13 18:49:15 -05:00
Alx Sa
a9dc4ddb2c widgets, pdb, libgimp: GimpProcedureDialog Image Widget
This patch adds a GimpImageChooser widget
for use in GimpProcedureDialog Image parameter
GUI creation.
2025-11-12 03:12:24 +00:00
Alx Sa
ea3c4dfc5a core: Pass through group mask size matches render
In 85d381bd, we fixed pass through layer groups to match
the size of the group render, allowing for filter effects to
be applied on all layers below.
This patch extends that fix to layer masks created on pass
through layer groups. This allows you to create a mask and
then selectively hide/show effects on the layer below,
like a maskable adjustment layer.
2025-11-09 15:47:17 +00:00
Gabriele Barbero
5d03bb847e core, widgets: ensure to add colors of GimpFillEditor in color history once
Previously, changing the color via the GimpFillEditor color button
immediately pushed each intermediate value into the color history,
polluting it with transient previews. Only the final choice
confirmed by the user should be recorded.

Now the color is recorded in the history only when the user explicitly
confirms the selection (e.g. OK/Apply), preventing noisy
history entries while preserving the expected behavior when a color
is accepted.

core: add spaces to fix alignment
2025-11-08 18:50:33 +01:00
Jehan
5ff80c7dfb app: fix duplicating link layers.
Link layer duplicates were reusing the same GimpLink as the original
layer, because the properties sync was done after we created a new link
object.
2025-11-08 13:34:16 +01:00
Jehan
8a0754a5be Issue #15121: link layer positioning problem.
Only store a PROP_TRANSFORM if there is a transform. Otherwise the
stored offsets are bogus and would only break the position at load.
2025-11-08 12:37:45 +01:00
Gabriele Barbero
c5e9b51c0d Revert "core, display: Enable resize for GUI layer copying"
This reverts commit 975d1a4aa3.
2025-11-07 22:50:45 +00:00
Gabriele Barbero
50dfd8d9e9 core: enable the resize undo for drawables inside gimp_item_resize
This commit makes sure each layer has the resize undo enabled
when rezising, in order to make sure that are correctly added to the
undo step.
2025-11-07 22:50:45 +00:00
Alx Sa
ab620151c5 core: Workaround for link layer monitoring on Windows
As of GLib 2.86.1-1, GFileMonitors created with the
G_FILE_MONITOR_WATCH_HARD_LINKS
flag are not monitored on Windows.
This means that link layers will not
automatically update when the external
source is edited.
We will temporarily use the
G_FILE_MONITOR_NONE flag on Windows
until this is resolved
2025-11-06 22:19:54 +00:00
Jehan
dddca29423 app: move the tool swapping code to tool manager and action to tools-action.
Per review, let's avoid having all the tools history in every
GimpContext.

Also a further commit will work on special-casing filter tools, which is
why we are storing up to 3 tool infos, instead of only 2.
2025-10-31 13:54:59 +01:00
Jehan
eeb419a363 Bug 373060 - allow to easily switch to last used tool.
New action "Last Tool" ("context-tools-swap"), defaulted to <shift>X.
Thanks to Damien de Lemeny for the original patch and Alexander Hämmerle
for the test case in test-ui.c.
2025-10-31 13:54:59 +01:00
Jehan
1fa3bc8e51 Issue #14014: do not allow NULL or empty parasite name.
This reverts commit 7b023177a8 and reimplement it as a CRITICAL because
if this happens, a bug has occured. If so, we don't want to hide the
bug, we want to be warned of it so that we can investigate further.

Clearly it should simply not be possible to create a parasite with a
NULL name. First if we look at xcf_load_parasite(), we were already
returning early when the name was NULL. Also even the constructor
gimp_parasite_new() has an early check and will return NULL on a NULL or
empty name.

So the question is: how come we had a parasite with NULL name (if that
is really the problem)? I don't have the answer to this and it's
possible that this bug had already been fixed somehow. But in any case,
if it happens again, we'll want this CRITICAL to run.
2025-10-28 13:48:48 +01:00
Gabriele Barbero
7b023177a8 core: check for NULL name in gimp_parasite_list_remove
Sometimes, probably due to a metadata corruption, a pasarite with a NULL
name can be present in the parasite list. This causes a crash when
trying to remove it, because `gimp_parasite_list_find` does not accept NULL
keys. This commit adds a check for NULL names in `gimp_parasite_list_remove`.
2025-10-28 00:27:51 +00:00
Jehan
8f9b742b51 Issue #14799: sync source and filtered container freeze count at creation.
This one was happening very rarely, which made it hard to track, though
I think it would happen more frequently to people with a lot of fonts
(and therefore font loading would take a lot of time) since the
problematic situation occured when the thread callback
gimp_font_factory_load_async_callback() would run after the
corresponding tagged container was created in constructor
gimp_data_factory_view_constructor().

When this happened, the source and filtered containers were not
synchronized regarding their freeze count. And in particular, the
filtered container would have one less freeze and would try to thaw once
the thread callback ran and thaw the source container, which was
provoking the CRITICAL.
2025-10-27 16:39:55 +01:00
Jehan
a9dce982a6 Issue #13787: ignore GimpControllerMouse when migrating controllerrc.
As said in previous commit, this controller was removed as commit
76ddf4421c. Unfortunately we can't easily remove the full
(GimpControllerInfo) record, unless we were to redo or enhance the
migration code, because current code works line by line.

Nevertheless this change is enough to render the GimpControllerInfo
object invalid in a way where we can detect and clean it out (cf.
previous commit).
2025-10-24 02:24:53 +02:00
Jehan
a43b894f53 app: fix a string leak. 2025-10-23 01:18:58 +02:00
Jehan
2edd6ccb95 app, pdb: do not push undos on rasterizables when loading a XCF.
Fixing:

> GIMP-CRITICAL: gimp_image_undo_push_rasterizable: assertion 'gimp_item_is_attached (GIMP_ITEM (rasterizable))' failed

… when loading the XCF from #14131.
2025-10-23 01:16:58 +02:00
Jehan
a5ac6eb9c1 app: fix merge visible layers when there are pass-through groups. 2025-10-22 23:58:56 +02:00
Jehan
833e5858a3 app: fix merging a pass-through layer group.
See issue raised in gimp-ux#681.
A merged pass-through is typically bigger than its contents' bounding
box.
2025-10-22 23:57:46 +02:00
Jehan
e7842fea26 app, pdb: improve erroring on "Merge Down".
- Merging down a pass-through group onto a layer below does not make any
  sense, considering how the below layer is the input to the
  pass-through.
- Adding ability to blink problematic items when merge down fails. This
  will help people to figure out what is the problem.
2025-10-22 23:34:30 +02:00
Jehan
1235bf00bd app: factorize auto-rename code into GimpRasterizable.
Rasterizable objects are all created from some side data and can be
renamed automatically based on this data (from the link file for link
layers; from the path for vector layers; from the text for text layers).

So let's share code.
2025-10-22 22:29:19 +02:00
Jehan
eed69f42c0 app: support a GimpPath as GValue.
Fixes on stderr:

> gimp_g_value_get_memsize: unhandled object value type: GimpPath
2025-10-22 19:33:58 +02:00
Jehan
11dc1c6b47 app: revert to previously selected drawables when getting out of quick mask. 2025-10-16 01:03:25 +02:00
Alx Sa
931f60923a core: Commit NDE filters on Quick Mask exit
Per Reju, NDE filters are not factored into the selection
created when turning off the Quick Mask.
This patch adds a call to gimp_drawable_merge_filters ()
on exit so that all active filters are merged down before
the selection is made.
2025-10-15 19:36:41 +00:00
Jehan
c5cdea4842 app: copy the rasterization state for all 3 types implementing GimpRasterizable. 2025-10-14 22:06:04 +02:00
Jehan
67a04ba3b2 app, libgimp, pdb: port GimpRasterizable interface to libgimp too. 2025-10-13 16:37:25 +02:00
Jehan
d593cb3230 app, pdb, po: new GimpRasterizable interface.
Share the whole rasterize logic of the text, link and vector layer into
an interface. I didn't write it as an abstract parent class, because we
might have more rasterizable items in the future, which may not be
layers (e.g. there were discussions of vector masks).
2025-10-13 15:37:11 +02:00
Alx Sa
e224278517 app, modules: Resolve unused Windows variable warnings
This patch adds moves several variables that are not used
on Windows to #ifndef G_OS_WIN32 blocks to prevent
warnings on Windows builds.
2025-10-12 14:06:04 +00:00
Jehan
7c7f7b4898 app, libgimpwidgets: add 2 new icon macros.
New libgimpwidgets icon macros: GIMP_ICON_LAYER_LINK_LAYER and
GIMP_ICON_LAYER_VECTOR_LAYER. Note that the actual icons still need to
be done so I use temporary actual icon designs for now.

Also adding some TODOs for these.

Fix run warning:

> WARNING: icon theme has no icon 'gimp-vector-layer'.
2025-10-10 23:34:37 +02:00
Jehan
144ce9b897 app: fix updating sessionrc from 2.x to GIMP 3.2.
While "gimp-vectors-list" migration to newer name "gimp-path-list" was
correctly happening from GIMP 3.0 to 3.2, there is a different code path
from 2.x to 3.2 (because the scale factor update can only happen in this
latter codepath). So this part of the migration needs to be duplicated
in both update functions.
2025-10-10 19:39:14 +02:00
Jehan
432c3089fd app: fix migration of "vectors"->"path" renamed action from 2.10.
While the migration code did exist from 3.0 shortcutsrc, we need to
duplicate this for the menurc migration, in case someone were to migrate
from 2.10, 2.8 or older (i.e. installing 3.2 after GIMP 2 without having
ever installed 3.0 in-between).
2025-10-10 12:16:50 +02:00
Jehan
c392d8ea7f app: remove various layers discard action in favor of layers-rasterize.
The following actions are removed: layers-link-discard,
layers-text-discard and layers-vector-discard. The new action
"layers-rasterize" introduced previously will handle all of these.

Since layers-text-discard is the only one which existed until GIMP 3.0,
we are migrating any custom shortcut which may have been set to
layers-rasterize (both from 3.0 shortcutsrc or older menurc).

Action layers-link-monitor is also removed (in favor of layers-retrieve)
but no migration code is added, since this didn't exist in 3.0.
2025-10-10 12:16:50 +02:00
Jehan
a54e13c105 app: fix converting 2.10 menurc to 3.0 shortcutsrc.
Ugh. How did this happen?!
2025-10-10 12:16:50 +02:00
Jehan
1ca6faab0d app, menus: new actions layers-rasterize and layers-retrieve.
These 2 new actions are meant to be usable on all 3 types of non-raster
(and non-group) layers, i.e. link, text and vector layers, to
respectively rasterize and un-rasterize them.

This will also work with multiple selected layers, and is not specific
to one type of layers.

I also change how gimp_text_layer_discard() used to work, by marking the
text layer as modified instead of actually discarding all text
information. The main consequence of this was that a layer rasterized
this way was forever lost. Now it can actually be revived as a text
layer, not only through the new layers-retrieve action, but also by
trying to edit it with the Text tool, which will trigger the same dialog
as when a text layer had been rasterized by editing it with a paint
tool.

Whereas the label of "layers-rasterize" seem to be quite straightforward
(simply "Rasterize" per discussions in gimp-ux#252), I am really unsure
of the label for "layers-retrieve". Further UX discussions should help
on this front.
2025-10-09 20:41:11 +02:00
Jehan
0ae163e43c app: fix partial canvas update when hiding or removing filter on…
… pass-through group layer.

Because of the strength-reduce pass-through to normal mode, we had case
when the effective layer mode of a pass-through group ended up to
Normal, which may shrink the effective bounding box.

Note that getting rid of the GimpGroupLayer's get_effective_mode()
(gimp_group_layer_get_effective_mode()) implementation was also fixing
this issue. I did hesitate a lot because it is also simplifying the code
a lot. But I was also wary about getting rid of the optimization
previously made by Ell (see commit fa9a023c270; note that I haven't
actually tested how efficient this optimization is).

This seems like a good compromise.
2025-10-08 01:23:07 +02:00
Jehan
85d381bd0c Issue #15004: empty pass-through groups have no size, making it…
… impossible to use them like adjustment layers without additional step.

Even without the "adjustment layer" look-alike use case, this is wrong,
because an effect on an adjustment layer will be only applied on the
area contained in child layers, whereas by definition, a pass-through
layer would use the below render as input, and therefore its output
could be bigger than its child layers box.

I could find commit aa9ae1c65c as a culprit commit, and reverting it
would in fact also fix this issue, though by doing this, we'd regress on
the issue #4634 (I tested with one of the contributed XCF and can indeed
reproduce the bug).

Instead I return the unioned bounding box of the node, and of the
computed one. I do not feel like it's optimal, but this feels like a
complicated issue. It looks to me like there might be another deeper
issue in how both these bounding boxes are computed (not optimally!).

In any case, it also makes empty pass-through groups now usable to apply
directly an effect on the whole below render, as a side effect.
2025-10-07 23:34:55 +02:00
luzpaz
91418131a0 app, libgimp*, pdb, themes: Fix description typos
This patch fixes minor typos in user-facing descriptions
and internal comments found by Codespell.
2025-09-24 16:50:15 +00:00
Jehan
28fa2e5fc7 app, libgimp, pdb: new function gimp_link_layer_get_mime_type().
As discussed with NikcDC, this will be useful, for instance for the SVG
export to know the mime type of the linked file. If not PNG, JPG or SVG,
we may want to output a small warning that some viewers may not be able
to read such files, since the SVG spec makes the support of these 3
formats only as mandatory.
2025-09-24 16:11:01 +02:00
Jehan
ba1de3b68e app, libgimp, pdb: add GimpLinkLayer base API.
Still more to be done, but this is the basic, working API.
2025-09-24 01:56:52 +02:00
Jehan
789d82355c app, pdb: "Add Layer Mask" dialog asks whether to edit mask immediately.
While there are cases when you want to edit the mask straight away (this is
often the case when starting with a white or black mask), in many other cases,
the mask may be already as you want it per its initialization (e.g. when
initializing with a channel, selection, the alpha channel, etc.).

Until now, the Add Mask dialog was always switching to the "Edit Layer Mask"
mode by default, which forced an additional unneeded click each time you created
a mask (and were in a case where you initialize the mask as you want it
directly).

Now adding "Edit mask immediately" feature in the "Add Layer Mask dialog":

* It's checked by default to keep historical behavior.
* As most other dialogs, the last value is remembered, allowing people with
  repetitive workflow not to have to repeatedly set the settings each and every
  time.
* This default is also visible and settable in Preferences > Interface > Dialog
  Defaults.
2025-09-22 22:04:32 +02:00
Jehan
7c947ef1af app, libgimpbase, plug-ins: deprecate GimpPixPipe.
This really feels like internal API which we'd want to keep private (and
used by core plug-ins only).

Also as Jacob noticed, it's not even included in libgimpbase/gimpbase.h
so plug-ins wishing to use this API need to include this file
specifically anyway (but the header is still installed and the API is
introspected).

Since we cannot remove these functions now that GIMP 3 was published,
for API stability, I am only deprecating them both in the C API with
macros and in the bindings with GObject Introspection annotations.
Therefore any third-party plug-in developer trying to use these
functions in a plug-in will get build-time or run-time warnings.

Then when we'll move on to GIMP 4 development, we can remove the
deprecation and simply make this file private-only use instead.
2025-09-11 16:23:57 +02:00
Gabriele Barbero
5a34856e38 core: fix wrong if condition in gimp_drawable_duplicate
Probably a typo: the wrong control variable was used in the if statement.
This caused a segfault when duplicating a drawable if new_filter was NULL.
2025-09-06 17:04:51 +02:00
Alx Sa
599a6c7afe core: Fix Lab & CMYK ACB palette import
Converts the babl formats for Adobe Color Book
Lab and CMYK formats to "float", to prevent a crash
when accessing u8 Lab colors that have negative values
and CMYK colors that are too dark.
2025-09-05 11:02:13 +00:00
Liam Quin (ankh/demib0y/barefootliam)
760ef381fe fix crash on build or startup if extensions file does not exist 2025-08-30 18:41:03 +00:00
Jehan
38c379cd92 app: properly forbid paint tools to draw on link layers and forbid…
… filter tools to merge filters, both on link and vector layers.
2025-08-30 10:12:17 +02:00
Jehan
2c44689fe2 app, po: localize various strings which were blocked by string freeze. 2025-08-30 09:15:28 +02:00
Jehan
4f3aee5e83 Issue #14759: link layers (of vector files) initial dimensions will fill…
… the whole canvas while keeping aspect ratio of the source image.

The previous dimensions were not entirely "out of the blue" since they
were taken from the file, but very often dimensions from vector images
are kinda bogus (apart from aspect ratio, they don't mean much) anyway.

Now we will just fill the canvas box by default.

When changing the source file of an existing link layer though (through
Link Layer properties), the dimensions will be within the current layer
bounding box.

Also I realized that we need to also store the link width/height in the
XCF because the buffer width/height may not be right (in case a
transform matrix was applied). This commit therefore breaks XCF file
with link layers made in the last 2 days. Since we have not made even a
dev release, it's probably fine to do this and not bump the XCF version.
2025-08-28 23:13:03 +02:00