gimpenums.c.tail 5.28 KB
Newer Older
1 2 3

typedef GType (* GimpGetTypeFunc) (void);

4
static const GimpGetTypeFunc get_type_funcs[] =
5
{
6
  gegl_distance_metric_get_type,
7 8 9
  gimp_add_mask_type_get_type,
  gimp_blend_mode_get_type,
  gimp_brush_application_mode_get_type,
10
  gimp_brush_generated_shape_get_type,
11
  gimp_cap_style_get_type,
12 13 14
  gimp_channel_ops_get_type,
  gimp_channel_type_get_type,
  gimp_clone_type_get_type,
15 16
  gimp_color_management_mode_get_type,
  gimp_color_rendering_intent_get_type,
17
  gimp_color_tag_get_type,
18
  gimp_component_type_get_type,
19 20 21
  gimp_convert_dither_type_get_type,
  gimp_convert_palette_type_get_type,
  gimp_convolve_type_get_type,
22
  gimp_desaturate_mode_get_type,
23 24
  gimp_dodge_burn_type_get_type,
  gimp_fill_type_get_type,
25
  gimp_foreground_extract_mode_get_type,
26
  gimp_gradient_blend_color_space_get_type,
27 28 29
  gimp_gradient_segment_color_get_type,
  gimp_gradient_segment_type_get_type,
  gimp_gradient_type_get_type,
30
  gimp_grid_style_get_type,
31 32 33 34 35
  gimp_histogram_channel_get_type,
  gimp_hue_range_get_type,
  gimp_icon_type_get_type,
  gimp_image_base_type_get_type,
  gimp_image_type_get_type,
36
  gimp_ink_blob_type_get_type,
37
  gimp_interpolation_type_get_type,
38
  gimp_join_style_get_type,
39
  gimp_layer_color_space_get_type,
40
  gimp_layer_composite_mode_get_type,
41
  gimp_layer_mode_get_type,
42 43 44 45 46 47
  gimp_mask_apply_mode_get_type,
  gimp_merge_type_get_type,
  gimp_message_handler_type_get_type,
  gimp_offset_type_get_type,
  gimp_orientation_type_get_type,
  gimp_pdb_arg_type_get_type,
48
  gimp_pdb_error_handler_get_type,
49 50 51
  gimp_pdb_proc_type_get_type,
  gimp_pdb_status_type_get_type,
  gimp_paint_application_mode_get_type,
52
  gimp_precision_get_type,
53 54 55 56
  gimp_progress_command_get_type,
  gimp_repeat_mode_get_type,
  gimp_rotation_type_get_type,
  gimp_run_mode_get_type,
57
  gimp_select_criterion_get_type,
58 59
  gimp_size_type_get_type,
  gimp_stack_trace_mode_get_type,
60
  gimp_stroke_method_get_type,
61
  gimp_text_direction_get_type,
62
  gimp_text_hint_style_get_type,
63
  gimp_text_justification_get_type,
64
  gimp_transfer_mode_get_type,
65
  gimp_transform_direction_get_type,
66
  gimp_transform_resize_get_type,
67
  gimp_vectors_stroke_type_get_type
68 69
};

