Commit Graph

2144 Commits

Author SHA1 Message Date
Alx Sa f036812a94 libgimpwidgets, widgets: Fix icons on Path locks
The visibility lock icon and help ID was accidentally
left off the PathsTreeView set-up.
The Path Attributes also used the wrong icon to indicate
the paths were locked (compared to the one shown in the
Path Attributes dialogue).
2024-07-16 17:50:41 +00:00
Jehan d08f751626 libgimp, libgimpwidgets: use G_DECLARE_(DERIVABLE|FINAL)_TYPE macros for GimpProcedureDialog…
… and its subclasses, as well as for GimpDialog.
2024-07-13 12:24:49 +02:00
bootchk 0dae61772a Fix #11613 crash Wayland flatpak unreffing GBytes window handle
Refactor: extract method gimp_widget_free_native_handle.
This reduces duplication of code and encapsulates Wayland specific code.

Call the new function in more places.
This is expected to fix #11613 but it is hard to be sure
since the exact sequence of events in 11613 was never determined
and only reproduceable in some flatpak builds.

Calling the new function in more places also should eliminate leaks.
But I did not test there was a leak prior to this fix.
2024-07-09 17:48:53 +00:00
bootchk bdddc94151 libgimpwidgets: fix #11339 chroma slider fail on small increments
In GimpColorSelector setter, don't change the model if perceptually same.
More than just don't emit changed, don't change the model value.

Also, fix leak by freeing old color.
2024-07-09 15:56:07 +00:00
Alx Sa d00aacfea2 libgimpwidgets: Fix Procedure Browser description size
Currently when you open the Procedure Browser, part of the
description text is off-screen.
This patch changes the values for the GtkPaned panels so that
the description is completely visible horizontally. It also makes
the vertical scrollbar conditional on the widget height rather
than always showing.
2024-06-11 15:00:00 +00:00
Alx Sa ceb9747e23 libgimpwidgets: New API to check system animation status
Ports the animation code started in e13cc635
to an independent gimp_widget_animation_enabled()
function. This allows plug-in authors to
also conditionally turn off animations if
the user's system settings say to do so.

The function is applied to the About
Dialogue animation as well as two Easter
Egg animations:
* Wilber's eyes blinking after 23 minutes
on an empty canvas
* Wilber's eyes following the mouse after
a certain sequence of tools is clicked
2024-06-10 13:47:25 +00:00
Jehan a73881478c libgimpwidgets: new gimp_int_radio_frame_set_title().
This new function allows to set a title with mnemonic.

But also it properly sets the frame label as the mnemonic widget for the
radio buttons, otherwise the mnemonic is mostly bogus and doesn't
actually give focus to the editable widgets (i.e. the radio group).
2024-06-06 21:08:08 +02:00
Jehan 0b2d8fedc3 libgimp, libgimpwidgets: ability to generate a GimpIntRadioFrame for GimpChoice arguments.
This includes a new function gimp_prop_choice_radio_frame_new() which
creates GimpIntRadioFrame from GimpChoice properties.

GimpChoice GimpProcedure arguments are still creating a combo box by
default, but it is now possible to override this default behavior to get
a radio frame by calling first:

```C
gimp_procedure_dialog_get_widget (dialog, "arg-name", GIMP_TYPE_INT_RADIO_FRAME);
```
2024-06-06 20:20:30 +02:00
Niels De Graef 36c201e426 libgimpwidget: Mark gimpcolorscale as introspectable
There's no seemingly good reason for it not to be introspected, so let's
add it to the files. This also fixes an issue where the documentation
for it is not properly generated.
2024-05-21 10:08:07 +02:00
Alx Sa 47dde0580a libgimpwidgets: Fix formatting from 8adcc0cd
Some minor code style issues remained 
that I missed in 8adcc0cd.
After further reflection, I also converted
the code to be a private/internal function.
gimp_prop_check_button_new () should
cover the majority of GtkCheckButtons,
and the function is currently only used
to fix the size of those widgets. We could
revisit it as a public function in the
future if more use cases are found.
2024-05-19 02:10:23 +00:00
Mark Sweeney 8adcc0cdcb libgimpwidgets: Fix GUI twitching due to bold label sizing
Resolves #10026

