gimpenums.c.tail 5.38 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_bucket_fill_mode_get_type,
12
  gimp_cap_style_get_type,
13 14 15
  gimp_channel_ops_get_type,
  gimp_channel_type_get_type,
  gimp_clone_type_get_type,
16 17
  gimp_color_management_mode_get_type,
  gimp_color_rendering_intent_get_type,
18
  gimp_color_tag_get_type,
19
  gimp_component_type_get_type,
20 21 22
  gimp_convert_dither_type_get_type,
  gimp_convert_palette_type_get_type,
  gimp_convolve_type_get_type,
23
  gimp_desaturate_mode_get_type,
24 25
  gimp_dodge_burn_type_get_type,
  gimp_fill_type_get_type,
26
  gimp_foreground_extract_mode_get_type,
27
  gimp_gradient_blend_color_space_get_type,
28 29 30
  gimp_gradient_segment_color_get_type,
  gimp_gradient_segment_type_get_type,
  gimp_gradient_type_get_type,
31
  gimp_grid_style_get_type,
32 33 34 35 36
  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,
37
  gimp_ink_blob_type_get_type,
38
  gimp_interpolation_type_get_type,
39
  gimp_join_style_get_type,
40
  gimp_layer_color_space_get_type,
41
  gimp_layer_composite_mode_get_type,
42
  gimp_layer_mode_get_type,
43 44 45 46 47 48
  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,
49
  gimp_pdb_error_handler_get_type,
50 51 52
  gimp_pdb_proc_type_get_type,
  gimp_pdb_status_type_get_type,
  gimp_paint_application_mode_get_type,
53
  gimp_precision_get_type,
54 55 56 57
  gimp_progress_command_get_type,
  gimp_repeat_mode_get_type,
  gimp_rotation_type_get_type,
  gimp_run_mode_get_type,
58
  gimp_select_criterion_get_type,
59 60
  gimp_size_type_get_type,
  gimp_stack_trace_mode_get_type,
61
  gimp_stroke_method_get_type,
62
  gimp_text_direction_get_type,
63
  gimp_text_hint_style_get_type,
64
  gimp_text_justification_get_type,
65
  gimp_transfer_mode_get_type,
66
  gimp_transform_direction_get_type,
67
  gimp_transform_resize_get_type,
68
  gimp_user_directory_get_type,
69
  gimp_vectors_stroke_type_get_type
70 71
};

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

140 141
static gboolean enums_initialized = FALSE;

142 143
GType gimp_convert_dither_type_compat_get_type (void);
GType gimp_layer_mode_effects_get_type         (void);
144

145
/**
146
 * gimp_enums_init:
147 148
 *
 * This function makes sure all the enum types are registered
149 150 151 152
 * 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.
153
 *
154
 * Since: 2.4
155
 **/
156
void
157
gimp_enums_init (void)
158
{
159
  const GimpGetTypeFunc *funcs = get_type_funcs;
160
  GQuark                 quark;
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
  /*  keep compat enum code in sync with app/app.c (app_libs_init)  */
  quark = g_quark_from_static_string ("gimp-compat-enum");

176 177
  g_type_set_qdata (GIMP_TYPE_CONVERT_DITHER_TYPE, quark,
		    (gpointer) gimp_convert_dither_type_compat_get_type ());
178
  g_type_set_qdata (GIMP_TYPE_LAYER_MODE, quark,
179
		    (gpointer) gimp_layer_mode_effects_get_type ());
180

181
  gimp_base_compat_enums_init ();
182

183
  enums_initialized = TRUE;
184 185 186 187 188 189 190 191 192 193 194
}

/**
 * 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
 *
195
 * Since: 2.2
196 197 198 199 200 201 202 203
 **/
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);

204
  return (const gchar **) type_names;
205
}