Commit Graph

23487 Commits

Author SHA1 Message Date
Jehan 748dc77bb5 Revert "app: check selected items changed before running "select-items"."
This reverts commit ca3c480314.

The fix was wrong and was creating other issues such as #7655. We must
always emit this signal.
2022-02-02 21:13:33 +01:00
Jehan 69ee9c927b app: fix build warning. 2022-02-02 16:20:28 +01:00
Jehan e9bea93324 Issue #7720: Layer Sets UI Suggestion.
Using the "list-add" icon instead of "document-save" indeed makes more
sense for the button to store a layer set.

Also renaming "Named Selection" to "New layer set's name", which should
hopefully be less confusing. In particular, we keep consistency with the
"No layer set stored" label (naming the concept "layer set" both times).
And it should be clearer that it is a field to write down a name for
creating a new layer set.
2022-02-02 16:15:25 +01:00
Jehan 02220766b0 app: small code reorganization.
Signal handler to the end with other private functions.
2022-02-01 23:36:40 +01:00
Jehan 55b3e3a336 app: fix selecting fonts with arrow keys in Fonts dockable.
My commit ca28934dfc was very wrong. We absolutely need to set context
in list view editors too. In particular, we could not loop through fonts
in the Fonts dockable very quickly with up/down arrow keys anymore
(since the GimpFontFactoryView is a GimpContainerEditor).

When doing this though, we could have some weird crash in the
GimpContainerPopup watching for context change through button
press/release. Indeed when doing this, simply opening the popup (for
instance clicking on the Fonts icon in text tool options) would trigger
a context change as a button click consequence.
The solution is obviously to check which widget the button event belongs
to and ignore it if it happened on any other widget than the popup.
2022-02-01 23:31:47 +01:00
Jehan c872dcbf20 app, icons, libgimpwidgets: fix icon's gresources rules.
Now the source images are in the build dirs.

Also:
- clean the EXTRA_DIST contents on autotools;
- add dependencies rules in meson gresources to make sure icons are
  built before resource build;
- finally remove a duplicate build rule in Color Makefile.
2022-01-31 21:37:20 +01:00
Jehan 3e47e395a5 app: some typo fix.
Found while looking at this part of the code.
2022-01-31 14:52:42 +01:00
Lukas Oberhuber 96c23903bc macos: support standard fullscreen
This moves to standard fullscreen behavior for Gimp.

Added benefit is that it no longer requires gdkquartz-cocoa-access.h
which the Gtk team wish to stop supporting https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/4303.

Bug 756178 also no longer manifests, cdc7542d46
so it is now safe to do.

Finally, removes dependency on objective c in the app/display directory.
2022-01-24 14:49:42 +00:00
Lukas Oberhuber ce90cc28a1 macos: support python plugins in meson
This change makes sure that plugins can load when gimp is built with
meson. This is because .typelibs and .gir files do not have full library
paths when build using meson (this is different from autotools).
2022-01-24 02:12:22 +00:00
Nikc 998479706b Issue #4107: Removing titlebar/borders from Windows Splash Screen 2022-01-21 13:49:18 +00:00
Jacob Boerema 1858d72d03 app: fix #7682 crash loading xcf with linked text layers
Due to recent changes on master the linked layers concept doesn't exist
anymore. The conversion code checks whether all linked layers are valid.
However, text layers need special handling.

In the past updating the linked_layers wasn't needed when the layer pointer
of a text layer was changed. Now, that has changed because we parse that
list for valid layers. To fix this we update linked_layers in the same
way as already was done for selected_layers.
2022-01-06 15:04:06 -05:00
Jehan 0530e26845 app: remove some signal remnant from GimpImageClass. 2021-12-23 19:11:38 +01:00
Jehan 7607261d68 app: add eye icon to the GimpItemTreeView header's visibility column.
Makes it much more obvious where you have to click for visibility, and
where each column is. Also it's more consistent.
2021-12-23 18:41:47 +01:00
Jehan cbf979e506 app: oups, forgot to add an correspondance for XCF 16 loading handler. 2021-12-23 14:11:16 +01:00
Jehan 2329d3e86d app: labels for item search display the pattern syntax. 2021-12-23 13:45:20 +01:00
Jehan 8dd07a7d4b app: unselect all layers when a search pattern is wrong. 2021-12-23 13:45:20 +01:00
Jehan 2b54ad1bbf app: do not save an item pattern search on Enter, but Shift-Enter.
Sometimes, you just want to quickly select layers, not necessarily save
the pattern. So you'd just type a few words, followed by Enter. Don't
save the search pattern everytime.

