[gimp] libgimp: add a gazillion of macros to gimpprocedure-params.h



commit 09eaf0295ad94d53a5813c00fd608597b262937a
Author: Michael Natterer <mitch gimp org>
Date:   Tue Aug 20 01:00:47 2019 +0200

    libgimp: add a gazillion of macros to gimpprocedure-params.h
    
    that make dealing with value arrays easier and shorter, e.g.
    
      g_value_get_boolean (gimp_value_array_index (args, n)):
    
    becomes:
    
      GIMP_VALUES_GET_BOOLEAN (args, n);

 libgimp/gimpprocedure-params.h | 255 +++++++++++++++++++++++++++++++++++++++--
 1 file changed, 247 insertions(+), 8 deletions(-)
---
diff --git a/libgimp/gimpprocedure-params.h b/libgimp/gimpprocedure-params.h
index 0ee23f2ae3..3df79e2525 100644
--- a/libgimp/gimpprocedure-params.h
+++ b/libgimp/gimpprocedure-params.h
@@ -41,6 +41,8 @@ G_BEGIN_DECLS
  **/
 
 
+/*  boolean  */
+
 #define GIMP_PROC_ARG_BOOLEAN(class, name, nick, blurb, default, flags) \
   gimp_procedure_add_argument (procedure,\
                                g_param_spec_boolean (name, nick, blurb,\
@@ -53,6 +55,15 @@ G_BEGIN_DECLS
                                    default,\
                                    flags))
 
+#define GIMP_VALUES_GET_BOOLEAN(args, n) \
+  g_value_get_boolean (gimp_value_array_index (args, n))
+
+#define GIMP_VALUES_SET_BOOLEAN(args, n, value) \
+  g_value_set_boolean (gimp_value_array_index (args, n), value)
+
+
+/*  int  */
+
 #define GIMP_PROC_ARG_INT(class, name, nick, blurb, min, max, default, flags) \
   gimp_procedure_add_argument (procedure,\
                                g_param_spec_int (name, nick, blurb,\
@@ -65,6 +76,15 @@ G_BEGIN_DECLS
                                    min, max, default,\
                                    flags))
 
+#define GIMP_VALUES_GET_INT(args, n) \
+  g_value_get_int (gimp_value_array_index (args, n))
+
+#define GIMP_VALUES_SET_INT(args, n, value) \
+  g_value_set_int (gimp_value_array_index (args, n), value)
+
+
+/*  uint  */
+
 #define GIMP_PROC_ARG_UINT(class, name, nick, blurb, min, max, default, flags) \
   gimp_procedure_add_argument (procedure,\
                                g_param_spec_uint (name, nick, blurb,\
@@ -77,6 +97,9 @@ G_BEGIN_DECLS
                                    min, max, default,\
                                    flags))
 
+
+/* uchar  */
+
 #define GIMP_PROC_ARG_UCHAR(class, name, nick, blurb, min, max, default, flags) \
   gimp_procedure_add_argument (procedure,\
                                g_param_spec_uchar (name, nick, blurb,\
@@ -89,6 +112,15 @@ G_BEGIN_DECLS
                                    min, max, default,\
                                    flags))
 
+#define GIMP_VALUES_GET_UCHAR(args, n) \
+  g_value_get_uchar (gimp_value_array_index (args, n))
+
+#define GIMP_VALUES_SET_UCHAR(args, n, value) \
+  g_value_set_uchar (gimp_value_array_index (args, n), value)
+
+
+/*  unit  */
+
 #define GIMP_PROC_ARG_UNIT(class, name, nick, blurb, pixels, percent, default, flags) \
   gimp_procedure_add_argument (procedure,\
                                gimp_param_spec_unit (name, nick, blurb,\
@@ -101,6 +133,9 @@ G_BEGIN_DECLS
                                    pixels, percent, default,\
                                    flags))
 
+
+/*  double  */
+
 #define GIMP_PROC_ARG_DOUBLE(class, name, nick, blurb, min, max, default, flags) \
   gimp_procedure_add_argument (procedure,\
                                g_param_spec_double (name, nick, blurb,\
@@ -113,6 +148,15 @@ G_BEGIN_DECLS
                                    min, max, default,\
                                    flags))
 
