Commit Graph

2196 Commits

Author SHA1 Message Date
Alx Sa 201ab6ff7a actions: Add new Navigation dockable icons
This patch connects the new icons made by Denis Rangelov
for the Shrink Wrap and Fill Window zoom actions in the
Navigation Dockable.
2024-12-26 17:00:17 +00:00
Alx Sa e409a74ec2 libgimpwidgets: Ellipsize GimpColorSelect color profile labels
Similar to 42300d9d, we want to prevent overly long color profile
labels from stretching out dialogues with GimpColorSelect too far.
This patch adds gtk_label_set_ellipsize () to both the color profile
and simulation profile labels, and adds them to a grid instead of
letting them free-flow.
2024-11-26 21:56:11 +00:00
Alx Sa 9b23c35c30 libgimpwidgets: Replaced deprecated gtk_icon_theme_add_builtin_icon ()...
...with gtk_icon_theme_add_resource_path (). Per Wormnest in !1027, this function
might not even be necessary at all. But until removing it can be completely tested,
this patch at least removes the deprecation warning for GIMP 3.0 RC1.
2024-11-02 23:26:18 +00:00
Jehan 5f4464445f libgimp*: keep 10 reserved spots for future virtual functions in every derivable class.
Hopefully this should be enough to add new features in the future
without breaking ABI, at least until GIMP 4!
2024-11-01 17:22:07 +01:00
Jehan 724e317272 libgimpwidgets: GimpFileEntry is not public anymore.
The whole widget was made deprecated in 2006 (commit 99f979e118) but it
is still being used by another widget. Since we can break API, I at
least hide the functions and type by making these private.

This will give us time to think if we really need this widget (or a
nicer implementation for this widget) or if we just want to get rid of
it.
2024-10-31 19:54:43 +01:00
Jehan a42142d5a0 libgimpwidgets: delete unused variable.
Checking the log, it looks like this code has not been touched since
2007, so whatever this various was used for, it's clearly not been used
for a long time.

Fixes warning:

> libgimpwidgets/gimpcairo-utils.c:80:16: warning: variable 'total_length' set but not used [-Wunused-but-set-variable]
2024-10-28 22:08:45 +01:00
Alx Sa bced3c5e04 libgimpwidgets: GimpUnitComboBox and GimpZoomModel...
...are now FINAL TYPEs.
2024-10-22 04:23:46 +00:00
Alx Sa 1a70e911b1 libgimpwidgets: Add parent instance to GimpPathEditor
The GtkBox parent_instance was left off when the widget
was converted to FINAL TYPE in bd23d5a9.
2024-10-21 13:40:59 +00:00
Alx Sa bd23d5a926 libgimpwidgets: More widgets are now FINAL types 2024-10-19 02:27:07 +00:00
Alx Sa d2d4d65acb libgimpwidgets: GimpIntRadioFrame is now a FINAL type 2024-10-18 04:17:23 +00:00
Jehan cd71f9ff00 libgimpwidgets: GimpFileEntry now final. 2024-10-16 22:30:49 +02:00
Jehan 4a02c08bfa libgimpwidgets: GimpEnumStore made final. 2024-10-16 22:30:49 +02:00
Jehan 9ff663ccb2 libgimpwidgets: GimpColorSelector and GimpController are abstract. 2024-10-16 22:30:49 +02:00
Jehan 8822ca71a2 libgimpwidgets: GimpColorSelection made final. 2024-10-16 22:30:49 +02:00
Jehan 95b1963723 libgimpwidgets: GimpColorNotebook made final. 2024-10-16 22:30:49 +02:00
Jehan 426caf7132 libgimpwidgets: GimpColorHexEntry made final. 2024-10-16 22:30:49 +02:00
Jehan 555ce20248 libgimpwidgets: GimpColorDisplayStack made final. 2024-10-16 22:30:49 +02:00
Jehan 85c989da1e libgimpwidgets: GimpColorDisplay is an abstract class.
It is a shared API for subclasses and is not meant to be instanciated
directly.
2024-10-16 22:30:49 +02:00
Jehan ba3f0c73a4 libgimpwidgets: GimpColorArea made final. 2024-10-16 22:30:49 +02:00
Jehan 925faf83ac libgimpwidgets: GimpChainButton now a final type too. 2024-10-16 22:30:49 +02:00
Jehan 03b88d8ac0 libgimpwidgets: GimpCellRendererToggle now final. 2024-10-16 22:30:49 +02:00
Jehan 3728e37553 libgimpwidgets: make GimpBrowser final. 2024-10-16 22:30:49 +02:00
Jehan 3ee7a922af Issue #10998: more cases where fg/bg color was not properly updated.
Always update stored colors. When colors are perceptually identical, we
only bypass color rendering code, but not the color value update (even
small value updates need to be echoed across the code, so that what is
shown is always what is set).
2024-10-15 15:23:11 +02:00
Jehan d28525e141 Issue #12146: default to HSV Hue for GimpColorSelect.
Commit abf0c1c272 fixed the inconsistency of showing "R" for RGB's Red
channel selected whereas the actually displayed selection UI was "H" for
HSV's Hue channel.
As a consequence of this fix, now we were indeed displayed "R". Yet
people got used to working with the Hue channel (and LC plane) for
at least a dozen years. Let's make "H" the officially displayed channel.
2024-10-13 15:38:36 +02:00
Alx Sa 4698c67290 libgimpwidgets: Convert more widgets to FINAL/DERIVABLE TYPE
These were missed earlier as they did not
have private structs in the .h file
2024-10-12 20:17:29 +00:00
Jehan 5fc2d58ad4 libgimpwidget: clean out a forgotten signal method. 2024-10-10 11:50:56 +02:00
Jehan a040dfd6e4 Issue #11339: color selection sliders don't always update for slow increments.
Rather than the previously reverted commit, the proper solution is:

