app: pass the drop_path to GimpContainerTreeView::drop_possible()
Together with some more refactoring, this will soon enable smarter layer group dnd behavior.
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||||
*
|
*
|
||||||
* gimpcontainertreeview-dnd.c
|
* 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
|
* 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
|
* 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 *src_viewable = NULL;
|
||||||
GimpViewable *dest_viewable = NULL;
|
GimpViewable *dest_viewable = NULL;
|
||||||
GtkTreePath *path = NULL;
|
GtkTreePath *drop_path = NULL;
|
||||||
GtkTargetList *target_list;
|
GtkTargetList *target_list;
|
||||||
GdkAtom target_atom;
|
GdkAtom target_atom;
|
||||||
GimpDndType src_type;
|
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,
|
if (gtk_tree_view_get_path_at_pos (tree_view->view, x, y,
|
||||||
&path, NULL, NULL, NULL))
|
&drop_path, NULL, NULL, NULL))
|
||||||
{
|
{
|
||||||
GimpViewRenderer *renderer;
|
GimpViewRenderer *renderer;
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
GdkRectangle cell_area;
|
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,
|
gtk_tree_model_get (tree_view->model, &iter,
|
||||||
GIMP_CONTAINER_TREE_VIEW_COLUMN_RENDERER, &renderer,
|
GIMP_CONTAINER_TREE_VIEW_COLUMN_RENDERER, &renderer,
|
||||||
@ -112,7 +112,7 @@ gimp_container_tree_view_drop_status (GimpContainerTreeView *tree_view,
|
|||||||
|
|
||||||
g_object_unref (renderer);
|
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))
|
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_type,
|
||||||
src_viewable,
|
src_viewable,
|
||||||
dest_viewable,
|
dest_viewable,
|
||||||
|
drop_path,
|
||||||
drop_pos,
|
drop_pos,
|
||||||
&drop_pos,
|
&drop_pos,
|
||||||
&drag_action))
|
&drag_action))
|
||||||
@ -137,9 +138,9 @@ gimp_container_tree_view_drop_status (GimpContainerTreeView *tree_view,
|
|||||||
gdk_drag_status (context, drag_action, time);
|
gdk_drag_status (context, drag_action, time);
|
||||||
|
|
||||||
if (return_path)
|
if (return_path)
|
||||||
*return_path = path;
|
*return_path = drop_path;
|
||||||
else
|
else
|
||||||
gtk_tree_path_free (path);
|
gtk_tree_path_free (drop_path);
|
||||||
|
|
||||||
if (return_atom)
|
if (return_atom)
|
||||||
*return_atom = target_atom;
|
*return_atom = target_atom;
|
||||||
@ -156,7 +157,7 @@ gimp_container_tree_view_drop_status (GimpContainerTreeView *tree_view,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_tree_path_free (path);
|
gtk_tree_path_free (drop_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
drop_impossible:
|
drop_impossible:
|
||||||
@ -233,7 +234,7 @@ gimp_container_tree_view_drag_motion (GtkWidget *widget,
|
|||||||
GimpContainerTreeView *tree_view)
|
GimpContainerTreeView *tree_view)
|
||||||
{
|
{
|
||||||
GtkAllocation allocation;
|
GtkAllocation allocation;
|
||||||
GtkTreePath *path;
|
GtkTreePath *drop_path;
|
||||||
GtkTreeViewDropPosition drop_pos;
|
GtkTreeViewDropPosition drop_pos;
|
||||||
|
|
||||||
gtk_widget_get_allocation (widget, &allocation);
|
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,
|
if (gimp_container_tree_view_drop_status (tree_view,
|
||||||
context, x, y, time,
|
context, x, y, time,
|
||||||
&path, NULL, NULL, NULL, NULL,
|
&drop_path, NULL, NULL, NULL, NULL,
|
||||||
&drop_pos))
|
&drop_pos))
|
||||||
{
|
{
|
||||||
gtk_tree_view_set_drag_dest_row (tree_view->view, path, drop_pos);
|
gtk_tree_view_set_drag_dest_row (tree_view->view, drop_path, drop_pos);
|
||||||
gtk_tree_path_free (path);
|
gtk_tree_path_free (drop_path);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -480,6 +481,7 @@ gimp_container_tree_view_real_drop_possible (GimpContainerTreeView *tree_view,
|
|||||||
GimpDndType src_type,
|
GimpDndType src_type,
|
||||||
GimpViewable *src_viewable,
|
GimpViewable *src_viewable,
|
||||||
GimpViewable *dest_viewable,
|
GimpViewable *dest_viewable,
|
||||||
|
GtkTreePath *drop_path,
|
||||||
GtkTreeViewDropPosition drop_pos,
|
GtkTreeViewDropPosition drop_pos,
|
||||||
GtkTreeViewDropPosition *return_drop_pos,
|
GtkTreeViewDropPosition *return_drop_pos,
|
||||||
GdkDragAction *return_drag_action)
|
GdkDragAction *return_drag_action)
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||||
*
|
*
|
||||||
* gimpcontainertreeview-dnd.h
|
* 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
|
* 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
|
* 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,
|
GimpDndType src_type,
|
||||||
GimpViewable *src_viewable,
|
GimpViewable *src_viewable,
|
||||||
GimpViewable *dest_viewable,
|
GimpViewable *dest_viewable,
|
||||||
|
GtkTreePath *drop_path,
|
||||||
GtkTreeViewDropPosition drop_pos,
|
GtkTreeViewDropPosition drop_pos,
|
||||||
GtkTreeViewDropPosition *return_drop_pos,
|
GtkTreeViewDropPosition *return_drop_pos,
|
||||||
GdkDragAction *return_drag_action);
|
GdkDragAction *return_drag_action);
|
||||||
|
@ -71,6 +71,7 @@ struct _GimpContainerTreeViewClass
|
|||||||
GimpDndType src_type,
|
GimpDndType src_type,
|
||||||
GimpViewable *src_viewable,
|
GimpViewable *src_viewable,
|
||||||
GimpViewable *dest_viewable,
|
GimpViewable *dest_viewable,
|
||||||
|
GtkTreePath *drop_path,
|
||||||
GtkTreeViewDropPosition drop_pos,
|
GtkTreeViewDropPosition drop_pos,
|
||||||
GtkTreeViewDropPosition *return_drop_pos,
|
GtkTreeViewDropPosition *return_drop_pos,
|
||||||
GdkDragAction *return_drag_action);
|
GdkDragAction *return_drag_action);
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||||
*
|
*
|
||||||
* gimpdrawabletreeview.c
|
* 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
|
* 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
|
* 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,
|
GimpDndType src_type,
|
||||||
GimpViewable *src_viewable,
|
GimpViewable *src_viewable,
|
||||||
GimpViewable *dest_viewable,
|
GimpViewable *dest_viewable,
|
||||||
|
GtkTreePath *drop_path,
|
||||||
GtkTreeViewDropPosition drop_pos,
|
GtkTreeViewDropPosition drop_pos,
|
||||||
GtkTreeViewDropPosition *return_drop_pos,
|
GtkTreeViewDropPosition *return_drop_pos,
|
||||||
GdkDragAction *return_drag_action);
|
GdkDragAction *return_drag_action);
|
||||||
@ -200,6 +201,7 @@ gimp_drawable_tree_view_drop_possible (GimpContainerTreeView *tree_view,
|
|||||||
GimpDndType src_type,
|
GimpDndType src_type,
|
||||||
GimpViewable *src_viewable,
|
GimpViewable *src_viewable,
|
||||||
GimpViewable *dest_viewable,
|
GimpViewable *dest_viewable,
|
||||||
|
GtkTreePath *drop_path,
|
||||||
GtkTreeViewDropPosition drop_pos,
|
GtkTreeViewDropPosition drop_pos,
|
||||||
GtkTreeViewDropPosition *return_drop_pos,
|
GtkTreeViewDropPosition *return_drop_pos,
|
||||||
GdkDragAction *return_drag_action)
|
GdkDragAction *return_drag_action)
|
||||||
@ -208,6 +210,7 @@ gimp_drawable_tree_view_drop_possible (GimpContainerTreeView *tree_view,
|
|||||||
src_type,
|
src_type,
|
||||||
src_viewable,
|
src_viewable,
|
||||||
dest_viewable,
|
dest_viewable,
|
||||||
|
drop_path,
|
||||||
drop_pos,
|
drop_pos,
|
||||||
return_drop_pos,
|
return_drop_pos,
|
||||||
return_drag_action))
|
return_drag_action))
|
||||||
|
@ -138,6 +138,7 @@ static gboolean gimp_item_tree_view_drop_possible (GimpContainerTreeView *view
|
|||||||
GimpDndType src_type,
|
GimpDndType src_type,
|
||||||
GimpViewable *src_viewable,
|
GimpViewable *src_viewable,
|
||||||
GimpViewable *dest_viewable,
|
GimpViewable *dest_viewable,
|
||||||
|
GtkTreePath *drop_path,
|
||||||
GtkTreeViewDropPosition drop_pos,
|
GtkTreeViewDropPosition drop_pos,
|
||||||
GtkTreeViewDropPosition *return_drop_pos,
|
GtkTreeViewDropPosition *return_drop_pos,
|
||||||
GdkDragAction *return_drag_action);
|
GdkDragAction *return_drag_action);
|
||||||
@ -1027,6 +1028,7 @@ gimp_item_tree_view_drop_possible (GimpContainerTreeView *tree_view,
|
|||||||
GimpDndType src_type,
|
GimpDndType src_type,
|
||||||
GimpViewable *src_viewable,
|
GimpViewable *src_viewable,
|
||||||
GimpViewable *dest_viewable,
|
GimpViewable *dest_viewable,
|
||||||
|
GtkTreePath *drop_path,
|
||||||
GtkTreeViewDropPosition drop_pos,
|
GtkTreeViewDropPosition drop_pos,
|
||||||
GtkTreeViewDropPosition *return_drop_pos,
|
GtkTreeViewDropPosition *return_drop_pos,
|
||||||
GdkDragAction *return_drag_action)
|
GdkDragAction *return_drag_action)
|
||||||
@ -1049,6 +1051,7 @@ gimp_item_tree_view_drop_possible (GimpContainerTreeView *tree_view,
|
|||||||
src_type,
|
src_type,
|
||||||
src_viewable,
|
src_viewable,
|
||||||
dest_viewable,
|
dest_viewable,
|
||||||
|
drop_path,
|
||||||
drop_pos,
|
drop_pos,
|
||||||
return_drop_pos,
|
return_drop_pos,
|
||||||
return_drag_action);
|
return_drag_action);
|
||||||
|
@ -104,6 +104,7 @@ static gboolean gimp_layer_tree_view_drop_possible(GimpContainerTreeView *view,
|
|||||||
GimpDndType src_type,
|
GimpDndType src_type,
|
||||||
GimpViewable *src_viewable,
|
GimpViewable *src_viewable,
|
||||||
GimpViewable *dest_viewable,
|
GimpViewable *dest_viewable,
|
||||||
|
GtkTreePath *drop_path,
|
||||||
GtkTreeViewDropPosition drop_pos,
|
GtkTreeViewDropPosition drop_pos,
|
||||||
GtkTreeViewDropPosition *return_drop_pos,
|
GtkTreeViewDropPosition *return_drop_pos,
|
||||||
GdkDragAction *return_drag_action);
|
GdkDragAction *return_drag_action);
|
||||||
@ -665,6 +666,7 @@ gimp_layer_tree_view_drop_possible (GimpContainerTreeView *tree_view,
|
|||||||
GimpDndType src_type,
|
GimpDndType src_type,
|
||||||
GimpViewable *src_viewable,
|
GimpViewable *src_viewable,
|
||||||
GimpViewable *dest_viewable,
|
GimpViewable *dest_viewable,
|
||||||
|
GtkTreePath *drop_path,
|
||||||
GtkTreeViewDropPosition drop_pos,
|
GtkTreeViewDropPosition drop_pos,
|
||||||
GtkTreeViewDropPosition *return_drop_pos,
|
GtkTreeViewDropPosition *return_drop_pos,
|
||||||
GdkDragAction *return_drag_action)
|
GdkDragAction *return_drag_action)
|
||||||
@ -689,6 +691,7 @@ gimp_layer_tree_view_drop_possible (GimpContainerTreeView *tree_view,
|
|||||||
src_type,
|
src_type,
|
||||||
src_viewable,
|
src_viewable,
|
||||||
dest_viewable,
|
dest_viewable,
|
||||||
|
drop_path,
|
||||||
drop_pos,
|
drop_pos,
|
||||||
return_drop_pos,
|
return_drop_pos,
|
||||||
return_drag_action);
|
return_drag_action);
|
||||||
|
Reference in New Issue
Block a user