diff --git a/app/actions/drawable-actions.c b/app/actions/drawable-actions.c index 60a0007450..a549fa2df2 100644 --- a/app/actions/drawable-actions.c +++ b/app/actions/drawable-actions.c @@ -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); diff --git a/app/actions/edit-actions.c b/app/actions/edit-actions.c index fa3269bfca..1396e3d188 100644 --- a/app/actions/edit-actions.c +++ b/app/actions/edit-actions.c @@ -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) diff --git a/app/actions/edit-commands.c b/app/actions/edit-commands.c index 6a1214a4a6..0f5381fb12 100644 --- a/app/actions/edit-commands.c +++ b/app/actions/edit-commands.c @@ -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, diff --git a/app/actions/filters-actions.c b/app/actions/filters-actions.c index 6ac51f4375..46598d0b03 100644 --- a/app/actions/filters-actions.c +++ b/app/actions/filters-actions.c @@ -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; diff --git a/app/actions/gimpgeglprocedure.c b/app/actions/gimpgeglprocedure.c index be1ae40cef..473577ca6e 100644 --- a/app/actions/gimpgeglprocedure.c +++ b/app/actions/gimpgeglprocedure.c @@ -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; diff --git a/app/actions/layers-actions.c b/app/actions/layers-actions.c index 6e491cc634..b6f0fe6394 100644 --- a/app/actions/layers-actions.c +++ b/app/actions/layers-actions.c @@ -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; diff --git a/app/actions/layers-commands.c b/app/actions/layers-commands.c index 29da45f223..262fb4f297 100644 --- a/app/actions/layers-commands.c +++ b/app/actions/layers-commands.c @@ -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. */ diff --git a/app/actions/select-actions.c b/app/actions/select-actions.c index cfc166e1c0..38ac3fcd79 100644 --- a/app/actions/select-actions.c +++ b/app/actions/select-actions.c @@ -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; diff --git a/app/actions/vectors-actions.c b/app/actions/vectors-actions.c index c3bf9bb205..7e34fe851f 100644 --- a/app/actions/vectors-actions.c +++ b/app/actions/vectors-actions.c @@ -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; diff --git a/app/core/gimp-edit.c b/app/core/gimp-edit.c index bf0be4f147..36a08f6586 100644 --- a/app/core/gimp-edit.c +++ b/app/core/gimp-edit.c @@ -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; diff --git a/app/core/gimpimage-crop.c b/app/core/gimpimage-crop.c index c6814d4d65..3e4e4698ba 100644 --- a/app/core/gimpimage-crop.c +++ b/app/core/gimpimage-crop.c @@ -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; diff --git a/app/core/gimpimage-merge.c b/app/core/gimpimage-merge.c index fa94a996f7..5a5f82bed6 100644 --- a/app/core/gimpimage-merge.c +++ b/app/core/gimpimage-merge.c @@ -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.")); diff --git a/app/core/gimpitem.c b/app/core/gimpitem.c index d08ded3227..cf117f694a 100644 --- a/app/core/gimpitem.c +++ b/app/core/gimpitem.c @@ -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 diff --git a/app/core/gimpitem.h b/app/core/gimpitem.h index cb79e2fe35..0444023a55 100644 --- a/app/core/gimpitem.h +++ b/app/core/gimpitem.h @@ -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, diff --git a/app/core/gimplayermask.c b/app/core/gimplayermask.c index dd3435a771..2660a29113 100644 --- a/app/core/gimplayermask.c +++ b/app/core/gimplayermask.c @@ -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; } diff --git a/app/display/gimpdisplayshell-dnd.c b/app/display/gimpdisplayshell-dnd.c index dfce2570c2..b164842b8c 100644 --- a/app/display/gimpdisplayshell-dnd.c +++ b/app/display/gimpdisplayshell-dnd.c @@ -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, diff --git a/app/display/gimptoolpath.c b/app/display/gimptoolpath.c index 7865517b8a..ca8f06b735 100644 --- a/app/display/gimptoolpath.c +++ b/app/display/gimptoolpath.c @@ -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; diff --git a/app/pdb/gimppdb-utils.c b/app/pdb/gimppdb-utils.c index 16fe883be4..49b9482b37 100644 --- a/app/pdb/gimppdb-utils.c +++ b/app/pdb/gimppdb-utils.c @@ -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 " diff --git a/app/plug-in/gimpplugin-message.c b/app/plug-in/gimpplugin-message.c index ac7465993d..8965a8d34d 100644 --- a/app/plug-in/gimpplugin-message.c +++ b/app/plug-in/gimpplugin-message.c @@ -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" diff --git a/app/tools/gimpbucketfilltool.c b/app/tools/gimpbucketfilltool.c index 7d29883895..40f04e84e1 100644 --- a/app/tools/gimpbucketfilltool.c +++ b/app/tools/gimpbucketfilltool.c @@ -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)) { diff --git a/app/tools/gimpcagetool.c b/app/tools/gimpcagetool.c index 44a24f4521..5cd0de8584 100644 --- a/app/tools/gimpcagetool.c +++ b/app/tools/gimpcagetool.c @@ -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)) { diff --git a/app/tools/gimpcroptool.c b/app/tools/gimpcroptool.c index d09783285d..d590388c31 100644 --- a/app/tools/gimpcroptool.c +++ b/app/tools/gimpcroptool.c @@ -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) diff --git a/app/tools/gimpeditselectiontool.c b/app/tools/gimpeditselectiontool.c index a57887da80..e1c09caf79 100644 --- a/app/tools/gimpeditselectiontool.c +++ b/app/tools/gimpeditselectiontool.c @@ -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; } diff --git a/app/tools/gimpfiltertool.c b/app/tools/gimpfiltertool.c index 2595e90102..489661ed91 100644 --- a/app/tools/gimpfiltertool.c +++ b/app/tools/gimpfiltertool.c @@ -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; diff --git a/app/tools/gimpgradienttool.c b/app/tools/gimpgradienttool.c index 421ee40ca3..a459e4adbd 100644 --- a/app/tools/gimpgradienttool.c +++ b/app/tools/gimpgradienttool.c @@ -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)) { diff --git a/app/tools/gimpmovetool.c b/app/tools/gimpmovetool.c index 68ff5058d7..cb2b499576 100644 --- a/app/tools/gimpmovetool.c +++ b/app/tools/gimpmovetool.c @@ -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) diff --git a/app/tools/gimppainttool.c b/app/tools/gimppainttool.c index 52bd340553..e6092704f4 100644 --- a/app/tools/gimppainttool.c +++ b/app/tools/gimppainttool.c @@ -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)) diff --git a/app/tools/gimpselectiontool.c b/app/tools/gimpselectiontool.c index 43121f2a8f..79765fa3d6 100644 --- a/app/tools/gimpselectiontool.c +++ b/app/tools/gimpselectiontool.c @@ -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; diff --git a/app/tools/gimptransformtool.c b/app/tools/gimptransformtool.c index 8a7f7234a1..1f39aca065 100644 --- a/app/tools/gimptransformtool.c +++ b/app/tools/gimptransformtool.c @@ -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; } diff --git a/app/tools/gimpwarptool.c b/app/tools/gimpwarptool.c index de60c2debc..712e5d6400 100644 --- a/app/tools/gimpwarptool.c +++ b/app/tools/gimpwarptool.c @@ -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; diff --git a/app/widgets/gimpdrawabletreeview.c b/app/widgets/gimpdrawabletreeview.c index cf78a39cb6..84707cb33f 100644 --- a/app/widgets/gimpdrawabletreeview.c +++ b/app/widgets/gimpdrawabletreeview.c @@ -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;