[gimp/wip/Jehan/layers-dockable-refresh: 38/58] app: add multi-channel drag'n drop ability.




commit c79446bdb99861629187b2d5c8c9d4ac6d973127
Author: Jehan <jehan girinstud io>
Date:   Sun Jun 20 01:07:52 2021 +0200

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

 app/widgets/gimpcontainertreeview-dnd.c |  1 +
 app/widgets/gimpdnd.c                   | 18 ++++++++++++++++--
 app/widgets/gimpdnd.h                   |  2 ++
 app/widgets/widgets-enums.h             |  3 ++-
 4 files changed, 21 insertions(+), 3 deletions(-)
---
diff --git a/app/widgets/gimpcontainertreeview-dnd.c b/app/widgets/gimpcontainertreeview-dnd.c
index e961bcb915..5d1643a2b1 100644
--- a/app/widgets/gimpcontainertreeview-dnd.c
+++ b/app/widgets/gimpcontainertreeview-dnd.c
@@ -206,6 +206,7 @@ gimp_container_tree_view_drop_status (GimpContainerTreeView    *tree_view,
       }
       break;
 
+    case GIMP_DND_TYPE_CHANNEL_LIST:
     case GIMP_DND_TYPE_LAYER_LIST:
       /* Various GimpViewable list (GList) drag data. */
       {
diff --git a/app/widgets/gimpdnd.c b/app/widgets/gimpdnd.c
index 89ff18e7b4..30e7efcdd2 100644
--- a/app/widgets/gimpdnd.c
+++ b/app/widgets/gimpdnd.c
@@ -643,6 +643,20 @@ static const GimpDndDataDef dnd_data_defs[] =
     gimp_dnd_set_item_list_data,
   },
 
+  {
+    GIMP_TARGET_CHANNEL_LIST,
+
+    "gimp-dnd-get-channel-list-func",
+    "gimp-dnd-get-channel-list-data",
+
+    "gimp-dnd-set-channel-list-func",
+    "gimp-dnd-set-channel-list-data",
+
+    gimp_dnd_get_viewable_list_icon,
+    gimp_dnd_get_item_list_data,
+    gimp_dnd_set_item_list_data,
+  },
+
 };
 
 
@@ -1916,9 +1930,9 @@ gimp_dnd_data_type_get_by_g_type (GType    type,
     {
       dnd_type = GIMP_DND_TYPE_LAYER_MASK;
     }
-  else if (g_type_is_a (type, GIMP_TYPE_CHANNEL) && ! list)
+  else if (g_type_is_a (type, GIMP_TYPE_CHANNEL))
     {
-      dnd_type = GIMP_DND_TYPE_CHANNEL;
+      dnd_type = list ? GIMP_DND_TYPE_CHANNEL_LIST : GIMP_DND_TYPE_CHANNEL;
     }
   else if (g_type_is_a (type, GIMP_TYPE_VECTORS) && ! list)
     {
diff --git a/app/widgets/gimpdnd.h b/app/widgets/gimpdnd.h
index ac31c7f80e..5b3f93c991 100644
--- a/app/widgets/gimpdnd.h
+++ b/app/widgets/gimpdnd.h
@@ -97,6 +97,8 @@
 #define GIMP_TARGET_LAYER_LIST \
         { "application/x-gimp-layer-list", GTK_TARGET_SAME_APP, GIMP_DND_TYPE_LAYER_LIST }
 
+#define GIMP_TARGET_CHANNEL_LIST \
+        { "application/x-gimp-channel-list", GTK_TARGET_SAME_APP, GIMP_DND_TYPE_CHANNEL_LIST }
 
 /*  dnd initialization  */
 
diff --git a/app/widgets/widgets-enums.h b/app/widgets/widgets-enums.h
index e18a1c563d..9adfefa60b 100644
--- a/app/widgets/widgets-enums.h
+++ b/app/widgets/widgets-enums.h
@@ -168,8 +168,9 @@ typedef enum  /*< skip >*/
   GIMP_DND_TYPE_NOTEBOOK_TAB = 24,
 
   GIMP_DND_TYPE_LAYER_LIST   = 25,
+  GIMP_DND_TYPE_CHANNEL_LIST = 26,
 
-  GIMP_DND_TYPE_LAST         = GIMP_DND_TYPE_LAYER_LIST
+  GIMP_DND_TYPE_LAST         = GIMP_DND_TYPE_CHANNEL_LIST
 } GimpDndType;
 
 typedef enum  /*< skip >*/


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