Commit graph

4995 commits

Author SHA1 Message Date
Ell
41790aef4b app: fix transform-grid center point for non-affine transforms; use as pivot
In GimpToolTransformGrid, use the transformed center-point of the
original polygon as the position of the center-point handle, and as
a snapping point for the pivot when "cornersnap" is TRUE, instead
of using the center-point of the transformed polygon.  These two
points are different for non-affine transformations.

Furthermore, when "use-pivot-handle" is FALSE, use the center-
point as the reference point when transforming around the pivot,
instead of the pivot itself, which might not be set.  In
particular, this fixes transformation around the pivot in the
perspective tool.

Don't explicitly set the center-point as the pivot in the scale
tool, since this commit makes it unnecessary.

(cherry picked from commit cdc5782b3c)
2019-02-28 15:46:48 -05:00
Ell
cbd712a2bd app: in operation tool, update scrolled-window size request when options-box size changes
In GimpOperationTool, update the options scrolled-window size
request whenever the size of the options box changes, instead of
only when constructing the GUI, since the options layout may change
dynamically through GUM, or through a custom GUI.
2019-02-17 04:20:11 -05:00
Ell
bd67478b49 app: add gimp_gegl_node_is_point_operation()
... which takes a GeglNode, and determines if the associated
operation is a point operation.

Use in GimpFilterTool, instead of performing the same check
manually.

(cherry picked from commit 918f2e75bd)
2019-02-15 12:40:11 -05:00
Ell
04052fe3a4 app: in GimpOperationTool, add scrollbar width to scrolled-window requisition
... so that the scrollbar doesn't cover the child in wide UIs.
2019-02-13 13:27:43 -05:00
Jehan
f5225f2211 app: error messages should happen on button press, not initialization.
The initialization is sometimes done when switching tools (for instance
when selecting the active tool by command), not always on button press.
So the error output behavior was inconsistent, and worse, the tool was
sometimes not forbidden to run when it should have been.
Just run all the checks (layer groups, locks and whatnot) on button
press.

(cherry picked from commit 74cfd4fd95)
2019-02-13 16:12:41 +01:00
Ell
4a7988b9fa Issue #2935 - GIMP 2.10 - options hidden in filter dialogs
gtk2 doesn't propagate the child requisition to the scrolled-window
requisition, so we have to do it manually.
2019-02-10 17:53:16 -05:00
Ell
8878ff5f04 app: in GimpRotateTool, improve fuzzy comparisons
(cherry picked from commit b002f20412)
2019-02-05 04:39:11 -05:00
Ell
da6086636b app: in GimpTransformGridTool, allow linking forward/backward transforms
Add a GimpTransformGridTool::matrix_to_info() virtual function,
which should extract the tool-specific transformation parameters
given a transformation matrix, and the old parameter set (which is
needed in some tools, to derive the parameters that aren't encoded
in the matrix, such as the pivot point).  The transformation matrix
can be any combination of matrices calculated by the tool, and
their inverses.  Subclasses should only implement this function if
every such matrix can be mapped back to transformation parameters.
This is currently the case for all the transform-grid tools, except
for the shear tool (since it only supports shearing along one of
the horizontal or the vertical directions, however, the combined
matrix may require shearing in both directions).

When a transform-grid tool implements this function, show a chain-
button between the two transform-direction radio-buttons in the
tool options.  When the chain-button is linked, whenever the
transform corresponding to the active direction is modified, adjust
the transform corresponding to the non-active direction such that
the overall transform remains the same.

One notable workflow that this enables is transforming a layer
while adjusting a different area than its boundary, by first
defining the area while the transform-directions are linked, and
then transforming the area while the transform-directions are
unlinked.

(cherry picked from commit 39e23267f7)
2019-02-04 16:50:41 -05:00
Ell
ca06990828 app: in GimpTransformGridTool, allow simultaneous forward and backward transforms
In GimpTransformGridTool, allow performing simultaneous forward
(normal) and backward (corrective) transforms, by having each
transform direction operate on an independent set of parameters.
In other words, whereas the transform-grid tools previously had a
single transform, which could be applied either normally or
correctively using the "direction" tool-option, they now have two
independent transforms, one applied normally and the other
applied correctively, which are toggled using the "direction"
option.  The overall transform is the combination of the backward
transform, followed by the forward transform.

Another way to think about it, is that the tool transforms a source
shape into a destination shape.  The source shape is defined by the
backward transform, and the destination shape is defined by the
forward transform.  Wherewas previously only one of these shapes
could be controlled (the other shape always being the item bounds),
it's now possible to control both shapes in a single transform.
The next commit will allow modifying both shapes simultaneously,
making this even more useful.

