~ubuntu-branches/ubuntu/maverick/gimp/maverick-updates

« back to all changes in this revision

Viewing changes to app/pdb/context_cmds.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2005-12-09 19:44:52 UTC
  • Revision ID: james.westby@ubuntu.com-20051209194452-yggpemjlofpjqyf4
Tags: upstream-2.2.9
ImportĀ upstreamĀ versionĀ 2.2.9

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* The GIMP -- an 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 2 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, write to the Free Software
 
16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
17
 */
 
18
 
 
19
/* NOTE: This file is autogenerated by pdbgen.pl. */
 
20
 
 
21
#include "config.h"
 
22
 
 
23
 
 
24
#include <glib-object.h>
 
25
 
 
26
#include "libgimpcolor/gimpcolor.h"
 
27
 
 
28
#include "pdb-types.h"
 
29
#include "procedural_db.h"
 
30
 
 
31
#include "core/gimp.h"
 
32
#include "core/gimpcontainer.h"
 
33
#include "core/gimpcontext.h"
 
34
#include "core/gimpdatafactory.h"
 
35
#include "plug-in/plug-in-context.h"
 
36
#include "plug-in/plug-in.h"
 
37
 
 
38
static ProcRecord context_push_proc;
 
39
static ProcRecord context_pop_proc;
 
40
static ProcRecord context_get_foreground_proc;
 
41
static ProcRecord context_set_foreground_proc;
 
42
static ProcRecord context_get_background_proc;
 
43
static ProcRecord context_set_background_proc;
 
44
static ProcRecord context_set_default_colors_proc;
 
45
static ProcRecord context_swap_colors_proc;
 
46
static ProcRecord context_get_opacity_proc;
 
47
static ProcRecord context_set_opacity_proc;
 
48
static ProcRecord context_get_paint_mode_proc;
 
49
static ProcRecord context_set_paint_mode_proc;
 
50
static ProcRecord context_get_brush_proc;
 
51
static ProcRecord context_set_brush_proc;
 
52
static ProcRecord context_get_pattern_proc;
 
53
static ProcRecord context_set_pattern_proc;
 
54
static ProcRecord context_get_gradient_proc;
 
55
static ProcRecord context_set_gradient_proc;
 
56
static ProcRecord context_get_palette_proc;
 
57
static ProcRecord context_set_palette_proc;
 
58
static ProcRecord context_get_font_proc;
 
59
static ProcRecord context_set_font_proc;
 
60
 
 
61
void
 
62
register_context_procs (Gimp *gimp)
 
63
{
 
64
  procedural_db_register (gimp, &context_push_proc);
 
65
  procedural_db_register (gimp, &context_pop_proc);
 
66
  procedural_db_register (gimp, &context_get_foreground_proc);
 
67
  procedural_db_register (gimp, &context_set_foreground_proc);
 
68
  procedural_db_register (gimp, &context_get_background_proc);
 
69
  procedural_db_register (gimp, &context_set_background_proc);
 
70
  procedural_db_register (gimp, &context_set_default_colors_proc);
 
71
  procedural_db_register (gimp, &context_swap_colors_proc);
 
72
  procedural_db_register (gimp, &context_get_opacity_proc);
 
73
  procedural_db_register (gimp, &context_set_opacity_proc);
 
74
  procedural_db_register (gimp, &context_get_paint_mode_proc);
 
75
  procedural_db_register (gimp, &context_set_paint_mode_proc);
 
76
  procedural_db_register (gimp, &context_get_brush_proc);
 
77
  procedural_db_register (gimp, &context_set_brush_proc);
 
78
  procedural_db_register (gimp, &context_get_pattern_proc);
 
79
  procedural_db_register (gimp, &context_set_pattern_proc);
 
80
  procedural_db_register (gimp, &context_get_gradient_proc);
 
81
  procedural_db_register (gimp, &context_set_gradient_proc);
 
82
  procedural_db_register (gimp, &context_get_palette_proc);
 
83
  procedural_db_register (gimp, &context_set_palette_proc);
 
84
  procedural_db_register (gimp, &context_get_font_proc);
 
85
  procedural_db_register (gimp, &context_set_font_proc);
 
86
}
 
87
 
 
88
static Argument *
 
89
context_push_invoker (Gimp         *gimp,
 
90
                      GimpContext  *context,
 
91
                      GimpProgress *progress,
 
92
                      Argument     *args)
 
93
{
 
94
  gboolean success = TRUE;
 
95
  if (gimp->current_plug_in && gimp->current_plug_in->open)
 
96
    {
 
97
      success = plug_in_context_push (gimp->current_plug_in);
 
98
    }
 
99
  else
 
100
    {
 
101
      success = FALSE;
 
102
    }
 
103
  return procedural_db_return_args (&context_push_proc, success);
 
104
}
 
105
 
 
106
static ProcRecord context_push_proc =
 
107
{
 
108
  "gimp_context_push",
 
109
  "Pushes a context to the top of the plug-in's context stack.",
 
110
  "This procedure creates a new context by copying the current context. This copy becomes the new current context for the calling plug-in until it is popped again.",
 
111
  "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
 
112
  "Michael Natterer & Sven Neumann",
 
113
  "2004",
 
114
  NULL,
 
115
  GIMP_INTERNAL,
 
116
  0,
 
117
  NULL,
 
118
  0,
 
119
  NULL,
 
120
  { { context_push_invoker } }
 
121
};
 
