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

« back to all changes in this revision

Viewing changes to app/pdb/undo_cmds.c

  • 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-2003 Spencer Kimball and Peter Mattis
3
3
 *
4
4
 * This program is free software; you can redistribute it and/or modify
16
16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
17
 */
18
18
 
19
 
/* NOTE: This file is autogenerated by pdbgen.pl. */
 
19
/* NOTE: This file is auto-generated by pdbgen.pl. */
20
20
 
21
21
#include "config.h"
22
22
 
24
24
#include <glib-object.h>
25
25
 
26
26
#include "pdb-types.h"
27
 
#include "procedural_db.h"
 
27
#include "gimppdb.h"
 
28
#include "gimpprocedure.h"
 
29
#include "core/gimpparamspecs.h"
28
30
 
29
31
#include "core/gimp.h"
30
32
#include "core/gimpimage-undo.h"
31
33
#include "core/gimpimage.h"
32
 
#include "plug-in/plug-in.h"
33
 
 
34
 
static ProcRecord image_undo_group_start_proc;
35
 
static ProcRecord image_undo_group_end_proc;
36
 
static ProcRecord image_undo_is_enabled_proc;
37
 
static ProcRecord image_undo_disable_proc;
38
 
static ProcRecord image_undo_enable_proc;
39
 
static ProcRecord image_undo_freeze_proc;
40
 
static ProcRecord image_undo_thaw_proc;
 
34
#include "plug-in/gimpplugin-cleanup.h"
 
35
#include "plug-in/gimpplugin.h"
 
36
#include "plug-in/gimppluginmanager.h"
 
37
 
 
38
#include "internal_procs.h"
 
39
 
 
40
 
 
41
static GValueArray *
 
42
image_undo_group_start_invoker (GimpProcedure     *procedure,
 
43
                                Gimp              *gimp,
 
44
                                GimpContext       *context,
 
45
                                GimpProgress      *progress,
 
46
                                const GValueArray *args)
 
47
{
 
48
  gboolean success = TRUE;
 
49
  GimpImage *image;
 
50
 
 
51
  image = gimp_value_get_image (&args->values[0], gimp);
 
52
 
 
53
  if (success)
 
54
    {
 
55
      GimpPlugIn  *plug_in   = gimp->plug_in_manager->current_plug_in;
 
56
      const gchar *undo_desc = NULL;
 
57
 
 
58
      if (plug_in)
 
59
        {
 
60
          success = gimp_plug_in_cleanup_undo_group_start (plug_in, image);
 
61
 
 
62
          if (success)
 
63
            undo_desc = gimp_plug_in_get_undo_desc (plug_in);
 
64
        }
 
65
 
 
66
      if (success)
 
67
        gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_MISC, undo_desc);
 
68
    }
 
69
 
 
70
  return gimp_procedure_get_return_values (procedure, success);
 
71
}
 
72
 
 
73
static GValueArray *
 
74
image_undo_group_end_invoker (GimpProcedure     *procedure,
 
75
                              Gimp              *gimp,
 
76
                              GimpContext       *context,
 
77
                              GimpProgress      *progress,
 
78
                              const GValueArray *args)
 
79
{
 
80
  gboolean success = TRUE;
 
81
  GimpImage *image;
 
82
 
 
83
  image = gimp_value_get_image (&args->values[0], gimp);
 
84
 
 
85
  if (success)
 
86
    {
 
87
      GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
 
88
 
 
89
      if (plug_in)
 
90
        success = gimp_plug_in_cleanup_undo_group_end (plug_in, image);
 
91
 
 
92
      if (success)
 
93
        gimp_image_undo_group_end (image);
 
94
    }
 
95
 
 
96
  return gimp_procedure_get_return_values (procedure, success);
 
97
}
 
98
 
 
99
static GValueArray *
 
100
image_undo_is_enabled_invoker (GimpProcedure     *procedure,
 
101
                               Gimp              *gimp,
 
102
                               GimpContext       *context,
 
103
                               GimpProgress      *progress,
 
104
                               const GValueArray *args)
 
105
{
 
106
  gboolean success = TRUE;
 
107
  GValueArray *return_vals;
 
108
  GimpImage *image;
 
109
  gboolean enabled = FALSE;
 
110
 
 
111
  image = gimp_value_get_image (&args->values[0], gimp);
 
112
 
 
113
  if (success)
 
114
    {
 
115
      enabled = gimp_image_undo_is_enabled (image);
 
116
    }
 
117
 
 
118
  return_vals = gimp_procedure_get_return_values (procedure, success);
 
119
 
 
120
  if (success)
 
121
    g_value_set_boolean (&return_vals->values[1], enabled);
 
122
 
 
123
  return return_vals;
 
124
}
 