Note that since both transforms start off as the identity, using
only one of the transform directions has the same behavior as
before.

(cherry picked from commit de8e81f81f)
2019-02-04 16:50:41 -05:00
Ell
3ad945c3c8 app: add GimpTransformToolClass::undo_desc field
Add an undo_desc field to GimpTransformToolClass, which subclasses
should set to the tool's default undo description.  Provide a
default implementation for the get_undo_desc() vfunc, which returns
(a copy of) undo_desc.  This simplifies transform tools that have a
static undo descrption, as well as provides a fallback when a
detailed undo description can't be generated (not currently
relevant, but will be used in the next commit).

(cherry picked from commit d549440650)
2019-02-04 16:48:57 -05:00
Ell
b0ab2b6564 app: improve rotate-tool undo description
When rotating an item around its center using the rotate tool,
i.e., if the pivot point hasn't been moved, don't include the pivot
coordinates in the undo description.

(cherry picked from commit 44c8a1f274)
2019-02-04 16:48:56 -05:00
Ell
054d441a8d app: improve measure-tool undo description
When straightening an item using the measure-tool, include the
orientation and angle in the undo description.

(cherry picked from commit b95bf3fb93)
2019-02-04 16:48:56 -05:00
Ell
6495b6d023 app: fix CRITICALs in GimpMeasureTool
In GimpMeasureTool, don't try to access the "straighten" button
when halting the tool if it's NULL, which can happen when the
measure tool is selected upon startup, but is changed before its
tool-options GUI is constructed.

(cherry picked from commit 7fc5698f32)
2019-02-04 16:48:55 -05:00
Ell
d74df14766 app: in GimpTransformGridTool, fix layer hiding
In GimpTransformGridTool, when the "show-preview" tool-option
changes, don't take the transform validity into account when
deciding whether to hide the current layer -- it should only affect
the visibility of the preview, not the layer.

(cherry picked from commit 7ed512040e)
2019-02-04 16:48:54 -05:00
Ell
08c540ebc1 app: in GimpTransformGridTool, remove flip-tool hack
The flip tool is not a subclass of GimpTransformGridTool; this is
a leftover from GimpTransformTool.

(cherry picked from commit 3ebda874b5)
2019-02-04 16:48:53 -05:00
Michael Natterer
6be6ea0e92 Issue #2898 - Gegl Operations - Color Wrap does not fit the screen on...
...1920*1980 resolution

In GimpOperationTool, make the generated GUI scrollable if it is
higher than half the monitor's workarea. This is meant as a last
resort for generated GUIs that do not have a custom constructor that
makes them usable using better layouts.

(cherry picked from commit b85d7c2334)
2019-02-03 18:15:48 +01:00
Ell
297971e447 app: fix CRITICAL when initializing the perspective-clone tool
When initializaing the perspective-clone tool in paint mode, the
GimpDrawTool may already be active, causing the call to
gimp_draw_tool_start() to fail with a CRITICAL.  Stop the draw tool
first, if active, to avoid that.

(cherry picked from commit 07d2d5af5a)
2019-01-31 09:13:04 -05:00
Ell
5e6378a7a3 app: in perspective-clone tool, fix cursor presicion; hide brush while adjusting
In GimpPerspectiveCloneTool, use PIXEL_CENTER cursor precision
while setting the source, and place the source-position handle at
the center of the selected pixel, rather than at its top-left
corner.

Additionally, disable the paint tool while adjusting the
perspective, so that the brush outline isn't shown, and the cursor
precision remains SUBPIXEL, even if the hard-edge option is
toggled.

(cherry picked from commit e5c9314a88)
2019-01-31 06:22:52 -05:00
Ell
5c3532609f app: add gimp_paint_tool_set_active()
... which can use to enable/disable certain aspects of
GimpPaintTool (in particular, brush-outline drawing).  Should be
used by subclasses, to temporarily disable the paint tool while in
a non-paint mode (currently, this is only needed by the
perspective-clone tool; see next commit.)

(cherry picked from commit 05dd5029ee)
2019-01-31 06:22:51 -05:00
Ell
028b0f39dd app: fix cursor precision of source tools
In GimpCloneTool, set the cursor precision to PIXEL_CENTER while
setting a source, and have GimpBrushTool snap the brush outline to
pixel centers.

(cherry picked from commit ef2818231f)
2019-01-31 06:22:50 -05:00
Ell
b1c977e510 app: fix cursor precision of various tools
Fix the cursor precision of the cage-transform, foreground-select,
n-point deformation, and warp-transform tools.

