unit-cmds.c 34.5 KB
Newer Older
1
/* GIMP - The GNU Image Manipulation Program
2
 * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
Manish Singh's avatar
Manish Singh committed
3
 *
4
 * This program is free software: you can redistribute it and/or modify
Manish Singh's avatar
Manish Singh committed
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
Manish Singh's avatar
Manish Singh committed
7 8 9 10 11 12 13 14
 * (at your option) any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
15
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
Manish Singh's avatar
Manish Singh committed
16 17
 */

18
/* NOTE: This file is auto-generated by pdbgen.pl. */
Manish Singh's avatar
Manish Singh committed
19

20 21
#include "config.h"

22
#include <gegl.h>
23

24 25
#include "libgimpbase/gimpbase.h"

26
#include "pdb-types.h"
Manish Singh's avatar
Manish Singh committed
27

28
#include "core/gimpparamspecs.h"
29
#include "core/gimpunit.h"
30

31 32
#include "gimppdb.h"
#include "gimpprocedure.h"
33
#include "internal-procs.h"
34

Manish Singh's avatar
Manish Singh committed
35

36
static GValueArray *
37 38 39 40 41 42
unit_get_number_of_units_invoker (GimpProcedure      *procedure,
                                  Gimp               *gimp,
                                  GimpContext        *context,
                                  GimpProgress       *progress,
                                  const GValueArray  *args,
                                  GError            **error)
Manish Singh's avatar
Manish Singh committed
43
{
44
  GValueArray *return_vals;
45
  gint32 num_units = 0;
46 47

  num_units = _gimp_unit_get_number_of_units (gimp);
Manish Singh's avatar
Manish Singh committed
48

49
  return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
50
  g_value_set_int (&return_vals->values[1], num_units);
Manish Singh's avatar
Manish Singh committed
51

52
  return return_vals;
Manish Singh's avatar
Manish Singh committed
53 54
}

55
static GValueArray *
56 57 58 59 60 61
unit_get_number_of_built_in_units_invoker (GimpProcedure      *procedure,
                                           Gimp               *gimp,
                                           GimpContext        *context,
                                           GimpProgress       *progress,
                                           const GValueArray  *args,
                                           GError            **error)
62
{
63
  GValueArray *return_vals;
64
  gint32 num_units = 0;
65 66

  num_units = _gimp_unit_get_number_of_built_in_units (gimp);
67

68
  return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
69
  g_value_set_int (&return_vals->values[1], num_units);
70

71
  return return_vals;
72 73
}

74
static GValueArray *
75 76 77 78 79 80
unit_new_invoker (GimpProcedure      *procedure,
                  Gimp               *gimp,
                  GimpContext        *context,
                  GimpProgress       *progress,
                  const GValueArray  *args,
                  GError            **error)
Manish Singh's avatar
Manish Singh committed
81 82
{
  gboolean success = TRUE;
83
  GValueArray *return_vals;
84
  const gchar *identifier;
Manish Singh's avatar
Manish Singh committed
85 86
  gdouble factor;
  gint32 digits;
87 88 89 90
  const gchar *symbol;
  const gchar *abbreviation;
  const gchar *singular;
  const gchar *plural;
91
  GimpUnit unit_id = 0;
Manish Singh's avatar
Manish Singh committed
92

93 94 95 96 97 98 99
  identifier = g_value_get_string (&args->values[0]);
  factor = g_value_get_double (&args->values[1]);
  digits = g_value_get_int (&args->values[2]);
  symbol = g_value_get_string (&args->values[3]);
  abbreviation = g_value_get_string (&args->values[4]);
  singular = g_value_get_string (&args->values[5]);
  plural = g_value_get_string (&args->values[6]);
Manish Singh's avatar
Manish Singh committed
100 101

  if (success)
102
    {
103 104
      unit_id = _gimp_unit_new (gimp, identifier, factor, digits,
                                symbol, abbreviation, singular, plural);
105
    }
Manish Singh's avatar
Manish Singh committed
106

107 108
  return_vals = gimp_procedure_get_return_values (procedure, success,
                                                  error ? *error : NULL);
Manish Singh's avatar
Manish Singh committed
109 110

  if (success)
111
    g_value_set_int (&return_vals->values[1], unit_id);
Manish Singh's avatar
Manish Singh committed
112

113
  return return_vals;
Manish Singh's avatar
Manish Singh committed
114 115
}