125
 
 
126
static GValueArray *
 
127
image_undo_disable_invoker (GimpProcedure     *procedure,
 
128
                            Gimp              *gimp,
 
129
                            GimpContext       *context,
 
130
                            GimpProgress      *progress,
 
131
                            const GValueArray *args)
 
132
{
 
133
  gboolean success = TRUE;
 
134
  GValueArray *return_vals;
 
135
  GimpImage *image;
 
136
  gboolean disabled = FALSE;
 
137
 
 
138
  image = gimp_value_get_image (&args->values[0], gimp);
 
139
 
 
140
  if (success)
 
141
    {
 
142
    #if 0
 
143
      GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
 
144
 
 
145
      if (plug_in)
 
146
        success = gimp_plug_in_cleanup_undo_disable (plug_in, image);
 
147
    #endif
 
148
 
 
149
      if (success)
 
150
        disabled = gimp_image_undo_disable (image);
 
151
    }
 
152
 
 
153
  return_vals = gimp_procedure_get_return_values (procedure, success);
 
154
 
 
155
  if (success)
 
156
    g_value_set_boolean (&return_vals->values[1], disabled);
 
157
 
 
158
  return return_vals;
 
159
}
 
160
 
 
161
static GValueArray *
 
162
image_undo_enable_invoker (GimpProcedure     *procedure,
 
163
                           Gimp              *gimp,
 
164
                           GimpContext       *context,
 
165
                           GimpProgress      *progress,
 
166
                           const GValueArray *args)
 
167
{
 
168
  gboolean success = TRUE;
 
169
  GValueArray *return_vals;
 
170
  GimpImage *image;
 
171
  gboolean enabled = FALSE;
 
172
 
 
173
  image = gimp_value_get_image (&args->values[0], gimp);
 
174
 
 
175
  if (success)
 
176
    {
 
177
    #if 0
 
178
      GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
 
179
 
 
180
      if (plug_in)
 
181
        success = gimp_plug_in_cleanup_undo_enable (plug_in, image);
 
182
    #endif
 
183
 
 
184
      if (success)
 
185
        enabled = gimp_image_undo_enable (image);
 
186
    }
 
187
 
 
188
  return_vals = gimp_procedure_get_return_values (procedure, success);
 
189
 
 
190
  if (success)
 
191
    g_value_set_boolean (&return_vals->values[1], enabled);
 
192
 
 
193
  return return_vals;
 
194
}
 
195
 
 
196
static GValueArray *
 
197
image_undo_freeze_invoker (GimpProcedure     *procedure,
 
198
                           Gimp              *gimp,
 
199
                           GimpContext       *context,
 
200
                           GimpProgress      *progress,
 
201
                           const GValueArray *args)
 
202
{
 
203
  gboolean success = TRUE;
 
204
  GValueArray *return_vals;
 
205
  GimpImage *image;
 
206
  gboolean frozen = FALSE;
 
207
 
 
208
  image = gimp_value_get_image (&args->values[0], gimp);
 
209
 
 
210
  if (success)
 
211
    {
 
212
    #if 0
 
213
      GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
 
214
 
 
215
      if (plug_in)
 
216
        success = gimp_plug_in_cleanup_undo_freeze (plug_in, image);
 
217
    #endif
 
218
 
 
219
      if (success)
 
220
        frozen = gimp_image_undo_freeze (image);
 
221
    }
 
222
 
 
223
  return_vals = gimp_procedure_get_return_values (procedure, success);
 
224
 
 
225
  if (success)
 
226
    g_value_set_boolean (&return_vals->values[1], frozen);
 
227
 
 
228
  return return_vals;
 
229
}
 
230
 
 
231
static GValueArray *
 
232
image_undo_thaw_invoker (GimpProcedure     *procedure,
 
233
                         Gimp              *gimp,
 
234
                         GimpContext       *context,
 
235
                         GimpProgress      *progress,
 
236
                         const GValueArray *args)
 
237
{
 
238
  gboolean success = TRUE;
 
239
  GValueArray *return_vals;
 
240
  GimpImage *image;
 
241
  gboolean thawed = FALSE;
 
242
 
 
243
  image = gimp_value_get_image (&args->values[0], gimp);
 
244
 
 
245
  if (success)
 
246
    {
 
247
    #if 0
 
248
      GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
 
249
 
 
250
      if (plug_in)
 
251
        success = gimp_plug_in_cleanup_undo_thaw (plug_in, image);
 
252
    #endif
 
253
 
 
254
      if (success)
 
255
        thawed = gimp_image_undo_thaw (image);
 
256
    }
 
257
 
 
258
  return_vals = gimp_procedure_get_return_values (procedure, success);
 
259
 
 
260
  if (success)
 
261
    g_value_set_boolean (&return_vals->values[1], thawed);
 
262
 
 
263
  return return_vals;
 
264
}
41
265
 
