Commit Graph

23213 Commits

Author SHA1 Message Date
Jehan a86ed68870 app: wait for the software to be fully initialized before processing…
… DBus calls.
In particular, Aryeom would start GIMP and directly double click some
image to be loaded in GIMP in the very short while when splash is
visible. Previous code would wait for the `restored` flag to be TRUE.
This was nearly it as we can actually start loading images as soon as
the 'restore' signal has passed. Yet the flag is set in the main
handler, but we actually also need the <Image> UI manager to exist,
which is created in gui_restore_after_callback() (so also a 'restore'
handler, yet after the main signal handler, i.e. after `restored` is set
to TRUE). Without this, gui_display_create() would fail with a CRITICAL,
hence file_open_with_proc_and_display() as well.

I could have tried to set the `restored` flag later, maybe with some
clever signal handling trick (and handle both the GUI and non-GUI cases,
i.e. I cannot set the flag inside gui_restore_after_callback() as it
would break the non-GUI cases). Instead I go for a simpler logics with a
new `initialized` flag which is only meant to be set once, once
everything has been loaded, i.e. once you can consider GIMP to be fully
running hence ready to process any common runtime command.
2020-11-10 21:51:57 +01:00
Jehan 75e6f1062e app: fix "Luma Lighten/Darken only" layer modes.
This is a continuation of #5888 as I realized that most layer modes were
fixed with my commit b3fc24268a (and follow-up f40dc40cbc) but at least
2 were still crashing GIMP: "Luma Lighten/Darken only" modes.

There were 2 bugs here:

* The first bug was that when gimp_operation_layer_mode_real_process()
  ran, gimp_operation_layer_mode_prepare() had not been run yet.
  prepare() is called before the process() of GeglOperation, but it
  would seem the process() of GimpOperationLayerMode on the other end
  happens before GeglOperation's prepare() is run. I am absolutely
  unsure if this is expected or not and have a hard time figuring out
  all the details of the C/C++ cohabitation.
  As a solution, I am moving out the fish caching (the needed part
  inside gimp_operation_layer_mode_real_process()) in its own function
  so that I can easily call it separately before inspecting the fishes.

* The second issue was that some blend functions needed more than a
  GeglOperation alone. E.g. blend_function() for luma lighten
  gimp_operation_layer_mode_blend_luma_lighten_only() would call
  gegl_operation_get_source_space() which requires the node to exist.
  Similarly for the Luma darken only mode. So I keep both the node and
  operation around, and when finalizing, I free the node (which in turn
  frees the operation).

Ell > if you are reading our commits, I would really appreciate your
review (or fixes) of my code here! :)
2020-11-10 17:25:34 +01:00
Jehan f40dc40cbc app: fix autotools build.
My previous commit broke the autotools build. Apparently when using
g_object_unref(), some C++ symbol leaked into libapppaint.a archive
library, hence the main binaries (e.g. gimp-2.99) could not be linked
without adding -lstdc++ flag:

> /usr/bin/ld: paint/libapppaint.a(gimppaintcore-loops.o): undefined reference to symbol '__gxx_personality_v0@@CXXABI_1.3'
> /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: error adding symbols: DSO missing from command line

Not exactly sure why using this GLib function in particular caused this,
but let's just try another approach in order not to link the main binary
with C++ standard lib.
Instead let's manage all GeglOperation allocation in gimp-layer-modes.c
by adding a gimp_layer_modes_exit() function and some static array for
storing operation object of each layer mode.
2020-11-10 12:52:01 +01:00
Jehan b3fc24268a Issue #5888: GIMP 2.99.2 crash when using brush in multiply mode.
The GimpOperationLayerMode variable member in DoLayerBlend was not
properly constructed. C++ class constructor can be called by creating
object variables, but with GObject, we have to do it with pointers.
Otherwise here we were only allocating the memory for the struct, but
not actually calling any initialization functions.

Also it would seem that the struct was not initialized at zero, as the
space_fish variable was not NULL when it should (i.e. even with same
composite and blend space), hence composite_to_blend_fish was not NULL
and since the operation was not a valid GeglOperation when entering
gimp_operation_layer_mode_real_process(), we crashed.
Not sure how it went unseen for so long!

So instead let's make the layer_mode class member into a pointer. As
such, I have to properly allocate and free it. This is also why I am
adding a copy constructor which will ref the pointer (otherwise we unref
more than we ref as the default copy constructor would just copy the
pointer).
2020-11-10 01:11:01 +01:00
Rafał Mikrut 3e35fe4d80 Cppcheck fixes 2020-11-05 19:42:14 +00:00
Jehan d95f417719 app, libgimpwidgets, modules, plug-ins: code changes after GimpScaleEntry…
… reclassing as GimpLabelSpin subclass.
2020-11-05 18:06:52 +01:00
Jehan 3449652fe8 app: properly grab focus when targetting text input of GimpSpinScale.
By just redirecting to parent signal handler, it was not properly
grabbing focus. In particular for a text entry with number input, we
want the text to be fully selected (because when we go for inputting
numbers, it is more often than not because we want to enter free numbers
very different from existing value).
So let's grab the entry focus, hence fully select current number
contents.
2020-11-05 18:06:52 +01:00
Jehan b3c0ba061b app, libgimpwidgets, modules, plug-ins: finishing GimpScaleEntry port.
Renaming the temporary function gimp_scale_entry_new2() into
gimp_scale_entry_new() now that the original code is entirely gone. This
is now a fully-fledged widget with a nice and proper introspectable API.
2020-11-01 02:46:20 +01:00
Jehan 0f05825a29 app, libgimpwidgets, plug-ins: default increments for GimpScaleEntry.
Instead of setting always manually the step and page increments when
creating a GimpScaleEntry, let's just generate some common cases
automatically. Indeed the increments are rarely something you want to
care about. The algorithm used is:
- For a range under 1.0, use a hundredth and a tenth (typically a [0,
  1.0] range will step-increment of 0.01 and page-increment of 0.1).
- For small ranges (under 40), step-increment by 1, page-increment by 2.
- For bigger ranges, step-increment by 1, page-increment by 10.

For use cases when you absolutely want specific increment values, I add
the gimp_scale_entry_set_increments() function. It is much better to
have a small and understandable constructor call followed by
configuration calls (only when needed) rather than a constructor with a
crazy amount of parameters. Hence gimp_scale_entry_new() went from 17
arguments (absolutely unreadable calls) to now 5.
2020-10-30 12:33:46 +01:00
Jehan 1e81bdabb0 app, libgimpwidgets: improve GimpScaleEntry API.
* Add a gimp_scale_entry_get_value() because if we don't do a property
  widget, getting the value of the widget easily is a main point.
* Move gimp_scale_entry_(set|get)_logarithmic() to the new class API.
* Internally edit the GtkSpinButton width depending on min/max values,
  place digits, and possible value sign.
* Emit a "value-changed" signal (similarly to other widgets with a
  value), for cases when just binding the "value" property is not
  enough.
* Finally use the new API in palette-import-dialog.
2020-10-30 11:02:20 +01:00
Jehan d81b151e79 app, plug-ins: use the updated gimp_prop_scale_entry_new() API. 2020-10-30 11:02:20 +01:00
Jehan 1a5eea4f0f app, libgimp, pdb: improve a bit gimp_image_get_parasite_list() docs.
It is more accurate to say it returns a list of parasite names rather
than a list of parasites (as we could take it as meaning a list of
GimpParasite). Of course, we would soon see the actual element contents
(if not for the introspection metadata (element-type gchar*)), but
better being accurate in textual docs too.
2020-10-30 11:02:20 +01:00
Jehan 1fb2448850 app, pdb: use gimp_is_canonical_identifier() for pdb-get|set-data…
… instead of gimp_pdb_is_canonical_procedure().
The later would set an error saying "Procedure name '%s' is not a
canonical identifier". Yet the data label is not a procedure name. It is
a random name. I'm not sure why we need it to be canonical too, but why
not. In any case, let's use the right function.
2020-10-30 11:02:20 +01:00
Jehan b96bed5909 app: show unavailable actions in Action Search after available ones.
Some people had been complaining that they couldn't find some actions in
some case, which was only because they were in states where the actions
were non-sensitive. So it was "normal" (i.e. not a bug), yet I can see
how it can be disturbing especially when we don't realize that an action
is meant to be inactive in some given case.
Of course the option to show all actions already existed in the
Preferences. But as most options in Preferences, this is hardly
discoverable and many people only use default settings. Moreover showing
hidden action made the action search cluttered with non-sensitive
actions in the middle of sensitive ones.

