[gimp] A more hackish way to use GimpLayerMode instead of GimpLayerModeEffects
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] A more hackish way to use GimpLayerMode instead of GimpLayerModeEffects
- Date: Tue, 24 Jan 2017 22:29:11 +0000 (UTC)
commit ebd3ab1b267e50717f955203b556a24a87740d5e
Author: Michael Natterer <mitch gimp org>
Date: Tue Jan 24 23:25:02 2017 +0100
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.
app/app.c | 4 ++-
libgimp/gimpenums.c.tail | 4 ++-
libgimp/gimptypes.h | 35 ++++++++++++++++++++
libgimpbase/gimpbaseenums.c | 72 -----------------------------------------
libgimpbase/gimpbaseenums.h | 34 -------------------
libgimpbase/gimpcompatenums.c | 72 +++++++++++++++++++++++++++++++++++++++++
libgimpbase/gimpcompatenums.h | 32 ++++++++++++++++++
tools/pdbgen/enumcode.pl | 4 ++-
8 files changed, 148 insertions(+), 109 deletions(-)
---
diff --git a/app/app.c b/app/app.c
index 077d3b2..7c620b8 100644
--- a/app/app.c
+++ b/app/app.c
@@ -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
diff --git a/libgimp/gimpenums.c.tail b/libgimp/gimpenums.c.tail
index 4a186ca..ee44b28 100644
--- a/libgimp/gimpenums.c.tail
+++ b/libgimp/gimpenums.c.tail
@@ -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;
}
diff --git a/libgimp/gimptypes.h b/libgimp/gimptypes.h
index 48e7025..365585f 100644
--- a/libgimp/gimptypes.h
+++ b/libgimp/gimptypes.h
@@ -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__ */
diff --git a/libgimpbase/gimpbaseenums.c b/libgimpbase/gimpbaseenums.c
index 0e70378..b809c0d 100644
--- a/libgimpbase/gimpbaseenums.c
+++ b/libgimpbase/gimpbaseenums.c
@@ -1021,78 +1021,6 @@ gimp_join_style_get_type (void)
}
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)
{
static const GEnumValue values[] =
diff --git a/libgimpbase/gimpbaseenums.h b/libgimpbase/gimpbaseenums.h
index 056a7f1..52b10eb 100644
--- a/libgimpbase/gimpbaseenums.h
+++ b/libgimpbase/gimpbaseenums.h
@@ -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;
diff --git a/libgimpbase/gimpcompatenums.c b/libgimpbase/gimpcompatenums.c
index 7736665..83de8e2 100644
--- a/libgimpbase/gimpcompatenums.c
+++ b/libgimpbase/gimpcompatenums.c
@@ -403,6 +403,78 @@ gimp_interpolation_type_compat_get_type (void)
}
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)
{
static const GEnumValue values[] =
diff --git a/libgimpbase/gimpcompatenums.h b/libgimpbase/gimpcompatenums.h
index 32fffc4..083fa2d 100644
--- a/libgimpbase/gimpcompatenums.h
+++ b/libgimpbase/gimpcompatenums.h
@@ -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;
diff --git a/tools/pdbgen/enumcode.pl b/tools/pdbgen/enumcode.pl
index 75e04ca..d663817 100755
--- a/tools/pdbgen/enumcode.pl
+++ b/tools/pdbgen/enumcode.pl
@@ -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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]