[gimp] app: pass the drop_path to GimpContainerTreeView::drop_possible()



commit bb852184e1d33f2aebeae6089535178c334b1d93
Author: Michael Natterer <mitch gimp org>
Date:   Mon Dec 28 21:10:04 2009 +0100

    app: pass the drop_path to GimpContainerTreeView::drop_possible()
    
    Together with some more refactoring, this will soon enable smarter
    layer group dnd behavior.

 app/widgets/gimpcontainertreeview-dnd.c |   26 ++++++++++++++------------
 app/widgets/gimpcontainertreeview-dnd.h |    3 ++-
 app/widgets/gimpcontainertreeview.h     |    1 +
 app/widgets/gimpdrawabletreeview.c      |    5 ++++-
 app/widgets/gimpitemtreeview.c          |    3 +++
 app/widgets/gimplayertreeview.c         |    3 +++
 6 files changed, 27 insertions(+), 14 deletions(-)
---
diff --git a/app/widgets/gimpcontainertreeview-dnd.c b/app/widgets/gimpcontainertreeview-dnd.c
index ed8cde9..0b03f8e 100644
--- a/app/widgets/gimpcontainertreeview-dnd.c
+++ b/app/widgets/gimpcontainertreeview-dnd.c
@@ -2,7 +2,7 @@
  * Copyright (C) 1995 Spencer Kimball and Peter Mattis
  *
  * gimpcontainertreeview-dnd.c
- * Copyright (C) 2003 Michael Natterer <mitch gimp org>
+ * Copyright (C) 2003-2009 Michael Natterer <mitch gimp org>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -51,7 +51,7 @@ gimp_container_tree_view_drop_status (GimpContainerTreeView    *tree_view,
 {
   GimpViewable            *src_viewable  = NULL;
   GimpViewable            *dest_viewable = NULL;
-  GtkTreePath             *path          = NULL;
+  GtkTreePath             *drop_path     = NULL;
   GtkTargetList           *target_list;
   GdkAtom                  target_atom;
   GimpDndType              src_type;
@@ -96,13 +96,13 @@ gimp_container_tree_view_drop_status (GimpContainerTreeView    *tree_view,
     }
 
   if (gtk_tree_view_get_path_at_pos (tree_view->view, x, y,
-                                     &path, NULL, NULL, NULL))
+                                     &drop_path, NULL, NULL, NULL))
     {
       GimpViewRenderer *renderer;
       GtkTreeIter       iter;
       GdkRectangle      cell_area;
 
-      gtk_tree_model_get_iter (tree_view->model, &iter, path);
+      gtk_tree_model_get_iter (tree_view->model, &iter, drop_path);
 
       gtk_tree_model_get (tree_view->model, &iter,
                           GIMP_CONTAINER_TREE_VIEW_COLUMN_RENDERER, &renderer,
@@ -112,7 +112,7 @@ gimp_container_tree_view_drop_status (GimpContainerTreeView    *tree_view,
 
       g_object_unref (renderer);
 
-      gtk_tree_view_get_cell_area (tree_view->view, path, NULL, &cell_area);
+      gtk_tree_view_get_cell_area (tree_view->view, drop_path, NULL, &cell_area);
 
       if (y >= (cell_area.y + cell_area.height / 2))
         {
@@ -130,6 +130,7 @@ gimp_container_tree_view_drop_status (GimpContainerTreeView    *tree_view,
                                                                          src_type,
                                                                          src_viewable,
                                                                          dest_viewable,
+                                                                         drop_path,
                                                                          drop_pos,
                                                                          &drop_pos,
                                                                          &drag_action))
@@ -137,9 +138,9 @@ gimp_container_tree_view_drop_status (GimpContainerTreeView    *tree_view,
           gdk_drag_status (context, drag_action, time);
 
           if (return_path)
-            *return_path = path;
+            *return_path = drop_path;
           else
-            gtk_tree_path_free (path);
+            gtk_tree_path_free (drop_path);
 
           if (return_atom)
             *return_atom = target_atom;
@@ -156,7 +157,7 @@ gimp_container_tree_view_drop_status (GimpContainerTreeView    *tree_view,
           return TRUE;
         }
 
-      gtk_tree_path_free (path);
+      gtk_tree_path_free (drop_path);
     }
 
  drop_impossible:
@@ -233,7 +234,7 @@ gimp_container_tree_view_drag_motion (GtkWidget             *widget,
                                       GimpContainerTreeView *tree_view)
 {
   GtkAllocation            allocation;
-  GtkTreePath             *path;
+  GtkTreePath             *drop_path;
   GtkTreeViewDropPosition  drop_pos;
 
   gtk_widget_get_allocation (widget, &allocation);
@@ -274,11 +275,11 @@ gimp_container_tree_view_drag_motion (GtkWidget             *widget,
 
   if (gimp_container_tree_view_drop_status (tree_view,
                                             context, x, y, time,
-                                            &path, NULL, NULL, NULL, NULL,
+                                            &drop_path, NULL, NULL, NULL, NULL,
                                             &drop_pos))
     {
-      gtk_tree_view_set_drag_dest_row (tree_view->view, path, drop_pos);
-      gtk_tree_path_free (path);
+      gtk_tree_view_set_drag_dest_row (tree_view->view, drop_path, drop_pos);
+      gtk_tree_path_free (drop_path);
     }
   else
     {
@@ -480,6 +481,7 @@ gimp_container_tree_view_real_drop_possible (GimpContainerTreeView   *tree_view,
                                              GimpDndType              src_type,
                                              GimpViewable            *src_viewable,
                                              GimpViewable            *dest_viewable,
+                                             GtkTreePath             *drop_path,
                                              GtkTreeViewDropPosition  drop_pos,
                                              GtkTreeViewDropPosition *return_drop_pos,
                                              GdkDragAction           *return_drag_action)
diff --git a/app/widgets/gimpcontainertreeview-dnd.h b/app/widgets/gimpcontainertreeview-dnd.h
index 7389afb..1778e28 100644
--- a/app/widgets/gimpcontainertreeview-dnd.h
+++ b/app/widgets/gimpcontainertreeview-dnd.h
@@ -2,7 +2,7 @@
  * Copyright (C) 1995 Spencer Kimball and Peter Mattis
  *
  * gimpcontainertreeview-dnd.h
- * Copyright (C) 2003 Michael Natterer <mitch gimp org>
+ * Copyright (C) 2003-2009 Michael Natterer <mitch gimp org>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -53,6 +53,7 @@ gimp_container_tree_view_real_drop_possible (GimpContainerTreeView   *tree_view,
                                              GimpDndType              src_type,
                                              GimpViewable            *src_viewable,
                                              GimpViewable            *dest_viewable,
+                                             GtkTreePath             *drop_path,
                                              GtkTreeViewDropPosition  drop_pos,
                                              GtkTreeViewDropPosition *return_drop_pos,
                                              GdkDragAction           *return_drag_action);
diff --git a/app/widgets/gimpcontainertreeview.h b/app/widgets/gimpcontainertreeview.h
index e7bdda1..3e449ed 100644
--- a/app/widgets/gimpcontainertreeview.h
+++ b/app/widgets/gimpcontainertreeview.h
@@ -71,6 +71,7 @@ struct _GimpContainerTreeViewClass
                                GimpDndType              src_type,
                                GimpViewable            *src_viewable,
                                GimpViewable            *dest_viewable,
+                               GtkTreePath             *drop_path,
                                GtkTreeViewDropPosition  drop_pos,
                                GtkTreeViewDropPosition *return_drop_pos,
                                GdkDragAction           *return_drag_action);
diff --git a/app/widgets/gimpdrawabletreeview.c b/app/widgets/gimpdrawabletreeview.c
index 74c1a89..2bb5882 100644
--- a/app/widgets/gimpdrawabletreeview.c
+++ b/app/widgets/gimpdrawabletreeview.c
@@ -2,7 +2,7 @@
  * Copyright (C) 1995 Spencer Kimball and Peter Mattis
  *
  * gimpdrawabletreeview.c
- * Copyright (C) 2001-2003 Michael Natterer <mitch gimp org>
+ * Copyright (C) 2001-2009 Michael Natterer <mitch gimp org>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -57,6 +57,7 @@ static gboolean gimp_drawable_tree_view_drop_possible(GimpContainerTreeView *vie
                                                       GimpDndType          src_type,
                                                       GimpViewable        *src_viewable,
                                                       GimpViewable        *dest_viewable,
+                                                      GtkTreePath         *drop_path,
                                                       GtkTreeViewDropPosition  drop_pos,
                                                       GtkTreeViewDropPosition *return_drop_pos,
                                                       GdkDragAction       *return_drag_action);
@@ -200,6 +201,7 @@ gimp_drawable_tree_view_drop_possible (GimpContainerTreeView   *tree_view,
                                        GimpDndType              src_type,
                                        GimpViewable            *src_viewable,
                                        GimpViewable            *dest_viewable,
+                                       GtkTreePath             *drop_path,
                                        GtkTreeViewDropPosition  drop_pos,
                                        GtkTreeViewDropPosition *return_drop_pos,
                                        GdkDragAction           *return_drag_action)
@@ -208,6 +210,7 @@ gimp_drawable_tree_view_drop_possible (GimpContainerTreeView   *tree_view,
                                                                     src_type,
                                                                     src_viewable,
                                                                     dest_viewable,
+                                                                    drop_path,
                                                                     drop_pos,
                                                                     return_drop_pos,
                                                                     return_drag_action))
diff --git a/app/widgets/gimpitemtreeview.c b/app/widgets/gimpitemtreeview.c
index da7d8da..c470e62 100644
--- a/app/widgets/gimpitemtreeview.c
+++ b/app/widgets/gimpitemtreeview.c
@@ -138,6 +138,7 @@ static gboolean gimp_item_tree_view_drop_possible   (GimpContainerTreeView *view
                                                      GimpDndType        src_type,
                                                      GimpViewable      *src_viewable,
                                                      GimpViewable      *dest_viewable,
+                                                     GtkTreePath       *drop_path,
                                                      GtkTreeViewDropPosition  drop_pos,
                                                      GtkTreeViewDropPosition *return_drop_pos,
                                                      GdkDragAction     *return_drag_action);
@@ -1027,6 +1028,7 @@ gimp_item_tree_view_drop_possible (GimpContainerTreeView   *tree_view,
                                    GimpDndType              src_type,
                                    GimpViewable            *src_viewable,
                                    GimpViewable            *dest_viewable,
+                                   GtkTreePath             *drop_path,
                                    GtkTreeViewDropPosition  drop_pos,
                                    GtkTreeViewDropPosition *return_drop_pos,
                                    GdkDragAction           *return_drag_action)
@@ -1049,6 +1051,7 @@ gimp_item_tree_view_drop_possible (GimpContainerTreeView   *tree_view,
                                                                        src_type,
                                                                        src_viewable,
                                                                        dest_viewable,
+                                                                       drop_path,
                                                                        drop_pos,
                                                                        return_drop_pos,
                                                                        return_drag_action);
diff --git a/app/widgets/gimplayertreeview.c b/app/widgets/gimplayertreeview.c
index 848d558..6bec6e7 100644
--- a/app/widgets/gimplayertreeview.c
+++ b/app/widgets/gimplayertreeview.c
@@ -104,6 +104,7 @@ static gboolean gimp_layer_tree_view_drop_possible(GimpContainerTreeView *view,
                                                    GimpDndType          src_type,
                                                    GimpViewable        *src_viewable,
                                                    GimpViewable        *dest_viewable,
+                                                   GtkTreePath         *drop_path,
                                                    GtkTreeViewDropPosition  drop_pos,
                                                    GtkTreeViewDropPosition *return_drop_pos,
                                                    GdkDragAction       *return_drag_action);
@@ -665,6 +666,7 @@ gimp_layer_tree_view_drop_possible (GimpContainerTreeView   *tree_view,
                                     GimpDndType              src_type,
                                     GimpViewable            *src_viewable,
                                     GimpViewable            *dest_viewable,
+                                    GtkTreePath             *drop_path,
                                     GtkTreeViewDropPosition  drop_pos,
                                     GtkTreeViewDropPosition *return_drop_pos,
                                     GdkDragAction           *return_drag_action)
@@ -689,6 +691,7 @@ gimp_layer_tree_view_drop_possible (GimpContainerTreeView   *tree_view,
                                                                        src_type,
                                                                        src_viewable,
                                                                        dest_viewable,
+                                                                       drop_path,
                                                                        drop_pos,
                                                                        return_drop_pos,
                                                                        return_drag_action);



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