Commit Graph

23343 Commits

Author SHA1 Message Date
Jehan 5c63c2478f app: duplicate and delete channel actions multi-channel aware. 2021-12-23 12:55:11 +01:00
Jehan 718177b8bc app: raise/lower channels one step or to top/bottom multi-channel aware. 2021-12-23 12:55:11 +01:00
Jehan fcd59784e0 app: improve "Select Top|Bottom Layer" actions.
Similarly to how I improved "Select Top|Bottom Channel", we should set
the actions sensitive not only when the selected layers are not the
top/bottom ones, but also when there are no selected layers at all.
2021-12-23 12:55:11 +01:00
Jehan 8d38b72446 app: channel selection actions now multi-channel aware. 2021-12-23 12:55:11 +01:00
Jehan 670a7fcc9c app: generate a critical with some more information.
I had a weird case where g_return_val_if_fail() ran but I could not
reproduce and am not sure how this happened. Adding the item name may
help diagnose the next time it happens.
2021-12-23 12:55:11 +01:00
Jehan 566e55e72e app: "Bend the text along the currently active path" multi-layer aware.
It still only requires one single path selected to work, but I updated
the internal API used.
2021-12-23 12:55:11 +01:00
Jehan b9eb289b5c app: implement multi-paths selection.
For now, highlighting, snapping and moving (position change with move
tool) have been implemented.
2021-12-23 12:55:11 +01:00
Jehan 45e18f696c app: add multi-channel drag'n drop ability. 2021-12-23 12:55:11 +01:00
Jehan 58302ee332 app, pdb: get rid of various gimp_image_get_active_channel().
Replace them with gimp_image_get_selected_channels().
2021-12-23 12:55:11 +01:00
Jehan bd038b1864 app: implement multi-channel selection.
Similar to commit 592cea6b87, but this
type for the Channels dockable.
2021-12-23 12:55:11 +01:00
Jehan 8faf6a832c app: get rid of GimpContainerViewInterface select_item signal.
Now that we have implementations for select_items everywhere and that
all the code is only wired to call or handle select_items, the single
item variant select_item is of no use anymore. Let's make a big cleanup.
2021-12-23 12:55:11 +01:00
Jehan 8a46a72d7d app: all remaining select-item handlers replaced by select-items ones. 2021-12-23 12:55:11 +01:00
Jehan 2a404cb41d app: more "select-item" signal handlers changed to "select-items" ones. 2021-12-23 12:55:11 +01:00
Jehan 4b681eb448 app, libgimpwidgets: new gimp_event_triggers_context_menu() and use it…
… for the container tree view contextual menu.

A very annoying point of contextual menus is that they happen on button
press whereas menu item selection happens on button release. When the
menu corner is positionned on the click position, nothing bad happens;
yet when place is missing on screen, the menu might get positionned over
the pointer position. And worse, the mouse position might be just over
an activatable menu item. So we end up in this weird situation where a
click implies: press, menu opens, release, random item (whatever is
below the pointer) is selected and menu closes.

To get rid of this weird case, let's have our contextual menu happen on
button release. In reality, I don't think anyone cares that it happens
on press or release, you just "click". But what you certainly don't want
is to click random menu items!
2021-12-23 12:55:11 +01:00
Jehan 8a91d973cd app: fix clicking on unsaved images in Quit / Close All dialog.
Let's now use the "select-items" signal only (even in cases where we
expect only one selection per construction).
2021-12-23 12:55:11 +01:00
Jehan 9d46e47653 app: one more select_items() implementation which I had forgotten. 2021-12-23 12:55:11 +01:00
Jehan a404500f3e app: add a select_items() implementation on various classes…
… implementing GimpContainerViewInterface.
2021-12-23 12:55:11 +01:00
Jehan 367901875f app: check if an item was already inserted by actually looking it up in…
… the container.

There was this weird case which we somehow could only reproduce on
Aryeom's computer/build, not mine, with the same code and reproduction
steps (reproducible at will on her build only). Basically when drag'n
dropping a duplicated layer inside a collapsed layer group, the
row-expanded handler would try to select the moved layer before it is
actually inserted. This would end up into crash-happy code.

I'm still unsure of why the order of operation is different here, but
anyway what is for sure is that the `inserting_item` boolean flag was
not protecting much. It's not like it's an actual mutex and anyway this
is not multi-threaded code either so this flag was mostly useless (which
is why we were crashing). Instead let's actually look if the item is in
the container or not.
2021-12-23 12:55:11 +01:00
Jehan 1a3dbe2099 app: implement a select_items() method for GimpContainerComboBox…
… and use gimp_container_view_select_items() when the context changes.