122
 
 
123
static Argument *
 
124
context_pop_invoker (Gimp         *gimp,
 
125
                     GimpContext  *context,
 
126
                     GimpProgress *progress,
 
127
                     Argument     *args)
 
128
{
 
129
  gboolean success = TRUE;
 
130
  if (gimp->current_plug_in && gimp->current_plug_in->open)
 
131
    {
 
132
      success = plug_in_context_pop (gimp->current_plug_in);
 
133
    }
 
134
  else
 
135
    {
 
136
      success = FALSE;
 
137
    }
 
138
  return procedural_db_return_args (&context_pop_proc, success);
 
139
}
 
140
 
 
141
static ProcRecord context_pop_proc =
 
142
{
 
143
  "gimp_context_pop",
 
144
  "Pops the topmost context from the plug-in's context stack.",
 
145
  "This procedure creates a new context and makes it the current context for the calling plug-in.",
 
146
  "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
 
147
  "Michael Natterer & Sven Neumann",
 
148
  "2004",
 
149
  NULL,
 
150
  GIMP_INTERNAL,
 
151
  0,
 
152
  NULL,
 
153
  0,
 
154
  NULL,
 
155
  { { context_pop_invoker } }
 
156
};
 
157
 
 
158
static Argument *
 
159
context_get_foreground_invoker (Gimp         *gimp,
 
160
                                GimpContext  *context,
 
161
                                GimpProgress *progress,
 
162
                                Argument     *args)
 
163
{
 
164
  Argument *return_args;
 
165
  GimpRGB color;
 
166
 
 
167
  gimp_context_get_foreground (context, &color);
 
168
 
 
169
  return_args = procedural_db_return_args (&context_get_foreground_proc, TRUE);
 
170
  return_args[1].value.pdb_color = color;
 
171
 
 
172
  return return_args;
 
173
}
 
174
 
 
175
static ProcArg context_get_foreground_outargs[] =
 
176
{
 
177
  {
 
178
    GIMP_PDB_COLOR,
 
179
    "foreground",
 
180
    "The foreground color"
 
181
  }
 
182
};
 
183
 
 
184
static ProcRecord context_get_foreground_proc =
 
185
{
 
186
  "gimp_context_get_foreground",
 
187
  "Get the current GIMP foreground color.",
 
188
  "This procedure returns the current GIMP foreground color. The foreground color is used in a variety of tools such as paint tools, blending, and bucket fill.",
 
189
  "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
 
190
  "Michael Natterer & Sven Neumann",
 
191
  "2004",
 
192
  NULL,
 
193
  GIMP_INTERNAL,
 
194
  0,
 
195
  NULL,
 
196
  1,
 
197
  context_get_foreground_outargs,
 
198
  { { context_get_foreground_invoker } }
 
199
};
 
200
 
 
201
static Argument *
 
202
context_set_foreground_invoker (Gimp         *gimp,
 
203
                                GimpContext  *context,
 
204
                                GimpProgress *progress,
 
205
                                Argument     *args)
 
206
{
 
207
  GimpRGB color;
 
208
 
 
209
  color = args[0].value.pdb_color;
 
210
 
 
211
  gimp_rgb_set_alpha (&color, 1.0);
 
212
  gimp_context_set_foreground (context, &color);
 
213
 
 
214
  return procedural_db_return_args (&context_set_foreground_proc, TRUE);
 
215
}
 
216
 
 
217
static ProcArg context_set_foreground_inargs[] =
 
218
{
 
219
  {
 
220
    GIMP_PDB_COLOR,
 
221
    "foreground",
 
222
    "The foreground color"
 
223
  }
 
224
};
 
225
 
 
226
static ProcRecord context_set_foreground_proc =
 
227
{
 
228
  "gimp_context_set_foreground",
 
229
  "Set the current GIMP foreground color.",
 
230
  "This procedure sets the current GIMP foreground color. After this is set, operations which use foreground such as paint tools, blending, and bucket fill will use the new value.",
 
231
  "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
 
232
  "Michael Natterer & Sven Neumann",
 
233
  "2004",
 
234
  NULL,
 
235
  GIMP_INTERNAL,
 
236
  1,
 
237
  context_set_foreground_inargs,
 
238
  0,
 
239
  NULL,
 
240
  { { context_set_foreground_invoker } }
 
241
};
 
242
 
 
243
static Argument *
 
244
context_get_background_invoker (Gimp         *gimp,
 
245
                                GimpContext  *context,
 
246
                                GimpProgress *progress,
 
247
                                Argument     *args)
 
248
{
 
249
  Argument *return_args;
 
250
  GimpRGB color;
 
251
 
 
252
  gimp_context_get_background (context, &color);
 
253
 
 
254
  return_args = procedural_db_return_args (&context_get_background_proc, TRUE);
 
255
  return_args[1].value.pdb_color = color;
 
256
 
 
257
  return return_args;
 
258
}
 
259
 
 
260
static ProcArg context_get_background_outargs[] =
 