116
static GValueArray *
117 118 119 120 121 122
unit_get_deletion_flag_invoker (GimpProcedure      *procedure,
                                Gimp               *gimp,
                                GimpContext        *context,
                                GimpProgress       *progress,
                                const GValueArray  *args,
                                GError            **error)
Manish Singh's avatar
Manish Singh committed
123 124
{
  gboolean success = TRUE;
125
  GValueArray *return_vals;
126
  GimpUnit unit_id;
127
  gboolean deletion_flag = FALSE;
Manish Singh's avatar
Manish Singh committed
128

129
  unit_id = g_value_get_int (&args->values[0]);
Manish Singh's avatar
Manish Singh committed
130

131 132 133 134 135
  if (success)
    {
      deletion_flag = _gimp_unit_get_deletion_flag (gimp, unit_id);
    }

136 137
  return_vals = gimp_procedure_get_return_values (procedure, success,
                                                  error ? *error : NULL);
Manish Singh's avatar
Manish Singh committed
138 139

  if (success)
140
    g_value_set_boolean (&return_vals->values[1], deletion_flag);
Manish Singh's avatar
Manish Singh committed
141

142
  return return_vals;
Manish Singh's avatar
Manish Singh committed
143 144
}

145
static GValueArray *
146 147 148 149 150 151
unit_set_deletion_flag_invoker (GimpProcedure      *procedure,
                                Gimp               *gimp,
                                GimpContext        *context,
                                GimpProgress       *progress,
                                const GValueArray  *args,
                                GError            **error)
Manish Singh's avatar
Manish Singh committed
152 153
{
  gboolean success = TRUE;
154
  GimpUnit unit_id;
Manish Singh's avatar
Manish Singh committed
155 156
  gboolean deletion_flag;

157 158
  unit_id = g_value_get_int (&args->values[0]);
  deletion_flag = g_value_get_boolean (&args->values[1]);
Manish Singh's avatar
Manish Singh committed
159 160

  if (success)
161 162 163
    {
      _gimp_unit_set_deletion_flag (gimp, unit_id, deletion_flag);
    }
Manish Singh's avatar
Manish Singh committed
164

165 166
  return gimp_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
Manish Singh's avatar
Manish Singh committed
167 168
}

169
static GValueArray *
170 171 172 173 174 175
unit_get_identifier_invoker (GimpProcedure      *procedure,
                             Gimp               *gimp,
                             GimpContext        *context,
                             GimpProgress       *progress,
                             const GValueArray  *args,
                             GError            **error)
Manish Singh's avatar
Manish Singh committed
176 177
{
  gboolean success = TRUE;
178
  GValueArray *return_vals;
179
  GimpUnit unit_id;
180
  gchar *identifier = NULL;
Manish Singh's avatar
Manish Singh committed
181

182
  unit_id = g_value_get_int (&args->values[0]);
Manish Singh's avatar
Manish Singh committed
183

184 185 186 187 188
  if (success)
    {
      identifier = g_strdup (_gimp_unit_get_identifier (gimp, unit_id));
    }

189 190
  return_vals = gimp_procedure_get_return_values (procedure, success,
                                                  error ? *error : NULL);
Manish Singh's avatar
Manish Singh committed
191 192

  if (success)
193
    g_value_take_string (&return_vals->values[1], identifier);
Manish Singh's avatar
Manish Singh committed
194

195
  return return_vals;
Manish Singh's avatar
Manish Singh committed
196 197
}