Selecting a checkbutton makes the label bold. This increases the
width of its label, and if it's the longest item in a box, this
causes minor "twitching" and resizing of the dialogue.
This patch calculates the size of the label when bold and then
requests the label width be set accordingly to resolve the issue.
2024-05-18 21:33:51 +00:00
Niels De Graef c2971f000a libgimpwidgets: Add missing GIR annotations 2024-05-11 15:30:45 +02:00
Simon Budig e0564ae69d libgimpwidgets: don't leak dest_profile 2024-05-06 00:35:51 +02: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 d661e8efb1 libgimpcolor: gimprgb-parse finally deleted.
- gimp_rgb_list_names() ported as gimp_color_list_names() using NUL-terminated
  GimpColorArray.
- GimpColorHexEntry uses the new function (and is therefore now GimpRGB free!).
- gimp_rgb_parse_name() deleted as it's unused since my previous commit.

With all this, gimprgb-parse.c is now deleted from the repository! \o/
2024-04-20 20:04:32 +02: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
Jacob Boerema ae2cf562e8 libgimpwidgets: fix #10821 Problem with LabelSpin widget
For certain min/max values of the LabelSpin widget, in combination with
zero digits, it proves impossible to change the initial value.
The reason for this is that the step size may become less than 1.0.
In which case, stepping doesn't work because the number of digits is
set to zero.

Let's check for this situation and when digits is zero set the step
to 1.0 and make sure that page is at least the same value.

While testing this I also noticed another issue: when initializing
the upper value was set to 0.0 and the lower to 1.0 which leads to
a critical because lower > upper.
We fix this by switching the initial upper and lower values.
2024-04-16 21:44:22 -04:00
Jehan 956a9fac6c Issue #10715: icon for effects.
We now have a proper icon thanks to Denis Rangelov!
2024-04-16 19:54:06 +02:00
bootchk 4048556171 libgimpwidgets: fix #11255 unterminated Wayland window ID string
Copy the NULL when creating GBytes from a string.
2024-04-16 09:26:00 +00:00
cheesequake 8153dffb92 Issue #9727: Reduced text area to improve Slider UX 2024-04-15 22:31:35 +00:00
Jehan 9a353b9db9 libgimpwidgets: fix undeclared identifier.
Build for macOS on CI breaks with:

