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

« back to all changes in this revision

Viewing changes to tools/pdbgen/pdb/undo.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
17
17
 
18
18
# "Perlized" from C source by Manish Singh <yosh@gimp.org>
19
19
 
20
 
# The defs
21
 
 
22
20
sub image_undo_group_start {
23
21
    $blurb = 'Starts a group undo.';
24
22
 
25
23
    $help = <<'HELP';
26
24
This function is used to start a group undo--necessary for logically combining
27
25
two or more undo operations into a single operation. This call must be used in
28
 
conjunction with a 'gimp-image-undo-group-end' call.
 
26
conjunction with a gimp_image_undo_group_end() call.
29
27
HELP
30
28
 
31
29
    &std_pdb_misc;
32
30
    $date = '1997';
33
31
 
34
 
    @inargs = ( &std_image_arg );
35
 
    $inargs[0]->{desc} = 'The ID of the image in which to open an undo group';
 
32
    @inargs = (
 
33
        { name => 'image', type => 'image',
 
34
          desc => 'The ID of the image in which to open an undo group' }
 
35
    );
36
36
 
37
 
    %invoke = ( headers => [ qw("core/gimp.h" "plug-in/plug-in.h") ],
38
 
                vars => [ 'gchar *undo_desc = NULL' ],
39
 
                code => <<CODE
 
37
    %invoke = (
 
38
        code => <<'CODE'
40
39
{
41
 
  if (gimp->current_plug_in)
42
 
    undo_desc = plug_in_get_undo_desc (gimp->current_plug_in);
43
 
 
44
 
  gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_MISC, undo_desc);
45
 
 
46
 
  if (undo_desc)
47
 
    g_free (undo_desc);
 
40
  GimpPlugIn  *plug_in   = gimp->plug_in_manager->current_plug_in;
 
41
  const gchar *undo_desc = NULL;
 
42
 
 
43
  if (plug_in)
 
44
    {
 
45
      success = gimp_plug_in_cleanup_undo_group_start (plug_in, image);
 
46
 
 
47
      if (success)
 
48
        undo_desc = gimp_plug_in_get_undo_desc (plug_in);
 
49
    }
 
50
 
 
51
  if (success)
 
52
    gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_MISC, undo_desc);
48
53
}
49
54
CODE
50
55
    );
54
59
    $blurb = 'Finish a group undo.';
55
60
 
56
61
    $help = <<'HELP';
57
 
This function must be called once for each 'gimp-image-undo-group-start' call
 
62
This function must be called once for each gimp_image_undo_group_start() call
58
63
that is made.
59
64
HELP
60
65
 
61
66
    &std_pdb_misc;
62
67
    $date = '1997';
63
68
 
64
 
    @inargs = ( &std_image_arg );
65
 
    $inargs[0]->{desc} = 'The ID of the image in which to close an undo group';
66
 
 
67
 
    %invoke = ( code => 'gimp_image_undo_group_end (gimage);' );
 
69
    @inargs = (
 
70
        { name => 'image', type => 'image',
 
71
          desc => 'The ID of the image in which to close an undo group' }
 
72
    );
 
73
 
 
74
    %invoke = (
 
75
        code => <<'CODE'
 
76
{
 
77
  GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
 
78
 
 
79
  if (plug_in)
 
80
    success = gimp_plug_in_cleanup_undo_group_end (plug_in, image);
 
81
 
 
82
  if (success)
 
83
    gimp_image_undo_group_end (image);
 
84
}
 
85
CODE
 
86
    );
68
87
}
69
88
 
70
89
sub image_undo_is_enabled {
73
92
    $help = <<'HELP';
74
93
This procedure checks if the image's undo stack is currently enabled or
75
94
disabled.  This is useful when several plugins or scripts call each other
76
 
and want to check if their caller has already used 'gimp_image_undo_disable'
77
 
or 'gimp_image_undo_freeze'.
 
95
and want to check if their caller has already used gimp_image_undo_disable()
 
96
or gimp_image_undo_freeze().
78
97
HELP
79
98
 
80
 
    $author = $copyright = 'Raphael Quinet';
81
 
    $date = '1999';
 
99
    &raphael_pdb_misc('1999');
82
100
 
83
 
    @inargs = ( &std_image_arg );
 
101
    @inargs = (
 
102
        { name => 'image', type => 'image',
 
103
          desc  => 'The image' }
 
104
    );
84
105
 
85
106
    @outargs = (
86
 
        { name => 'enabled', type => 'boolean', init => 1,
87
 
          desc => 'True if undo is enabled for this image' }
 
107
        { name => 'enabled', type => 'boolean',
 
108
          desc => 'TRUE if undo is enabled for this image' }
88
109
    );
89
110
 
90
 
    %invoke = ( code => 'enabled = gimp_image_undo_is_enabled (gimage);' );
 
111
    %invoke = (
 
112
        code => <<'CODE'
 
113
{
 
114
  enabled = gimp_image_undo_is_enabled (image);
 
115
}
 
116
CODE
 
117
    );
91
118
}
92
119
 