198
static GValueArray *
199 200 201 202 203 204
unit_get_factor_invoker (GimpProcedure      *procedure,
                         Gimp               *gimp,
                         GimpContext        *context,
                         GimpProgress       *progress,
                         const GValueArray  *args,
                         GError            **error)
Manish Singh's avatar
Manish Singh committed
205 206
{
  gboolean success = TRUE;
207
  GValueArray *return_vals;
208
  GimpUnit unit_id;
209
  gdouble factor = 0.0;
Manish Singh's avatar
Manish Singh committed
210

211
  unit_id = g_value_get_int (&args->values[0]);
Manish Singh's avatar
Manish Singh committed
212

213 214 215 216 217
  if (success)
    {
      factor = _gimp_unit_get_factor (gimp, unit_id);
    }

218 219
  return_vals = gimp_procedure_get_return_values (procedure, success,
                                                  error ? *error : NULL);
Manish Singh's avatar
Manish Singh committed
220 221

  if (success)
222
    g_value_set_double (&return_vals->values[1], factor);
Manish Singh's avatar
Manish Singh committed
223

224
  return return_vals;
Manish Singh's avatar
Manish Singh committed
225 226
}

227
static GValueArray *
228 229 230 231 232 233
unit_get_digits_invoker (GimpProcedure      *procedure,
                         Gimp               *gimp,
                         GimpContext        *context,
                         GimpProgress       *progress,
                         const GValueArray  *args,
                         GError            **error)
Manish Singh's avatar
Manish Singh committed
234 235
{
  gboolean success = TRUE;
236
  GValueArray *return_vals;
237
  GimpUnit unit_id;
238
  gint32 digits = 0;
Manish Singh's avatar
Manish Singh committed
239

240
  unit_id = g_value_get_int (&args->values[0]);
Manish Singh's avatar
Manish Singh committed
241

242 243 244 245 246
  if (success)
    {
      digits = _gimp_unit_get_digits (gimp, unit_id);
    }

247 248
  return_vals = gimp_procedure_get_return_values (procedure, success,
                                                  error ? *error : NULL);
Manish Singh's avatar
Manish Singh committed
249 250

  if (success)
251
    g_value_set_int (&return_vals->values[1], digits);
Manish Singh's avatar
Manish Singh committed
252

253
  return return_vals;
Manish Singh's avatar
Manish Singh committed
254 255
}

256
static GValueArray *
257 258 259 260 261 262
unit_get_symbol_invoker (GimpProcedure      *procedure,
                         Gimp               *gimp,
                         GimpContext        *context,
                         GimpProgress       *progress,
                         const GValueArray  *args,
                         GError            **error)
Manish Singh's avatar
Manish Singh committed
263 264
{
  gboolean success = TRUE;
265
  GValueArray *return_vals;
266
  GimpUnit unit_id;
267
  gchar *symbol = NULL;
Manish Singh's avatar
Manish Singh committed
268

269
  unit_id = g_value_get_int (&args->values[0]);
Manish Singh's avatar
Manish Singh committed
270

271 272 273 274 275
  if (success)
    {
      symbol = g_strdup (_gimp_unit_get_symbol (gimp, unit_id));
    }

276 277
  return_vals = gimp_procedure_get_return_values (procedure, success,
                                                  error ? *error : NULL);
Manish Singh's avatar
Manish Singh committed
278 279

  if (success)
280
    g_value_take_string (&return_vals->values[1], symbol);
Manish Singh's avatar
Manish Singh committed
281

282
  return return_vals;
Manish Singh's avatar
Manish Singh committed
283 284
}

285
static GValueArray *
286 287 288 289 290 291
unit_get_abbreviation_invoker (GimpProcedure      *procedure,
                               Gimp               *gimp,
                               GimpContext        *context,
                               GimpProgress       *progress,
                               const GValueArray  *args,
                               GError            **error)