Only save it when you hit the "Save" button or on Shift-Enter.
2021-12-23 13:45:20 +01:00
Jehan 362fae9147 app, devel-docs: saving the item sets in XCF (bumping to XCF 16).
We now save and load layer and channel item sets. Only missing set types
are path ones, but the whole path item is just its own exception in the
XCF format, and adding support for it, while keeping compatibility with
older XCF seem like a small headache. I could do it, but I actually
wonder if it is worth it. Would people really need to store sets of
paths?

Also this commit finally gets rid of any remnant of the old item "link"
concept (I think), so we are getting close to merging the branch.
2021-12-23 13:45:20 +01:00
Jehan 084906dbf1 app, devel-docs, libgimp, pdb: remove gimp_item_set_linked().
I cleaned many remaining places where the concept of linked item still
survived.
On loading an XCF file with linked items, we are now going to create a
named sets for the linked items, allowing people to easily select these
back if the relation was still needed.

We don't remove gimp_item_get_linked() yet and in particular, we don't
save stored items into XCF files. This will come in an upcoming change.
2021-12-23 13:45:20 +01:00
Jehan aab4ea2bd6 app: more removal of item link related code.
- removing the GIMP_ITEM_SET_LINKED enum value.
- removing gimp_image_item_list_linked(). Now we should directly use
  gimp_image_item_list_filter() instead.
- "preview-linked" option for transform tools is no more.
2021-12-23 13:45:20 +01:00
Jehan 2ce84b5245 app, devel-docs, libgimp, pdb: delete gimpitem-linked.[ch].
Getting rid of the last usage from these files dedicated to outdated
item link concept.
2021-12-23 13:45:20 +01:00
Jehan 26615fde92 app, devel-docs, libgimp, pdb: now removing gimp_item_linked_rotate(). 2021-12-23 13:45:20 +01:00
Jehan 6f901dfe3e app, devel-docs, libgimp, pdb: get rid of gimp_item_linked_translate().
Similarly to the previous commit, we get rid of "item link" code for
translating items.
2021-12-23 13:45:20 +01:00
Jehan 26d696ce9d app, devel-docs, libgimp, pdb: remove item link ref in flip code.
"Item links" concept is no more in the GUI so we are progressively
removing reference and implementation of this in the core code.
2021-12-23 13:45:20 +01:00
Jehan 7f90d73d58 app: do not update the tree view editable renderer when editing.
When double-clicking the non-selected layer, the function
gimp_view_renderer_set_border_color() was being called, which in turn
called gimp_view_renderer_update() after some idle time.

Unfortunately when this happened, the "update" handler
gimp_container_tree_store_renderer_update() would call
gtk_tree_model_row_changed() which triggers a focus out through GTK.

One way to handle this would be to call gimp_view_renderer_update()
directly when changing border color (no idle time), though it's actually
more efficient to just cancel the idle function when we start editing
the item name. It's just not necessary.
2021-12-23 13:45:20 +01:00
Jehan ca28934dfc app: fix "%d items selected" label when multi-selecting.
This got broken in commit 28f6b1b268 because you want to always throw
the signal. Yet the context must only be updated with a grid view in the
GimpContainerEditor. Now it should work correctly (hopefully!).
2021-12-23 13:44:59 +01:00
Jehan 60bf8cd87e app: fix selecting an object in an icon view.
We must make sure to care about slight discrepancies between context
object and actually selected icon representing an object, which might be
slightly different at selection change time (just before everything
syncs up).
2021-12-23 13:43:51 +01:00
Jehan 0db6dd9f25 app: make sure the GimpContainerPopup shows the right item as selected…
… for the case of data managed by the GimpContext.

Checking stable and dev builds, it looks this just never worked and used
to just show no selection. Now it is more annoying as it shows a
selected item, but not the right one. Just make sure it shows whatever
is currently selected.
2021-12-23 13:43:51 +01:00
Jehan 28f6b1b268 app: fix gimp_container_view_multi_selected().
The whole hack for types managed by context is not needed anymore. It
works fine with generic code. Also because of this hack, there was a bug
when clicking on some button raising a container popup (such as the
"Dynamics" button in tool options) would reset the context to default
value (e.g. reset to "Basic Dynamics") on the first click, without
raising the popup. Only the second click would raise a popup.
2021-12-23 13:43:51 +01:00
Jehan 9a1a7a766c app: implement GimpContainerViewInterface's get_selected() for…
… GimpContainerComboBox and add a warning when the implementation is
missing.