261
{
 
262
  {
 
263
    GIMP_PDB_COLOR,
 
264
    "background",
 
265
    "The background color"
 
266
  }
 
267
};
 
268
 
 
269
static ProcRecord context_get_background_proc =
 
270
{
 
271
  "gimp_context_get_background",
 
272
  "Get the current GIMP background color.",
 
273
  "This procedure returns the current GIMP background color. The background color is used in a variety of tools such as blending, erasing (with non-alpha images), and image filling.",
 
274
  "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
 
275
  "Michael Natterer & Sven Neumann",
 
276
  "2004",
 
277
  NULL,
 
278
  GIMP_INTERNAL,
 
279
  0,
 
280
  NULL,
 
281
  1,
 
282
  context_get_background_outargs,
 
283
  { { context_get_background_invoker } }
 
284
};
 
285
 
 
286
static Argument *
 
287
context_set_background_invoker (Gimp         *gimp,
 
288
                                GimpContext  *context,
 
289
                                GimpProgress *progress,
 
290
                                Argument     *args)
 
291
{
 
292
  GimpRGB color;
 
293
 
 
294
  color = args[0].value.pdb_color;
 
295
 
 
296
  gimp_rgb_set_alpha (&color, 1.0);
 
297
  gimp_context_set_background (context, &color);
 
298
 
 
299
  return procedural_db_return_args (&context_set_background_proc, TRUE);
 
300
}
 
301
 
 
302
static ProcArg context_set_background_inargs[] =
 
303
{
 
304
  {
 
305
    GIMP_PDB_COLOR,
 
306
    "background",
 
307
    "The background color"
 
308
  }
 
309
};
 
310
 
 
311
static ProcRecord context_set_background_proc =
 
312
{
 
313
  "gimp_context_set_background",
 
314
  "Set the current GIMP background color.",
 
315
  "This procedure sets the current GIMP background color. After this is set, operations which use background such as blending, filling images, clearing, and erasing (in non-alpha images) will use the new value.",
 
316
  "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
 
317
  "Michael Natterer & Sven Neumann",
 
318
  "2004",
 
319
  NULL,
 
320
  GIMP_INTERNAL,
 
321
  1,
 
322
  context_set_background_inargs,
 
323
  0,
 
324
  NULL,
 
325
  { { context_set_background_invoker } }
 
326
};
 
327
 
 
328
static Argument *
 
329
context_set_default_colors_invoker (Gimp         *gimp,
 
330
                                    GimpContext  *context,
 
331
                                    GimpProgress *progress,
 
332
                                    Argument     *args)
 
333
{
 
334
  gimp_context_set_default_colors (context);
 
335
  return procedural_db_return_args (&context_set_default_colors_proc, TRUE);
 
336
}
 
337
 
 
338
static ProcRecord context_set_default_colors_proc =
 
339
{
 
340
  "gimp_context_set_default_colors",
 
341
  "Set the current GIMP foreground and background colors to black and white.",
 
342
  "This procedure sets the current GIMP foreground and background colors to their initial default values, black and white.",
 
343
  "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
 
344
  "Michael Natterer & Sven Neumann",
 
345
  "2004",
 
346
  NULL,
 
347
  GIMP_INTERNAL,
 
348
  0,
 
349
  NULL,
 
350
  0,
 
351
  NULL,
 
352
  { { context_set_default_colors_invoker } }
 
353
};
 
354
 
 
355
static Argument *
 
356
context_swap_colors_invoker (Gimp         *gimp,
 
357
                             GimpContext  *context,
 
358
                             GimpProgress *progress,
 
359
                             Argument     *args)
 
360
{
 
361
  gimp_context_swap_colors (context);
 
362
  return procedural_db_return_args (&context_swap_colors_proc, TRUE);
 
363
}
 
364
 
 
365
static ProcRecord context_swap_colors_proc =
 
366
{
 
367
  "gimp_context_swap_colors",
 
368
  "Swap the current GIMP foreground and background colors.",
 
369
  "This procedure swaps the current GIMP foreground and background colors, so that the new foreground color becomes the old background color and vice versa.",
 
370
  "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
 
371
  "Michael Natterer & Sven Neumann",
 
372
  "2004",
 
373
  NULL,
 
374
  GIMP_INTERNAL,
 
375
  0,
 
376
  NULL,
 
377
  0,
 
378
  NULL,
 
379
  { { context_swap_colors_invoker } }
 
380
};
 
381
 
 
382
static Argument *
 
383
context_get_opacity_invoker (Gimp         *gimp,
 
384
                             GimpContext  *context,
 
385
                             GimpProgress *progress,
 
386
                             Argument     *args)
 
387
{
 
388
  Argument *return_args;
 
389
 
 
390
  return_args = procedural_db_return_args (&context_get_opacity_proc, TRUE);
 
391
  return_args[1].value.pdb_float = gimp_context_get_opacity (context) * 100.0;
 
392
 
 
393
  return return_args;
 
394
}
 
395
 
 
396
static ProcArg context_get_opacity_outargs[] =
 
397
{
 
398
  {
 
399
    GIMP_PDB_FLOAT,
 
400
    "opacity",
 
401
    "The opacity: 0 <= opacity <= 100"
 
402
  }
 
403
};
 