Manish Singh's avatar
Manish Singh committed
292 293
{
  gboolean success = TRUE;
294
  GValueArray *return_vals;
295
  GimpUnit unit_id;
296
  gchar *abbreviation = NULL;
Manish Singh's avatar
Manish Singh committed
297

298
  unit_id = g_value_get_int (&args->values[0]);
Manish Singh's avatar
Manish Singh committed
299

300 301 302 303 304
  if (success)
    {
      abbreviation = g_strdup (_gimp_unit_get_abbreviation (gimp, unit_id));
    }

305 306
  return_vals = gimp_procedure_get_return_values (procedure, success,
                                                  error ? *error : NULL);
Manish Singh's avatar
Manish Singh committed
307 308

  if (success)
309
    g_value_take_string (&return_vals->values[1], abbreviation);
Manish Singh's avatar
Manish Singh committed
310

311
  return return_vals;
Manish Singh's avatar
Manish Singh committed
312 313
}

314
static GValueArray *
315 316 317 318 319 320
unit_get_singular_invoker (GimpProcedure      *procedure,
                           Gimp               *gimp,
                           GimpContext        *context,
                           GimpProgress       *progress,
                           const GValueArray  *args,
                           GError            **error)
Manish Singh's avatar
Manish Singh committed
321 322
{
  gboolean success = TRUE;
323
  GValueArray *return_vals;
324
  GimpUnit unit_id;
325
  gchar *singular = NULL;
Manish Singh's avatar
Manish Singh committed
326

327
  unit_id = g_value_get_int (&args->values[0]);
Manish Singh's avatar
Manish Singh committed
328

329 330 331 332 333
  if (success)
    {
      singular = g_strdup (_gimp_unit_get_singular (gimp, unit_id));
    }

334 335
  return_vals = gimp_procedure_get_return_values (procedure, success,
                                                  error ? *error : NULL);
Manish Singh's avatar
Manish Singh committed
336 337

  if (success)
338
    g_value_take_string (&return_vals->values[1], singular);
Manish Singh's avatar
Manish Singh committed
339

340
  return return_vals;
Manish Singh's avatar
Manish Singh committed
341 342
}

343
static GValueArray *
344 345 346 347 348 349
unit_get_plural_invoker (GimpProcedure      *procedure,
                         Gimp               *gimp,
                         GimpContext        *context,
                         GimpProgress       *progress,
                         const GValueArray  *args,
                         GError            **error)
Manish Singh's avatar
Manish Singh committed
350 351
{
  gboolean success = TRUE;
352
  GValueArray *return_vals;
353
  GimpUnit unit_id;
354
  gchar *plural = NULL;
Manish Singh's avatar
Manish Singh committed
355

356
  unit_id = g_value_get_int (&args->values[0]);
Manish Singh's avatar
Manish Singh committed
357

358 359 360 361 362
  if (success)
    {
      plural = g_strdup (_gimp_unit_get_plural (gimp, unit_id));
    }

363 364
  return_vals = gimp_procedure_get_return_values (procedure, success,
                                                  error ? *error : NULL);
Manish Singh's avatar
Manish Singh committed
365 366

  if (success)
367
    g_value_take_string (&return_vals->values[1], plural);
Manish Singh's avatar
Manish Singh committed
368

369
  return return_vals;
Manish Singh's avatar
Manish Singh committed
370 371
}

372
void
373
register_unit_procs (GimpPDB *pdb)
Manish Singh's avatar
Manish Singh committed
374
{
375 376 377 378 379
  GimpProcedure *procedure;

  /*
   * gimp-unit-get-number-of-units
   */
380
  procedure = gimp_procedure_new (unit_get_number_of_units_invoker);
381 382
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
                               "gimp-unit-get-number-of-units");
