Commit ebd3ab1b authored by Michael Natterer's avatar Michael Natterer 😴
Browse files

A more hackish way to use GimpLayerMode instead of GimpLayerModeEffects

C++ won't allow us to use GimpLayerMode in the API where we used to
have GimpLayerModeEffects.

Move GimpLayerModeEffects to libgimpbase/gimpcompatenums.h so it's
not in the API any longer, and instead typedef and define stuff in
libgimp/gimptypes.h, and adapt the compat enum registering code
accordingly.
parent 17a805bd
......@@ -80,6 +80,8 @@ static gboolean app_exit_after_callback (Gimp *gimp,
gboolean kill_it,
GMainLoop **loop);
GType gimp_layer_mode_effects_get_type (void); /* compat cruft */
/* local variables */
......@@ -117,7 +119,7 @@ app_libs_init (GOptionContext *context,
quark = g_quark_from_static_string ("gimp-compat-enum");
g_type_set_qdata (GIMP_TYPE_LAYER_MODE, quark,
(gpointer) GIMP_TYPE_LAYER_MODE_EFFECTS);
(gpointer) gimp_layer_mode_effects_get_type ());
}
void
......
......@@ -131,6 +131,8 @@ static const gchar * const type_names[] =
static gboolean enums_initialized = FALSE;
GType gimp_layer_mode_effects_get_type (void);
/**
* gimp_enums_init:
*
......@@ -163,7 +165,7 @@ gimp_enums_init (void)
quark = g_quark_from_static_string ("gimp-compat-enum");
g_type_set_qdata (GIMP_TYPE_LAYER_MODE, quark,
(gpointer) GIMP_TYPE_LAYER_MODE_EFFECTS);
(gpointer) gimp_layer_mode_effects_get_type ());
enums_initialized = TRUE;
}
......
......@@ -37,6 +37,41 @@ typedef struct _GimpParamRegion GimpParamRegion;
typedef union _GimpParamData GimpParamData;
typedef struct _GimpParam GimpParam;
#ifndef GIMP_DISABLE_DEPRECATED
/* This is so ugly it hurts. C++ won't let us have enum GimpLayerMode
* in the API where we used to have enum GimpLayerModeEffects, so
* typedef and define around to make it happy:
*/
typedef GimpLayerMode GimpLayerModeEffects;
#define GIMP_NORMAL_MODE GIMP_LAYER_MODE_NORMAL_NON_LINEAR
#define GIMP_DISSOLVE_MODE GIMP_LAYER_MODE_DISSOLVE
#define GIMP_BEHIND_MODE GIMP_LAYER_MODE_BEHIND
#define GIMP_MULTIPLY_MODE GIMP_LAYER_MODE_MULTIPLY_LEGACY
#define GIMP_SCREEN_MODE GIMP_LAYER_MODE_SCREEN_LEGACY
#define GIMP_OVERLAY_MODE GIMP_LAYER_MODE_OVERLAY_LEGACY
#define GIMP_DIFFERENCE_MODE GIMP_LAYER_MODE_DIFFERENCE_LEGACY
#define GIMP_ADDITION_MODE GIMP_LAYER_MODE_ADDITION_LEGACY
#define GIMP_SUBTRACT_MODE GIMP_LAYER_MODE_SUBTRACT_LEGACY
#define GIMP_DARKEN_ONLY_MODE GIMP_LAYER_MODE_DARKEN_ONLY_LEGACY
#define GIMP_LIGHTEN_ONLY_MODE GIMP_LAYER_MODE_LIGHTEN_ONLY_LEGACY
#define GIMP_HUE_MODE GIMP_LAYER_MODE_HSV_HUE_LEGACY
#define GIMP_SATURATION_MODE GIMP_LAYER_MODE_HSV_SATURATION_LEGACY
#define GIMP_COLOR_MODE GIMP_LAYER_MODE_HSV_COLOR_LEGACY
#define GIMP_VALUE_MODE GIMP_LAYER_MODE_HSV_VALUE_LEGACY
#define GIMP_DIVIDE_MODE GIMP_LAYER_MODE_DIVIDE_LEGACY
#define GIMP_DODGE_MODE GIMP_LAYER_MODE_DODGE_LEGACY
#define GIMP_BURN_MODE GIMP_LAYER_MODE_BURN_LEGACY
#define GIMP_HARDLIGHT_MODE GIMP_LAYER_MODE_HARDLIGHT_LEGACY
#define GIMP_SOFTLIGHT_MODE GIMP_LAYER_MODE_SOFTLIGHT_LEGACY
#define GIMP_GRAIN_EXTRACT_MODE GIMP_LAYER_MODE_GRAIN_EXTRACT_LEGACY
#define GIMP_GRAIN_MERGE_MODE GIMP_LAYER_MODE_GRAIN_MERGE_LEGACY
#define GIMP_COLOR_ERASE_MODE GIMP_LAYER_MODE_COLOR_ERASE
#endif /* ! GIMP_DISABLE_DEPRECATED */
G_END_DECLS
#endif /* __GIMP_TYPES_H__ */
......@@ -1020,78 +1020,6 @@ gimp_join_style_get_type (void)
return type;
}
GType
gimp_layer_mode_effects_get_type (void)
{
static const GEnumValue values[] =
{
{ GIMP_NORMAL_MODE, "GIMP_NORMAL_MODE", "normal-mode" },
{ GIMP_DISSOLVE_MODE, "GIMP_DISSOLVE_MODE", "dissolve-mode" },
{ GIMP_BEHIND_MODE, "GIMP_BEHIND_MODE", "behind-mode" },
{ GIMP_MULTIPLY_MODE, "GIMP_MULTIPLY_MODE", "multiply-mode" },
{ GIMP_SCREEN_MODE, "GIMP_SCREEN_MODE", "screen-mode" },
{ GIMP_OVERLAY_MODE, "GIMP_OVERLAY_MODE", "overlay-mode" },
{ GIMP_DIFFERENCE_MODE, "GIMP_DIFFERENCE_MODE", "difference-mode" },
{ GIMP_ADDITION_MODE, "GIMP_ADDITION_MODE", "addition-mode" },
{ GIMP_SUBTRACT_MODE, "GIMP_SUBTRACT_MODE", "subtract-mode" },
{ GIMP_DARKEN_ONLY_MODE, "GIMP_DARKEN_ONLY_MODE", "darken-only-mode" },
{ GIMP_LIGHTEN_ONLY_MODE, "GIMP_LIGHTEN_ONLY_MODE", "lighten-only-mode" },
{ GIMP_HUE_MODE, "GIMP_HUE_MODE", "hue-mode" },
{ GIMP_SATURATION_MODE, "GIMP_SATURATION_MODE", "saturation-mode" },
{ GIMP_COLOR_MODE, "GIMP_COLOR_MODE", "color-mode" },
{ GIMP_VALUE_MODE, "GIMP_VALUE_MODE", "value-mode" },
{ GIMP_DIVIDE_MODE, "GIMP_DIVIDE_MODE", "divide-mode" },
{ GIMP_DODGE_MODE, "GIMP_DODGE_MODE", "dodge-mode" },
{ GIMP_BURN_MODE, "GIMP_BURN_MODE", "burn-mode" },
{ GIMP_HARDLIGHT_MODE, "GIMP_HARDLIGHT_MODE", "hardlight-mode" },
{ GIMP_SOFTLIGHT_MODE, "GIMP_SOFTLIGHT_MODE", "softlight-mode" },
{ GIMP_GRAIN_EXTRACT_MODE, "GIMP_GRAIN_EXTRACT_MODE", "grain-extract-mode" },
{ GIMP_GRAIN_MERGE_MODE, "GIMP_GRAIN_MERGE_MODE", "grain-merge-mode" },
{ GIMP_COLOR_ERASE_MODE, "GIMP_COLOR_ERASE_MODE", "color-erase-mode" },
{ 0, NULL, NULL }
};
static const GimpEnumDesc descs[] =
{
{ GIMP_NORMAL_MODE, "GIMP_NORMAL_MODE", NULL },
{ GIMP_DISSOLVE_MODE, "GIMP_DISSOLVE_MODE", NULL },
{ GIMP_BEHIND_MODE, "GIMP_BEHIND_MODE", NULL },
{ GIMP_MULTIPLY_MODE, "GIMP_MULTIPLY_MODE", NULL },
{ GIMP_SCREEN_MODE, "GIMP_SCREEN_MODE", NULL },
{ GIMP_OVERLAY_MODE, "GIMP_OVERLAY_MODE", NULL },
{ GIMP_DIFFERENCE_MODE, "GIMP_DIFFERENCE_MODE", NULL },
{ GIMP_ADDITION_MODE, "GIMP_ADDITION_MODE", NULL },
{ GIMP_SUBTRACT_MODE, "GIMP_SUBTRACT_MODE", NULL },
{ GIMP_DARKEN_ONLY_MODE, "GIMP_DARKEN_ONLY_MODE", NULL },
{ GIMP_LIGHTEN_ONLY_MODE, "GIMP_LIGHTEN_ONLY_MODE", NULL },
{ GIMP_HUE_MODE, "GIMP_HUE_MODE", NULL },
{ GIMP_SATURATION_MODE, "GIMP_SATURATION_MODE", NULL },
{ GIMP_COLOR_MODE, "GIMP_COLOR_MODE", NULL },
{ GIMP_VALUE_MODE, "GIMP_VALUE_MODE", NULL },
{ GIMP_DIVIDE_MODE, "GIMP_DIVIDE_MODE", NULL },
{ GIMP_DODGE_MODE, "GIMP_DODGE_MODE", NULL },
{ GIMP_BURN_MODE, "GIMP_BURN_MODE", NULL },
{ GIMP_HARDLIGHT_MODE, "GIMP_HARDLIGHT_MODE", NULL },
{ GIMP_SOFTLIGHT_MODE, "GIMP_SOFTLIGHT_MODE", NULL },
{ GIMP_GRAIN_EXTRACT_MODE, "GIMP_GRAIN_EXTRACT_MODE", NULL },
{ GIMP_GRAIN_MERGE_MODE, "GIMP_GRAIN_MERGE_MODE", NULL },
{ GIMP_COLOR_ERASE_MODE, "GIMP_COLOR_ERASE_MODE", NULL },
{ 0, NULL, NULL }
};
static GType type = 0;
if (G_UNLIKELY (! type))
{
type = g_enum_register_static ("GimpLayerModeEffects", values);
gimp_type_set_translation_domain (type, GETTEXT_PACKAGE "-libgimp");
gimp_type_set_translation_context (type, "layer-mode-effects");
gimp_enum_set_value_descriptions (type, descs);
}
return type;
}
GType
gimp_mask_apply_mode_get_type (void)
{
......
......@@ -502,40 +502,6 @@ typedef enum
} GimpJoinStyle;
#ifndef GIMP_DISABLE_DEPRECATED
#define GIMP_TYPE_LAYER_MODE_EFFECTS (gimp_layer_mode_effects_get_type ())
GType gimp_layer_mode_effects_get_type (void) G_GNUC_CONST;
typedef enum /*< pdb-skip >*/
{
GIMP_NORMAL_MODE,
GIMP_DISSOLVE_MODE,
GIMP_BEHIND_MODE,
GIMP_MULTIPLY_MODE,
GIMP_SCREEN_MODE,
GIMP_OVERLAY_MODE,
GIMP_DIFFERENCE_MODE,
GIMP_ADDITION_MODE,
GIMP_SUBTRACT_MODE,
GIMP_DARKEN_ONLY_MODE,
GIMP_LIGHTEN_ONLY_MODE,
GIMP_HUE_MODE,
GIMP_SATURATION_MODE,
GIMP_COLOR_MODE,
GIMP_VALUE_MODE,
GIMP_DIVIDE_MODE,
GIMP_DODGE_MODE,
GIMP_BURN_MODE,
GIMP_HARDLIGHT_MODE,
GIMP_SOFTLIGHT_MODE,
GIMP_GRAIN_EXTRACT_MODE,
GIMP_GRAIN_MERGE_MODE,
GIMP_COLOR_ERASE_MODE
} GimpLayerModeEffects;
#endif /* GIMP_DISABLE_DEPRECATED */
#define GIMP_TYPE_MASK_APPLY_MODE (gimp_mask_apply_mode_get_type ())
GType gimp_mask_apply_mode_get_type (void) G_GNUC_CONST;
......
......@@ -402,6 +402,78 @@ gimp_interpolation_type_compat_get_type (void)
return type;
}
GType
gimp_layer_mode_effects_get_type (void)
{
static const GEnumValue values[] =
{
{ GIMP_NORMAL_MODE, "GIMP_NORMAL_MODE", "normal-mode" },
{ GIMP_DISSOLVE_MODE, "GIMP_DISSOLVE_MODE", "dissolve-mode" },
{ GIMP_BEHIND_MODE, "GIMP_BEHIND_MODE", "behind-mode" },
{ GIMP_MULTIPLY_MODE, "GIMP_MULTIPLY_MODE", "multiply-mode" },
{ GIMP_SCREEN_MODE, "GIMP_SCREEN_MODE", "screen-mode" },
{ GIMP_OVERLAY_MODE, "GIMP_OVERLAY_MODE", "overlay-mode" },
{ GIMP_DIFFERENCE_MODE, "GIMP_DIFFERENCE_MODE", "difference-mode" },
{ GIMP_ADDITION_MODE, "GIMP_ADDITION_MODE", "addition-mode" },
{ GIMP_SUBTRACT_MODE, "GIMP_SUBTRACT_MODE", "subtract-mode" },
{ GIMP_DARKEN_ONLY_MODE, "GIMP_DARKEN_ONLY_MODE", "darken-only-mode" },
{ GIMP_LIGHTEN_ONLY_MODE, "GIMP_LIGHTEN_ONLY_MODE", "lighten-only-mode" },
{ GIMP_HUE_MODE, "GIMP_HUE_MODE", "hue-mode" },
{ GIMP_SATURATION_MODE, "GIMP_SATURATION_MODE", "saturation-mode" },
{ GIMP_COLOR_MODE, "GIMP_COLOR_MODE", "color-mode" },
{ GIMP_VALUE_MODE, "GIMP_VALUE_MODE", "value-mode" },
{ GIMP_DIVIDE_MODE, "GIMP_DIVIDE_MODE", "divide-mode" },
{ GIMP_DODGE_MODE, "GIMP_DODGE_MODE", "dodge-mode" },
{ GIMP_BURN_MODE, "GIMP_BURN_MODE", "burn-mode" },
{ GIMP_HARDLIGHT_MODE, "GIMP_HARDLIGHT_MODE", "hardlight-mode" },
{ GIMP_SOFTLIGHT_MODE, "GIMP_SOFTLIGHT_MODE", "softlight-mode" },
{ GIMP_GRAIN_EXTRACT_MODE, "GIMP_GRAIN_EXTRACT_MODE", "grain-extract-mode" },
{ GIMP_GRAIN_MERGE_MODE, "GIMP_GRAIN_MERGE_MODE", "grain-merge-mode" },
{ GIMP_COLOR_ERASE_MODE, "GIMP_COLOR_ERASE_MODE", "color-erase-mode" },
{ 0, NULL, NULL }
};
static const GimpEnumDesc descs[] =
{
{ GIMP_NORMAL_MODE, "GIMP_NORMAL_MODE", NULL },
{ GIMP_DISSOLVE_MODE, "GIMP_DISSOLVE_MODE", NULL },
{ GIMP_BEHIND_MODE, "GIMP_BEHIND_MODE", NULL },
{ GIMP_MULTIPLY_MODE, "GIMP_MULTIPLY_MODE", NULL },
{ GIMP_SCREEN_MODE, "GIMP_SCREEN_MODE", NULL },
{ GIMP_OVERLAY_MODE, "GIMP_OVERLAY_MODE", NULL },
{ GIMP_DIFFERENCE_MODE, "GIMP_DIFFERENCE_MODE", NULL },
{ GIMP_ADDITION_MODE, "GIMP_ADDITION_MODE", NULL },
{ GIMP_SUBTRACT_MODE, "GIMP_SUBTRACT_MODE", NULL },
{ GIMP_DARKEN_ONLY_MODE, "GIMP_DARKEN_ONLY_MODE", NULL },
{ GIMP_LIGHTEN_ONLY_MODE, "GIMP_LIGHTEN_ONLY_MODE", NULL },
{ GIMP_HUE_MODE, "GIMP_HUE_MODE", NULL },
{ GIMP_SATURATION_MODE, "GIMP_SATURATION_MODE", NULL },
{ GIMP_COLOR_MODE, "GIMP_COLOR_MODE", NULL },
{ GIMP_VALUE_MODE, "GIMP_VALUE_MODE", NULL },
{ GIMP_DIVIDE_MODE, "GIMP_DIVIDE_MODE", NULL },
{ GIMP_DODGE_MODE, "GIMP_DODGE_MODE", NULL },
{ GIMP_BURN_MODE, "GIMP_BURN_MODE", NULL },
{ GIMP_HARDLIGHT_MODE, "GIMP_HARDLIGHT_MODE", NULL },
{ GIMP_SOFTLIGHT_MODE, "GIMP_SOFTLIGHT_MODE", NULL },
{ GIMP_GRAIN_EXTRACT_MODE, "GIMP_GRAIN_EXTRACT_MODE", NULL },
{ GIMP_GRAIN_MERGE_MODE, "GIMP_GRAIN_MERGE_MODE", NULL },
{ GIMP_COLOR_ERASE_MODE, "GIMP_COLOR_ERASE_MODE", NULL },
{ 0, NULL, NULL }
};
static GType type = 0;
if (G_UNLIKELY (! type))
{
type = g_enum_register_static ("GimpLayerModeEffects", values);
gimp_type_set_translation_domain (type, GETTEXT_PACKAGE "-libgimp");
gimp_type_set_translation_context (type, "layer-mode-effects");
gimp_enum_set_value_descriptions (type, descs);
}
return type;
}
GType
gimp_transfer_mode_compat_get_type (void)
{
......
......@@ -176,6 +176,38 @@ typedef enum
} GimpInterpolationTypeCompat;
#define GIMP_TYPE_LAYER_MODE_EFFECTS (gimp_layer_mode_effects_get_type ())
GType gimp_layer_mode_effects_get_type (void) G_GNUC_CONST;
typedef enum
{
GIMP_NORMAL_MODE,
GIMP_DISSOLVE_MODE,
GIMP_BEHIND_MODE,
GIMP_MULTIPLY_MODE,
GIMP_SCREEN_MODE,
GIMP_OVERLAY_MODE,
GIMP_DIFFERENCE_MODE,
GIMP_ADDITION_MODE,
GIMP_SUBTRACT_MODE,
GIMP_DARKEN_ONLY_MODE,
GIMP_LIGHTEN_ONLY_MODE,
GIMP_HUE_MODE,
GIMP_SATURATION_MODE,
GIMP_COLOR_MODE,
GIMP_VALUE_MODE,
GIMP_DIVIDE_MODE,
GIMP_DODGE_MODE,
GIMP_BURN_MODE,
GIMP_HARDLIGHT_MODE,
GIMP_SOFTLIGHT_MODE,
GIMP_GRAIN_EXTRACT_MODE,
GIMP_GRAIN_MERGE_MODE,
GIMP_COLOR_ERASE_MODE
} GimpLayerModeEffects;
#define GIMP_TYPE_TRANSFER_MODE_COMPAT (gimp_transfer_mode_compat_get_type ())
GType gimp_transfer_mode_compat_get_type (void) G_GNUC_CONST;
......
......@@ -162,6 +162,8 @@ print ENUMFILE <<CODE;
static gboolean enums_initialized = FALSE;
GType gimp_layer_mode_effects_get_type (void);
/**
* gimp_enums_init:
*
......@@ -194,7 +196,7 @@ gimp_enums_init (void)
quark = g_quark_from_static_string ("gimp-compat-enum");
g_type_set_qdata (GIMP_TYPE_LAYER_MODE, quark,
(gpointer) GIMP_TYPE_LAYER_MODE_EFFECTS);
(gpointer) gimp_layer_mode_effects_get_type ());
enums_initialized = TRUE;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment