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.
This commit is contained in:
Michael Natterer 2012-09-06 23:55:35 +02:00
parent 96ce2c936d
commit e546f2b43b
9 changed files with 19 additions and 6 deletions

View File

@ -1226,6 +1226,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 }
};
@ -1242,6 +1243,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 }
};

View File

@ -571,6 +571,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;

View File

@ -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));

View File

@ -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);

View File

@ -185,7 +185,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,

View File

@ -211,7 +211,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;

View File

@ -340,7 +340,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;

View File

@ -227,6 +227,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);

View File

@ -215,7 +215,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);