Commit Graph

250 Commits

Author SHA1 Message Date
Jehan b05fc6950d app: create and use gimp_image_item_list_linked().
This function returns a new list of items from an input list. The output
list will optionally contains linked items if any of the input item is
linked so we don't have to rewrite the same duplicated code for every
feature where item links matter.

Moreover it also filters descendants if any of the input items is an
item group, hence avoiding to apply a transformation twice to a
descendant item.

Use this new function already in 2 places, hence skimming quite a bit of
redundant code.
2020-05-26 14:15:17 +02:00
Jehan a7c59277fb app: quick on-canvas copy-paste multi-layer aware. 2020-05-17 23:00:07 +02:00
Jehan cb03fa1f08 app: Move tool multi-layer aware.
If several items are selected, they will be moved together. If one of
them is linked, all other linked items will be added to the moved
items.
2020-05-17 18:32:16 +02:00
Ell 1e9bf288ba app: fix CRITICAL when translating selected content
Fix a CRITICAL when creating a floating selection by Alt-dragging a
selection using one of the selection tools.
2019-10-02 18:38:01 +03:00
Ell 915bdffb5a app: in GimpEditSelectionTool, freeze moved items' previews
... to avoid unnecessarily updating their previews while dragging,
and, in particular, to avoid updating the image's GimpImageViewable
size in show-all mode.
2019-09-04 20:51:43 +03:00
Ell e4990bee7b app: add "Image" transform type to transform tools
Add a new "Image" transform type to the transform tools, in
addition to the existing "Layer", "Selection", and "Path" transform
types.  The "Image" mode transforms the entire image, rather than a
single item.  In tools with a preview, the preview shows the
transformed image projection.  The clipping mode controls how the
canvas is clipped during the transform; in particular, the ADJUST
clipping mode resizes the canvas to fit its transformed size.
2019-08-11 00:28:44 +03:00
Michael Natterer 901350ba20 app: use g_clear_pointer() in more places 2019-05-27 17:47:55 +02:00
Ell 637105b962 app: in all tools, blink lock box when the current item is locked
In all tools, when the current item can't be edited due to its lock
mask, use gimp_tools_blink_lock_box(), added in the previous
commit,to blink the lock box of the corresponding dockable, in
addition to showing an error message in the status bar, to hint at
the source of the error.
2018-12-10 08:55:17 -05:00
Ell c9bc3d7a09 app: in the move tool, blink type box when there's no item to move
In the move tool, when there is no item of the selected type to
move, blink the move-type box widget in the tool options, in
addition to showing an error message in the status bar, to hint at
the source of the error.
2018-12-10 08:39:47 -05:00
Ell 4fefab1798 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.
2018-07-15 19:09:06 -04:00
Michael Natterer 5f700549e7 Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
Michael Natterer 1d8696cd80 Get rid of gdk_flush() globally, use gdk_display_flush() 2018-05-20 21:06:34 +02:00
Ell 151eeb9761 app: use gimp_item_{start,end}_transform() in GimpEditSelectionTool
... instead of gimp_item_{start,end}_move().

This should have been part of commit
37742a9fee.
2018-04-29 08:30:37 -04:00
Michael Natterer ce8c4cb2a0 Bug 795288 - Layer is moved by arrow keys even after all locks...
...(Pixel, Position and Size, Alpha Channel) are enabled.

gimp_edit_selection_tool_translate(): add checks for locks and bail
out with a message if the item is NULL or locked.

gimp_move_tool_button_press(): refactor NULL and lock checks to look
more like the new code added above, and also check "lock-content" of
channels and masks: moving them changes their pixels.
2018-04-18 20:41:54 +02:00
Ell 68e37f28c2 Bug 793373 - Crash when ctrl-alt-clicking, dragging then releasing...
... a selection.

The crash was the result of an unmatched gimp_item_end_move() call,
which is an error.  Add the matching gimp_item_start_move() call
when starting to drag a selection in GimpEditSelectionTool.  Revert
last commit, so that unmatched gimp_layer_end_move() calls are not
silently ignored, and add a check instead.
2018-02-12 05:18:26 -05:00
Ell 02a20c6c73 app: add gimp_item_{start,end}_move()
Add gimp_item_{start,end}_move(), and corresponding
GimpItem::{start,end}_move() virtual functions, which should be
called before/after "moving" the item (i.e., translating, scaling,
resizing, flipping, rotating, or transforming the item).  Moves
performed between the outermost pair of start/end calls are treated
atomically.

What exactly does "treated atomically" entail depends on the
subclasses -- GimpItem doesn't provide a default implementation for
these functions, so the current commit doesn't change any behavior.
The next commit, which adds layer-mask support for group layers,
uses the functions to avoid cropping the mask too early while a
child is moving.

