Commit Graph

45666 Commits

Author SHA1 Message Date
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
Cristian Secară 93a43ce0fd Update Romanian translation
(cherry picked from commit b8dfa31a88)
2020-05-18 14:24:29 +00:00
Yuri Chornoivan 65c5232e01 Update Ukrainian translation 2020-05-18 12:54:13 +00:00
Yuri Chornoivan abc0348f6d Update Ukrainian translation 2020-05-18 12:25:14 +00:00
Niels De Graef c2d4e7d265 gir: Fix some missing (out) annotations 2020-05-18 13:26:23 +02:00
Niels De Graef 09094fe66f gimpenumwidgets: Apply (transfer none) annotation
`(out)` implies `(transfer full)`, which isn't the case here. Let's fix
it before anyone tries to use it and gets hard to debug problems.
2020-05-18 13:00:58 +02: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 bb7f94ce3b libgimp: add new functions to gimp.def.
This fixes the Windows build.
2020-05-17 22:44:02 +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 0ae4686172 pdb: proper conversions for object arrays in PDB. 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
Jehan 86af7c3fa2 app: make "layers-new-last-values" multi-selection aware.
It allows to create several layers at once, by adding them all with
default generated names above each respectively selected layer.
2020-05-17 18:32:16 +02:00
Jehan 7e0adbc282 devel-docs: update XCF docs with XCF 14 changes. 2020-05-17 18:32:16 +02:00
Jehan 592cea6b87 app: actually implement XCF multi-layer selection saving/loading.
Since XCF up to now was assuming single-selection, adding
multi-selection in XCF means bumping its version to XCF 14.
2020-05-17 18:32:16 +02:00
Jehan d3139e0f7c app: support saving/exporting with multi-selection.
This commit just changes our saving API (i.e. the GimpSaveProcedure
class) to take an array of drawables as argument instead of a single
drawable.

It actually doesn't matter much for exporting as the whole API seems
more or less bogus there and all formats plug-ins mostly care only
whether they will merge/flatten all visible layers (the selected ones
don't really matter) or if the format supports layers of some sort. It
may be worth later strengthening a bit this whole logics, and maybe
allow partial exports for instance.

As for saving, it was not even looking at the passed GimpDrawable either
and was simply re-querying the active layer anyway.
Note that I don't implement the multi-selection saving in XCF yet in
this commit. I only updated the API. The reason is that the current
commit won't be backportable to gimp-2-10 because it is an API break. On
the other hand, the code to save multi-selection can still be backported
even though the save() API will only pass a single drawable (as I said
anyway, this argument was mostly bogus until now, hence it doesn't
matter much for 2.10 logics).
2020-05-17 18:32:16 +02:00