383 384 385 386 387 388 389 390 391 392 393 394 395 396
  gimp_procedure_set_static_strings (procedure,
                                     "gimp-unit-get-number-of-units",
                                     "Returns the number of units.",
                                     "This procedure returns the number of defined units.",
                                     "Michael Natterer <mitch@gimp.org>",
                                     "Michael Natterer",
                                     "1999",
                                     NULL);
  gimp_procedure_add_return_value (procedure,
                                   gimp_param_spec_int32 ("num-units",
                                                          "num units",
                                                          "The number of units",
                                                          G_MININT32, G_MAXINT32, 0,
                                                          GIMP_PARAM_READWRITE));
397
  gimp_pdb_register_procedure (pdb, procedure);
398
  g_object_unref (procedure);
399 400 401 402

  /*
   * gimp-unit-get-number-of-built-in-units
   */
403
  procedure = gimp_procedure_new (unit_get_number_of_built_in_units_invoker);
404 405
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
                               "gimp-unit-get-number-of-built-in-units");
406 407 408
  gimp_procedure_set_static_strings (procedure,
                                     "gimp-unit-get-number-of-built-in-units",
                                     "Returns the number of built-in units.",
409
                                     "This procedure returns the number of defined units built-in to GIMP.",
410 411 412 413 414 415 416 417 418 419
                                     "Michael Natterer <mitch@gimp.org>",
                                     "Michael Natterer",
                                     "1999",
                                     NULL);
  gimp_procedure_add_return_value (procedure,
                                   gimp_param_spec_int32 ("num-units",
                                                          "num units",
                                                          "The number of built-in units",
                                                          G_MININT32, G_MAXINT32, 0,
                                                          GIMP_PARAM_READWRITE));
420
  gimp_pdb_register_procedure (pdb, procedure);
421
  g_object_unref (procedure);
422 423 424 425

  /*
   * gimp-unit-new
   */
426
  procedure = gimp_procedure_new (unit_new_invoker);
427 428
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
                               "gimp-unit-new");
429 430 431
  gimp_procedure_set_static_strings (procedure,
                                     "gimp-unit-new",
                                     "Creates a new unit and returns it's integer ID.",
432
                                     "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.",
433 434 435 436 437 438 439 440
                                     "Michael Natterer <mitch@gimp.org>",
                                     "Michael Natterer",
                                     "1999",
                                     NULL);
  gimp_procedure_add_argument (procedure,
                               gimp_param_spec_string ("identifier",
                                                       "identifier",
                                                       "The new unit's identifier",
441
                                                       FALSE, FALSE, TRUE,
442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459
                                                       NULL,
                                                       GIMP_PARAM_READWRITE));
  gimp_procedure_add_argument (procedure,
                               g_param_spec_double ("factor",
                                                    "factor",
                                                    "The new unit's factor",
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
                                                    GIMP_PARAM_READWRITE));
  gimp_procedure_add_argument (procedure,
                               gimp_param_spec_int32 ("digits",
                                                      "digits",
                                                      "The new unit's digits",
                                                      G_MININT32, G_MAXINT32, 0,
                                                      GIMP_PARAM_READWRITE));
  gimp_procedure_add_argument (procedure,
                               gimp_param_spec_string ("symbol",
                                                       "symbol",
                                                       "The new unit's symbol",
460
                                                       FALSE, FALSE, TRUE,
461 462 463 464 465 466
                                                       NULL,
                                                       GIMP_PARAM_READWRITE));
  gimp_procedure_add_argument (procedure,
                               gimp_param_spec_string ("abbreviation",
                                                       "abbreviation",
                                                       "The new unit's abbreviation",
467
                                                       FALSE, FALSE, TRUE,
468 469 470 471 472 473
                                                       NULL,
                                                       GIMP_PARAM_READWRITE));
  gimp_procedure_add_argument (procedure,
                               gimp_param_spec_string ("singular",
                                                       "singular",
                                                       "The new unit's singular form",
474
                                                       FALSE, FALSE, TRUE,
475 476 477 478 479 480
                                                       NULL,
                                                       GIMP_PARAM_READWRITE));
  gimp_procedure_add_argument (procedure,
                               gimp_param_spec_string ("plural",
                                                       "plural",
                                                       "The new unit's plural form",
481
                                                       FALSE, FALSE, TRUE,
482 483 484 485 486 487 488 489 490 491
                                                       NULL,
                                                       GIMP_PARAM_READWRITE));
  gimp_procedure_add_return_value (procedure,
                                   gimp_param_spec_unit ("unit-id",
                                                         "unit id",
                                                         "The new unit's ID",
                                                         TRUE,
                                                         FALSE,
                                                         GIMP_UNIT_PIXEL,
                                                         GIMP_PARAM_READWRITE));