70
static const gchar * const type_names[] =
71
{
72
  "GeglDistanceMetric",
73 74 75
  "GimpAddMaskType",
  "GimpBlendMode",
  "GimpBrushApplicationMode",
76
  "GimpBrushGeneratedShape",
77
  "GimpCapStyle",
78 79 80
  "GimpChannelOps",
  "GimpChannelType",
  "GimpCloneType",
81 82
  "GimpColorManagementMode",
  "GimpColorRenderingIntent",
83
  "GimpColorTag",
84
  "GimpComponentType",
85 86 87
  "GimpConvertDitherType",
  "GimpConvertPaletteType",
  "GimpConvolveType",
88
  "GimpDesaturateMode",
89 90
  "GimpDodgeBurnType",
  "GimpFillType",
91
  "GimpForegroundExtractMode",
92
  "GimpGradientBlendColorSpace",
93 94 95
  "GimpGradientSegmentColor",
  "GimpGradientSegmentType",
  "GimpGradientType",
96
  "GimpGridStyle",
97 98 99 100 101
  "GimpHistogramChannel",
  "GimpHueRange",
  "GimpIconType",
  "GimpImageBaseType",
  "GimpImageType",
102
  "GimpInkBlobType",
103
  "GimpInterpolationType",
104
  "GimpJoinStyle",
105
  "GimpLayerColorSpace",
106
  "GimpLayerCompositeMode",
107
  "GimpLayerMode",
108 109 110 111 112 113
  "GimpMaskApplyMode",
  "GimpMergeType",
  "GimpMessageHandlerType",
  "GimpOffsetType",
  "GimpOrientationType",
  "GimpPDBArgType",
114
  "GimpPDBErrorHandler",
115 116 117
  "GimpPDBProcType",
  "GimpPDBStatusType",
  "GimpPaintApplicationMode",
118
  "GimpPrecision",
119 120 121 122
  "GimpProgressCommand",
  "GimpRepeatMode",
  "GimpRotationType",
  "GimpRunMode",
123
  "GimpSelectCriterion",
124 125
  "GimpSizeType",
  "GimpStackTraceMode",
126
  "GimpStrokeMethod",
127
  "GimpTextDirection",
128
  "GimpTextHintStyle",
129
  "GimpTextJustification",
130
  "GimpTransferMode",
131
  "GimpTransformDirection",
132
  "GimpTransformResize",
133
  "GimpVectorsStrokeType"
134 135
};

136 137
static gboolean enums_initialized = FALSE;

138 139
#if 0
/*  keep around as documentation how to do compat enums  */
140
GType gimp_convert_dither_type_compat_get_type (void);
141
#endif
142

143
/**
144
 * gimp_enums_init:
145 146
 *
 * This function makes sure all the enum types are registered
147 148 149 150
 * with the #GType system. This is intended for use by language
 * bindings that need the symbols early, before gimp_main is run.
 * It's not necessary for plug-ins to call this directly, because
 * the normal plug-in initialization code will handle it implicitly.
151
 *
152
 * Since: 2.4
153
 **/
154
void
155
gimp_enums_init (void)
156
{
157
  const GimpGetTypeFunc *funcs = get_type_funcs;
158
#if 0
159
  GQuark                 quark;
160
#endif
161
  gint                   i;
162

163 164 165
  if (enums_initialized)
    return;

166
  for (i = 0; i < G_N_ELEMENTS (get_type_funcs); i++, funcs++)
167 168 169 170 171
    {
      GType type = (*funcs) ();

      g_type_class_ref (type);
    }
172

173 174 175
#if 0
  /*  keep around as documentation how to do compat enums  */

176 177 178
  /*  keep compat enum code in sync with app/app.c (app_libs_init)  */
  quark = g_quark_from_static_string ("gimp-compat-enum");

179 180
  g_type_set_qdata (GIMP_TYPE_CONVERT_DITHER_TYPE, quark,
		    (gpointer) gimp_convert_dither_type_compat_get_type ());
181
#endif
182

183
  gimp_base_compat_enums_init ();
184

185
  enums_initialized = TRUE;
186 187 188 189 190 191 192 193 194 195 196
}

/**
 * gimp_enums_get_type_names:
 * @n_type_names: return location for the number of names
 *
 * This function gives access to the list of enums registered by libgimp.
 * The returned array is static and must not be modified.
 *
 * Return value: an array with type names
 *
197
 * Since: 2.2
198 199 200 201 202 203 204 205
 **/
const gchar **
gimp_enums_get_type_names (gint *n_type_names)
{
  g_return_val_if_fail (n_type_names != NULL, NULL);

  *n_type_names = G_N_ELEMENTS (type_names);

206
  return (const gchar **) type_names;
207
}