404
 
 
405
static ProcRecord context_get_opacity_proc =
 
406
{
 
407
  "gimp_context_get_opacity",
 
408
  "Get the opacity.",
 
409
  "This procedure returns the opacity setting. The return value is a floating point number between 0 and 100.",
 
410
  "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
 
411
  "Michael Natterer & Sven Neumann",
 
412
  "2004",
 
413
  NULL,
 
414
  GIMP_INTERNAL,
 
415
  0,
 
416
  NULL,
 
417
  1,
 
418
  context_get_opacity_outargs,
 
419
  { { context_get_opacity_invoker } }
 
420
};
 
421
 
 
422
static Argument *
 
423
context_set_opacity_invoker (Gimp         *gimp,
 
424
                             GimpContext  *context,
 
425
                             GimpProgress *progress,
 
426
                             Argument     *args)
 
427
{
 
428
  gboolean success = TRUE;
 
429
  gdouble opacity;
 
430
 
 
431
  opacity = args[0].value.pdb_float;
 
432
  if (opacity < 0.0 || opacity > 100.0)
 
433
    success = FALSE;
 
434
 
 
435
  if (success)
 
436
    gimp_context_set_opacity (context, opacity / 100.0);
 
437
 
 
438
  return procedural_db_return_args (&context_set_opacity_proc, success);
 
439
}
 
440
 
 
441
static ProcArg context_set_opacity_inargs[] =
 
442
{
 
443
  {
 
444
    GIMP_PDB_FLOAT,
 
445
    "opacity",
 
446
    "The opacity: 0 <= opacity <= 100"
 
447
  }
 
448
};
 
449
 
 
450
static ProcRecord context_set_opacity_proc =
 
451
{
 
452
  "gimp_context_set_opacity",
 
453
  "Set the opacity.",
 
454
  "This procedure modifies the opacity setting. The value should be a floating point number between 0 and 100.",
 
455
  "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
 
456
  "Michael Natterer & Sven Neumann",
 
457
  "2004",
 
458
  NULL,
 
459
  GIMP_INTERNAL,
 
460
  1,
 
461
  context_set_opacity_inargs,
 
462
  0,
 
463
  NULL,
 
464
  { { context_set_opacity_invoker } }
 
465
};
 
466
 
 
467
static Argument *
 
468
context_get_paint_mode_invoker (Gimp         *gimp,
 
469
                                GimpContext  *context,
 
470
                                GimpProgress *progress,
 
471
                                Argument     *args)
 
472
{
 
473
  Argument *return_args;
 
474
 
 
475
  return_args = procedural_db_return_args (&context_get_paint_mode_proc, TRUE);
 
476
  return_args[1].value.pdb_int = gimp_context_get_paint_mode (context);
 
477
 
 
478
  return return_args;
 
479
}
 
480
 
 
481
static ProcArg context_get_paint_mode_outargs[] =
 
482
{
 
483
  {
 
484
    GIMP_PDB_INT32,
 
485
    "paint_mode",
 
486
    "The paint mode: { GIMP_NORMAL_MODE (0), GIMP_DISSOLVE_MODE (1), GIMP_BEHIND_MODE (2), GIMP_MULTIPLY_MODE (3), GIMP_SCREEN_MODE (4), GIMP_OVERLAY_MODE (5), GIMP_DIFFERENCE_MODE (6), GIMP_ADDITION_MODE (7), GIMP_SUBTRACT_MODE (8), GIMP_DARKEN_ONLY_MODE (9), GIMP_LIGHTEN_ONLY_MODE (10), GIMP_HUE_MODE (11), GIMP_SATURATION_MODE (12), GIMP_COLOR_MODE (13), GIMP_VALUE_MODE (14), GIMP_DIVIDE_MODE (15), GIMP_DODGE_MODE (16), GIMP_BURN_MODE (17), GIMP_HARDLIGHT_MODE (18), GIMP_SOFTLIGHT_MODE (19), GIMP_GRAIN_EXTRACT_MODE (20), GIMP_GRAIN_MERGE_MODE (21), GIMP_COLOR_ERASE_MODE (22) }"
 
487
  }
 
488
};
 
489
 
 
490
static ProcRecord context_get_paint_mode_proc =
 
491
{
 
492
  "gimp_context_get_paint_mode",
 
493
  "Get the paint mode.",
 
494
  "This procedure returns the paint-mode setting. The return value is an integer which corresponds to the values listed in the argument description.",
 
495
  "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
 
496
  "Michael Natterer & Sven Neumann",
 
497
  "2004",
 
498
  NULL,
 
499
  GIMP_INTERNAL,
 
500
  0,
 
501
  NULL,
 
502
  1,
 
503
  context_get_paint_mode_outargs,
 
504
  { { context_get_paint_mode_invoker } }
 
505
};
 
506
 
 
507
static Argument *
 
508
context_set_paint_mode_invoker (Gimp         *gimp,
 
509
                                GimpContext  *context,
 
510
                                GimpProgress *progress,
 
511
                                Argument     *args)
 