(cherry picked from commit 158705e4ef)
2019-01-31 04:39:40 -05:00
Jehan
ffe2fb478c app: new gimp_spin_scale_set_constrain_drag() and use it on paint...
... tools' brush options.
After discussions, it turned out that many people disliked that the spin
scale for brush size (and some other options) get you fractional values.
How often do you actually need to get a 4.32 pixel-size brush? And even
how meaningful is it? On the other hand, you usually want a 4 or a 5
pixel size brush and it's nearly impossible to get (exactly) by dragging
the scale widget.
It is so annoying that some even resort to edit the value with keyboard!
So I am adding an optional "constrain" feature to GimpSpinScale. It will
still be possible to get fractional values when constraining is on, for
instance with keyboard edit (the arrow incrementation also will keep any
fractional part). So the interaction for such scales is simply reversed
so that you get integers easily, and fractional parts with a bit more
effort.

It is not turned on by default (some feature actually need precision and
we don't want to break the sliders for these) and for the time being, I
only applied it to all the brush settings in paint tools. Now that it
exist, we may want to apply this to more scales in various parts of
GIMP.

(cherry picked from commit bff3903f37)
2019-01-25 18:34:09 +01:00
Jehan
e7ec1aa550 app: allow more motion events with line art bucket fill.
When a fill zone was a bit too segmented, you'd want to just stroke
across it. But it was leaving some pieces uncolored, even though the
pointer dragged through it! The exact motion mode allows more events.

Note: I don't set it in the similar color filling (where it could have
been useful too) mostly because it is harder to remove events then (even
if a point was already filled, it could still serve as a seed for more
filling if threshold > 0), thus implied too much processing. Anyway in
all my tests, it was more a problem for line art filling anyway.

(cherry picked from commit 9c13058d54)
2019-01-23 19:42:35 +01:00
Ell
6a65e76267 app: fix rectangle-select tool rounded-corners option
In GimpToolRectangle, fix the type of the cornder_radius field, so
that non-integer radii are properly displayed.

In GimpRectangleSelectOptions and GimpToolRectangle, increase the
maximal corner radius.

(cherry picked from commit a472696012)
2019-01-21 11:39:28 -05:00
Michael Natterer
9adf6c89ff Issue #1942 - Smudge Tool with Sample Merged Option
Add a Sample Merged option to smudge, a lot like for heal, just needed
tweaking in more places.

(cherry picked from commit 34cad3a06e)
2019-01-20 17:50:50 +01:00
Jehan
8064a17e86 app: fix a crash in bucket fill tool.
In commit c71b4916af, I forgot to disconnect signals on the bucket fill
options at finalization, leading the software to crash on an
non-existing tool.

(cherry picked from commit 0a952a3429)
2019-01-17 15:37:24 +01:00
Jehan
32fdd69324 app: add the concept of line art source to Bucket Fill tool.
Additionally to sample merge and active layer, now we can only use the
layer above or below the active layer as line art source.

The line art fill is meant to work on drawing lines. Though sample merge
still is ok in many cases, the more you fill with colors, the more the
line art computation becomes unecessarily complex. Also when you use a
lot of layers with some of them already filled with colors, it makes it
impossible to colorize some line art zones with the tool. Moreover you
just don't want to have to hide every layers out there to colorize one
layer (especially background layers and such as you may want to see the
result with your background).
Thus we want to be able to set the source as a unique layer, while it
not being necessarily the active one (because you want lines and colors
on different layers). In this case, I am assuming that the color and the
line layers are next to each other (most common organization).

(cherry picked from commit c71b4916af)
2019-01-15 17:39:17 +01:00
Ell
293ae15b72 app: in filter tools, allow toggling on-canvas controller visibility
In GimpFilterTool, when the filter uses an on-canvas controller,
provide a toggle in the tool's filter-options dialog allowing to
toggle the controller's visibility.  This allows getting the
controller out of the way when unneeded.

(cherry picked from commit 33c22ae2a3)
2019-01-13 08:15:51 -05:00
Ell
3ac417afe4 app: in GimpDrawTool, avoid CRITICAL on widget signal if not active
In GimpDrawTool, do nothing in the tool-widget signal handlers if
the draw-tool isn't active, to avoid CRITICALs due to a NULL
display.  This can happen if a widget is set before the tool is
started.

(cherry picked from commit 34e6c8734b)
2019-01-13 08:15:49 -05:00
Ell
300166a612 app: handle GimpToolWidget::message in GimpDrawTool
... by forwarding the message to the tool.