Even though some types of containers still expect only a single
selected content, we should slowly move to multiple item code. The
reason is to avoid 2 code paths which makes the code more complicated
and bug-prone. When all child classes of GimpContainerView will have a
valid select_items() implementation, we can work on getting rid of the
select_item() in favor of the multi-item one.
2021-12-23 12:55:11 +01:00
Jehan 47e0e6f519 app, libgimp, pdb: add visibility lock API. 2021-12-23 12:55:11 +01:00
Jehan de6a57d5c2 app: fix coordinate conversion.
I was doing it the wrong way, and it became impossible to drop layers
into a layer folder (unless it already had some layers in it).
2021-12-23 12:47:28 +01:00
Jehan 9b7c868f4d app: more coordinate conversion in GimpContainerTreeView. 2021-12-23 12:47:28 +01:00
Jehan 9d25482c03 app: use the new lock icons. 2021-12-23 12:47:28 +01:00
Jehan cd3b3b8dd4 app: fix crash with a NULL highlight area. 2021-12-23 12:47:28 +01:00
Jehan 1ba3c3d4b5 app: fix gimp_item_tree_view_blink_lock().
The bin window coordinates must be converted to the widget coordinates.
This was not a problem before, but now with the column header, if I
don't do this, the position is wrong.

Similarly fix the lock popover position.
2021-12-23 12:47:28 +01:00
Jehan 59f3d0097c app: show GimpItemTreeView's header.
The header shows a lock icon, making the column more discoverable, as
well as where to click.
Also the title for the item column will now be used for the
multi-selection label (counting items) instead of using
GimpItemTreeView's options box.

Finally use the new gimp-multi-lock icon to show multiple locks.

This makes for much nicer and usable item tree.
2021-12-23 12:47:28 +01:00
Jehan 18fab4e257 app: add Alt-click on visibility and locks for exclusive switch within…
… the selected items only.
This is the exact same algorithm as Shift-click, except that Shift-click
switch exclusivity within the whole level of items. Alt-click does the
same but only within selected items in the list.
2021-12-23 12:47:28 +01:00
Jehan cd7f399006 app: implement exclusive lock switching (Shift-click).
Similar to exclusive visibility switch on layers, now for locks too, if
one wants to lock all layers within a same level for instance by
Shift-clicking the lock icon.

Also once again I factorized the exclusive switching code to ensure it
will always works the same for all similar features (visibility and all
locks).
2021-12-23 12:47:28 +01:00
Jehan c9812c29f9 app: hide the lock popup when clicking on shown same cell's. 2021-12-23 12:47:28 +01:00
Jehan 8508eda45f app: more responsive lock and link popovers.
First of all, let's use gtk_widget_show|hide() instead of
gtk_popover_popup|down() because these GtkPopover API sometimes "block"
when clicking very fast on the item list, sometimes up to 2 or 3 seconds
(at least it feels like seconds, I haven't actually timed it!). I'm sure
the ones who developed it thought it was nice to have slow popping
dialogs, but when working fast, this can only be frustrating).

The second responsiveness change is that when clicking out of useful
lock popover area, it should not only close, but the event should be
passed onto the item tree view when relevant. This allows for instance
to directly click on an eye cell to change a layer visibility without
having to click twice.
2021-12-23 12:46:59 +01:00
Jehan 302bf53a67 app: blink the lock cell when failing to switch visibility (eye). 2021-12-23 12:20:43 +01:00
Jehan 1c1b84b88b app: also use gimp_item_tree_view_add_lock() for default locks.
All locks now use the exact same code, which makes for very nice code
factorization, but also ensures consistent behavior.
2021-12-23 12:20:43 +01:00
Jehan dda15cb0e8 app: improve item lock management with gimp_item_tree_view_add_lock().
Use this for the alpha lock brought by GimpLayerTreeView.
Also use the new gimp_widget_blink_rect() to only blink the appropriate
cell when a lock is preventing you from doing something.
2021-12-23 12:20:43 +01:00
Jehan 0a5a20cbb8 app: use gimp-layer as visibility lock icon.
The 2 eyes next to each other are just weird in this layout.
2021-12-23 12:20:43 +01:00
Jehan 33e2d18a59 app: new gimp_widget_blink_rect().
Also change signature of gimp_highlight_widget().
These functions allow to highlight or blink specific widget areas only
when needed.
2021-12-23 12:20:43 +01:00
Jehan b356ea6aac app: show lock state as cell icon in Layers dockable…
… and drop the link cell (the lock cell takes the space).

This is an experiment with the following logics:
* I am getting rid on the linked item logics, so the icon cell
  disappears anyway.
* The lock buttons are not so visible above the Layers dockable and so
  many have I seen people frustrated of not being able to do some action
  until they realize they locked something in the layer (even sometimes
  advanced users).
  The icon next to the eye is much more visible. Also I will now display
  different icons depending on the type of locks. If a single lock is in
  effect, I show the corresponding icon. If 2 or more locks are in
  effect, I show a generic lock icon.
* With multi-selection of items in particular, this top lock row was a
  lot more weird and could show inconsistent state (some of the
  selection is locked, other is not). Now the per-row lock icon allows a
  much nicer granularity.