* gimp_color_selector_set_color() must not test for perceptual identity
  because GimpColorSelector is too much of a generic class. In some
  case, such a test may be worth it to limit costly updates (in
  particular when it implies some rendering of color surfaces), but this
  would happen in specific subclasses.
* In GimpColorSelection, the GimpColorScales show numbers, so any change
  in them will likely trigger other scales to change as a side effect.
  Therefore when handling the "color-changed" signal on these scales,
  however small the change may be, we want to run the update.

Now removing this test in gimp_color_selector_set_color() also revealed
a serious bug which I fix in this commit, which is that the binding
between the "value" of a GimpLabelSpin with the "value" of its
adjustment was still triggering repeated property-setting, which was
enough to freeze the GUI for a while. The logic of using only the
GtkAdjustment's value as a source while also binding both properties was
not robust enough. Instead the GimpLabelSpin will now store its own
value and the binding will simply keep it in sync with the one in the
adjustment.

Note that this is also part of the solution for #10998, because it means
there were cases where the color displayed in scales of the color
selection dialog was not actually the color set as foreground or
background.
2024-10-10 11:50:56 +02:00
Jehan 079a68a920 Revert "libgimpwidgets: fix #11339 chroma slider fail on small increments"
This reverts commit bdddc94151.

This commit was not fixing the issue the proper way and was creating new
issues.

The real problem was that for very small increments at a time, a color
change could be perceptually identical to the previous color and
therefore not trigger color updates down to subclasses.
The reverted commit was trying to work around this by not updating the
GimpColorSelector color when it was perceptually identical (therefore
next check may be a bigger color distance), but this was definitely not
right. It was creating inconsistency in the stored color with the
actually selected one and that was the root for more issues.

See the next commit for a proper fix.

Oh and by the way, there was no leak, unlike what the reverted commit
message was saying. The old color was freed. ;-)
2024-10-10 11:50:56 +02:00
Jehan abf0c1c272 libgimpwidgets: make sure that the selected channel is in sync with reality.
By default, the GimpColorSelect widget is set to show HSV with Hue
selected but we weren't selecting the channel which was defaulting to
"Red" of RGB. Therefore there was some inconsistency when first opening
the color selection dialog which was showing HSV colors on the left, yet
with "Red" selected on the right.

This fixes the inconsistency, which also allows parent or container code
to set the default they want (which is indeed RGB).
2024-10-10 11:50:56 +02:00
Jehan b1616cfaaf libgimpwidgets: argh, silly bug. 2024-10-10 11:50:56 +02:00
Jehan e8958e417c libgimpwidgets: show the model in the GimpColorSelect label.
Do not only show the space, but also the model. For instance both RGB
and HSV can have the same profiles.
As for LCH, we must not show any space (it is based on CIELAB).

Note that I use the string "Model: %s" which is already used in
libgimpcolor, so I am not breaking string freeze. The "%s - %s" string
though is not localized, even though ideally it should be (and possibly
even be a better joining string in English), but I don't want to break
string freeze for this.

