gimp/gimp-2.8.2-crop-to-selection.patch

168 lines
8.1 KiB
Diff
Raw Normal View History

From 84ccbe56d09ac1dc8b5e56fef2adebcf2cb27766 Mon Sep 17 00:00:00 2001
From: Nils Philippsen <nils@redhat.com>
Date: Tue, 13 Nov 2012 16:41:28 +0100
Subject: [PATCH] patch: crop-to-selection
Squashed commit of the following:
commit 44d0c6393a92b1e5b1ce361ed5240ec669c1972b
Author: Michael Natterer <mitch@gimp.org>
Date: Thu Sep 6 23:55:35 2012 +0200
Bug 683462 - cropping with rectangular select tool leaves misaligned...
Reset the tool on image changes again, but not if only the active
drawable changes, so keep bug #678890 closed:
Introduce new dirty flag GIMP_DIRTY_ACTIVE_DRAWABLE and set it on all
tools' dirty_mask except for rect select. Check the new flag when
reseting the active tool because of a drawable change.
(cherry picked from commit e546f2b43bbe77901516c780428bda40f5af26ba)
(cherry picked from commit f3a4200e7287971f700194d596efd3eaeae36b72)
---
app/core/core-enums.c | 2 ++
app/core/core-enums.h | 1 +
app/display/gimpdisplayshell-tool-events.c | 4 +++-
app/tools/gimpcagetool.c | 3 ++-
app/tools/gimpforegroundselecttool.c | 4 +++-
app/tools/gimpimagemaptool.c | 3 ++-
app/tools/gimpiscissorstool.c | 4 +++-
app/tools/gimprectangleselecttool.c | 1 +
app/tools/gimptransformtool.c | 3 ++-
9 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/app/core/core-enums.c b/app/core/core-enums.c
index cf6e9ce..bba0a95 100644
--- a/app/core/core-enums.c
+++ b/app/core/core-enums.c
@@ -941,6 +941,7 @@ gimp_dirty_mask_get_type (void)
{ GIMP_DIRTY_DRAWABLE, "GIMP_DIRTY_DRAWABLE", "drawable" },
{ GIMP_DIRTY_VECTORS, "GIMP_DIRTY_VECTORS", "vectors" },
{ GIMP_DIRTY_SELECTION, "GIMP_DIRTY_SELECTION", "selection" },
+ { GIMP_DIRTY_ACTIVE_DRAWABLE, "GIMP_DIRTY_ACTIVE_DRAWABLE", "active-drawable" },
{ GIMP_DIRTY_ALL, "GIMP_DIRTY_ALL", "all" },
{ 0, NULL, NULL }
};
@@ -957,6 +958,7 @@ gimp_dirty_mask_get_type (void)
{ GIMP_DIRTY_DRAWABLE, "GIMP_DIRTY_DRAWABLE", NULL },
{ GIMP_DIRTY_VECTORS, "GIMP_DIRTY_VECTORS", NULL },
{ GIMP_DIRTY_SELECTION, "GIMP_DIRTY_SELECTION", NULL },
+ { GIMP_DIRTY_ACTIVE_DRAWABLE, "GIMP_DIRTY_ACTIVE_DRAWABLE", NULL },
{ GIMP_DIRTY_ALL, "GIMP_DIRTY_ALL", NULL },
{ 0, NULL, NULL }
};
diff --git a/app/core/core-enums.h b/app/core/core-enums.h
index e2edea3..ce62aa5 100644
--- a/app/core/core-enums.h
+++ b/app/core/core-enums.h
@@ -449,6 +449,7 @@ typedef enum /*< pdb-skip >*/
GIMP_DIRTY_DRAWABLE = 1 << 6,
GIMP_DIRTY_VECTORS = 1 << 7,
GIMP_DIRTY_SELECTION = 1 << 8,
+ GIMP_DIRTY_ACTIVE_DRAWABLE = 1 << 9,
GIMP_DIRTY_ALL = 0xffff
} GimpDirtyMask;
diff --git a/app/display/gimpdisplayshell-tool-events.c b/app/display/gimpdisplayshell-tool-events.c
index 6b8df80..d9d2176 100644
--- a/app/display/gimpdisplayshell-tool-events.c
+++ b/app/display/gimpdisplayshell-tool-events.c
@@ -1686,7 +1686,9 @@ gimp_display_shell_initialize_tool (GimpDisplayShell *shell,
}
else if ((active_tool->drawable !=
gimp_image_get_active_drawable (image)) &&
- ! gimp_tool_control_get_preserve (active_tool->control))
+ (! gimp_tool_control_get_preserve (active_tool->control) &&
+ (gimp_tool_control_get_dirty_mask (active_tool->control) &
+ GIMP_DIRTY_ACTIVE_DRAWABLE)))
{
/* create a new one, deleting the current */
gimp_context_tool_changed (gimp_get_user_context (gimp));
diff --git a/app/tools/gimpcagetool.c b/app/tools/gimpcagetool.c
index fe0e1a9..806f089 100644
--- a/app/tools/gimpcagetool.c
+++ b/app/tools/gimpcagetool.c
@@ -184,7 +184,8 @@ gimp_cage_tool_init (GimpCageTool *self)
GIMP_DIRTY_IMAGE |
GIMP_DIRTY_IMAGE_STRUCTURE |
GIMP_DIRTY_DRAWABLE |
- GIMP_DIRTY_SELECTION);
+ GIMP_DIRTY_SELECTION |
+ GIMP_DIRTY_ACTIVE_DRAWABLE);
gimp_tool_control_set_wants_click (tool->control, TRUE);
gimp_tool_control_set_tool_cursor (tool->control,
GIMP_TOOL_CURSOR_PERSPECTIVE);
diff --git a/app/tools/gimpforegroundselecttool.c b/app/tools/gimpforegroundselecttool.c
index ec909f9..b320a2b 100644
--- a/app/tools/gimpforegroundselecttool.c
+++ b/app/tools/gimpforegroundselecttool.c
@@ -183,7 +183,9 @@ gimp_foreground_select_tool_init (GimpForegroundSelectTool *fg_select)
gimp_tool_control_set_scroll_lock (tool->control, FALSE);
gimp_tool_control_set_preserve (tool->control, FALSE);
- gimp_tool_control_set_dirty_mask (tool->control, GIMP_DIRTY_IMAGE_SIZE);
+ gimp_tool_control_set_dirty_mask (tool->control,
+ GIMP_DIRTY_IMAGE_SIZE |
+ GIMP_DIRTY_ACTIVE_DRAWABLE);
gimp_tool_control_set_precision (tool->control,
GIMP_CURSOR_PRECISION_PIXEL_CENTER);
gimp_tool_control_set_tool_cursor (tool->control,
diff --git a/app/tools/gimpimagemaptool.c b/app/tools/gimpimagemaptool.c
index c168dfc..1b7ef06 100644
--- a/app/tools/gimpimagemaptool.c
+++ b/app/tools/gimpimagemaptool.c
@@ -201,7 +201,8 @@ gimp_image_map_tool_init (GimpImageMapTool *image_map_tool)
GIMP_DIRTY_IMAGE |
GIMP_DIRTY_IMAGE_STRUCTURE |
GIMP_DIRTY_DRAWABLE |
- GIMP_DIRTY_SELECTION);
+ GIMP_DIRTY_SELECTION |
+ GIMP_DIRTY_ACTIVE_DRAWABLE);
image_map_tool->drawable = NULL;
image_map_tool->operation = NULL;
diff --git a/app/tools/gimpiscissorstool.c b/app/tools/gimpiscissorstool.c
index 8392fea..f795f0a 100644
--- a/app/tools/gimpiscissorstool.c
+++ b/app/tools/gimpiscissorstool.c
@@ -328,7 +328,9 @@ gimp_iscissors_tool_init (GimpIscissorsTool *iscissors)
gimp_tool_control_set_scroll_lock (tool->control, TRUE);
gimp_tool_control_set_snap_to (tool->control, FALSE);
gimp_tool_control_set_preserve (tool->control, FALSE);
- gimp_tool_control_set_dirty_mask (tool->control, GIMP_DIRTY_IMAGE_SIZE);
+ gimp_tool_control_set_dirty_mask (tool->control,
+ GIMP_DIRTY_IMAGE_SIZE |
+ GIMP_DIRTY_ACTIVE_DRAWABLE);
gimp_tool_control_set_tool_cursor (tool->control, GIMP_TOOL_CURSOR_ISCISSORS);
iscissors->op = ISCISSORS_OP_NONE;
diff --git a/app/tools/gimprectangleselecttool.c b/app/tools/gimprectangleselecttool.c
index 50d9852..3dcd2d3 100644
--- a/app/tools/gimprectangleselecttool.c
+++ b/app/tools/gimprectangleselecttool.c
@@ -229,6 +229,7 @@ gimp_rectangle_select_tool_init (GimpRectangleSelectTool *rect_sel_tool)
GIMP_CURSOR_PRECISION_PIXEL_BORDER);
gimp_tool_control_set_tool_cursor (tool->control,
GIMP_TOOL_CURSOR_RECT_SELECT);
+ gimp_tool_control_set_preserve (tool->control, FALSE);
gimp_tool_control_set_dirty_mask (tool->control,
GIMP_DIRTY_IMAGE_SIZE |
GIMP_DIRTY_SELECTION);
diff --git a/app/tools/gimptransformtool.c b/app/tools/gimptransformtool.c
index 4c41232..bd37efb 100644
--- a/app/tools/gimptransformtool.c
+++ b/app/tools/gimptransformtool.c
@@ -201,7 +201,8 @@ gimp_transform_tool_init (GimpTransformTool *tr_tool)
gimp_tool_control_set_dirty_mask (tool->control,
GIMP_DIRTY_IMAGE_SIZE |
GIMP_DIRTY_DRAWABLE |
- GIMP_DIRTY_SELECTION);
+ GIMP_DIRTY_SELECTION |
+ GIMP_DIRTY_ACTIVE_DRAWABLE);
gimp_tool_control_set_precision (tool->control,
GIMP_CURSOR_PRECISION_SUBPIXEL);
--
1.7.11.7