(cherry picked from commit 265071f34b)
2019-01-13 08:15:48 -05:00
Ell
10f22753e4 app: in gimpdrawtool.c, s/rectangle/widget/ in tool-widget signal handlers
(cherry picked from commit 749dc3c465)
2019-01-13 08:15:46 -05:00
Jehan
78392316db Issue #2786: a few string issues.
Several en_GB to en_US.

Also "Show a preview of the transform_grided image". "grided" should be
"gridded", but I also have a problem with the underscore. Should it be
"transform-gridded"? Even so, does it really make sense?
I chose to just read "Show a preview of the transformed image", which I
think is simpler and the most understandable (we don't need to leak the
implementation with a transform grid into the human read text IMO). If
anyone think that was not the right choice, feel free to propose
otherwise.
Thanks to Bruce Cowan for noticing these.

(cherry picked from commit f9c170dfbd)
2019-01-12 18:04:55 +01:00
Ell
7547df54dd app: in the gradient tool, halt gradient editor before committing filter
In the gradient tool, halt the gradient editor before committing
the filter, so that its image-flush idle source is removed before
applying the operation, to avoid flushing the image, and hence
restarting its projection rendering, during application.

(cherry picked from commit 2256ab22f7)
2019-01-12 04:54:18 -05:00
Ell
a16d06a40a Issue #1824 - Crash on 2.10.4 using tablet
In GimpTool, track the last-seen pointer coordinates, modifier
state, and event time, during button_press() and motion() events
and use those to synthesize a button_release() event when
comitting/halting the tool, if the tool is still active, and a
matching button_release() event has not been received.

The paint tools (as well as other tools) require each
button_press() event to be matched by a button_release() event in
order to properly finish their operation, but one isn't organically
generated when switching tools due to a device change.

(cherry picked from commit 9b25611857)
2019-01-09 13:40:48 -05:00
Jehan
2dc3e1813c app: make layer picking a generic modifier of the shell.
Instead of having layer picking only on paint tools with alt-click, make
it available everywhere with alt-middle click. Moving through layers is
also a way to navigate an image, so it actually makes sense to be with
other modifiers (panning, zooming, rotating), while making the feature
more generic (this is definitely useful whatever the selected tool).

(cherry picked from commit 4c337353a0)
2019-01-08 13:41:06 +01:00
Jehan
e0be9bdef2 app: alt-click to pick a layer will loop through candidate layers.
If you click on a zone filled in several visible layers, you don't
necessarily want the top layer. You may want one below. With this
change, as long as you hold alt, you will loop through all candidate
layers from top to bottom (then looping back top when reaching the
bottom).
In a first alt-click, you will always end up to the top candidate.

(cherry picked from commit 90e9eb3fca)
2019-01-08 13:41:06 +01:00
Jehan
5790c809c1 app: allow picking layer in paint tools on alt-click.
When working with a lot of layers, it is common to have to switch easily
between layers. And having to go back to the layer list is annoying and
also sometimes not practical at all when you can't find easily the right
layer. This is a first step in an experiment for such a feature, worked
together with Aryeom as advisor (and originator of the feature idea).
For now I apply this only to paint tools, though we are considering
having it as a generic modifier too, working whatever the tool. Yet we
wouldn't be able to use alt-left click (as it is used already in some
tools).
How it works is simply that in any paint tool, alt-click allows to
switch to the topmost layer having a visible pixel at the clicked
position.

(cherry picked from commit 3b59e6f61e)
2019-01-08 13:41:05 +01:00
Ell
926e28b219 app: in bucket fill tool, don't calculate line art of layer groups
... since they can't be used with the fill tool.

(cherry picked from commit 4b4fffbd0e)
2019-01-07 04:29:13 -05:00
Ell
0f2f95d97b app: in bucket-fill tool, avoid calculating line art when not in line-art mode
In the bucket-fill tool, don't pre-calculate the line art when not
using a line-art fill area.  Also, misc. cleanup.

(cherry picked from commit 823d4a0d24)
2019-01-06 16:31:11 -05:00
Michael Natterer
c4e6c3add2 app: wrap some overly long lines in gimpbucketfilltool.c
and some other pedantic style fixes.

(cherry picked from commit 292903b78d)
2019-01-02 16:35:48 +01:00
Michael Natterer
fca2e84f4f app, libgimpbase: move enum GimpBucketFillArea to the core
The whole bucket fill specific enum stuff is on its way out, so let's
keep this one out of libgimp for now until we decide how to present
line art filling in the PDB.

