[gimp/gimp-2-10] Issue #2667 - When copying a text layer, paste should create a new...



commit d6ca6d510e845ecf6eb004e343ce33da853bc356
Author: Michael Natterer <mitch gimp org>
Date:   Wed Jan 2 00:14:35 2019 +0100

    Issue #2667 - When copying a text layer, paste should create a new...
    
    ...text layer, not an image of the text
    
    In gimp_edit_paste_get_layer(), when pasting as floating selection,
    collapse the pasted layer into an ordinary layer only if it's a group
    layer. There is nothing that speaks against having a floating text
    layer, it works just fine.
    
    (cherry picked from commit 8a4aacb52f52b11bedd879ea03271b7ca540099d)

 app/core/gimp-edit.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/app/core/gimp-edit.c b/app/core/gimp-edit.c
index 78199f0c55..e2b521da9e 100644
--- a/app/core/gimp-edit.c
+++ b/app/core/gimp-edit.c
@@ -30,11 +30,11 @@
 #include "gimp-edit.h"
 #include "gimpbuffer.h"
 #include "gimpcontext.h"
+#include "gimpgrouplayer.h"
 #include "gimpimage.h"
 #include "gimpimage-duplicate.h"
 #include "gimpimage-new.h"
 #include "gimpimage-undo.h"
-#include "gimplayer.h"
 #include "gimplayer-floating-selection.h"
 #include "gimplayer-new.h"
 #include "gimplist.h"
@@ -249,11 +249,15 @@ gimp_edit_paste_get_layer (GimpImage     *image,
         case GIMP_PASTE_TYPE_FLOATING_IN_PLACE:
         case GIMP_PASTE_TYPE_FLOATING_INTO:
         case GIMP_PASTE_TYPE_FLOATING_INTO_IN_PLACE:
-          /*  when pasting as floating selection, force creation of a
-           *  plain layer, so gimp_item_convert() will collapse a
-           *  group layer
+          /*  when pasting as floating make sure gimp_item_convert()
+           *  will turn group layers into normal layers, otherwise use
+           *  the same layer type so e.g. text information gets
+           *  preserved. See issue #2667.
            */
-          layer_type = GIMP_TYPE_LAYER;
+          if (GIMP_IS_GROUP_LAYER (layer))
+            layer_type = GIMP_TYPE_LAYER;
+          else
+            layer_type = G_TYPE_FROM_INSTANCE (layer);
           break;
 
         case GIMP_PASTE_TYPE_NEW_LAYER:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]