libgimpbase: rename enum GimpHueRange's values

and add compat cruft for the old names.
This commit is contained in:
Michael Natterer 2017-01-09 02:45:16 +01:00
parent a2006110eb
commit 178794f6f1
12 changed files with 159 additions and 67 deletions

View File

@ -94,7 +94,7 @@ gimp_hue_saturation_config_class_init (GimpHueSaturationConfigClass *klass)
_("Range"), _("Range"),
_("The affected range"), _("The affected range"),
GIMP_TYPE_HUE_RANGE, GIMP_TYPE_HUE_RANGE,
GIMP_ALL_HUES, 0); GIMP_HUE_RANGE_ALL, 0);
GIMP_CONFIG_PROP_DOUBLE (object_class, PROP_HUE, GIMP_CONFIG_PROP_DOUBLE (object_class, PROP_HUE,
"hue", "hue",
@ -227,7 +227,7 @@ gimp_hue_saturation_config_serialize (GimpConfig *config,
old_range = hs_config->range; old_range = hs_config->range;
for (range = GIMP_ALL_HUES; range <= GIMP_MAGENTA_HUES; range++) for (range = GIMP_HUE_RANGE_ALL; range <= GIMP_HUE_RANGE_MAGENTA; range++)
{ {
hs_config->range = range; hs_config->range = range;
@ -280,7 +280,7 @@ gimp_hue_saturation_config_equal (GimpConfig *a,
GimpHueSaturationConfig *config_b = GIMP_HUE_SATURATION_CONFIG (b); GimpHueSaturationConfig *config_b = GIMP_HUE_SATURATION_CONFIG (b);
GimpHueRange range; GimpHueRange range;
for (range = GIMP_ALL_HUES; range <= GIMP_MAGENTA_HUES; range++) for (range = GIMP_HUE_RANGE_ALL; range <= GIMP_HUE_RANGE_MAGENTA; range++)
{ {
if (config_a->hue[range] != config_b->hue[range] || if (config_a->hue[range] != config_b->hue[range] ||
config_a->saturation[range] != config_b->saturation[range] || config_a->saturation[range] != config_b->saturation[range] ||
@ -302,7 +302,7 @@ gimp_hue_saturation_config_reset (GimpConfig *config)
GimpHueSaturationConfig *hs_config = GIMP_HUE_SATURATION_CONFIG (config); GimpHueSaturationConfig *hs_config = GIMP_HUE_SATURATION_CONFIG (config);
GimpHueRange range; GimpHueRange range;
for (range = GIMP_ALL_HUES; range <= GIMP_MAGENTA_HUES; range++) for (range = GIMP_HUE_RANGE_ALL; range <= GIMP_HUE_RANGE_MAGENTA; range++)
{ {
hs_config->range = range; hs_config->range = range;
gimp_hue_saturation_config_reset_range (hs_config); gimp_hue_saturation_config_reset_range (hs_config);
@ -321,7 +321,7 @@ gimp_hue_saturation_config_copy (GimpConfig *src,
GimpHueSaturationConfig *dest_config = GIMP_HUE_SATURATION_CONFIG (dest); GimpHueSaturationConfig *dest_config = GIMP_HUE_SATURATION_CONFIG (dest);
GimpHueRange range; GimpHueRange range;
for (range = GIMP_ALL_HUES; range <= GIMP_MAGENTA_HUES; range++) for (range = GIMP_HUE_RANGE_ALL; range <= GIMP_HUE_RANGE_MAGENTA; range++)
{ {
dest_config->hue[range] = src_config->hue[range]; dest_config->hue[range] = src_config->hue[range];
dest_config->saturation[range] = src_config->saturation[range]; dest_config->saturation[range] = src_config->saturation[range];

View File

@ -85,7 +85,7 @@ map_hue (GimpHueSaturationConfig *config,
GimpHueRange range, GimpHueRange range,
gdouble value) gdouble value)
{ {
value += (config->hue[GIMP_ALL_HUES] + config->hue[range]) / 2.0; value += (config->hue[GIMP_HUE_RANGE_ALL] + config->hue[range]) / 2.0;
if (value < 0) if (value < 0)
return value + 1.0; return value + 1.0;
@ -117,7 +117,7 @@ map_hue_overlap (GimpHueSaturationConfig *config,
gdouble v = config->hue[primary_range] * primary_intensity + gdouble v = config->hue[primary_range] * primary_intensity +
config->hue[secondary_range] * secondary_intensity; config->hue[secondary_range] * secondary_intensity;
value += (config->hue[GIMP_ALL_HUES] + v) / 2.0; value += (config->hue[GIMP_HUE_RANGE_ALL] + v) / 2.0;
if (value < 0) if (value < 0)
return value + 1.0; return value + 1.0;
@ -132,7 +132,7 @@ map_saturation (GimpHueSaturationConfig *config,
GimpHueRange range, GimpHueRange range,
gdouble value) gdouble value)
{ {
gdouble v = config->saturation[GIMP_ALL_HUES] + config->saturation[range]; gdouble v = config->saturation[GIMP_HUE_RANGE_ALL] + config->saturation[range];
/* This change affects the way saturation is computed. With the old /* This change affects the way saturation is computed. With the old
* code (different code for value < 0), increasing the saturation * code (different code for value < 0), increasing the saturation
@ -152,7 +152,7 @@ map_lightness (GimpHueSaturationConfig *config,
GimpHueRange range, GimpHueRange range,
gdouble value) gdouble value)
{ {
gdouble v = (config->lightness[GIMP_ALL_HUES] + config->lightness[range]) / 2.0; gdouble v = (config->lightness[GIMP_HUE_RANGE_ALL] + config->lightness[range]) / 2.0;
if (v < 0) if (v < 0)
return value * (v + 1.0); return value * (v + 1.0);

View File

@ -1349,7 +1349,7 @@ register_color_procs (GimpPDB *pdb)
"hue range", "hue range",
"Range of affected hues", "Range of affected hues",
GIMP_TYPE_HUE_RANGE, GIMP_TYPE_HUE_RANGE,
GIMP_ALL_HUES, GIMP_HUE_RANGE_ALL,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure, gimp_procedure_add_argument (procedure,
g_param_spec_double ("hue-offset", g_param_spec_double ("hue-offset",

View File

@ -1104,7 +1104,7 @@ register_drawable_color_procs (GimpPDB *pdb)
"hue range", "hue range",
"Range of affected hues", "Range of affected hues",
GIMP_TYPE_HUE_RANGE, GIMP_TYPE_HUE_RANGE,
GIMP_ALL_HUES, GIMP_HUE_RANGE_ALL,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure, gimp_procedure_add_argument (procedure,
g_param_spec_double ("hue-offset", g_param_spec_double ("hue-offset",

View File

@ -59,6 +59,8 @@ gimp_base_init (GimpUnitVtable *vtable)
(gpointer) GIMP_TYPE_CONVOLVE_TYPE_COMPAT); (gpointer) GIMP_TYPE_CONVOLVE_TYPE_COMPAT);
g_type_set_qdata (GIMP_TYPE_FILL_TYPE, quark, g_type_set_qdata (GIMP_TYPE_FILL_TYPE, quark,
(gpointer) GIMP_TYPE_FILL_TYPE_COMPAT); (gpointer) GIMP_TYPE_FILL_TYPE_COMPAT);
g_type_set_qdata (GIMP_TYPE_HUE_RANGE, quark,
(gpointer) GIMP_TYPE_HUE_RANGE_COMPAT);
gimp_base_initialized = TRUE; gimp_base_initialized = TRUE;
} }

View File

@ -783,25 +783,25 @@ gimp_hue_range_get_type (void)
{ {
static const GEnumValue values[] = static const GEnumValue values[] =
{ {
{ GIMP_ALL_HUES, "GIMP_ALL_HUES", "all-hues" }, { GIMP_HUE_RANGE_ALL, "GIMP_HUE_RANGE_ALL", "all" },
{ GIMP_RED_HUES, "GIMP_RED_HUES", "red-hues" }, { GIMP_HUE_RANGE_RED, "GIMP_HUE_RANGE_RED", "red" },
{ GIMP_YELLOW_HUES, "GIMP_YELLOW_HUES", "yellow-hues" }, { GIMP_HUE_RANGE_YELLOW, "GIMP_HUE_RANGE_YELLOW", "yellow" },
{ GIMP_GREEN_HUES, "GIMP_GREEN_HUES", "green-hues" }, { GIMP_HUE_RANGE_GREEN, "GIMP_HUE_RANGE_GREEN", "green" },
{ GIMP_CYAN_HUES, "GIMP_CYAN_HUES", "cyan-hues" }, { GIMP_HUE_RANGE_CYAN, "GIMP_HUE_RANGE_CYAN", "cyan" },
{ GIMP_BLUE_HUES, "GIMP_BLUE_HUES", "blue-hues" }, { GIMP_HUE_RANGE_BLUE, "GIMP_HUE_RANGE_BLUE", "blue" },
{ GIMP_MAGENTA_HUES, "GIMP_MAGENTA_HUES", "magenta-hues" }, { GIMP_HUE_RANGE_MAGENTA, "GIMP_HUE_RANGE_MAGENTA", "magenta" },
{ 0, NULL, NULL } { 0, NULL, NULL }
}; };
static const GimpEnumDesc descs[] = static const GimpEnumDesc descs[] =
{ {
{ GIMP_ALL_HUES, "GIMP_ALL_HUES", NULL }, { GIMP_HUE_RANGE_ALL, "GIMP_HUE_RANGE_ALL", NULL },
{ GIMP_RED_HUES, "GIMP_RED_HUES", NULL }, { GIMP_HUE_RANGE_RED, "GIMP_HUE_RANGE_RED", NULL },
{ GIMP_YELLOW_HUES, "GIMP_YELLOW_HUES", NULL }, { GIMP_HUE_RANGE_YELLOW, "GIMP_HUE_RANGE_YELLOW", NULL },
{ GIMP_GREEN_HUES, "GIMP_GREEN_HUES", NULL }, { GIMP_HUE_RANGE_GREEN, "GIMP_HUE_RANGE_GREEN", NULL },
{ GIMP_CYAN_HUES, "GIMP_CYAN_HUES", NULL }, { GIMP_HUE_RANGE_CYAN, "GIMP_HUE_RANGE_CYAN", NULL },
{ GIMP_BLUE_HUES, "GIMP_BLUE_HUES", NULL }, { GIMP_HUE_RANGE_BLUE, "GIMP_HUE_RANGE_BLUE", NULL },
{ GIMP_MAGENTA_HUES, "GIMP_MAGENTA_HUES", NULL }, { GIMP_HUE_RANGE_MAGENTA, "GIMP_HUE_RANGE_MAGENTA", NULL },
{ 0, NULL, NULL } { 0, NULL, NULL }
}; };

View File

@ -388,13 +388,23 @@ GType gimp_hue_range_get_type (void) G_GNUC_CONST;
typedef enum typedef enum
{ {
GIMP_ALL_HUES, GIMP_HUE_RANGE_ALL,
GIMP_RED_HUES, GIMP_HUE_RANGE_RED,
GIMP_YELLOW_HUES, GIMP_HUE_RANGE_YELLOW,
GIMP_GREEN_HUES, GIMP_HUE_RANGE_GREEN,
GIMP_CYAN_HUES, GIMP_HUE_RANGE_CYAN,
GIMP_BLUE_HUES, GIMP_HUE_RANGE_BLUE,
GIMP_MAGENTA_HUES GIMP_HUE_RANGE_MAGENTA,
#ifndef GIMP_DISABLE_DEPRECATED
GIMP_ALL_HUES = GIMP_HUE_RANGE_ALL, /*< skip, pdb-skip >*/
GIMP_RED_HUES = GIMP_HUE_RANGE_RED, /*< skip, pdb-skip >*/
GIMP_YELLOW_HUES = GIMP_HUE_RANGE_YELLOW, /*< skip, pdb-skip >*/
GIMP_GREEN_HUES = GIMP_HUE_RANGE_GREEN, /*< skip, pdb-skip >*/
GIMP_CYAN_HUES = GIMP_HUE_RANGE_CYAN, /*< skip, pdb-skip >*/
GIMP_BLUE_HUES = GIMP_HUE_RANGE_BLUE, /*< skip, pdb-skip >*/
GIMP_MAGENTA_HUES = GIMP_HUE_RANGE_MAGENTA /*< skip, pdb-skip >*/
#endif /* GIMP_DISABLE_DEPRECATED */
} GimpHueRange; } GimpHueRange;

View File

@ -210,6 +210,46 @@ gimp_fill_type_compat_get_type (void)
return type; return type;
} }
GType
gimp_hue_range_compat_get_type (void)
{
static const GEnumValue values[] =
{
{ GIMP_ALL_HUES, "GIMP_ALL_HUES", "all-hues" },
{ GIMP_RED_HUES, "GIMP_RED_HUES", "red-hues" },
{ GIMP_YELLOW_HUES, "GIMP_YELLOW_HUES", "yellow-hues" },
{ GIMP_GREEN_HUES, "GIMP_GREEN_HUES", "green-hues" },
{ GIMP_CYAN_HUES, "GIMP_CYAN_HUES", "cyan-hues" },
{ GIMP_BLUE_HUES, "GIMP_BLUE_HUES", "blue-hues" },
{ GIMP_MAGENTA_HUES, "GIMP_MAGENTA_HUES", "magenta-hues" },
{ 0, NULL, NULL }
};
static const GimpEnumDesc descs[] =
{
{ GIMP_ALL_HUES, "GIMP_ALL_HUES", NULL },
{ GIMP_RED_HUES, "GIMP_RED_HUES", NULL },
{ GIMP_YELLOW_HUES, "GIMP_YELLOW_HUES", NULL },
{ GIMP_GREEN_HUES, "GIMP_GREEN_HUES", NULL },
{ GIMP_CYAN_HUES, "GIMP_CYAN_HUES", NULL },
{ GIMP_BLUE_HUES, "GIMP_BLUE_HUES", NULL },
{ GIMP_MAGENTA_HUES, "GIMP_MAGENTA_HUES", NULL },
{ 0, NULL, NULL }
};
static GType type = 0;
if (G_UNLIKELY (! type))
{
type = g_enum_register_static ("GimpHueRangeCompat", values);
gimp_type_set_translation_domain (type, GETTEXT_PACKAGE "-libgimp");
gimp_type_set_translation_context (type, "hue-range-compat");
gimp_enum_set_value_descriptions (type, descs);
}
return type;
}
/* Generated data ends here */ /* Generated data ends here */

View File

@ -104,6 +104,22 @@ typedef enum
} GimpFillTypeCompat; } GimpFillTypeCompat;
#define GIMP_TYPE_HUE_RANGE_COMPAT (gimp_hue_range_compat_get_type ())
GType gimp_hue_range_compat_get_type (void) G_GNUC_CONST;
typedef enum
{
GIMP_ALL_HUES,
GIMP_RED_HUES,
GIMP_YELLOW_HUES,
GIMP_GREEN_HUES,
GIMP_CYAN_HUES,
GIMP_BLUE_HUES,
GIMP_MAGENTA_HUES
} GimpHueRangeCompat;
G_END_DECLS G_END_DECLS
#endif /* __GIMP_COMPAT_ENUMS_H__ */ #endif /* __GIMP_COMPAT_ENUMS_H__ */

View File

@ -156,31 +156,20 @@ add_compat_enums(PyObject *m)
PyModule_AddIntConstant(m, "DESATURATE_LUMINOSITY", PyModule_AddIntConstant(m, "DESATURATE_LUMINOSITY",
GIMP_DESATURATE_LUMA); GIMP_DESATURATE_LUMA);
PyModule_AddIntConstant(m, "EXPORT_CAN_HANDLE_RGB", PyModule_AddIntConstant (m, "ALL_HUES",
GIMP_EXPORT_CAN_HANDLE_RGB); GIMP_HUE_RANGE_ALL);
PyModule_AddIntConstant(m, "EXPORT_CAN_HANDLE_GRAY", PyModule_AddIntConstant (m, "RED_HUES",
GIMP_EXPORT_CAN_HANDLE_GRAY); GIMP_HUE_RANGE_RED);
PyModule_AddIntConstant(m, "EXPORT_CAN_HANDLE_INDEXED", PyModule_AddIntConstant (m, "YELLOW_HUES",
GIMP_EXPORT_CAN_HANDLE_INDEXED); GIMP_HUE_RANGE_YELLOW);
PyModule_AddIntConstant(m, "EXPORT_CAN_HANDLE_BITMAP", PyModule_AddIntConstant (m, "GREEN_HUES",
GIMP_EXPORT_CAN_HANDLE_BITMAP); GIMP_HUE_RANGE_GREEN);
PyModule_AddIntConstant(m, "EXPORT_CAN_HANDLE_ALPHA", PyModule_AddIntConstant (m, "CYAN_HUES",
GIMP_EXPORT_CAN_HANDLE_ALPHA); GIMP_HUE_RANGE_CYAN);
PyModule_AddIntConstant(m, "EXPORT_CAN_HANDLE_LAYERS", PyModule_AddIntConstant (m, "BLUE_HUES",
GIMP_EXPORT_CAN_HANDLE_LAYERS); GIMP_HUE_RANGE_BLUE);
PyModule_AddIntConstant(m, "EXPORT_CAN_HANDLE_LAYERS_AS_ANIMATION", PyModule_AddIntConstant (m, "MAGENTA_HUES",
GIMP_EXPORT_CAN_HANDLE_LAYERS_AS_ANIMATION); GIMP_HUE_RANGE_MAGENTA);
PyModule_AddIntConstant(m, "EXPORT_CAN_HANDLE_LAYER_MASKS",
GIMP_EXPORT_CAN_HANDLE_LAYER_MASKS);
PyModule_AddIntConstant(m, "EXPORT_NEEDS_ALPHA",
GIMP_EXPORT_NEEDS_ALPHA);
PyModule_AddIntConstant(m, "EXPORT_CANCEL",
GIMP_EXPORT_CANCEL);
PyModule_AddIntConstant(m, "EXPORT_IGNORE",
GIMP_EXPORT_IGNORE);
PyModule_AddIntConstant(m, "EXPORT_EXPORT",
GIMP_EXPORT_EXPORT);
PyModule_AddIntConstant (m, "NORMAL_MODE", PyModule_AddIntConstant (m, "NORMAL_MODE",
GIMP_LAYER_MODE_NORMAL); GIMP_LAYER_MODE_NORMAL);
@ -228,6 +217,32 @@ add_compat_enums(PyObject *m)
GIMP_LAYER_MODE_GRAIN_MERGE_LEGACY); GIMP_LAYER_MODE_GRAIN_MERGE_LEGACY);
PyModule_AddIntConstant (m, "COLOR_ERASE_MODE", PyModule_AddIntConstant (m, "COLOR_ERASE_MODE",
GIMP_LAYER_MODE_COLOR_ERASE); GIMP_LAYER_MODE_COLOR_ERASE);
PyModule_AddIntConstant(m, "EXPORT_CAN_HANDLE_RGB",
GIMP_EXPORT_CAN_HANDLE_RGB);
PyModule_AddIntConstant(m, "EXPORT_CAN_HANDLE_GRAY",
GIMP_EXPORT_CAN_HANDLE_GRAY);
PyModule_AddIntConstant(m, "EXPORT_CAN_HANDLE_INDEXED",
GIMP_EXPORT_CAN_HANDLE_INDEXED);
PyModule_AddIntConstant(m, "EXPORT_CAN_HANDLE_BITMAP",
GIMP_EXPORT_CAN_HANDLE_BITMAP);
PyModule_AddIntConstant(m, "EXPORT_CAN_HANDLE_ALPHA",
GIMP_EXPORT_CAN_HANDLE_ALPHA);
PyModule_AddIntConstant(m, "EXPORT_CAN_HANDLE_LAYERS",
GIMP_EXPORT_CAN_HANDLE_LAYERS);
PyModule_AddIntConstant(m, "EXPORT_CAN_HANDLE_LAYERS_AS_ANIMATION",
GIMP_EXPORT_CAN_HANDLE_LAYERS_AS_ANIMATION);
PyModule_AddIntConstant(m, "EXPORT_CAN_HANDLE_LAYER_MASKS",
GIMP_EXPORT_CAN_HANDLE_LAYER_MASKS);
PyModule_AddIntConstant(m, "EXPORT_NEEDS_ALPHA",
GIMP_EXPORT_NEEDS_ALPHA);
PyModule_AddIntConstant(m, "EXPORT_CANCEL",
GIMP_EXPORT_CANCEL);
PyModule_AddIntConstant(m, "EXPORT_IGNORE",
GIMP_EXPORT_IGNORE);
PyModule_AddIntConstant(m, "EXPORT_EXPORT",
GIMP_EXPORT_EXPORT);
} }
static void static void

View File

@ -171,6 +171,14 @@ static const NamedConstant const old_constants[] =
{ "DESATURATE-LUMINOSITY", GIMP_DESATURATE_LUMA }, { "DESATURATE-LUMINOSITY", GIMP_DESATURATE_LUMA },
{ "ALL-HUES", GIMP_HUE_RANGE_ALL },
{ "RED-HUES", GIMP_HUE_RANGE_RED },
{ "YELLOW-HUES", GIMP_HUE_RANGE_YELLOW },
{ "GREEN-HUES", GIMP_HUE_RANGE_GREEN },
{ "CYAN-HUES", GIMP_HUE_RANGE_CYAN },
{ "BLUE-HUES", GIMP_HUE_RANGE_BLUE },
{ "MAGENTA-HUES", GIMP_HUE_RANGE_MAGENTA },
{ "NORMAL-MODE", GIMP_LAYER_MODE_NORMAL }, { "NORMAL-MODE", GIMP_LAYER_MODE_NORMAL },
{ "DISSOLVE-MODE", GIMP_LAYER_MODE_DISSOLVE }, { "DISSOLVE-MODE", GIMP_LAYER_MODE_DISSOLVE },
{ "BEHIND-MODE", GIMP_LAYER_MODE_BEHIND }, { "BEHIND-MODE", GIMP_LAYER_MODE_BEHIND },

View File

@ -253,16 +253,17 @@ package Gimp::CodeGen::enums;
GimpHueRange => GimpHueRange =>
{ contig => 1, { contig => 1,
header => 'libgimpbase/gimpbaseenums.h', header => 'libgimpbase/gimpbaseenums.h',
symbols => [ qw(GIMP_ALL_HUES GIMP_RED_HUES GIMP_YELLOW_HUES symbols => [ qw(GIMP_HUE_RANGE_ALL GIMP_HUE_RANGE_RED
GIMP_GREEN_HUES GIMP_CYAN_HUES GIMP_BLUE_HUES GIMP_HUE_RANGE_YELLOW GIMP_HUE_RANGE_GREEN
GIMP_MAGENTA_HUES) ], GIMP_HUE_RANGE_CYAN GIMP_HUE_RANGE_BLUE
mapping => { GIMP_ALL_HUES => '0', GIMP_HUE_RANGE_MAGENTA) ],
GIMP_RED_HUES => '1', mapping => { GIMP_HUE_RANGE_ALL => '0',
GIMP_YELLOW_HUES => '2', GIMP_HUE_RANGE_RED => '1',
GIMP_GREEN_HUES => '3', GIMP_HUE_RANGE_YELLOW => '2',
GIMP_CYAN_HUES => '4', GIMP_HUE_RANGE_GREEN => '3',
GIMP_BLUE_HUES => '5', GIMP_HUE_RANGE_CYAN => '4',
GIMP_MAGENTA_HUES => '6' } GIMP_HUE_RANGE_BLUE => '5',
GIMP_HUE_RANGE_MAGENTA => '6' }
}, },
GimpIconType => GimpIconType =>
{ contig => 1, { contig => 1,