42
266
void
43
 
register_undo_procs (Gimp *gimp)
44
 
{
45
 
  procedural_db_register (gimp, &image_undo_group_start_proc);
46
 
  procedural_db_register (gimp, &image_undo_group_end_proc);
47
 
  procedural_db_register (gimp, &image_undo_is_enabled_proc);
48
 
  procedural_db_register (gimp, &image_undo_disable_proc);
49
 
  procedural_db_register (gimp, &image_undo_enable_proc);
50
 
  procedural_db_register (gimp, &image_undo_freeze_proc);
51
 
  procedural_db_register (gimp, &image_undo_thaw_proc);
52
 
}
53
 
 
54
 
static Argument *
55
 
image_undo_group_start_invoker (Gimp         *gimp,
56
 
                                GimpContext  *context,
57
 
                                GimpProgress *progress,
58
 
                                Argument     *args)
59
 
{
60
 
  gboolean success = TRUE;
61
 
  GimpImage *gimage;
62
 
  gchar *undo_desc = NULL;
63
 
 
64
 
  gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int);
65
 
  if (! GIMP_IS_IMAGE (gimage))
66
 
    success = FALSE;
67
 
 
68
 
  if (success)
69
 
    {
70
 
      if (gimp->current_plug_in)
71
 
        undo_desc = plug_in_get_undo_desc (gimp->current_plug_in);
72
 
 
73
 
      gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_MISC, undo_desc);
74
 
 
75
 
      if (undo_desc)
76
 
        g_free (undo_desc);
77
 
    }
78
 
 
79
 
  return procedural_db_return_args (&image_undo_group_start_proc, success);
80
 
}
81
 
 
82
 
static ProcArg image_undo_group_start_inargs[] =
83
 
{
84
 
  {
85
 
    GIMP_PDB_IMAGE,
86
 
    "image",
87
 
    "The ID of the image in which to open an undo group"
88
 
  }
89
 
};
90
 
 
91
 
static ProcRecord image_undo_group_start_proc =
92
 
{
93
 
  "gimp_image_undo_group_start",
94
 
  "Starts a group undo.",
95
 
  "This function is used to start a group undo--necessary for logically combining two or more undo operations into a single operation. This call must be used in conjunction with a 'gimp-image-undo-group-end' call.",
96
 
  "Spencer Kimball & Peter Mattis",
97
 
  "Spencer Kimball & Peter Mattis",
98
 
  "1997",
99
 
  NULL,
100
 
  GIMP_INTERNAL,
101
 
  1,
102
 
  image_undo_group_start_inargs,
103
 
  0,
104
 
  NULL,
105
 
  { { image_undo_group_start_invoker } }
106
 
};
107
 
 
108
 
static Argument *
109
 
image_undo_group_end_invoker (Gimp         *gimp,
110
 
                              GimpContext  *context,
111
 
                              GimpProgress *progress,
112
 
                              Argument     *args)
113
 
{
114
 
  gboolean success = TRUE;
115
 
  GimpImage *gimage;
116
 
 
117
 
  gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int);
118
 
  if (! GIMP_IS_IMAGE (gimage))
119
 
    success = FALSE;
120
 
 
121
 
  if (success)
122
 
    gimp_image_undo_group_end (gimage);
123
 
 
124
 
  return procedural_db_return_args (&image_undo_group_end_proc, success);
125
 
}
126
 
 
127
 
static ProcArg image_undo_group_end_inargs[] =
128
 
{
129
 
  {
130
 
    GIMP_PDB_IMAGE,
131
 
    "image",
132
 
    "The ID of the image in which to close an undo group"
133
 
  }
134
 
};
135
 
 
136
 
static ProcRecord image_undo_group_end_proc =
137
 
{
138
 
  "gimp_image_undo_group_end",
139
 
  "Finish a group undo.",
140
 
  "This function must be called once for each 'gimp-image-undo-group-start' call that is made.",
141
 
  "Spencer Kimball & Peter Mattis",
142
 
  "Spencer Kimball & Peter Mattis",
143
 
  "1997",
144
 
  NULL,
145
 
  GIMP_INTERNAL,
146
 
  1,
147
 
  image_undo_group_end_inargs,
148
 
  0,
149
 
  NULL,
150
 
  { { image_undo_group_end_invoker } }
151
 
};
152
 
 
153
 
