Commit Graph

24700 Commits

Author SHA1 Message Date
Jehan b8712b27de Issue #12011: gimp-path-import-from-file etc. are misnamed. 2024-09-11 16:26:45 +02:00
Jehan 41a2596d29 Issue #12021: Text editor Open and Clear buttons disabled and without icons.
Also remove "text-editor-toolbar" which was one of these fake actions
only used to represent submenus in the old action implementation.
2024-09-11 15:24:20 +02:00
Jehan 0c484ddcd3 Issue #3495: broken conversion when changing TRC.
When converting an image TRC (or a precision+TRC change), we used to
convert the profile to a linear (resp. sRGB TRC) variant or use the
builtin profile, which we'd set on the image.

Pippin is telling me that "it used to be that linear and non-linear
precision gave different results, rather than only about how things were
stored". Yet this is not needed anymore. Nowadays "RGBA foo" + any
profile is linear anyway, disregarding the profile's TRC.

Furthermore, this way, we don't lose the original TRC in a non-linear ->
linear -> non-linear roundtrip and we simplify the code, which fixes
such problems as shown in #3495 as a side effect.
2024-09-11 13:16:28 +02:00
Stanislav Grinkov 8f5775ee0c display: Use label for GimpStatusComboBox width
We check the width of the zoom label (if it exists) and use it to size the
combobox's entry field. Otherwise, we default to the existing formula.
Also removes Windows special-casing for PERCENT_SPACING constant,
as Pango now uses harfbuzz on Windows as well.
2024-09-10 20:44:54 +00:00
Alx Sa c8694485db operations: Revert legacy modes for performance
This patch temporarily reverts 02546da7,
due to performance issues with our use
of Babl. After 3.0, we'll try to improve
these operations so they can be more
color correct.
However, GimpRGB, GimpHSV, and GimpHSL are
replaced with double arrays.
2024-09-09 14:39:19 +00:00
Alx Sa 8138b1eaee operations: Create legacy GimpColor conversions
There are certain operations where we're
not yet getting sufficient performance with
Babl. For these legacy operations, we'll
use the original GimpHSV/HSL conversions
internally. This will allow us to replace
them in the future without plug-in
developers relying on them.
2024-09-09 14:39:19 +00:00
Jehan 0270fa5d7f app: do not rely on data name for identifying internal data.
The name for internal data may be localized. This is the case at least
for some dynamic gradients (Foreground to Background and others).
Nevertheless they have unique collection name. So let's simply rely on
this for internal data.
See point 2 in: https://gitlab.gnome.org/GNOME/gimp/-/merge_requests/1830#note_2218014

I also change the standard alias fonts to also have unique collection
names. These seem to be the only other internal data which had no unique
collection until now, which is now fixed.
2024-09-09 13:45:14 +02:00
Jehan a92388c433 Issue #9270: Change GimpBrushSelect to choose only brush.
gimp_brushes_popup() was triggering a popup allowing to change not only
the brush, but also the "paint mode", the opacity and the spacing. As
far as I could see, this was used nowhere for the paint mode and
opacity.

As for the spacing, it looks like gfig was indeed getting this data,
except that the GimpBrushSelect was disabling the effect on this scale
by setting change_brush_spacing to FALSE when calling
gimp_brush_factory_view_new(), and even setting this to TRUE, it was not
working fine anyway. Rather than debugging this, let's simplify the API.
Such settings seems like additional paint settings which don't have to
be in the brush selection. If someone wants people to also select an
opacity, spacing or paint mode, it would be much more efficient to add
separate plug-in arguments for these.

Additionally, I fix GimpBrushFactoryView not to show the spacing scale
when change_brush_spacing was set to FALSE anyway. This is just a bogus
widget then, which can only confuse people.
2024-09-06 18:14:01 +02:00
Jehan 75a50ce87b app, libgimp, pdb, plug-ins: add ability to default to context for all resource args.
Also fixes the passing of the resource param definitions through PDB.
There was some weird assumption, with a comment, in commit 73733335c8
that this was unneeded, which meant that we were not able to properly
recreate the right param spec over the wire.
2024-09-06 16:33:24 +02:00
Alx Sa 6f8231eee6 app/file-data: Remove GimpRGB from file-data-gbr.c
Composite code also simplified since we only need to operate on
grayscale rather than 3 channels for RGB.
2024-09-05 21:21:37 +00:00
Alx Sa 80ed0268e3 plug-ins, operation: Remove uses of GimpHSL
GimpOperationHueSaturation did not do
conversions since the source was already
HSL, so its GimpHSL object was replaced
with a float array.
Van-Gogh plug-in's RGB -> HSL
conversion was replaced with an
HSL float Babl format with gegl_buffer_sample ().
2024-09-05 12:15:29 +00:00
Jehan ba3da3d338 app, libgimp*, pdb: new GimpParamSpecObject abstract spec type.
This abstract spec type is basically a GParamSpecObject with a default
value. It will be used by various object spec with default values, such
as GimpParamSpecColor, GimpParamSpecUnit and all GimpParamSpecResource
subtypes. Also it has a duplicate() class method so that every spec type
can implement the proper way to duplicate itself.