> ../gimp3-2.99.19/libgimpwidgets/gimppickbutton-quartz.c:210:45: error: use of undeclared identifier 'monitor_profile'
>       space = gimp_color_profile_get_space (monitor_profile,
2024-04-12 12:24:53 +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
lillolollo 9f86d6b8d0 libgimpwidgets: Replace deprecated CGColorSpaceCopyICCProfile with CGColorSpaceCopyICCData 2024-04-11 01:28:16 +00:00
Alx Sa f726efba76 Don't convert to float before storing...
...in GeglColor. Just use the "u8" format.
2024-04-09 00:48:35 +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
Alx Sa 0ec02a4fa9 libgimpwidgets: Fix CRITICAL when no monitor profile is set
Resolves #11246

On Windows, a CRITICAL was being repeatedly thrown if you
didn't have a monitor profile set. This is because we were trying to
pass a NULL value to g_utf16_to_utf8 () whenever we needed to
convert a GeglColor.
This patch fixes it by checking if the monitor profile filename is NULL
before trying to convert it.
2024-04-07 12:52:24 +00:00
Alx Sa 0e3f34206a libgimpwidgets: Prevent FileChooser widget from crashing
We dereference "file" twice in gimp_prop_file_chooser_button_callback(),
once in the GIMP_IS_PARAM_SPEC_CONFIG_PATH () condition and then
at the end of the function. This is likely due to a similar structure in 2.10,
which did not have a second condition.
As a result, any Gegl filter which had a file property would crash if set from
a GUI. The first g_object_unref() is removed so we only dereference "file"
once.
2024-04-04 15:23:27 +00:00
Alx Sa 3cccc0d319 libgimpwidgets: Get full color data from ColorArea
Resolves #11146

As Idriss Fekir and I noted,  5ce128a9 added support for
receiving GeglColor data to GimpColorAreas, but
retrieving it still resulted in RGBA application/x-color
values being stored when dragged.
This patch updates gimp_color_area_drag_data_get () to
give the format and profile information along with the
pixel values.
2024-03-29 04:01:12 +00:00
Alx Sa 5ce128a9fa libgimpwidgets: Allow colors to be dropped on ColorAreas
Post color space invasion, this function needed to read in
GeglColors directly rather than converting from GimpRGB.
2024-03-26 13:57:52 +00:00
Alx Sa 05af8c91c1 widgets: Minor GimpRGB to GeglColor ports
Mainly fixing GimpRGB comments and
parameters that are unused (or in unused
functions).
GimpCircle and GimpGradientChooser
have color conversions ported to use
GeglColor exclusively.
2024-03-19 04:40:14 +00:00
Alx Sa 28b236b578 libgimpbase: Replace GimpRGB in gimpchecks
Converted to gdouble[] and updated in all 
calls to the enums in gegl_color_set_pixel()
2024-03-17 16:19:25 +00:00
Alx Sa 3767e1032d libgimpwidgets: Port GimpCellRendererColor...
...to use GeglColor rather than GimpRGB.
Also update the ColorHexEntry,
DynamicsOutputEditor, and the
colormap-remap plug-in which uses this
widget.
2024-03-14 00:40:02 -04:00
Alfred Wingate 46a1580018 libgimpbase libgimpwidgets: install needed headers
* These headers weren't installed despite being included by other
  installed headers.

Bug: https://gitlab.gnome.org/GNOME/gimp/-/issues/10132
Bug: https://bugs.gentoo.org/920535
Signed-off-by: Alfred Wingate <parona@protonmail.com>
2024-02-28 05:53:54 +00:00
Jehan 7f6e666afc libgimpwidgets: make sure we update everything when changing the format. 2024-02-17 11:27:29 +01:00
Jehan 18d68d9e7c Issue #10850: [Color Space Invasion] Possible profile mis-match between color selectors.
It was simply not implemented yet, but it's true that it's such a visible and
used feature that it's worth adding it in time for GIMP 2.99.18!
2024-02-17 11:24:00 +01:00
Jehan 8e63ef91f5 Issue #10858: [Color Space Invasion] Alpha ColorScale has corrupted values.
While the buffer used by Cairo may have a rowstride bigger than 3 * width, our
internally stored buffer has the exact size required for drawing the scale.
2024-02-16 22:05:23 +01:00
Jehan 7db648195c libgimpwidgets: fix initializing a GimpLabelColor. 2024-02-14 23:36:39 +01:00
Jehan dc66e99949 libgimpwidgets: fix XY rendering in GimpColorSelect for RGB color model. 2024-02-11 23:28:04 +01:00
Jehan 89b80b5b63 libgimpwidgets: don't unnecessarily redraw color previews.
When changing the selected color, we have no reason to redraw the Z preview.
This preview should only be redrawn if the allocation size changed, or if we
change the previewed model or the Z component.

As for the XY preview, it should only be redrawn if the Z value is changed (and
of course, similarly, if the allocation changed or if model or Z component
changed).
2024-02-11 23:28:04 +01:00
Jehan 6a2aee1fce libgimpwidgets: render GimpColorSelect with babl conversion.
No custom conversion code anymore. This also fixes some bugs in HSV when
I was wrongfully multiplying the hue by 360 when mixing babl and custom
code paths.
2024-02-11 23:28:04 +01:00
Jehan ba26fc26e7 libgimpwidgets: direct binding between a GimpLabelColor and its color area. 2024-02-11 23:28:04 +01:00
Jehan 4b3702bfc1 libgimpwidgets, libgimpcolor: RGB and HSV should also show out-of-gamut…
… in soft-proof space when soft-proofing is enabled.
2024-02-11 23:28:03 +01:00
Jehan de83bca814 app, libgimpwidgets: make GimpColorSelector sync with soft-proofing.
Until now we only had the case of the CMYK color selector using the
soft-proofing profile. Yet this is also interesting for other color
selectors, in particular to show out-of-gamut colors. Indeed if we
enable soft-proofing on the active image, it is interesting to show the
intersection of the current RGB/Grayscale space gamut with the
soft-proofing gamut.

Right now, this is only used in GimpColorSelect when showing colors in
LCh color space.
2024-02-11 23:28:03 +01:00
Jehan 4d2acac506 libgimpwidgets, modules: display the exact space/profile name for…
… relevant color selectors.
2024-02-11 23:28:03 +01:00
Jehan 3c3f3030f1 libgimpwidgets: GimpColorSelect is now also aware of active image space. 2024-02-11 23:28:03 +01:00
Jehan e104196cb7 app, libgimpwidgets: "Scales" color selection now space-aware.
This commit adds gimp_color_selector_set_format() which is meant to give
awareness of the target color format for which we are selecting colors.
Right now, I am only using this information on the Scales selection
method, which means that now colors you read and select are in the
target space. Even better, the out-of-gamut shown happens in the with
LCH scales is for the target space too. As tested, it already makes
quite a difference for an image in sRGB vs. say adobeRGB.

Note that right now, I only use the format information as a space, but
in fact, I made the API to be about a format because the actual format
can be used wisely too. First we may want to do different thing
depending on the color model itself (which the space may give away or
not, especially when using default spaces or when we'll have images
using models with no space in the future, such as CIE Lab). But also
whether the image is following the space TRC or is linear (or
perceptual) would change how we represent the data. If we were to show
non-linear values in the Colors dockable but when painting, the color
picker shows linear values for instance, it might be puzzling to people.
2024-02-11 23:28:03 +01:00
Jehan 9833ebd0ee app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:

1. Take into account the image space, and this is what we must navigate
   through, in particular for various representations of RGB or HSV.
   I.e. that if the active image is in anyRGB, the RGB values shown must
   be within anyRGB. Right now, everything is still shown/used as sRGB
   (even though it's properly retrieved and transformed to the target
   space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
   label somewhere.
3. Allow to switch between image and softproof spaces, regarding
   out-of-gamut display. I.e. that while RGB/HSV must be shown within
   the image space (assuming it's anyRGB), we may want to show
   out-of-gamut area (pink areas) within the softproof space. This may
   mean adding a checkbox. Or maybe simply taking into account whether
   we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
   gimp_widget_get_render_space() for display drawing. We don't need any
   soft-proofing or black point compensation for any of these widgets so
   pure babl is fine. Indeed we want to show any in-gamut color
   correctly (and not transformed according to specific intents or
   through soft-proofing). We will take care of the proofing case with
   out-of-gamut area showing only.
5. In the various drawing functions, we should move to
   CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
   that it makes sense to be more accurate, especially as we are
   essentially showing color gradients in 1 or 2 directions in these
   various widgets.
2024-02-11 23:28:03 +01:00
Jehan 093d00572a app, libgimpcolor: more move to GeglColor.
- New libgimpcolor functions: gimp_color_parse_hex() and gimp_color_parse_name().
- GimpColorHexEntry is now space-invaded. Though recognized color names
  and hexadecimal syntax are sRGB only (because CSS and SVG
  specifications explicitly say that this syntax is for sRGB values), it
  is possible to enter non-sRGB values with
  gimp_color_hex_entry_set_color().
- GimpColorSelection is now space-invaded.
2024-02-11 23:28:03 +01:00
Jehan ee19ad54d6 app, libgimpcolor: 2 new libgimpcolor functions.
Adding gimp_color_is_out_of_gamut() and gimp_color_is_out_of_self_gamut() and
using them where relevant.
2024-02-11 23:28:03 +01:00