Commit Graph

5322 Commits

Author SHA1 Message Date
Alx Sa cc3f7afb04 tools: auto-activate transform tools on canvas
This removes the need to click the canvas after selecting a transform
tool before you can start working on the transform.
2022-11-13 17:52:25 +00:00
Jehan 9a2f5b0709 app: rework and fix the logic for copy-pasting multiple drawables.
There were a lot of incertainty of what should happen when we copy layers being
descendant of each other (i.e. when you select a group layer and some of its
children), then when you paste such data. So we sat down with Aryeom and tried
to come up with some consistent behavior which is somewhat expectable, but also
which would allow the most use-case.

Otherwise it was making very weird result when pasting the data, duplicating
some layers and whatnot, which was obviously a buggy behavior and never the
expected result.

We decided that if you select one leaf item, then even if you also selected a
parent item, it would be as though the parent was not selected. This is very
often what you expect anyway when you select a whole bunch of layers and would
work well if, say, you shift-click over many layers in sub-groups. Then you
wouldn't have to manually ctrl-click to unselect every group.

Then what if you were instead expecting to copy many groups? Then you could
shift-click the group arrow, closing all same-level groups. Once they are all
closed, you can shift-click the groups to only select group layers, not their
contents.

This way, both use cases are still quite doable easily with this default choice.
2022-11-12 18:28:58 +01:00
Jehan 6083fd81a1 app, desktop: prepare AppData <release/> item for upcoming GIMP 2.99.14. 2022-11-09 15:31:39 +01:00
Jehan 51fe025afb app: update sensitivity rules of distribute buttons.
Distribute features do not care about the reference object anymore. All we care
about is whether we have more than 2 objects.
2022-11-09 13:20:31 +01:00
Jehan c3e1197ec9 app: fix a CRITICAL.
We should look at the display stored on the GimpDrawTool.
2022-11-09 13:04:51 +01:00
Jehan bd87766170 app: various Alignement tool strings update.
- Option dockable is named "Align and Distribute" rather than "Alignment".
  First, because it's not just about alignment; also because this way, it looks
  like other software, such as Inkscape; lastly because it's more consistent
  with other tool options ("Move", "Rotate", etc.).
- Add a tooltip to the Anchor Point widget to explain what it's used for.
- Rewrite various align/distribute button tooltips to make clearer that we are
  aligning anchor points with specific edges (or distributing these anchor
  points).
- Rename the first section to simpler "Targets".
- Some more rewording of other texts.
2022-11-09 00:40:44 +01:00
Jehan 6a63091e68 app: remove the offset feature in the Align/Distribute tool.
It's clearly broken right now. I can see it might have been used even to
progressively shift aligned items, but this was not used anymore. As for being
used while distributing, it doesn't make any sense anymore with the new logic of
not moving the extreme (first/last in coordinates) items.

I can see how an additional concept of offset can be useful in some situations,
but for now, let's get rid of this. We'll see in the future if someone asks for
it and provides valid use cases to work from.
2022-11-09 00:08:16 +01:00
Jehan e48b002c84 app, icons, libgimpwidgets: add "distribute with evenly gaps" options.
There was one case in Inkscape which we could not do: distributing objects
keeping even gaps between them. Until now, we could only distribute keeping even
distance between anchor points (top, left, bottom, right or center).

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

The icons are hopefully temporary, until we can make better ones.
2022-11-08 23:48:32 +01:00
Jehan 09543af82a app: distribute while keeping extreme objects unmoved.
After discussing with Aryeom, we decided that "Distribute" should work within
the current horizontal or vertical bounds, as this is how it is usually done in
other software (e.g. Inkscape). For instance, if there are 4 items, the first
and last (coordinate-wise) stay untouched, and only the 2 intermediate items get
distributed evenly.

