[gimp] app: paste as new layer if the target layer can't be modified
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: paste as new layer if the target layer can't be modified
- Date: Mon, 19 Sep 2016 10:37:08 +0000 (UTC)
commit 08513f50f89e660229db3e9bf193eec602fd4507
Author: Michael Natterer <mitch gimp org>
Date: Mon Sep 19 12:36:11 2016 +0200
app: paste as new layer if the target layer can't be modified
Which happens on layer groups and locked drawables.
app/actions/edit-actions.c | 6 +---
app/actions/edit-commands.c | 62 ++++++++++++++++++++++++++++++++++++++++---
2 files changed, 60 insertions(+), 8 deletions(-)
---
diff --git a/app/actions/edit-actions.c b/app/actions/edit-actions.c
index 2f04ada..6b3ec04 100644
--- a/app/actions/edit-actions.c
+++ b/app/actions/edit-actions.c
@@ -372,11 +372,9 @@ edit_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("edit-cut", writable && !children);
SET_SENSITIVE ("edit-copy", drawable);
SET_SENSITIVE ("edit-copy-visible", image);
- SET_SENSITIVE ("edit-paste", !image || (!drawable ||
- (writable && !children)));
+ /* "edit-paste" is always active */
SET_SENSITIVE ("edit-paste-as-new-layer", image);
- SET_SENSITIVE ("edit-paste-into", image && (!drawable ||
- (writable && !children)));
+ SET_SENSITIVE ("edit-paste-into", image);
SET_SENSITIVE ("edit-named-cut", writable && !children);
SET_SENSITIVE ("edit-named-copy", drawable);
diff --git a/app/actions/edit-commands.c b/app/actions/edit-commands.c
index 76e79e5..6df8830 100644
--- a/app/actions/edit-commands.c
+++ b/app/actions/edit-commands.c
@@ -319,19 +319,73 @@ edit_paste_cmd_callback (GtkAction *action,
GimpDisplay *display = action_data_get_display (data);
if (display && gimp_display_get_image (display))
- edit_paste (display, FALSE);
+ {
+ GimpImage *image = gimp_display_get_image (display);
+ GimpDrawable *drawable = gimp_image_get_active_drawable (image);;
+
+ if (drawable && gimp_viewable_get_children (GIMP_VIEWABLE (drawable)))
+ {
+ gimp_message_literal (display->gimp, G_OBJECT (display),
+ GIMP_MESSAGE_INFO,
+ _("Pasting as new layer because the "
+ "target is a group layer."));
+
+ edit_paste_as_new_layer_cmd_callback (action, data);
+ }
+ else if (drawable && gimp_item_is_content_locked (GIMP_ITEM (drawable)))
+ {
+ gimp_message_literal (display->gimp, G_OBJECT (display),
+ GIMP_MESSAGE_INFO,
+ _("Pasting as new layer because the "
+ "target's pixels are locked."));
+
+ edit_paste_as_new_layer_cmd_callback (action, data);
+ }
+ else
+ {
+ edit_paste (display, FALSE);
+ }
+ }
else
- edit_paste_as_new_image_cmd_callback (action, data);
+ {
+ edit_paste_as_new_image_cmd_callback (action, data);
+ }
}
void
edit_paste_into_cmd_callback (GtkAction *action,
gpointer data)
{
- GimpDisplay *display;
+ GimpImage *image;
+ GimpDisplay *display;
+ GimpDrawable *drawable;
+ return_if_no_image (image, data);
return_if_no_display (display, data);
- edit_paste (display, TRUE);
+ drawable = gimp_image_get_active_drawable (image);;
+
+ if (drawable && gimp_viewable_get_children (GIMP_VIEWABLE (drawable)))
+ {
+ gimp_message_literal (display->gimp, G_OBJECT (display),
+ GIMP_MESSAGE_INFO,
+ _("Pasting as new layer because the "
+ "target is a group layer."));
+
+ edit_paste_as_new_layer_cmd_callback (action, data);
+ }
+ else if (drawable && gimp_item_is_content_locked (GIMP_ITEM (drawable)))
+ {
+ gimp_message_literal (display->gimp, G_OBJECT (display),
+ GIMP_MESSAGE_INFO,
+ _("Pasting as new layer because the "
+ "target's pixels are locked."));
+
+ edit_paste_as_new_layer_cmd_callback (action, data);
+ }
+ else
+ {
+ edit_paste (display, TRUE);
+ }
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]