1 /* GIMP - The GNU Image Manipulation Program
2  * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 /* NOTE: This file is auto-generated by pdbgen.pl. */
19 
20 #include "config.h"
21 
22 #include <gegl.h>
23 
24 #include <gdk-pixbuf/gdk-pixbuf.h>
25 
26 #include "libgimpbase/gimpbase.h"
27 
28 #include "libgimpbase/gimpbase.h"
29 
30 #include "pdb-types.h"
31 
32 #include "core/gimpparamspecs.h"
33 #include "core/gimpunit.h"
34 
35 #include "gimppdb.h"
36 #include "gimpprocedure.h"
37 #include "internal-procs.h"
38 
39 
40 static GimpValueArray *
unit_get_number_of_units_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)41 unit_get_number_of_units_invoker (GimpProcedure         *procedure,
42                                   Gimp                  *gimp,
43                                   GimpContext           *context,
44                                   GimpProgress          *progress,
45                                   const GimpValueArray  *args,
46                                   GError               **error)
47 {
48   GimpValueArray *return_vals;
49   gint32 num_units = 0;
50 
51   num_units = _gimp_unit_get_number_of_units (gimp);
52 
53   return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
54   g_value_set_int (gimp_value_array_index (return_vals, 1), num_units);
55 
56   return return_vals;
57 }
58 
59 static GimpValueArray *
unit_get_number_of_built_in_units_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)60 unit_get_number_of_built_in_units_invoker (GimpProcedure         *procedure,
61                                            Gimp                  *gimp,
62                                            GimpContext           *context,
63                                            GimpProgress          *progress,
64                                            const GimpValueArray  *args,
65                                            GError               **error)
66 {
67   GimpValueArray *return_vals;
68   gint32 num_units = 0;
69 
70   num_units = _gimp_unit_get_number_of_built_in_units (gimp);
71 
72   return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
73   g_value_set_int (gimp_value_array_index (return_vals, 1), num_units);
74 
75   return return_vals;
76 }
77 
78 static GimpValueArray *
unit_new_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)79 unit_new_invoker (GimpProcedure         *procedure,
80                   Gimp                  *gimp,
81                   GimpContext           *context,
82                   GimpProgress          *progress,
83                   const GimpValueArray  *args,
84                   GError               **error)
85 {
86   gboolean success = TRUE;
87   GimpValueArray *return_vals;
88   const gchar *identifier;
89   gdouble factor;
90   gint32 digits;
91   const gchar *symbol;
92   const gchar *abbreviation;
93   const gchar *singular;
94   const gchar *plural;
95   GimpUnit unit_id = 0;
96 
97   identifier = g_value_get_string (gimp_value_array_index (args, 0));
98   factor = g_value_get_double (gimp_value_array_index (args, 1));
99   digits = g_value_get_int (gimp_value_array_index (args, 2));
100   symbol = g_value_get_string (gimp_value_array_index (args, 3));
101   abbreviation = g_value_get_string (gimp_value_array_index (args, 4));
102   singular = g_value_get_string (gimp_value_array_index (args, 5));
103   plural = g_value_get_string (gimp_value_array_index (args, 6));
104 
105   if (success)
106     {
107       unit_id = _gimp_unit_new (gimp, identifier, factor, digits,
108                                 symbol, abbreviation, singular, plural);
109     }
110 
111   return_vals = gimp_procedure_get_return_values (procedure, success,
112                                                   error ? *error : NULL);
113 
114   if (success)
115     g_value_set_int (gimp_value_array_index (return_vals, 1), unit_id);
116 
117   return return_vals;
118 }
119 
120 static GimpValueArray *
unit_get_deletion_flag_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)121 unit_get_deletion_flag_invoker (GimpProcedure         *procedure,
122                                 Gimp                  *gimp,
123                                 GimpContext           *context,
124                                 GimpProgress          *progress,
125                                 const GimpValueArray  *args,
126                                 GError               **error)
127 {
128   gboolean success = TRUE;
129   GimpValueArray *return_vals;
130   GimpUnit unit_id;
131   gboolean deletion_flag = FALSE;
132 
133   unit_id = g_value_get_int (gimp_value_array_index (args, 0));
134 
135   if (success)
136     {
137       deletion_flag = _gimp_unit_get_deletion_flag (gimp, unit_id);
138     }
139 
140   return_vals = gimp_procedure_get_return_values (procedure, success,
141                                                   error ? *error : NULL);
142 
143   if (success)
144     g_value_set_boolean (gimp_value_array_index (return_vals, 1), deletion_flag);
145 
146   return return_vals;
147 }
148 
149 static GimpValueArray *
unit_set_deletion_flag_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)150 unit_set_deletion_flag_invoker (GimpProcedure         *procedure,
151                                 Gimp                  *gimp,
152                                 GimpContext           *context,
153                                 GimpProgress          *progress,
154                                 const GimpValueArray  *args,
155                                 GError               **error)
156 {
157   gboolean success = TRUE;
158   GimpUnit unit_id;
159   gboolean deletion_flag;
160 
161   unit_id = g_value_get_int (gimp_value_array_index (args, 0));
162   deletion_flag = g_value_get_boolean (gimp_value_array_index (args, 1));
163 
164   if (success)
165     {
166       _gimp_unit_set_deletion_flag (gimp, unit_id, deletion_flag);
167     }
168 
169   return gimp_procedure_get_return_values (procedure, success,
170                                            error ? *error : NULL);
171 }
172 
173 static GimpValueArray *
unit_get_identifier_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)174 unit_get_identifier_invoker (GimpProcedure         *procedure,
175                              Gimp                  *gimp,
176                              GimpContext           *context,
177                              GimpProgress          *progress,
178                              const GimpValueArray  *args,
179                              GError               **error)
180 {
181   gboolean success = TRUE;
182   GimpValueArray *return_vals;
183   GimpUnit unit_id;
184   gchar *identifier = NULL;
185 
186   unit_id = g_value_get_int (gimp_value_array_index (args, 0));
187 
188   if (success)
189     {
190       identifier = g_strdup (_gimp_unit_get_identifier (gimp, unit_id));
191     }
192 
193   return_vals = gimp_procedure_get_return_values (procedure, success,
194                                                   error ? *error : NULL);
195 
196   if (success)
197     g_value_take_string (gimp_value_array_index (return_vals, 1), identifier);
198 
199   return return_vals;
200 }
201 
202 static GimpValueArray *
unit_get_factor_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)203 unit_get_factor_invoker (GimpProcedure         *procedure,
204                          Gimp                  *gimp,
205                          GimpContext           *context,
206                          GimpProgress          *progress,
207                          const GimpValueArray  *args,
208                          GError               **error)
209 {
210   gboolean success = TRUE;
211   GimpValueArray *return_vals;
212   GimpUnit unit_id;
213   gdouble factor = 0.0;
214 
215   unit_id = g_value_get_int (gimp_value_array_index (args, 0));
216 
217   if (success)
218     {
219       factor = _gimp_unit_get_factor (gimp, unit_id);
220     }
221 
222   return_vals = gimp_procedure_get_return_values (procedure, success,
223                                                   error ? *error : NULL);
224 
225   if (success)
226     g_value_set_double (gimp_value_array_index (return_vals, 1), factor);
227 
228   return return_vals;
229 }
230 
231 static GimpValueArray *
unit_get_digits_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)232 unit_get_digits_invoker (GimpProcedure         *procedure,
233                          Gimp                  *gimp,
234                          GimpContext           *context,
235                          GimpProgress          *progress,
236                          const GimpValueArray  *args,
237                          GError               **error)
238 {
239   gboolean success = TRUE;
240   GimpValueArray *return_vals;
241   GimpUnit unit_id;
242   gint32 digits = 0;
243 
244   unit_id = g_value_get_int (gimp_value_array_index (args, 0));
245 
246   if (success)
247     {
248       digits = _gimp_unit_get_digits (gimp, unit_id);
249     }
250 
251   return_vals = gimp_procedure_get_return_values (procedure, success,
252                                                   error ? *error : NULL);
253 
254   if (success)
255     g_value_set_int (gimp_value_array_index (return_vals, 1), digits);
256 
257   return return_vals;
258 }
259 
260 static GimpValueArray *
unit_get_symbol_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)261 unit_get_symbol_invoker (GimpProcedure         *procedure,
262                          Gimp                  *gimp,
263                          GimpContext           *context,
264                          GimpProgress          *progress,
265                          const GimpValueArray  *args,
266                          GError               **error)
267 {
268   gboolean success = TRUE;
269   GimpValueArray *return_vals;
270   GimpUnit unit_id;
271   gchar *symbol = NULL;
272 
273   unit_id = g_value_get_int (gimp_value_array_index (args, 0));
274 
275   if (success)
276     {
277       symbol = g_strdup (_gimp_unit_get_symbol (gimp, unit_id));
278     }
279 
280   return_vals = gimp_procedure_get_return_values (procedure, success,
281                                                   error ? *error : NULL);
282 
283   if (success)
284     g_value_take_string (gimp_value_array_index (return_vals, 1), symbol);
285 
286   return return_vals;
287 }
288 
289 static GimpValueArray *
unit_get_abbreviation_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)290 unit_get_abbreviation_invoker (GimpProcedure         *procedure,
291                                Gimp                  *gimp,
292                                GimpContext           *context,
293                                GimpProgress          *progress,
294                                const GimpValueArray  *args,
295                                GError               **error)
296 {
297   gboolean success = TRUE;
298   GimpValueArray *return_vals;
299   GimpUnit unit_id;
300   gchar *abbreviation = NULL;
301 
302   unit_id = g_value_get_int (gimp_value_array_index (args, 0));
303 
304   if (success)
305     {
306       abbreviation = g_strdup (_gimp_unit_get_abbreviation (gimp, unit_id));
307     }
308 
309   return_vals = gimp_procedure_get_return_values (procedure, success,
310                                                   error ? *error : NULL);
311 
312   if (success)
313     g_value_take_string (gimp_value_array_index (return_vals, 1), abbreviation);
314 
315   return return_vals;
316 }
317 
318 static GimpValueArray *
unit_get_singular_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)319 unit_get_singular_invoker (GimpProcedure         *procedure,
320                            Gimp                  *gimp,
321                            GimpContext           *context,
322                            GimpProgress          *progress,
323                            const GimpValueArray  *args,
324                            GError               **error)
325 {
326   gboolean success = TRUE;
327   GimpValueArray *return_vals;
328   GimpUnit unit_id;
329   gchar *singular = NULL;
330 
331   unit_id = g_value_get_int (gimp_value_array_index (args, 0));
332 
333   if (success)
334     {
335       singular = g_strdup (_gimp_unit_get_singular (gimp, unit_id));
336     }
337 
338   return_vals = gimp_procedure_get_return_values (procedure, success,
339                                                   error ? *error : NULL);
340 
341   if (success)
342     g_value_take_string (gimp_value_array_index (return_vals, 1), singular);
343 
344   return return_vals;
345 }
346 
347 static GimpValueArray *
unit_get_plural_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)348 unit_get_plural_invoker (GimpProcedure         *procedure,
349                          Gimp                  *gimp,
350                          GimpContext           *context,
351                          GimpProgress          *progress,
352                          const GimpValueArray  *args,
353                          GError               **error)
354 {
355   gboolean success = TRUE;
356   GimpValueArray *return_vals;
357   GimpUnit unit_id;
358   gchar *plural = NULL;
359 
360   unit_id = g_value_get_int (gimp_value_array_index (args, 0));
361 
362   if (success)
363     {
364       plural = g_strdup (_gimp_unit_get_plural (gimp, unit_id));
365     }
366 
367   return_vals = gimp_procedure_get_return_values (procedure, success,
368                                                   error ? *error : NULL);
369 
370   if (success)
371     g_value_take_string (gimp_value_array_index (return_vals, 1), plural);
372 
373   return return_vals;
374 }
375 
376 void
register_unit_procs(GimpPDB * pdb)377 register_unit_procs (GimpPDB *pdb)
378 {
379   GimpProcedure *procedure;
380 
381   /*
382    * gimp-unit-get-number-of-units
383    */
384   procedure = gimp_procedure_new (unit_get_number_of_units_invoker);
385   gimp_object_set_static_name (GIMP_OBJECT (procedure),
386                                "gimp-unit-get-number-of-units");
387   gimp_procedure_set_static_strings (procedure,
388                                      "gimp-unit-get-number-of-units",
389                                      "Returns the number of units.",
390                                      "This procedure returns the number of defined units.",
391                                      "Michael Natterer <mitch@gimp.org>",
392                                      "Michael Natterer",
393                                      "1999",
394                                      NULL);
395   gimp_procedure_add_return_value (procedure,
396                                    gimp_param_spec_int32 ("num-units",
397                                                           "num units",
398                                                           "The number of units",
399                                                           G_MININT32, G_MAXINT32, 0,
400                                                           GIMP_PARAM_READWRITE));
401   gimp_pdb_register_procedure (pdb, procedure);
402   g_object_unref (procedure);
403 
404   /*
405    * gimp-unit-get-number-of-built-in-units
406    */
407   procedure = gimp_procedure_new (unit_get_number_of_built_in_units_invoker);
408   gimp_object_set_static_name (GIMP_OBJECT (procedure),
409                                "gimp-unit-get-number-of-built-in-units");
410   gimp_procedure_set_static_strings (procedure,
411                                      "gimp-unit-get-number-of-built-in-units",
412                                      "Returns the number of built-in units.",
413                                      "This procedure returns the number of defined units built-in to GIMP.",
414                                      "Michael Natterer <mitch@gimp.org>",
415                                      "Michael Natterer",
416                                      "1999",
417                                      NULL);
418   gimp_procedure_add_return_value (procedure,
419                                    gimp_param_spec_int32 ("num-units",
420                                                           "num units",
421                                                           "The number of built-in units",
422                                                           G_MININT32, G_MAXINT32, 0,
423                                                           GIMP_PARAM_READWRITE));
424   gimp_pdb_register_procedure (pdb, procedure);
425   g_object_unref (procedure);
426 
427   /*
428    * gimp-unit-new
429    */
430   procedure = gimp_procedure_new (unit_new_invoker);
431   gimp_object_set_static_name (GIMP_OBJECT (procedure),
432                                "gimp-unit-new");
433   gimp_procedure_set_static_strings (procedure,
434                                      "gimp-unit-new",
435                                      "Creates a new unit and returns it's integer ID.",
436                                      "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.",
437                                      "Michael Natterer <mitch@gimp.org>",
438                                      "Michael Natterer",
439                                      "1999",
440                                      NULL);
441   gimp_procedure_add_argument (procedure,
442                                gimp_param_spec_string ("identifier",
443                                                        "identifier",
444                                                        "The new unit's identifier",
445                                                        FALSE, FALSE, TRUE,
446                                                        NULL,
447                                                        GIMP_PARAM_READWRITE));
448   gimp_procedure_add_argument (procedure,
449                                g_param_spec_double ("factor",
450                                                     "factor",
451                                                     "The new unit's factor",
452                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
453                                                     GIMP_PARAM_READWRITE));
454   gimp_procedure_add_argument (procedure,
455                                gimp_param_spec_int32 ("digits",
456                                                       "digits",
457                                                       "The new unit's digits",
458                                                       G_MININT32, G_MAXINT32, 0,
459                                                       GIMP_PARAM_READWRITE));
460   gimp_procedure_add_argument (procedure,
461                                gimp_param_spec_string ("symbol",
462                                                        "symbol",
463                                                        "The new unit's symbol",
464                                                        FALSE, FALSE, TRUE,
465                                                        NULL,
466                                                        GIMP_PARAM_READWRITE));
467   gimp_procedure_add_argument (procedure,
468                                gimp_param_spec_string ("abbreviation",
469                                                        "abbreviation",
470                                                        "The new unit's abbreviation",
471                                                        FALSE, FALSE, TRUE,
472                                                        NULL,
473                                                        GIMP_PARAM_READWRITE));
474   gimp_procedure_add_argument (procedure,
475                                gimp_param_spec_string ("singular",
476                                                        "singular",
477                                                        "The new unit's singular form",
478                                                        FALSE, FALSE, TRUE,
479                                                        NULL,
480                                                        GIMP_PARAM_READWRITE));
481   gimp_procedure_add_argument (procedure,
482                                gimp_param_spec_string ("plural",
483                                                        "plural",
484                                                        "The new unit's plural form",
485                                                        FALSE, FALSE, TRUE,
486                                                        NULL,
487                                                        GIMP_PARAM_READWRITE));
488   gimp_procedure_add_return_value (procedure,
489                                    gimp_param_spec_unit ("unit-id",
490                                                          "unit id",
491                                                          "The new unit's ID",
492                                                          TRUE,
493                                                          FALSE,
494                                                          GIMP_UNIT_PIXEL,
495                                                          GIMP_PARAM_READWRITE));
496   gimp_pdb_register_procedure (pdb, procedure);
497   g_object_unref (procedure);
498 
499   /*
500    * gimp-unit-get-deletion-flag
501    */
502   procedure = gimp_procedure_new (unit_get_deletion_flag_invoker);
503   gimp_object_set_static_name (GIMP_OBJECT (procedure),
504                                "gimp-unit-get-deletion-flag");
505   gimp_procedure_set_static_strings (procedure,
506                                      "gimp-unit-get-deletion-flag",
507                                      "Returns the deletion flag of the unit.",
508                                      "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.",
509                                      "Michael Natterer <mitch@gimp.org>",
510                                      "Michael Natterer",
511                                      "1999",
512                                      NULL);
513   gimp_procedure_add_argument (procedure,
514                                gimp_param_spec_unit ("unit-id",
515                                                      "unit id",
516                                                      "The unit's integer ID",
517                                                      TRUE,
518                                                      FALSE,
519                                                      GIMP_UNIT_PIXEL,
520                                                      GIMP_PARAM_READWRITE));
521   gimp_procedure_add_return_value (procedure,
522                                    g_param_spec_boolean ("deletion-flag",
523                                                          "deletion flag",
524                                                          "The unit's deletion flag",
525                                                          FALSE,
526                                                          GIMP_PARAM_READWRITE));
527   gimp_pdb_register_procedure (pdb, procedure);
528   g_object_unref (procedure);
529 
530   /*
531    * gimp-unit-set-deletion-flag
532    */
533   procedure = gimp_procedure_new (unit_set_deletion_flag_invoker);
534   gimp_object_set_static_name (GIMP_OBJECT (procedure),
535                                "gimp-unit-set-deletion-flag");
536   gimp_procedure_set_static_strings (procedure,
537                                      "gimp-unit-set-deletion-flag",
538                                      "Sets the deletion flag of a unit.",
539                                      "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.",
540                                      "Michael Natterer <mitch@gimp.org>",
541                                      "Michael Natterer",
542                                      "1999",
543                                      NULL);
544   gimp_procedure_add_argument (procedure,
545                                gimp_param_spec_unit ("unit-id",
546                                                      "unit id",
547                                                      "The unit's integer ID",
548                                                      TRUE,
549                                                      FALSE,
550                                                      GIMP_UNIT_PIXEL,
551                                                      GIMP_PARAM_READWRITE));
552   gimp_procedure_add_argument (procedure,
553                                g_param_spec_boolean ("deletion-flag",
554                                                      "deletion flag",
555                                                      "The new deletion flag of the unit",
556                                                      FALSE,
557                                                      GIMP_PARAM_READWRITE));
558   gimp_pdb_register_procedure (pdb, procedure);
559   g_object_unref (procedure);
560 
561   /*
562    * gimp-unit-get-identifier
563    */
564   procedure = gimp_procedure_new (unit_get_identifier_invoker);
565   gimp_object_set_static_name (GIMP_OBJECT (procedure),
566                                "gimp-unit-get-identifier");
567   gimp_procedure_set_static_strings (procedure,
568                                      "gimp-unit-get-identifier",
569                                      "Returns the textual identifier of the unit.",
570                                      "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.",
571                                      "Michael Natterer <mitch@gimp.org>",
572                                      "Michael Natterer",
573                                      "1999",
574                                      NULL);
575   gimp_procedure_add_argument (procedure,
576                                gimp_param_spec_unit ("unit-id",
577                                                      "unit id",
578                                                      "The unit's integer ID",
579                                                      TRUE,
580                                                      FALSE,
581                                                      GIMP_UNIT_PIXEL,
582                                                      GIMP_PARAM_READWRITE));
583   gimp_procedure_add_return_value (procedure,
584                                    gimp_param_spec_string ("identifier",
585                                                            "identifier",
586                                                            "The unit's textual identifier",
587                                                            FALSE, FALSE, FALSE,
588                                                            NULL,
589                                                            GIMP_PARAM_READWRITE));
590   gimp_pdb_register_procedure (pdb, procedure);
591   g_object_unref (procedure);
592 
593   /*
594    * gimp-unit-get-factor
595    */
596   procedure = gimp_procedure_new (unit_get_factor_invoker);
597   gimp_object_set_static_name (GIMP_OBJECT (procedure),
598                                "gimp-unit-get-factor");
599   gimp_procedure_set_static_strings (procedure,
600                                      "gimp-unit-get-factor",
601                                      "Returns the factor of the unit.",
602                                      "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.",
603                                      "Michael Natterer <mitch@gimp.org>",
604                                      "Michael Natterer",
605                                      "1999",
606                                      NULL);
607   gimp_procedure_add_argument (procedure,
608                                gimp_param_spec_unit ("unit-id",
609                                                      "unit id",
610                                                      "The unit's integer ID",
611                                                      TRUE,
612                                                      FALSE,
613                                                      GIMP_UNIT_PIXEL,
614                                                      GIMP_PARAM_READWRITE));
615   gimp_procedure_add_return_value (procedure,
616                                    g_param_spec_double ("factor",
617                                                         "factor",
618                                                         "The unit's factor",
619                                                         -G_MAXDOUBLE, G_MAXDOUBLE, 0,
620                                                         GIMP_PARAM_READWRITE));
621   gimp_pdb_register_procedure (pdb, procedure);
622   g_object_unref (procedure);
623 
624   /*
625    * gimp-unit-get-digits
626    */
627   procedure = gimp_procedure_new (unit_get_digits_invoker);
628   gimp_object_set_static_name (GIMP_OBJECT (procedure),
629                                "gimp-unit-get-digits");
630   gimp_procedure_set_static_strings (procedure,
631                                      "gimp-unit-get-digits",
632                                      "Returns the number of digits of the unit.",
633                                      "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.",
634                                      "Michael Natterer <mitch@gimp.org>",
635                                      "Michael Natterer",
636                                      "1999",
637                                      NULL);
638   gimp_procedure_add_argument (procedure,
639                                gimp_param_spec_unit ("unit-id",
640                                                      "unit id",
641                                                      "The unit's integer ID",
642                                                      TRUE,
643                                                      FALSE,
644                                                      GIMP_UNIT_PIXEL,
645                                                      GIMP_PARAM_READWRITE));
646   gimp_procedure_add_return_value (procedure,
647                                    gimp_param_spec_int32 ("digits",
648                                                           "digits",
649                                                           "The unit's number of digits",
650                                                           G_MININT32, G_MAXINT32, 0,
651                                                           GIMP_PARAM_READWRITE));
652   gimp_pdb_register_procedure (pdb, procedure);
653   g_object_unref (procedure);
654 
655   /*
656    * gimp-unit-get-symbol
657    */
658   procedure = gimp_procedure_new (unit_get_symbol_invoker);
659   gimp_object_set_static_name (GIMP_OBJECT (procedure),
660                                "gimp-unit-get-symbol");
661   gimp_procedure_set_static_strings (procedure,
662                                      "gimp-unit-get-symbol",
663                                      "Returns the symbol of the unit.",
664                                      "This procedure returns the symbol of the unit (\"''\" for inches).",
665                                      "Michael Natterer <mitch@gimp.org>",
666                                      "Michael Natterer",
667                                      "1999",
668                                      NULL);
669   gimp_procedure_add_argument (procedure,
670                                gimp_param_spec_unit ("unit-id",
671                                                      "unit id",
672                                                      "The unit's integer ID",
673                                                      TRUE,
674                                                      FALSE,
675                                                      GIMP_UNIT_PIXEL,
676                                                      GIMP_PARAM_READWRITE));
677   gimp_procedure_add_return_value (procedure,
678                                    gimp_param_spec_string ("symbol",
679                                                            "symbol",
680                                                            "The unit's symbol",
681                                                            FALSE, FALSE, FALSE,
682                                                            NULL,
683                                                            GIMP_PARAM_READWRITE));
684   gimp_pdb_register_procedure (pdb, procedure);
685   g_object_unref (procedure);
686 
687   /*
688    * gimp-unit-get-abbreviation
689    */
690   procedure = gimp_procedure_new (unit_get_abbreviation_invoker);
691   gimp_object_set_static_name (GIMP_OBJECT (procedure),
692                                "gimp-unit-get-abbreviation");
693   gimp_procedure_set_static_strings (procedure,
694                                      "gimp-unit-get-abbreviation",
695                                      "Returns the abbreviation of the unit.",
696                                      "This procedure returns the abbreviation of the unit (\"in\" for inches).",
697                                      "Michael Natterer <mitch@gimp.org>",
698                                      "Michael Natterer",
699                                      "1999",
700                                      NULL);
701   gimp_procedure_add_argument (procedure,
702                                gimp_param_spec_unit ("unit-id",
703                                                      "unit id",
704                                                      "The unit's integer ID",
705                                                      TRUE,
706                                                      FALSE,
707                                                      GIMP_UNIT_PIXEL,
708                                                      GIMP_PARAM_READWRITE));
709   gimp_procedure_add_return_value (procedure,
710                                    gimp_param_spec_string ("abbreviation",
711                                                            "abbreviation",
712                                                            "The unit's abbreviation",
713                                                            FALSE, FALSE, FALSE,
714                                                            NULL,
715                                                            GIMP_PARAM_READWRITE));
716   gimp_pdb_register_procedure (pdb, procedure);
717   g_object_unref (procedure);
718 
719   /*
720    * gimp-unit-get-singular
721    */
722   procedure = gimp_procedure_new (unit_get_singular_invoker);
723   gimp_object_set_static_name (GIMP_OBJECT (procedure),
724                                "gimp-unit-get-singular");
725   gimp_procedure_set_static_strings (procedure,
726                                      "gimp-unit-get-singular",
727                                      "Returns the singular form of the unit.",
728                                      "This procedure returns the singular form of the unit.",
729                                      "Michael Natterer <mitch@gimp.org>",
730                                      "Michael Natterer",
731                                      "1999",
732                                      NULL);
733   gimp_procedure_add_argument (procedure,
734                                gimp_param_spec_unit ("unit-id",
735                                                      "unit id",
736                                                      "The unit's integer ID",
737                                                      TRUE,
738                                                      FALSE,
739                                                      GIMP_UNIT_PIXEL,
740                                                      GIMP_PARAM_READWRITE));
741   gimp_procedure_add_return_value (procedure,
742                                    gimp_param_spec_string ("singular",
743                                                            "singular",
744                                                            "The unit's singular form",
745                                                            FALSE, FALSE, FALSE,
746                                                            NULL,
747                                                            GIMP_PARAM_READWRITE));
748   gimp_pdb_register_procedure (pdb, procedure);
749   g_object_unref (procedure);
750 
751   /*
752    * gimp-unit-get-plural
753    */
754   procedure = gimp_procedure_new (unit_get_plural_invoker);
755   gimp_object_set_static_name (GIMP_OBJECT (procedure),
756                                "gimp-unit-get-plural");
757   gimp_procedure_set_static_strings (procedure,
758                                      "gimp-unit-get-plural",
759                                      "Returns the plural form of the unit.",
760                                      "This procedure returns the plural form of the unit.",
761                                      "Michael Natterer <mitch@gimp.org>",
762                                      "Michael Natterer",
763                                      "1999",
764                                      NULL);
765   gimp_procedure_add_argument (procedure,
766                                gimp_param_spec_unit ("unit-id",
767                                                      "unit id",
768                                                      "The unit's integer ID",
769                                                      TRUE,
770                                                      FALSE,
771                                                      GIMP_UNIT_PIXEL,
772                                                      GIMP_PARAM_READWRITE));
773   gimp_procedure_add_return_value (procedure,
774                                    gimp_param_spec_string ("plural",
775                                                            "plural",
776                                                            "The unit's plural form",
777                                                            FALSE, FALSE, FALSE,
778                                                            NULL,
779                                                            GIMP_PARAM_READWRITE));
780   gimp_pdb_register_procedure (pdb, procedure);
781   g_object_unref (procedure);
782 }
783