512
{
 
513
  gboolean success = TRUE;
 
514
  gint32 paint_mode;
 
515
 
 
516
  paint_mode = args[0].value.pdb_int;
 
517
  if (paint_mode < GIMP_NORMAL_MODE || paint_mode > GIMP_COLOR_ERASE_MODE)
 
518
    success = FALSE;
 
519
 
 
520
  if (success)
 
521
    gimp_context_set_paint_mode (context, paint_mode);
 
522
 
 
523
  return procedural_db_return_args (&context_set_paint_mode_proc, success);
 
524
}
 
525
 
 
526
static ProcArg context_set_paint_mode_inargs[] =
 
527
{
 
528
  {
 
529
    GIMP_PDB_INT32,
 
530
    "paint_mode",
 
531
    "The paint mode: { GIMP_NORMAL_MODE (0), GIMP_DISSOLVE_MODE (1), GIMP_BEHIND_MODE (2), GIMP_MULTIPLY_MODE (3), GIMP_SCREEN_MODE (4), GIMP_OVERLAY_MODE (5), GIMP_DIFFERENCE_MODE (6), GIMP_ADDITION_MODE (7), GIMP_SUBTRACT_MODE (8), GIMP_DARKEN_ONLY_MODE (9), GIMP_LIGHTEN_ONLY_MODE (10), GIMP_HUE_MODE (11), GIMP_SATURATION_MODE (12), GIMP_COLOR_MODE (13), GIMP_VALUE_MODE (14), GIMP_DIVIDE_MODE (15), GIMP_DODGE_MODE (16), GIMP_BURN_MODE (17), GIMP_HARDLIGHT_MODE (18), GIMP_SOFTLIGHT_MODE (19), GIMP_GRAIN_EXTRACT_MODE (20), GIMP_GRAIN_MERGE_MODE (21), GIMP_COLOR_ERASE_MODE (22) }"
 
532
  }
 
533
};
 
534
 
 
535
static ProcRecord context_set_paint_mode_proc =
 
536
{
 
537
  "gimp_context_set_paint_mode",
 
538
  "Set the paint mode.",
 
539
  "This procedure modifies the paint_mode setting.",
 
540
  "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
 
541
  "Michael Natterer & Sven Neumann",
 
542
  "2004",
 
543
  NULL,
 
544
  GIMP_INTERNAL,
 
545
  1,
 
546
  context_set_paint_mode_inargs,
 
547
  0,
 
548
  NULL,
 
549
  { { context_set_paint_mode_invoker } }
 
550
};
 
551
 
 
552
static Argument *
 
553
context_get_brush_invoker (Gimp         *gimp,
 
554
                           GimpContext  *context,
 
555
                           GimpProgress *progress,
 
556
                           Argument     *args)
 
557
{
 
558
  gboolean success = TRUE;
 
559
  Argument *return_args;
 
560
  GimpBrush *brush;
 
561
 
 
562
  success = (brush = gimp_context_get_brush (context)) != NULL;
 
563
 
 
564
  return_args = procedural_db_return_args (&context_get_brush_proc, success);
 
565
 
 
566
  if (success)
 
567
    return_args[1].value.pdb_pointer = g_strdup (gimp_object_get_name (GIMP_OBJECT (brush)));
 
568
 
 
569
  return return_args;
 
570
}
 
571
 
 
572
static ProcArg context_get_brush_outargs[] =
 
573
{
 
574
  {
 
575
    GIMP_PDB_STRING,
 
576
    "name",
 
577
    "The name of the active brush"
 
578
  }
 
579
};
 
580
 
 
581
static ProcRecord context_get_brush_proc =
 
582
{
 
583
  "gimp_context_get_brush",
 
584
  "Retrieve the currently active brush.",
 
585
  "This procedure returns the nme of the currently active brush. All paint operations and stroke operations use this brush to control the application of paint to the image.",
 
586
  "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
 
587
  "Michael Natterer & Sven Neumann",
 
588
  "2004",
 
589
  NULL,
 
590
  GIMP_INTERNAL,
 
591
  0,
 
592
  NULL,
 
593
  1,
 
594
  context_get_brush_outargs,
 
595
  { { context_get_brush_invoker } }
 
596
};
 
597
 
 
598
static Argument *
 
599
context_set_brush_invoker (Gimp         *gimp,
 
600
                           GimpContext  *context,
 
601
                           GimpProgress *progress,
 
602
                           Argument     *args)
 
603
{
 
604
  gboolean success = TRUE;
 
605
  gchar *name;
 
606
  GimpBrush *brush;
 
607
 
 
608
  name = (gchar *) args[0].value.pdb_pointer;
 
609
  if (name == NULL || !g_utf8_validate (name, -1, NULL))
 
610
    success = FALSE;
 
611
 
 
612
  if (success)
 
613
    {
 
614
      brush = (GimpBrush *)
 
615
        gimp_container_get_child_by_name (gimp->brush_factory->container, name);
 
616
 
 
617
      if (brush)
 
618
        gimp_context_set_brush (context, brush);
 
619
      else
 
620
        success = FALSE;
 
621
    }
 
622
 
 
623
  return procedural_db_return_args (&context_set_brush_proc, success);
 
624
}
 
625
 
 
626
static ProcArg context_set_brush_inargs[] =
 
627
{
 
628
  {
 
629
    GIMP_PDB_STRING,
 
630
    "name",
 
631
    "The name o the brush"
 
632
  }
 
633
};
 