492
  gimp_pdb_register_procedure (pdb, procedure);
493
  g_object_unref (procedure);
494 495 496 497

  /*
   * gimp-unit-get-deletion-flag
   */
498
  procedure = gimp_procedure_new (unit_get_deletion_flag_invoker);
499 500
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
                               "gimp-unit-get-deletion-flag");
501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522
  gimp_procedure_set_static_strings (procedure,
                                     "gimp-unit-get-deletion-flag",
                                     "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.",
                                     "Michael Natterer <mitch@gimp.org>",
                                     "Michael Natterer",
                                     "1999",
                                     NULL);
  gimp_procedure_add_argument (procedure,
                               gimp_param_spec_unit ("unit-id",
                                                     "unit id",
                                                     "The unit's integer ID",
                                                     TRUE,
                                                     FALSE,
                                                     GIMP_UNIT_PIXEL,
                                                     GIMP_PARAM_READWRITE));
  gimp_procedure_add_return_value (procedure,
                                   g_param_spec_boolean ("deletion-flag",
                                                         "deletion flag",
                                                         "The unit's deletion flag",
                                                         FALSE,
                                                         GIMP_PARAM_READWRITE));
523
  gimp_pdb_register_procedure (pdb, procedure);
524
  g_object_unref (procedure);
525 526 527 528

  /*
   * gimp-unit-set-deletion-flag
   */
529
  procedure = gimp_procedure_new (unit_set_deletion_flag_invoker);
530 531
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
                               "gimp-unit-set-deletion-flag");
532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553
  gimp_procedure_set_static_strings (procedure,
                                     "gimp-unit-set-deletion-flag",
                                     "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.",
                                     "Michael Natterer <mitch@gimp.org>",
                                     "Michael Natterer",
                                     "1999",
                                     NULL);
  gimp_procedure_add_argument (procedure,
                               gimp_param_spec_unit ("unit-id",
                                                     "unit id",
                                                     "The unit's integer ID",
                                                     TRUE,
                                                     FALSE,
                                                     GIMP_UNIT_PIXEL,
                                                     GIMP_PARAM_READWRITE));
  gimp_procedure_add_argument (procedure,
                               g_param_spec_boolean ("deletion-flag",
                                                     "deletion flag",
                                                     "The new deletion flag of the unit",
                                                     FALSE,
                                                     GIMP_PARAM_READWRITE));
554
  gimp_pdb_register_procedure (pdb, procedure);
555
  g_object_unref (procedure);
556 557 558 559

  /*
   * gimp-unit-get-identifier
   */
560
  procedure = gimp_procedure_new (unit_get_identifier_invoker);
561 562
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
                               "gimp-unit-get-identifier");
563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582
  gimp_procedure_set_static_strings (procedure,
                                     "gimp-unit-get-identifier",
                                     "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.",
                                     "Michael Natterer <mitch@gimp.org>",
                                     "Michael Natterer",
                                     "1999",
                                     NULL);
  gimp_procedure_add_argument (procedure,
                               gimp_param_spec_unit ("unit-id",
                                                     "unit id",
                                                     "The unit's integer ID",
                                                     TRUE,
                                                     FALSE,
                                                     GIMP_UNIT_PIXEL,
                                                     GIMP_PARAM_READWRITE));
  gimp_procedure_add_return_value (procedure,
                                   gimp_param_spec_string ("identifier",
                                                           "identifier",
                                                           "The unit's textual identifier",
583
                                                           FALSE, FALSE, FALSE,
584 585
                                                           NULL,
                                                           GIMP_PARAM_READWRITE));