This issue is part of the fix for #10998, more as a UX issue than a bug
per-se. Depending on how you were selecting a color, now you might
select it as HSV, LCh or some other model (this was **not** the case
before, even though the GUI was similar. Yet the stored color was always
RGB. Now it's actually "whatever you choose"). As a consequence, it is
possible that choosing a color in another model may convert to slightly
different numbers, especially within decimal places. I don't think it
was the main issue, but it certainly doesn't help. Now we may be making
clearer what color model is being used in the GimpColorSelect color
areas.
2024-10-10 11:50:56 +02:00
Jehan d66df2aefe libgimpwidgets: do not set toggles visible when explicitly set not to…
… when changing the model.

Because of this, we had redundant toggles appearing in the Color
Selection dialog, in the GimpColorSelect tab.
2024-10-10 11:50:56 +02:00
Alx Sa ff1a92b81e libgimpwidgets: Fix infinite loop on appending invalid input
gimp_size_entry_eevl_unit_resolver () loops through all valid units
to find a match for user's inputted value in GimpSizeEntry.
It runs until gimp_unit_get_by_id () returns NULL, where it does a
final check on GIMP_UNIT_PERCENT.
Due to a small logic error, we kept setting the GimpUnit to
gimp_unit_percent () each time it was NULL, so the loop ran forever.
Per Jehan, this patch breaks the logic up so that we terminate the
loop once the percent check fails.
2024-10-02 23:21:05 +00: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
Alx Sa 816fb1c676 tools, libgimpwidgets: Connect SelectionOptions to icon size
This patch resizes the selection mode
icons based on the user's icon size
settings. It creates a new function in
gimpenumwidgets.c to update sizes,
then connects to GimpGuiConfig's icon
size update notifications in GimpSelectionOptions.
2024-08-15 19:07:14 +00:00
Joachim Priesner b3daeb12b5 libgimpwidgets: Fix stack buffer overrun
3833ab2b1d changed the type of "rgb" from
gdouble[3] to gfloat[3], but it should instead have changed the type of
"lch".

Resolves #11898.
2024-08-13 17:58:18 +00:00
Alx Sa 2286a447c1 libgimpwidgets, app/core: Fix babl formats to float
This patch converts the last instances of
non-RGBA color models from double to
float for babl formats.
2024-08-08 21:44:53 +00:00
Alx Sa 3833ab2b1d libgimpwidgets: Convert CIE LCH(ab) babl format to float
This patch converts the
few instances of CIE LCH(ab) double
to float to match babl's precision.
2024-08-08 19:25:07 +00:00
Jehan cde861a0e6 app, libgimpwidgets: fixing some obsolete unit format strings I missed. 2024-08-06 13:13:24 +02:00
Jehan 2a00a9e60a Issue #434: remove broken plural support for GimpUnit.
Rather than trying to implement full i18n plural support, we just remove
this failed attempt from the past. The fact is that to get proper
support, we'd basically need to reimplement a Gettext-like plural
definition syntax within our API, then ask people to write down this
plural definition for their language, then to write every plural form…
all this for custom units which only them will ever see!

Moreover code investigation shows that the singular form was simply
never used, and the plural form was always used (whatever the actual
unit value displayed).

As for the "identifier", this was a text which was never shown anywhere
(except in the unit editor) and for all built-in units, as well as
default unitrc units, it was equivalent to the English plural value.

So we now just have a unique name which is the "long label" to be used
everywhere in the GUI, and abbreviation will be basically the "short
label". That's it. No useless (or worse, not actually usable because it
was not generic internationalization) values anymore!
2024-08-06 11:39:57 +02:00
Alx Sa 5161c53f3c libgimpwidgets: Make GimpPickButton a derivable type
Per Jehan, we should remove gimppickbutton-default.[ch] and
move the functions into gimppickbutton.c. Then we can
make the GimpPickButtonPrivate API actually private without
any additional public functions.
2024-08-03 18:24:46 +00:00
Alx Sa f759b17e45 libgimpwidgets: Reverting GimpPickButton for 80f09fac
Temporarily reverting as the private struct
is shared between various OS versions of
the object and needs to be accessible.
A different approach will be needed to resolve,
and until then, I'd like the Debian pipeline to
work properly.
2024-08-03 08:08:31 +00:00
Alx Sa 80f09fac59 libgimpwidgets: Finish converting classes to derivable type 2024-08-03 06:39:55 +00:00
Alx Sa 438bc4f229 libgimp, libgimpmodule, libgimpwidgets: Port more widgets to derivable type 2024-08-03 02:48:07 +00:00
Jehan bc73232cd9 app, libgimpwidgets: fix CRITICAL on NULL GimpUnit.
I missed this one because it was using 0 instead of the GIMP_UNIT_PIXEL
macro. This was triggering CRITICALs when using the text tool.
2024-08-03 01:50:27 +02:00
Alx Sa 048b2c437d libgimp, libgimpcolor, libgimpconfig: Convert to derivable types
Also converted GimpPreview and
GimpScrolledPreview as they are the
parents of several of these widgets.
2024-08-02 14:02:30 +00: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
Alx Sa afce1c1f02 libgimpwidgets: Convert more gimpwidgets to derivable type
Continuation of work from 74e7e16e
2024-08-01 03:55:31 +00:00
Alx Sa 9b6e6effeb libgimpwidgets: Make GimpButton a derivable type 2024-07-30 19:04:53 +00:00
Alx Sa 74e7e16ec3 libgimpwidgets: Convert widgets to final/derived type
This patch converts libgimpwidgets with
no signals to be final or derived types.
The remaining widgets will be converted
in a subsequent patch.
2024-07-29 01:51:38 +00:00