634
 
 
635
static ProcRecord context_set_brush_proc =
 
636
{
 
637
  "gimp_context_set_brush",
 
638
  "Set the specified brush as the active brush.",
 
639
  "This procedure allows the active brush to be set by specifying its name. The name is simply a string which corresponds to one of the names of the installed brushes. If there is no matching brush found, this procedure will return an error. Otherwise, the specified brush becomes active and will be used in all subsequent paint operations.",
 
640
  "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
 
641
  "Michael Natterer & Sven Neumann",
 
642
  "2004",
 
643
  NULL,
 
644
  GIMP_INTERNAL,
 
645
  1,
 
646
  context_set_brush_inargs,
 
647
  0,
 
648
  NULL,
 
649
  { { context_set_brush_invoker } }
 
650
};
 
651
 
 
652
static Argument *
 
653
context_get_pattern_invoker (Gimp         *gimp,
 
654
                             GimpContext  *context,
 
655
                             GimpProgress *progress,
 
656
                             Argument     *args)
 
657
{
 
658
  gboolean success = TRUE;
 
659
  Argument *return_args;
 
660
  GimpPattern *pattern;
 
661
 
 
662
  success = (pattern = gimp_context_get_pattern (context)) != NULL;
 
663
 
 
664
  return_args = procedural_db_return_args (&context_get_pattern_proc, success);
 
665
 
 
666
  if (success)
 
667
    return_args[1].value.pdb_pointer = g_strdup (gimp_object_get_name (GIMP_OBJECT (pattern)));
 
668
 
 
669
  return return_args;
 
670
}
 
671
 
 
672
static ProcArg context_get_pattern_outargs[] =
 
673
{
 
674
  {
 
675
    GIMP_PDB_STRING,
 
676
    "name",
 
677
    "The name of the active pattern"
 
678
  }
 
679
};
 
680
 
 
681
static ProcRecord context_get_pattern_proc =
 
682
{
 
683
  "gimp_context_get_pattern",
 
684
  "Retrieve the currently active pattern.",
 
685
  "This procedure returns name of the the currently active pattern. All clone and bucket-fill operations with patterns will use this pattern to control the application of paint to the image.",
 
686
  "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
 
687
  "Michael Natterer & Sven Neumann",
 
688
  "2004",
 
689
  NULL,
 
690
  GIMP_INTERNAL,
 
691
  0,
 
692
  NULL,
 
693
  1,
 
694
  context_get_pattern_outargs,
 
695
  { { context_get_pattern_invoker } }
 
696
};
 
697
 
 
698
static Argument *
 
699
context_set_pattern_invoker (Gimp         *gimp,
 
700
                             GimpContext  *context,
 
701
                             GimpProgress *progress,
 
702
                             Argument     *args)
 
703
{
 
704
  gboolean success = TRUE;
 
705
  gchar *name;
 
706
  GimpPattern *pattern;
 
707
 
 
708
  name = (gchar *) args[0].value.pdb_pointer;
 
709
  if (name == NULL || !g_utf8_validate (name, -1, NULL))
 
710
    success = FALSE;
 
711
 
 
712
  if (success)
 
713
    {
 
714
      pattern = (GimpPattern *)
 
715
        gimp_container_get_child_by_name (gimp->pattern_factory->container, name);
 
716
 
 
717
      if (pattern)
 
718
        gimp_context_set_pattern (context, pattern);
 
719
      else
 
720
        success = FALSE;
 
721
    }
 
722
 
 
723
  return procedural_db_return_args (&context_set_pattern_proc, success);
 
724
}
 
725
 
 
726
static ProcArg context_set_pattern_inargs[] =
 
727
{
 
728
  {
 
729
    GIMP_PDB_STRING,
 
730
    "name",
 
731
    "The name of the pattern"
 
732
  }
 
733
};
 
734
 
 
735
static ProcRecord context_set_pattern_proc =
 
736
{
 
737
  "gimp_context_set_pattern",
 
738
  "Set the specified pattern as the active pattern.",
 
739
  "This procedure allows the active pattern to be set by specifying its name. The name is simply a string which corresponds to one of the names of the installed patterns. If there is no matching pattern found, this procedure will return an error. Otherwise, the specified pattern becomes active and will be used in all subsequent paint operations.",
 
740
  "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
 
741
  "Michael Natterer & Sven Neumann",
 
742
  "2004",
 
743
  NULL,
 
744
  GIMP_INTERNAL,
 
745
  1,
 
746
  context_set_pattern_inargs,
 
747
  0,
 
748
  NULL,
 
749
  { { context_set_pattern_invoker } }
 
750
};
 
751
 
 
752
static Argument *
 
753
context_get_gradient_invoker (Gimp         *gimp,
 
754
                              GimpContext  *context,
 
755
                              GimpProgress *progress,
 
756
                              Argument     *args)
 
757
{
 
758
  gboolean success = TRUE;
 
759
  Argument *return_args;
 
760
  GimpGradient *gradient;
 
761
 
 
762
  success = (gradient = gimp_context_get_gradient (context)) != NULL;
 
763
 
 
764
  return_args = procedural_db_return_args (&context_get_gradient_proc, success);
 
765
 
 
766
  if (success)
 
767
    return_args[1].value.pdb_pointer = g_strdup (gimp_object_get_name (GIMP_OBJECT (gradient)));
 
768
 
 
769
  return return_args;
 
770
}
 
