Commit graph

4912 commits

Author SHA1 Message Date
Ell
5b93eee52a app: in scale tool, scale around center even when using numeric input
In the scale tool, when the "around center" option is toggled,
scale the item around its center not only through canvas
interaction, but also when entering width/height values through the
tool GUI.

(cherry picked from commit 786bfa5171)
2018-11-15 12:53:11 -05:00
Ell
e0e825580b Issue #2308 - Strange behavior when switching active layer during transform
Replace GimpTransformTool's 'drawable' field with an 'item' field,
and have GimpTransformGridTool set it to the active item, to which
the transformation is applied, during its initialization.  In
gimp_transform_tool_get_active_item(), return the value of the
transform tool's 'item' field, if not NULL, instead of the image's
active item.  This makes sure we apply that transform-grid tools
apply the transformation for the item for which they were
activated, even if the image's active item has changed.

(cherry picked from commit 3eaae58595)
2018-10-04 21:51:38 -04:00
Ell
9b3c2e9b4e app: don't commit trivial warp transform
In the warp tool, don't commit a trivial (empty) transform.  This
is especially important now that exiting the tool through undo
causes it to get comitted (... with a trivial transform).

(cherry picked from commit d12dd3fb35)
2018-09-29 12:38:50 -04:00
Ell
943757c136 Issue #1180 - Warp tool aborts changes to layer A when ...
... changing layers and warping layer B

Add a new GimpToolControl::dirty_action field, which specifies the
tool action to perform when the a dirty event matching the tool
control's dirty mask occurs; this field defaults to HALT.  Apply
this action to the active tool in tool-manager in response to a
matching dirty event, instead of unconditionally halting the tool.
Likewise, use this action to stop the active tool in response to a
button-press event on a different drawable in the same image.

Set the dirty action of the gradient and warp tools to COMMIT, so
that they get comitted, rather than stopped, in cases such as
switching layers (including switching to/from quick-mask mode),
and, for the warp tool, changing the selection.

(cherry picked from commit ed20393f0e)
2018-09-29 12:38:50 -04:00
Ell
943f92a6ac Issue #2222 - Warp Transform doesn't commit changes upon saving ...
... the XCF file

Add a "saving" signal to GimpImage, which is emitted when the image
is about to be saved or exported (but before it's actually saved/
exported).  Connect to this signal in tool-manager, and commit the
current tool in response (unless its GimpToolControl::preserve is
TRUE).

(cherry picked from commit ae628a8664)
2018-09-29 02:40:27 -04:00
Ell
c9510721c5 app: construct tool-options GUI lazily
We currently construct the tool-options GUI for all the tools at
startup, which takes a significant amount of time.  Instead,
only register the GUI construction function with the tool-options
object, using the new gimp_tools_set_tool_options_gui_func()
function, and use the registered function to construct the GUI when
actually needed.

(cherry picked from commit c1347a7f26)
2018-09-27 02:44:35 -04:00
Ell
49390462c8 Issue #2272 - Crash when using the intelligent-scissors tool ...
... after erasing all points

When erasing the last remaining point in the iscissors tool, halt
the tool, rather than leaving the tool active with an empty curve,
which it is not prepared to handle, and which results in a segfault
once trying to add a new point.

Additionally, when erasing the last remaining segment (i.e., the
two last remaining points), don't erase the entire segment (i.e.,
both points), but rather convert the segment to its initial point,
so that, in effect, we only erase the last point of the segment.

(cherry picked from commit a5baba5539)
2018-09-26 02:14:36 -04:00
Ell
6a8ece0fd5 app: confirm transforms that result in very large items
In GimpTransformTools, precalculate the resulting size of the
transformed item(s), and request confirmation if the size grows to
over 10 times the size of the image (in either dimension).  This
protects against transformations that can result in suprprisingly
large items, such as inverted transformations, and, specifically,
perspective-correction transformations performed using the measure
tool, which will be added in the following commits.

(cherry picked from commit 20a6a3583b)
2018-09-25 04:31:37 -04:00
Ell
31b369d09f app, libgimp*, modules: don't use g_type_class_add_private() ...
... and G_TYPE_INSTANCE_GET_PRIVATE()