93
120
sub image_undo_disable {
96
123
    $help = <<'HELP';
97
124
This procedure disables the image's undo stack, allowing subsequent operations
98
125
to ignore their undo steps. This is generally called in conjunction with
99
 
'gimp_image_undo_enable' to temporarily disable an image undo stack. This is
 
126
gimp_image_undo_enable() to temporarily disable an image undo stack. This is
100
127
advantageous because saving undo steps can be time and memory intensive.
101
128
HELP
102
129
 
103
130
    &std_pdb_misc;
104
131
 
105
 
    @inargs = ( &std_image_arg );
 
132
    @inargs = (
 
133
        { name => 'image', type => 'image',
 
134
          desc => 'The image' }
 
135
    );
106
136
 
107
137
    @outargs = (
108
138
        { name => 'disabled', type => 'boolean',
109
 
          desc => 'True if the image undo has been disabled',
110
 
          alias => 'success ? TRUE : FALSE', no_declare => 1 }
111
 
    );
112
 
 
113
 
    %invoke = ( code => 'success = gimp_image_undo_disable (gimage);' );
 
139
          desc => 'TRUE if the image undo has been disabled' }
 
140
    );
 
141
 
 
142
    %invoke = (
 
143
        code => <<'CODE'
 
144
{
 
145
#if 0
 
146
  GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
 
147
 
 
148
  if (plug_in)
 
149
    success = gimp_plug_in_cleanup_undo_disable (plug_in, image);
 
150
#endif
 
151
 
 
152
  if (success)
 
153
    disabled = gimp_image_undo_disable (image);
 
154
}
 
155
CODE
 
156
    );
114
157
}
115
158
 
116
159
sub image_undo_enable {
119
162
    $help = <<'HELP';
120
163
This procedure enables the image's undo stack, allowing subsequent operations
121
164
to store their undo steps. This is generally called in conjunction with
122
 
'gimp_image_undo_disable' to temporarily disable an image undo stack.
 
165
gimp_image_undo_disable() to temporarily disable an image undo stack.
123
166
HELP
124
167
 
125
168
    &std_pdb_misc;
126
169
 
127
 
    @inargs = ( &std_image_arg );
 
170
    @inargs = (
 
171
        { name => 'image', type => 'image',
 
172
          desc => 'The image' }
 
173
    );
128
174
 
129
175
    @outargs = (
130
176
        { name => 'enabled', type => 'boolean',
131
 
          desc => 'True if the image undo has been enabled',
132
 
          alias => 'success ? TRUE : FALSE', no_declare => 1 }
133
 
    );
134
 
 
135
 
    %invoke = ( code => 'success = gimp_image_undo_enable (gimage);' );
 
177
          desc => 'TRUE if the image undo has been enabled' }
 
178
    );
 
179
 
 
180
    %invoke = (
 
181
        code => <<'CODE'
 
182
{
 
183
#if 0
 
184
  GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
 
185
 
 
186
  if (plug_in)
 
187
    success = gimp_plug_in_cleanup_undo_enable (plug_in, image);
 
188
#endif
 
189
 
 
190
  if (success)
 
191
    enabled = gimp_image_undo_enable (image);
 
192
}
 
193
CODE
 
194
    );
136
195
}
137
196
 
138
197
sub image_undo_freeze {
139
198
    $blurb = "Freeze the image's undo stack.";
140
199
 
141
 
    $author = $copyright = 'Adam D. Moss';
142
 
    $date = '1999';
 
200
    &adam_pdb_misc('1999');
143
201
 
144
202
    $help = <<'HELP';
145
 
This procedure freezes the image's undo stack, allowing subsequent operations
146
 
to ignore their undo steps.  This is generally called in conjunction with 
147
 
'gimp_image_undo_thaw' to temporarily disable an image undo stack.  This is 
148
 
advantageous because saving undo steps can be time and memory intensive.  
149
 
'gimp_image_undo_{freeze,thaw}' and 'gimp_image_undo_{disable,enable}' differ 
150
 
in that the former does not free up all undo steps when undo is thawed, so is 
151
 
more suited to interactive in-situ previews.  It is important in this case 
152
 
that the image is back to the same state it was frozen in before thawing, else 
153
 
'undo' behaviour is undefined.
 
203
This procedure freezes the image's undo stack, allowing subsequent
 
204
operations to ignore their undo steps.  This is generally called in
 
205
conjunction with gimp_image_undo_thaw() to temporarily disable an
 
206
image undo stack.  This is advantageous because saving undo steps can
 
207
be time and memory intensive.  gimp_image_undo_freeze() /
 
208
gimp_image_undo_thaw() and gimp_image_undo_disable() /
 
209
gimp_image_undo_enable() differ in that the former does not free up
 
210
all undo steps when undo is thawed, so is more suited to interactive
 
211
in-situ previews.  It is important in this case that the image is back
 
212
to the same state it was frozen in before thawing, else 'undo'
 
213
behaviour is undefined.
154
214
HELP
155
215
 
156
 
    @inargs = ( &std_image_arg );
 
216
    @inargs = (
 
217
        { name => 'image', type => 'image',
 
218
          desc => 'The image' }
 
219
    );
157
220
 
158
221
    @outargs = (
159
222
        { name => 'frozen', type => 'boolean',
160
 
          desc => 'True if the image undo has been frozen',
161
 
          alias => 'success ? TRUE : FALSE', no_declare => 1 }
162
 
    );
163
 
 
164
 
    %invoke = ( code => 'success = gimp_image_undo_freeze (gimage);' );
 
223
          desc => 'TRUE if the image undo has been frozen' }
 