771
 
 
772
static ProcArg context_get_gradient_outargs[] =
 
773
{
 
774
  {
 
775
    GIMP_PDB_STRING,
 
776
    "name",
 
777
    "The name of the active gradient"
 
778
  }
 
779
};
 
780
 
 
781
static ProcRecord context_get_gradient_proc =
 
782
{
 
783
  "gimp_context_get_gradient",
 
784
  "Retrieve the currently active gradient.",
 
785
  "This procedure returns the name of the currently active gradient.",
 
786
  "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
 
787
  "Michael Natterer & Sven Neumann",
 
788
  "2004",
 
789
  NULL,
 
790
  GIMP_INTERNAL,
 
791
  0,
 
792
  NULL,
 
793
  1,
 
794
  context_get_gradient_outargs,
 
795
  { { context_get_gradient_invoker } }
 
796
};
 
797
 
 
798
static Argument *
 
799
context_set_gradient_invoker (Gimp         *gimp,
 
800
                              GimpContext  *context,
 
801
                              GimpProgress *progress,
 
802
                              Argument     *args)
 
803
{
 
804
  gboolean success = TRUE;
 
805
  gchar *name;
 
806
  GimpGradient *gradient;
 
807
 
 
808
  name = (gchar *) args[0].value.pdb_pointer;
 
809
  if (name == NULL || !g_utf8_validate (name, -1, NULL))
 
810
    success = FALSE;
 
811
 
 
812
  if (success)
 
813
    {
 
814
      gradient = (GimpGradient *)
 
815
        gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
 
816
 
 
817
      if (gradient)
 
818
        gimp_context_set_gradient (context, gradient);
 
819
      else
 
820
        success = FALSE;
 
821
    }
 
822
 
 
823
  return procedural_db_return_args (&context_set_gradient_proc, success);
 
824
}
 
825
 
 
826
static ProcArg context_set_gradient_inargs[] =
 
827
{
 
828
  {
 
829
    GIMP_PDB_STRING,
 
830
    "name",
 
831
    "The name of the gradient"
 
832
  }
 
833
};
 
834
 
 
835
static ProcRecord context_set_gradient_proc =
 
836
{
 
837
  "gimp_context_set_gradient",
 
838
  "Sets the specified gradient as the active gradient.",
 
839
  "This procedure lets you set the specified gradient as the active or \"current\" one. The name is simply a string which corresponds to one of the loaded gradients. If no matching gradient is found, this procedure will return an error. Otherwise, the specified gradient will become active and will be used for subsequent custom gradient operations.",
 
840
  "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
 
841
  "Michael Natterer & Sven Neumann",
 
842
  "2004",
 
843
  NULL,
 
844
  GIMP_INTERNAL,
 
845
  1,
 
846
  context_set_gradient_inargs,
 
847
  0,
 
848
  NULL,
 
849
  { { context_set_gradient_invoker } }
 
850
};
 
851
 
 
852
static Argument *
 
853
context_get_palette_invoker (Gimp         *gimp,
 
854
                             GimpContext  *context,
 
855
                             GimpProgress *progress,
 
856
                             Argument     *args)
 
857
{
 
858
  gboolean success = TRUE;
 
859
  Argument *return_args;
 
860
  GimpPalette *palette;
 
861
 
 
862
  success = (palette = gimp_context_get_palette (context)) != NULL;
 
863
 
 
864
  return_args = procedural_db_return_args (&context_get_palette_proc, success);
 
865
 
 
866
  if (success)
 
867
    return_args[1].value.pdb_pointer = g_strdup (gimp_object_get_name (GIMP_OBJECT (palette)));
 
868
 
 
869
  return return_args;
 
870
}
 
871
 
 
872
static ProcArg context_get_palette_outargs[] =
 
873
{
 
874
  {
 
875
    GIMP_PDB_STRING,
 
876
    "name",
 
877
    "The name of the active palette"
 
878
  }
 
879
};
 
880
 
 
881
static ProcRecord context_get_palette_proc =
 
882
{
 
883
  "gimp_context_get_palette",
 
884
  "Retrieve the currently active palette.",
 
885
  "This procedure returns the name of the the currently active palette.",
 
886
  "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
 
887
  "Michael Natterer & Sven Neumann",
 
888
  "2004",
 
889
  NULL,
 
890
  GIMP_INTERNAL,
 
891
  0,
 
892
  NULL,
 
893
  1,
 
894
  context_get_palette_outargs,
 
895
  { { context_get_palette_invoker } }
 
896
};
 
897
 
 
898
static Argument *
 
899
context_set_palette_invoker (Gimp         *gimp,
 
900
                             GimpContext  *context,
 
901
                             GimpProgress *progress,
 
902
                             Argument     *args)
 