This fixes the fact that in gimp_config_param_spec_duplicate(), all
unknown object spec types (because they are implemented in libgimp,
which is invisible to libgimpconfig) are just copied as
GParamSpecObject, hence losing default values and other parameters.

As a second enhancement, it also makes it easier to detect the object
spec types for which we have default value support in
gimp_config_reset_properties().

As a side fix, gimp_param_spec_color() now just always duplicates the
passed default color, making it hence much easier to avoid bugs when
reusing a GeglColor.
2024-09-04 22:34:49 +02:00
bootchk 73733335c8 libgimp: plugins: fix #10950 resource defaults not effective
Now you can declare a default value when declaring resource arguments to
a PDB procedure.

Add default behavior to GimpParamSpecResource.
Add field and override g_param_spec_value_set_default.

Fix the plugins that have resource arguments.
Some plugins temporarily use a hardcoded default instead of declared default.
ScriptFu plugins, TODO.

Misc fix to the test plugin for this case: test-dialog.py.
Dev>Demo>Test dialog...

TODO 10822 Lava plugin issue depends on this.

Note film.c fixed but still doesn't work.
2024-09-04 21:32:28 +02:00
Jehan d7fadf9fe6 Issue #11988: GEGL param specs are not serialized anymore.
This is a regression brought with commits 9b5463b5c5 and f7aaba9fc9.
Technically the bug already existed, but it was brought to light after
the reordering of our param bit flags, because GEGL_PARAM_PAD_INPUT
(which is set on all op properties) and GIMP_PARAM_DONT_SERIALIZE are
now the same value. It used to be same as GIMP_CONFIG_PARAM_AGGREGATE,
which, by chance only, didn't have unfortunate consequence on
serialization, yet that was also a bug. The real fix is that we should
not propagate GEGL bit flags in our operation config types.
2024-09-04 13:48:03 +02:00
Alx Sa 3a0fb282a4 app/tools: Don't merge filters on layer groups
Resolves #11993
In !1319, we added the ability to merge down filters destructively
in the Filter Tool GUI. This accidentally allowed you to merge down
a filter on a layer group. This patch adds checks to prevent this
option from being used, in the same way we hide the option when
editing an existing layer effect.
2024-09-04 01:34:56 +00:00
Alx Sa ece9929996 app/widgets: Remove GimpRGB from gimpwidgets-utils.c
The colors are assumed to be sRGB since they come from a
pre-defined array and are used for the item color tags in the
GUI. This replaces the call to gimp_rgb_composite () with the
direct implementation of the GIMP_RGB_COMPOSITE_NORMAL
code.
It also ensures that only one call is made to gegl_color_set_rgba (),
rather than two if the color is inherited.
2024-09-03 03:24:10 +00:00
Alx Sa fc7c3d0666 core: Update layer effect masks during conversion
We weren't updating the precision of layer effect masks when
converting the layer's precision. This patch updated with the
format from gimp_image_get_mask_format ().
Note that in the future, this code should be moved to
gimp_drawable_real_convert_type () once that function is used
in all the child classes of GimpDrawable.
2024-09-02 21:42:43 +00:00
Alx Sa fd091bc005 pdb: Check number of arguments for gimp_file_save ()
gimp_file_save () is used to save both XCF
and export formats like PNG. XCF does
not have a GimpExportOption parameter,
but we were unconditionally copying it.
This patch adds a check for this.
2024-09-01 18:29:04 +00:00
Jehan 49b68fbf38 Issue #11725: do not try to uninhibit when inhibiting was not done by GIMP.
As noted by bootchk, docs of gtk_application_is_inhibited() says:

> Determines if any of the actions specified in flags are currently inhibited (possibly by another application).

The last part, between parentheses imply that it's possible for another
application to inhibit GIMP. So we should not rely on this function to
verify we inhibited the logout. Just check of we have an inhibition
cookie.
2024-09-01 01:15:10 +02:00
Jehan f7aaba9fc9 app, libgimpbase, libgimpconfig: make our custom GParamFlags definitions…
… more robust.

GIMP_PARAM_NO_VALIDATE and GIMP_CONFIG_PARAM_DONT_COMPARE were the same
value, most likely because when GIMP_CONFIG_PARAM_DONT_COMPARE got added
(commit c5c807d191), the comment to keep in sync
libgimpbase/gimpparamspecs.h and libgimpconfig/gimpconfig-params.h was
missed.

