~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to tools/pdbgen/pdb/context.pdb

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-05-02 16:33:03 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070502163303-bvzhjzbpw8qglc4y
Tags: 2.3.16-1ubuntu1
* Resynchronized with Debian, remaining Ubuntu changes:
  - debian/rules: i18n magic.
* debian/control.in:
  - Maintainer: Ubuntu Core Developers <ubuntu-devel@lists.ubuntu.com>
* debian/patches/02_help-message.patch,
  debian/patches/03_gimp.desktop.in.in.patch,
  debian/patches/10_dont_show_wizard.patch: updated.
* debian/patches/04_composite-signedness.patch,
  debian/patches/05_add-letter-spacing.patch: dropped, used upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# The GIMP -- an image manipulation program
 
1
# GIMP - The GNU Image Manipulation Program
2
2
# Copyright (C) 1995 Spencer Kimball and Peter Mattis
3
3
 
4
4
# This program is free software; you can redistribute it and/or modify
30
30
    $help = <<'HELP';
31
31
This procedure creates a new context by copying the current context. This
32
32
copy becomes the new current context for the calling plug-in until it is
33
 
popped again.
 
33
popped again using gimp_context_pop().
34
34
HELP
35
35
 
36
36
    &pdb_misc;
38
38
    %invoke = (
39
39
        code => <<'CODE'
40
40
{
41
 
  if (gimp->current_plug_in && gimp->current_plug_in->open)
42
 
    {
43
 
      success = plug_in_context_push (gimp->current_plug_in);
44
 
    }
 
41
  GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
 
42
 
 
43
  if (plug_in && plug_in->open)
 
44
    success = gimp_plug_in_context_push (plug_in);
45
45
  else
46
 
    {
47
 
      success = FALSE;
48
 
    }
 
46
    success = FALSE;
49
47
}
50
48
CODE
51
49
    );
55
53
    $blurb = 'Pops the topmost context from the plug-in\'s context stack.';
56
54
 
57
55
    $help = <<'HELP';
58
 
This procedure creates a new context and makes it the current context for the
59
 
calling plug-in.
 
56
This procedure removes the topmost context from the plug-in's context
 
57
stack.  The context that was active before the corresponding call to
 
58
gimp_context_push() becomes the new current context of the plug-in.
60
59
HELP
61
60
 
62
61
    &pdb_misc;
64
63
    %invoke = (
65
64
        code => <<'CODE'
66
65
{
67
 
  if (gimp->current_plug_in && gimp->current_plug_in->open)
68
 
    {
69
 
      success = plug_in_context_pop (gimp->current_plug_in);
70
 
    }
71
 
  else
72
 
    {
73
 
      success = FALSE;
74
 
    }
 
66
  GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
 
67
 
 
68
  if (plug_in && plug_in->open)
 
69
    success = gimp_plug_in_context_pop (plug_in);
 
70
  else
 
71
    success = FALSE;
 
72
}
 
73
CODE
 
74
    );
 
75
}
 
76
 
 
77
sub context_get_paint_method {
 
78
    $blurb = 'Retrieve the currently active paint method.';
 
79
 
 
80
    $help = <<'HELP';
 
81
This procedure returns the name of the currently active paint method.
 
82
HELP
 
83
 
 
84
    &mitch_pdb_misc('2005', '2.4');
 
85
 
 
86
    @outargs = (
 
87
        { name  => 'name', type  => 'string',
 
88
          desc  => 'The name of the active paint method' }
 
89
    );
 
90
 
 
91
    %invoke = (
 
92
        code => <<'CODE'
 
93
{
 
94
  GimpPaintInfo *paint_info = gimp_context_get_paint_info (context);
 
95
 
 
96
  if (paint_info)
 
97
    name = g_strdup (gimp_object_get_name (GIMP_OBJECT (paint_info)));
 
98
  else
 
99
    success = FALSE;
 
100
}
 
101
CODE
 
102
    );
 
103
}
 