g_type_class_add_private() and G_TYPE_INSTANCE_GET_PRIVATE() were
deprecated in GLib 2.58.  Instead, use
G_DEFINE_[ABSTRACT_]TYPE_WITH_PRIVATE(), and
G_ADD_PRIVATE[_DYNAMIC](), and the implictly-defined
foo_get_instance_private() functions, all of which are available in
the GLib versions we depend on.

This commit only covers types registered using one of the
G_DEFINE_FOO() macros (i.e., most types), but not types with a
custom registration function, of which we still have a few -- GLib
currently only provides a (non-deprecated) public API for adding a
private struct using the G_DEFINE_FOO() macros.

Note that this commit was 99% auto-generated (because I'm not
*that* crazy :), so if there are any style mismatches... we'll have
to live with them for now.
2018-09-18 14:41:35 -04:00
Øyvind Kolås
8d5c00a80d app: migrate iscissorstool to new iterator api
(cherry picked from commit beb4ecb238)
2018-09-18 12:36:13 +02:00
Ell
b1652b02d8 app: don't change text-layer box mode after moving using text tool
When moving a text layer using the text tool (through alt+drag),
don't change the layer's box mode to "fixed", which is unnecessary,
since the layer's size isn't affected.

(cherry picked from commit 601c213c7a)
2018-09-06 11:47:08 -04:00
Ell
951c08efd5 app: fix text tool frame position when undoing move operation
While editing a text layer with the text tool, update the layer's
frame when the layer moves, which most notably happens when
undoing/redoing a move operation while the text tool is active.

(cherry picked from commit 238c1035db)
2018-09-06 11:47:08 -04:00
Ell
925b7f2c60 app: streamline text-tool drawing blocking/unblocking logic
The various functions of the text tool currently block and unblock
drawing (through gimp_text_tool_[un]block_drawing()) implicitly,
and in a non-symmetric fashion, which makes the tool's logic rather
fragile.  Instead, require blocking/unblocking to be done
symmetrically, and explicitly block/unblock drawing as necessary in
all functions.

(cherry picked from commit a03183b266)
2018-09-06 11:47:08 -04:00
Ell
e2b54845bd app: fix uninitialized variable warning in gimptexttool.c
(cherry picked from commit a1caa17531)
2018-09-06 11:47:08 -04:00
ONO Yoshio
2ff515b374 app: avoid to rotate unattached vectors directory in ...
... gimp_text_tool_create_vectors_warped().
fixed commit 8dfe00fa17

(cherry picked from commit 5483ea88e5)
2018-09-06 08:45:40 +09:00
ONO Yoshio
54f9d3ee7d Issue #2064 - text along path not working with vertical text.
(cherry picked from commit 8dfe00fa17)
2018-09-03 12:34:15 +09:00
Ell
8cfd24107f app: show error on attempt to subtract-from/intersect-with empty selection
In all the selection tools, show an error (and a BAD cursor
modifier) wheh starting a selection, if the current selection is
empty, and the tool is in SUBTRACT or INTERSECT mode (in which
case, the selection has no effect).

(cherry picked from commit 0e26525e65)
2018-09-02 08:50:22 -04:00
Ell
806cb6e348 Issue #2120 - Segmentation fault while using Levels to white balance a layer
Move the call to gimp_filter_tool_disable_color_picking() from the
filter-tool's dialog "unmap" handler to gimp_filter_tool_halt().
Since commit ec80a88513, we
explicitly destroy the GUI when halting the filter tool, which
happens before the dialog's unmap handler is called, which could
potentially result in a dangling pointer to the active color-picker
widget in gimp_filter_tool_disable_color_picking().

(cherry picked from commit 072d6b0d12)
2018-08-30 03:37:48 -04:00
Ell
8814852159 Issue #2116 - bug: Image guide creation by dragging does not allow ...
... 100% position anymore

