Commit Graph

2054 Commits

Author SHA1 Message Date
Michael Natterer 8d9eef875c libgimpwidgets: use gdk_seat_grab,ungrab() in gimphelpui.c,
getting rid of using the the deprecated pointer grab API.

Since there is something fishy and gtk_get_event_widget(event) always
returns the GtkInvisible we grab on (not the actual event widget), we
just steal the "find widget at pointer" code from gtkinspector and
find the help widget that way.
2023-05-24 17:18:38 +02:00
Michael Natterer 7e7a20530d libgimpwidgets: improve parameter names of gimp_grid_attach_aligned() 2023-05-24 15:59:34 +02:00
Niels De Graef 41e3d10a18 libgimpwidgets: Fix some gir annotations
Add a missing nullable, remove some references to `GtkHScale` as that no
longer exists.
2023-05-21 01:37:18 +02:00
Niels De Graef 0f05de3dc0 libgimpwidgets: Try harder to set parent window
In case someone passes a `GtkWidget` rather than a `GtkWindow` as a
parent to a `GimpDialog`, we still have another way of trying to get its
parent window, using `gtk_window_get_toplevel()`. If we still get a
window from that, it allows us to still specify a reasonable
"transient-for" value for our newly-made `GimpDialog`.
2023-05-20 20:24:28 +00:00
Alx Sa b2874464f5 icons: Revert most of !909
Per @Jehan, this solution would prevent default icons from being loaded
in custom themes if they did not include their own version.
The only thing kept from !909 is the replacement of hardcoded strings
in a few files with constants defined in gimpicons.h.
2023-05-14 21:54:41 -04:00
Alx Sa bca4535c40 icons: Restore GIMP icons replaced by GTK defaults
Five icons in the Layer dockable were being replaced by GTK defaults at
runtime. A "gimp-" prefix was added so that GIMP's version would always
be used. A few dialogues were fixed to use constants rather than
hardcoding the filename, to make it easier to update the icon in the
future.
2023-04-30 13:58:39 +00:00
Alx Sa a05213f82a libgimpwidget: Fix GimpFrame line-spacing property
GimpFrame has a property 'line-spacing'. gimp_frame_get_label_spacing ()
tried to access it as 'line_spacing', so it always returned 0.
Fixing the typo should now return the true spacing value.
2023-04-22 03:01:16 +00:00
Jehan 16656e7076 app, libgimpwidgets: last GtkUIManager and GtkAction usage in libgimpwidgets.
These were the last use of the old GtkAction API and it was particularly
annoying here as this widget is used both in core GIMP and in plug-ins, yet core
GIMP actions were not GtkAction anymore (so the "activate" signal handler's
signature was different, which would crash the core code).

Now the clash is resolved as this widget just uses GAction (which both
GimpAction, for core code, or GSimpleAction, for plug-ins, are).

This is also the absolute last use of GtkAction (and other related API) in all
our code (core, libgimp* and plug-ins). \o/
2023-04-12 22:07:09 +02:00
Jehan aff946b051 libgimpwidgets: fix menu item with tooltip without help ID.
In such a case, we may not want to connect to "query-tooltip", yet we still want
the normal tooltip to show up. This was a case for instance for the recently
opened file actions ("file-open-recent-*") or opened image actions which were
not showing their tooltips.
2023-04-12 22:07:09 +02:00
Jehan 01a4feb784 app, libgimpwidgets: GimpAction proxy widgets will display the proper tooltip.
The tooltip contains the reason for action inactivity, if relevant. And in case
of a GtkMenuItem in particular, it will also contain the "Press F1 for more
help" text at the bottom.
2023-04-12 22:07:08 +02:00
Jehan d5f845e35a Issue #9147: freeze when switching from multi-window to single window mode.
Don't keep bindings to still existing objects. We were ending up in some ugly
infinite looping.