104
 
 
105
sub context_set_paint_method {
 
106
    $blurb = 'Set the specified paint method as the active paint method.';
 
107
 
 
108
    $help = <<'HELP';
 
109
This procedure allows the active paint method to be set by specifying
 
110
its name.  The name is simply a string which corresponds to one of the
 
111
names of the available paint methods. If there is no matching method
 
112
found, this procedure will return an error.  Otherwise, the specified
 
113
method becomes active and will be used in all subsequent paint
 
114
operations.
 
115
HELP
 
116
 
 
117
    &mitch_pdb_misc('2005', '2.4');
 
118
 
 
119
    @inargs = (
 
120
        { name => 'name', type => 'string',
 
121
          desc => 'The name of the paint method' }
 
122
    );
 
123
 
 
124
    %invoke = (
 
125
        code => <<'CODE'
 
126
{
 
127
  GimpPaintInfo *paint_info = (GimpPaintInfo *)
 
128
    gimp_container_get_child_by_name (gimp->paint_info_list, name);
 
129
 
 
130
  if (paint_info)
 
131
    gimp_context_set_paint_info (context, paint_info);
 
132
  else
 
133
    success = FALSE;
75
134
}
76
135
CODE
77
136
    );
90
149
 
91
150
    @outargs = (
92
151
        { name => 'foreground', type => 'color',
93
 
          desc => "The foreground color", alias => 'color',
94
 
          void_ret => 1 }
 
152
          desc => 'The foreground color', void_ret => 1 }
95
153
    );
96
154
 
97
 
    %invoke = ( code => 'gimp_context_get_foreground (context, &color);' );
 
155
    %invoke = (
 
156
        code => <<'CODE'
 
157
{
 
158
  gimp_context_get_foreground (context, &foreground);
 
159
  gimp_rgb_set_alpha (&foreground, 1.0);
 
160
}
 
161
CODE
 
162
    );
98
163
}
99
164
 
100
165
sub context_set_foreground {
110
175
 
111
176
    @inargs = (
112
177
        { name => 'foreground', type => 'color',
113
 
          desc => "The foreground color", alias => 'color',
114
 
          void_ret => 1 }
 
178
          desc => 'The foreground color', void_ret => 1 }
115
179
    );
116
180
 
117
181
    %invoke = (
118
 
        code => <<CODE
 
182
        code => <<'CODE'
119
183
{
120
 
  gimp_rgb_set_alpha (&color, 1.0);
121
 
  gimp_context_set_foreground (context, &color);
 
184
  gimp_rgb_set_alpha (&foreground, 1.0);
 
185
  gimp_context_set_foreground (context, &foreground);
122
186
}
123
187
CODE
124
188
    );
137
201
 
138
202
    @outargs = (
139
203
        { name => 'background', type => 'color',
140
 
          desc => "The background color", alias => 'color',
141
 
          void_ret => 1 }
 
204
          desc => 'The background color', void_ret => 1 }
142
205
    );
143
206
 
144
 
    %invoke = ( code => 'gimp_context_get_background (context, &color);' );
 
207
    %invoke = (
 
208
        code => <<'CODE'
 
209
{
 
210
  gimp_context_get_background (context, &background);
 
211
  gimp_rgb_set_alpha (&background, 1.0);
 
212
}
 
213
CODE
 
214
    );
145
215
}
146
216
 
147
217
sub context_set_background {
157
227
 
158
228
    @inargs = (
159
229
        { name => 'background', type => 'color',
160
 
          desc => "The background color", alias => 'color',
161
 
          void_ret => 1 }
 
230
          desc => 'The background color', void_ret => 1 }
162
231
    );
163
232
 
164
233
    %invoke = (
165
 
        code => <<CODE
 
234
        code => <<'CODE'
166
235
{
167
 
  gimp_rgb_set_alpha (&color, 1.0);
168
 
  gimp_context_set_background (context, &color);
 
236
  gimp_rgb_set_alpha (&background, 1.0);
 
237
  gimp_context_set_background (context, &background);
169
238
}
170
239
CODE
171
240
    );