static Argument *
154
 
image_undo_is_enabled_invoker (Gimp         *gimp,
155
 
                               GimpContext  *context,
156
 
                               GimpProgress *progress,
157
 
                               Argument     *args)
158
 
{
159
 
  gboolean success = TRUE;
160
 
  Argument *return_args;
161
 
  GimpImage *gimage;
162
 
  gboolean enabled = FALSE;
163
 
 
164
 
  gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int);
165
 
  if (! GIMP_IS_IMAGE (gimage))
166
 
    success = FALSE;
167
 
 
168
 
  if (success)
169
 
    enabled = gimp_image_undo_is_enabled (gimage);
170
 
 
171
 
  return_args = procedural_db_return_args (&image_undo_is_enabled_proc, success);
172
 
 
173
 
  if (success)
174
 
    return_args[1].value.pdb_int = enabled;
175
 
 
176
 
  return return_args;
177
 
}
178
 
 
179
 
static ProcArg image_undo_is_enabled_inargs[] =
180
 
{
181
 
  {
182
 
    GIMP_PDB_IMAGE,
183
 
    "image",
184
 
    "The image"
185
 
  }
186
 
};
187
 
 
188
 
static ProcArg image_undo_is_enabled_outargs[] =
189
 
{
190
 
  {
191
 
    GIMP_PDB_INT32,
192
 
    "enabled",
193
 
    "True if undo is enabled for this image"
194
 
  }
195
 
};
196
 
 
197
 
static ProcRecord image_undo_is_enabled_proc =
198
 
{
199
 
  "gimp_image_undo_is_enabled",
200
 
  "Check if the image's undo stack is enabled.",
201
 
  "This procedure checks if the image's undo stack is currently enabled or disabled. This is useful when several plugins or scripts call each other and want to check if their caller has already used 'gimp_image_undo_disable' or 'gimp_image_undo_freeze'.",
202
 
  "Raphael Quinet",
203
 
  "Raphael Quinet",
204
 
  "1999",
205
 
  NULL,
206
 
  GIMP_INTERNAL,
207
 
  1,
208
 
  image_undo_is_enabled_inargs,
209
 
  1,
210
 
  image_undo_is_enabled_outargs,
211
 
  { { image_undo_is_enabled_invoker } }
212
 
};
213
 
 
214
 
static Argument *
215
 
image_undo_disable_invoker (Gimp         *gimp,
216
 
                            GimpContext  *context,
217
 
                            GimpProgress *progress,
218
 
                            Argument     *args)
219
 
{
220
 
  gboolean success = TRUE;
221
 
  Argument *return_args;
222
 
  GimpImage *gimage;
223
 
 
224
 
  gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int);
225
 
  if (! GIMP_IS_IMAGE (gimage))
226
 
    success = FALSE;
227
 
 
228
 
  if (success)
229
 
    success = gimp_image_undo_disable (gimage);
230
 
 
231
 
  return_args = procedural_db_return_args (&image_undo_disable_proc, success);
232
 
 
233
 
  if (success)
234
 
    return_args[1].value.pdb_int = success ? TRUE : FALSE;
235
 
 
236
 
  return return_args;
237
 
}
238
 
 
239
 
static ProcArg image_undo_disable_inargs[] =
240
 
{
241
 
  {
242
 
    GIMP_PDB_IMAGE,
243
 
    "image",
244
 
    "The image"
245
 
  }
246
 
};
247
 
 
248
 
static ProcArg image_undo_disable_outargs[] =
249
 
{
250
 
  {
251
 
    GIMP_PDB_INT32,
252
 
    "disabled",
253
 
    "True if the image undo has been disabled"
254
 
  }
255
 
};
256
 
 
257
 
static ProcRecord image_undo_disable_proc =
258
 
{
259
 
  "gimp_image_undo_disable",
260
 
  "Disable the image's undo stack.",
261
 
  "This procedure disables the image's undo stack, allowing subsequent operations to ignore their undo steps. This is generally called in conjunction with 'gimp_image_undo_enable' to temporarily disable an image undo stack. This is advantageous because saving undo steps can be time and memory intensive.",
262
 
  "Spencer Kimball & Peter Mattis",
263
 
  "Spencer Kimball & Peter Mattis",
264
 
  "1995-1996",
265
 
  NULL,
266
 
  GIMP_INTERNAL,
267
 
  1,
268
 
  image_undo_disable_inargs,
269
 
  1,
270
 
  image_undo_disable_outargs,
271
 
  { { image_undo_disable_invoker } }
272
 
};
273
 
 
274
 