Basically the default get_selected() implementation only works for
context properties, not for more generic usage of GimpContainerView. The
new warning will be a lot more informative and will help any future
cases where we might experience this bug.
2021-12-23 13:43:51 +01:00
Jehan 0a43a7063c app: add an implementation for get_selected() of GimpContainerEntry.
This fixes the container entry never showing (e.g. brush/dynamics) names
because after commit ca3c480314, the class could not properly detect if
the selection changed (as default implementation for this virtual
function does not suit this subclass).
2021-12-23 13:43:29 +01:00
Jehan ac1721917c app: reording private functions' declarations and definitions.
Keep them all together and in the same order, instead of mixing public
and private functions.
2021-12-23 13:39:43 +01:00
Jehan ca3c480314 app: check selected items changed before running "select-items".
This prevents repeatitively running the same signals when it is useless.

In particular, I encountered a case of infinite loops between
"floating-selection-changed" and "select-items" ending up infinitely
calling each other (then crashing GIMP).
2021-12-23 13:39:43 +01:00
Jehan 6a8910749a app: special-case icon theme loading when testing build.
It's a bit ugly, but it's not like this is run many times (only once
when loading the icon theme, or changing it).

Fixes this error appearing in various unit tests' output:

> gimp_icons_sanity_check: Icon theme path has no 'hicolor' subdirectory: /builds/GNOME/gimp/_install/share/gimp/2.99/icons

(even though it was not a test-failure error, it's still better to limit
output for debugging)
2021-12-23 13:39:43 +01:00
Jehan 72f8e63441 app: find templaterc and controllerrc when testing the build.
This should fix these errors when running `ninja test` or `make check`:

> GIMP-Error: Failed to open file ?/builds/GNOME/gimp/_install/etc/gimp/2.99/templaterc?: open() failed: No such file or directory
> GIMP-Error: Failed to open file ?/builds/GNOME/gimp/_install/etc/gimp/2.99/controllerrc?: open() failed: No such file or directory
2021-12-23 13:39:43 +01:00
Jehan efaf9e099e app, libgimp, libgimpwidgets: fix "Application icon missing" in tests.
When running tests, the data are not meant to be necessarily installed.
Therefore icons won't be found when calling gimp_widgets_init().

Add some special-casing to find them relatively to the install
directory.
2021-12-23 13:39:43 +01:00
Jehan b4892931c8 app: fix critical when filtering items in Palette dockable.
An item with no path is actually not always a bug. It can very well be
normal if the tree view has a filtering logics where some items which
were selected suddenly get hidden.
2021-12-23 13:39:43 +01:00
Jehan a6dccf5c2f app: fix icons for the "*-lock-*" actions.
Now that we have dedicated icons made by Aryeom!
2021-12-23 13:39:43 +01:00
Jehan d9846ac9dd app: get rid of all "*-linked" actions.
I.e.: "layers-linked", "channels-linked", "vectors-linked" and
"drawable-linked".
2021-12-23 13:39:43 +01:00
Jehan 9d23216566 app: remove the "Linked" switch from the item options dialog. 2021-12-23 13:39:42 +01:00
Jehan 5ac6d57b7b app: add a preferences for choosing your prefered search pattern format.
The 3 available formats are: simple text search, regular expressions and
glob patterns (cf. previous commit). I did a small step back from
previous commit by getting "is-pattern" property back in GimpItemList
instead of having this case as a value of GimpSelectMethod. The reason
is that it would render a useless value in the Preferences combo box.

Text search is the default.
2021-12-23 13:39:42 +01:00
Jehan 01b47863c2 app: GimpItemList supports glob, regular expression and simple text…
… search syntaxes.

The layer tree view is only using regexp so far, but the core code is
updated to allow more.

Simple text search is actually a bit more than "simple". It implies
tokenization of the text, Unicode normalization and case-folding. It
will also search with ASCII alternatives when possible. This includes
things like non-accented ASCII characters matching accented variants
which is neat.