183
252
 
184
253
    &pdb_misc;
185
254
 
186
 
    %invoke = ( code => 'gimp_context_set_default_colors (context);' );
 
255
    %invoke = (
 
256
        code => <<'CODE'
 
257
{
 
258
  gimp_context_set_default_colors (context);
 
259
}
 
260
CODE
 
261
    );
187
262
}
188
263
 
189
264
sub context_swap_colors {
196
271
 
197
272
    &pdb_misc;
198
273
 
199
 
    %invoke = ( code => 'gimp_context_swap_colors (context);' );
 
274
    %invoke = (
 
275
        code => <<'CODE'
 
276
{
 
277
  gimp_context_swap_colors (context);
 
278
}
 
279
CODE
 
280
    );
200
281
}
201
282
 
202
283
sub context_get_opacity {
211
292
 
212
293
    @outargs = (
213
294
        { name => 'opacity', type => '0 <= float <= 100',
214
 
          desc => 'The opacity: %%desc%%',
215
 
          alias => 'gimp_context_get_opacity (context) * 100.0',
216
 
          no_declare => 1 }
 
295
          desc => 'The opacity' }
 
296
    );
 
297
 
 
298
    %invoke = (
 
299
        code => <<'CODE'
 
300
{
 
301
  opacity = gimp_context_get_opacity (context) * 100.0;
 
302
}
 
303
CODE
217
304
    );
218
305
}
219
306
 
229
316
 
230
317
    @inargs = (
231
318
        { name => 'opacity', type => '0 <= float <= 100',
232
 
          desc => 'The opacity: %%desc%%' }
 
319
          desc => 'The opacity' }
233
320
    );
234
321
 
235
 
    %invoke = ( code => 'gimp_context_set_opacity (context, opacity / 100.0);' );
 
322
    %invoke = (
 
323
        code => <<'CODE'
 
324
{
 
325
  gimp_context_set_opacity (context, opacity / 100.0);
 
326
}
 
327
CODE
 
328
    );
236
329
}
237
330
 
238
331
sub context_get_paint_mode {
248
341
 
249
342
    @outargs = (
250
343
        { name => 'paint_mode', type => 'enum GimpLayerModeEffects',
251
 
          desc => 'The paint mode: { %%desc%% }',
252
 
          alias => 'gimp_context_get_paint_mode (context)',
253
 
          no_declare => 1 }
 
344
          desc => 'The paint mode' }
 
345
    );
 
346
 
 
347
    %invoke = (
 
348
        code => <<'CODE'
 
349
{
 
350
  paint_mode = gimp_context_get_paint_mode (context);
 
351
}
 
352
CODE
254
353
    );
255
354
}
256
355
 
265
364
 
266
365
    @inargs = (
267
366
        { name => 'paint_mode', type => 'enum GimpLayerModeEffects',
268
 
          desc => 'The paint mode: { %%desc%% }' }
 
367
          desc => 'The paint mode' }
269
368
    );
270
369
 
271
 
    %invoke = ( code => 'gimp_context_set_paint_mode (context, paint_mode);' );
 
370
    %invoke = (
 
371
        code => <<'CODE'
 
372
{
 
373
  gimp_context_set_paint_mode (context, paint_mode);
 
374
}
 
375
CODE
 
376
    );
272
377
}
273
378
 
274
379
sub context_get_brush {
275
380
    $blurb = 'Retrieve the currently active brush.';
276
381
 
277
382
    $help = <<'HELP';
278
 
This procedure returns the nme of the currently active brush.
 
383
This procedure returns the name of the currently active brush.
279
384
All paint operations and stroke operations use this brush to control
280
385
the application of paint to the image.
281
386
HELP
284
389
 
285
390
    @outargs = (
286
391
        { name  => 'name', type  => 'string',
287
 
          desc  => 'The name of the active brush',
288
 
          alias => 'g_strdup (gimp_object_get_name (GIMP_OBJECT (brush)))',
289
 
          no_declare => 1 }
 
392
          desc  => 'The name of the active brush' }
290
393
    );