586
  gimp_pdb_register_procedure (pdb, procedure);
587
  g_object_unref (procedure);
588 589 590 591

  /*
   * gimp-unit-get-factor
   */
592
  procedure = gimp_procedure_new (unit_get_factor_invoker);
593 594
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
                               "gimp-unit-get-factor");
595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616
  gimp_procedure_set_static_strings (procedure,
                                     "gimp-unit-get-factor",
                                     "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.",
                                     "Michael Natterer <mitch@gimp.org>",
                                     "Michael Natterer",
                                     "1999",
                                     NULL);
  gimp_procedure_add_argument (procedure,
                               gimp_param_spec_unit ("unit-id",
                                                     "unit id",
                                                     "The unit's integer ID",
                                                     TRUE,
                                                     FALSE,
                                                     GIMP_UNIT_PIXEL,
                                                     GIMP_PARAM_READWRITE));
  gimp_procedure_add_return_value (procedure,
                                   g_param_spec_double ("factor",
                                                        "factor",
                                                        "The unit's factor",
                                                        -G_MAXDOUBLE, G_MAXDOUBLE, 0,
                                                        GIMP_PARAM_READWRITE));
617
  gimp_pdb_register_procedure (pdb, procedure);
618
  g_object_unref (procedure);
619 620 621 622

  /*
   * gimp-unit-get-digits
   */
623
  procedure = gimp_procedure_new (unit_get_digits_invoker);
624 625
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
                               "gimp-unit-get-digits");
626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647
  gimp_procedure_set_static_strings (procedure,
                                     "gimp-unit-get-digits",
                                     "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.",
                                     "Michael Natterer <mitch@gimp.org>",
                                     "Michael Natterer",
                                     "1999",
                                     NULL);
  gimp_procedure_add_argument (procedure,
                               gimp_param_spec_unit ("unit-id",
                                                     "unit id",
                                                     "The unit's integer ID",
                                                     TRUE,
                                                     FALSE,
                                                     GIMP_UNIT_PIXEL,
                                                     GIMP_PARAM_READWRITE));
  gimp_procedure_add_return_value (procedure,
                                   gimp_param_spec_int32 ("digits",
                                                          "digits",
                                                          "The unit's number of digits",
                                                          G_MININT32, G_MAXINT32, 0,
                                                          GIMP_PARAM_READWRITE));
648
  gimp_pdb_register_procedure (pdb, procedure);
649
  g_object_unref (procedure);
650 651 652 653

  /*
   * gimp-unit-get-symbol
   */
654
  procedure = gimp_procedure_new (unit_get_symbol_invoker);
655 656
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
                               "gimp-unit-get-symbol");
657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676
  gimp_procedure_set_static_strings (procedure,
                                     "gimp-unit-get-symbol",
                                     "Returns the symbol of the unit.",
                                     "This procedure returns the symbol of the unit (\"''\" for inches).",
                                     "Michael Natterer <mitch@gimp.org>",
                                     "Michael Natterer",
                                     "1999",
                                     NULL);
  gimp_procedure_add_argument (procedure,
                               gimp_param_spec_unit ("unit-id",
                                                     "unit id",
                                                     "The unit's integer ID",
                                                     TRUE,
                                                     FALSE,
                                                     GIMP_UNIT_PIXEL,
                                                     GIMP_PARAM_READWRITE));
  gimp_procedure_add_return_value (procedure,
                                   gimp_param_spec_string ("symbol",
                                                           "symbol",
                                                           "The unit's symbol",
677
                                                           FALSE, FALSE, FALSE,
678 679
                                                           NULL,
                                                           GIMP_PARAM_READWRITE));
680
  gimp_pdb_register_procedure (pdb, procedure);
