Commit Graph

26 Commits

Author SHA1 Message Date
Ell 39e23267f7 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.
2019-02-04 16:48:13 -05:00
Ell de8e81f81f 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.
2019-02-04 16:48:12 -05:00
Ell d549440650 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).
2019-02-04 15:59:55 -05:00
Michael Natterer 5f700549e7 Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
Ell 6a3fc6c1b9 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.
2018-06-15 16:04:20 -04:00
Ell 1dbe765905 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:07:20 -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
Michael Natterer 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
Michael Natterer 99dee5860d app: manage GimpHandleTransformTool's handle-mode with an object binding 2017-06-19 23:46:06 +02:00
Michael Natterer 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
Michael Natterer 4b597f9622 app: take the handle transform tool out of the playground
It seems proper enough now.
2017-06-19 22:56:07 +02:00
Michael Natterer 96da8c1505 app: add status message to the handle transform tool
and fix a few glitches from tool widget porting.
2017-06-19 22:53:30 +02:00
Michael Natterer 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
Michael Natterer 38c9ee9e93 app: use a GimpToolHandleGrid in GimpHandleTransformTool 2017-06-19 01:22:13 +02:00
Michael Natterer 6cd91f1fde app: move the handle transform matrix calculation to gimp-transform-utils.[ch] 2017-06-17 10:03:24 +02:00
Michael Natterer a5f3808505 app: use the newly added tool widgets in the transform tools 2017-06-17 03:04:06 +02:00
Michael Natterer 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
Michael Natterer 4df9a1d568 Get rid of gtk_misc_set_alignment(label) and use gtk_label_set_x,yalign() 2016-09-08 19:11:20 +02:00
Michael Natterer 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
Michael Natterer 81cf8aa601 app: improve usability of the handle transform tool
Reorganize tool modes to be { ADD_TRANSFORM, MOVE, REMOVE }, where
ADD_TRANSFORM is the default and allows to add handles *and* transform
the image in one click-drag. MOVE moves handles without transforming
(shift) and REMOVE removes handles (control). Also improve cursors to
accurately show the result of a click.
2015-04-02 23:31:41 +02:00
Michael Natterer 974ce0b6d1 app: GimpHandleTransformTool: remove shortcuts in is_handle_position_valid()
The check should not depend on trans_info[NUM] because the code that
has the division by zero to avoid doesn't either. Closes bug #721009.
2015-03-30 00:12:16 +02:00
Michael Natterer 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
Michael Natterer 4dcd48fff2 app: move the handle transform tool to the playground 2015-03-08 17:21:11 +01:00
Michael Natterer 8f4fe89309 app: some more cleanup in the handle transform tool 2015-03-08 17:12:13 +01:00
Johannes Matschke 2989bad35a Bug 721009 - new transform tool with freely placeable handles
Add new tool GimpHandleTransformTool which allows to freely place up
to 4 handles on the image, then move any one of them, which transforms
the image so that the remaining handles keep their position.

Did quite some cleanup on the code before pushing --Mitch
2015-03-05 12:36:59 +01:00