static Argument *
275
 
image_undo_enable_invoker (Gimp         *gimp,
276
 
                           GimpContext  *context,
277
 
                           GimpProgress *progress,
278
 
                           Argument     *args)
279
 
{
280
 
  gboolean success = TRUE;
281
 
  Argument *return_args;
282
 
  GimpImage *gimage;
283
 
 
284
 
  gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int);
285
 
  if (! GIMP_IS_IMAGE (gimage))
286
 
    success = FALSE;
287
 
 
288
 
  if (success)
289
 
    success = gimp_image_undo_enable (gimage);
290
 
 
291
 
  return_args = procedural_db_return_args (&image_undo_enable_proc, success);
292
 
 
293
 
  if (success)
294
 
    return_args[1].value.pdb_int = success ? TRUE : FALSE;
295
 
 
296
 
  return return_args;
297
 
}
298
 
 
299
 
static ProcArg image_undo_enable_inargs[] =
300
 
{
301
 
  {
302
 
    GIMP_PDB_IMAGE,
303
 
    "image",
304
 
    "The image"
305
 
  }
306
 
};
307
 
 
308
 
static ProcArg image_undo_enable_outargs[] =
309
 
{
310
 
  {
311
 
    GIMP_PDB_INT32,
312
 
    "enabled",
313
 
    "True if the image undo has been enabled"
314
 
  }
315
 
};
316
 
 
317
 
static ProcRecord image_undo_enable_proc =
318
 
{
319
 
  "gimp_image_undo_enable",
320
 
  "Enable the image's undo stack.",
321
 
  "This procedure enables the image's undo stack, allowing subsequent operations to store their undo steps. This is generally called in conjunction with 'gimp_image_undo_disable' to temporarily disable an image undo stack.",
322
 
  "Spencer Kimball & Peter Mattis",
323
 
  "Spencer Kimball & Peter Mattis",
324
 
  "1995-1996",
325
 
  NULL,
326
 
  GIMP_INTERNAL,
327
 
  1,
328
 
  image_undo_enable_inargs,
329
 
  1,
330
 
  image_undo_enable_outargs,
331
 
  { { image_undo_enable_invoker } }
332
 
};
333
 
 
334
 
static Argument *
335
 
image_undo_freeze_invoker (Gimp         *gimp,
336
 
                           GimpContext  *context,
337
 
                           GimpProgress *progress,
338
 
                           Argument     *args)
339
 
{
340
 
  gboolean success = TRUE;
341
 
  Argument *return_args;
342
 
  GimpImage *gimage;
343
 
 
344
 
  gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int);
345
 
  if (! GIMP_IS_IMAGE (gimage))
346
 
    success = FALSE;
347
 
 
348
 
  if (success)
349
 
    success = gimp_image_undo_freeze (gimage);
350
 
 
351
 
  return_args = procedural_db_return_args (&image_undo_freeze_proc, success);
352
 
 
353
 
  if (success)
354
 
    return_args[1].value.pdb_int = success ? TRUE : FALSE;
355
 
 
356
 
  return return_args;
357
 
}
358
 
 
359
 
static ProcArg image_undo_freeze_inargs[] =
360
 
{
361
 
  {
362
 
    GIMP_PDB_IMAGE,
363
 
    "image",
364
 
    "The image"
365
 
  }
366
 
};
367
 
 
368
 
static ProcArg image_undo_freeze_outargs[] =
369
 
{
370
 
  {
371
 
    GIMP_PDB_INT32,
372
 
    "frozen",
373
 
    "True if the image undo has been frozen"
374
 
  }
375
 
};
376
 
 
377
 
static ProcRecord image_undo_freeze_proc =
378
 
{
379
 
  "gimp_image_undo_freeze",
380
 
  "Freeze the image's undo stack.",
381
 
  "This procedure freezes the image's undo stack, allowing subsequent operations to ignore their undo steps. This is generally called in conjunction with 'gimp_image_undo_thaw' to temporarily disable an image undo stack. This is advantageous because saving undo steps can be time and memory intensive. 'gimp_image_undo_{freeze,thaw}' and 'gimp_image_undo_{disable,enable}' differ in that the former does not free up all undo steps when undo is thawed, so is more suited to interactive in-situ previews. It is important in this case that the image is back to the same state it was frozen in before thawing, else 'undo' behaviour is undefined.",
382
 
  "Adam D. Moss",
383
 
  "Adam D. Moss",
384
 
  "1999",
385
 
  NULL,
386
 
  GIMP_INTERNAL,
387
 
  1,
388
 
  image_undo_freeze_inargs,
389
 
  1,
390
 
  image_undo_freeze_outargs,
391
 
  { { image_undo_freeze_invoker } }
392
 
};
393
 
 
394
 
