[gimp] app: register the enums in operations-enums.h as GTypes



commit 5c4eb753616b35ac126e9caeab6aba3fa0a8af84
Author: Michael Natterer <mitch gimp org>
Date:   Tue Jan 17 01:19:06 2017 +0100

    app: register the enums in operations-enums.h as GTypes
    
    and rename them to GimpLayerBlendTRC and GimpLayerCompositeMode.

 app/operations/Makefile.am        |   29 +++++++++++++-
 app/operations/operations-enums.c |   77 +++++++++++++++++++++++++++++++++++++
 app/operations/operations-enums.h |   13 +++++-
 3 files changed, 116 insertions(+), 3 deletions(-)
---
diff --git a/app/operations/Makefile.am b/app/operations/Makefile.am
index 368f518..840b118 100644
--- a/app/operations/Makefile.am
+++ b/app/operations/Makefile.am
@@ -19,7 +19,7 @@ AM_CPPFLAGS = \
 noinst_LIBRARIES = \
        libappoperations.a
 
-libappoperations_a_SOURCES = \
+libappoperations_a_sources = \
        operations-types.h                      \
        operations-enums.h                      \
        gimp-operations.c                       \
@@ -95,3 +95,30 @@ libappoperations_a_SOURCES = \
        gimpoperationposterize.h                \
        gimpoperationthreshold.c                \
        gimpoperationthreshold.h