(cherry picked from commit bddcd5c268)
2023-02-16 22:26:17 +01:00
Luca Bacci 48c27770b6 Use unicode-aware color management API
* GetMonitorInfoW
* EnumDisplayDevicesW
* GetStandardColorSpaceProfileW
* GetColorDirectoryW
2023-01-24 14:48:44 +00:00
Luca Bacci 11801cf402 Use SetWindowsHookExW () 2023-01-24 14:48:44 +00:00
Jehan 2aa325a55e libgimpwidgets: new gimp_spin_scale_get_mnemonic_keyval() function.
This solves part of #8524, for properties displaying as spin scale, which have a
mnemonic, yet our code was not able to tell so.
2023-01-23 23:28:15 +01:00
Jehan 955dd922a7 libgimpwidgets: new gimp_int_store_new_array().
Because the variable argument list variants of the function won't work in
binding. This makes creating GimpIntStore easy.
2023-01-10 17:48:05 +01:00
Alx Sa 3d54665a94 libgimpconfig: Retain color scale preferences
RGB 0..255/0..100 and LCh/HSV settings are now remembered when closing
and reopening GIMP.
A few enums were explicitly cast to GimpColorSelectorChannel to clear
some compiler warnings.
2023-01-10 00:20:22 +00:00
Jehan e48b002c84 app, icons, libgimpwidgets: add "distribute with evenly gaps" options.
There was one case in Inkscape which we could not do: distributing objects
keeping even gaps between them. Until now, we could only distribute keeping even
distance between anchor points (top, left, bottom, right or center).

With these 2 additional distribute options, I believe that GIMP is able to do
all the Alignment and Distribution options available in Inkscape (not the
"Rearrange" or node features, neither the text align/distrib; I just mean the
common align/distribute on objects), and even a bit more thanks to the anchor
point system (e.g. in Inkscape, we can't left or right-align to a reference
object/image center, or we can't center to a reference left/right/bottom/top
border; but we can do it in GIMP).

The icons are hopefully temporary, until we can make better ones.
2022-11-08 23:48:32 +01:00
Jehan dc8298ce76 libgimpwidgets: use "system-help" for GIMP_ICON_HELP.
Just "help" is not one of the standard icon names as per the Freedesktop Icon
Naming specification.
See: https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html

Therefore when using this name, we usually don't have any icon (especially as we
don't provide any in our own icon themes).
Use "system-help" instead which is a standard name 'for the “Help” system
category'.
2022-10-11 22:11:16 +00:00
Jehan 8ac5178214 libgimpwidgets: fix automake syntaxe.
Automake doesn't accept the "if else" syntax. Instead, we must add a new if/else
inside the first else block.

While I'm at it, I also add a G_GNUC_INTERNAL to the internal function
_gimp_pick_button_win32_pick(), though I don't think it's absolutely necessary
(yet explicit is better).
2022-10-11 00:29:57 +02:00
Luca Bacci d2dc2cb983 Add GimpPickButton implementation for Windows
Fixes https://gitlab.gnome.org/GNOME/gimp/-/issues/8506
2022-10-07 10:45:22 +00:00
Jehan ca230cb770 meson: fix warnings of deprecated features.
Now that we bumped our meson requirement, meson is complaining about
several features now deprecated even in the minimum required meson
version:

s/meson.source_root/meson.project_source_root/ to fix:

> WARNING: Project targets '>=0.56.0' but uses feature deprecated since '0.56.0': meson.source_root. use meson.project_source_root() or meson.global_source_root() instead.

s/meson.build_root/meson.project_build_root/ to fix:

> WARNING: Project targets '>=0.56.0' but uses feature deprecated since '0.56.0': meson.build_root. use meson.project_build_root() or meson.global_build_root() instead.

Fixing using path() on xdg_email and python ExternalProgram variables:

> WARNING: Project targets '>=0.56.0' but uses feature deprecated since '0.55.0': ExternalProgram.path. use ExternalProgram.full_path() instead

s/get_pkgconfig_variable *(\([^)]*\))/get_variable(pkgconfig: \1)/ to
fix:

> WARNING: Project targets '>=0.56.0' but uses feature deprecated since '0.56.0': dependency.get_pkgconfig_variable. use dependency.get_variable(pkgconfig : ...) instead
2022-08-31 01:29:37 +02:00
Jehan 9b21688501 Issue #6778: Colorpicker (from Colors dockable) shows wrong color.
Actually our X11 implementation is right, and the implementation from
the Freedesktop portal is "as far as it can do", i.e. that we get the
returned RGB value, which is unfortunately in display space. And it
doesn't return any space information together (we don't even know which
display the color comes from, in multi-display setups).

Therefore let's check if we are running GIMP on X11 and if so, let's
call this implementation first.