291
394
 
292
395
    %invoke = (
293
 
        vars => [ 'GimpBrush *brush' ],
294
 
        code => 'success = (brush = gimp_context_get_brush (context)) != NULL;'
 
396
        code => <<'CODE'
 
397
{
 
398
  GimpBrush *brush = gimp_context_get_brush (context);
 
399
 
 
400
  if (brush)
 
401
    name = g_strdup (gimp_object_get_name (GIMP_OBJECT (brush)));
 
402
  else
 
403
    success = FALSE;
 
404
}
 
405
CODE
295
406
    );
296
407
}
297
408
 
310
421
 
311
422
    @inargs = (
312
423
        { name => 'name', type => 'string',
313
 
          desc => 'The name o the brush' }
 
424
          desc => 'The name of the brush' }
314
425
    );
315
426
 
316
427
    %invoke = (
317
 
        vars => [ 'GimpBrush *brush' ],
318
428
        code => <<'CODE'
319
429
{
320
 
  brush = (GimpBrush *)
 
430
  GimpBrush *brush = (GimpBrush *)
321
431
    gimp_container_get_child_by_name (gimp->brush_factory->container, name);
322
432
 
323
433
  if (brush)
342
452
 
343
453
    @outargs = (
344
454
        { name  => 'name', type  => 'string',
345
 
          desc  => 'The name of the active pattern',
346
 
          alias => 'g_strdup (gimp_object_get_name (GIMP_OBJECT (pattern)))',
347
 
          no_declare => 1 }
 
455
          desc  => 'The name of the active pattern' }
348
456
    );
349
457
 
350
458
    %invoke = (
351
 
        vars => [ 'GimpPattern *pattern' ],
352
 
        code => 'success = (pattern = gimp_context_get_pattern (context)) != NULL;'
 
459
        code => <<'CODE'
 
460
{
 
461
  GimpPattern *pattern = gimp_context_get_pattern (context);
 
462
 
 
463
  if (pattern)
 
464
    name = g_strdup (gimp_object_get_name (GIMP_OBJECT (pattern)));
 
465
  else
 
466
    success = FALSE;
 
467
}
 
468
CODE
353
469
    );
354
470
}
355
471
 
372
488
    );
373
489
 
374
490
    %invoke = (
375
 
        vars => [ 'GimpPattern *pattern' ],
376
491
        code => <<'CODE'
377
492
{
378
 
  pattern = (GimpPattern *)
 
493
  GimpPattern *pattern = (GimpPattern *)
379
494
    gimp_container_get_child_by_name (gimp->pattern_factory->container, name);
380
495
 
381
496
  if (pattern)
398
513
 
399
514
    @outargs = (
400
515
        { name  => 'name', type  => 'string',
401
 
          desc  => 'The name of the active gradient',
402
 
          alias => 'g_strdup (gimp_object_get_name (GIMP_OBJECT (gradient)))',
403
 
          no_declare => 1 }
 
516
          desc  => 'The name of the active gradient' }
404
517
    );
405
518
 
406
519
    %invoke = (
407
 
        vars => [ 'GimpGradient *gradient' ],
408
 
        code => 'success = (gradient = gimp_context_get_gradient (context)) != NULL;'
 
520
        code => <<'CODE'
 
521
{
 
522
  GimpGradient *gradient = gimp_context_get_gradient (context);
 
523
 
 
524
  if (gradient)
 
525
    name = g_strdup (gimp_object_get_name (GIMP_OBJECT (gradient)));
 
526
  else
 
527
    success = FALSE;
 
528
}
 
529
CODE
409
530
    );
410
531
}
411
532
 
428
549
    );
429
550
 