GimpItem calls {start,end}_move() in the various "move" functions
(gimp_item_{translate,scale,...}(), before performing the actual
operation.  Additionally we call the functions in the
gimp_image_item_list_foo() functions, for each participating item,
so that the items are moved as a unit.  We call the functions in
the various gimp_image_remove_foo() functions, since removing an
item may affect the size of its ancestors, and is therefore akin to
moving.  We also call the functions in GimpEditSelectionTool, so
that the move tool moves items atomically while dragging.
2018-02-05 12:08:54 -05:00
Ell 984ed6cefd app: constrain line angles in display space, not image space
Add an offset_angle parameter to gimp_constrain_line(), which
offsets the radial lines by a given angle.

Add gimpdisplayshell-utils.[ch], with two new functions:

  - gimp_display_shell_get_constrained_line_offset_angle():
    Returns the offset angle to be passed to
    gimp_constrain_line(), in order to constrain line angles in
    display space, according to the shell's rotation angle and
    flip mode.

  - gimp_display_shell_constrain_line():  A convenience function
    which calls gimp_constrain_line() with the said offset angle.

Use the new functions in all instances where we constrain line
angles, so that angles are constrained in display space, rather
than image space.

The only exception is GimpEditSelectionTool, which keeps
constraining angles in image space, since it's not entirely obvious
that we want to constrain angles of dragged layers/selections in
display space.
2017-12-22 06:32:24 -05:00
Ell bf8b2f2e6b app: avoid CRITICAL when moving empty floating selection 2017-12-07 08:39:13 -05:00
Michael Natterer a5e1dd84fd app: implement GimpToolActiveModifiers in GimpTool
Change gimp_tool_set_active_modifier_state() to honor the new
GimpToolControlSetting. Explicitly set the mode to SEPARATE in
all tools that require modifier keys during a stroke.

And here comes the actual fix: change GimpTransformTool and
GimpToolTransformGrid to use SAME mode, and remove their
active_modifer_key() and hover_modifier() impls, so it makes no
difference whether a modifier is pressed before of after mouse button
press/release.
2017-10-29 16:42:53 +01:00
Michael Natterer 5ce223b552 app: cleanup in GimpEditSelectionTool
Rename and reorder members to be more clear. Move variables to local
scopes. Minor code reorganization.
2016-10-23 17:49:47 +02:00
Michael Natterer 7ec04e4afe app: get rid of hardcoding GDK_SHIFT_MASK in tools/
gimp_suggest_modifiers(): change "shift_format" and "control_format"
parameters to "extend_selection_format" and "toggle_behavior_format",
which fixes the longstanding problem that the function did the right
thing only by accident.

tools: use gimp_get_extend_selection_mask() instead of GDK_SHIFT_MASK
which is not 100% semantically correct in all cases, but at least a
step in the right direction to make the tool modifiers easier to
improve.
2015-10-17 15:31:08 +02:00
Michael Natterer 4c2edf1841 app: use gimp_image_item_list_bounds() in GimpEditSelectionTool
the code was duplicated 4 times. Also merge the layer and vectors
cases for finding bounding boxes into one, they are the same now.
2015-07-03 19:38:08 +02:00
Michael Natterer e90e90265b app: port everything from gimp_channel_bounds() to gimp_item_bounds()
except gimpchannel.c itself.
2015-07-03 19:38:08 +02:00
Michael Natterer 7e90a3e4e5 app: use gimp_item_bounds() instead of gimp_vectors_bounds() 2015-07-03 19:38:06 +02:00
Michael Natterer bc525f39ee app: factor out a function in GimpEditSelectionTool, and move one around 2015-07-03 19:38:06 +02:00
Michael Natterer 7d220a56e0 app: free GimpEditSelectionTool's stuff in finalize() 2015-07-03 12:27:08 +02:00
Michael Natterer 3d7af8a184 app: remove the "exclude" paameter from gimp_image_item_list_get_list()
and from gimp_image_item_list_filter(). After the fixes for bug 735906
it's no longer needed, and it was harmful.
2015-06-28 23:49:47 +02:00
Michael Natterer 358f13f5b8 Bug 735906 - Transform tools give unexpected results when transforming...
...certain sets of linked layers

Fix the move tool (GimpEditSelectionTool) using the same principle
as the other "linked item" features, just a bit more complicated...

Never translate the active item and its linked items separately,
always translate the entire list at once.

The linked logic was distributed across the entire file. Changed the
code to prepare lists of items that are translated live (layers and
vectors), and items that are translated at the end (channels, masks
and the selection). In the motion and button release functions, simply
use the prepared lists without any further duplicated checking.

Also clean up the stuff a bit, there is more cleanup needed but first
the fix...
2015-06-27 12:34:19 +02:00
Michael Natterer 3c706d00c6 Bug 735906 - Transform tools give unexpected results when transforming...
...certain sets of linked layers

Fix for translating layers from the PDB, and with the cursor keys
for gimpeditselectiontool. Moving layers with the mouse is still broken.

The approach is exactly the same as in 25a696c7.
2015-06-26 12:00:45 +02:00
Michael Natterer 6d6efbbf8b app: remove "remove_children" parameter from gimp_image_item_list_filter()
It was always TRUE. The function should be renamed now, but not until
the merging of linked item fixes to 2-8 is done.
2015-06-20 21:59:37 +02:00
Michael Natterer 64b24d169d app: remove "remove_locked" parameter from gimp_image_item_list_filter()
This is just removal of unused code before fixing bug 735906.
2015-06-20 16:03:40 +02:00
Michael Natterer 2068c61a85 Bug 730862 - Preview frozen while dragging selection tools...
...(crop, rectangle, etc) in large image zoomed-to-fit

Default to GIMP_MOTION_MODE_COMPRESS in all tools, and override it to
GIMP_MOTION_MODE_EXACT if the tool really needs the exact path of
motion events. This greatly reduces the events processed by the
rectangle tools and makes them much more responsive.
2014-06-02 20:55:33 +02:00
Jehan c7aa623a55 app: clean out a big bunch of leading tabs.
For some unknown reason, most calls to gimp_message_literal() were
indented with tabs.
2013-09-15 04:59:20 +12:00
Michael Natterer 2c62644f94 app: BoundSeg -> GimpBoundSeg, boundary_foo() -> gimp_boundary_foo() 2012-05-02 17:46:02 +02:00
Michael Natterer 9323c2f28c app: move base/boundary.[ch] to core/gimpboundary.[ch]
No other changes yet, just make the move build.
2012-05-02 17:46:02 +02:00
Michael Natterer 57dd302ee8 app: don't redundantly set GimpToolControl->scroll_lock to FALSE 2011-12-10 23:15:03 +01:00
Michael Natterer 38b8f0596d app: use the new modifier API instead of constants in all tools
There are still many uses of literal SHIFT and MOD1 left, but all uses
of CONTROL are gone. Should work exactly as before on Win/X11, and
still has some glitches on OSX.
2011-10-06 21:59:07 +02:00
Michael Natterer 9778b6a440 app: GimpEditSelectionTool: activate the tool *after* pushing it
because pushing sets its focus_display which is now only possible
while the a tool is not active.
2011-04-06 20:33:23 +02:00
Michael Natterer 492e0f9cfd app: some more mostly cosmetic tool cleanup 2011-04-04 08:19:12 +02:00
Michael Natterer 3d2fb51a63 app: GimpEditSelectionTool: call control_halt() in button_release()
Just for consistency, the tool is destroyed at the end of
button_release() anyway.
2011-03-30 12:08:38 +02:00
Michael Natterer 7c60bb5181 app: use more of the new GDK_KEY_foo key names
and move the compat defines from display-enums.h to widgets-enums.h
2011-03-29 17:24:08 +02:00
Michael Natterer 3f6a70f7fe app: define one more standard tool handle size 2010-11-08 22:48:50 +01:00
Michael Natterer 22db39afd2 app: fix incomplete earlier s/GtkAnchorType/GimpHandleAnchor/ change 2010-10-18 20:13:09 +02:00
Michael Natterer 3de4d7263a app: Bug 631619 - Drawing artifacts spread by paintbrush outline on canvas
Add a transform matrix to GimpCanvasBoundary and get rid of the whole
BoundSeg transform code in boundary.c and gimpbrushcore.c, it was
impossible to get this right on that level. Also fix te extents of
GimpCanvasBoundary os it leaves no artifacts.
2010-10-09 22:00:19 +02:00
Michael Natterer 545e65dda6 app: add gimp_display_shell_selection_pause() and _resume()
and use them instead of gimp_display_shell_selection_control() with
the resp. enum values. Remove the GIMP_SELECTION_PAUSE and _RESUME
enums values and thus the presence of this concept in the core.
2010-10-09 14:26:33 +02:00
Michael Natterer 06da10bc08 app: change boundary drawing by tools to work like the selection
- GimpCanvasBoundary takes unsorted BoundSeg arrays now and uses
  gimp_display_shell_transform_boundary() and gimp_cairo_add_boundary().
- Nobody calls boundary_sort() any longer for the purpose of displaying
  a boundary.
- gimp_display_shell_transform_boundary() got offset parameters
  so it can transform things that are not in the image's coordinate
  system.
2010-09-26 22:41:04 +02:00
Michael Natterer b3af235e79 app: rename all gimp_draw_tool_draw_foo() functions
to gimp_draw_tool_add_foo() because that's what they do now.
2010-09-25 19:02:22 +02:00
Michael Natterer 313f8bee1e app: remove "gboolean use_cairo" from the draw tool again
It's always TRUE now.
2010-09-24 21:14:49 +02:00
Michael Natterer a75b298946 app: enable cairo drawing for the edit selection tool 2010-09-23 23:47:20 +02:00
Michael Natterer 4d0c750327 app: get rid of "gboolean use_offsets" in the draw tool
and always pass image coordinates. Transform the coords manually in
the very few places which passed TRUE.
2010-09-23 19:23:27 +02:00