1 /* LIBGIMP - The GIMP Library
2 * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
6 * This library is free software: you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 3 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library. If not, see
18 * <https://www.gnu.org/licenses/>.
21 /* NOTE: This file is auto-generated by pdbgen.pl */
31 * @short_description: Provides a collection of predefined units and functions for creating user-defined units.
33 * Provides a collection of predefined units and functions for creating
39 * _gimp_unit_get_number_of_units:
41 * Returns the number of units.
43 * This procedure returns the number of defined units.
45 * Returns: The number of units.
48 _gimp_unit_get_number_of_units (void)
50 GimpParam
*return_vals
;
52 gint num_units
= GIMP_UNIT_END
;
54 return_vals
= gimp_run_procedure ("gimp-unit-get-number-of-units",
58 if (return_vals
[0].data
.d_status
== GIMP_PDB_SUCCESS
)
59 num_units
= return_vals
[1].data
.d_int32
;
61 gimp_destroy_params (return_vals
, nreturn_vals
);
67 * _gimp_unit_get_number_of_built_in_units:
69 * Returns the number of built-in units.
71 * This procedure returns the number of defined units built-in to GIMP.
73 * Returns: The number of built-in units.
76 _gimp_unit_get_number_of_built_in_units (void)
78 GimpParam
*return_vals
;
80 gint num_units
= GIMP_UNIT_END
;
82 return_vals
= gimp_run_procedure ("gimp-unit-get-number-of-built-in-units",
86 if (return_vals
[0].data
.d_status
== GIMP_PDB_SUCCESS
)
87 num_units
= return_vals
[1].data
.d_int32
;
89 gimp_destroy_params (return_vals
, nreturn_vals
);
96 * @identifier: The new unit's identifier.
97 * @factor: The new unit's factor.
98 * @digits: The new unit's digits.
99 * @symbol: The new unit's symbol.
100 * @abbreviation: The new unit's abbreviation.
101 * @singular: The new unit's singular form.
102 * @plural: The new unit's plural form.
104 * Creates a new unit and returns it's integer ID.
106 * This procedure creates a new unit and returns it's integer ID. Note
107 * that the new unit will have it's deletion flag set to TRUE, so you
108 * will have to set it to FALSE with gimp_unit_set_deletion_flag() to
109 * make it persistent.
111 * Returns: The new unit's ID.
114 _gimp_unit_new (const gchar
*identifier
,
118 const gchar
*abbreviation
,
119 const gchar
*singular
,
122 GimpParam
*return_vals
;
124 GimpUnit unit_id
= GIMP_UNIT_INCH
;
126 return_vals
= gimp_run_procedure ("gimp-unit-new",
128 GIMP_PDB_STRING
, identifier
,
129 GIMP_PDB_FLOAT
, factor
,
130 GIMP_PDB_INT32
, digits
,
131 GIMP_PDB_STRING
, symbol
,
132 GIMP_PDB_STRING
, abbreviation
,
133 GIMP_PDB_STRING
, singular
,
134 GIMP_PDB_STRING
, plural
,
137 if (return_vals
[0].data
.d_status
== GIMP_PDB_SUCCESS
)
138 unit_id
= return_vals
[1].data
.d_unit
;
140 gimp_destroy_params (return_vals
, nreturn_vals
);
146 * _gimp_unit_get_deletion_flag:
147 * @unit_id: The unit's integer ID.
149 * Returns the deletion flag of the unit.
151 * This procedure returns the deletion flag of the unit. If this value
152 * is TRUE the unit's definition will not be saved in the user's unitrc
155 * Returns: The unit's deletion flag.
158 _gimp_unit_get_deletion_flag (GimpUnit unit_id
)
160 GimpParam
*return_vals
;
162 gboolean deletion_flag
= FALSE
;
164 return_vals
= gimp_run_procedure ("gimp-unit-get-deletion-flag",
166 GIMP_PDB_INT32
, unit_id
,
169 if (return_vals
[0].data
.d_status
== GIMP_PDB_SUCCESS
)
170 deletion_flag
= return_vals
[1].data
.d_int32
;
172 gimp_destroy_params (return_vals
, nreturn_vals
);
174 return deletion_flag
;
178 * _gimp_unit_set_deletion_flag:
179 * @unit_id: The unit's integer ID.
180 * @deletion_flag: The new deletion flag of the unit.
182 * Sets the deletion flag of a unit.
184 * This procedure sets the unit's deletion flag. If the deletion flag
185 * of a unit is TRUE on gimp exit, this unit's definition will not be
186 * saved in the user's unitrc.
188 * Returns: TRUE on success.
191 _gimp_unit_set_deletion_flag (GimpUnit unit_id
,
192 gboolean deletion_flag
)
194 GimpParam
*return_vals
;
196 gboolean success
= TRUE
;
198 return_vals
= gimp_run_procedure ("gimp-unit-set-deletion-flag",
200 GIMP_PDB_INT32
, unit_id
,
201 GIMP_PDB_INT32
, deletion_flag
,
204 success
= return_vals
[0].data
.d_status
== GIMP_PDB_SUCCESS
;
206 gimp_destroy_params (return_vals
, nreturn_vals
);
212 * _gimp_unit_get_identifier:
213 * @unit_id: The unit's integer ID.
215 * Returns the textual identifier of the unit.
217 * This procedure returns the textual identifier of the unit. For
218 * built-in units it will be the english singular form of the unit's
219 * name. For user-defined units this should equal to the singular form.
221 * Returns: The unit's textual identifier.
224 _gimp_unit_get_identifier (GimpUnit unit_id
)
226 GimpParam
*return_vals
;
228 gchar
*identifier
= NULL
;
230 return_vals
= gimp_run_procedure ("gimp-unit-get-identifier",
232 GIMP_PDB_INT32
, unit_id
,
235 if (return_vals
[0].data
.d_status
== GIMP_PDB_SUCCESS
)
236 identifier
= g_strdup (return_vals
[1].data
.d_string
);
238 gimp_destroy_params (return_vals
, nreturn_vals
);
244 * _gimp_unit_get_factor:
245 * @unit_id: The unit's integer ID.
247 * Returns the factor of the unit.
249 * This procedure returns the unit's factor which indicates how many
250 * units make up an inch. Note that asking for the factor of \"pixels\"
251 * will produce an error.
253 * Returns: The unit's factor.
256 _gimp_unit_get_factor (GimpUnit unit_id
)
258 GimpParam
*return_vals
;
260 gdouble factor
= 0.0;
262 return_vals
= gimp_run_procedure ("gimp-unit-get-factor",
264 GIMP_PDB_INT32
, unit_id
,
267 if (return_vals
[0].data
.d_status
== GIMP_PDB_SUCCESS
)
268 factor
= return_vals
[1].data
.d_float
;
270 gimp_destroy_params (return_vals
, nreturn_vals
);
276 * _gimp_unit_get_digits:
277 * @unit_id: The unit's integer ID.
279 * Returns the number of digits of the unit.
281 * This procedure returns the number of digits you should provide in
282 * input or output functions to get approximately the same accuracy as
283 * with two digits and inches. Note that asking for the digits of
284 * \"pixels\" will produce an error.
286 * Returns: The unit's number of digits.
289 _gimp_unit_get_digits (GimpUnit unit_id
)
291 GimpParam
*return_vals
;
295 return_vals
= gimp_run_procedure ("gimp-unit-get-digits",
297 GIMP_PDB_INT32
, unit_id
,
300 if (return_vals
[0].data
.d_status
== GIMP_PDB_SUCCESS
)
301 digits
= return_vals
[1].data
.d_int32
;
303 gimp_destroy_params (return_vals
, nreturn_vals
);
309 * _gimp_unit_get_symbol:
310 * @unit_id: The unit's integer ID.
312 * Returns the symbol of the unit.
314 * This procedure returns the symbol of the unit (\"''\" for inches).
316 * Returns: The unit's symbol.
319 _gimp_unit_get_symbol (GimpUnit unit_id
)
321 GimpParam
*return_vals
;
323 gchar
*symbol
= NULL
;
325 return_vals
= gimp_run_procedure ("gimp-unit-get-symbol",
327 GIMP_PDB_INT32
, unit_id
,
330 if (return_vals
[0].data
.d_status
== GIMP_PDB_SUCCESS
)
331 symbol
= g_strdup (return_vals
[1].data
.d_string
);
333 gimp_destroy_params (return_vals
, nreturn_vals
);
339 * _gimp_unit_get_abbreviation:
340 * @unit_id: The unit's integer ID.
342 * Returns the abbreviation of the unit.
344 * This procedure returns the abbreviation of the unit (\"in\" for
347 * Returns: The unit's abbreviation.
350 _gimp_unit_get_abbreviation (GimpUnit unit_id
)
352 GimpParam
*return_vals
;
354 gchar
*abbreviation
= NULL
;
356 return_vals
= gimp_run_procedure ("gimp-unit-get-abbreviation",
358 GIMP_PDB_INT32
, unit_id
,
361 if (return_vals
[0].data
.d_status
== GIMP_PDB_SUCCESS
)
362 abbreviation
= g_strdup (return_vals
[1].data
.d_string
);
364 gimp_destroy_params (return_vals
, nreturn_vals
);
370 * _gimp_unit_get_singular:
371 * @unit_id: The unit's integer ID.
373 * Returns the singular form of the unit.
375 * This procedure returns the singular form of the unit.
377 * Returns: The unit's singular form.
380 _gimp_unit_get_singular (GimpUnit unit_id
)
382 GimpParam
*return_vals
;
384 gchar
*singular
= NULL
;
386 return_vals
= gimp_run_procedure ("gimp-unit-get-singular",
388 GIMP_PDB_INT32
, unit_id
,
391 if (return_vals
[0].data
.d_status
== GIMP_PDB_SUCCESS
)
392 singular
= g_strdup (return_vals
[1].data
.d_string
);
394 gimp_destroy_params (return_vals
, nreturn_vals
);
400 * _gimp_unit_get_plural:
401 * @unit_id: The unit's integer ID.
403 * Returns the plural form of the unit.
405 * This procedure returns the plural form of the unit.
407 * Returns: The unit's plural form.
410 _gimp_unit_get_plural (GimpUnit unit_id
)
412 GimpParam
*return_vals
;
414 gchar
*plural
= NULL
;
416 return_vals
= gimp_run_procedure ("gimp-unit-get-plural",
418 GIMP_PDB_INT32
, unit_id
,
421 if (return_vals
[0].data
.d_status
== GIMP_PDB_SUCCESS
)
422 plural
= g_strdup (return_vals
[1].data
.d_string
);
424 gimp_destroy_params (return_vals
, nreturn_vals
);