mirror of https://github.com/GNOME/gimp.git
app: properly blink the right locked layer when pixels are locked.
In particular, if painting on a layer whose parent's pixels are locked, we were blinking an empty lock spot, which is confusing. Now gimp_item_is_content_locked() will also return the proper item (when relevant, i.e. when returning TRUE) which is locked. It may or may not the same item as passed in (it may also be a parent item in particular).
This commit is contained in:
parent
957b547fac
commit
e72f5614da
|
@ -194,7 +194,7 @@ drawable_actions_update (GimpActionGroup *group,
|
|||
|
||||
locked = gimp_item_get_lock_content (item);
|
||||
can_lock = gimp_item_can_lock_content (item);
|
||||
writable = ! gimp_item_is_content_locked (item);
|
||||
writable = ! gimp_item_is_content_locked (item, NULL);
|
||||
locked_pos = gimp_item_get_lock_position (item);
|
||||
can_lock_pos = gimp_item_can_lock_position (item);
|
||||
movable = ! gimp_item_is_position_locked (item);
|
||||
|
|
|
@ -306,7 +306,7 @@ edit_actions_update (GimpActionGroup *group,
|
|||
if (! gimp_viewable_get_children (GIMP_VIEWABLE (iter->data)))
|
||||
have_no_groups = TRUE;
|
||||
|
||||
if (! gimp_item_is_content_locked (GIMP_ITEM (iter->data)))
|
||||
if (! gimp_item_is_content_locked (GIMP_ITEM (iter->data), NULL))
|
||||
have_writable = TRUE;
|
||||
|
||||
if (have_no_groups && have_writable)
|
||||
|
|
|
@ -512,7 +512,7 @@ edit_clear_cmd_callback (GimpAction *action,
|
|||
|
||||
for (iter = drawables; iter; iter = iter->next)
|
||||
if (! gimp_viewable_get_children (GIMP_VIEWABLE (iter->data)) &&
|
||||
! gimp_item_is_content_locked (GIMP_ITEM (iter->data)))
|
||||
! gimp_item_is_content_locked (GIMP_ITEM (iter->data), NULL))
|
||||
gimp_drawable_edit_clear (iter->data, action_data_get_context (data));
|
||||
|
||||
gimp_image_undo_group_end (image);
|
||||
|
@ -653,7 +653,7 @@ edit_paste (GimpDisplay *display,
|
|||
_("Pasted as new layer because the "
|
||||
"target is a layer group."));
|
||||
}
|
||||
else if (gimp_item_is_content_locked (GIMP_ITEM (drawable)))
|
||||
else if (gimp_item_is_content_locked (GIMP_ITEM (drawable), NULL))
|
||||
{
|
||||
gimp_message_literal (display->gimp, G_OBJECT (display),
|
||||
GIMP_MESSAGE_INFO,
|
||||
|
|
|
@ -891,7 +891,7 @@ filters_actions_update (GimpActionGroup *group,
|
|||
else
|
||||
item = GIMP_ITEM (drawable);
|
||||
|
||||
writable = ! gimp_item_is_content_locked (item);
|
||||
writable = ! gimp_item_is_content_locked (item, NULL);
|
||||
|
||||
if (gimp_viewable_get_children (GIMP_VIEWABLE (drawable)))
|
||||
writable = FALSE;
|
||||
|
|
|
@ -185,7 +185,7 @@ gimp_gegl_procedure_get_sensitive (GimpProcedure *procedure,
|
|||
else
|
||||
item = GIMP_ITEM (drawable);
|
||||
|
||||
sensitive = ! gimp_item_is_content_locked (item);
|
||||
sensitive = ! gimp_item_is_content_locked (item, NULL);
|
||||
|
||||
if (gimp_viewable_get_children (GIMP_VIEWABLE (drawable)))
|
||||
sensitive = FALSE;
|
||||
|
|
|
@ -836,7 +836,7 @@ layers_actions_update (GimpActionGroup *group,
|
|||
else
|
||||
have_no_groups = TRUE;
|
||||
|
||||
if (! gimp_item_is_content_locked (GIMP_ITEM (iter->data)))
|
||||
if (! gimp_item_is_content_locked (GIMP_ITEM (iter->data), NULL))
|
||||
have_writable = TRUE;
|
||||
else
|
||||
all_writable = FALSE;
|
||||
|
@ -889,7 +889,7 @@ layers_actions_update (GimpActionGroup *group,
|
|||
/* "next_visible" is actually "next_visible" and
|
||||
* "writable" and "not group"
|
||||
*/
|
||||
if (gimp_item_is_content_locked (next_visible->data) ||
|
||||
if (gimp_item_is_content_locked (next_visible->data, NULL) ||
|
||||
gimp_viewable_get_children (next_visible->data))
|
||||
next_visible = NULL;
|
||||
|
||||
|
|
|
@ -1458,7 +1458,7 @@ layers_mask_apply_cmd_callback (GimpAction *action,
|
|||
if (gimp_layer_get_mask (iter->data) &&
|
||||
(mode != GIMP_MASK_APPLY ||
|
||||
(! gimp_viewable_get_children (GIMP_VIEWABLE (iter->data)) &&
|
||||
! gimp_item_is_content_locked (GIMP_ITEM (iter->data)))))
|
||||
! gimp_item_is_content_locked (GIMP_ITEM (iter->data), NULL))))
|
||||
break;
|
||||
}
|
||||
if (iter == NULL)
|
||||
|
@ -1490,7 +1490,7 @@ layers_mask_apply_cmd_callback (GimpAction *action,
|
|||
{
|
||||
if (mode == GIMP_MASK_APPLY &&
|
||||
(gimp_viewable_get_children (GIMP_VIEWABLE (iter->data)) ||
|
||||
gimp_item_is_content_locked (GIMP_ITEM (iter->data))))
|
||||
gimp_item_is_content_locked (GIMP_ITEM (iter->data), NULL)))
|
||||
/* Layer groups cannot apply masks. Neither can
|
||||
* content-locked layers.
|
||||
*/
|
||||
|
|
|
@ -170,7 +170,7 @@ select_actions_update (GimpActionGroup *group,
|
|||
|
||||
for (iter = drawables; iter; iter = iter->next)
|
||||
{
|
||||
if (gimp_item_is_content_locked (iter->data))
|
||||
if (gimp_item_is_content_locked (iter->data, NULL))
|
||||
all_writable = FALSE;
|
||||
|
||||
if (gimp_viewable_get_children (iter->data))
|
||||
|
@ -182,7 +182,7 @@ select_actions_update (GimpActionGroup *group,
|
|||
|
||||
if (drawable)
|
||||
{
|
||||
writable = ! gimp_item_is_content_locked (GIMP_ITEM (drawable));
|
||||
writable = ! gimp_item_is_content_locked (GIMP_ITEM (drawable), NULL);
|
||||
|
||||
if (gimp_viewable_get_children (GIMP_VIEWABLE (drawable)))
|
||||
children = TRUE;
|
||||
|
|
|
@ -396,7 +396,7 @@ vectors_actions_update (GimpActionGroup *group,
|
|||
|
||||
if (drawable)
|
||||
{
|
||||
dr_writable = ! gimp_item_is_content_locked (GIMP_ITEM (drawable));
|
||||
dr_writable = ! gimp_item_is_content_locked (GIMP_ITEM (drawable), NULL);
|
||||
|
||||
if (gimp_viewable_get_children (GIMP_VIEWABLE (drawable)))
|
||||
dr_children = TRUE;
|
||||
|
|
|
@ -310,7 +310,7 @@ gimp_edit_paste_get_layers (GimpImage *image,
|
|||
*/
|
||||
if (! drawable ||
|
||||
gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) ||
|
||||
gimp_item_is_content_locked (GIMP_ITEM (drawable)))
|
||||
gimp_item_is_content_locked (GIMP_ITEM (drawable), NULL))
|
||||
{
|
||||
if (gimp_edit_paste_is_in_place (*paste_type))
|
||||
*paste_type = GIMP_PASTE_TYPE_NEW_LAYER_IN_PLACE;
|
||||
|
|
|
@ -122,7 +122,7 @@ gimp_image_crop (GimpImage *image,
|
|||
|
||||
gimp_item_translate (item, -x, -y, TRUE);
|
||||
|
||||
if (crop_layers && ! gimp_item_is_content_locked (item))
|
||||
if (crop_layers && ! gimp_item_is_content_locked (item, NULL))
|
||||
{
|
||||
gint off_x, off_y;
|
||||
gint lx1, ly1, lx2, ly2;
|
||||
|
|
|
@ -335,7 +335,7 @@ gimp_image_merge_down (GimpImage *image,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (gimp_item_is_content_locked (GIMP_ITEM (layer)))
|
||||
if (gimp_item_is_content_locked (GIMP_ITEM (layer), NULL))
|
||||
{
|
||||
g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
|
||||
_("The layer to merge down to is locked."));
|
||||
|
|
|
@ -125,7 +125,8 @@ static void gimp_item_get_property (GObject *object,
|
|||
static gint64 gimp_item_get_memsize (GimpObject *object,
|
||||
gint64 *gui_size);
|
||||
|
||||
static gboolean gimp_item_real_is_content_locked (GimpItem *item);
|
||||
static gboolean gimp_item_real_is_content_locked (GimpItem *item,
|
||||
GimpItem **locked_item);
|
||||
static gboolean gimp_item_real_is_position_locked (GimpItem *item);
|
||||
static gboolean gimp_item_real_is_visibility_locked (GimpItem *item);
|
||||
static gboolean gimp_item_real_bounds (GimpItem *item,
|
||||
|
@ -471,13 +472,17 @@ gimp_item_get_memsize (GimpObject *object,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gimp_item_real_is_content_locked (GimpItem *item)
|
||||
gimp_item_real_is_content_locked (GimpItem *item,
|
||||
GimpItem **locked_item)
|
||||
{
|
||||
GimpItem *parent = gimp_item_get_parent (item);
|
||||
|
||||
if (parent && gimp_item_is_content_locked (parent))
|
||||
if (parent && gimp_item_is_content_locked (parent, locked_item))
|
||||
return TRUE;
|
||||
|
||||
if (GET_PRIVATE (item)->lock_content && locked_item)
|
||||
*locked_item = item;
|
||||
|
||||
return GET_PRIVATE (item)->lock_content;
|
||||
}
|
||||
|
||||
|
@ -2460,11 +2465,12 @@ gimp_item_can_lock_content (GimpItem *item)
|
|||
}
|
||||
|
||||
gboolean
|
||||
gimp_item_is_content_locked (GimpItem *item)
|
||||
gimp_item_is_content_locked (GimpItem *item,
|
||||
GimpItem **locked_item)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_ITEM (item), FALSE);
|
||||
|
||||
return GIMP_ITEM_GET_CLASS (item)->is_content_locked (item);
|
||||
return GIMP_ITEM_GET_CLASS (item)->is_content_locked (item, locked_item);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -52,7 +52,8 @@ struct _GimpItemClass
|
|||
/* virtual functions */
|
||||
void (* unset_removed) (GimpItem *item);
|
||||
gboolean (* is_attached) (GimpItem *item);
|
||||
gboolean (* is_content_locked) (GimpItem *item);
|
||||
gboolean (* is_content_locked) (GimpItem *item,
|
||||
GimpItem **locked_item);
|
||||
gboolean (* is_position_locked) (GimpItem *item);
|
||||
gboolean (* is_visibility_locked) (GimpItem *item);
|
||||
GimpItemTree * (* get_tree) (GimpItem *item);
|
||||
|
@ -373,7 +374,8 @@ void gimp_item_set_lock_content (GimpItem *item,
|
|||
gboolean push_undo);
|
||||
gboolean gimp_item_get_lock_content (GimpItem *item);
|
||||
gboolean gimp_item_can_lock_content (GimpItem *item);
|
||||
gboolean gimp_item_is_content_locked (GimpItem *item);
|
||||
gboolean gimp_item_is_content_locked (GimpItem *item,
|
||||
GimpItem **locked_item);
|
||||
|
||||
void gimp_item_set_lock_position (GimpItem *item,
|
||||
gboolean lock_position,
|
||||
|
|
|
@ -36,7 +36,8 @@ static void gimp_layer_mask_preview_freeze (GimpViewable *
|
|||
static void gimp_layer_mask_preview_thaw (GimpViewable *viewable);
|
||||
|
||||
static gboolean gimp_layer_mask_is_attached (GimpItem *item);
|
||||
static gboolean gimp_layer_mask_is_content_locked (GimpItem *item);
|
||||
static gboolean gimp_layer_mask_is_content_locked (GimpItem *item,
|
||||
GimpItem **locked_item);
|
||||
static gboolean gimp_layer_mask_is_position_locked (GimpItem *item);
|
||||
static GimpItemTree * gimp_layer_mask_get_tree (GimpItem *item);
|
||||
static GimpItem * gimp_layer_mask_duplicate (GimpItem *item,
|
||||
|
@ -131,13 +132,14 @@ gimp_layer_mask_preview_thaw (GimpViewable *viewable)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gimp_layer_mask_is_content_locked (GimpItem *item)
|
||||
gimp_layer_mask_is_content_locked (GimpItem *item,
|
||||
GimpItem **locked_item)
|
||||
{
|
||||
GimpLayerMask *mask = GIMP_LAYER_MASK (item);
|
||||
GimpLayer *layer = gimp_layer_mask_get_layer (mask);
|
||||
|
||||
if (layer)
|
||||
return gimp_item_is_content_locked (GIMP_ITEM (layer));
|
||||
return gimp_item_is_content_locked (GIMP_ITEM (layer), locked_item);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -367,7 +367,7 @@ gimp_display_shell_dnd_fill (GimpDisplayShell *shell,
|
|||
return;
|
||||
}
|
||||
|
||||
if (gimp_item_is_content_locked (iter->data))
|
||||
if (gimp_item_is_content_locked (iter->data, NULL))
|
||||
{
|
||||
gimp_message_literal (shell->display->gimp, G_OBJECT (shell->display),
|
||||
GIMP_MESSAGE_ERROR,
|
||||
|
@ -499,7 +499,7 @@ gimp_display_shell_drop_buffer (GtkWidget *widget,
|
|||
|
||||
paste_type = GIMP_PASTE_TYPE_NEW_LAYER;
|
||||
}
|
||||
else if (gimp_item_is_content_locked (GIMP_ITEM (drawable)))
|
||||
else if (gimp_item_is_content_locked (GIMP_ITEM (drawable), NULL))
|
||||
{
|
||||
gimp_message_literal (shell->display->gimp, G_OBJECT (shell->display),
|
||||
GIMP_MESSAGE_ERROR,
|
||||
|
|
|
@ -538,19 +538,22 @@ gimp_tool_path_changed (GimpToolWidget *widget)
|
|||
static gboolean
|
||||
gimp_tool_path_check_writable (GimpToolPath *path)
|
||||
{
|
||||
GimpToolPathPrivate *private = path->private;
|
||||
GimpToolWidget *widget = GIMP_TOOL_WIDGET (path);
|
||||
GimpDisplayShell *shell = gimp_tool_widget_get_shell (widget);
|
||||
GimpToolPathPrivate *private = path->private;
|
||||
GimpToolWidget *widget = GIMP_TOOL_WIDGET (path);
|
||||
GimpDisplayShell *shell = gimp_tool_widget_get_shell (widget);
|
||||
GimpItem *locked_item = NULL;
|
||||
|
||||
if (gimp_item_is_content_locked (GIMP_ITEM (private->vectors)) ||
|
||||
if (gimp_item_is_content_locked (GIMP_ITEM (private->vectors), &locked_item) ||
|
||||
gimp_item_is_position_locked (GIMP_ITEM (private->vectors)))
|
||||
{
|
||||
gimp_tool_widget_message_literal (GIMP_TOOL_WIDGET (path),
|
||||
_("The active path is locked."));
|
||||
|
||||
if (locked_item == NULL)
|
||||
locked_item = GIMP_ITEM (private->vectors);
|
||||
|
||||
/* FIXME: this should really be done by the tool */
|
||||
gimp_tools_blink_lock_box (shell->display->gimp,
|
||||
GIMP_ITEM (private->vectors));
|
||||
gimp_tools_blink_lock_box (shell->display->gimp, locked_item);
|
||||
|
||||
private->function = VECTORS_FINISHED;
|
||||
|
||||
|
|
|
@ -584,7 +584,7 @@ gimp_pdb_item_is_modifiable (GimpItem *item,
|
|||
if ((modify & GIMP_PDB_ITEM_POSITION) && GIMP_IS_CHANNEL (item))
|
||||
modify |= GIMP_PDB_ITEM_CONTENT;
|
||||
|
||||
if ((modify & GIMP_PDB_ITEM_CONTENT) && gimp_item_is_content_locked (item))
|
||||
if ((modify & GIMP_PDB_ITEM_CONTENT) && gimp_item_is_content_locked (item, NULL))
|
||||
{
|
||||
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
|
||||
_("Item '%s' (%d) cannot be modified because its "
|
||||
|
|
|
@ -272,7 +272,7 @@ gimp_plug_in_handle_tile_put (GimpPlugIn *plug_in,
|
|||
}
|
||||
else
|
||||
{
|
||||
if (gimp_item_is_content_locked (GIMP_ITEM (drawable)))
|
||||
if (gimp_item_is_content_locked (GIMP_ITEM (drawable), NULL))
|
||||
{
|
||||
gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR,
|
||||
"Plug-in \"%s\"\n(%s)\n\n"
|
||||
|
|
|
@ -571,6 +571,7 @@ gimp_bucket_fill_tool_button_press (GimpTool *tool,
|
|||
GimpBucketFillOptions *options = GIMP_BUCKET_FILL_TOOL_GET_OPTIONS (tool);
|
||||
GimpGuiConfig *config = GIMP_GUI_CONFIG (display->gimp->config);
|
||||
GimpImage *image = gimp_display_get_image (display);
|
||||
GimpItem *locked_item = NULL;
|
||||
GList *drawables = gimp_image_get_selected_drawables (image);
|
||||
GimpDrawable *drawable;
|
||||
|
||||
|
@ -611,11 +612,11 @@ gimp_bucket_fill_tool_button_press (GimpTool *tool,
|
|||
return;
|
||||
}
|
||||
|
||||
if (gimp_item_is_content_locked (GIMP_ITEM (drawable)))
|
||||
if (gimp_item_is_content_locked (GIMP_ITEM (drawable), &locked_item))
|
||||
{
|
||||
gimp_tool_message_literal (tool, display,
|
||||
_("The active layer's pixels are locked."));
|
||||
gimp_tools_blink_lock_box (display->gimp, GIMP_ITEM (drawable));
|
||||
_("The selected layer's pixels are locked."));
|
||||
gimp_tools_blink_lock_box (display->gimp, locked_item);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -881,9 +882,9 @@ gimp_bucket_fill_tool_cursor_update (GimpTool *tool,
|
|||
if (g_list_length (drawables) == 1)
|
||||
drawable = drawables->data;
|
||||
|
||||
if (drawable &&
|
||||
! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
|
||||
! gimp_item_is_content_locked (GIMP_ITEM (drawable)) &&
|
||||
if (drawable &&
|
||||
! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
|
||||
! gimp_item_is_content_locked (GIMP_ITEM (drawable), NULL) &&
|
||||
(gimp_item_is_visible (GIMP_ITEM (drawable)) ||
|
||||
config->edit_non_visible))
|
||||
{
|
||||
|
|
|
@ -214,9 +214,10 @@ gimp_cage_tool_initialize (GimpTool *tool,
|
|||
GimpDisplay *display,
|
||||
GError **error)
|
||||
{
|
||||
GimpGuiConfig *config = GIMP_GUI_CONFIG (display->gimp->config);
|
||||
GimpImage *image = gimp_display_get_image (display);
|
||||
GList *drawables = gimp_image_get_selected_drawables (image);
|
||||
GimpGuiConfig *config = GIMP_GUI_CONFIG (display->gimp->config);
|
||||
GimpImage *image = gimp_display_get_image (display);
|
||||
GimpItem *locked_item = NULL;
|
||||
GList *drawables = gimp_image_get_selected_drawables (image);
|
||||
GimpDrawable *drawable;
|
||||
|
||||
if (g_list_length (drawables) != 1)
|
||||
|
@ -241,12 +242,12 @@ gimp_cage_tool_initialize (GimpTool *tool,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (gimp_item_is_content_locked (GIMP_ITEM (drawable)))
|
||||
if (gimp_item_is_content_locked (GIMP_ITEM (drawable), &locked_item))
|
||||
{
|
||||
g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
|
||||
_("The active layer's pixels are locked."));
|
||||
_("The selected item's pixels are locked."));
|
||||
if (error)
|
||||
gimp_tools_blink_lock_box (display->gimp, GIMP_ITEM (drawable));
|
||||
gimp_tools_blink_lock_box (display->gimp, locked_item);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -254,7 +255,7 @@ gimp_cage_tool_initialize (GimpTool *tool,
|
|||
! config->edit_non_visible)
|
||||
{
|
||||
g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
|
||||
_("The active layer is not visible."));
|
||||
_("The active item is not visible."));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -714,9 +715,9 @@ gimp_cage_tool_cursor_update (GimpTool *tool,
|
|||
drawable = drawables->data;
|
||||
g_list_free (drawables);
|
||||
|
||||
if (! drawable ||
|
||||
gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) ||
|
||||
gimp_item_is_content_locked (GIMP_ITEM (drawable)) ||
|
||||
if (! drawable ||
|
||||
gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) ||
|
||||
gimp_item_is_content_locked (GIMP_ITEM (drawable), NULL) ||
|
||||
! (gimp_item_is_visible (GIMP_ITEM (drawable)) ||
|
||||
config->edit_non_visible))
|
||||
{
|
||||
|
|
|
@ -461,7 +461,7 @@ gimp_crop_tool_commit (GimpCropTool *crop_tool)
|
|||
}
|
||||
|
||||
for (iter = layers; iter; iter = iter->next)
|
||||
if (! gimp_item_is_content_locked (GIMP_ITEM (iter->data)))
|
||||
if (! gimp_item_is_content_locked (GIMP_ITEM (iter->data), NULL))
|
||||
break;
|
||||
|
||||
if (iter == NULL)
|
||||
|
|
|
@ -987,6 +987,7 @@ gimp_edit_selection_tool_translate (GimpTool *tool,
|
|||
GdkModifierType extend_mask = gimp_get_extend_selection_mask ();
|
||||
const gchar *null_message = NULL;
|
||||
const gchar *locked_message = NULL;
|
||||
GimpItem *locked_item = NULL;
|
||||
GList *iter;
|
||||
gint velocity;
|
||||
|
||||
|
@ -1101,9 +1102,10 @@ gimp_edit_selection_tool_translate (GimpTool *tool,
|
|||
{
|
||||
locked_message = _("The active layer's position is locked.");
|
||||
}
|
||||
else if (gimp_item_is_content_locked (selected_items->data))
|
||||
else if (gimp_item_is_content_locked (selected_items->data,
|
||||
&locked_item))
|
||||
{
|
||||
locked_message = _("The active layer's pixels are locked.");
|
||||
locked_message = _("The selected layer's pixels are locked.");
|
||||
}
|
||||
}
|
||||
else if (GIMP_IS_CHANNEL (selected_items->data))
|
||||
|
@ -1114,7 +1116,7 @@ gimp_edit_selection_tool_translate (GimpTool *tool,
|
|||
|
||||
for (iter = selected_items; iter; iter = iter->next)
|
||||
if (! gimp_item_is_position_locked (iter->data) &&
|
||||
! gimp_item_is_content_locked (iter->data))
|
||||
! gimp_item_is_content_locked (iter->data, NULL))
|
||||
n_items++;
|
||||
|
||||
if (n_items == 0)
|
||||
|
@ -1159,8 +1161,12 @@ gimp_edit_selection_tool_translate (GimpTool *tool,
|
|||
else if (locked_message)
|
||||
{
|
||||
gimp_tool_message_literal (tool, display, locked_message);
|
||||
gimp_tools_blink_lock_box (display->gimp,
|
||||
active_item ? active_item : selected_items->data);
|
||||
|
||||
if (locked_item == NULL)
|
||||
locked_item = active_item ? active_item : selected_items->data;
|
||||
|
||||
gimp_tools_blink_lock_box (display->gimp, locked_item);
|
||||
|
||||
g_list_free (selected_items);
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -284,6 +284,7 @@ gimp_filter_tool_initialize (GimpTool *tool,
|
|||
GimpGuiConfig *config = GIMP_GUI_CONFIG (display->gimp->config);
|
||||
GimpImage *image = gimp_display_get_image (display);
|
||||
GimpDisplayShell *shell = gimp_display_get_shell (display);
|
||||
GimpItem *locked_item = NULL;
|
||||
GList *drawables = gimp_image_get_selected_drawables (image);
|
||||
GimpDrawable *drawable;
|
||||
|
||||
|
@ -309,12 +310,12 @@ gimp_filter_tool_initialize (GimpTool *tool,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (gimp_item_is_content_locked (GIMP_ITEM (drawable)))
|
||||
if (gimp_item_is_content_locked (GIMP_ITEM (drawable), &locked_item))
|
||||
{
|
||||
g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
|
||||
_("A selected layer's pixels are locked."));
|
||||
_("A selected item's pixels are locked."));
|
||||
if (error)
|
||||
gimp_tools_blink_lock_box (display->gimp, GIMP_ITEM (drawable));
|
||||
gimp_tools_blink_lock_box (display->gimp, locked_item);
|
||||
|
||||
g_list_free (drawables);
|
||||
return FALSE;
|
||||
|
|
|
@ -238,9 +238,10 @@ gimp_gradient_tool_initialize (GimpTool *tool,
|
|||
GimpDisplay *display,
|
||||
GError **error)
|
||||
{
|
||||
GimpImage *image = gimp_display_get_image (display);
|
||||
GimpGradientOptions *options = GIMP_GRADIENT_TOOL_GET_OPTIONS (tool);
|
||||
GimpGuiConfig *config = GIMP_GUI_CONFIG (display->gimp->config);
|
||||
GimpImage *image = gimp_display_get_image (display);
|
||||
GimpGradientOptions *options = GIMP_GRADIENT_TOOL_GET_OPTIONS (tool);
|
||||
GimpGuiConfig *config = GIMP_GUI_CONFIG (display->gimp->config);
|
||||
GimpItem *locked_item = NULL;
|
||||
GList *drawables;
|
||||
GimpDrawable *drawable;
|
||||
|
||||
|
@ -274,12 +275,12 @@ gimp_gradient_tool_initialize (GimpTool *tool,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (gimp_item_is_content_locked (GIMP_ITEM (drawable)))
|
||||
if (gimp_item_is_content_locked (GIMP_ITEM (drawable), &locked_item))
|
||||
{
|
||||
g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
|
||||
_("The active layer's pixels are locked."));
|
||||
_("The selected layer's pixels are locked."));
|
||||
if (error)
|
||||
gimp_tools_blink_lock_box (display->gimp, GIMP_ITEM (drawable));
|
||||
gimp_tools_blink_lock_box (display->gimp, locked_item);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -287,7 +288,7 @@ gimp_gradient_tool_initialize (GimpTool *tool,
|
|||
! config->edit_non_visible)
|
||||
{
|
||||
g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
|
||||
_("The active layer is not visible."));
|
||||
_("The selected item is not visible."));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -473,9 +474,9 @@ gimp_gradient_tool_cursor_update (GimpTool *tool,
|
|||
GimpImage *image = gimp_display_get_image (display);
|
||||
GList *drawables = gimp_image_get_selected_drawables (image);
|
||||
|
||||
if (g_list_length (drawables) != 1 ||
|
||||
gimp_viewable_get_children (drawables->data) ||
|
||||
gimp_item_is_content_locked (drawables->data) ||
|
||||
if (g_list_length (drawables) != 1 ||
|
||||
gimp_viewable_get_children (drawables->data) ||
|
||||
gimp_item_is_content_locked (drawables->data, NULL) ||
|
||||
! (gimp_item_is_visible (drawables->data) ||
|
||||
config->edit_non_visible))
|
||||
{
|
||||
|
|
|
@ -344,7 +344,7 @@ gimp_move_tool_button_press (GimpTool *tool,
|
|||
|
||||
if (gimp_item_is_position_locked (selected_items->data))
|
||||
locked_message = _("The selected layer's position is locked.");
|
||||
else if (gimp_item_is_content_locked (selected_items->data))
|
||||
else if (gimp_item_is_content_locked (selected_items->data, NULL))
|
||||
locked_message = _("The selected layer's pixels are locked.");
|
||||
}
|
||||
else if (GIMP_IS_CHANNEL (selected_items->data))
|
||||
|
@ -355,7 +355,7 @@ gimp_move_tool_button_press (GimpTool *tool,
|
|||
|
||||
for (iter = selected_items; iter; iter = iter->next)
|
||||
if (! gimp_item_is_position_locked (iter->data) &&
|
||||
! gimp_item_is_content_locked (iter->data))
|
||||
! gimp_item_is_content_locked (iter->data, NULL))
|
||||
n_items++;
|
||||
|
||||
if (n_items == 0)
|
||||
|
|
|
@ -311,7 +311,8 @@ gimp_paint_tool_button_press (GimpTool *tool,
|
|||
|
||||
for (iter = drawables; iter; iter = iter->next)
|
||||
{
|
||||
GimpDrawable *drawable = iter->data;
|
||||
GimpDrawable *drawable = iter->data;
|
||||
GimpItem *locked_item = NULL;
|
||||
|
||||
if (gimp_viewable_get_children (GIMP_VIEWABLE (drawable)))
|
||||
{
|
||||
|
@ -322,11 +323,11 @@ gimp_paint_tool_button_press (GimpTool *tool,
|
|||
return;
|
||||
}
|
||||
|
||||
if (gimp_item_is_content_locked (GIMP_ITEM (drawable)))
|
||||
if (gimp_item_is_content_locked (GIMP_ITEM (drawable), &locked_item))
|
||||
{
|
||||
gimp_tool_message_literal (tool, display,
|
||||
_("A selected layer's pixels are locked."));
|
||||
gimp_tools_blink_lock_box (display->gimp, GIMP_ITEM (drawable));
|
||||
_("The selected item's pixels are locked."));
|
||||
gimp_tools_blink_lock_box (display->gimp, locked_item);
|
||||
g_list_free (drawables);
|
||||
|
||||
return;
|
||||
|
@ -552,7 +553,7 @@ gimp_paint_tool_cursor_update (GimpTool *tool,
|
|||
GimpDrawable *drawable = iter->data;
|
||||
|
||||
if (gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) ||
|
||||
gimp_item_is_content_locked (GIMP_ITEM (drawable)) ||
|
||||
gimp_item_is_content_locked (GIMP_ITEM (drawable), NULL) ||
|
||||
! gimp_paint_tool_check_alpha (paint_tool, drawable, display, NULL) ||
|
||||
! (gimp_item_is_visible (GIMP_ITEM (drawable)) ||
|
||||
config->edit_non_visible))
|
||||
|
|
|
@ -558,8 +558,9 @@ gimp_selection_tool_check (GimpSelectionTool *sel_tool,
|
|||
case SELECTION_MOVE:
|
||||
case SELECTION_MOVE_COPY:
|
||||
{
|
||||
GList *drawables = gimp_image_get_selected_drawables (image);
|
||||
GList *iter;
|
||||
GList *drawables = gimp_image_get_selected_drawables (image);
|
||||
GimpItem *locked_item = NULL;
|
||||
GList *iter;
|
||||
|
||||
for (iter = drawables; iter; iter = iter->next)
|
||||
{
|
||||
|
@ -571,13 +572,13 @@ gimp_selection_tool_check (GimpSelectionTool *sel_tool,
|
|||
g_list_free (drawables);
|
||||
return FALSE;
|
||||
}
|
||||
else if (gimp_item_is_content_locked (iter->data))
|
||||
else if (gimp_item_is_content_locked (iter->data, &locked_item))
|
||||
{
|
||||
g_set_error (error, GIMP_ERROR, GIMP_FAILED,
|
||||
_("The active layer's pixels are locked."));
|
||||
_("A selected item's pixels are locked."));
|
||||
|
||||
if (error)
|
||||
gimp_tools_blink_lock_box (display->gimp, iter->data);
|
||||
gimp_tools_blink_lock_box (display->gimp, locked_item);
|
||||
|
||||
g_list_free (drawables);
|
||||
return FALSE;
|
||||
|
|
|
@ -658,6 +658,7 @@ gimp_transform_tool_check_selected_objects (GimpTransformTool *tr_tool,
|
|||
GList *iter;
|
||||
const gchar *null_message = NULL;
|
||||
const gchar *locked_message = NULL;
|
||||
GimpItem *locked_item = NULL;
|
||||
GimpGuiConfig *config = GIMP_GUI_CONFIG (display->gimp->config);
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_TRANSFORM_TOOL (tr_tool), NULL);
|
||||
|
@ -677,7 +678,7 @@ gimp_transform_tool_check_selected_objects (GimpTransformTool *tr_tool,
|
|||
{
|
||||
GimpItem *item = iter->data;
|
||||
|
||||
if (gimp_item_is_content_locked (item))
|
||||
if (gimp_item_is_content_locked (item, &locked_item))
|
||||
locked_message = _("A selected layer's pixels are locked.");
|
||||
else if (gimp_item_is_position_locked (item))
|
||||
locked_message = _("A selected layer's position and size are locked.");
|
||||
|
@ -708,7 +709,7 @@ gimp_transform_tool_check_selected_objects (GimpTransformTool *tr_tool,
|
|||
GimpItem *item = iter->data;
|
||||
|
||||
/* cannot happen, so don't translate these messages */
|
||||
if (gimp_item_is_content_locked (item))
|
||||
if (gimp_item_is_content_locked (item, &locked_item))
|
||||
locked_message = "The selection's pixels are locked.";
|
||||
else if (gimp_item_is_position_locked (item))
|
||||
locked_message = "The selection's position and size are locked.";
|
||||
|
@ -722,8 +723,8 @@ gimp_transform_tool_check_selected_objects (GimpTransformTool *tr_tool,
|
|||
{
|
||||
GimpItem *item = iter->data;
|
||||
|
||||
if (gimp_item_is_content_locked (item))
|
||||
locked_message = _("The active path's strokes are locked.");
|
||||
if (gimp_item_is_content_locked (item, &locked_item))
|
||||
locked_message = _("The selected path's strokes are locked.");
|
||||
else if (gimp_item_is_position_locked (item))
|
||||
locked_message = _("The active path's position is locked.");
|
||||
else if (! gimp_vectors_get_n_strokes (GIMP_VECTORS (item)))
|
||||
|
@ -749,7 +750,12 @@ gimp_transform_tool_check_selected_objects (GimpTransformTool *tr_tool,
|
|||
{
|
||||
g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED, locked_message);
|
||||
if (error)
|
||||
gimp_tools_blink_lock_box (display->gimp, GIMP_ITEM (objects->data));
|
||||
{
|
||||
if (locked_item == NULL)
|
||||
locked_item = GIMP_ITEM (objects->data);
|
||||
|
||||
gimp_tools_blink_lock_box (display->gimp, locked_item);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -757,11 +757,12 @@ gimp_warp_tool_can_stroke (GimpWarpTool *wt,
|
|||
GimpDisplay *display,
|
||||
gboolean show_message)
|
||||
{
|
||||
GimpTool *tool = GIMP_TOOL (wt);
|
||||
GimpWarpOptions *options = GIMP_WARP_TOOL_GET_OPTIONS (wt);
|
||||
GimpGuiConfig *config = GIMP_GUI_CONFIG (display->gimp->config);
|
||||
GimpImage *image = gimp_display_get_image (display);
|
||||
GList *drawables = gimp_image_get_selected_drawables (image);
|
||||
GimpTool *tool = GIMP_TOOL (wt);
|
||||
GimpWarpOptions *options = GIMP_WARP_TOOL_GET_OPTIONS (wt);
|
||||
GimpGuiConfig *config = GIMP_GUI_CONFIG (display->gimp->config);
|
||||
GimpImage *image = gimp_display_get_image (display);
|
||||
GimpItem *locked_item = NULL;
|
||||
GList *drawables = gimp_image_get_selected_drawables (image);
|
||||
GimpDrawable *drawable;
|
||||
|
||||
if (g_list_length (drawables) != 1)
|
||||
|
@ -795,14 +796,14 @@ gimp_warp_tool_can_stroke (GimpWarpTool *wt,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (gimp_item_is_content_locked (GIMP_ITEM (drawable)))
|
||||
if (gimp_item_is_content_locked (GIMP_ITEM (drawable), &locked_item))
|
||||
{
|
||||
if (show_message)
|
||||
{
|
||||
gimp_tool_message_literal (tool, display,
|
||||
_("The active layer's pixels are locked."));
|
||||
_("The selected item's pixels are locked."));
|
||||
|
||||
gimp_tools_blink_lock_box (display->gimp, GIMP_ITEM (drawable));
|
||||
gimp_tools_blink_lock_box (display->gimp, locked_item);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
@ -814,7 +815,7 @@ gimp_warp_tool_can_stroke (GimpWarpTool *wt,
|
|||
if (show_message)
|
||||
{
|
||||
gimp_tool_message_literal (tool, display,
|
||||
_("The active layer is not visible."));
|
||||
_("The selected item is not visible."));
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
|
|
@ -225,7 +225,7 @@ gimp_drawable_tree_view_drop_possible (GimpContainerTreeView *tree_view,
|
|||
src_type == GIMP_DND_TYPE_PATTERN)
|
||||
{
|
||||
if (! dest_viewable ||
|
||||
gimp_item_is_content_locked (GIMP_ITEM (dest_viewable)) ||
|
||||
gimp_item_is_content_locked (GIMP_ITEM (dest_viewable), NULL) ||
|
||||
gimp_viewable_get_children (GIMP_VIEWABLE (dest_viewable)))
|
||||
return FALSE;
|
||||
|
||||
|
|
Loading…
Reference in New Issue