Now it's not perfect. For instance tokenization seems very limited to
writing systems with spaces or alike. In particular, I tested with
Japanese and since you would typically write without spaces, a whole
group of several words would be one token. Since the text search
algorithm only search from token start, this is quite a failure as you
can't search with intermediate words only.
2021-12-23 12:55:11 +01:00
Jehan 767674fc5b app: fix weird pointer behavior when clicking out of lock popover.
It was like small drag'n drop were occuring, sometimes actually ending
up in moving layers or the like.
2021-12-23 12:55:11 +01:00
Jehan d774a8ff9d app: add multi-vectors drag'n drop ability. 2021-12-23 12:55:11 +01:00
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
Lukas Oberhuber 6821636a7b gimp_macos_setenv: set GI_TYPELIB_PATH macos
This sets the GI_TYPELIB_PATH so that macOS
gobject-introspection can find the typelib files.
2021-12-03 10:14:35 +00:00
Lukas Oberhuber b0547a72c6 macos env: Fix #7567, crash on new and open dialog
Fixes https://gitlab.gnome.org/GNOME/gimp/-/issues/7567
2021-12-01 23:12:44 +00:00
Lukas Oberhuber ee30d50d60 packaging: Update paths for MacOS
Updates the various path variables used to run the applicaition on Mac.
This includes update to python.
2021-11-30 17:09:00 +00:00
Jehan bb4ab851df app: replace using the "draw" signal by "expose-event" on GTK+2.
Not sure why but adding a handler to the "expose-event" signal of
GimpDisplayShell (similarly to how we do it in master branch on "draw")
just didn't work. But it works on the already existing signal handling
on the canvas instead (which actually is not a bad deal, as we also
remove the coordinates translation so maybe we should test this on
`master` too).

Note: why we are backporting all this logics to gimp-2-10 is because
changes in macOS BigSur broke the selection's marching ants the same way
they broke on Wayland and it was confirmed this fix worked for BigSur as
well, at least on the dev builds.
It is unnecessary to backport for Wayland (because GIMP 2.10 is based on
GTK2 which anyway works only through XWayland, hence doesn't have the
issue), we do it only for macOS BigSur (and further). Well at least the
fix will hopefully work on the stable branch, because I cannot test
myself.

See issue #5952.

(cherry picked from commit 6be014fc59)

Cherry-pick note: it was initially only for gimp-2-10 but actually also
works fine on the GTK3 branch and fixes some selection coordinates issue
when rotating the canvas.
2021-11-17 21:33:43 +01:00
Jacob Boerema d2c5591088 app: fix #383 Large PBM files exported from GIMP are blank
Fix as suggested by Massimo with formatting adjustments by me.
The use of gulong and glong is not cross platform safe: on Windows it is
32-bit and on most other platforms 64-bit.

Let's use guint64 and gint64 instead.
2021-11-14 18:06:56 -05:00
Emily Gonyer 3afa37cbc6 app, libgimp*, plug-ins: Changed gendered terms to be gender-neutral
Changed a handful of gendered terms to be gender-neutral, and one typo 
of 'he' to 'the' where appropriate.
2021-11-14 11:22:24 +00:00
Jacob Boerema 8d9db45dd5 app: fix resource leak warnings caught by static analysis.
In the unlikely case that we have an error we sometimes forget to free
either a dirname or appstring.
Let's fix these to reduce number of warnings.
2021-11-08 22:37:13 -05:00
Jacob Boerema e2b1cc9476 app: fix #6436 *.gih grayscale export crashes GIMP
When we try to export a grayscale image with layers with negative offsets
to a GIH brush GIMP crashes without producing any crashlog.
Running in GDB showed us that there is heap corruption caused by incorrect
computation of buffer sizes because of the negative offsets.

In file_gih_image_to_pipe there is a comment that offsets are assumed
positive, but no checking is done whether that is correct.
Let's add some checks, set offset to 0 if negative and adjust width and
height accordingly.
2021-11-08 17:10:32 -05:00
Jehan 40ca022c81 app, docs: fix GIMP's version in --dump-gimprc-manpage and update…
… gimprc's manpage as a consequence.

When running `gimp-console-2.99 --dump-gimprc-manpage` to output a man,
a line was:

> .TH GIMPRC 5 "Version @GIMP_VERSION@" "GIMP Manual Pages"

This is clearly the autotools substitution syntax, which is not being
used here (this is not a .in file processed by the build system), maybe
from some older build logics.
2021-10-21 22:10:31 +02:00
Jehan 6905b0bbef Issue #5313: consistent "file-pat-save-internal" procedure with…
… multiple drawables as parameter.

Previous commit 7bb892f3 was "making it work" by making the API
inconsistent and also only using the first drawable, which is making the
logics meaningless.