+#define GIMP_VALUES_GET_DOUBLE(args, n) \
+  g_value_get_double (gimp_value_array_index (args, n))
+
+#define GIMP_VALUES_SET_DOUBLE(args, n, value) \
+  g_value_set_double (gimp_value_array_index (args, n), value)
+
+
+/*  enum  */
+
 #define GIMP_PROC_ARG_ENUM(class, name, nick, blurb, enum_type, default, flags) \
   gimp_procedure_add_argument (procedure,\
                                g_param_spec_enum (name, nick, blurb,\
@@ -125,6 +169,15 @@ G_BEGIN_DECLS
                                    enum_type, default,\
                                    flags))
 
+#define GIMP_VALUES_GET_ENUM(args, n) \
+  g_value_get_enum (gimp_value_array_index (args, n))
+
+#define GIMP_VALUES_SET_ENUM(args, n, value) \
+  g_value_set_enum (gimp_value_array_index (args, n), value)
+
+
+/*  string  */
+
 #define GIMP_PROC_ARG_STRING(class, name, nick, blurb, default, flags) \
   gimp_procedure_add_argument (procedure,\
                                g_param_spec_string (name, nick, blurb,\
@@ -137,6 +190,21 @@ G_BEGIN_DECLS
                                    default,\
                                    flags))
 
+#define GIMP_VALUES_GET_STRING(args, n) \
+  g_value_get_string (gimp_value_array_index (args, n))
+
+#define GIMP_VALUES_DUP_STRING(args, n) \
+  g_value_dup_string (gimp_value_array_index (args, n))
+
+#define GIMP_VALUES_SET_STRING(args, n, value) \
+  g_value_set_string (gimp_value_array_index (args, n), value)
+
+#define GIMP_VALUES_TAKE_STRING(args, n, value) \
+  g_value_take_string (gimp_value_array_index (args, n), value)
+
+
+/*  rgb  */
+
 #define GIMP_PROC_ARG_RGB(class, name, nick, blurb, has_alpha, default, flags) \
   gimp_procedure_add_argument (procedure,\
                                gimp_param_spec_rgb (name, nick, blurb,\
@@ -149,7 +217,16 @@ G_BEGIN_DECLS
                                    has_alpha, default, \
                                    flags))
 
-#define GIMP_PROC_ARG_UINT8_ARRAY(class, name, nick, blurb, flags) \
+#define GIMP_VALUES_GET_RGB(args, n, value) \
+  gimp_value_get_rgb (gimp_value_array_index (args, n), value)
+
+#define GIMP_VALUES_SET_RGB(args, n, value) \
+  gimp_value_set_rgb (gimp_value_array_index (args, n), value)
+
+
+/*  uint8 array  */
+
+#define GIMP_PROC_ARG_UINT8_ARRAY(class, name, nick, blurb, flags)      \
   gimp_procedure_add_argument (procedure,\
                                gimp_param_spec_uint8_array (name, nick, blurb,\
                                flags))
@@ -159,27 +236,72 @@ G_BEGIN_DECLS
                                    gimp_param_spec_uint8_array (name, nick, blurb,\
                                    flags))
 
+#define GIMP_VALUES_GET_UINT8_ARRAY(args, n) \
+  gimp_value_get_uint8_array (gimp_value_array_index (args, n))
+
+#define GIMP_VALUES_DUP_UINT8_ARRAY(args, n) \
+  gimp_value_dup_uint8_array (gimp_value_array_index (args, n))
+
+#define GIMP_VALUES_SET_UINT8_ARRAY(args, n, value) \
+  gimp_value_set_uint8_array (gimp_value_array_index (args, n), value)
+
+#define GIMP_VALUES_TAKE_UINT8_ARRAY(args, n, value) \
+  gimp_value_take_uint8_array (gimp_value_array_index (args, n), value)
+
+
+/*  int16 array  */
+
 #define GIMP_PROC_ARG_INT16_ARRAY(class, name, nick, blurb, flags) \
   gimp_procedure_add_argument (procedure,\
                                gimp_param_spec_int16_array (name, nick, blurb,\
                                flags))
 