224
    );
 
225
 
 
226
    %invoke = (
 
227
        code => <<'CODE'
 
228
{
 
229
#if 0
 
230
  GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
 
231
 
 
232
  if (plug_in)
 
233
    success = gimp_plug_in_cleanup_undo_freeze (plug_in, image);
 
234
#endif
 
235
 
 
236
  if (success)
 
237
    frozen = gimp_image_undo_freeze (image);
 
238
}
 
239
CODE
 
240
    );
165
241
}
166
242
 
167
243
sub image_undo_thaw {
168
244
    $blurb = "Thaw the image's undo stack.";
169
245
 
170
 
    $author = $copyright = 'Adam D. Moss';
171
 
    $date = '1999';
 
246
    &adam_pdb_misc('1999');
172
247
 
173
248
    $help = <<'HELP';
174
 
This procedure thaws the image's undo stack, allowing subsequent operations to 
175
 
store their undo steps. This is generally called in conjunction with 
176
 
'gimp_image_undo_freeze' to temporarily freeze an image undo stack.  
177
 
'gimp_image_undo_thaw' does NOT free the undo stack as
178
 
'gimp_image_undo_enable' does, so is suited for situations where one wishes to 
179
 
leave the undo stack in the same state in which one found it despite 
180
 
non-destructively playing with the image in the meantime.  An example would be 
181
 
in-situ plugin previews.  Balancing freezes and thaws and ensuring image 
182
 
consistancy is the responsibility of the caller.
 
249
This procedure thaws the image's undo stack, allowing subsequent
 
250
operations to store their undo steps. This is generally called in
 
251
conjunction with gimp_image_undo_freeze() to temporarily freeze an
 
252
image undo stack.  gimp_image_undo_thaw() does NOT free the undo stack
 
253
as gimp_image_undo_enable() does, so is suited for situations where
 
254
one wishes to leave the undo stack in the same state in which one
 
255
found it despite non-destructively playing with the image in the
 
256
meantime.  An example would be in-situ plugin previews.  Balancing
 
257
freezes and thaws and ensuring image consistancy is the responsibility
 
258
of the caller.
183
259
HELP
184
260
 
185
 
    @inargs = ( &std_image_arg );
 
261
    @inargs = (
 
262
        { name => 'image', type => 'image',
 
263
          desc => 'The image' }
 
264
    );
186
265
 
187
266
    @outargs = (
188
267
        { name => 'thawed', type => 'boolean',
189
 
          desc => 'True if the image undo has been thawed',
190
 
          alias => 'success ? TRUE : FALSE', no_declare => 1 }
191
 
    );
192
 
 
193
 
    %invoke = ( code => 'success = gimp_image_undo_thaw (gimage);' );
194
 
}
195
 
 
196
 
@headers = qw("core/gimpimage-undo.h");
 
268
          desc => 'TRUE if the image undo has been thawed' }
 
269
    );
 
270
 
 
271
    %invoke = (
 
272
        code => <<'CODE'
 
273
{
 
274
#if 0
 
275
  GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
 
276
 
 
277
  if (plug_in)
 
278
    success = gimp_plug_in_cleanup_undo_thaw (plug_in, image);
 
279
#endif
 
280
 
 
281
  if (success)
 
282
    thawed = gimp_image_undo_thaw (image);
 
283
}
 
284
CODE
 
285
    );
 
286
}
 
287
 
 
288
 
 
289
@headers = qw("core/gimp.h"
 
290
              "core/gimpimage-undo.h"
 
291
              "plug-in/gimpplugin.h"
 
292
              "plug-in/gimpplugin-cleanup.h"
 
293
              "plug-in/gimppluginmanager.h");
197
294
 
198
295
@procs = qw(image_undo_group_start image_undo_group_end
199
296
            image_undo_is_enabled
200
297
            image_undo_disable image_undo_enable
201
298
            image_undo_freeze image_undo_thaw);
 
299
 
202
300
%exports = (app => [@procs], lib => [@procs]);
203
301
 
204
302
$desc = 'Undo';