Since the Reference is not relevant anymore for "Distribute", I undo part of my
previous commit, where I was organizing the reference setting into its own
section of the Alignment tool options. This setting is back as part of the
"Align" section.
2022-11-08 21:39:58 +01:00
Jehan 2b0928d895 app: big UI rework of the align/distribute tool.
- Adding a separate pivot widget to allow choosing which point of the items we
  align or distribute. E.g. until now, we could only align the right side of
  objects to the right side of the reference object, left to left and center to
  center. Now these are independent. Therefore I can align the left side of
  objects to the right border of a selection or a layer, and so on.
- Only keep 2 "distribute" buttons (for now). Most of the distribution actions
  were basically broken or extremely hard to understand. Also they were
  apparently mixing concepts of alignments with distributions. Now let's
  basically only keep the bases: horizontal or vertical distributions.
  Everything is still possible using a mix of alignment and distribution
  buttons, and it's much clearer.
- Since the GimpAlignmentType was used nearly only there (except for some usage
  like to store dock side or filter preview split direction, but these
  GIMP_ARRANGE_* values were unused there), I removed the various enum values
  which we don't use anymore.
- The Reference settings gets its own subsection in the Align tool options.
  Until now, it looked like it only applied to alignment, whereas it applies to
  distribution too.

Note: this is still work-in-progress, mostly some initial dev work to put some
algorithmic bases. We had some UI and specification discussions with Aryeom
already and some things might still change a lot.
2022-11-08 19:19:55 +01:00
Jehan 63dc7dee8a app: redraw handles when needed.
There were various cases when the reference's on-canvas handles were not
redrawn, or drawn at all:

- When the reference is an image, we now draw them. It may seem redundant as
  it's the image bounds, but it's still useful to see what are the reference
  bounds in a glimpse. Moreover in "Show All" mode, it's even more useful.
- Start the tool, hence draw the reference handles, in oper_update() if not
  started yet.
