Commit Graph

2692 Commits

Author SHA1 Message Date
Jehan 90e96d800b Issue #11958: Critical when opening an image.
I had added an assert in commit 98ebe96c1f specifically to catch other
cases where we may have run gimp_ui_manager_update() with inconsistent
user context, and I failed to catch the obvious CRITICAL (the damn Error
Console was catching it!).
Anyway we had this other obvious case when creating new displays in
gui_display_create() which would trigger the ui update with still
inconsistent context.

Now I'm in fact wondering why GimpContext is simply not returning the
active GimpDisplay's image and connecting to the "image" property of set
display so that it's always synchronized. But since we are so close to
GIMP 3, and I don't want to do too important restructuration of code
(why did we do this complicated update in 2 parts? Maybe there was a
good reason…) at this point, I'll just do the simple skip for now and
look more closely at GimpContext implementation after the release.
2024-08-27 13:53:30 +02:00
Jehan 98ebe96c1f Issue #10441: encoding conversion popup when changing from SWM to MWM. 2024-08-26 13:35:49 +02:00
Jehan 49ce5c2aa5 app, libgimpwidgets, plug-ins: add `tooltip` arg to gimp_help_connect().
As Cheesequake noted in !1673, there may be cases where one would want
to run gimp_help_connect() while also setting a tooltip. So they also
run gimp_help_set_help_data(), even though the latter is implied by the
former. Worse, it makes the order matter too much because if you call
gimp_help_connect() after gimp_help_set_help_data(), the tooltip would
be removed.

Now the reason is that gimp_help_connect() was clearly made to be run on
windows whereas gimp_help_set_help_data() was for other widgets, which
usually don't need to react to F1. Yet the previous commit does add
F1-connect for the lock buttons, which kind of makes sense. So why not
just add this tooltip argument.

As a side fix, I am removing a bunch of gimp_help_connect() on each
button in the layers effect popover. Just run it once on the top
container.
2024-08-24 23:29:39 +02:00
Jehan 690391b985 app: fix layer filter copying.
Copying filters over from one image to a partial copy was broken on
multiple level by doing it on an additional loop, and assuming that the
originally selected layers and the newly created ones had the same
structure:

1. First the actually copied layers may be more numerous. For instance,
   we'd also copy parent layers. Typically copying a layer under a layer
   group, both the layer and its parent layer group would be in the clip
   image.
2. Second, because this structure may change, the assumptions made so
   that filters were not copied to the right image.
3. And as a last consequence, sometimes we could have crashes, assuming
   the same structure and therefore directly dereferencing a NULL
   pointer. I had such a crash when copy-pasting a layer group, while
   also selecting its children layers (though this crash also got hidden
   by my previous commit, but just by chance).

Instead just copy filters in the same time as layers are copied, so that
we can easily associate the filter from the correct original layer we
copied from.
2024-08-24 12:36:26 +02:00
Anders Jonsson 16fc6093ee app: lower the upper limit for feather selection
The real upper limit was 1500 from the standard deviation of
gegl:gaussian blur multiplied with a magic number 3.5,
see 586bb73293
2024-08-18 17:40:02 +00:00
Jehan 576554a0af app: Up/Down in GimpContainerTreeView should select items "visually".
layers-select-next/layers-select-previous don't work well as up/down
arrow behavior because they only work within each selected layer's
level. But historically (and that's what makes the most sense IMO, and
is the most expected behavior), up/down arrows would walk through the
layer list visually. I.e. that it would select next whatever is the next
layer displayed in the Layers dockable, even if it means selecting
children or going down one layer group level.

The 2 new actions "layers-select-flattened-previous" and
"layers-select-flattened-next" do this. Say you have this tree:

Layer 1
Layer 2
 | - Layer 3
 | - Layer 4
Layer 5

With the "flattened" actions, after Layer 2, there is Layer 3, and after
Layer 4, there is Layer 5… unless… Layer 2 (layer group) is collapsed.
In which case, after Layer 2 is Layer 5. This selection movement indeed
takes into account the state of the layer group expanders.

This makes the Up/Down arrows work similarly to how they used to work
with default GtkTreeView implementation, except that the logic now also
works well with multiple selected items.
2024-08-13 16:41:21 +02:00
Jehan aee55ab25c Issue #11729: reword descriptions of "Select Previous|Next Layers" actions. 2024-08-13 12:54:27 +02:00
Jehan 583fbc6607 Revert "Issue #11729: Select Previous/Next Layers commands only select one layer."
This reverts commit 31df873d4c.

