[gimp] app: allow to drop buffers and components to empty displays



commit 81911a7b0260a64dc8bda69f6440441f69041fb4
Author: Michael Natterer <mitch gimp org>
Date:   Thu Apr 28 01:59:38 2011 +0200

    app: allow to drop buffers and components to empty displays
    
    and simply create new images from them.

 app/display/gimpdisplayshell-dnd.c |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-dnd.c b/app/display/gimpdisplayshell-dnd.c
index 504f3a0..26cc906 100644
--- a/app/display/gimpdisplayshell-dnd.c
+++ b/app/display/gimpdisplayshell-dnd.c
@@ -429,7 +429,14 @@ gimp_display_shell_drop_buffer (GtkWidget    *widget,
     return;
 
   if (! image)
-    return;
+    {
+      image = gimp_image_new_from_buffer (shell->display->gimp, NULL,
+                                          GIMP_BUFFER (viewable));
+      gimp_create_display (image->gimp, image, GIMP_UNIT_PIXEL, 1.0);
+      g_object_unref (image);
+
+      return;
+    }
 
   drawable = gimp_image_get_active_drawable (image);
 
@@ -581,7 +588,14 @@ gimp_display_shell_drop_component (GtkWidget       *widget,
     return;
 
   if (! dest_image)
-    return;
+    {
+      dest_image = gimp_image_new_from_component (image->gimp,
+                                                  image, component);
+      gimp_create_display (dest_image->gimp, dest_image, GIMP_UNIT_PIXEL, 1.0);
+      g_object_unref (dest_image);
+
+      return;
+    }
 
   channel = gimp_channel_new_from_component (image, component, NULL, NULL);
 
@@ -619,8 +633,8 @@ gimp_display_shell_drop_pixbuf (GtkWidget *widget,
                                 GdkPixbuf *pixbuf,
                                 gpointer   data)
 {
-  GimpDisplayShell *shell     = GIMP_DISPLAY_SHELL (data);
-  GimpImage        *image     = gimp_display_get_image (shell->display);
+  GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (data);
+  GimpImage        *image = gimp_display_get_image (shell->display);
   GimpLayer        *new_layer;
   GimpImageType     image_type;
 



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