static Argument *
395
 
image_undo_thaw_invoker (Gimp         *gimp,
396
 
                         GimpContext  *context,
397
 
                         GimpProgress *progress,
398
 
                         Argument     *args)
399
 
{
400
 
  gboolean success = TRUE;
401
 
  Argument *return_args;
402
 
  GimpImage *gimage;
403
 
 
404
 
  gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int);
405
 
  if (! GIMP_IS_IMAGE (gimage))
406
 
    success = FALSE;
407
 
 
408
 
  if (success)
409
 
    success = gimp_image_undo_thaw (gimage);
410
 
 
411
 
  return_args = procedural_db_return_args (&image_undo_thaw_proc, success);
412
 
 
413
 
  if (success)
414
 
    return_args[1].value.pdb_int = success ? TRUE : FALSE;
415
 
 
416
 
  return return_args;
417
 
}
418
 
 
419
 
static ProcArg image_undo_thaw_inargs[] =
420
 
{
421
 
  {
422
 
    GIMP_PDB_IMAGE,
423
 
    "image",
424
 
    "The image"
425
 
  }
426
 
};
427
 
 
428
 
static ProcArg image_undo_thaw_outargs[] =
429
 
{
430
 
  {
431
 
    GIMP_PDB_INT32,
432
 
    "thawed",
433
 
    "True if the image undo has been thawed"
434
 
  }
435
 
};
436
 
 
437
 
static ProcRecord image_undo_thaw_proc =
438
 
{
439
 
  "gimp_image_undo_thaw",
440
 
  "Thaw the image's undo stack.",
441
 
  "This procedure thaws the image's undo stack, allowing subsequent operations to store their undo steps. This is generally called in conjunction with 'gimp_image_undo_freeze' to temporarily freeze an image undo stack. 'gimp_image_undo_thaw' does NOT free the undo stack as 'gimp_image_undo_enable' does, so is suited for situations where one wishes to leave the undo stack in the same state in which one found it despite non-destructively playing with the image in the meantime. An example would be in-situ plugin previews. Balancing freezes and thaws and ensuring image consistancy is the responsibility of the caller.",
442
 
  "Adam D. Moss",
443
 
  "Adam D. Moss",
444
 
  "1999",
445
 
  NULL,
446
 
  GIMP_INTERNAL,
447
 
  1,
448
 
  image_undo_thaw_inargs,
449
 
  1,
450
 
  image_undo_thaw_outargs,
451
 
  { { image_undo_thaw_invoker } }
452
 
};
 
267
register_undo_procs (GimpPDB *pdb)
 