-#define GIMP_PROC_VAL_INT16_ARRAY(class, name, nick, blurb, flags) \
+#define GIMP_PROC_VAL_INT16_ARRAY(class, name, nick, blurb, flags)      \
   gimp_procedure_add_return_value (procedure,\
                                    gimp_param_spec_int16_array (name, nick, blurb,\
                                    flags))
 
+#define GIMP_VALUES_GET_INT16_ARRAY(args, n)                    \
+  gimp_value_get_int16_array (gimp_value_array_index (args, n))
+
+#define GIMP_VALUES_DUP_INT16_ARRAY(args, n)                    \
+  gimp_value_dup_int16_array (gimp_value_array_index (args, n))
+
+#define GIMP_VALUES_SET_INT16_ARRAY(args, n, value) \
+  gimp_value_set_int16_array (gimp_value_array_index (args, n), value)
+
+#define GIMP_VALUES_TAKE_INT16_ARRAY(args, n, value) \
+  gimp_value_take_int16_array (gimp_value_array_index (args, n), value)
+
+
+/*  int32 array  */
+
 #define GIMP_PROC_ARG_INT32_ARRAY(class, name, nick, blurb, flags) \
   gimp_procedure_add_argument (procedure,\
                                gimp_param_spec_int32_array (name, nick, blurb,\
                                flags))
 
-#define GIMP_PROC_VAL_INT32_ARRAY(class, name, nick, blurb, flags) \
+#define GIMP_PROC_VAL_INT32_ARRAY(class, name, nick, blurb, flags)      \
   gimp_procedure_add_return_value (procedure,\
                                    gimp_param_spec_int32_array (name, nick, blurb,\
                                    flags))
 
-#define GIMP_PROC_ARG_FLOAT_ARRAY(class, name, nick, blurb, flags) \
+#define GIMP_VALUES_GET_INT32_ARRAY(args, n) \
+  gimp_value_get_int32_array (gimp_value_array_index (args, n))
+
+#define GIMP_VALUES_DUP_INT32_ARRAY(args, n) \
+  gimp_value_dup_int32_array (gimp_value_array_index (args, n))
+
+#define GIMP_VALUES_SET_INT32_ARRAY(args, n, value) \
+  gimp_value_set_int32_array (gimp_value_array_index (args, n), value)
+
+#define GIMP_VALUES_TAKE_INT32_ARRAY(args, n, value) \
+  gimp_value_take_int32_array (gimp_value_array_index (args, n), value)
+
+
+/*  float array  */
+
+#define GIMP_PROC_ARG_FLOAT_ARRAY(class, name, nick, blurb, flags)      \
   gimp_procedure_add_argument (procedure,\
                                gimp_param_spec_float_array (name, nick, blurb,\
                                flags))
@@ -189,7 +311,22 @@ G_BEGIN_DECLS
                                    gimp_param_spec_float_array (name, nick, blurb,\
                                    flags))
 
-#define GIMP_PROC_ARG_STRING_ARRAY(class, name, nick, blurb, flags) \
+#define GIMP_VALUES_GET_FLOAT_ARRAY(args, n) \
+  gimp_value_get_float_array (gimp_value_array_index (args, n))
+
+#define GIMP_VALUES_DUP_FLOAT_ARRAY(args, n) \
+  gimp_value_dup_float_array (gimp_value_array_index (args, n))
+
+#define GIMP_VALUES_SET_FLOAT_ARRAY(args, n, value) \
+  gimp_value_set_float_array (gimp_value_array_index (args, n), value)
+
+#define GIMP_VALUES_TAKE_FLOAT_ARRAY(args, n, value) \
+  gimp_value_take_float_array (gimp_value_array_index (args, n), value)
+
+
+/*  string array  */
+
+#define GIMP_PROC_ARG_STRING_ARRAY(class, name, nick, blurb, flags)     \
   gimp_procedure_add_argument (procedure,\
                                gimp_param_spec_string_array (name, nick, blurb,\
                                flags))
@@ -199,7 +336,22 @@ G_BEGIN_DECLS
                                    gimp_param_spec_string_array (name, nick, blurb,\
                                    flags))
 