My commit was not wrong per-se (it didn't add any bug), but it was in
fact not useful either, and only adding a useless list copy for no good
reason.
I thought that action_select_object() was actually selecting objects,
but looking at implementation, it in fact doesn't. It only returns a
pointer to the object to select.
2024-08-13 12:54:27 +02:00
Jehan 31df873d4c Issue #11729: Select Previous/Next Layers commands only select one layer.
Somehow it works fine on my machine, but this is very likely the
culprit. gimp_image_get_selected_layers() returning directly the pointer
to selected layers, we should always make a copy before doing anything
which would change this selection!
2024-08-12 14:48:56 +02:00
Jehan d0be4828ce app, pdb: improve cut error message and fix return value.
This fixes 2 issues:

1. Since gimp_edit_cut() uses gimp_edit_copy(), it had the same error
   message when no selected drawables were within the selection.
2. When there was a previously existing clipboard image, gimp_edit_cut()
   could return it as though the cut succeded, even when it did not.
2024-08-09 20:39:26 +02:00
Jehan cb18908d15 app, menus: rename the files too.
I did it in 2 commits otherwise git has a hard time seeing the move+edit
as a file move and the `git show` on previous commit is much less
useful.
2024-08-05 12:08:59 +02:00
Jehan d46d26933b app, menus: rename all "vectors-" actions to "paths-".
Though these are not as user-facing as other strings, the action names
still are somewhat user-facing. Let's rename them consistently with the
GUI and the API.

This commit also handles user config migration so that custom shortcuts
are not lost.
2024-08-05 12:08:59 +02:00
Jehan d493f0537f Issue #8900 and #9923: reimplementing GimpUnit as a proper class.
This fixes all our GObject Introspection issues with GimpUnit which was
both an enum and an int-derived type of user-defined units *completing*
the enum values. GIR clearly didn't like this!

Now GimpUnit is a proper class and units are unique objects, allowing to
compare them with an identity test (i.e. `unit == gimp_unit_pixel ()`
tells us if unit is the pixel unit or not), which makes it easy to use,
just like with int, yet adding also methods, making for nicer
introspected API.

As an aside, this also fixes #10738, by having all the built-in units
retrievable even if libgimpbase had not been properly initialized with
gimp_base_init().
I haven't checked in details how GIR works to introspect, but it looks
like it loads the library to inspect and runs functions, hence
triggering some CRITICALS because virtual methods (supposed to be
initialized with gimp_base_init() run by libgimp) are not set. This new
code won't trigger any critical because the vtable method are now not
necessary, at least for all built-in units.

Note that GimpUnit is still in libgimpbase. It could have been moved to
libgimp in order to avoid any virtual method table (since we need to
keep core and libgimp side's units in sync, PDB is required), but too
many libgimpwidgets widgets were already using GimpUnit. And technically
most of GimpUnit logic doesn't require PDB (only the creation/sync
part). This is one of the reasons why user-created GimpUnit list is
handled and stored differently from other types of objects.

Globally this simplifies the code a lot too and we don't need separate
implementations of various utils for core and libgimp, which means less
prone to errors.
2024-08-02 10:46:38 +02:00
Cheesequake 6b611a4802 actions: move top and bottom item check code 2024-07-18 17:57:17 +00:00
Alx Sa 0a3613e48d actions: Rename return_if_no_vectors_list macro...
...to return_if_no_paths to match the
change to GimpPath as well as the format
of the layers and channels macro.
2024-07-17 23:25:48 +00:00
Jacob Boerema 97df731de1 app: be consistent and use plural for multi-select path actions 2024-07-16 17:21:55 -04:00
Cheesequake afea82ed6c Issue #11809: Fix raise and lower actions for channels and paths 2024-07-16 15:21:44 +00:00
Cheesequake bdab00d04b Issue #11732: Fix Raise and Lower actions for Multi-Layer selections 2024-07-14 19:21:53 +00:00
Alx Sa 2e6938b3da app: Rename app/core GimpVectors vectors API...
...to path.
Changes the names of
gimp_vectors_* () API to
gimp_path[s]_* (). Renames related files
to [path] instead of [vectors], along with
relevant enums and functions.
2024-07-13 05:07:57 +00:00
Alx Sa e8df68fb65 libgimp, app, pdb: Rename GimpVectors to GimpPath
This commit renames the GimpVectors
object to GimpPath in both app/core and
in libgimp. It also renames the files
to gimppath.[ch] and updates the relevant
build and translation files.
There are still outstanding gimp_vectors_* ()
functions on the app side that need to be renamed
in a subsequent commit.
2024-07-12 06:16:25 +00:00
Alx Sa 7fe398ca1a display: Fix regression accidentally introduced 2024-07-11 01:38:13 +00:00
Alx Sa 5cd7c5c2f8 actions: Swapped text actions 2024-07-11 01:17:49 +00:00
Alx Sa 853f37bed9 app: Rename app/core GimpImage vectors API...
...to paths.
Similar to d0bdbdfd, but covering the
app/core versions of the API instead of
libgimp. Changes the names of
gimp_image_*_vectors () API to
gimp_image_*_path[s] ().
Also renames some related functions such
as gimp_image_pick_path (). The next step
will be to rename the gimp_vectors_* () to
gimp_path_* ().
2024-07-11 01:17:49 +00:00
Jacob Boerema 51b444b846 app, actions: be consistent and use plural for layer moving ...
commands that work on multiple layers:
Raise Layer -> Raise Layers
Layer to Top -> Layers to Top
Lower Layer -> Lower Layers
Layer to Bottom -> Layers to Bottom
Also update the hint strings.
2024-06-23 19:05:01 -04:00
Jacob Boerema 5f41b4460c app, actions: be consistent and call Duplicate Layer -> Duplicate Layers
Since it works on multiple selected layers use the plural like we
also do in other similar cases.
2024-06-23 14:09:06 -04:00
Jacob Boerema 6dbf144f6b app: add missing help ids for the text tool 2024-06-22 16:47:44 -04:00
Jacob Boerema 9c432f6505 app, actions: use consistent naming for Text to Path
In the main menu and layers dialog context menu it is called
`Text to Path`, let's use that same name in the text tool actions
instead of `Path from Text`.
2024-06-22 16:11:57 -04:00
Jacob Boerema a3ecca3487 app: fix some layer mask strings
Not all layer mask menu commands and help texts were updated to reflect
that they work on multiple masks.
Updates
- Apply Layer Mask -> Apply Layer Masks
- Delete Layer Mask -> Delete Layer Masks
- Their text hints and the one for Disable Layer Masks

Updates the undo strings, even though these don't seem to be used
anymore? Looks like undo always picks the menu command now.
2024-06-22 14:20:02 -04:00
Jehan 39ea23ed52 app, libgimp, plug-ins: improve GimpVectorLoadProcedure workflow.
I'm moving the logic of choosing a correct default for width/height by adding an
"extract dimensions" callback in the procedure. The logic is that every vector
format out there should likely have metadata either for pixel dimensions or
physical dimensions, or at the very least for no-unit dimensions (ratio only).

Vector load procedures will have to implement only the extraction of such data
in a callback called by GIMP but not how to act upon them, so that we have a
common logic for all vector images.

I am implementing this callback first in the SVG plug-in, moving all the code
to extract dimensions (and improving it) in this callback.

Also I am deleting "file-svg-load-thumb" procedure. I could simply reimplement
it using the same code, but it looks to me like this is very useless for vector
formats to have a specific thumbnail procedure (unless it were to use very
specific metadata for faster result). This is vector data, just ask it directly
at the proper bounding box size.
2024-06-08 18:58:06 +02:00
Alx Sa 83141ba62d actions, plug-ins: Minor clean-up and warning fix
*In file-pnm, format_name is no longer
used due to changes in exporting
functions. This was creating a warning
about an unused variable.

*In 519f301c, an attempt to add a
short-key for MacOS Settings was left in.
It did not work because "comma" should
be spelled out rather than using ",". This
patch removes the accelerator.
2024-05-28 16:16:29 +00:00
Alx Sa 519f301c65 actions: Use Settings rather than Preferences on MacOS
Per Lukas Oberhuber, Preferences should be called Settings
on MacOS, as it was before the GTK3 menu port.
2024-05-19 02:12:44 +00:00
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
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
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
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
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
Cheesequake 702d5e1e80 Issue #11071: Changed detailed_signal from "map" to "realize" to enable opening animations 2024-04-11 14:59:15 +00:00
Alx Sa 10eb615eff widgets: Port gimp_get_color_tag_color ()...
...to accept GeglColor paramaters instead
of GimpRGB. This function is used to draw
the layer/channel color tags.
Note that a temporary GimpRGB was left
to use with gimp_rgb_composite ().
It will be replaced once that function is
also converted to use GeglColor.
2024-04-02 04:00:50 +00:00
Alx Sa 69314ba087 tools: Add NDE support for group layers
This patch allows NDE filters to be
applied to group layers as well.
The "merge down" function is disabled.
2024-03-06 22:04:28 +00:00
cheesequake 1a76346ed5 Fixes:#10933 context swatch crash issue 2024-03-04 21:10:36 +00:00
Jehan 0b87030928 Issue #10776: Hide "Edit > Manage Extensions" for the release.
The extension format's official release is pushed for after GIMP 3 release.
Let's not leave this dialog around as it would confuse people.
2024-03-01 00:51:22 +01:00
Alx Sa 5ad18094db actions: Load opacity/mode/region properties in NDE
Resolves #10848.

In cc62f2b0, we moved the filter property loading code
earlier in the process. However, the opacity, mode, and
region options for GimpFilterTool were not included in
this move, so they reset back to defaults each time.
This fixes that problem so settings are retained when
editing.
2024-02-15 05:31:36 +00:00
Jehan 636a33aed2 app: GimpColorDialog now fully uses GeglColor. 2024-02-11 23:28:03 +01:00
Jehan 4a30f431fd app: work with a GimpPalette rather than a colormap.
We historically have both the colormap and palette concept in core GIMP,
though they are actually kinda the same concept, except that with
"colormap" we work with an array of raw data and it's a lot less
color-aware. It is still much more efficient in some specific cases,
such as when converting the image (we can then convert the whole palette
as a single buffer, because the image palette is space-restricted
anyway), when storing undo data or when storing/loading in XCF.

But for all the rest, let's use gimp_image_get_colormap_palette() and
work with the GimpPalette API.
2024-02-11 23:28:03 +01:00
Jehan dc1f5ea227 app, libgimp, pdb, plug-ins: GimpPalette are now GeglColor based. 2024-02-11 23:28:03 +01:00
Jehan b6856af9d8 app: GimpGradient now uses GeglColor.
I still see some limitations in GimpGradient, and in particular, they are still
always stored as RGB in GGR files. It would be nice if we could store the actual
color format. This way, if someone chooses a gradient stop as Lab or CMYK color,
that's what the gradient file would keep track of. But also even storing the
space of a color (instead of storing/loading always in sRGB, even though this
may still work fine as we store unbounded double values). This might warrant for
a v2 of GGR file format.

This commit also fixes loading of SVG gradient which was apparently broken
regarding hexadecimal color parsing.

Finally I improve gegl_color_set_alpha() by adding an alpha channel when the
initial format had none.
2024-02-11 23:28:03 +01:00
Jehan 916d032f67 app, libgimp*, plug-ins: GimpColorButton now space-invaded.
The invasion extended to some core widgets too, in particular GimpColorPanel (a
subclass of GimpColorButton). There was quite a lot of code depending on these
widgets.
2024-02-11 23:28:03 +01:00
Jehan b06fe36970 app, libgimp*, plug-ins, tools: settings custom check colors now space-invaded.
We pass 2 GeglColor through the wire now. Since it is passed very early
(when sharing the configuration), I had some issues with initialization
order of GEGL, and in particular when calling gegl_init() before
gegl_config() inside _gimp_config(), I had a bunch of such criticals:

> Plugin script-fu: GLib-GObject: CRITICAL: Two different plugins tried to register 'GeglOpPlugIn-transform-core'

Anyway in the end, I store the passed colors as raw bytes and strings in
the GPConfig object, and re-construct the GeglColor last minute in
_gimp_config().
2024-02-11 23:28:02 +01:00
Jehan 4879ab7b7f app, libgimp, pdb, plug-ins: move more code to GeglColor.
In particular, I updated the channel and quick-mask colors, padding colors and
more.
2024-02-11 23:28:02 +01:00
Jehan a60b16f497 app: grab HSV values directly from GeglColor.
Absolutely no need to use intermediate GimpRGB and GimpHSV now convert data
ourselves with gimp_rgb_to_hsv() and gimp_hsv_to_rgb().
2024-02-11 23:28:02 +01:00