1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
|
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
*
* gimpunit_pdb.c
*
* This library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <https://www.gnu.org/licenses/>.
*/
/* NOTE: This file is auto-generated by pdbgen.pl */
#include "config.h"
#include "gimp.h"
/**
* SECTION: gimpunit
* @title: gimpunit
* @short_description: Provides a collection of predefined units and functions for creating user-defined units.
*
* Provides a collection of predefined units and functions for creating
* user-defined units.
**/
/**
* _gimp_unit_get_number_of_units:
*
* Returns the number of units.
*
* This procedure returns the number of defined units.
*
* Returns: The number of units.
**/
gint
_gimp_unit_get_number_of_units (void)
{
GimpParam *return_vals;
gint nreturn_vals;
gint num_units = GIMP_UNIT_END;
return_vals = gimp_run_procedure ("gimp-unit-get-number-of-units",
&nreturn_vals,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
num_units = return_vals[1].data.d_int32;
gimp_destroy_params (return_vals, nreturn_vals);
return num_units;
}
/**
* _gimp_unit_get_number_of_built_in_units:
*
* Returns the number of built-in units.
*
* This procedure returns the number of defined units built-in to GIMP.
*
* Returns: The number of built-in units.
**/
gint
_gimp_unit_get_number_of_built_in_units (void)
{
GimpParam *return_vals;
gint nreturn_vals;
gint num_units = GIMP_UNIT_END;
return_vals = gimp_run_procedure ("gimp-unit-get-number-of-built-in-units",
&nreturn_vals,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
num_units = return_vals[1].data.d_int32;
gimp_destroy_params (return_vals, nreturn_vals);
return num_units;
}
/**
* _gimp_unit_new:
* @identifier: The new unit's identifier.
* @factor: The new unit's factor.
* @digits: The new unit's digits.
* @symbol: The new unit's symbol.
* @abbreviation: The new unit's abbreviation.
* @singular: The new unit's singular form.
* @plural: The new unit's plural form.
*
* Creates a new unit and returns it's integer ID.
*
* This procedure creates a new unit and returns it's integer ID. Note
* that the new unit will have it's deletion flag set to TRUE, so you
* will have to set it to FALSE with gimp_unit_set_deletion_flag() to
* make it persistent.
*
* Returns: The new unit's ID.
**/
GimpUnit
_gimp_unit_new (const gchar *identifier,
gdouble factor,
gint digits,
const gchar *symbol,
const gchar *abbreviation,
const gchar *singular,
const gchar *plural)
{
GimpParam *return_vals;
gint nreturn_vals;
GimpUnit unit_id = GIMP_UNIT_INCH;
return_vals = gimp_run_procedure ("gimp-unit-new",
&nreturn_vals,
GIMP_PDB_STRING, identifier,
GIMP_PDB_FLOAT, factor,
GIMP_PDB_INT32, digits,
GIMP_PDB_STRING, symbol,
GIMP_PDB_STRING, abbreviation,
GIMP_PDB_STRING, singular,
GIMP_PDB_STRING, plural,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
unit_id = return_vals[1].data.d_unit;
gimp_destroy_params (return_vals, nreturn_vals);
return unit_id;
}
/**
* _gimp_unit_get_deletion_flag:
* @unit_id: The unit's integer ID.
*
* Returns the deletion flag of the unit.
*
* This procedure returns the deletion flag of the unit. If this value
* is TRUE the unit's definition will not be saved in the user's unitrc
* file on gimp exit.
*
* Returns: The unit's deletion flag.
**/
gboolean
_gimp_unit_get_deletion_flag (GimpUnit unit_id)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean deletion_flag = FALSE;
return_vals = gimp_run_procedure ("gimp-unit-get-deletion-flag",
&nreturn_vals,
GIMP_PDB_INT32, unit_id,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
deletion_flag = return_vals[1].data.d_int32;
gimp_destroy_params (return_vals, nreturn_vals);
return deletion_flag;
}
/**
* _gimp_unit_set_deletion_flag:
* @unit_id: The unit's integer ID.
* @deletion_flag: The new deletion flag of the unit.
*
* Sets the deletion flag of a unit.
*
* This procedure sets the unit's deletion flag. If the deletion flag
* of a unit is TRUE on gimp exit, this unit's definition will not be
* saved in the user's unitrc.
*
* Returns: TRUE on success.
**/
gboolean
_gimp_unit_set_deletion_flag (GimpUnit unit_id,
gboolean deletion_flag)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-unit-set-deletion-flag",
&nreturn_vals,
GIMP_PDB_INT32, unit_id,
GIMP_PDB_INT32, deletion_flag,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* _gimp_unit_get_identifier:
* @unit_id: The unit's integer ID.
*
* Returns the textual identifier of the unit.
*
* This procedure returns the textual identifier of the unit. For
* built-in units it will be the english singular form of the unit's
* name. For user-defined units this should equal to the singular form.
*
* Returns: The unit's textual identifier.
**/
gchar *
_gimp_unit_get_identifier (GimpUnit unit_id)
{
GimpParam *return_vals;
gint nreturn_vals;
gchar *identifier = NULL;
return_vals = gimp_run_procedure ("gimp-unit-get-identifier",
&nreturn_vals,
GIMP_PDB_INT32, unit_id,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
identifier = g_strdup (return_vals[1].data.d_string);
gimp_destroy_params (return_vals, nreturn_vals);
return identifier;
}
/**
* _gimp_unit_get_factor:
* @unit_id: The unit's integer ID.
*
* Returns the factor of the unit.
*
* This procedure returns the unit's factor which indicates how many
* units make up an inch. Note that asking for the factor of \"pixels\"
* will produce an error.
*
* Returns: The unit's factor.
**/
gdouble
_gimp_unit_get_factor (GimpUnit unit_id)
{
GimpParam *return_vals;
gint nreturn_vals;
gdouble factor = 0.0;
return_vals = gimp_run_procedure ("gimp-unit-get-factor",
&nreturn_vals,
GIMP_PDB_INT32, unit_id,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
factor = return_vals[1].data.d_float;
gimp_destroy_params (return_vals, nreturn_vals);
return factor;
}
/**
* _gimp_unit_get_digits:
* @unit_id: The unit's integer ID.
*
* Returns the number of digits of the unit.
*
* This procedure returns the number of digits you should provide in
* input or output functions to get approximately the same accuracy as
* with two digits and inches. Note that asking for the digits of
* \"pixels\" will produce an error.
*
* Returns: The unit's number of digits.
**/
gint
_gimp_unit_get_digits (GimpUnit unit_id)
{
GimpParam *return_vals;
gint nreturn_vals;
gint digits = 0;
return_vals = gimp_run_procedure ("gimp-unit-get-digits",
&nreturn_vals,
GIMP_PDB_INT32, unit_id,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
digits = return_vals[1].data.d_int32;
gimp_destroy_params (return_vals, nreturn_vals);
return digits;
}
/**
* _gimp_unit_get_symbol:
* @unit_id: The unit's integer ID.
*
* Returns the symbol of the unit.
*
* This procedure returns the symbol of the unit (\"''\" for inches).
*
* Returns: The unit's symbol.
**/
gchar *
_gimp_unit_get_symbol (GimpUnit unit_id)
{
GimpParam *return_vals;
gint nreturn_vals;
gchar *symbol = NULL;
return_vals = gimp_run_procedure ("gimp-unit-get-symbol",
&nreturn_vals,
GIMP_PDB_INT32, unit_id,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
symbol = g_strdup (return_vals[1].data.d_string);
gimp_destroy_params (return_vals, nreturn_vals);
return symbol;
}
/**
* _gimp_unit_get_abbreviation:
* @unit_id: The unit's integer ID.
*
* Returns the abbreviation of the unit.
*
* This procedure returns the abbreviation of the unit (\"in\" for
* inches).
*
* Returns: The unit's abbreviation.
**/
gchar *
_gimp_unit_get_abbreviation (GimpUnit unit_id)
{
GimpParam *return_vals;
gint nreturn_vals;
gchar *abbreviation = NULL;
return_vals = gimp_run_procedure ("gimp-unit-get-abbreviation",
&nreturn_vals,
GIMP_PDB_INT32, unit_id,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
abbreviation = g_strdup (return_vals[1].data.d_string);
gimp_destroy_params (return_vals, nreturn_vals);
return abbreviation;
}
/**
* _gimp_unit_get_singular:
* @unit_id: The unit's integer ID.
*
* Returns the singular form of the unit.
*
* This procedure returns the singular form of the unit.
*
* Returns: The unit's singular form.
**/
gchar *
_gimp_unit_get_singular (GimpUnit unit_id)
{
GimpParam *return_vals;
gint nreturn_vals;
gchar *singular = NULL;
return_vals = gimp_run_procedure ("gimp-unit-get-singular",
&nreturn_vals,
GIMP_PDB_INT32, unit_id,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
singular = g_strdup (return_vals[1].data.d_string);
gimp_destroy_params (return_vals, nreturn_vals);
return singular;
}
/**
* _gimp_unit_get_plural:
* @unit_id: The unit's integer ID.
*
* Returns the plural form of the unit.
*
* This procedure returns the plural form of the unit.
*
* Returns: The unit's plural form.
**/
gchar *
_gimp_unit_get_plural (GimpUnit unit_id)
{
GimpParam *return_vals;
gint nreturn_vals;
gchar *plural = NULL;
return_vals = gimp_run_procedure ("gimp-unit-get-plural",
&nreturn_vals,
GIMP_PDB_INT32, unit_id,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
plural = g_strdup (return_vals[1].data.d_string);
gimp_destroy_params (return_vals, nreturn_vals);
return plural;
}
|