-#define GIMP_PROC_ARG_RGB_ARRAY(class, name, nick, blurb, flags) \
+#define GIMP_VALUES_GET_STRING_ARRAY(args, n) \
+  gimp_value_get_string_array (gimp_value_array_index (args, n))
+
+#define GIMP_VALUES_DUP_STRING_ARRAY(args, n) \
+  gimp_value_dup_string_array (gimp_value_array_index (args, n))
+
+#define GIMP_VALUES_SET_STRING_ARRAY(args, n, value) \
+  gimp_value_set_string_array (gimp_value_array_index (args, n), value)
+
+#define GIMP_VALUES_TAKE_STRING_ARRAY(args, n, value) \
+  gimp_value_take_string_array (gimp_value_array_index (args, n), value)
+
+
+/*  rgb array  */
+
+#define GIMP_PROC_ARG_RGB_ARRAY(class, name, nick, blurb, flags)        \
   gimp_procedure_add_argument (procedure,\
                                gimp_param_spec_rgb_array (name, nick, blurb,\
                                flags))
@@ -209,6 +361,21 @@ G_BEGIN_DECLS
                                    gimp_param_spec_rgb_array (name, nick, blurb,\
                                    flags))
 
+#define GIMP_VALUES_GET_RGB_ARRAY(args, n) \
+  gimp_value_get_rgb_array (gimp_value_array_index (args, n))
+
+#define GIMP_VALUES_DUP_RGB_ARRAY(args, n) \
+  gimp_value_dup_rgb_array (gimp_value_array_index (args, n))
+
+#define GIMP_VALUES_SET_RGB_ARRAY(args, n, value) \
+  gimp_value_set_rgb_array (gimp_value_array_index (args, n), value)
+
+#define GIMP_VALUES_TAKE_RGB_ARRAY(args, n, value) \
+  gimp_value_take_rgb_array (gimp_value_array_index (args, n), value)
+
+
+/*  display  */
+
 #define GIMP_PROC_ARG_DISPLAY(class, name, nick, blurb, none_ok, flags) \
   gimp_procedure_add_argument (procedure,\
                                gimp_param_spec_display_id (name, nick, blurb,\
@@ -221,6 +388,9 @@ G_BEGIN_DECLS
                                    none_ok, \
                                    flags))
 
+
+/*  image  */
+
 #define GIMP_PROC_ARG_IMAGE(class, name, nick, blurb, none_ok, flags) \
   gimp_procedure_add_argument (procedure,\
                                gimp_param_spec_image_id (name, nick, blurb,\
@@ -233,7 +403,16 @@ G_BEGIN_DECLS
                                    none_ok, \
                                    flags))
 
-#define GIMP_PROC_ARG_ITEM(class, name, nick, blurb, none_ok, flags) \
+#define GIMP_VALUES_GET_IMAGE(args, n) \
+  gimp_value_get_image_id (gimp_value_array_index (args, n))
+
+#define GIMP_VALUES_SET_IMAGE(args, n, value) \
+  gimp_value_set_image_id (gimp_value_array_index (args, n), value)
+
+
+/*  item  */
+
+#define GIMP_PROC_ARG_ITEM(class, name, nick, blurb, none_ok, flags)    \
   gimp_procedure_add_argument (procedure,\
                                gimp_param_spec_item_id (name, nick, blurb,\
                                none_ok, \
@@ -245,6 +424,15 @@ G_BEGIN_DECLS
                                    none_ok, \
                                    flags))
 
+#define GIMP_VALUES_GET_ITEM(args, n) \
+  gimp_value_get_item_id (gimp_value_array_index (args, n))
+
+#define GIMP_VALUES_SET_ITEM(args, n, value) \
+  gimp_value_set_item_id (gimp_value_array_index (args, n), value)
+
+
+/*  drawable  */
+
 #define GIMP_PROC_ARG_DRAWABLE(class, name, nick, blurb, none_ok, flags) \
   gimp_procedure_add_argument (procedure,\
                                gimp_param_spec_drawable_id (name, nick, blurb,\
@@ -257,7 +445,16 @@ G_BEGIN_DECLS
                                    none_ok, \
                                    flags))
 