Instead, since libgimpconfig can include libgimpbase, do the other way
around: first non-GLib param flags are in libgimpbase, then we add a
GIMP_PARAM_FLAG_SHIFT, then we increment from it in libgimpconfig, and
finally we increment from GIMP_CONFIG_PARAM_FLAG_SHIFT if ever we add
more flags in app/ (right now GIMP_SYMMETRY_PARAM_GUI is apparently the
only one, but this may change).
2024-09-01 00:12:27 +02:00
Jehan 42f7a167c3 Issue #11922: Fatal error on closing main window when in export plug-in. 2024-08-30 17:10:30 +02:00
Alx Sa 8b57aabed2 display: Update View options after GimpDisplay updated
Previously, we called gimp_display_shell_appearance_update ()
which updates the "Show" settings in the View menu *before*
we had updated the Display object in GimpContext.
This meant that the wrong settings were being applied when
switching images.
This patch moves the call after we run gimp_context_set_display ()
to make sure we've got the right active Display.
2024-08-29 23:11:07 +00:00
Jehan 6a465876ec app: do the quick exit on point releases, whether stable or unstable.
The other way around, we were going to have the quick'n dirty exit for
the whole 3.0 stable branch, which is obviously not what we want. We
want the clean exit for all developer builds, even within a stable
branch.
2024-08-29 18:26:38 +02:00
Jehan 10e8b5d0c1 Issue #11967: fix CRITICAL. 2024-08-29 16:46:27 +02:00
Alx Sa a4f9e7e89a widgets, themes: Define colors for GimpBlobEditor
The color for the nib handle is pulled from
the widget's background-color style.
However, this was not defined - so it was
always (0, 0, 0).
This patch adds a GimpBlobEditor CSS
class and defines the background and
border color for it to resolve the issue.
2024-08-29 13:30:39 +00:00
Jehan f2d5ff446a app: clear more dangling weak pointers. 2024-08-28 21:25:33 +02:00
Jehan c8c17a3509 app: remove a dangling weak pointer on an image.
This may have a reason for some memory-related crashes which happened
when color chooser dialogs were raised, e.g. in #11956.
2024-08-28 21:05:08 +02:00
Jehan 195bd5fc8e app: fix 2 g_object_weak_unref() calls. 2024-08-28 21:05:08 +02:00
Jehan b9a6d8fc70 app: fix pasting into a channel.
It was made impossible to paste into a channel, as this was creating a
normal layer instead. We need to use floating selections when the pasted
target is a GimpChannel type.

Note that the UX is very ugly right now for these (except for the layer
mask case as I improved this a lot with commits 04810ec95e and
28457ce337), so I opened issue Teams/GIMP/Design/gimp-ux/89 to design
further evolutions.
2024-08-27 21:27:49 +02:00
Jehan 17b094ecc4 Issue #9600: CRITICAL when anchoring a floating selection to the image's selection. 2024-08-27 19:09:48 +02:00
Jehan 4e499810a5 Issue #11957: also ignore events when switching to MWM.
This is a follow-up of commit c5db158f58, where the flickering issue was
happening when creating new windows when already in multi-window mode. I
had the same issue again when I had several tabs opened in SWM and
switched to MWM. Then it would undraw displays to move them to their own
window. In the short time when this occurs, we don't want to process
events. So now I changed the "drawn" status when undrawing ("unrealize"
event) a shell.

I also changed the implementation of gimp_displays_accept_focus_events().
What we need is to check the active shell only of each window. In SWM in
particular, it is normal that non-visible tab shells get unrealized.
2024-08-27 17:37:00 +02:00
Jehan 7b669a9ac9 Revert "app: fix a random segmentation fault."
This reverts commit 77712347d1.

The fix was wrong. See #11962.
2024-08-27 16:04:29 +02:00
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 82c607d4a8 app, libgimp, pdb: support triple-backticks unformatted desc sections.
The previous PDB generation was losing pre-formatting inside
triple-backticked blocks. In particular we were losing indentation
(which was already ugly in C, but even syntactically wrong when
displaying Python code samples). And it was also making us add
double-newlines between every code lines, which was annoying.

This updated code now leaves triple-backticked sections as-is.