268
{
 
269
  GimpProcedure *procedure;
 
270
 
 
271
  /*
 
272
   * gimp-image-undo-group-start
 
273
   */
 
274
  procedure = gimp_procedure_new (image_undo_group_start_invoker);
 
275
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-image-undo-group-start");
 
276
  gimp_procedure_set_static_strings (procedure,
 
277
                                     "gimp-image-undo-group-start",
 
278
                                     "Starts a group undo.",
 
279
                                     "This function is used to start a group undo--necessary for logically combining two or more undo operations into a single operation. This call must be used in conjunction with a 'gimp-image-undo-group-end' call.",
 
280
                                     "Spencer Kimball & Peter Mattis",
 
281
                                     "Spencer Kimball & Peter Mattis",
 
282
                                     "1997",
 
283
                                     NULL);
 
284
  gimp_procedure_add_argument (procedure,
 
285
                               gimp_param_spec_image_id ("image",
 
286
                                                         "image",
 
287
                                                         "The ID of the image in which to open an undo group",
 
288
                                                         pdb->gimp, FALSE,
 
289
                                                         GIMP_PARAM_READWRITE));
 
290
  gimp_pdb_register_procedure (pdb, procedure);
 
291
  g_object_unref (procedure);
 
292
 
 
293
  /*
 
294
   * gimp-image-undo-group-end
 
295
   */
 
296
  procedure = gimp_procedure_new (image_undo_group_end_invoker);
 
297
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-image-undo-group-end");
 
298
  gimp_procedure_set_static_strings (procedure,
 
299
                                     "gimp-image-undo-group-end",
 
300
                                     "Finish a group undo.",
 
301
                                     "This function must be called once for each 'gimp-image-undo-group-start' call that is made.",
 
302
                                     "Spencer Kimball & Peter Mattis",
 
303
                                     "Spencer Kimball & Peter Mattis",
 
304
                                     "1997",
 
305
                                     NULL);
 
306
  gimp_procedure_add_argument (procedure,
 
307
                               gimp_param_spec_image_id ("image",
 
308
                                                         "image",
 
309
                                                         "The ID of the image in which to close an undo group",
 
310
                                                         pdb->gimp, FALSE,
 
311
                                                         GIMP_PARAM_READWRITE));
 
312
  gimp_pdb_register_procedure (pdb, procedure);
 
313
  g_object_unref (procedure);
 
314
 
 
315
  /*
 
316
   * gimp-image-undo-is-enabled
 
317
   */
 
318
  procedure = gimp_procedure_new (image_undo_is_enabled_invoker);
 
319
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-image-undo-is-enabled");
 
320
  gimp_procedure_set_static_strings (procedure,
 
321
                                     "gimp-image-undo-is-enabled",
 
322
                                     "Check if the image's undo stack is enabled.",
 
323
                                     "This procedure checks if the image's undo stack is currently enabled or disabled. This is useful when several plugins or scripts call each other and want to check if their caller has already used 'gimp-image-undo-disable' or 'gimp-image-undo-freeze'.",
 
324
                                     "Rapha\xc3\xabl Quinet <raphael@gimp.org>",
 
325
                                     "Rapha\xc3\xabl Quinet",
 
326
                                     "1999",
 
327
                                     NULL);
 
328
  gimp_procedure_add_argument (procedure,
 
329
                               gimp_param_spec_image_id ("image",
 
330
                                                         "image",
 
331
                                                         "The image",
 
332
                                                         pdb->gimp, FALSE,
 
333
                                                         GIMP_PARAM_READWRITE));
 
334
  gimp_procedure_add_return_value (procedure,
 
335
                                   g_param_spec_boolean ("enabled",
 
336
                                                         "enabled",
 
337
                                                         "TRUE if undo is enabled for this image",
 
338
                                                         FALSE,
 
339
                                                         GIMP_PARAM_READWRITE));
 
340
  gimp_pdb_register_procedure (pdb, procedure);
 
341
  g_object_unref (procedure);
 
342
 
 
343
  /*
 
344
   * gimp-image-undo-disable
 
345
   */
 
346
  procedure = gimp_procedure_new (image_undo_disable_invoker);
 
347
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-image-undo-disable");
 
348
  gimp_procedure_set_static_strings (procedure,
 
349
                                     "gimp-image-undo-disable",
 
350
                                     "Disable the image's undo stack.",
 
351
                                     "This procedure disables the image's undo stack, allowing subsequent operations to ignore their undo steps. This is generally called in conjunction with 'gimp-image-undo-enable' to temporarily disable an image undo stack. This is advantageous because saving undo steps can be time and memory intensive.",
 
352
                                     "Spencer Kimball & Peter Mattis",
 
353
                                     "Spencer Kimball & Peter Mattis",
 
354
                                     "1995-1996",
 
355
                                     NULL);
 
356
  gimp_procedure_add_argument (procedure,
 
357
                               gimp_param_spec_image_id ("image",
 
358
                                                         "image",
 
359
                                                         "The image",
 
360
                                                         pdb->gimp, FALSE,
 
361
                                                         GIMP_PARAM_READWRITE));
 
362
  gimp_procedure_add_return_value (procedure,
 
363
                                   g_param_spec_boolean ("disabled",
 
364
                                                         "disabled",
 
365
                                                         "TRUE if the image undo has been disabled",
 
366
                                                         FALSE,
 
367
                                                         GIMP_PARAM_READWRITE));
 
368
  gimp_pdb_register_procedure (pdb, procedure);
 
369
  g_object_unref (procedure);
 
370
 
 
371
  /*
 
372
   * gimp-image-undo-enable
 
373
   */
 
374
  procedure = gimp_procedure_new (image_undo_enable_invoker);
 
375
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-image-undo-enable");
 
376
  gimp_procedure_set_static_strings (procedure,
 
377
                                     "gimp-image-undo-enable",
 
378
                                     "Enable the image's undo stack.",
 
379
                                     "This procedure enables the image's undo stack, allowing subsequent operations to store their undo steps. This is generally called in conjunction with 'gimp-image-undo-disable' to temporarily disable an image undo stack.",
 
380
                                     "Spencer Kimball & Peter Mattis",
 
381
                                     "Spencer Kimball & Peter Mattis",
 
382
                                     "1995-1996",
 
383
                                     NULL);
 
384
  gimp_procedure_add_argument (procedure,
 
385
                               gimp_param_spec_image_id ("image",
 
386
                                                         "image",
 
387
                                                         "The image",
 
388
                                                         pdb->gimp, FALSE,
 
389
                                                         GIMP_PARAM_READWRITE));
 
390
  gimp_procedure_add_return_value (procedure,
 
391
                                   g_param_spec_boolean ("enabled",
 
392
                                                         "enabled",
 
393
                                                         "TRUE if the image undo has been enabled",
 
394
                                                         FALSE,
 
395
                                                         GIMP_PARAM_READWRITE));
 
396
  gimp_pdb_register_procedure (pdb, procedure);
 
397
  g_object_unref (procedure);
 
398
 
 
399
  /*
 
400
   * gimp-image-undo-freeze
 
401
   */
 
402
  procedure = gimp_procedure_new (image_undo_freeze_invoker);
 
403
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-image-undo-freeze");
 
404
  gimp_procedure_set_static_strings (procedure,
 
405
                                     "gimp-image-undo-freeze",
 
406
                                     "Freeze the image's undo stack.",
 
407
                                     "This procedure freezes the image's undo stack, allowing subsequent operations to ignore their undo steps. This is generally called in conjunction with 'gimp-image-undo-thaw' to temporarily disable an image undo stack. This is advantageous because saving undo steps can be time and memory intensive. 'gimp-image-undo-freeze' / 'gimp-image-undo-thaw' and 'gimp-image-undo-disable' / 'gimp-image-undo-enable' differ in that the former does not free up all undo steps when undo is thawed, so is more suited to interactive in-situ previews. It is important in this case that the image is back to the same state it was frozen in before thawing, else 'undo' behaviour is undefined.",
 
408
                                     "Adam D. Moss",
 
409
                                     "Adam D. Moss",
 
410
                                     "1999",
 
411
                                     NULL);
 
412
  gimp_procedure_add_argument (procedure,
 
413
                               gimp_param_spec_image_id ("image",
 
414
                                                         "image",
 
415
                                                         "The image",
 
416
                                                         pdb->gimp, FALSE,
 
417
                                                         GIMP_PARAM_READWRITE));
 
418
  gimp_procedure_add_return_value (procedure,
 
419
                                   g_param_spec_boolean ("frozen",
 
420
                                                         "frozen",
 
421
                                                         "TRUE if the image undo has been frozen",
 
422
                                                         FALSE,
 
423
                                                         GIMP_PARAM_READWRITE));
 
424
  gimp_pdb_register_procedure (pdb, procedure);
 
425
  g_object_unref (procedure);
 
426
 
 
427
  /*
 
428
   * gimp-image-undo-thaw
 
429
   */
 
430
  procedure = gimp_procedure_new (image_undo_thaw_invoker);
 
431
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-image-undo-thaw");
 
432
  gimp_procedure_set_static_strings (procedure,
 
433
                                     "gimp-image-undo-thaw",
 
434
                                     "Thaw the image's undo stack.",
 
435
                                     "This procedure thaws the image's undo stack, allowing subsequent operations to store their undo steps. This is generally called in conjunction with 'gimp-image-undo-freeze' to temporarily freeze an image undo stack. 'gimp-image-undo-thaw' does NOT free the undo stack as 'gimp-image-undo-enable' does, so is suited for situations where one wishes to leave the undo stack in the same state in which one found it despite non-destructively playing with the image in the meantime. An example would be in-situ plugin previews. Balancing freezes and thaws and ensuring image consistancy is the responsibility of the caller.",
 
436
                                     "Adam D. Moss",
 
437
                                     "Adam D. Moss",
 
438
                                     "1999",
 
439
                                     NULL);
 
440
  gimp_procedure_add_argument (procedure,
 
441
                               gimp_param_spec_image_id ("image",
 
442
                                                         "image",
 
443
                                                         "The image",
 
444
                                                         pdb->gimp, FALSE,
 
445
                                                         GIMP_PARAM_READWRITE));
 
446
  gimp_procedure_add_return_value (procedure,
 
447
                                   g_param_spec_boolean ("thawed",
 
448
                                                         "thawed",
 
449
                                                         "TRUE if the image undo has been thawed",
 
450
                                                         FALSE,
 
451
                                                         GIMP_PARAM_READWRITE));
 
452
  gimp_pdb_register_procedure (pdb, procedure);
 
453
  g_object_unref (procedure);
 
454
}