See this report on xdg-desktop-portal to get proper space info:
https://github.com/flatpak/xdg-desktop-portal/issues/862
2022-08-18 21:42:39 +02:00
Alx Sa 7b7ce8c5f0 display: Show Soft-Proofing menu in status bar
This adds a Soft-Proofing pop-over menu when right-clicking the toggle
in GimpStatusBar. It lets users toggle proofing, using BPC and showing
out-of-gamut colors. It also lets users change the profile and
rendering intent.
2022-08-17 11:37:10 -04:00
Nikc 1c81c426ae Modules: Convert CMYK color selector to babl 2022-08-15 21:14:14 +00:00
Alx Sa 0587a10543 core: Add simulation intent and BPC to GimpImage
Adds a simulation_bpc and simulation_intent to GimpImage to allow 
plug-ins to access it
for CMYK import/export.
Four pdb functions were added to enable this access:
image_get_simulation_bpc (), image_set_simulation_bpc (), 
image_get_simulation_intent (), and image_set_simulation_intent ().
Next, it updates menu options and code to support GimpImage's
internal simulation intent and bpc.
New 'simulation-intent-changed' and 'simulation-bpc-changed signal 
are emitted via
GimpColorManagedInterface so that relevant tools 
(such as the
CYMK color picker, GimpColorFrame, and future pop-overs)
 are aware of these changes.
2022-08-13 19:39:47 +00:00
lloyd konneker 0c1b00b04c Enhance GimpProcedureDialog have int combo widget for G_PARAM_SPEC_ENUM
Resolves #8488
2022-08-13 07:34:17 -04:00
Jehan ccbf3c4bb0 app, libgimp*: add various stamp files to CLEANFILES.
Fixes:

> ERROR: files left in build directory after distclean:
2022-08-01 23:34:50 +02:00
Jehan 83e465ec16 app, libgimp*: updating autotools script in sync with meson.
Generated *enums.c now have an additional stamp no-op header include
(see last 2 commits). Sync this change into the autotools generation
scripts to prevent back and forth useless generation of these files each
time we switch from one build system to another.
2022-08-01 20:00:01 +02:00
Jehan 979acaaae2 app, libgimp*: commit the newly generated *enums.c files.
They are nearly the same as initially, except that now they include an
intermediate stamp header which will be generated by the build system.

The only 2 enums which don't need these includes (and are not versioned)
are libgimp/gimpenums.c and libgimpthumb/gimpthumb-enums.c.
2022-08-01 20:00:01 +02:00
Jehan 106f2a061d Issue #8145: meson: generation of '*-enums.c' files.
Our meson build system was not properly building the enums.c file,
because they are versionned.

I did a similar trick as what I did for the pdbgen, which is that I used
a wrapper script around the existing perl script, which sets proper
options and generate a stamp file in the end (which is considered by
meson as the actual custom target, not the C file since it is generated
in the source dir).

The most important part is that the stamp file is a generated header
source (not just a random text file) which is **included** by the
generated C file. This is what will force meson to regenerate the C file
if the header is updated, **then** build using this new version, not use
an outdated versionned version (which would make for hard to diagnose
bugs), through the indirection of the intermediate stamp header.

See #4201.
See also: https://github.com/mesonbuild/meson/issues/10196#issuecomment-1080742592
2022-08-01 19:59:53 +02:00
Jehan e4cd2405a9 libgimpwidgets: do not export GResource generated functions.
This explains why the defcheck script never complained for the 2
*_get_resource() functions removed in my previous commit. These were
exported in the libgimpwidgets library on the autotools build (and not
on the meson build).

Fix the discrepancy by not exporting these symbols on autotools as well,
as I don't think this is needed on public API.

This should now fix the distcheck build for autotools.
2022-07-31 23:44:48 +02:00
Jehan 01e87819ce libgimpwidgets: fix def file.
The defcheck.py file finds these errors:

> Problem found in /home/jehan/dev/src/gimp/libgimpwidgets/gimpwidgets.def
>   the following symbols are listed in the .def-file,
>   but are not exported by the library.
>      - gimp_color_picker_cursors_get_resource
>      - gimp_icon_pixbufs_get_resource

