[gimp/wip/Jehan/layers-dockable-refresh: 57/80] app: add multi-vectors drag'n drop ability.




commit a3dd3730300de0321c7dfefef8ac5e9d92440d77
Author: Jehan <jehan girinstud io>
Date:   Mon Jun 21 22:32:25 2021 +0200

    app: add multi-vectors drag'n drop ability.

 app/widgets/gimpcontainertreeview-dnd.c |  1 +
 app/widgets/gimpdnd.c                   | 18 ++++++++++++++++--
 app/widgets/gimpdnd.h                   |  3 +++
 app/widgets/widgets-enums.h             |  3 ++-
 4 files changed, 22 insertions(+), 3 deletions(-)
---
diff --git a/app/widgets/gimpcontainertreeview-dnd.c b/app/widgets/gimpcontainertreeview-dnd.c
index 5d1643a2b1..e632f9891b 100644
--- a/app/widgets/gimpcontainertreeview-dnd.c
+++ b/app/widgets/gimpcontainertreeview-dnd.c
@@ -208,6 +208,7 @@ gimp_container_tree_view_drop_status (GimpContainerTreeView    *tree_view,
 
     case GIMP_DND_TYPE_CHANNEL_LIST:
     case GIMP_DND_TYPE_LAYER_LIST:
+    case GIMP_DND_TYPE_VECTORS_LIST:
       /* Various GimpViewable list (GList) drag data. */
       {
         GtkWidget *src_widget = gtk_drag_get_source_widget (context);
diff --git a/app/widgets/gimpdnd.c b/app/widgets/gimpdnd.c
index 30e7efcdd2..9e6c1fc5b4 100644
--- a/app/widgets/gimpdnd.c
+++ b/app/widgets/gimpdnd.c
@@ -657,6 +657,20 @@ static const GimpDndDataDef dnd_data_defs[] =
     gimp_dnd_set_item_list_data,
   },
 
+  {
+    GIMP_TARGET_VECTORS_LIST,
+
+    "gimp-dnd-get-vectors-list-func",
+    "gimp-dnd-get-vectors-list-data",
+
+    "gimp-dnd-set-vectors-list-func",
+    "gimp-dnd-set-vectors-list-data",
+
+    gimp_dnd_get_viewable_list_icon,
+    gimp_dnd_get_item_list_data,
+    gimp_dnd_set_item_list_data,
+  },
+
 };
 
 
@@ -1934,9 +1948,9 @@ gimp_dnd_data_type_get_by_g_type (GType    type,
     {
       dnd_type = list ? GIMP_DND_TYPE_CHANNEL_LIST : GIMP_DND_TYPE_CHANNEL;
     }
-  else if (g_type_is_a (type, GIMP_TYPE_VECTORS) && ! list)
+  else if (g_type_is_a (type, GIMP_TYPE_VECTORS))
     {
-      dnd_type = GIMP_DND_TYPE_VECTORS;
+      dnd_type = list ? GIMP_DND_TYPE_VECTORS_LIST : GIMP_DND_TYPE_VECTORS;
     }
   else if (g_type_is_a (type, GIMP_TYPE_BRUSH) && ! list)
     {
diff --git a/app/widgets/gimpdnd.h b/app/widgets/gimpdnd.h
index 5b3f93c991..52f2c774b9 100644
--- a/app/widgets/gimpdnd.h
+++ b/app/widgets/gimpdnd.h
@@ -100,6 +100,9 @@
 #define GIMP_TARGET_CHANNEL_LIST \
         { "application/x-gimp-channel-list", GTK_TARGET_SAME_APP, GIMP_DND_TYPE_CHANNEL_LIST }
 
+#define GIMP_TARGET_VECTORS_LIST \
+        { "application/x-gimp-vectors-list", GTK_TARGET_SAME_APP, GIMP_DND_TYPE_VECTORS_LIST }
+
 /*  dnd initialization  */
 
 void  gimp_dnd_init (Gimp *gimp);
diff --git a/app/widgets/widgets-enums.h b/app/widgets/widgets-enums.h
index 9adfefa60b..00e387026d 100644
--- a/app/widgets/widgets-enums.h
+++ b/app/widgets/widgets-enums.h
@@ -169,8 +169,9 @@ typedef enum  /*< skip >*/
 
   GIMP_DND_TYPE_LAYER_LIST   = 25,
   GIMP_DND_TYPE_CHANNEL_LIST = 26,
+  GIMP_DND_TYPE_VECTORS_LIST = 27,
 
-  GIMP_DND_TYPE_LAST         = GIMP_DND_TYPE_CHANNEL_LIST
+  GIMP_DND_TYPE_LAST         = GIMP_DND_TYPE_VECTORS_LIST
 } GimpDndType;
 
 typedef enum  /*< skip >*/


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