+
+libappoperations_a_built_sources = operations-enums.c
+
+libappoperations_a_SOURCES = \
+       $(libappoperations_a_built_sources)     \
+       $(libappoperations_a_sources)
+
+#
+# rules to generate built sources
+#
+# setup autogeneration dependencies
+gen_sources = xgen-pec
+CLEANFILES = $(gen_sources)
+
+operations-enums.c: $(srcdir)/operations-enums.h $(GIMP_MKENUMS)
+       $(GIMP_MKENUMS) \
+               --fhead "#include \"config.h\"\n#include <gio/gio.h>\n#include 
\"libgimpbase/gimpbase.h\"\n#include \"operations-enums.h\"\n#include \"gimp-intl.h\"" \
+               --fprod "\n/* enumerations from \"@filename@\" */" \
+               --vhead "GType\n@enum_name@_get_type (void)\n{\n  static const G@Type@Value values[] =\n  {" \
+               --vprod "    { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
+               --vtail "    { 0, NULL, NULL }\n  };\n" \
+               --dhead "  static const Gimp@Type@Desc descs[] =\n  {" \
+               --dprod "    { @VALUENAME@, @valuedesc@, @valuehelp@ }," \
+               --dtail "    { 0, NULL, NULL }\n  };\n\n  static GType type = 0;\n\n  if (G_UNLIKELY (! 
type))\n    {\n      type = g_@type@_register_static (\"@EnumName@\", values);\n      
gimp_type_set_translation_context (type, \"@enumnick@\");\n      gimp_@type@_set_value_descriptions (type, 
descs);\n    }\n\n  return type;\n}\n" \
+               $(srcdir)/operations-enums.h > xgen-pec \
+       && cp xgen-pec $(@F) \
+       && rm -f xgen-pec
diff --git a/app/operations/operations-enums.c b/app/operations/operations-enums.c
new file mode 100644
index 0000000..bc9691d
--- /dev/null
+++ b/app/operations/operations-enums.c
@@ -0,0 +1,77 @@
+
+/* Generated data (by gimp-mkenums) */
+
+#include "config.h"
+#include <gio/gio.h>
+#include "libgimpbase/gimpbase.h"
+#include "operations-enums.h"
+#include "gimp-intl.h"
+
+/* enumerations from "./operations-enums.h" */
+GType
+gimp_layer_blend_trc_get_type (void)
+{
+  static const GEnumValue values[] =
+  {
+    { GIMP_LAYER_BLEND_RGB_LINEAR, "GIMP_LAYER_BLEND_RGB_LINEAR", "rgb-linear" },
+    { GIMP_LAYER_BLEND_RGB_PERCEPTUAL, "GIMP_LAYER_BLEND_RGB_PERCEPTUAL", "rgb-perceptual" },
+    { GIMP_LAYER_BLEND_LAB, "GIMP_LAYER_BLEND_LAB", "lab" },
+    { 0, NULL, NULL }
+  };
+
+  static const GimpEnumDesc descs[] =
+  {
+    { GIMP_LAYER_BLEND_RGB_LINEAR, "GIMP_LAYER_BLEND_RGB_LINEAR", NULL },
+    { GIMP_LAYER_BLEND_RGB_PERCEPTUAL, "GIMP_LAYER_BLEND_RGB_PERCEPTUAL", NULL },
+    { GIMP_LAYER_BLEND_LAB, "GIMP_LAYER_BLEND_LAB", NULL },
+    { 0, NULL, NULL }
+  };
+
+  static GType type = 0;
+
+  if (G_UNLIKELY (! type))
+    {
+      type = g_enum_register_static ("GimpLayerBlendTRC", values);
+      gimp_type_set_translation_context (type, "layer-blend-trc");
+      gimp_enum_set_value_descriptions (type, descs);
+    }
+
+  return type;
+}
+
+GType
+gimp_layer_composite_mode_get_type (void)
+{
+  static const GEnumValue values[] =
+  {
+    { GIMP_LAYER_COMPOSITE_SRC_ATOP, "GIMP_LAYER_COMPOSITE_SRC_ATOP", "src-atop" },
+    { GIMP_LAYER_COMPOSITE_SRC_OVER, "GIMP_LAYER_COMPOSITE_SRC_OVER", "src-over" },
+    { GIMP_LAYER_COMPOSITE_SRC_IN, "GIMP_LAYER_COMPOSITE_SRC_IN", "src-in" },
+    { GIMP_LAYER_COMPOSITE_DST_ATOP, "GIMP_LAYER_COMPOSITE_DST_ATOP", "dst-atop" },
+    { 0, NULL, NULL }
+  };
+
+  static const GimpEnumDesc descs[] =
+  {
+    { GIMP_LAYER_COMPOSITE_SRC_ATOP, "GIMP_LAYER_COMPOSITE_SRC_ATOP", NULL },
+    { GIMP_LAYER_COMPOSITE_SRC_OVER, "GIMP_LAYER_COMPOSITE_SRC_OVER", NULL },
+    { GIMP_LAYER_COMPOSITE_SRC_IN, "GIMP_LAYER_COMPOSITE_SRC_IN", NULL },
+    { GIMP_LAYER_COMPOSITE_DST_ATOP, "GIMP_LAYER_COMPOSITE_DST_ATOP", NULL },
+    { 0, NULL, NULL }
+  };
+
+  static GType type = 0;
+
+  if (G_UNLIKELY (! type))
+    {
+      type = g_enum_register_static ("GimpLayerCompositeMode", values);
+      gimp_type_set_translation_context (type, "layer-composite-mode");
+      gimp_enum_set_value_descriptions (type, descs);
+    }
+
+  return type;
+}
+
+
+/* Generated data ends here */
+
diff --git a/app/operations/operations-enums.h b/app/operations/operations-enums.h
index 37126bb..6b3ad20 100644
--- a/app/operations/operations-enums.h
+++ b/app/operations/operations-enums.h
@@ -21,12 +21,21 @@
 #define __OPERATIONS_ENUMS_H__
 
 
+#define GIMP_TYPE_LAYER_BLEND_TRC (gimp_layer_blend_trc_get_type ())
+
+GType gimp_layer_blend_trc_get_type (void) G_GNUC_CONST;
+
 typedef enum
 {
   GIMP_LAYER_BLEND_RGB_LINEAR,
   GIMP_LAYER_BLEND_RGB_PERCEPTUAL,
   GIMP_LAYER_BLEND_LAB,
-} GimpBlendBlend;
+} GimpLayerBlendTRC;
+
+
+#define GIMP_TYPE_LAYER_COMPOSITE_MODE (gimp_layer_composite_mode_get_type ())
+
+GType gimp_layer_composite_mode_get_type (void) G_GNUC_CONST;
 
 typedef enum
 {
@@ -34,7 +43,7 @@ typedef enum
   GIMP_LAYER_COMPOSITE_SRC_OVER,
   GIMP_LAYER_COMPOSITE_SRC_IN,
   GIMP_LAYER_COMPOSITE_DST_ATOP
-} GimpLayerComposite;
+} GimpLayerCompositeMode;
 
 
 #endif /* __OPERATIONS_ENUMS_H__ */


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