This change gets rid of the "Show unavailable actions" settings and
always show all matching actions. In order not to clutter the list with
useless results, I simply updated the display logics to always show
non-sensitive action after sensitive ones. Note that even non-sensitive
actions will still be ordered in a better-match-on-top logics, yet they
will be after sensitive actions. So the top results will be the best
matches among sensitive actions (action in history), followed by various
levels of matches (actions with matching labels, tooltips, different
order matches, etc.); then they will be followed by best matches among
non-sensitive actions, followed by the same levels of matches as
sensitive ones.

This way, we still keep a very relevant result and there is no need to
have a settings for this.
2020-10-26 16:40:43 +01:00
Jehan 90bcdf9bda app, libgimp, pdb: remove references of removed functions.
There were still a few references to functions which have been removed
from GIMP 3 (because they were deprecated in previous versions), which I
found as I was doing an inventory of removed functions.
2020-10-26 15:36:42 +01:00
Jehan 7e6ced5c99 Issue #5322: [Wayland] broken splash size.
This is not a fix, only an extra-ugly workaround so that at the very
least we don't end up with a splash screen taking the whole display on
Wayland.

Basically by setting 1/3 as the max splash size, a Wayland desktop with
no scale ratio will have a splash taking a third of the screen while it
would take 2/3 of the screen with a scale ratio of ×2 (of course, it
will still be very broken with a scale ratio of ×3 but are there
displays needing such high scaling?). The real fix will be when GTK/GDK
fix their API so that it returns what the docs says it should (i.e. a
size in "application pixels" not "device pixels"), as it does on X11,
Windows, macOS… Then we won't create random max size and we will be able
to properly control our splash size.

Note that this neither fixes nor works around the position issue on
Wayland (in my case, the splash was just always on top-left of the
display).
2020-10-25 00:55:26 +02:00
Jehan 3a50e52ac7 app: fix some glitches in the splash status text.
These small glitches have bothered me for a while now, so I finally
fixed these before the dev release!
Basically there were 2 fixes:
1. use the ink extents to compute any drawn area as this is what will be
   actually drawn.
2. Not only expose the drawn area of the new text, but also the one of
   the previous text in order to be sure all text pixels are correctly
   reset (in case the new text is smaller than previous one). I.e. we
   must expose the smallest rectangle containing both previous and new
   area of text.
2020-10-25 00:00:05 +02:00
Jehan e676ad46ec app: clean tab indentation. 2020-10-24 03:05:20 +02:00
Jehan 68cea84658 app: fix AppStream tag localization.
As AppStream docs says, <description> "tag should be translated
by-paragraph" in upstream metadata, which is what we have always done
(i.e. <_p> tags which becomes <p xml:lang="xy">).

Unfortunately as_app_get_description() is optimized to work for
Collection Metadata where the 'tag is translated "as a whole"' (again
cf. specs) for faster parsing. So we were ending up with a text mixing
the original and all localized texts.
I have opened a bug report to appstream-glib:
https://github.com/hughsie/appstream-glib/issues/381

While waiting for this to be fixed (i.e. when the function will handle
both cases accordingly to the metadata source), this code makes my own
locale extraction (defaulting to original text which is assumed to be
the previous same level tag with no xml:lang if no tag with the exact
lang attribute was found).
2020-10-23 00:24:16 +02:00
Jehan 6c26d39c8e app: unstable versions will check available development releases.
Stable versions (i.e. minor version number even, e.g. 2.10.22) will only
look for higher stable releases. But for unstable versions, we will want
to look up the development releases too. So for instance GIMP 2.99.2
will warn if the development version 2.99.4 has been released, but also
if the stable version 3.0.0 has been released (whatever is the highest,
which is the stable version in this example).
2020-10-22 16:18:31 +02:00
Jehan 89db5f65fd app: properly free internal strings at finalization and before…
… overriding their previous value.
2020-10-22 16:04:38 +02:00
Jehan 057b94f5f5 app: use gimp_viewable_is_ancestor() instead of gimp_item_is_ancestor().
I had recently created gimp_item_is_ancestor() but realize it duplicates
gimp_viewable_is_ancestor() (which works on GimpItem since it's a parent
class). No need for duplicate code.
2020-10-22 12:45:33 +02:00
Jehan 4b9dc93d08 app, pdb: set string arguments to "" *after* the GFile.
Thanks to Wormnest for pushing me to look further. Since gimp-file-save
is actually redirecting the call to another procedure (save proc for the
specific format) which might have more arguments, including string
arguments. When it finds any, it sets it to an empty string "" (which I
guess is ok as "default value when we don't know what to put there").

The previous code would not hurt. Starting at the fourth argument
(GFile), it would just do nothing, then continue with the firth and
further. Still, starting directly at the fifth arg is the proper code
for this.
2020-10-21 20:28:38 +02:00
Jehan 9487c5648b app: fix gimp-file-save PDB procedure implementation.
The GFile was taken from the wrong argument.
2020-10-21 17:58:19 +02:00
Jehan 1a90a2df32 app: fix alpha to selection on single layer with offset. 2020-10-21 17:36:58 +02:00
Jehan 025309b0d7 app, libgimpconfig: "printer-profile" becomes "simulation-profile".
As per a FIXME for 3.0 where various mention to "print" got replaced by
a more generic notion of "simulation".
2020-10-16 19:50:19 +02:00
Jehan 5c89099f75 Issue #4777: "New version available" after update.
The About dialog refreshes the release information relatively to
currently running version before being displayed. No check of the remote
JSON file is done, it only verifies whether any stored released
version/revision is not same (or even lower) than the actually running
version. Indeed existence of a stored release means that a newer version
exists at check time only. On later run, this stored information may
have become deprecated.
2020-10-16 18:15:31 +02:00
Jehan 3e0be2046e app: fix wrong extension active state on exit.
First the deserialize data of extensionrc was wrong. I need to edit the
pointer to the GList (and dereference it when I need).

Also when inserting an extension into the `running_extensions` hash
table, I could not reuse the same string as in the `processed` list
(because this string is going to be freed at end of initialization).
Just always use the GimpObject name of the extension, since it will stay
alive for as long as the object is alive.
2020-10-09 15:30:54 +02:00
Jehan 9c4860b31e app: check extensionrc existence before trying to parse it.
On first run, it would not exist (which is normal) which was producing
an error message on stderr.
2020-10-09 15:30:54 +02:00
Jehan 915657153f app: don't show an uninstall button for system extensions.
Unlike user extensions, system ones can only be deactivated, not
uninstalled.
2020-10-09 15:30:54 +02:00
Jehan c04c2d841d app: fix file comparison.
g_list_find_custom() uses a GCompareFunc which has a return value
similar to strcmp(), i.e. with 0 for equality (and not a boolean, which
is basically the opposite).
2020-10-08 03:20:05 +02:00
Jacob Boerema 9acefd22de fix: themes_theme_change_notify: error parsing theme.css on Windows.
When loading a theme on Windows we always get an error like:
themes_theme_change_notify: error parsing [path including drive letter to:]\theme.css: theme.css:8:99Failed to import: Operation not supported

The location points to the end of the filename of the first @ import url string.
This is caused by the string not being an url.
Based on suggestions from Jehan and lillolollo we replace g_file_get_path
with g_file_get_uri since an url is what is expected here.
Since that function already escapes the string we also remove
g_str_escape here.
2020-09-26 21:21:10 +00:00
Jehan 578c078590 app: GimpFilterTool displays a "Sample merged" checkbox.
In several GeglOperation filters, it is possible to pick a color. Up to
now, it was only possible to pick a color from the active layer (the one
you run the operation on). With this change, we can also pick in Sample
merged mode, same as Color Picker tool and other color tools.
2020-09-26 12:40:54 +02:00
Jehan 578e3b0bd9 Issue #5630: Sample Merged as defaults in Color Picker tool.
The rational: advanced users won't really care about defaults (they know
to switch this option on/off depending on situation) but maybe beginners
would be less confused to pick "what they see" on first use, rather than
picking on the active layer? Now whatever is the default won't change
anyone's daily usage of GIMP. Clearly every image and use case is
different, so both with or without sample merged are useful one time or
another (this is why the option exists). It's really about the less
surprising option for beginners, based on usage statistics.

I ran a small poll on Twitter/Reddit/Patreon/Tipeee and ended up with
numbers of 131 for switching to "Sample merged" as default and 43
against, which is about 75% in favor. So let's just switch. It makes
sense anyway.
2020-09-25 21:44:27 +02:00
Jehan 2ec6510973 Issue #4505: Adjust the Preferences size to fit on smaller displays.
Make some of the bigger Preferences pages automatically scrollable if
needed. Based on my tests, this should be enough to fit on quite small
displays, at least with the default themes, even the 1366×768 reported
as too small. It should even fit in 1280×720 (in my tests, it did).