(cherry picked from commit 368f2e596a)
2019-01-02 15:54:20 +01:00
Ell
f8a5c58d41 app: in warp tool, crop filter to stroke bounds
In the warp tool, set the drawable-filter's crop area to the
combined stroke bounds, so that, when comitting the tool, only this
area is processed, instead of the entire drawable area.

(cherry picked from commit e06c4643dc)
2018-12-30 05:13:30 -05:00
Ell
0685c05cfb app: in GimpFilterTool, make region combo insensitive when selection is empty
(cherry picked from commit 093e017df8)
2018-12-29 20:55:43 -05:00
Ell
3e1a631583 app: in GimpFilterTool, show region combo for non-point ops
In GimpFilterTool, show the region combo when applying a non-point
op, as well as when applying a position-dependent point op.  The
result of non-point ops may depend on the choice of input region,
even if the op is not position-dependent.

(cherry picked from commit 7949fd9a28)
2018-12-29 20:27:46 -05:00
Jehan
e001f344e5 app: rename and merge the spline and segment length properties...
... in GimpBucketFillOptions for the line art algorithm.

Inside GimpLineArt, there are still 2 properties, but we don't show them
anymore in the Bucket Fill tool options. One of the main reason is
probably that it's hard to differentiate their usage. One is to close
with curved lines, the other with straight segments. Yet we don't
actually have any control on one or the other. All one knows is that you
can have "holes" in your drawing of a given size and you want them
close-like for filling. Only reason I can see to have 2 types of closure
is whether you'd want to totally disable one type of closure (then you
set it to 0). But this is a very limited reason for making the options
less understandable overall, IMO.
So for the time being, let's show up only a single option which sets
both properties in GimpLineArt. As patdavid says "it makes sense as a
first pass".

Also rename the option to shorter/simpler "Maximum gap length". Thanks
to patdavid and pippin for helping on figuring out this better label!

Finally I am bumping the default for the gaps to 100px. The original
values were ok for the basic small images used in demos, but not for
real life image where it was always too short (even 100px may still be
too short actually, but much better than the 20 and 60px from before!).

(cherry picked from commit 503775a5a0)
2018-12-24 13:35:32 +01:00
Michael Natterer
769a6f73cc app: fix capitalization of the "Line Art Detection" frame
(cherry picked from commit 822f1b9090)
2018-12-22 21:08:06 +01:00
Alexandre Prokoudine
3d9ad63c34 Unified transform: enable Constraint:Scale by default 2018-12-21 01:49:44 +03:00
Jehan
ef12064655 app: allow setting line art spline and segment length to 0.
Practically it means that the algorithm won't close line art anymore
with both settings at 0. This can nevertheless still be a very useful
tool when you have a drawing style with well-closed lines. In such a
case, you will still profit from the color flooding under the line art
part of the algorithm.
Moreover with such well-closed zones from start, you don't get the
over-segmentation anymore and the threaded processing will be faster
obviously.

(cherry picked from commit 0a2d066168)
2018-12-19 16:24:23 +01:00
Jehan
86b9738286 app: do not make line art bucket fill a GimpSelectCriterion anymore.
This was my initial choice, but the more I think about it, the less I am
sure this was the right choice. There was some common code (as I was
making a common composite bucket fill once the line art was generated),
but there is also a lot of different code and the functions were filled
of exception when we were doing a line art fill. Also though there is a
bit of color works (the way we decide whether a pixel is part of a
stroke or not, though currently this is basic grayscale threshold), this
is really not the same as other criterions. In particular this was made
obvious on the Select by Color tool where the line art criterion was
completely meaningless and would have had to be opted-out!

This commit split a bit the code. Instead of finding the line art in the
criterion list, I add a third choice to the "Fill whole selection"/"Fill
similar colors" radio. In turn I create a new GimpBucketFillArea type
with the 3 choices, and remove line art value from GimpSelectCriterion.

I am not fully happy yet of this code, as it creates a bit of duplicate
code, and I would appreciate to move some code away from gimpdrawable-*
and gimppickable-* files. This may happen later. I break the work in
pieces to not get too messy.
Also this removes access to the smart colorization from the API, but
that's probably ok as I prefer to not freeze options too early in the
process since API needs to be stable. Probably we should get a concept
of experimental API.

(cherry picked from commit cd924f453a)
2018-12-19 16:23:26 +01:00
Jehan
fec11389cb app: allow switching fill type with Alt even when Pattern fill selected.
Currently in bucket fill tool, the modifier was only switching fg to bg
and bg to fg, and was doing nothing when pattern was set. I make it
switch to fg as well (and remember which was the original value).

(cherry picked from commit 5a157bf1ba)
2018-12-19 16:21:37 +01:00