Instead accept multiple drawables, and export only the selected drawable
(when alone) or the merged-down image containing only the selected
drawables (when many).

Note that in current implementation, this is not useful from GUI calls
because the fully merged image is always exported when run interactively
or with last vals (i.e. from the GUI) because gimp_export_image()
flattens the image. So this change would only work when called
non-interactively from other plug-ins. In such a case, multi-layer
images do no longer return an error and whatever items are selected
would change the export result.

See also #7370 for a discussion about how to handle the selected items
during export (because currently the `drawables` parameter of
GimpSaveProcedure's run function is clearly a mostly bogus parameter).
2021-10-15 00:32:10 +02:00
Jehan 7e3cab1475 app: replace a g_free_error() by g_clear_error().
As a review fix of MR !470 since the contributor Andrzej Hunt is
unfortunately not responding.
2021-10-12 20:13:20 +02:00
Andrzej Hunt 59eae13aec xcf-load: g_free name in error cases to avoid leak
In all 3 cases:
 - xcf_read_string allocates a new string into name.
 - If an error is detected, we return early - name remains unused.
Therefore we add g_free (name) to these early returns to avoid a leak.
2021-10-12 20:13:20 +02:00
Andrzej Hunt 76b11a5f69 gimptagcache: free error to avoid leak
If gimp_xml_parser_parse_gfile returns FALSE, we know that error might
be set. Therefore we add a g_error_free to avoid leaking the error.
2021-10-12 20:13:20 +02:00
Jacob Boerema 352ef68c46 app, libgimp: Add metadata preference for saving thumbnail by default
Saving a thumbnail is closely related to the other metadata preferences,
but so far this was the only one that didn't have a preference for a
default user value.
This commit adds a preference in the metadata section where a user can
select whether thumbnail saving is enabled by default or not.
2021-10-12 13:20:47 -04:00
Jacob Boerema 970665f2b2 app: fix no console output on Windows for --dump-gimprc
On Windows the --dump-gimprc, --dump-gimprc-system and --dump-gimprc-manpage
command line parameters do not produce any console output.
Apparently we need to request the handle for stdout instead of directly
using1 for stdout.

After this commit there still is a problem when redirecting output to a
file. It seems that the buffer where stdout is stored is not flushed or
the file pointer is reset to 0 every time causing overwrites instead of
appending to the file.
2021-10-12 11:50:11 -04:00
Jacob Boerema 206bc06eab app: fix Gimp-Config warning Can't tell anything about a gint64.
When running gimp-console-2.99.exe --dump-gimprc-system we get two
warnings:
(gimp-console-2.99.exe:23000): Gimp-Config-WARNING **: 16:08:29.604:
 FIXME: Can't tell anything about a gint64.

Let's fix this by adding G_TYPE_INT64 as a known integer value.
2021-10-12 11:11:17 -04:00
Jehan 52928e04a5 Issue #7327: Cannot build GIMP3 on MSYS2 using Meson.
This is untested on my side, because the bug only happens on native
builds with meson (our CI has cross-builds with meson and native builds
with autotools and I only do cross-builds locally) but I think/hope it
will work.

Basically we were using .full_path() because these rc files were also
used as input of some configure_file() calls which doesn't like custom
target objects as input (it wants strings or file objects). Yet a bug
in meson didn't like the colon used in native Windows full paths ('C:'
and such) when used in windows.compile_resources(). This has been fixed
by Luca Bacci in: https://github.com/mesonbuild/meson/pull/9368
Yet we just cannot depend on very early meson (or worse dev meson code).

On the other hand, if the input is a custom_tgt object, it uses the
object ID which we give as first parameter of custom_target() so we know
it's appropriately named without colons (such as 'gimp_plugins_rc').
Thus we should not bump into this issue again.

For the few usage in configure_file(), I just add a .full_path() only
when needed at call time.

Last but not least, I replace the bogus `meson --version` call by a
`python3 -c 'exit()'` as advised by Eli Schwartz:
2afa019c70 (note_1284951)

The reason is that it is apparently possible (or will be when some
reimplementation of meson will be done) that the `meson` executable
itself does not exist. On the other hand, `python3` should always be
there, as a mandatory dependency of the build tool.