Unfortunately I was completely unable to do this by modifying the
existing functions, which were modifying the input arg in-place. So I
made them into functions returning the result. But then there is another
part of code (niceargs()) where changing array contents doesn't work
properly, and worse it seems to corrupt the array somehow (because I
have generation breakage in completely-different pieces of the PDB
generation code). I believe there is some passing-by reference/value
concepts in perl which I don't quite get (they use `&`, `\` and other
symbols and even searching for these, I don't quite understand how to
use them the right way) but I've spent already too much time on this. So
since I've got something working now by having duplicate functions, I'll
let someone else from the future, who knows better perl, re-merge these
functions if they know how.
2024-08-27 11:48:49 +02:00
Jehan 0fe66771da app, libgimp, pdb: fixing broken GIR links.
The 'help' field needs to be single-quoted so that @-values do not look
like perl variables, hence breaking GIR annotations.

Fixing:

> Possible unintended interpolation of @Gimp in string at /home/jehan/dev/src/gimp/pdb/groups/item.pdb line 64.
2024-08-27 00:26:59 +02:00
Jehan d1c8e5efb9 app, libgimp, pdb: prettify the previous commit.
I double-checked the gi-docgen docs and realized the "Note:" were all on
the same line as previous text. I had forgotten it just removed one
newline. So if I want a new paragraph (double-newline in markdown), I
need 3 newlines in the pdb file.
2024-08-26 22:48:45 +02:00
Jehan 890a3c715f Issue #10673: make clearer API docs for _id*() functions.
All the functions working with object's IDs are mostly internal. They
are still made public because they can be useful and are relevant in
specific use cases (i.e. using IDs to reference items in specific
widgets, such as drop-down lists, or when temporarily storing an item as
integer, etc.).
Yet it should be made clear that these usages are the exception rather
than the norm.
2024-08-26 15:03:24 +02:00
Jehan 98ebe96c1f Issue #10441: encoding conversion popup when changing from SWM to MWM. 2024-08-26 13:35:49 +02:00
Jehan 77712347d1 app: fix a random segmentation fault.
I had this one case at GIMP exit where destroying editor->selection
inside gimp_colormap_editor_set_context() was segfaulting, very likely
because the widget was already destroyed so the pointer was dangling.

Therefore set a weak pointer, and clear it in dispose, so that whatever
comes first at destruction time will reset the pointer to NULL.
2024-08-26 13:35:49 +02:00
Jehan c5db158f58 Issue #11957: ignore events on all display shell when one is being created.
This fixes a never-ending flickering blocking the GUI, until a manual
focus event (such as moving a window in front) breaks the infinite loop
of handling focus events.
2024-08-25 23:56:26 +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
cheesequake aad228cfeb widgets: Set up help-ids properly
This patch adds gimp_help_connect () calls before
gImp_set_help_data () to set up F1 keybind to work
properly. It also adds lock_visibility_help_id to channel
view.

Resolves #11718
2024-08-24 23:20:23 +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
Jehan 408c22dd70 app: copying a layer group implies copying all its children.
Similar to how cut already works, when we shift-click both a layer group
and its descendants, just drop the descendants. They are already
implied.
2024-08-24 12:36:26 +02:00
Alx Sa 5a03dff9d2 app, plug-ins: Fix warnings and typo
app/text/gimptextlayout.c gives warnings
on MSYS2 about xres and yres not being
initialized.
plug-ins/file-tiff/file-tiff-load.c gives
warnings about read_unit not being
initialized.
plug-ins/file-bmp/bmp.c has a typo on
the label of the rgbx-8888 option for
rgb-format.
2024-08-20 12:50:49 +00:00
Jehan 6ca0a78452 Issue #7497: Unable to drag layers in the layer list of another open project. 2024-08-20 12:38:09 +02:00
Jehan 8844e57a0c meson, app: depend on GEGL 0.4.49.
Main dev branch of GIMP always depends on the HEAD of babl and GEGL
anyway, but that's just so that we maybe have less people reporting GIMP
not building because they use a stable release version of GEGL (though
it won't take care of the case of people using an older 0.4.49 build
which also won't have the newer API).
2024-08-20 00:22:01 +02:00
Alx Sa 3beb2e88ec widgets: Restore GTK2 tab scrolling behavior
In GTK2 and GIMP 2.10, you can use the mouse scroller to
switch between dockable tabs if you hover over the bar.
This behavior was removed from GtkNotebook in GTK3.
This patch follows other GTK3 applications in re-implementing
the behavior with a scroll-event callback.
2024-08-19 15:59:34 +00:00
Jehan cc02b5adad app: s/GIMP_MESSAGE_ERROR/GIMP_MESSAGE_WARNING/ as reported by schumaml. 2024-08-19 17:44:09 +02:00
Jehan b5a0da63bc app: store versions of GEGL operations in XCF files.
I broke MR !1660 commits into 2 commits so that the strings are added
now (freeing this up for the upcoming string freeze), with this commit.

A next commit will be needed when we'll have the proper version update
infrastructure on GEGL side, because right now, all we can do when
filter versions don't match is ignoring the filter.
2024-08-19 17:23:26 +02:00