Targetting even smaller screens may be overdoing it for an image
manipulation software. We'll see if people still ask for a smaller
dialog.
2020-09-24 18:29:30 +02:00
Jehan 09fa321074 app: new profile conversion policy to preferred color profile.
Our Preferences exposes a concept of "Preferred color profile" (for RGB,
grayscale and CMYK), which is used in some places to be proposed as
default alternative to built-in profiles. But it was not used in the
import color profile dialog (only 2 choices were: keep the image profile
or convert to built-in RGB).
This commit now adds this third choice, which is even made default when
hitting the "Convert" button directly, without tweaking with the dialog.
Because we can assume that if someone made the explicit choice to label
such a profile as "Preferred", this is more likely the one to convert to
(if one even wants to convert from an embedded profile anyway).

As for the `Preferences > Image Import & Export > Color profile policy`,
they now propose 4 choices: Ask, Keep embedded profile, Convert to
built-in or preferred profiles.
2020-09-24 16:27:34 +02:00
Jehan 41c8d19634 app: argh metadata-rotation-import-dialog.h missing from Makefile.am.
This was breaking the dist (hence the distcheck)!
2020-09-24 14:54:52 +02:00
Jehan 5a8d69629a libgimp, pdb: new functions gimp_image_policy_rotate() and…
… gimp_image_policy_color_profile().
These functions allow a plug-in to explicitly execute the Rotation and
Profile conversion policies on an image (which may be any of
Rotating/Discarding/Ask or Converting/Keeping/Ask respectively). These
policies are automatically executed when loading an image from GIMP
interfaces, but they won't be when loading an image from the PDB. Then
it is up to the calling code to decide what to do (which can be either
some arbitrary code or following the user policy).
2020-09-24 12:49:57 +02:00
Jehan 67e2e1b5bb app, libgimp, plug-ins: move Orientation metadata handling into core.
Orientation is now handled by core code, just next to profile conversion
handling.

One of the first consequence is that we don't need to have a non-GUI
version gimp_image_metadata_load_finish_batch() in libgimp, next to a
GUI version of the gimp_image_metadata_load_finish() function in
libgimpui. This makes for simpler API.
Also a plug-in which wishes to get access to the rotation dialog
provided by GIMP without loading ligimpui/GTK+ (for whatever reason)
will still have the feature.

The main advantage is that the "Don't ask me again" feature is now
handled by a settings in `Preferences > Image Import & Export` as the
"Metadata rotation policy". Until now it was saved as a global parasite,
which made it virtually non-editable once you checked it once (no easy
way to edit parasites except by scripts). So say you refused the
rotation once while checking "Don't ask again", and GIMP will forever
discard the rotation metadata without giving you a sane way to change
your mind. Of course, I could have passed the settings to plug-ins
through the PDB, but I find it a lot better to simply handle such
settings core-side.

The dialog code is basically the same as an app/dialogs/ as it was in
libgimp, with the minor improvement that it now takes the scale ratio
into account (basically the maximum thumbnail size will be bigger on
higher density displays).