681
  g_object_unref (procedure);
682 683 684 685

  /*
   * gimp-unit-get-abbreviation
   */
686
  procedure = gimp_procedure_new (unit_get_abbreviation_invoker);
687 688
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
                               "gimp-unit-get-abbreviation");
689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708
  gimp_procedure_set_static_strings (procedure,
                                     "gimp-unit-get-abbreviation",
                                     "Returns the abbreviation of the unit.",
                                     "This procedure returns the abbreviation of the unit (\"in\" for inches).",
                                     "Michael Natterer <mitch@gimp.org>",
                                     "Michael Natterer",
                                     "1999",
                                     NULL);
  gimp_procedure_add_argument (procedure,
                               gimp_param_spec_unit ("unit-id",
                                                     "unit id",
                                                     "The unit's integer ID",
                                                     TRUE,
                                                     FALSE,
                                                     GIMP_UNIT_PIXEL,
                                                     GIMP_PARAM_READWRITE));
  gimp_procedure_add_return_value (procedure,
                                   gimp_param_spec_string ("abbreviation",
                                                           "abbreviation",
                                                           "The unit's abbreviation",
709
                                                           FALSE, FALSE, FALSE,
710 711
                                                           NULL,
                                                           GIMP_PARAM_READWRITE));
712
  gimp_pdb_register_procedure (pdb, procedure);
713
  g_object_unref (procedure);
714 715 716 717

  /*
   * gimp-unit-get-singular
   */
718
  procedure = gimp_procedure_new (unit_get_singular_invoker);
719 720
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
                               "gimp-unit-get-singular");
721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740
  gimp_procedure_set_static_strings (procedure,
                                     "gimp-unit-get-singular",
                                     "Returns the singular form of the unit.",
                                     "This procedure returns the singular form of the unit.",
                                     "Michael Natterer <mitch@gimp.org>",
                                     "Michael Natterer",
                                     "1999",
                                     NULL);
  gimp_procedure_add_argument (procedure,
                               gimp_param_spec_unit ("unit-id",
                                                     "unit id",
                                                     "The unit's integer ID",
                                                     TRUE,
                                                     FALSE,
                                                     GIMP_UNIT_PIXEL,
                                                     GIMP_PARAM_READWRITE));
  gimp_procedure_add_return_value (procedure,
                                   gimp_param_spec_string ("singular",
                                                           "singular",
                                                           "The unit's singular form",
741
                                                           FALSE, FALSE, FALSE,
742 743
                                                           NULL,
                                                           GIMP_PARAM_READWRITE));
744
  gimp_pdb_register_procedure (pdb, procedure);
745
  g_object_unref (procedure);
746 747 748 749

  /*
   * gimp-unit-get-plural
   */
750
  procedure = gimp_procedure_new (unit_get_plural_invoker);
751 752
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
                               "gimp-unit-get-plural");
753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772
  gimp_procedure_set_static_strings (procedure,
                                     "gimp-unit-get-plural",
                                     "Returns the plural form of the unit.",
                                     "This procedure returns the plural form of the unit.",
                                     "Michael Natterer <mitch@gimp.org>",
                                     "Michael Natterer",
                                     "1999",
                                     NULL);
  gimp_procedure_add_argument (procedure,
                               gimp_param_spec_unit ("unit-id",
                                                     "unit id",
                                                     "The unit's integer ID",
                                                     TRUE,
                                                     FALSE,
                                                     GIMP_UNIT_PIXEL,
                                                     GIMP_PARAM_READWRITE));
  gimp_procedure_add_return_value (procedure,
                                   gimp_param_spec_string ("plural",
                                                           "plural",
                                                           "The unit's plural form",
773
                                                           FALSE, FALSE, FALSE,
774 775
                                                           NULL,
                                                           GIMP_PARAM_READWRITE));
776
  gimp_pdb_register_procedure (pdb, procedure);
777
  g_object_unref (procedure);
778
}