mirror of https://github.com/GNOME/gimp.git
app/tools: Allow locked layers to be used as sources
GimpSourceTools like Clone and Heal use GimpPaintTool's code for determining if they can work on a pixel-locked layer. This means that they can not set a locked layer as a source even though that would not affect the locked layer's pixels. This patch adds an additional condition to GimpPaintTool, to allow operations if the tool is a GimpSourceTool AND only Ctrl is held down. This allows the layer to be set as a source while preventing it from being drawn on.
This commit is contained in:
parent
05b470eba7
commit
134100fb8a
|
@ -53,6 +53,7 @@
|
|||
#include "gimppaintoptions-gui.h"
|
||||
#include "gimppainttool.h"
|
||||
#include "gimppainttool-paint.h"
|
||||
#include "gimpsourcetool.h"
|
||||
#include "gimptoolcontrol.h"
|
||||
#include "gimptools-utils.h"
|
||||
|
||||
|
@ -324,6 +325,13 @@ gimp_paint_tool_button_press (GimpTool *tool,
|
|||
}
|
||||
|
||||
if (gimp_item_is_content_locked (GIMP_ITEM (drawable), &locked_item))
|
||||
{
|
||||
gboolean constrain_only;
|
||||
|
||||
/* Allow pixel-locked layers to be set as sources */
|
||||
constrain_only = (state & gimp_get_constrain_behavior_mask () &&
|
||||
! (state & gimp_get_extend_selection_mask ()));
|
||||
if (! (GIMP_IS_SOURCE_TOOL (tool) && constrain_only))
|
||||
{
|
||||
gimp_tool_message_literal (tool, display,
|
||||
_("The selected item's pixels are locked."));
|
||||
|
@ -332,6 +340,7 @@ gimp_paint_tool_button_press (GimpTool *tool,
|
|||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (! gimp_paint_tool_check_alpha (paint_tool, drawable, display, &error))
|
||||
{
|
||||
|
@ -560,12 +569,21 @@ gimp_paint_tool_cursor_update (GimpTool *tool,
|
|||
! gimp_paint_tool_check_alpha (paint_tool, drawable, display, NULL) ||
|
||||
! (gimp_item_is_visible (GIMP_ITEM (drawable)) ||
|
||||
config->edit_non_visible))
|
||||
{
|
||||
gboolean constrain_only;
|
||||
|
||||
/* Allow pixel-locked layers to be set as sources */
|
||||
constrain_only = (state & gimp_get_constrain_behavior_mask () &&
|
||||
! (state & gimp_get_extend_selection_mask ()));
|
||||
|
||||
if (! (GIMP_IS_SOURCE_TOOL (tool) && constrain_only))
|
||||
{
|
||||
modifier = GIMP_CURSOR_MODIFIER_BAD;
|
||||
toggle_modifier = GIMP_CURSOR_MODIFIER_BAD;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
g_list_free (drawables);
|
||||
|
||||
|
|
Loading…
Reference in New Issue