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

and rename them to GimpLayerBlendTRC and GimpLayerCompositeMode.
This commit is contained in:
Michael Natterer 2017-01-17 01:19:06 +01:00
parent e267d87963
commit 5c4eb75361
3 changed files with 116 additions and 3 deletions

View File

@ -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

View File

@ -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 */

View File

@ -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__ */