- When the "align-reference" property changes.
- When the display (active image) changes.
2022-11-08 13:05:56 +01:00
Jehan 4c09f194d1 app: more fine-grained align/distribute button sensitivity.
When the reference is a guide in particular, no distribution is possible (on one
dimension, the size is 0, on the other, it's infinite) and alignment is only
possible in one direction (depending on guide orientation).
2022-11-07 22:48:30 +01:00
Jehan 6dc48f571c app: fix logic in gimp_edit_selection_tool_translate().
We should not check if all items are locked, but if one item is locked. It is
enough to forbid the translation from happening.
Otherwise it is currently possible to bypass position lock by using keyboard
arrows for layers or channels.
2022-10-19 15:47:11 +02:00
Jehan 789f52c412 app: make moving vectors with keyboard arrows multi-selection aware.
And this is one less usage of gimp_image_get_active_vectors()!
2022-10-19 15:41:23 +02:00
Jehan c8547d0a50 app: new option "Use extents of layer contents" to Align tool.
Instead of using the layer borders, we use the bounding box for the contents.
This is similar to first run "Crop to Content" on every selected layer except
we don't actually need to crop. Therefore we can work on bigger layer than the
actual content while still arranging them based on content bounds.

So often the result of alignment/distribution feels wrong because it doesn't
correspond to the content we are seeing. With this option, we'll have the option
to choose the desired behavior.
2022-10-18 00:48:51 +02:00
Jehan 9be6a6b711 app: highlight guides which will be aligned or distributed. 2022-10-17 23:08:33 +02:00
Jehan 4eaf6c16b9 app: rework the Align tool interaction taking multi-item selection into account.
The old interaction was quite horrible. I don't think I ever really got a good
use of it. It was so hard to understand what you were picking and so on.

Now that we can multi-select items, let's just use this as the base of what we
want to align or distribute. Clicking on canvas will now mostly be used to pick
an item as reference. From now on, only the reference object will get on-canvas
handle, making it very obvious how your alignment or distribution will work.

I leave only an alternative picking method (with Alt or Shift-Alt pick) to add
guides to objects to align or distributes, as these don't have a selection
dockable.

I'm also improving the selection of stacked layers by looping through them
(similar as the layer selection on canvas feature) so that we can select even
background layers which have a lot of layers showing above.

I am planning to improve this tool even further, but this is a first step to
make it actually usable within the new multi-item interaction logic.
2022-10-17 19:03:50 +02:00
Alx Sa ca6b58e970 text: Add outline options to text editor
This ports Massimo’s code to work in the latest version of GIMP.
It adds new outline-related properties to GimpText and GimpTextOptions.
These are controlled via the Text Tool Editor.
Cairo is currently used to draw the outline around the text.
2022-10-12 22:00:40 +00:00
Jehan acf428b24c app: get rid of one more gimp_image_get_active_vectors(). 2022-10-12 18:02:43 +02:00
Jehan 925d4c317f app: cleaning unused variables.
Removing build warnings!
2022-10-12 17:53:04 +02:00
Jehan 131cdf0f1c app: fix preview for multi-layer transform.
Though it was working in the "Composited preview" case, it was only showing one
of the multiple layers being transformed in the basic case.
2022-10-12 17:52:04 +02:00
Jehan 274c079c4c app: also show rotation preview for multiple-selected paths. 2022-10-12 17:19:10 +02:00
Jehan b74e6c2198 Issue #8640: Rotate two selected paths creates error window. 2022-10-12 17:19:10 +02:00
Jehan ca230cb770 meson: fix warnings of deprecated features.
Now that we bumped our meson requirement, meson is complaining about
several features now deprecated even in the minimum required meson
version:

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

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

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

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

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

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

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

> WARNING: Project targets '>=0.56.0' but uses feature deprecated since '0.56.0': dependency.get_pkgconfig_variable. use dependency.get_variable(pkgconfig : ...) instead
2022-08-31 01:29:37 +02:00
Jehan c804865ddd app: new "tools-paint-select-pixel-size-set" action.
Also ensure that the outline circle is redrawn while changing the
outline size.
2022-08-17 14:20:18 +02:00
Jehan 67d5e59ffb app: new "tools-warp-effect-pixel-size-set" pixel size set action. 2022-08-17 14:20:18 +02:00
Jehan ebf99132eb app: create a new pixel-size-set action for Ink and Brush tools.
Once this is done, I got rid of the ugly hack I added over the already
ugly hack used on "*-set" enum actions.
2022-08-17 14:20:18 +02:00
Jehan c7979e7f06 app: new double action "tools-mypaint-brush-pixel-size-set", used as…
… new action_pixel_size of GimpMyBrushTool.

MyPaint brush tool clearly shows the limits of my trick to have some
enum actions work with absolute values whereas others work with
per-mille values between the property min and max.

Indeed firstly MyBrush's "radius" value is logarithmic and can be
negative. Since the enum trick relies on the fact that negative values
are the semantic enumerated constants, it's broken in such case. The
second issue is that while it was acceptable to use int size for most
paint tools (even though they were double), here radius only goes from
-2.0 to 6.0; so using int values only would leave us with jumping brush
sizes.

So now I create a proper double action which simply takes pixel size and
use this from the on-canvas brush size changing. No weird trick, no int
or sign limitations.
I also add a new optional action_pixel_size in GimpToolControl.

Note: I'm also updating a bit the logic for the MyPaint brush outline
function gimp_mybrush_tool_get_outline(). Indeed after skimming a bit
through mypaint-brush.c code in libmypaint, I am not sure at all we need
to use the offset_by_random like this. And really this shown outline
seems more indicative than anything else when I see the actual size
printed by the various brushes. Finally here it was counter-productive
as I needed to get easily the logarithmic radius from the pointer
interaction on canvas.
2022-08-17 14:20:18 +02:00
Jehan 8e9abd5e85 app: make sure the size circle is also displayed for the ink tool.
Note that the other paint tool which is not as common as others is the
MyPaint brush tool. At first I thought the circle outline didn't work.
It does actually work, but the radius concept is simply very weird in
this tool so we have to move a lot. To be investigated.
2022-08-17 14:20:18 +02:00
Jehan 5be997fbdf app: display the brush outline (or fallback or circle) when resizing.
Bypass temporarily the "Show brush outline" settings when resizing
on-canvas.
2022-08-17 14:20:18 +02:00
Jehan ccbf3c4bb0 app, libgimp*: add various stamp files to CLEANFILES.
Fixes:

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

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

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

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

See #4201.
See also: https://github.com/mesonbuild/meson/issues/10196#issuecomment-1080742592
2022-08-01 19:59:53 +02:00
Jehan 4a5acb2448 app: show the tool options in various other error cases.
Similar to the previous commit, use the new
gimp_tools_show_tool_options() before blinking various tool options
widgets since these are good hints for wrongly set options and it's nice
to be able to point at these.
2022-07-27 10:45:40 +02:00
Jehan 6c18c7e497 Issue #7795: fix CRITICAL when tool options dockable is absent.
Create a new utils function gimp_tools_show_tool_options() because
showing the tool options is likely a common action. And use this when we
want to blink the selection mode box, for this particular case.

Note that I could not reproduce the CRITICAL here (i.e. even if the
dockable was not showing, it seems the widget did already exist anyway).
Anyway it's a nice idea to raise the tool options as the goal is to
explicitly show how to fix the issue here. And it should fix the bug for
people encountering it.
2022-07-27 10:13:40 +02:00
Nikc 93399de7cd Converting CMYK sample points to babl process 2022-07-20 22:35:13 +00:00
Jehan c06083158a Issue #8102: crash when using the clone tool.
So it turns out that the "notify::src-drawables" property signal in
particular can happen during gimp_paint_tool_paint_interpolate() called
from gimp_paint_tool_paint_thread(). Though the function
gimp_clone_options_gui_update_src_label() was run in the main thread in
simple cases, being called this way through a paint thread happens when
very quickly changing the source while painting, which is what Aryeom
does (when I see her using the clone tool, she would sometimes change
the source very quickly several times in barely a few seconds).

Yet GTK and GDK calls must not happen in non-main threads. It used to be
acceptable when protected with gdk_threads_enter|leave() calls but doing
this is deprecated. The now sanctioned method is to call the GTK code in
an idle function since these are guaranteed to run in the main thread.

This was most likely explaining why crashes could quite randomly happen,
though I'm not sure why I never had those (even though I could reproduce
the GTK calls happening in non-main threads, but without crashing GIMP)
and why Aryeom gets these much more often suddenly. Maybe some recent
dependency change which would trigger these more easily or other
context-dependant changes (as most non thread-safe code, bugs and crash
often happen in race conditions, so are harder to reproduce reliably)?
2022-04-21 19:13:01 +02:00
Jehan fc063cb2ca app: use the unobtrusive cursor only in no-pointer+no-outline case.
We take a step back from the original MR which was proposing the "single
dot" cursor as a new "Pointer mode" option. I was really unsure this was
the best solution, especially reading again the whole original report.
It means that now nearly all of the original patch has been rewritten
another way, but let's leave the contributor commit as a start point to
get to where we are, and as acknowledgement of the contribution.

