18
18
# "Perlized" from C source by Manish Singh <yosh@gimp.org>
22
20
sub image_undo_group_start {
23
21
$blurb = 'Starts a group undo.';
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.
34
@inargs = ( &std_image_arg );
35
$inargs[0]->{desc} = 'The ID of the image in which to open an undo group';
33
{ name => 'image', type => 'image',
34
desc => 'The ID of the image in which to open an undo group' }
37
%invoke = ( headers => [ qw("core/gimp.h" "plug-in/plug-in.h") ],
38
vars => [ 'gchar *undo_desc = NULL' ],
41
if (gimp->current_plug_in)
42
undo_desc = plug_in_get_undo_desc (gimp->current_plug_in);
44
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_MISC, undo_desc);
40
GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
41
const gchar *undo_desc = NULL;
45
success = gimp_plug_in_cleanup_undo_group_start (plug_in, image);
48
undo_desc = gimp_plug_in_get_undo_desc (plug_in);
52
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_MISC, undo_desc);
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().
80
$author = $copyright = 'Raphael Quinet';
99
&raphael_pdb_misc('1999');
83
@inargs = ( &std_image_arg );
102
{ name => 'image', type => 'image',
103
desc => 'The image' }
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' }
90
%invoke = ( code => 'enabled = gimp_image_undo_is_enabled (gimage);' );
114
enabled = gimp_image_undo_is_enabled (image);
93
120
sub image_undo_disable {
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.
105
@inargs = ( &std_image_arg );
133
{ name => 'image', type => 'image',
134
desc => 'The image' }
108
138
{ name => 'disabled', type => 'boolean',
109
desc => 'True if the image undo has been disabled',
110
alias => 'success ? TRUE : FALSE', no_declare => 1 }
113
%invoke = ( code => 'success = gimp_image_undo_disable (gimage);' );
139
desc => 'TRUE if the image undo has been disabled' }
146
GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
149
success = gimp_plug_in_cleanup_undo_disable (plug_in, image);
153
disabled = gimp_image_undo_disable (image);
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.
127
@inargs = ( &std_image_arg );
171
{ name => 'image', type => 'image',
172
desc => 'The image' }
130
176
{ name => 'enabled', type => 'boolean',
131
desc => 'True if the image undo has been enabled',
132
alias => 'success ? TRUE : FALSE', no_declare => 1 }
135
%invoke = ( code => 'success = gimp_image_undo_enable (gimage);' );
177
desc => 'TRUE if the image undo has been enabled' }
184
GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
187
success = gimp_plug_in_cleanup_undo_enable (plug_in, image);
191
enabled = gimp_image_undo_enable (image);
138
197
sub image_undo_freeze {
139
198
$blurb = "Freeze the image's undo stack.";
141
$author = $copyright = 'Adam D. Moss';
200
&adam_pdb_misc('1999');
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.
156
@inargs = ( &std_image_arg );
217
{ name => 'image', type => 'image',
218
desc => 'The image' }
159
222
{ name => 'frozen', type => 'boolean',
160
desc => 'True if the image undo has been frozen',
161
alias => 'success ? TRUE : FALSE', no_declare => 1 }
164
%invoke = ( code => 'success = gimp_image_undo_freeze (gimage);' );
223
desc => 'TRUE if the image undo has been frozen' }
230
GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
233
success = gimp_plug_in_cleanup_undo_freeze (plug_in, image);
237
frozen = gimp_image_undo_freeze (image);
167
243
sub image_undo_thaw {
168
244
$blurb = "Thaw the image's undo stack.";
170
$author = $copyright = 'Adam D. Moss';
246
&adam_pdb_misc('1999');
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
185
@inargs = ( &std_image_arg );
262
{ name => 'image', type => 'image',
263
desc => 'The image' }
188
267
{ name => 'thawed', type => 'boolean',
189
desc => 'True if the image undo has been thawed',
190
alias => 'success ? TRUE : FALSE', no_declare => 1 }
193
%invoke = ( code => 'success = gimp_image_undo_thaw (gimage);' );
196
@headers = qw("core/gimpimage-undo.h");
268
desc => 'TRUE if the image undo has been thawed' }
275
GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
278
success = gimp_plug_in_cleanup_undo_thaw (plug_in, image);
282
thawed = gimp_image_undo_thaw (image);
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");
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);
202
300
%exports = (app => [@procs], lib => [@procs]);