tools: Crop Tool is conditionally destructive
Resolves #15418 Destructive tools can not be used on non-raster layers (vector, text, link). However, the Crop Tool is only destructive when "Delete Pixels" option is enabled - otherwise it just crops the canvas size. This patch toggles the GimpTool classes' "is_destructive" setting based on the value of "Delete Pixels".
This commit is contained in:
parent
d46d90283f
commit
540fe925f1
1 changed files with 12 additions and 2 deletions
|
|
@ -165,7 +165,9 @@ gimp_crop_tool_init (GimpCropTool *crop_tool)
|
|||
static void
|
||||
gimp_crop_tool_constructed (GObject *object)
|
||||
{
|
||||
GimpCropTool *crop_tool = GIMP_CROP_TOOL (object);
|
||||
GimpTool *tool = GIMP_TOOL (object);
|
||||
GimpCropTool *crop_tool = GIMP_CROP_TOOL (tool);
|
||||
GimpCropOptions *options = GIMP_CROP_TOOL_GET_OPTIONS (crop_tool);
|
||||
GimpContext *context;
|
||||
GimpToolInfo *tool_info;
|
||||
|
||||
|
|
@ -186,6 +188,9 @@ gimp_crop_tool_constructed (GObject *object)
|
|||
gimp_crop_tool_image_changed (crop_tool,
|
||||
gimp_context_get_image (context),
|
||||
context);
|
||||
|
||||
/* The Crop Tool is only destructive when "Delete Pixels" is enabled */
|
||||
GIMP_TOOL_GET_CLASS (tool)->is_destructive = options->delete_pixels;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -302,7 +307,8 @@ gimp_crop_tool_options_notify (GimpTool *tool,
|
|||
GimpToolOptions *options,
|
||||
const GParamSpec *pspec)
|
||||
{
|
||||
GimpCropTool *crop_tool = GIMP_CROP_TOOL (tool);
|
||||
GimpCropTool *crop_tool = GIMP_CROP_TOOL (tool);
|
||||
GimpCropOptions *crop_options = GIMP_CROP_TOOL_GET_OPTIONS (crop_tool);
|
||||
|
||||
if (! strcmp (pspec->name, "layer-only") ||
|
||||
! strcmp (pspec->name, "allow-growing"))
|
||||
|
|
@ -317,6 +323,10 @@ gimp_crop_tool_options_notify (GimpTool *tool,
|
|||
gimp_crop_tool_update_option_defaults (crop_tool, FALSE);
|
||||
}
|
||||
}
|
||||
else if (! strcmp (pspec->name, "delete-pixels"))
|
||||
{
|
||||
GIMP_TOOL_GET_CLASS (tool)->is_destructive = crop_options->delete_pixels;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Reference in a new issue