Only downside of the move to the core is that this rotation dialog is
raised only when you open an image from the core, not as a PDB call. So
a plug-in which makes say a "file-jpeg-load" PDB call, even in
INTERACTIVE run mode, won't have rotation processed. Note that this was
already the same for embedded color profile conversion. This can be
wanted or not. Anyway some additional libgimp calls might be of interest
to explicitly call the core dialogs.
2020-09-24 12:43:41 +02:00
Jehan 5fb0577768 app: NULL log domain is not a bug.
A log error can have a NULL domain (apparently equivalent to "" default
domain, according to g_log_set_handler() docs and we even explicitly
list the NULL domain in the log_domains array in app/gimp-log.c.

Yet our log handler was not expecting such possibility and was running a
g_str_has_prefix() on NULL. Not sure why it aborted there. It might be
because outputting a new warning inside the warning handler did not go
well. Anyway this seems to fix our side of the bug #5358. The main fix
will likely be on GEGL side (UMFPACK_ERROR_out_of_memory error).
2020-09-22 17:59:41 +02:00
Jehan 6dae2c1d33 app: remove unused function.
gimp_ui_get_dialog() is not used anymore anywhere.
2020-09-21 21:00:30 +02:00
Jehan ec26bc44ae app: (meson) create_test_env.sh was not run.
The script `create_test_env.sh` was registered in meson as a run target
(i.e. to be run manually by `ninja create_test_env`), which is really
not useful. So a `ninja test` was outputting various:

> You have a writable data folder configured (/gimp/build/dir/app/tests/gimpdir-output/gradients),
> but this folder does not exist. Please create the folder or fix your
> configuration in the Preferences dialog's 'Folders' section.

Unfortunately run target are only meant to be run from command lines and
cannot be used in 'depends' argument of test() or 'dependencies' of
executable() because "in Meson all dependencies are to output files, not
to concepts" (cf. https://github.com/mesonbuild/meson/issues/1793).

So instead a run_target() just directly use a run_command() and make
this script run during configuration step. Also make the shell script
executable as it was not.

See also #5666 as it was one of the errors outputted by the reporter's
log (though probably not the main issue).
2020-09-20 13:20:29 +02:00
santouits 6e00a19fd0 Don't compile gimpmarshal source file many times
Also, removes gimpmarshal.h from a source file that didn't need it.
2020-09-13 18:13:29 +03:00
Jehan 68a7431a10 Issue #5623: https://gimp.org/gimp_versions.json is redirected…
… to www.gimp.org.
2020-09-08 21:13:27 +02:00
Niels De Graef 5d3ca7d714 propwidget: Add gimp_prop_switch_new()
Allow developers to add a `GtkSwitch` based on a property. Also start
using it in the first preferences page.
2020-08-22 23:53:49 +00:00
Jehan e50f522d5b app: "drawable-linked" multi-drawable aware. 2020-08-17 18:28:26 +02:00
Jehan 84e587d255 app: GimpSelectionEditor multi-drawable aware.
When clicking on the selection mask (in the dockable view) or when
dropping a color on this same view, we can now select by color based on
the selected layer composition (not only one single layer, nor the whole
image as sample merged, but also a specific list of composited layers).

gimp_channel_select_by_color() is made multi-drawable aware as a
consequence of this.
2020-08-17 18:22:19 +02:00
Jehan bd452d7df1 app: (selection editor) fix clicking on selection mask or dropping color
I discover that the selection editor has these hidden features that (1)
you can click on the selection mask (in the editor dockable) and it
behaves like the Select by Color tool (not sure exactly how useful this
feature is as you can't really see where you click though) and (2) you
can drop a color and it will select this color also as though clicked by
the Select by Color tool (which looks quite useful!).
These features use the option values as set in the Select by Color tool.

Unfortunately both these features were broken when a non-zero threshold
was set because it expects a [0-1] range whereas threshold is [0-255].
Fix the parameters in gimp_channel_select_by_color() call.
2020-08-17 13:32:36 +02:00
Jehan c5f9b8e190 Issue #5530: do not fail font loading on broken user/GIMP fonts.conf.
Additionally to loading the default fontconfig configuration file, GIMP
also looks up /etc/gimp/<version>/fonts.conf and
$XDG_CONFIG_HOME/GIMP/<version>/fonts.conf (or equivalent in other
OSes). If these don't exist (which is the most common case), this is not
considered a bug. Fontconfig had a regression bug of
FcConfigParseAndLoad() in 2.13.92, which was fixed in a later commit:
fcada52291
As a consequence of this bug, font loading failed in Windows when these
non-mandatory files were absent.

The current commit, originally proposed by Jacob Boerema (@Wormnest) and
slightly reviewed works around the issue, because anyway there is never
any reason why failing to load these files should break font loading as
a general rule. Even if these files exist and are broken (wrong syntax
or whatnot), we should just output some warning on stderr and continue
loading without these additional confs.
With fontconfig 2.13.92, warnings will be also outputted (wrongly), but
at least it won't block loading anymore.

Also let's unref() the `config` object even when the whole font loading
succeeds. Man of FcConfigSetCurrent() clearly says that the reference
count of config is incremented since 2.12.0 (our current minimum
fontconfig is 2.12.4) so let's not leak one reference.
2020-08-16 18:06:09 +02:00
Ell 10d3ae2894 app: during splash-screen lookup, don't leak GFileEnumerator 2020-08-11 21:52:38 +03:00
Felix Yan fe085200c3 Correct typos in layers-commands.c 2020-08-08 10:41:20 +00:00
Jehan c73ac8fdf4 app: action "drawable-visible" now multi-layer aware. 2020-08-03 19:51:18 +02:00
Øyvind Kolås ec746901c3 build, app: depend on GEGL 0.4.26 2020-08-02 22:34:15 +02:00
Liam Quin be0e63aa1c Issue #4328: Distorted path of an open/imported circle from an svg file.
Undoing the apparent mistake (revert 27e78849a2) and changing the 2nd
occurrence instead.
2020-08-02 22:08:34 +02:00
Ell 9e0fdc8e2c app: allow recording GLIB log messages in performance logs
Add a new "Messages" boolean parameter to performance logs, which,
when set, records GLIB log messages in the performance log as
markers, with an accompanying sample capturing their backtrace.
This option is enabled by default.
2020-08-02 11:02:00 +03:00
Ell a143bfdf1d app: add gimp_log_{set,remove}_handler()
... which set/remove a GLIB log handler for all domains used by
GIMP.

Use the new functions in errors.c, instead of using
g_log_set_handler() directly.
2020-08-02 11:01:59 +03:00
Jehan 892fbafdf8 app: some more gimp_image_get_active_drawable() removed.
No logics changed. These are places where we expect single layer
selected.
2020-08-02 01:10:13 +02:00
Jehan 9b55f82579 app: drawables translation with arrow keys multi-layer aware.
We can now move multiple layers selected, together with the arrow keys.
2020-08-01 22:39:21 +02:00
Jehan 8b55346500 app: Color Select tool multi-layer aware.
Similar logics as Fuzzy Select (see my previous commit), which is that
if multiple layers are selected (and sample merged unchecked), it
selects as though through a composited image containing only the
selected layers.
2020-08-01 20:37:48 +02:00
Jehan 6093399d7b app: Fuzzy Select tool multi-layer aware.
When several layers are selected, and using the Fuzzy select tool
without sample merged (with sample merged, nothing changes, it just uses
the whole image), the selection will be based off a composited render of
the image with only selected layers.

This is equivalent to only making selected layers visible, running fuzzy
select with sample merged, then making other layers visible again.
2020-08-01 19:56:07 +02:00
Jehan 67b757f55a app: drop a color or a buffer multi-layer aware.
When dropping a color, we fill all the selected layers with this color.

When dropping a buffer, multi-layer is same as no layers selected (i.e.
we paste once as a new layer, not multiple times).
2020-08-01 19:14:21 +02:00
Jehan 1fa951127e app: more code in paint and brightness-contrast tool to port.
These 2 tools only work on single drawable at once. Yet slowly getting
rid of all usage of gimp_image_get_active_drawable().
2020-08-01 18:25:45 +02:00
Jehan ac0287e2f3 app: window title stays single layer for now.
Logics stay the same except I replace gimp_image_get_active_drawable()
by gimp_image_get_selected_drawables() to show I looked at this code.
Basically it doesn't look like we can really handle multiple layer
selected here, unless we want overly-long window titles.
2020-08-01 18:25:45 +02:00
Jehan 5357628df2 app, pdb: fix pdb and generated code.
Oups! The meson build failing to properly generate code is annoying!
2020-08-01 16:36:27 +02:00
Jehan 2ba6ac6286 app: selection stroke and "Stroke Path" now multi-layer aware.
This includes "select-stroke*" actions and "Stroke Path" feature of the
Vector tool.
2020-08-01 14:02:24 +02:00
Jehan 6b829c7008 app: Selection fill and "Fill Path" now multi-layer aware.
This includes the actions "select-fill*" as well as the "Fill Path"
feature in the Vector tool which were using common code.
2020-08-01 13:12:21 +02:00
Jehan 5d14a7a595 app: some fixes/improvements.
Forgot to free a list.
Also getting rid of a gimp_image_get_active_drawable() in edit_paste(),
with logics staying the same.
2020-08-01 12:04:04 +02:00
Jehan 5eec3e3457 app: get rid of last remnants of single-layer logics in edit-actions.
edit-cut and edit-named-* implementations were already multi-layer
aware. Making them sensitive appropriately was the only missing part.
2020-07-31 21:06:10 +02:00
Ell 552991b2d2 app: return visible widgets from a few more gimp_prop() functions
... in particular, this fixes the Rotate Colors prop-gui.
2020-07-31 20:47:05 +03:00
Jehan ae0f595a19 app: edit-fill-fg|bg|pattern multi-layer aware. 2020-07-31 17:52:53 +02:00
Jehan 117495323f app: fix layer double click (Layer Attributes dialog).
This got *again* broken because of some obviously impossible code path
(a same variable tested against 2 different values!). Anyway I tested
again and it seems that all possible interactions in the item tree views
are now correctly working though the whole button press code is a very
complicated mess of possible variations and events.
2020-07-31 17:42:39 +02:00
Jehan 696fb34cc5 app: layers-mask-edit only works with a single layer selected. 2020-07-31 17:42:39 +02:00
Jehan 0f1f8b7b45 app: layers-resize and layers-scale work on one layer at once.
Making these actions multi-layer aware here means checking only exactly
1 layer is selected as these actions have GUI which shows dimensions and
preview (for the layer dimension action, i.e. layers-resize).
2020-07-30 21:26:13 +02:00
Jehan bf7d555759 app: edit-clear multi-layers aware. 2020-07-30 21:18:54 +02:00
Jehan 62eedd41b4 app: layers-alpha-add|remove multi-layer aware. 2020-07-30 21:03:03 +02:00
Jehan 4b3348dffe app: layers-crop-to-selection and layers-crop-to-content multi-layers…
… aware.
2020-07-30 18:36:18 +02:00
Ell 9b29d17895 app: improve layout of performance-log file-selection dialog parameters 2020-07-30 18:15:32 +03:00
Jehan 802ba92ca5 app: do not allocate a GFile when crashing.
When backup-ing images upon crashing, reuse a GFile allocated at
startup, and simply rename the file to handle multiple files to save.
2020-07-30 16:00:38 +02:00
Jehan 949d7eee3b app: fix backup creation on crash.
The call to "gimp-xcf-save" was not updated to the new API using a
drawable array and a GFile.
Also for the drawable array, do not actually create it as anyway this is
a dummy argument (so far XCF saving does not even look at this argument
and just re-check the selected drawables).
2020-07-30 14:17:02 +02:00
Jehan d11e59fc42 app: allow a number of drawables to 0 for "gimp-xcf-save".
This parameter is not even used because we check again the selected
drawables during the save code. Allowing to set to 0 is simpler, and
also it will allow to not have to allocate an object array for layers
when we want to avoid memory management (during crash handling).
2020-07-30 14:15:52 +02:00
Jehan 9069919931 app: output errors to stderr when gimp_procedure_execute() fails with…
… argument validation.
I had a case where argument validation was failing on range and no error
was propagated (during a crash handling). Let's not leave these errors
totally silent as it makes such usually easy issues harder to debug. In
the specific case of no GError passed, just print the error to stderr.
2020-07-30 14:10:36 +02:00
Ell d11cbbbbc9 app: in GimpDashboard, fix progressive-performance-log env-var 2020-07-30 01:14:37 +03:00
Ell 146c234350 app: add progressive performance logs
Add an option to record progressive performance logs.  Progressive
logs contain complete information after each recorded sample, by
writing partial address maps at each sample, containing all new
addresses introduced by the sample.  Furthermore, when recording a
progressive log, the output stream is flushed after each sample.

This allows recording complete logs even in cases where they can't
be properly terminated, such as when GIMP crashes or freezes in the
middle of the log.

Progressive logs are disabled by default, since they potentially
increase the sampling cost.  They can be enabled through a toggle
in the log file-dialog, or through the
GIMP_PERFORMANCE_LOG_PROGRESSIVE environment varaible.
2020-07-30 01:03:38 +03:00
Ell 126002c5c9 app: allow controlling performance-log parameters through the UI
When recording a performance log, allow setting the log parametrs
through the file dialog.  Currently, this includes the sample
frequency, and the option to include backtraces.

These options are still controllable through the
GIMP_PERFORMANCE_LOG_SAMPLE_FREQUENCY and
GIMP_PERFORMANCE_LOG_BACKTRACE environment variables.  When set,
the variables override the values entered through the UI.
2020-07-30 01:03:37 +03:00
Ell 95b69dd77b app: in GimpBacktrace Windows backend, return NULL backtrace if not initialized
In the Windows implementation of gimp_backtrace_new(), return NULL
if the backend is not fully initialized.
2020-07-30 01:03:37 +03:00
Jehan 281f17e53c app: GimpToolRectangle multi-layer aware.
This fixes default constraint values when multiple layers are selected.
In particular fixed aspect ratio defaults in Crop or Rectangle Select
tools, in layer mode, when several layers are selected, the default
aspect ratio is the layer's ratio if all layers have the same
dimensions, otherwise it's the image dimension ratio.

Also fixes a bug when trying to create the tool rectangle while multiple
layers are selected (the rectangle was always of size 0 at point 0).

Finally fixes the auto-shrink feature with multiple layers selected. The
rectangle will now auto-shrink to the smallest rectangle which
encompasses the contents of all selected drawables inside the existing
rectangle.
2020-07-29 19:26:05 +02:00
Ell 3a462a5e63 Issue #5472 - CRITICAL while using Move tool with arrow keys
In gimp_edit_selection_tool_translate(), perform the active-item
checks even when the effective translation offset is 0, and only
bail afterwards.  This avoids erroneously calling
gimp_tool_message_literal() with a NULL message in this case.
2020-07-29 20:08:19 +03:00
Ell 0829dba97f Issue #4536 - Seg fault when trying to open image on Google Drive (Gnome 3.34.3)
In file_open_image(), mount non-native files *before* looking up a
file-proc.  Previously, we'd only mount the file after the initial
lookup, and fail to perform a second lookup if the mount succeeded,
leaving us with a NULL file-proc and a subsequent segfault.

Additionally, simplify the rest of the remote-file code-path.
2020-07-28 11:01:23 +03:00
Jehan 73b960aefb app: fix a build warning.
Fixes:
> warning: passing argument 1 of ‘GIMP_CONFIG’ discards ‘const’
> qualifier from pointer target type.
2020-07-20 15:41:22 +02:00
Jehan d3ef6cfb18 app: show playground if any of the experimental feature is enabled.
Basically if you enabled OpenCL or any of the experimental tools, it
will show the Playground in Preferences. Otherwise, say you enabled some
experimental feature months ago (e.g. with the CLI option) and you now
experience crashes or whatnot. And you forgot how to change it, and only
remembered that there was something in Preferences. It would make you
crazy to not find the tab again to disable the option.

This is even more important as OpenCL is moving from a normal option to
a playground option. So you might not even have ever seen the Playground
tab in Preferences and would not know how to disable OpenCL after you
enabled it originally in "System Resources" tab.

So now Playground is visible with any of these 3 conditions:
* If you use an unstable version.
* If you run GIMP with --show-playground option.
* If you previously enabled one of the playground options.
2020-07-17 13:28:43 +02:00
Jehan 0f806d0e9c app: move OpenCL settings into the Playground.
After discussions on IRC, it was decided that our current level of
support of OpenCL was not good enough. As a normal settings, people just
see it as a normal acceleration checkbox, even despite the warning text
and emoticone saying the opposite (i.e. it may even slow things down in
some cases).
Basically this feature needs more love to be back into mainstream
Preferences.
2020-07-17 12:04:27 +02:00
Jehan bc5f6371e9 app: add contents of /.flatpak-info in the verbose info.
This file is available in a flatpak sandbox and will contain various
info such as the build commit, very useful info as we can have several
builds for a same version. For instance if we have exactly the right
commit, we can load exactly the same binary as a bug reporter very
easily, hence are able to get source correspondance without necessarily
asking reporters to install debug symbols (though it stays easier if
they can do it).

Other interesting info contained in this file are the exact runtime
used, the installed application or runtime extensions, the permissions
(people may override our flatpak permissions so it's useful to be able
to check when they did) and environment variables…
2020-07-16 12:12:37 +02:00
Jehan 74d0990456 app: fix Alpha to Selection for single selected layer.
By adding support for multiple selected layers, it seems I broke the
single selected layer case. Fixed now!
2020-07-06 23:15:12 +02:00
Jehan b52cdf4c90 app: make "gegl:matting-levin" default engine of Foreground Select tool.
Even though this engine is optional, we already have the code to detect
its absence at runtime, and to fallback to "gegl:matting-global". So it
won't be a problem even then.

When the operation is present though, it definitely makes a lot more
sense than matting global as default, because it performs a lot better
in most cases (as far as I could see as well as others).
2020-07-06 22:19:26 +02:00
Jehan 5565a6a389 app: layers-resize-to-image action multi-layer aware. 2020-07-01 01:00:48 +02:00
Jehan 86716ba8a4 app: fix gimp_image_merge_down() when merging multiple neighbour layers.
If the next visible layer below a selected layer is itself selected, we
want to create bigger merge list with all 3 layers merged at once (or
even more if the next-next is also selected, and so on).
2020-07-01 00:40:40 +02:00
Jehan 955aecab92 app, pdb: layers-merge-down action now multi-layer aware.
When several layers are selected, each layer will merge down with the
layer below it. This is similar to running Merge Down several times, one
for each selected layer.
2020-06-30 23:29:05 +02:00
Jehan dadae644bf app: fix selected layers in duplicated image.
This seems to have been broken since much longer, but it only made a
problem with recent changes. Since we were duplicating layer groups and
contents layers at once, the current code could not keep layer selection
other than at root level in a duplicated image.
Use the layer paths to make sure we select exactly the right copied
layers, since the path should not change in a fully duplicated image.
2020-06-27 18:07:51 +02:00
Jehan 33520a547d app, libgimp: protect a bit GDK X Window calls.
The GDK_WINDOWING_X11 build-time macro check is not enough as GDK can be
built with both X11 and Wayland backends. We need to add a runtime check
of the type of display.
2020-06-21 12:54:13 +02:00
Jehan 2ae1ab505a app: [Wayland] fix invalid preedit range in text tool.
So it seems that pango_attr_iterator_range() could return G_MAXINT for
a Pango attribute when it is at the end of the preedit string. Looking
at Pango code, I see they initialize the attribute end property to
PANGO_ATTR_INDEX_TO_TEXT_END (G_MAXUINT), later clamped to G_MAXINT by
pango_attr_iterator_range(). So I guess for the specific case where we
are at the text end, it is normal. Only weird thing is that this didn't
happen at all on X11, only in Wayland.

So let's do our own pre-check. Also double the check by adding a UTF-8
validation.

This fixes preedit text not being displayed and the following warning:

> Gtk-CRITICAL **: 12:31:25.118: gtk_text_buffer_emit_insert: assertion 'g_utf8_validate (text, len, NULL)' failed

Even worse, this was potentially an out-of-range reading, though
fortunately checked early enough.
2020-06-21 12:35:22 +02:00
Ell 887d6a3670 app, themes: fix display-shell statusbar height
In gimp.css, don't set a minimum height for GimpDisplayShell
statusbars.  Instead, in GimpStatusbar, set the widget's minimum
height to the maximum of its children's natural heights.  Note that
we have to do this manually, instead of using a size group, since
GtkSizeGroup::ignore-hidden is deprecated (and nonfunctional) in
GTK3.
2020-06-18 13:12:29 +03:00
Ell f182442206 app, themes: improve GimpSpinScale styling 2020-06-17 10:40:42 +03:00
Ell 9809939e25 app, themes: use compact style for GimpSpinScale
Align GimpSpinScale with gimp-2-10, by modifying its appearance and
behavior to match the 2.10 compact style, fixing interaction along
the way.  Unlike 2.10, there is no option to revert to the old
style.
2020-06-16 19:40:43 +03:00
Jehan 66a952df9f app: check if display is X11 before gdk_x11_display_get_user_time().
Fixes:
> GLib-GObject-WARNING **: 20:51:24.156: invalid cast from 'GdkWaylandDisplay' to 'GdkX11Display'
2020-06-15 21:36:54 +02:00
Jehan f0281e1421 app: remove the "Keys" list in the Input Device editor.
After discussion with Carlos Garnacho, we came to the conclusion this
list is a useless feature. Basically what we call "input device" here is
pretty much "pointer device" only. We are indeed explicitly ignoring any
device identified as GDK_SOURCE_KEYBOARD, leaving us only with various
types of pointer devices (and pads actually, which maybe we should also
ignore in fact).
Such devices don't usually come with "keys", only "buttons". And in rare
cases of very weird devices coming with both buttons and keys, they will
usually identify as 2 separate devices (a pointer device and a keyboard
one) anyway, in Carlos experience, so we would still wouldn't have
access to the real keys anyway.

Moreover these keys were not only useless, but also sometimes confusing,
because some pointer devices would actually list keys, but then if you
tried to map some key event, it would not do anything (as they are not
real keys). The tablets I was testing with were such, reporting hundreds
of keys which do nothing and only confused the hell out of me.
Carlos says it probably means that the tablet drivers send bogus data of
key descriptions (so a bug in the driver, harmless yet still confusing).

So let's just get rid of this key list as our tablet expert says these
are bogus and let's see if anyone ever reports feature loss of some
extra weird pointing device which one would have used in GIMP while
mapping keys. Note that I leave the concept of keys inside
GimpDeviceInfo for now (only removing the widget part listing these)
just in case we realize we have to bring these back (less chance of code
conflict in the future when reverting the small GUI commit). But chances
are high that we will have to clean GimpDeviceInfo too and just get rid
of key code there.
2020-06-13 21:40:06 +02:00
Jehan 4def457c63 app: Input Devices "Reset" button should actually reset to defaults.
In other dialogs, it is not a revert to how it was before opening the
dialog, but a reset to default settings.
To just revert to dialog opening values, we can just use "Cancel" and
reopen the dialog (a bit cumbersome, but not something done often
anyway).

Currently what "Reset" does is to set back the device mode and any
customized axe curve. It doesn't touch customized keys, but these will
disappear anyway in a further commit.
2020-06-13 20:36:37 +02:00
Ell c4a201eaf4 Issue #5208 - paint brush is broken when aspect ratio is set to negative
Fix horizontal downscaling of brush mipmap levels with odd width.
We'd previously fail to skip the last pixel of each input row,
which isn't included in the output when the width is odd, causing
subsequent output rows to be shifted to the right.
2020-06-12 17:30:28 +03:00
Ell bbc0f18953 app: fix error propagation in boolean GUM grouping subexpressions 2020-06-12 01:35:04 +03:00
Ell 5c07bcd1ff app: fix reference parsing in boolean GUM expressions 2020-06-12 01:35:04 +03:00
Ell 93f728e484 app: fix switching filter-tool split-preview orientation
... after last commit.
2020-06-11 21:31:01 +03:00
Ell 214936e8c6 app: use absolute offset for filter-tool split-preview guide position
In GimpDrawableFilter and GimpFilterTool, use an absolute offset
for the split-preview guide position, instead of storing it as a
fraction of the drawable's width/height.  The latter could
introduce rounding error, which would result in wrong coordinates
when converted back to an absolute offset.
2020-06-11 20:45:33 +03:00
Ell 9a25ae7171 app: update custom guides when moved past display bounds
In GimpGuideTool, when a custom guide (whose position is updated
directly on motion) is moved past the display bounds, keep updating
the corresponding GimpGuide's position, even though the guide will
be removed on release, to avoid leaving the guide at its old
position.

This affects the filter tool's split-preview guide.
2020-06-11 20:45:14 +03:00
Jehan ee79c7b294 app: "OK", "Cancel" and "Reset" buttons on "Input Devices" dialog.
Rather than the "Save" and "Close" buttons which were very weird, if not
misleading. When Aryeom was giving a course to students, several thought
the buttons were broken because "nothing happened" when clicking "Save".

So instead, "OK" will just save and exit (equivalent to click "Save"
then "Close" on old GUI) as it is the common usage and should be doable
in a single click.
"Cancel" closes while resetting to how the settings were before opening
the dialog.
Finally "Reset" just reset the settings to how they were before opening,
without closing the dialog.

This also makes the buttons look/behave like the ones on Preferences,
which is nice consistency-wise too.
2020-06-10 02:33:50 +02:00
Jehan 080ef8a0d8 Issue #5179: fix "Add layer masks" and improve "Edit layer mask".
The `mask` test was broken as it is not multi-layer aware (also it
should be negated).

The "layers-mask-edit" test was actually already fine because current
implementation only allow mask editing when single-selected. Still
improve the test to use multi-layer variables.

Thanks to Cyril Richard for the original patch proposition from which I
derivated the present one.
2020-06-09 11:54:16 +02:00
Jehan 5302beb947 app: make a tooltip translatable and translate device axis strings.
Thanks to Cristian Secară on the developer mailing list to notice them.
2020-06-09 10:58:28 +02:00
Øyvind Kolås 14765e72b6 meson, autotools, app: depend on GEGL 0.4.24 2020-06-07 21:24:03 +02:00
Øyvind Kolås 529471e1ca meson, autotools, app: depend on babl-0.1.78 2020-06-07 20:33:32 +02:00
Ell 24f45e327b po: add vector-toolpath-actions.c to POTFILES.in
... and remove intl support from vector-toolpath-commands.c.
2020-06-04 01:34:34 +03:00
Ell ca351d3520 app: misc cleanup in prop-gui range creation 2020-06-03 10:16:23 +03:00
Ell c7599626f4 app: fix prop-gui static range visibility 2020-06-03 10:16:22 +03:00
Ell 4492f61df4 app: in _gimp_prop_gui_new_generic(), use "range-label" pspec key as range label
... when available
2020-06-02 23:56:16 +03:00
Ell 438babea6b app: improve gegl:focus-blur prop-gui constructor
... by grouping the geometry options, which can be controlled
through the on-canvas UI, in an expandable frame, which is
collapsed by default.  The shape option is not part of the group,
and is moved to the top.
2020-06-02 23:25:26 +03:00
Ell 323355a708 app, menus: add gegl:lens-blur to Filters -> Blur
gegl:lens-blur simulates an out-of-focus lens blur.
2020-06-02 23:25:26 +03:00
Ell 8eb752b194 app: use special prop-gui widget for luminance ranges
In _gimp_prop_gui_new_generic(), when a pair of consecutive
properties have "range-start" and "range-end" roles, respectively,
and "luminance" units, use a range prop-widget for both properties,
as per the previous commits.

The range is sorted by default, unless the first property has a
"range-sorted" key of "false".
2020-06-02 23:25:25 +03:00
Ell ce8235e977 app: add gimp_prop_range_set_ui_limits()
... which sets the limits of the range-widget's handle-bar
explicitly, instead of using the lower/upper properties' limits.
2020-06-02 23:25:25 +03:00
Ell fa5dd99559 app: allow setting handle-bar limits explicitly
In GimpHandleBar, add gimp_handle_bar_{set,unset,get}_limits(), to
allow settings the handle-bar limits explicitly, rather than
inheriting the adjustment limits.
2020-06-02 23:25:24 +03:00
Ell e03b8e597b app: add gimp_prop_range_new()
... which creates a widget controlling a pair of lower/upper range-
limit properties, comprised of a handle-bar and two spin-buttons.

If the "sorted" parameter is TRUE, the "lower" property is bounded
above by the "upper" property, and vice versa.
2020-06-02 23:25:23 +03:00
Ell 45e5c2231a app: add gimp_gtk_adjustment_chain()
... which takes a pair of GtkAdjustments, and binds the value of
the first to the lower-limit of the second, and the value of the
second to the upper-limit of the first.
2020-06-02 23:25:22 +03:00
Ell 0ac2aa5130 app: in gimp_accel_label_set_action(), emit notify 2020-06-02 11:03:25 +03:00
Ell 8139836d5d app: fix parsing of GUM cross-property references 2020-06-01 22:40:27 +03:00
Ell ae801871e5 app: in gimp_prop_eval_string(), don't leak result upon trailing tokens 2020-06-01 22:40:27 +03:00
Ell 4d83c7a3fc app: list all tool-group tools in tool-button tooltip
In tool-group GimpToolButton tooltips, in addition to showing the
description of the currently-active tool, list the other tools in
the group as well, to improve discoverability.
2020-06-01 19:29:27 +03:00
Ell 2259ad5fcc app: add GimpAccelLabel
Add a new GimpAccelLabel widget, which shows an accelerator label
for a given GimpAction.  Unlike GtkAccelLabel, GimpAccelLabel
doesn't show a user-provided label in addition to that.

Note that the size request of GtkAccelLabel doesn't include the
accelerator part, which is desirable in some contexts.
GimpAccelLabel doesn't suffer from that.
2020-06-01 19:29:24 +03:00
qarmin be5d23bf98 Compare counter value instead its pointer address 2020-05-31 10:04:13 +00:00
Sabri Ünal 4ad1a68c3a Fix a typo: All selected_items 2020-05-30 19:30:33 +00:00
Jehan 647ebffe7b app: GimpTransformTool multi-layer aware.
This implied a lot of other core changes, which also pushed me into
improving some of the edit actions and PDB calls to be multi-layer aware
in the same time.

Note that it is still work-in-progress, but I just had to commit
something in an acceptable intermediate state otherwise I was just going
crazy.

In particular now the various transform tools are multi-layer aware and
work simultaneously on all selected layers (and the linked layers if any
of the selected layers is linked too). Both preview and final transform
processing works.
In the limitations, preview doesn't work well (only one layer in the
preview) when there is a selection (though the actual transform works).

Also I am left to wonder how we should process this case of canvas
selection+transform on multi-layers. Indeed currently I am just creating
a floating selection (like we used to for the selection+transform case)
containing a transform result of the composited version of all selected
layers. This is a possible expected result, but another could be to get
several transformed layers (without composition). But then should the
"Floating Selection" concept allow for multiple Floating Selections?
Sooo many questions left to answer.
2020-05-28 14:28:01 +02:00
Øyvind Kolås d7d0c046f0 app,build: depend on babl-0.1.76 2020-05-27 15:21:09 +02:00
Simon Budig 3927401a80 app: Simplify the logic for the GimpToolPath popup. 2020-05-26 23:09:25 +02:00
Jehan 5398d15b55 app, pdb: fix build warning because of discarded 'const' qualifier.
The PDB creates the array of drawables as a `const GimpItem *` and the
compiler does not like when we drop the const qualifier. So force this
const dropping with explicit type casting.
2020-05-26 21:49:58 +02:00
Jehan b8eef4e859 app: fix check for XCF 14.
I must obvioulsy check for selected layer number over 1, not 0. Right
now, all common XCF files ended as being version 14.
2020-05-26 16:57:27 +02:00
Jehan b05fc6950d app: create and use gimp_image_item_list_linked().
This function returns a new list of items from an input list. The output
list will optionally contains linked items if any of the input item is
linked so we don't have to rewrite the same duplicated code for every
feature where item links matter.

Moreover it also filters descendants if any of the input items is an
item group, hence avoiding to apply a transformation twice to a
descendant item.

Use this new function already in 2 places, hence skimming quite a bit of
redundant code.
2020-05-26 14:15:17 +02:00
Jehan 7233464664 app: Alpha to Selection will warn when the resulting selection is empty.
Proposed by Aryeom to make it more obvious of a possible issue when
running "Alpha to Selection" and ending up with an empty selection
(which is useless hence may means there might have been a problem in
one's workflow).
This warning will also occur for similar actions (i.e. the
Add|Substract|Intersect Alpha to|from|with Selection actions).
2020-05-26 14:15:17 +02:00
Jehan 03af9da83b app: GimpTool multi-drawable aware.
Right now I don't change the logics of any of the tools, except that the
GimpTool class now stores a list of drawables instead of a single
drawable. This can be later used on a case-by-case basis to make various
tools actually work on multiple drawables.
2020-05-26 14:15:17 +02:00
Jehan 661f057603 app: add gimp_image_equal_selected_drawables().
This can be used in various places where we want to check whether a
previously saved list of drawables is still the same list of selected
drawables. It used to be easily done with an equality test with a single
active drawable, but not anymore with a list of selected drawables.
2020-05-26 14:15:17 +02:00
Ell 10f9ee63c6 app: don't leak UI manager in GimpToolPath 2020-05-26 11:10:27 +03:00
Ell 18d747611c app: forward tool get_popup() to widget get_popup() in GimpDrawTool
Override GimpTool::get_popup() in GimpDrawTool, forwarding the
request to the tool widget, if one exists.

Remove the same code in GimpVectorTool -- this now works for all
tools/widgets.
2020-05-26 11:07:25 +03:00
Ell 4b1c8f9ec7 app: fix precondition return values in gimp_tool_widget_get_popup() 2020-05-26 11:05:58 +03:00
Ell afda774f44 app: update tool widgets on display-shell changes more granularly
Partially revert commit c73710e410,
avoiding updating tool widgets unconditionally on tool resume in
GimpDrawTool -- it's too expensive in general.

Instead, handle display-shell changes in GimpToolWidget, by adding
GimpToolWidget::update_on_{scale,scroll,rotate} flags, which
subclasses can use to request an update on any of these events.

Set the flags as necessary for the affected widgets.
2020-05-26 10:46:01 +03:00
Ell ec69083354 app: fix compiler warnings in GimpToolWidget 2020-05-26 10:44:46 +03:00
Simon Budig 8839cb58bb pdb: update autogenerated files. 2020-05-25 22:55:01 +02:00
Simon Budig c10778fa03 app: implement a few more functions for the ToolPath context menu. 2020-05-25 22:13:45 +02:00
Simon Budig f6f180c5cb app: Add basic infratructure for a vector tool popup menu. 2020-05-25 22:13:45 +02:00
Simon Budig 44a7e92967 app/vectors: implement stroke_reverse and stroke_shift_start 2020-05-25 12:33:10 +02:00
Ell 258c8454d5 app: implement GimpColorManaged for GimpImageProxy
In GimpImageProxy, implement GimpColorManaged by forwarding the
functions to the underlying GimpImage, and forwarding the signals
in the other direction.  This fixes color-managed view in the
Navigation dockable.
2020-05-22 16:35:56 +03:00
Ell d9f5558977 app: update core-enums.c 2020-05-22 16:35:56 +03:00
Jehan ae4abbabfd app: layers-merge-group multi-layer aware.
Also layers-flatten-image does not care about the layer selection and
layers-anchor works anyway only when there is a floating selection,
which means only one layer selected.
2020-05-21 15:08:28 +02:00
Niels De Graef 842dc7535f gir: (skip) functions with varargs
Bindings can't handle these, so they are not introspectable.
2020-05-21 13:49:38 +02:00
Jehan 5c221df99f app: layers-blend-space-* & layers-composite-space|mode-* multi-layer…
… aware.
2020-05-21 00:04:37 +02:00
Jehan 338ac504df app: "layers-mask-selection-*" multi-layers aware.
All selected layers' masks are combined first as union, then the result
is combined with the image selection according to requested boolean
operation.
Also use new gimp_channel_combine_items() function.
2020-05-20 22:59:34 +02:00
Jehan 081ebf19f0 app: more accurate undo names.
Don't just name all alpha-selection actions the same "Alpha to
Selection". Have some more accurate naming like "Substract Alpha from
Selection", etc.

Also improve the action names to make them more accurate as these names
are not only in menus anymore, but also in search actions (and we want
to avoid duplicate naming).
2020-05-20 21:20:39 +02:00
Ell 09870d4b15 app: zero-out transparent pixels when converting to indexed
When converting an image to indexed mode, zero-out transparent
pixels instead of leaving junk in their indices, which might well
be out of range of the palette.
2020-05-20 21:16:52 +03:00
Jehan 32740ac0de app: improve alpha to selection with multiple items.
I created a new function gimp_channel_combine_items() which combines a
list of items with a channel. The list of items is first combined
together as an union set, then only combined with the channel with the
desired operation (this is important for operations such as intersect
which was broken in my previous commit because all items would be
intersected with each other and the selection, whereas we actually want
the union of all items to be intersected with the selection). This new
function is now used for "Alpha to Selection".

Also similarly to copy or color-pick on multi-layers, alpha to selection
will now use the composited result of the multi-layers as visible. In
particular it means that opacity, modes and visible properties on the
layers are taken into account. Alpha to selection on a single layer
though still works as previously, only taking the non-composited layer
data into account.
I am actually struggling if alpha to selection on uncomposited layers
(just an union on alpha to selection result for each layer) would not
make sense to on some workflows. To be experimented.

Finally it is to be noted that this function should also work on
channels and vectors (both single or multiple; and of course in such
cases, compositing does not matter) though I haven't tested yet. It
could even work with a source mix of layers, channels and vectors,
though our GUI does not allow such action currently.
2020-05-20 18:45:44 +02:00
Ell a90f59d961 app: fix alignment of generic pixel buffers
Wherever we store arbitrary-format colors in an opaque buffer, use
double for the buffer, instead of char, so that it has a strict-
enough alignment to handle all our used pixel formats.
2020-05-20 08:53:41 +03:00
Michael Schumacher 7412c4be6f app: use G_GINT64_FORMAT to fix a long unsigned int vs. long long int format warning 2020-05-19 18:24:38 +00:00
Ell 8fa9221fb8 app: don't leak text-tool UI manager 2020-05-19 17:06:24 +03:00
Ell e38010b2d1 app: in GimpPanedBox, don't accept drag contexts with unsupported targets
... to avoid both highlighting the droppable areas during darg, and
crashing on drop.
2020-05-18 18:19:01 +03:00
Jehan 645d80123a app: make "Alpha to Selection" multi-layer aware.
Allows to select several layers and have their alpha channel to replace
the selection, or substract from it, etc.
2020-05-18 12:22:08 +02:00
Jehan 2dcd38c586 app: gradient tool multi-drawables aware.
It means forbidding gradient tool to work (with appropriate error
message) on multiple selection. Applying gradient on several layers at
once is not supported at this point.
2020-05-18 11:37:25 +02:00
Jehan 2b764c6542 app: do not try to copy a buffer result from a canceled GEGL operation.
This fixes:
> GEGL-WARNING: (../../src/gegl/gegl/buffer/gegl-tile.c:127):gegl_tile_dup: runtime check failed: (! src->damage)

Which happened when a GEGL operation was running and you canceled it in
the middle, say with the ESC key (easy to reproduce with long operations
such as "Color to Gray"). In such case, obviously don't try to copy the
unfinished operation result into the dest buffer.
2020-05-18 11:22:34 +02:00
Jehan 2956873740 app, libgimp, pdb: fix gimp_selection_float() usage.
This fixes bugs introduced in commit a7c59277fb where I obviously didn't
properly checked all the places where gimp_selection_float() was used
after its parameters changed.
2020-05-18 02:09:45 +02:00
Jehan 73096b9a04 app: make the text tool multi-layer aware.
Multi-drawable selection for text tool only matters for positionning the
newly created text layer, if relevant. If a single layer is selected, it
will be same as before.
With multiple selection, the new layer just ends up to the top in case
of layers from different containers.
2020-05-18 00:53:57 +02:00
Jehan 5e960ad56b app: fix gimp_item_tree_get_insert_pos() with GIMP_IMAGE_ACTIVE_PARENT.
Don't check for NULL parent as it is a valid parent (for a root item).
Check instead just if we are the first item in the list.
2020-05-18 00:30:19 +02:00
Jehan a7c59277fb app: quick on-canvas copy-paste multi-layer aware. 2020-05-17 23:00:07 +02:00
Jehan 5498adf50a app, libgimp, pdb: color picker multi-layer aware.
Color picking on a single layer still works as it used to. On multiple
layer, it will now pick on the composited color, similarly to sample
merged if only selected layers were made visible.

The PDB/libgimp function gimp_image_pick_color() is also updated to work
on multiple drawables too, giving the same ability to plug-ins (the only
call to this function in core plug-ins have been updated).
2020-05-17 18:57:32 +02:00
Jehan 6f5fbe4022 app: scroll automatically only when none of the selected items…
… are visible in the container tree view (upon updating selection).
2020-05-17 18:57:32 +02:00
Jehan 5cf71f3220 app: test-ui multi-layer aware.
This is actually commented-out test code, but still to be thorough in
case we ever re-enable this code.
2020-05-17 18:57:32 +02:00
Jehan f0557e93f8 app: Layer Selection Advance (up/down) now multi-layer aware. 2020-05-17 18:57:32 +02:00
Jehan 0ab91b9b55 app: "Import Palette" multi-layer aware.
When creating a palette out of an image without checking "Sample
Merged", it will now extract the colors out of each individual selected
layers separately. This allows to create palettes even out of all layers
of an image but still considering these individually.
2020-05-17 18:57:32 +02:00
Jehan 28112bbf9e app: layer pick through canvas click multi-layer aware. 2020-05-17 18:57:32 +02:00
Jehan 83d8fcdd06 app: GimpCanvasLayerBoundary to show all selected layers area.
I am currently unsure of this one. Since GimpCanvasLayerBoundary is a
GimpCanvasRectangle, it now shows the minimum rectangular boundary
containing all selected layers.

Should we instead show all individual layers boundary? I didn't choose
this because it would make the whole canvas much more messy, and also I
figure that layer boundaries are mostly used to get an idea of your
current working space extent, for instance if we were to resize the
canvas. Matter to discuss, I guess.
2020-05-17 18:57:32 +02:00
Jehan e3094b4c86 app: Crop tool now multi-layer aware. 2020-05-17 18:57:32 +02:00
Jehan 5964f72cea app, pdb: layers-merge-layers* and image-merge-layers multi-layer aware.
Multi selection actually only really matter when "Merge within active
groups only" option is checked, in which case we are able to merge
layers within several layer groups simultaneously, and end up with
multi-selected merged layers.

Also not sure why both layers-merge-layers and image-merge-layers exist,
as they are exactly the same (exact same callback called when
activated).
2020-05-17 18:57:32 +02:00
Jehan 9dc6b2e9fe app: various "select-*" were already multi-layer aware.
No code change, they don't actually need drawable selection to work.
2020-05-17 18:57:32 +02:00
Jehan 98603c69c9 app, libgimp, pdb: "edit-copy" multi-layer aware.
When several layers are selected, select their render, similar to how
"edit-copy-visible" would have copied an image with only these layers
made visible.
Also apply the same logics to PDB function gimp_edit_copy() which can
now be used on several drawables at once.
2020-05-17 18:57:32 +02:00
Jehan 0534e077b7 app: selection were not displayed when multi-layers selected. 2020-05-17 18:32:16 +02:00
Jehan cb03fa1f08 app: Move tool multi-layer aware.
If several items are selected, they will be moved together. If one of
them is linked, all other linked items will be added to the moved
items.
2020-05-17 18:32:16 +02:00
Jehan 22a86c44ca app: layers-select-* multi-selection aware.
Allows to move multiple selection up and down, within each selected
layer's own depth.
2020-05-17 18:32:16 +02:00
Jehan 8f22f12ee7 app: layers-lock-content and layers-lock-position multi-layer aware. 2020-05-17 18:32:16 +02:00
Jehan 80b74ce9e9 app: raise-layers* and lower-layers* actions multi-selection aware. 2020-05-17 18:32:16 +02:00
Jehan 8a65b9c3b0 app: allow shift-click on GimpContainerTreeView expanders.
Similarly to shift-click on visibility or link toggles, shift-click on
expanders allow to expand/collapse all layer groups at a given level,
but the one initially clicked.
2020-05-17 18:32:16 +02:00
Jehan c3e9aeff8c app: multi-layer awareness for layers-new-group and layers-new.
Also improve a bit layers-new-last-values to also work when no layer is
currently selected (in such case, we just create a top layer at root
depth).
2020-05-17 18:32:16 +02:00
Jehan c1f68c02cf app: fix some GimpContainerTreeView mouse interactions.
- Don't trigger selection when toggling visibility/links.
- Fix some weird selection jump when clicking while editing a layer
  title.
- Return FALSE in GDK_BUTTON_RELEASE so that viewable larger preview
  popup gets closed on mouse release.
2020-05-17 18:32:16 +02:00
Jehan 7cdf85693a app: multi-layer aware layers-mask-add and layers-mask-add-button.
These actions raise a GimpViewableDialog. For this to work, I made this
widget work with a list of GimpViewable, not a single viewable anymore
(so maybe the widget class name should change?).
When this list contains only a single GimpViewable, it will display
exactly like before, with a viewable preview. With several viewables,
the preview won't show.

This allows to add masks to all selected layers at once, with the same
basic options for all masks, as set in the dialog.
2020-05-17 18:32:16 +02:00
Jehan 6501c3961d app: multi-layer awareness for layers' lock-alpha, opacity and mode.
Both with the various action layers-lock-alpha, layers-opacity-* and
layers-mode-*, as well as through the layer tree view GUI (alpha lock
icon, opacity slider and layer mode combo box).
2020-05-17 18:32:16 +02:00
Jehan 6916edde0c app: make layers-color-tag-* multi-layer aware. 2020-05-17 18:32:16 +02:00
Jehan a029ef3f97 app: layers-mask-show and layers-mask-disable multi-layer aware.
As for layers-mask-edit, it should only be sensitive in single layer
selection, and multiple selection of layers will get them out of
mask-edit mode.
2020-05-17 18:32:16 +02:00
Jehan 9c277e078c app: make layers-mask-apply and layers-mask-delete multi-layer aware.
Not fully happy of the action sensitivity tests as they check for
content-lock, layer groups and such, but independently. So we could have
a case with 2 layers selected: a group + a content-locked layer. Yet the
layers-mask-apply action would be sensitive.
But instead of make more tests, I am nearly wondering if we should not
make action sensitivity more lax as the actual action will make the
tests anyway and just do nothing.
2020-05-17 18:32:16 +02:00
Jehan b5c8a259c8 app: make layers-mask-add-last-values multi-selection aware. 2020-05-17 18:32:16 +02:00
Jehan b2c11f8e95 app: layers-duplicate now also multi-selection aware. 2020-05-17 18:32:16 +02:00
Jehan 65e2738053 app: add an info label above GimpItemTreeView item list to indicate…
… multi-selected items.
The idea is that with multi-selection now enabled, you may always lose
track and forget you have several items/layers selected. This is
especially true when you have a lot of layers (say you selected one at
the top of the list, another at the bottom; without scrolling, you may
only see one of them). And this can become bad when doing some
destructive action which is allowed on several layers at once (say
deleting several layers while you thought you were deleting only one!).

I got the idea from Thunderbird GUI which also displays the number of
selected conversations in the email list. Same as in Thunderbird, I also
wanted to theme the label similarly to a selected item in the item list
below. This was hard because there is no way to reference the parent
theme colors from within GIMP one. Instead I made so that the label is
always shown as a fully selected text (which is a bit ugly semantically,
but I could not find better). Why I wanted this styling is to give *a
bit* of focus to this info so that it is not too invisible. Otherwise
purpose is defeated. Yet this label is still more subtle than
Thunderbird one (don't want to take all attention toward it). Hopefully
this got the right in-between style.
2020-05-17 18:32:16 +02:00