2021-12-23 12:20:43 +01:00
Jehan 9492affda3 app: add an item visibility lock.
Sometimes one may want to lock visibility of a given layer. This is very
useful in particular when shift-clicking a layer visibility. In this
case, it won't be included in the list of layer to update. This can be
used for instance if you want some layers always visible (or always
hidden) while setting exclusive visibility of some other layers only.
2021-12-23 12:20:43 +01:00
Jehan a0fc5a025a app: allow storing regular expression-based item sets.
Instead of just storing list of layers, I created a new simple type
GimpItemList (actually GimpItemSet would be better named, but
unfortunately we use this name for an enum type). So far, this new class
can handle 2 types of item sets: named fixed sets and pattern-generated
sets.
2021-12-23 12:20:43 +01:00
Jehan ec99784d6e app: add a placeholder to the stored layer set list.
This is nice for better discovery of the feature allowing to store your
layer selection.
2021-12-23 12:20:43 +01:00
Jehan da987a1485 app: add layer selection by regular expression.
I am unsure if regular expression is the right choice as it may
obviously be a bit too technical. I hesitated with glob-type match for a
while. We'll see!
2021-12-23 12:20:43 +01:00
Jehan 25adf686a5 app: add logical operations on layer sets. 2021-12-23 12:20:43 +01:00
Jehan 4fad4bf89f app: new concept of sets of layers stored in GimpImage.
The eventual goal is to replace the "linked layers" concept, which is
why I am using similar vocabulary. The point is that linked layers are
mostly useless/redundant now with multiplie layer selection, except for
one thing: they kind of serve like a way to "save" a selection of layers
(to be moved/transformed together mostly). Apart from this, multiple
selection is more powerful on any way. You can do much more than
transforming the layers together (you can reorganize them together,
delete them, crop them and so on).

Therefore this new feature is the way to fill the only weakness of layer
selection: its ephemerality. Now we can save a given set of layers, not
even only one, but as many as we want, and under a meaningful name, for
later reuse.
Moreover it will make layer-handling core code much simpler as we
currently have 2 concepts of layer set: multiple selection and links.
The new stored links are only a way to recreate multiple selections.

More is to come, for instance right now, these are not stored in the XCF
format. Also it would be awesome to add logical operators (Shift for
union of layer sets, Ctrl for subtraction and Shift-Ctrl for
intersection). And finally I was thinking about a way to select by
pattern (regular expression? Shell-style glob patterns?) and even store
these patterns. So if you save a "Marmot .*" selection pattern, then
when you select it later, new layers matching this pattern will be
included too (instead of fixed-in-time list of layers).
2021-12-23 12:20:43 +01:00
Lukas Oberhuber 41ff82acbf macos: style cleanup in gimp wrapper code 2021-12-22 12:59:06 +00:00
Lukas Oberhuber e41250394d gimptextstyleeditor: Fix crash on exit
Messages were being sent to editor after editor had been destroyed. This
stops that.
2021-12-22 12:58:32 +00:00
Lukas Oberhuber d8afa6c829 gimp: macOS run from build directory
This change allows gimp to run from the build
directory rather than having to wait for the
full packaging process to complete.

However, 'gi' modules are not loading properly
so that might be something to fix.
2021-12-22 01:34:58 +00:00
Øyvind Kolås 124239202c app,build: depend on GEGL-0.4.34 2021-12-19 00:59:33 +01:00
Niels De Graef bba495999d app: Use g_clear_object() in main.c
Also no need to do a null-check if you're doing g_free(), it can handle
that already.
2021-12-17 09:49:05 +01:00
Niels De Graef bb4403fd49 app: Remove old GimpUiManager popup API
The code used `gtk_menu_popup()`, which was deprecated a while ago, as
it was broken on certain GDK backends, like Wayland.

Fixes https://gitlab.gnome.org/GNOME/gimp/-/issues/5319
2021-12-13 20:57:23 +01:00
Niels De Graef eed28c0941 app: Popup menu at rect in GimpEditor
Rather than trying to fix up our own heuristics using a
`GtkMenuPositionFunc`, use whatever GTK provides to position given a
specific rectangle, which also has the benefit of nicely integrating
with GDK backends such as Wayland. Another advantage is that we can use
GdkGravity to center the popup.

Since GTK 3, GtkWidget also gained a "popup-menu" signal, which we
can/should use instead of rolling our own context signals.
2021-12-13 20:57:21 +01:00
Niels De Graef 67fd1f0c52 app: Popup menu at pointer in GimpEditor
Rather than trying to fix up our own heuristics using a
`GtkMenuPositionFunc`, use the API that GTK provides to have popup
nicely placed near the pointer, which also has the benefit of nicely
integrating with GDK backends such as Wayland.
2021-12-13 20:56:54 +01:00