-#define GIMP_PROC_ARG_LAYER(class, name, nick, blurb, none_ok, flags) \
+#define GIMP_VALUES_GET_DRAWABLE(args, n) \
+  gimp_value_get_drawable_id (gimp_value_array_index (args, n))
+
+#define GIMP_VALUES_SET_DRAWABLE(args, n, value) \
+  gimp_value_set_drawable_id (gimp_value_array_index (args, n), value)
+
+
+/*  layer */
+
+#define GIMP_PROC_ARG_LAYER(class, name, nick, blurb, none_ok, flags)   \
   gimp_procedure_add_argument (procedure,\
                                gimp_param_spec_layer_id (name, nick, blurb,\
                                none_ok, \
@@ -269,6 +466,15 @@ G_BEGIN_DECLS
                                    none_ok, \
                                    flags))
 
+#define GIMP_VALUES_GET_LAYER(args, n) \
+  gimp_value_get_layer_id (gimp_value_array_index (args, n))
+
+#define GIMP_VALUES_SET_LAYER(args, n, value) \
+  gimp_value_set_layer_id (gimp_value_array_index (args, n), value)
+
+
+/*  channel  */
+
 #define GIMP_PROC_ARG_CHANNEL(class, name, nick, blurb, none_ok, flags) \
   gimp_procedure_add_argument (procedure,\
                                gimp_param_spec_channel_id (name, nick, blurb,\
@@ -281,6 +487,15 @@ G_BEGIN_DECLS
                                    none_ok, \
                                    flags))
 
+#define GIMP_VALUES_GET_CHANNEL(args, n) \
+  gimp_value_get_channel_id (gimp_value_array_index (args, n))
+
+#define GIMP_VALUES_SET_CHANNEL(args, n, value) \
+  gimp_value_set_channel_id (gimp_value_array_index (args, n), value)
+
+
+/*  layer mask  */
+
 #define GIMP_PROC_ARG_LAYER_MASK(class, name, nick, blurb, none_ok, flags) \
   gimp_procedure_add_argument (procedure,\
                                gimp_param_spec_layer_mask_id (name, nick, blurb,\
@@ -293,6 +508,15 @@ G_BEGIN_DECLS
                                    none_ok, \
                                    flags))
 
+#define GIMP_VALUES_GET_LAYER_MASK(args, n) \
+  gimp_value_get_layer_mask_id (gimp_value_array_index (args, n))
+
+#define GIMP_VALUES_SET_LAYER_MASK(args, n, value) \
+  gimp_value_set_layer_mask_id (gimp_value_array_index (args, n), value)
+
+
+/*  selection  */
+
 #define GIMP_PROC_ARG_SELECTION(class, name, nick, blurb, none_ok, flags) \
   gimp_procedure_add_argument (procedure,\
                                gimp_param_spec_selection_id (name, nick, blurb,\
@@ -305,6 +529,15 @@ G_BEGIN_DECLS
                                    none_ok, \
                                    flags))
 
+#define GIMP_VALUES_GET_SELECTION(args, n) \
+  gimp_value_get_selection_id (gimp_value_array_index (args, n))
+
+#define GIMP_VALUES_SET_SELECTION(args, n, value) \
+  gimp_value_set_selection_id (gimp_value_array_index (args, n), value)
+
+
+/*  vectors  */
+
 #define GIMP_PROC_ARG_VECTORS(class, name, nick, blurb, none_ok, flags) \
   gimp_procedure_add_argument (procedure,\
                                gimp_param_spec_vectors_id (name, nick, blurb,\
@@ -317,6 +550,12 @@ G_BEGIN_DECLS
                                    none_ok, \
                                    flags))
 
+#define GIMP_VALUES_GET_VECTORS(args, n) \
+  gimp_value_get_vectors_id (gimp_value_array_index (args, n))
+
+#define GIMP_VALUES_SET_VECTORS(args, n, value) \
+  gimp_value_set_vectors_id (gimp_value_array_index (args, n), value)
+
 
 G_END_DECLS
 


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