Commit Graph

76 Commits

Author SHA1 Message Date
Ell
916d8bb66d app: in Unified Transform tool, avoid moving pivot when locked
In GimpUnifiedTransfomTool, avoid moving the pivot when
readjusting, and when the transform directions are linked, if the
pivot is locked.

(cherry picked from commit d7c995153d)
2020-04-27 16:56:05 +03:00
Ell
1ecbb94b2c app: take transform-grid handle size into account when readjusting
In the unified-transform, scale, and perspective tools, take the
maximal transform-grid handle size into account when readjusting
the transform, so that the handles themselves are fully within view
under arbitrary rotation, rather than just the corners.

(cherry picked from commit 46e16e175c)
2019-03-08 12:11:20 -05:00
Ell
ab060c110f app: implement readjust() in various transform tools
Implement GimpTransformGridTool::radjust(), added in the previous
commit, in various transform tools:

The unified-transform, scale, and perspective tools readjust the
transformation such that the grid is centered relative to the view,
and its handles are fully within view under arbitrary rotation.

The rotate tool readjusts the transformation such that the pivot is
centered, and the grid is unrotated, relative to the view.

(cherry picked from commit 5e5118c1db)
2019-03-07 16:27:30 -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
a88c0ffb93 Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:47:19 +02:00
Ell
c7895c9752 app: clean up GimpTransformGridTool; adapt subclasses
Get rid of GimpTransformGridTool::recalc_matrix() and
gimp_transform_grid_tool_recalc_matrix(), and have
GimpTransformGridTool and its subclasses use
GimpTransformTool::recalc_matrix() and
gimp_transform_tool_recalc_matrix() directly instead.

In order to break the GimpToolWidget::changed/
GimpTransformTool::recalc_matrix() loop, add a
GimpTransformGridTool::update_widget() vfunc, which subclasses
should override to update their tool-widget (instead of doing this
in ::recalc_matrix()), and ::widget_changed(), which is called when
the tool-widget changes (and which subclasses should override
instead of connecting to the tool-widget's "changed" signal
directly.)  GimpTransformGridTool calls these functions as
necessary, instead of relying on extra parameters passed to
recalc_matrix().

Adapt all the direct and indirect subclasses of
GimpTransformGridTool to the change.

(cherry picked from commit 6a3fc6c1b9)
2018-06-15 16:05:13 -04:00
Ell
340c4a2309 app: add GimpTransformGridTool; derive most transform tools from it
While most of our transform tools use an interactive transform
grid, and have similar behavior, the flip tool is an odd one out.
The new "auto straighten" function of the measure tool introduces
another tool that performs transformations, while not behaving like
the rest of the transform tools.

Factor out the parts of GimpTransformTool that handle user
interaction into GimpTransformGridTool (with corresponding
GimpTransformGridOptions, and GimpTransformGridToolUndo), and only
leave the basic transform functionality and options in
GimpTransformTool (and GimpTransformOptions).

Derive all the transform tools (and transform-tool base classes)
that previously derived from GimpTransformTool, from
GimpTransformGridTool.  The one exception is GimpFlipTool, which
still derives from GimpTransformTool directly.  The next commit
will derive GimpMeasureTool from GimpTransformTool as well.
2018-06-09 18:30:28 -04:00
Ell
442be72630 app: port relevant transform tools to GimpGenericTransformTool
Derive GimpUnifiedTransformTool, GimpPerspectiveTool, and
GimpHandleTransformTool from GimpGenericTransformTool, eliminating
their common logic.

Remove gimp_transform_matrix_handles(), which is no longer used.
2018-01-27 07:30:30 -05:00
1ce878ef47 Bug 791949 - Please ind Shift+T to the Unified Transform Tool
Clean up transform tool keyboard shortcuts (things move around by
stealing Shift+t from the scale tool):

Shift+T  Unified Transform (was Shift+L)
Shift+S  Scale             (was Shift+T)
Shift+H  Shear             (was Shift+S)
Shift+L  Handle Transform  (was Ctrl+Shift+H)
2018-01-03 18:02:28 +01:00
Ell
2e9ab59d19 app: use matrix to determine if doing perspective transform in preview
In GimpCanvasTransformPreview, use the transform matrix to
determine if we're doing a perspective transform, rather than
relying on a separate property, so that we don't use the slow
perspective path unnecessarily.

Consequently, remove the does_perspective member of
GimpTransformTool, since it's no longer used.
2017-11-14 11:24:56 -05:00
9f59657fef app: also manage all contrain and frompivot properties centrally
using g_object_bind_property().
2017-06-19 23:29:01 +02:00
0411801765 app: manage the transform tools' grid properties in GimpTransformTool
Simply use g_object_bind_property() to connect the grid properties of
GimpTransformOoptions and GimpToolTransformGrid and remove all other
grid property setting code.
2017-06-19 23:06:39 +02:00
e13d3f1754 app: remove a lot of cruft from GimpTransformTool
All tools have a widget now so none of this stuff is needed any longer.
2017-06-19 01:53:01 +02:00
a5f3808505 app: use the newly added tool widgets in the transform tools 2017-06-17 03:04:06 +02:00
91e861adcc libgimpwidgets, *: deprecating stock IDs for good, part one...
Remove all stock items added since 2.8, restore accidentially removed
ones, and rename the newly added GIMP_STOCK_* defines to GIMP_ICON_*.

