[gimp] libgimp: add convenience macros GIMP_VALUES_GET_FOO_ID()



commit 81ee690bbf8a63482044f3fd3fcb04568ebb716c
Author: Michael Natterer <mitch gimp org>
Date:   Thu Sep 5 13:22:37 2019 +0200

    libgimp: add convenience macros GIMP_VALUES_GET_FOO_ID()
    
    becuse some plug-ins really want the ID for good reasons and not the
    object, and code looks so much nicer when the entire list of arguments
    is extracted using the macros.

 libgimp/gimpprocedure-params.h | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
---
diff --git a/libgimp/gimpprocedure-params.h b/libgimp/gimpprocedure-params.h
index f5d08e2af2..23e70540b4 100644
--- a/libgimp/gimpprocedure-params.h
+++ b/libgimp/gimpprocedure-params.h
@@ -474,6 +474,9 @@ G_BEGIN_DECLS
 #define GIMP_VALUES_GET_DISPLAY(args, n) \
   g_value_get_object (gimp_value_array_index (args, n))
 
+#define GIMP_VALUES_GET_DISPLAY_ID(args, n) \
+  gimp_display_get_id (g_value_get_object (gimp_value_array_index (args, n)))
+
 #define GIMP_VALUES_SET_DISPLAY(args, n, value) \
   g_value_set_object (gimp_value_array_index (args, n), value)
 
@@ -495,6 +498,9 @@ G_BEGIN_DECLS
 #define GIMP_VALUES_GET_IMAGE(args, n) \
   g_value_get_object (gimp_value_array_index (args, n))
 
+#define GIMP_VALUES_GET_IMAGE_ID(args, n) \
+  gimp_image_get_id (g_value_get_object (gimp_value_array_index (args, n)))
+
 #define GIMP_VALUES_SET_IMAGE(args, n, value) \
   g_value_set_object (gimp_value_array_index (args, n), value)
 
@@ -516,6 +522,9 @@ G_BEGIN_DECLS
 #define GIMP_VALUES_GET_ITEM(args, n) \
   g_value_get_object (gimp_value_array_index (args, n))
 
+#define GIMP_VALUES_GET_ITEM_ID(args, n) \
+  gimp_item_get_id (g_value_get_object (gimp_value_array_index (args, n)))
+
 #define GIMP_VALUES_SET_ITEM(args, n, value) \
   g_value_set_object (gimp_value_array_index (args, n), value)
 
@@ -537,6 +546,9 @@ G_BEGIN_DECLS
 #define GIMP_VALUES_GET_DRAWABLE(args, n) \
   g_value_get_object (gimp_value_array_index (args, n))
 
+#define GIMP_VALUES_GET_DRAWABLE_ID(args, n) \
+  gimp_item_get_id (g_value_get_object (gimp_value_array_index (args, n)))
+
 #define GIMP_VALUES_SET_DRAWABLE(args, n, value) \
   g_value_set_object (gimp_value_array_index (args, n), value)
 
@@ -558,6 +570,9 @@ G_BEGIN_DECLS
 #define GIMP_VALUES_GET_LAYER(args, n) \
   g_value_get_object (gimp_value_array_index (args, n))
 
+#define GIMP_VALUES_GET_LAYER_ID(args, n) \
+  gimp_item_get_id (g_value_get_object (gimp_value_array_index (args, n)))
+
 #define GIMP_VALUES_SET_LAYER(args, n, value) \
   g_value_set_object (gimp_value_array_index (args, n), value)
 
@@ -579,6 +594,9 @@ G_BEGIN_DECLS
 #define GIMP_VALUES_GET_CHANNEL(args, n) \
   g_value_get_object (gimp_value_array_index (args, n))
 
+#define GIMP_VALUES_GET_CHANNEL_ID(args, n) \
+  gimp_item_get_id (g_value_get_object (gimp_value_array_index (args, n)))
+
 #define GIMP_VALUES_SET_CHANNEL(args, n, value) \
   g_value_set_object (gimp_value_array_index (args, n), value)
 
@@ -600,6 +618,9 @@ G_BEGIN_DECLS
 #define GIMP_VALUES_GET_LAYER_MASK(args, n) \
   g_value_get_object (gimp_value_array_index (args, n))
 
+#define GIMP_VALUES_GET_LAYER_MASK_ID(args, n) \
+  gimp_item_get_id (g_value_get_object (gimp_value_array_index (args, n)))
+
 #define GIMP_VALUES_SET_LAYER_MASK(args, n, value) \
   g_value_set_object (gimp_value_array_index (args, n), value)
 
@@ -621,6 +642,9 @@ G_BEGIN_DECLS
 #define GIMP_VALUES_GET_SELECTION(args, n) \
   g_value_get_object (gimp_value_array_index (args, n))
 
+#define GIMP_VALUES_GET_SELECTION_ID(args, n) \
+  gimp_item_get_id (g_value_get_object (gimp_value_array_index (args, n)))
+
 #define GIMP_VALUES_SET_SELECTION(args, n, value) \
   g_value_set_object (gimp_value_array_index (args, n), value)
 
@@ -642,6 +666,9 @@ G_BEGIN_DECLS
 #define GIMP_VALUES_GET_VECTORS(args, n) \
   g_value_get_object (gimp_value_array_index (args, n))
 
+#define GIMP_VALUES_GET_VECTORS_ID(args, n) \
+  gimp_item_get_id (g_value_get_object (gimp_value_array_index (args, n)))
+
 #define GIMP_VALUES_SET_VECTORS(args, n, value) \
   g_value_set_object (gimp_value_array_index (args, n), value)
 


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