In GimpGuideTool, use a closed [0, max_position] range as the
allowable range for new/repositioned guides (where max_position is
either the image's width or height), so that guides can be placed
at the right/bottom edge of the image.

(cherry picked from commit 547190faa8)
2018-08-28 03:46:25 -04:00
Ell
6c46891c4c app: explicitly clear GUI when halting a filter tool
In gimp_filter_tool_halt(), explicitly clear the GUI container
before clearing filter_tool->config, since the tool might be halted
during the GUI dialog's delete event, in which case the GUI will
only be implicitly destroyed *after* the function returns.  The
destruction of the GUI might fire signals whose handlers rely on
filter_tool->config, so we need to make sure it happens while it's
still alive.

In particular, this fixes a CRITICAL in the threshold tool, which
occurs due to the histogram view's "range-changhed" signal being
fired during its destruction, and its handler accessing
filter_tool->config.

(cherry picked from commit ec80a88513)
2018-08-20 14:42:22 -04:00
Ell
0e3084a9d1 Issue 2052 - Crash when using the flip tool
In gimp_transform_tool_transform(), use "active_item", instead of
"tool->drawable", when cutting/pasting the selected portion of a
layer for transformation.  The latter is a remnant of the old
transform-tool code, and is not guaranteed to be correspond to the
correct drawable, or even to a valid drawable (i.e., it can
potentially produce wrong results, or segfault.)

(cherry picked from commit 9420805525)
2018-08-20 04:22:41 -04:00
Ell
e10d5852c1 app: add gegl:long-shadow to the menus
(cherry picked from commit 537bf4ec6a)
2018-08-09 19:03:06 -04:00
Ell
e1e637c238 app: keep sanity/blacklist gegl op lists alphabetically sorted
(cherry picked from commit b6c56a6ae9)
2018-08-09 19:03:06 -04:00
Michael Natterer
af2a27f1c9 Issue #1662 - GIMP crashes while using cage transform when selection is active
Fixed by implementing Massimo's two findings:

gimp_operation_cage_transform_process(): if aux_buf is NULL, bail out
after initializing out_buf with identity vectors, fixes the crash.

gimp_cage_tool_create_filter(): set the drawable filter's region to
GIMP_FILTER_REGION_DRAWABLE, fixes offset when there is a selection.

(cherry picked from commit 49dfc6143d)
2018-08-07 20:11:52 +02:00
Jehan
9ec12b6246 app: minor coding-style cleanup.
Adding spaces between function names and parenthese.

I would normally have just amended the contributed patches and pushed,
but gitlab is making our review process over-complicated with many
roundtrips with contributors, and review quality drops. Stating it here
for the records!
See commit 70945b8960 (where this cleaning
should have directly been done).

(cherry picked from commit 5c56f8cb3a)
2018-08-02 15:26:19 +02:00
ONO Yoshio
f6ed6e6e72 Fixed that anchor position of text is shifted when text direction is changed.
anchor of LTR is top-left corner.
anchor of TTB-RTL is top-right cornner.
anchor of TTB-LTR is top-left cornner.

(cherry picked from commit 70945b8960)
2018-08-02 15:26:19 +02:00
ONO Yoshio
bb56a97a8b Modified a comment in more detail.
(cherry picked from commit b405b0364c)
2018-07-31 15:24:30 +02:00
ONO Yoshio
e2958714d9 MR !19: Add support for vertical text writing.
Squashed commit of the following:

commit ee1ff7d502658cfa1248a13a3f0348495db07eda
Author: ONO Yoshio <ohtsuka.yoshio@gmail.com>
Date:   Sun Jul 29 00:31:47 2018 +0900

    Fixed that gimp-text-dir-ttb-* icons are lacked in Symbolic.

commit d87d012d697628da28fe90199cc04b95b72ba8ef
Author: ONO Yoshio <ohtsuka.yoshio@gmail.com>
Date:   Sat Jul 28 16:23:10 2018 +0900

    Fix a typo.

commit cf0238bf7df56c384cdf3b7ec69557d14740f853
Author: ONO Yoshio <ohtsuka.yoshio@gmail.com>
Date:   Sat Jul 28 15:50:57 2018 +0900

    Fixed seg fault error.

commit b07f60d06fa1a753fda5b4d46af01698c344154e
Author: ONO Yoshio <ohtsuka.yoshio@gmail.com>
Date:   Fri Jul 27 17:15:34 2018 +0900

    Add support for vertical text writing.

    https://gitlab.gnome.org/GNOME/gimp/issues/641

(cherry picked from commit 587d9bbb03)
2018-07-30 23:10:11 +02:00
Ell
f1bc66ce30 app: fix segafult when halting filter-tool with controller
In GimpFilterTool, bind the controller's lifetime to the lifetime
of the config object, rather than to the lifetime of the
corresponding tool widget; make the controller's widget pointer a
weak pointer to the widget, and bail out of the controller "set()"
functions when the widget pointer is NULL.

This fixes an issue arising when the properties of a config object
that outlives the widget change after the widget had died,
triggering a call to the controller's set() function, resulting in
a segafult when trying to access the widget.

(cherry picked from commit 78abe756f1)
2018-07-24 02:27:01 -04:00
Ell
b72dc8abf1 Issue #1874 - Critical error after selecting "Edit Text on Canvas" ...
... from layer context menu

In gimp_text_tool_set_layer(), do nothing if the input layer is the
currently-edited layer, otherwise we get a CRITICAL.

(cherry picked from commit 6b1d77b11c)
2018-07-19 02:27:11 -04:00
Ell
9a77dc75a4 Issue #1850 - Undoing the "straighten" operation in the Measure tool ...
... does not restore the measure points

Halt the measure tool after straightening, thus removing the
expectation that undoing the operation should restore the original
points.

Halting the tool, rather than making undo work "as expected",
sidesteps several issues:

  - Implementing undo correctly is tricky, since image-undo and
    tool-undo are handled separately.

  - In fact, the measure tool doesn't provide tool-undo, so that
    image edits can be undone while the tool is active without
    affecting the tool, and it's not clear that we want to change
    this behavior.  However, this makes undoing a straighten
    operation a special case, and it's not entirely clear what the
    behavior should be when undoing other kinds of transformations,
    or when the measure points had changed since the straighten
    operation.

  - Perhaps most importantly, measure tool points are restricted to
    the pixel grid, which means that when measuring an angle
    against an orientation that's not fully horizontal or vertical
    in image space (either using a 3-point angle, or when the
    canvas is rotated), the resulting transformed point after
    straightening doesn't generally land on the pixel grid, causing
    it to be rounded, which can result in a non-zero angle after
    the rotation.  This is especially ugly, since clicking
    "straighten" again at this point would cause another non-
    trivial rotation.

(cherry picked from commit 2e08c9164a)
2018-07-16 01:21:48 -04:00
Ell
bfa94216a9 app: bind "orientation" measure-tool option to compass
Bind the "orientation" property of the measure-tool options to the
tool's compass widget's "orientation" property, instead of manually
synchronizing their values.

(cherry picked from commit 7a91aabf37)
2018-07-15 19:58:59 -04:00
Ell
dc2cdfe658 Issue #1851 - Measure tool straighten rotation is always to the horizontal.
Add an "orientation" option to the measure tool, corresponding to
the "orientation" property of GimpToolCompass (i.e., it controls
the orientation against which the angle is measured, when not in 3-
point mode.)  The orientation is "auto" by default, so that the
angle is always <= 45 deg.  Note that the "orientation" option
affects the tool's "straighten" function, so that the layer is
rotated toward the current orientation.

Use the "pixel-angle" and "unit-angle" properies of
GimpToolCompass to read the measured angle, instead of duplicating
the angle-measurement logic, in particular, so that we benefit from
the improvements/fixes of the previous commit.

(cherry picked from commit cb3b7a1ba5)
2018-07-15 19:09:16 -04:00
Ell
fc4ca7fbcf app: add "orientation" property to GimpToolCompass + improvements
Add an "orientation" property to GimpToolCompass, which can be one
of "auto", "horizontal", or "vertical", and which controls the
orientation of the line against which the angle is measured, when
not in 3-point mode (previously, the line would always be
horizontal.)  When "orientation" is "auto", the orientation is
automatically set to either horizontal or vertical, such that the
measured angle is <= 45 deg.

Keep the line horizontal, or vertical, in display-space, rather
than in image-space, so that the compass works correctly even when
the canvas is rotated and/or flipped.

Fix the compass's behavior when the image's horizontal and vertical
resolutions are different, both with and without dot-for-dot.

Add "pixel-angle" and "unit-angle" read-only properties, which
return the measured angle either with or without taking the image's
resolution into account, respectively.  These properties will be
used by the measure tool in the next commit, instead of having it
implement its own angle calculation.

(cherry picked from commit d2f33cf1be)
2018-07-15 19:09:16 -04:00
Ell
4cb91320a4 app: fix line-angle constraint when xres != yres
Fix gimp_constrain_line() and friends to properly constrain line
angles when the image's horizontal and vertical resolutions are
different, and dot-for-dot is disabled.

(cherry picked from commit 4fefab1798)
2018-07-15 19:09:16 -04:00
Michael Natterer
6e86e2233e app: move GimpColorFrameMode to the core and name it GimpColorPickMode
(cherry picked from commit f676f2aa79)
2018-07-15 23:29:41 +02:00
Michael Natterer
3c9de4b59e app: turn GimpSamplePoint into a GObject, just like GimpGuide
In fact, they are so similar now, they should get a common abstract
parent class.

(cherry picked from commit b4c244b839)
2018-07-15 16:01:16 +02:00
Michael Natterer
a90619ff00 app: rename enum GimpColorPickMode to GimpColorPickTarget
This is just some preparation for fixing issue #1805, but actually
"target" is a much better name so I went the full way and also changed
GUI labels and the color picker tool options config property
accordingly.

If anyone notices at all, how horrible is it to lose your saved pick
target...

(cherry picked from commit b140b283dc)
2018-07-15 14:39:03 +02:00
luz.paz
2883b8fb40 Misc. comment typos
Found via `codespell`

(cherry picked from commit 732bcb463e)
2018-07-14 21:17:19 +02:00
Michael Natterer
5e3150b90e app: small formatting fix in gimpfiltertool-widgets.c
(cherry picked from commit 9629fc8785)
2018-07-13 12:41:30 +02:00
Michael Natterer
ea86c3be12 Issue #1833 - (gimp-context-get-gradient-repeat-mode) always warns...
...and successfully fails

Commit d2ad2928 removed "gradient-repeat" from GimpPaintOptions, not
considering that it is also used in the PDB.

Move "gradient-repeat" from GimpGradientOptions back to
GimpPaintOptions, and add a comment that it is only used by the
gradient tool, not for painting.

(cherry picked from commit c3d37140eb)
2018-07-12 11:44:35 +02:00
Michael Natterer
a88c0ffb93 Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:47:19 +02:00
Michael Natterer
5d11544b2c app: make the rectangle options a bit narrower, still too wide...
(cherry picked from commit 6c3b1112be)
2018-07-08 14:49:13 +02:00
Ell
6ac4c48d9a app: add gegl:stereographic-projection (little planet) to the menus
(cherry picked from commit a96264b1b7)
2018-07-05 09:54:16 -04:00
Michael Natterer
e662b5a0ee app: fix logic error in tool_options_manager_paint_options_notify()
(cherry picked from commit 1ef7056324)
2018-07-03 20:13:49 +02:00
Michael Natterer
b4edec423c app: move the improved paint property copying code to GimpPaintOptions
and remove the old brush, dynamics, gradient property copying
functions.

(cherry picked from commit 80c423ae40)
2018-07-03 20:13:40 +02:00
Michael Natterer
a8b333a00e app: indentation in gimp-tools.c
(cherry picked from commit 5299b1894d)
2018-07-03 20:13:28 +02:00
Michael Natterer
cf7f27390c app: switch to using gimp-tool-options-manager
and remove all other tool options parent setting/unsetting and
property copying code. Also select a tool at the end of
tool_manager_init() so it is in sync with what the tool options
manager does.

(cherry picked from commit 37f69457b7)
2018-07-03 20:13:20 +02:00
Michael Natterer
2a916b241c app: more stuff in gimp-tool-options-manager.c
tool_options_manager_tool_changed(): also copy the non-global paint
options of the new tool to the global paint options, so they get used
when "global_foo" is enabled.

(cherry picked from commit 1b858eb4ad)
2018-07-03 20:12:54 +02:00
Michael Natterer
08d64c6eb8 app: small fix in gimp-tool-options-manager.c
tool_options_manager_paint_options_notify(): sync properties between
tool paint options and global paint options if the property is global
*or* the active tool is involved.

tool_options_manager_global_notify(): don't mess with the active
tool's connection to the user context or its properties at all, it is
always fully connected to the user context anyway.

(cherry picked from commit 54257da7c4)
2018-07-03 20:12:44 +02:00