Indeed these don't exist. Unsure why the autootols check failed to
report these until today.
2022-07-31 20:07:00 +02:00
Jehan 6a08fd6596 libgimpwidgets: fix segfaults on wrongly handled referencing.
gimp_color_config_get_simulation_color_profile() is returning a new
object, so we had 2 code paths giving either allocated data or not.

Therefore simply ref the passed softproof profile in the second code
path, and don't ref it anymore when caching it (especially as it might
also be NULL at that point).
2022-07-18 14:33:42 +02:00
Lukas Oberhuber 042eddfb0a canvas: remove limits on ruler & statusbar updates
This removes rate limiting of ruler and statusbar updates which were
required to get acceptable performance on mac for drawing on the canvas.

This requires the latest changes on in Gtk 3.24 to be incorporated.
2022-07-05 13:02:30 +00:00
Alx Sa 0d7fed93ae core: Add softproof profile to GimpImage
Adds a simulation_profile to GimpImage to allow plug-ins to access it
for CMYK import/export.
Two pdb functions were added to enable this access:
image_get_simulation_profile () and image_set_simulation_profile()
Next, it updates menu options and code to support GimpImage's
internal simulation profile. Menu items are moved from View to Image's
Color Management section.
New 'simulation-profile-changed' signal is emitted via
GimpColorManagedInterface so that relevant tools (such as the
CYMK color picker, GimpColorFrame, and future dockable
dialogue) are aware of these changes.
2022-07-02 15:26:19 +02:00
Jehan 8761d84aef libgimp, libgimpwidgets: more consistent API for widgets using a…
… GimpIntStore for value filling.

GimpIntComboBox was not taking ownership of the value store whereas the
newer GimpIntRadioFrame was taking ownership. As a more common practice,
I decided to leave ownership to the caller (which will therefore have
the responsibility to free the data) in the main class and property
widget APIs.

On the other hand, let's steal ownership of the store objects in the
gimp_procedure_dialog_get_int_*() functions as these are really used for
very quick and easy creation of dialogs by script writers. It would even
allow to create a GimpIntStore inline within the widget creation
function, if one wanted to.
2022-06-17 17:50:18 +02:00
Jehan b7d271b7d0 libgimpwidgets: small doc comment fix. 2022-06-17 17:18:12 +02:00
Jehan 42143881d8 libgimp, libgimpwidgets: supporting GFile properties in…
… GimpProcedureDialog.

- gimp_prop_file_chooser_button_new() now works also with properties
  G_PARAM_SPEC_OBJECT having a value_type == G_TYPE_FILE (additionally
  to GIMP_PARAM_SPEC_CONFIG_PATH properties).
- gimp_procedure_dialog_get_widget() will now create a
  GtkFileChooserButton in open mode for such a GFile property.
- New gimp_procedure_dialog_get_file_chooser() API to create
  GtkFileChooserButton for GFile properties in other modes.

Current limitation: GtkFileChooserButton doesn't have a label. This
should be fixed, probably by creating another custom widget with would
be a labelized file chooser button.
2022-06-17 17:18:12 +02:00
Jehan 5123dc0f83 libgimp: missing new API in def files. 2022-06-16 11:45:33 +02:00
Jehan 41201f0865 libgimpwidgets: new GimpIntRadioFrame object.
A proper class for a frame containing radio buttons. This object has a
"value" property and will therefore be very easy to use in various API
binding a config property to a widget property.

A GimpIntRadioFrame is also what gimp_prop_int_radio_frame_new() will
return now.

gimp_prop_int_radio_box_new() on the other hand is being removed. It is
used nowhere and is unneeded. If someone really needs a non-labelled
group of radio buttons, they can also create a GimpIntRadioFrame, remove
the label and hide the borders. At least they will still be able to
easily bind it to a config property.
2022-06-15 21:18:37 +02:00
Jehan 87f7a92786 app, libgimp, libgimpbase, libgimpwidgets: better checkboard colors API.
- Some coding style fixes (alignment, etc.).
- Adding missing "Since: 3.0" annotations. We are still wondering
  whether this should go in 2.10, in which case, it would become
  "Since: 2.10.32" annotations. See discussion in !274.