430
551
    %invoke = (
431
 
        vars => [ 'GimpGradient *gradient' ],
432
552
        code => <<'CODE'
433
553
{
434
 
  gradient = (GimpGradient *)
 
554
  GimpGradient *gradient = (GimpGradient *)
435
555
    gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
436
556
 
437
557
  if (gradient)
454
574
 
455
575
    @outargs = (
456
576
        { name  => 'name', type  => 'string',
457
 
          desc  => 'The name of the active palette',
458
 
          alias => 'g_strdup (gimp_object_get_name (GIMP_OBJECT (palette)))',
459
 
          no_declare => 1 }
 
577
          desc  => 'The name of the active palette' }
460
578
    );
461
579
 
462
580
    %invoke = (
463
 
        vars => [ 'GimpPalette *palette' ],
464
 
        code => 'success = (palette = gimp_context_get_palette (context)) != NULL;'
 
581
        code => <<'CODE'
 
582
{
 
583
  GimpPalette *palette = gimp_context_get_palette (context);
 
584
 
 
585
  if (palette)
 
586
    name = g_strdup (gimp_object_get_name (GIMP_OBJECT (palette)));
 
587
  else
 
588
    success = FALSE;
 
589
}
 
590
CODE
465
591
    );
466
592
}
467
593
 
484
610
    );
485
611
 
486
612
    %invoke = (
487
 
        vars => [ 'GimpPalette *palette' ],
488
613
        code => <<'CODE'
489
614
{
490
 
  palette = (GimpPalette *)
 
615
  GimpPalette *palette = (GimpPalette *)
491
616
    gimp_container_get_child_by_name (gimp->palette_factory->container, name);
492
617
 
493
618
  if (palette)
510
635
 
511
636
    @outargs = (
512
637
        { name  => 'name', type  => 'string',
513
 
          desc  => 'The name of the active font',
514
 
          alias => 'g_strdup (gimp_object_get_name (GIMP_OBJECT (font)))',
515
 
          no_declare => 1 }
 
638
          desc  => 'The name of the active font' }
516
639
    );
517
640
 
518
641
    %invoke = (
519
 
        vars => [ 'GimpFont *font' ],
520
 
        code => 'success = (font = gimp_context_get_font (context)) != NULL;'
 
642
        code => <<'CODE'
 
643
{
 
644
  GimpFont *font = gimp_context_get_font (context);
 
645
 
 
646
  if (font)
 
647
    name = g_strdup (gimp_object_get_name (GIMP_OBJECT (font)));
 
648
  else
 
649
    success = FALSE;
 
650
}
 
651
CODE
521
652
    );
522
653
}
523
654
 
540
671
    );
541
672
 
542
673
    %invoke = (
543
 
        vars => [ 'GimpFont *font' ],
544
674
        code => <<'CODE'
545
675
{
546
 
  font = (GimpFont *)
 
676
  GimpFont *font = (GimpFont *)
547
677
    gimp_container_get_child_by_name (gimp->fonts, name);
548
678
 
549
679
  if (font)
555
685
    );
556
686
}
557
687
 
558
 
@headers = qw("core/gimp.h" "core/gimpcontainer.h" "core/gimpcontext.h"
 
688
 
 
689
@headers = qw("core/gimp.h"
 
690
              "core/gimpcontainer.h"
 
691
              "core/gimpcontext.h"
559
692
              "core/gimpdatafactory.h"
560
 
              "plug-in/plug-in.h" "plug-in/plug-in-context.h");
 
693
              "plug-in/gimpplugin.h"
 
694
              "plug-in/gimpplugin-context.h"
 
695
              "plug-in/gimppluginmanager.h");
561
696
 
562
697
@procs = qw(context_push context_pop
 
698
            context_get_paint_method context_set_paint_method
563
699
            context_get_foreground context_set_foreground
564
700
            context_get_background context_set_background
565
701
            context_set_default_colors context_swap_colors
570
706
            context_get_gradient context_set_gradient
571
707
            context_get_palette context_set_palette
572
708
            context_get_font context_set_font);
 
709
 
573
710
%exports = (app => [@procs], lib => [@procs]);
574
711
 
575
712
$desc = 'Context';