(will move to having GIMP_ICON_* defines instead of magic hardcoded
strings for all icons).
2017-02-28 19:31:27 +01:00
4df9a1d568 Get rid of gtk_misc_set_alignment(label) and use gtk_label_set_x,yalign() 2016-09-08 19:11:20 +02:00
127b3de54a Bug 756775 - UnifiedTransformTool: nan value in handle geometry computation
Do not compute angle between 2 vectors if at least one of them is a null vector.
Return 0.0 instead.
2015-11-24 10:31:47 +01:00
22fc50c279 app: rename all values of enum GimpContextPropMask
from GIMP_CONTEXT_FOO_MASK to GIMP_CONTEXT_PROP_MASK_FOO.
Also rename the FIRST and LAST values of enum GimpContextPropType.
2015-09-08 21:18:49 +02:00
36ca4d03f1 app: some cleanup in GimpTransformTool and subclasses
- formatting
- rename some GimpTransformTool members
- add member "does_persoective" and don't include subclasses
- handle drawing cleanup
2015-03-23 23:18:28 +01:00
1c20940f82 app: use a GimpToolGui in GimpTransformTool 2013-06-07 11:52:48 +02:00
a2e8da357e transformtool: flip cursor if needed 2013-03-24 23:13:56 +01:00
438fc4221e app: remove unused variable in gimp_unified_transform_tool_init() 2012-10-12 22:39:11 +02:00
0f380eba53 transformtool: actually use the correct index for the angle vector 2012-08-27 15:12:29 +02:00
6396e83057 transformtool: use new corner and side cursors appropriately considering current transform 2012-08-27 15:07:15 +02:00
11a9fe33d9 app: another minor cleanup in gimpunifiedtransformtool.c
you missed a spot
2012-08-23 02:16:06 +02:00
b11a705203 transformtool: rotate handles along with frame 2012-08-22 22:53:59 +02:00
e83b40982f transformtool: adjust handles a bit
Since the move handle is gone, the pivot can be normal sized and circle again,
also put shear handles at 3/4 rather than 3/5.
2012-08-22 22:49:45 +02:00
5d711be340 app: formatting cleanup in gimpunifiedtransformtool.c 2012-08-22 20:45:16 +02:00
08cd798ec6 transformtool: Set the cursor and tool cursor properly on each handle by way of the new cursor_update method 2012-08-20 20:28:21 +02:00
d789cbff9d transformtool: Fix indent of switch statement 2012-08-20 20:28:19 +02:00
6af6218c2b transformtool: Remove now unused variables 2012-08-20 16:57:58 +02:00
4c22ed8128 transformtool: Use the same method for frompivot for shearing as everything else 2012-08-20 16:42:29 +02:00
3f72695a80 transformtool: kill rotate and move handle, instead rotate when outside frame (move already works inside) 2012-08-20 15:46:48 +02:00
0f6709d2d0 transformtool: Be a bit more strict about the pivot being inside the transform frame to use it, to protect against it flying away to infinity 2012-08-20 15:46:47 +02:00
4e57571103 transformtool: Remove some annoying duplication and draw perspective handles differently 2012-08-20 15:46:47 +02:00
b27c33f13c transformtool: Add back statusbar code (but more helpful) that was deleted when I made pick_function 2012-08-20 15:46:47 +02:00
c37619ade7 transformtool: Pick move operation anywhere inside polygon 2012-08-20 15:46:47 +02:00
a0d79634ed transformtool: Add one more rotation handle, in case the point you want to pivot around is close to the first one 2012-08-20 15:46:47 +02:00
f84987de73 transformtool: Add the bunch of 8 separate options for 3 things 2012-08-20 15:46:46 +02:00
03117bdf40 transformtool: Update modifier keys for options, solves problem with perspective frompivot + constrain 2012-08-20 15:46:46 +02:00
f2099fbb28 transformtool: Check if new transform is convex and don't involve the pivot if it isn't 2012-08-20 15:46:46 +02:00
501c15f910 transformtool: Add a pick_function method to the TransformTool class and remove some more hack duplication 2012-08-20 15:46:46 +02:00
293600c579 transformtool: Add a draw_gui method to the TransformTool class and remove some hack duplication 2012-08-20 15:46:46 +02:00
01142f248d transformtool: some more cleanup + comments 2012-08-20 15:46:45 +02:00
03d9a75c30 transformtool: Rename p to d because p is a weird name for a delta/diff 2012-08-20 15:46:45 +02:00
eb65b09ebd transformtool: move assignment of coords to after the logic code, this somehow fixes frompivot perspective 2012-08-20 15:46:45 +02:00
ed29503f28 transformtool: Deduplicate code, use more vector representations, fix style and warnings 2012-08-20 15:46:45 +02:00
70671f2967 transformtool: Factor out getpivotdelta() function 2012-08-20 15:46:45 +02:00