- Changing gimp_checks_get_colors() signature: merge the 4 color
  arguments into 2 (inout) arguments which seems a bit nicer in C,
  whereas binding handles such arguments correctly. The other
  alternative would have been to at least change the order to have out
  arguments in the end.

  I also hesitated to get another API in libgimp, which would have been
  config-aware (just returning the 2 check colors, depending on user-set
  Preferences), then having GimpPreviewArea handling 2 colors (without a
  GimpCheckType input). But actually, doing this, we'd remove the nice
  menu popup where one could choose a generic check type (not everyone
  wants to play with specific non-gray colors) in Gimp*Preview widgets.
  So in the end, I left this whole thing as-is.
  Instead I document the function with code sample to initialize
  properly the GimpPreviewArea (since libgimpwidgets/ are independent
  with no knowledge of the core config) in order to respect user
  preferences.
- Hide the color properties in gimp_preview_area_menu_new() because
  anyway gimp_preview_area_menu_new() does not support GimpRGB
  properties right now (so all we get are warnings). It's still possible
  to select custom colors on GimpPreviewArea, simply we are stuck at the
  ones set in Preferences globally for now (unless a plug-in creates
  custom GUI to set these).

Fixed Conflicts from !274:
	libgimp/gimp.h
	libgimpwidgets/gimppreviewarea.c
2022-05-14 16:31:50 +02:00
Ben Rogalski d90b84ba9d Custom transparency checkerboard colors
Reviewer (Jehan) note: cherry picked from MR !274. Still deciding
whether this will be pushed to gimp-2-10 branch too.

Fixed Conflicts from !274:
	app/dialogs/preferences-dialog.c
	app/display/gimpdisplayshell-draw.c
	app/plug-in/gimppluginmanager-call.c
	libgimp/gimp.c
	libgimp/gimp.h
	libgimpwidgets/gimppreviewarea.c
	libgimpwidgets/gimppreviewarea.h
	libgimpwidgets/gimpscrolledpreview.c
2022-05-14 16:27:15 +02:00
Niels De Graef e5caf21bcb pickbutton: Add version check for XDG portal
`PickColor()` API only got added in version 2, so check for that before
trying to use it.
2022-05-13 11:28:28 +02:00
Jehan c3cc859a88 libgimpwidgets: fix label vertical alignment of GimpSpinScale.
Let's not try to align anymore the label text with the value (numbers
inside the GtkEntry) text. Our previous offset computation was wrong
anyway, but even correctly aligning the text, there could be cases where
the label's actual font was bigger than the number's font.

I had the case with GIMP set in Korean. The number text was 11-pixel
high but the Hangul text on 16 pixels in plug-ins using a GimpSpinScale,
most likely because the font used for numbers didn't have Hangul glyphs.
So we ended up with very ugly scale title on the bottom of the widget,
even out of the progress area. Instead, we just make sure that the label
is exactly in the vertical middle of the widget, disregarding the entry
layout's offset.
2022-04-26 23:06:51 +02:00
Jehan 75f9bdccbb libgimpwidgets: add back some GEGL prop special-casing in…
… gimp_prop_spin_scale_new().

This was forgotten when moving the code to libgimpwidgets in commit
7056f1b960. Thanks to Thomas Manni for noticing.
2022-04-09 21:53:32 +02:00
Jehan 78fceca353 libgimpwidgets: GimpSpinScale header was not listed. 2022-04-09 18:35:15 +02:00
Jehan 0593980864 libgimpwidgets: missing API in the def file. 2022-03-07 18:03:56 +01:00
Jehan 622d0da43e app, libgimpwidgets: allowing changing a dockable settings value while…
… blinking it.

This will be necessary to demo new features available only in some
situations. E.g. a new option in line art detection mode of bucket fill
would require said mode to be enabled.
2022-03-06 19:30:31 +01:00
Jehan 60b67ec204 libgimpwidgets: fix the def file.
The gimp_widget_set_identifier() doesn't really need to be there since
we don't install the gimpwidgets-private.h header. But I guess it makes
sense that we still need to add it for our internal use at least.

This should fix the CI.
2022-03-06 00:37:36 +01:00
Jehan 93021b19e1 app, libgimpwidgets: create private gimp_widget_set_identifier() API.
I add it in libgimpwidgets because we need to also use it on propwidgets
created from there, but it's actually only for core GUI usage, so it's
actually in a private part of the library.

Though it's actually doing quite a basic thing, it is nicer and more
foolproof than a manual g_object_set*() everywhere. Moreover it will be
nicer to grep.
2022-03-05 22:51:35 +01:00