In order to use an appropriate `python3`, I made the
pythonmod.find_installation() check required in our build (which should
not be a problem since it's a meson requirement as well), even when the
-Dpython option is false (this one depends on other requirements too
anyway, such as version and pygobject). This way I can call this meson
variable of discovered python in my bogus call, instead of calling a
(potentially different) python from PATH environment.
2021-10-12 17:06:18 +02:00
Lukas Oberhuber 5ff5d38985 Macro name change to GDK_OSX_BIGSUR 2021-10-04 20:40:30 +00:00
Lukas Oberhuber 0ac0e4bdc9 gdkquartz-cocoa-access.h is not correct yet 2021-10-04 20:06:35 +00:00
Lukas Oberhuber e14f9fc500 app: allow compiling on Mac OS where gimpimagewindow.c needs…
… an API that went private in GTK 3.

Note from reviewer (Jehan): this API became public again in commit
gtk@242b76a7, available since GTK 3.24.29. Before this, the function 
(gdk_quartz_window_get_nswindow()) was actually still in the ABI, so we
could declare the function locally before using it. This is an ugly
workaround, but it works.
What we do is providing both solutions depending on GTK version, leaving
build warnings as constant reminders so that we remember to get rid of
the workaround when we bump minimum GTK requirement.

Cf. discussions in gtk#2452 and gimp!483.
2021-10-03 11:20:15 +00:00
Jehan fd9f96f174 app: get rid of a wrong return-after-free report.
Reported by Massimo, though this one is wrong, as far as I can see.

`ninja scan-build` apparently reports `result` as being returned after
being freed here. But actually since we are setting the `error` with
g_set_error() in the same time we free `result`, we would also enter the
`if (*error)` block a few lines later, which would return NULL and not
`result` anyway. I guess the static analyzer could not see that far.

Still, set the pointer to NULL with g_clear_pointer(), which should be
enough to make the static analyzer happy.
2021-10-01 12:51:48 +02:00
Jordi Mas 6aaa017d34 Remove unnecessary space at the end of the string 2021-09-28 10:42:58 +00:00
Jehan d4733e5b21 app: fix drag'n drop of fg/bg colors under Wayland.
Commit 086ae77929 had broken dnd of colors from toolbox's color area on
Wayland. Clearly Wayland did not like we changed focus on a click,
breaking the drag.

To fix this, do not propagate button press and release events from the
GimpFgBgEditor editor anymore. Yet, since changing colors is usually to
be used (often immediately) on the canvas, giving back the focus to
canvas still makes sense. Therefore, instead of using press/release
events, add semantic signals to GimpFgBgEditor: color-dropped,
colors-swapped and colors-default (additionally to already existing
color-clicked). Then connect to these new signals to grab focus for
canvas when relevant.

Thanks to Massimo for raising the broken color dnd feature.
2021-09-26 19:06:26 +02:00
Jehan 78d9f9799f app: fix dragging color boxes into item dockables.
Commit 83b3d9e5 broke dragging color widgets into channels dockables or
other item dockables.
Thanks to Massimo for raising that these lines were needed for this.
2021-09-26 17:06:57 +02:00
Jehan 6374481f4f Issue #6909: Crash after cancelling out of avif export dialog.
Do not leave dangling signal handler.
2021-09-26 16:30:29 +02:00
Jehan 1abb4543cd app, pdb: move "src-drawables" from core to option object for…
… "gimp-clone" and "gimp-heal" PDB calls.

Untested but this should work. Anyway we will take a close look at the
whole API before releasing.
2021-09-14 17:59:47 +02:00
Jehan 6ad00cdbba app: improve source tool options GUI.
The "Source" dropdown to choose an image or pattern, and to check
"Sample merged" seem important enough that I moved them up the source
tool options. I also added a label giving information about the image
source being currently set, i.e. in particular which image (when the
source is another image), how many composited layers (or all of them
with "Sample merged" checked), or if each layer is its own source.

For this to happen, I moved src-drawables property from GimpSourceCore
to GimpSourceOptions (though without making it a config property,
because we don't want this option to be saved in config files). It
actually makes sense, it is a kind of "option" of how the tool will
behave, and then it is also visible by the options GUI.
2021-09-14 17:59:47 +02:00
Jehan 370db868a3 app: "Registered" alignment makes no sense with self-to-self painting.
The "Registered" alignment is used to paint from one layer to another
(in same or different image) at exactly the same image coordinates. It
doesn't make much sense with the self-to-self painting when having
multiple drawables selected.

Note that it still works with the other new feature using multiple
layers as a composited source (limited "Sample merged"-like painting,
but only from specific layers).
2021-09-14 17:59:47 +02:00
Jehan b86c927210 app: fixing painting with a selection. 2021-09-14 17:59:47 +02:00
Jehan d5670644b4 app: make painting with applicator working in multi-drawable mode. 2021-09-14 17:59:47 +02:00
Jehan 03edaf5cea app: fix more broken offset in other tools.
Similar to the source core fix, but a bit simpler because we don't have
to deal with a source and a target offset, let's fix offset handling in:
- Blur / Sharpen tool.
- Dodge / Burn tool.
- Ink tool.
- MyPaint brush tool.
- Smudge tool.
2021-09-14 17:59:47 +02:00
Jehan 977807985b app: fix broken source painting offset.
As expected from early changes of code, painting was widely broken with
offsetted layers, because previous code used to process the drawable
offset earlier in the painting process, on paint tool level, whereas now
the tool gives coordinates in image space to the paint core (because it
gives a list of drawables which may have different offsets, hence image
space is the only valid coordinates space). This means the various paint
core algorithms must handle each drawable's offset at actual painting
time.
2021-09-14 17:59:47 +02:00
Jehan 231ab4413b app: make Perspective Clone tool also work with multiple drawables. 2021-09-14 17:59:47 +02:00
Jehan 3a9462b219 app, pdb: properly save the list of source drawables.
By doing this, I also add the ability to use a composited projection of
the selected drawables as source. This is similar to "Sample merged"
except that instead of using the whole visible image, we use what would
have been visible if only the selected layers existed.

Note that this doesn't work together with the previously added ability
of multi-cloning from each layer to itself. This ability works for
cloning from multiple layers to one.
2021-09-14 17:59:47 +02:00
Jehan b4d189f8ef app: add ability to clone/heal from/on multiple layers.
When multiple layers are selected, the "sample merged" button won't
work. In such a context, each selected layer will pick from itself into
itself.
2021-09-14 17:59:47 +02:00
Jehan 8934d43975 app: make painting possibly multi-drawable aware.
- Make the various virtual methods of GimpPaintCore use a list of
  drawables as argument instead of a single drawable.
- gimp_brush_core_eval_transform_dynamics() can work with an image as
  argument rather than a drawable as it doesn't actually depends on
  specific drawable data.
- New function gimp_paint_tool_enable_multi_paint() to be used in init()
  method of paint tools to announce that this tool can work with
  multiple layers selected.
- Use gimp_paint_tool_enable_multi_paint() in the GimpSourceTool base
  class only for now.

This is a first step for multi-layer drawing, but we don't want it to be
possible in just any random cases, which is why I add a special function
to advertize this capability. We will use it for special-casing the
clone (as well as heal and perspective tools most likely) tool to work
on several layers at once. At this step, it is still very bugged and not
really working properly. In particular, since we don't process the
drawable offset early anymore (because it makes no sense when we pass a
list of drawables with different offsets), I suspect that all the
offset-related code will be very broken.
2021-09-14 17:59:47 +02:00
Øyvind Kolås 127bf7abfb configure,meson,app: depend on GEGL-0.4.32 2021-09-05 20:34:59 +02:00
Stanislav Grinkov 8516221662
app: Correctly place merged down layer...
when the image is in indexed color mode, and bottom layer doesn't
have an alpha channel.

Resolves: #4945
2021-09-02 13:04:13 +06:00
Jehan 49e534247a app, libgimp*, pdb, plug-ins: use g_memdup2() instead of g_memdup()
Since it appeared with GLib 2.68.0, we could not change this until we
bumped the dependency which has only become possible a few days ago
(since Debian testing is our baseline for dependency bumps). Cf.
previous commit.

As this is a drop-in replacement (just a guint parameter changed to
gsize to avoid integer overflow), search-and-replace with:

> sed -i 's/g_memdup\>/g_memdup2/g' `grep -rIl 'g_memdup\>' *`

… followed by a few manual alignment tweaks when necessary.

This gets rid of the many deprecation warnings which we had lately when
building with a recent GLib version.
2021-08-26 17:32:09 +02:00
Luca Bacci 1685746579
Only select available API's 2021-08-25 20:35:08 +02:00
Luca Bacci 825ea9dc1c
Move initialization order 2021-08-25 20:35:02 +02:00
Luca Bacci 012df8514a
Add a config enum for the pointer input API to use on Windows 2021-08-25 18:24:54 +02:00
Luca Bacci f6fc9d4245
Rename GimpLangRc to GimpEarlyRc 2021-08-25 18:23:17 +02:00
Jehan f888a6f2f0 app: update menurc migration.
- Migrate "view-rotate-reset" to "view-reset" (there is a
  "view-rotate-reset" in GIMP 3, but it will be only for rotate; what
  was really doing the same-named action in 2.10 is now what
  "view-reset" does).
- Make sure we don't migrate "file-export" from a 2.10 config. From a
  2.8 or below, we don't to migrate it (same as for 2.8 to 2.10), but in
  a 2.10 config, it is already the same action as the one in GIMP 3.
2021-08-23 19:10:27 +02:00
Jehan 15fb4a7be0 Issue #1168 - Allow resetting rotation view and flip view separately.
Action "view-rotate-reset" renamed to "view-reset" (resets both flipping
and rotate). New "view-rotate-reset" and "view-flip-rotate" for
resetting rotation and flipping respectively.
2021-08-23 15:46:11 +02:00
Jehan 753e994e1d app: forgot to also properly migrate the docks size.
Same as last commit, avoiding to end up with twice too big docks.
2021-08-23 13:57:38 +02:00
Jehan c43de62e99 app: config folder migration update for GIMP 3.
Fix the search for previous folders, which was broken as it was
specifically expecting 1-digit numbers so far.

The differences of the GIMP 3 config import are:

- update sizes and positions in the sessionrc according to the scale
  factor, because GTK2 doesn't have scale support. It means that, e.g.
  with a 2× display, all sizes and positions in GIMP 2.x must be divided
  by 2 (otherwise the first thing many people will get when testing GIMP
  3 for the first time is an off-screen window).
  Of course, I even wondered if it would not be nice to just drop the
  sessionrc altogether and start with a nice blank slate, but then you
  also lose the opened dock and their organization and some settings
  (such as whether you chose single or multi window mode, etc.).
- scripts/ and plug-ins/ are not imported. Probably makes no sense so
  far as they would end up broken (but maybe it's not true for all
  script-fu scripts?).
2021-08-23 13:37:11 +02:00
Jehan ef87f34ba4 Issue #6843: "Canvas Size" dialog takes too much vertical space.
Since the recent changes to add template ability, there are just too
many widgets stacked up vertically. Let's use a little better the
horizontal space.

To do this, I moved the preview on the right side of the "Canvas Size"
and "Offset" number fields, and the "Center" button just below it.
2021-08-22 18:21:37 +02:00
Jehan 38a0b7611c app: free mypaint_brush_path, mypaint_brush_path_writable and…
… default_mypaint_brush in gimp_core_config_finalize().

As reported by Massimo.
2021-08-22 12:10:11 +02:00
Jehan 3fa68be264 app: date string in the About dialog was not always freed.
Let's move the g_date_time_format() to the inner block when it's
actually used, hence also make sure we allocate and free at the same
code level, which is a better practice to limit leaks.

Reported by Massimo.
2021-08-22 12:01:38 +02:00
Jehan 0fe7e147b5 app: unref the GtkSizeGroup-s.
As explained in GTK docs, size groups are referenced by every internal
widget hence can be immediately unref-ed after we added widgets in it.
In the end, when the widgets are destroyed (thus removed from the
group), the group will end up freed too.

Reported by Massimo.
2021-08-22 11:55:12 +02:00
Jehan 62827563c4 app: unref the newly created GVariant-s.
I first sink these, because they are floating references. This is
actually quite unneeded here, because callbacks given to
gimp_action_group_add_procedure_actions() (this is what
filters_history_cmd_callback() is for) are not taking ownership of the
GVariant anyway. Yet just in case this ever changes, this is the proper
way to do it to avoid a double-free in the future. We take ownership in
the calling code, hence we free the variable there after using it.
2021-08-22 11:32:59 +02:00
Jehan 456327eff0 app: unfreed GList.
Thanks to Massimo for reporting.
2021-08-22 10:56:13 +02:00
Jehan 9a0876b9bd app: forgotten GList freeing.
Thanks to Massimo for the report.
2021-08-21 19:06:14 +02:00
Jehan 1ece3675c9 app: another leaked GtkTreePath.
Thanks to Massimo, again and again. ;-)
2021-08-20 22:00:03 +02:00
Jehan 025cebf76f app: free an unusing allocated string when not used as a result.
Another leak reported by Massimo.
2021-08-20 21:53:41 +02:00