903
{
 
904
  gboolean success = TRUE;
 
905
  gchar *name;
 
906
  GimpPalette *palette;
 
907
 
 
908
  name = (gchar *) args[0].value.pdb_pointer;
 
909
  if (name == NULL || !g_utf8_validate (name, -1, NULL))
 
910
    success = FALSE;
 
911
 
 
912
  if (success)
 
913
    {
 
914
      palette = (GimpPalette *)
 
915
        gimp_container_get_child_by_name (gimp->palette_factory->container, name);
 
916
 
 
917
      if (palette)
 
918
        gimp_context_set_palette (context, palette);
 
919
      else
 
920
        success = FALSE;
 
921
    }
 
922
 
 
923
  return procedural_db_return_args (&context_set_palette_proc, success);
 
924
}
 
925
 
 
926
static ProcArg context_set_palette_inargs[] =
 
927
{
 
928
  {
 
929
    GIMP_PDB_STRING,
 
930
    "name",
 
931
    "The name of the palette"
 
932
  }
 
933
};
 
934
 
 
935
static ProcRecord context_set_palette_proc =
 
936
{
 
937
  "gimp_context_set_palette",
 
938
  "Set the specified palette as the active palette.",
 
939
  "This procedure allows the active palette to be set by specifying its name. The name is simply a string which corresponds to one of the names of the installed palettes. If no matching palette is found, this procedure will return an error. Otherwise, the specified palette becomes active and will be used in all subsequent palette operations.",
 
940
  "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
 
941
  "Michael Natterer & Sven Neumann",
 
942
  "2004",
 
943
  NULL,
 
944
  GIMP_INTERNAL,
 
945
  1,
 
946
  context_set_palette_inargs,
 
947
  0,
 
948
  NULL,
 
949
  { { context_set_palette_invoker } }
 
950
};
 
951
 
 
952
static Argument *
 
953
context_get_font_invoker (Gimp         *gimp,
 
954
                          GimpContext  *context,
 
955
                          GimpProgress *progress,
 
956
                          Argument     *args)
 
957
{
 
958
  gboolean success = TRUE;
 
959
  Argument *return_args;
 
960
  GimpFont *font;
 
961
 
 
962
  success = (font = gimp_context_get_font (context)) != NULL;
 
963
 
 
964
  return_args = procedural_db_return_args (&context_get_font_proc, success);
 
965
 
 
966
  if (success)
 
967
    return_args[1].value.pdb_pointer = g_strdup (gimp_object_get_name (GIMP_OBJECT (font)));
 
968
 
 
969
  return return_args;
 
970
}
 
971
 
 
972
static ProcArg context_get_font_outargs[] =
 
973
{
 
974
  {
 
975
    GIMP_PDB_STRING,
 
976
    "name",
 
977
    "The name of the active font"
 
978
  }
 
979
};
 
980
 
 
981
static ProcRecord context_get_font_proc =
 
982
{
 
983
  "gimp_context_get_font",
 
984
  "Retrieve the currently active font.",
 
985
  "This procedure returns the name of the currently active font.",
 
986
  "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
 
987
  "Michael Natterer & Sven Neumann",
 
988
  "2004",
 
989
  NULL,
 
990
  GIMP_INTERNAL,
 
991
  0,
 
992
  NULL,
 
993
  1,
 
994
  context_get_font_outargs,
 
995
  { { context_get_font_invoker } }
 
996
};
 
997
 
 
998
static Argument *
 
999
context_set_font_invoker (Gimp         *gimp,
 
1000
                          GimpContext  *context,
 
1001
                          GimpProgress *progress,
 
1002
                          Argument     *args)
 
1003
{
 
1004
  gboolean success = TRUE;
 
1005
  gchar *name;
 
1006
  GimpFont *font;
 
1007
 
 
1008
  name = (gchar *) args[0].value.pdb_pointer;
 
1009
  if (name == NULL || !g_utf8_validate (name, -1, NULL))
 
1010
    success = FALSE;
 
1011
 
 
1012
  if (success)
 
1013
    {
 
1014
      font = (GimpFont *)
 
1015
        gimp_container_get_child_by_name (gimp->fonts, name);
 
1016
 
 
1017
      if (font)
 
1018
        gimp_context_set_font (context, font);
 
1019
      else
 
1020
        success = FALSE;
 
1021
    }
 
1022
 
 
1023
  return procedural_db_return_args (&context_set_font_proc, success);
 
1024
}
 
1025
 
 
1026
static ProcArg context_set_font_inargs[] =
 
1027
{
 
1028
  {
 
1029
    GIMP_PDB_STRING,
 
1030
    "name",
 
1031
    "The name of the font"
 
1032
  }
 
1033
};
 
1034
 
 
1035
static ProcRecord context_set_font_proc =
 
1036
{
 
1037
  "gimp_context_set_font",
 
1038
  "Set the specified font as the active font.",
 
1039
  "This procedure allows the active font to be set by specifying its name. The name is simply a string which corresponds to one of the names of the installed fonts. If no matching font is found, this procedure will return an error. Otherwise, the specified font becomes active and will be used in all subsequent font operations.",
 
1040
  "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
 
1041
  "Michael Natterer & Sven Neumann",
 
1042
  "2004",
 
1043
  NULL,
 
1044
  GIMP_INTERNAL,
 
1045
  1,
 
1046
  context_set_font_inargs,
 
1047
  0,
 
1048
  NULL,
 
1049
  { { context_set_font_invoker } }
 
1050
};