The reporter was annoyed by the crosshair when none were requested and
probably mostly for painting tools only (at least examples were about
brush or pencil, etc.) while showing outline. It looks to me like the
real issue was maybe when we were showing the big crosshair when using
the 4-arc fallback outline, for instance when using a dynamics changing
size. If so, this main issue is already fixed by my commit 64dc26064b.
No need of a new option for this, especially if the option can be as
confusing as a barely visible dot-cursor (I can already imagine the bug
reports of people tweaking random preferences and unhappy because the
pointer became invisible, while they don't know how they did it).

Instead I would say that when people specifically uncheck both "Show
brush outline" and "Show pointer" options, showing a huge crosshair
feels quite counter-productive. This is where I think that our small
unobtrusive cursor (probably a better name than "Single dot" by the way,
as it's not a single dot anymore) might be of use, the ultimate case
when someone really want a cursor as inconspicuous as possible, while
still having a visible feedback of the pointer position (even with
display-tablets, parallax issues make such a visual feedback important
to target where one paints).
So let's try this first and see how it goes.
2022-03-13 16:04:40 +01:00
Jehan 64dc26064b app: do not draw the big handle when we have a fallback for the outline.
If someone explicitly asked not to get a pointer, yet to have the
outline, we should not force a crosshair on them while the fallback
outline is a perfectly visible mark (4 arcs around the pointer's
position, well delimiting the brush size).
2022-03-12 18:55:35 +01:00
Jehan d4ae533080 app: pack all line art settings in a single box.
It's still the same visually but it will be useful for 2 reasons: first,
it makes nicer code to show/hide only this one box instead of 3 frames;
second it will be used for the release note demo feature so that we can
blink the full line art settings box.
2022-03-06 19:30:31 +01:00
Jehan 622d0da43e app, libgimpwidgets: allowing changing a dockable settings value while…
… blinking it.

This will be necessary to demo new features available only in some
situations. E.g. a new option in line art detection mode of bucket fill
would require said mode to be enabled.
2022-03-06 19:30:31 +01:00
Jehan 60a9c90074 app: create a concept of "blink scenario" to blink several widget in…
… a given order, not at the same time.

This will be used for the release item notifications to show people
where new or changed features are, but in an ordered blink scenario. For
instance: select a tool first, then blink some tool icon, open the tool
options and finally blink the specific new/changed option. I am hoping
it would help awareness of changes (just words on a web news may make
some features a bit foreign when not used to look in details in advanced
options).
2022-03-05 17:42:54 +01:00
Jehan 5dcc833398 app: move gimp_tools_blink_widget() as gimp_blink_dockable() in…
… gimpwidgets-utils.h.

It just makes more sense, even in terms of #include-s which we'd need to
make.
2022-03-05 17:42:54 +01:00
Jehan dac452f3a2 app: grab focus before blinking a dockable widget.
It should help with scrolling the dockable to make the widget visible,
as I don't see a generic and simple scrolling API for GTK scrollable
containers.
In my own testing, it did work if the dockable was already opened. But
if it was just created by the blink API, then giving focus immediately
doesn't properly scroll. I am not really going to investigate now, but
this should be fixed eventually.
2022-03-04 18:25:47 +01:00
Jehan e1c3e7d85b app: use new gimp_tools_blink_widget() to blink source scrolldown.
When the bucket fill can't work because the line art source is not
right, let's blink the associated settings for people to know where to
look at.
2022-03-04 15:41:53 +01:00
Jehan 71a2c83a94 app, libgimpwigets: new internal util function gimp_tools_blink_widget()
This function will help us raise attention to various widgets in
dockables by blinking them similarly to how we blink locks or visibility
icons.

I associate this with the fact that property widgets identifier will be
the property name, so we get identifiers for free when creating widgets
through the propwidgets API.
2022-03-04 15:41:02 +01:00
Jehan 4a6b2e9fbb app: change "Detect opacity" checkbox sensitivity and tooltip depending…
… on the line art source.
Also now the default tooltip itself will be more appropriate rather than
reusing the "fill-transparent" property blurb (maybe I should have made
this its own property in fact).
2022-03-04 14:30:46 +01:00
Jehan d3686fdb9c app: make the "Automatic closure" a settings of its own.
This is the same thing as setting the max gap length to 0, except that
it would mean constantly having to play with the gap length and possibly
losing settings you carefully tweaked. Instead with this additional
settings, we hide the gap length settings when automatic closure is
disabled.

Also it makes kind of a nice parallel with the "Manual closure" settings
which can also be enabled/disabled similarly.
2022-03-03 20:05:14 +01:00
Jehan 08c3bb407b app: source tools should not be choosable for bucket fill stroke.
Since we can't select a source, the source tools would fail stroking
with an error. It was usable when stroking a path or selection as we
can have the source tool started while running these. Since only one
tool can be started at once, this is not possible when running bucket
fill tool (it would require some logics change on tools).

This change has 2 parts: add an "insensitive" column to
GimpContainerComboBox (allowing to mark some cells as insensitive), then
use this new attribute in the GimpBucketFillOptions to show all source
tools as insensitive.
2022-03-03 18:44:03 +01:00