~ubuntu-branches/ubuntu/vivid/gimp/vivid

« back to all changes in this revision

Viewing changes to app/core/gimpimage-undo.c

  • Committer: Package Import Robot
  • Author(s): Jordi Mallach
  • Date: 2012-05-08 18:50:03 UTC
  • mto: (1.1.26) (0.5.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 71.
  • Revision ID: package-import@ubuntu.com-20120508185003-tltkvbaysf8d2426
ImportĀ upstreamĀ versionĀ 2.8.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* GIMP - The GNU Image Manipulation Program
2
2
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
3
3
 *
4
 
 * This program is free software; you can redistribute it and/or modify
 
4
 * This program is free software: you can redistribute it and/or modify
5
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
 
6
 * the Free Software Foundation; either version 3 of the License, or
7
7
 * (at your option) any later version.
8
8
 *
9
9
 * This program is distributed in the hope that it will be useful,
12
12
 * GNU General Public License for more details.
13
13
 *
14
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.
 
15
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
16
 */
18
17
 
19
18
#include "config.h"
20
19
 
21
 
#include <glib-object.h>
 
20
#include <gegl.h>
22
21
 
23
22
#include "core-types.h"
24
23
 
28
27
#include "gimp-utils.h"
29
28
#include "gimpdrawableundo.h"
30
29
#include "gimpimage.h"
 
30
#include "gimpimage-private.h"
31
31
#include "gimpimage-undo.h"
32
32
#include "gimpitem.h"
33
33
#include "gimplist.h"
49
49
/*  public functions  */
50
50
 
51
51
gboolean
 
52
gimp_image_undo_is_enabled (const GimpImage *image)
 
53
{
 
54
  g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
 
55
 
 
56
  return (GIMP_IMAGE_GET_PRIVATE (image)->undo_freeze_count == 0);
 
57
}
 
58
 
 
59
gboolean
 
60
gimp_image_undo_enable (GimpImage *image)
 
61
{
 
62
  g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
 
63
 
 
64
  /*  Free all undo steps as they are now invalidated  */
 
65
  gimp_image_undo_free (image);
 
66
 
 
67
  return gimp_image_undo_thaw (image);
 
68
}
 
69
 
 
70
gboolean
 
71
gimp_image_undo_disable (GimpImage *image)
 
72
{
 
73
  g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
 
74
 
 
75
  return gimp_image_undo_freeze (image);
 
76
}
 
77
 
 
78
gboolean
 
79
gimp_image_undo_freeze (GimpImage *image)
 
80
{
 
81
  GimpImagePrivate *private;
 
82
 
 
83
  g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
 
84
 
 
85
  private = GIMP_IMAGE_GET_PRIVATE (image);
 
86
 
 
87
  private->undo_freeze_count++;
 
88
 
 
89
  if (private->undo_freeze_count == 1)
 
90
    gimp_image_undo_event (image, GIMP_UNDO_EVENT_UNDO_FREEZE, NULL);
 
91
 
 
92
  return TRUE;
 
93
}
 
94
 
 
95
gboolean
 
96
gimp_image_undo_thaw (GimpImage *image)
 
97
{
 
98
  GimpImagePrivate *private;
 
99
 
 
100
  g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
 
101
 
 
102
  private = GIMP_IMAGE_GET_PRIVATE (image);
 
103
 
 
104
  g_return_val_if_fail (private->undo_freeze_count > 0, FALSE);
 
105
 
 
106
  private->undo_freeze_count--;
 
107
 
 
108
  if (private->undo_freeze_count == 0)
 
109
    gimp_image_undo_event (image, GIMP_UNDO_EVENT_UNDO_THAW, NULL);
 
110
 
 
111
  return TRUE;
 
112
}
 
113
 
 
114
gboolean
52
115
gimp_image_undo (GimpImage *image)
53
116
{
 
117
  GimpImagePrivate *private;
 
118
 
54
119
  g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
55
 
  g_return_val_if_fail (image->pushing_undo_group == GIMP_UNDO_GROUP_NONE,
 
120
 
 
121
  private = GIMP_IMAGE_GET_PRIVATE (image);
 
122
 
 
123
  g_return_val_if_fail (private->pushing_undo_group == GIMP_UNDO_GROUP_NONE,
56
124
                        FALSE);
57
125
 
58
126
  gimp_image_undo_pop_stack (image,
59
 
                             image->undo_stack,
60
 
                             image->redo_stack,
 
127
                             private->undo_stack,
 
128
                             private->redo_stack,
61
129
                             GIMP_UNDO_MODE_UNDO);
62
130
 
63
131
  return TRUE;
64
132
}
65
133
 
 
134
gboolean
 
135
gimp_image_redo (GimpImage *image)
 
136
{
 
137
  GimpImagePrivate *private;
 
138
 
 
139
  g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
 
140
 
 
141
  private = GIMP_IMAGE_GET_PRIVATE (image);
 
142
 
 
143
  g_return_val_if_fail (private->pushing_undo_group == GIMP_UNDO_GROUP_NONE,
 
144
                        FALSE);
 
145
 
 
146
  gimp_image_undo_pop_stack (image,
 
147
                             private->redo_stack,
 
148
                             private->undo_stack,
 
149
                             GIMP_UNDO_MODE_REDO);
 
150
 
 
151
  return TRUE;
 
152
}
 
153
 
66
154
/*
67
155
 * this function continues to undo as long as it only sees certain
68
156
 * undo types, in particular visibility changes.
70
158
gboolean
71
159
gimp_image_strong_undo (GimpImage *image)
72
160
{
73
 
  GimpUndo *undo;
 
161
  GimpImagePrivate *private;
 
162
  GimpUndo         *undo;
74
163
 
75
164
  g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
76
 
  g_return_val_if_fail (image->pushing_undo_group == GIMP_UNDO_GROUP_NONE,
 
165
 
 
166
  private = GIMP_IMAGE_GET_PRIVATE (image);
 
167
 
 
168
  g_return_val_if_fail (private->pushing_undo_group == GIMP_UNDO_GROUP_NONE,
77
169
                        FALSE);
78
170
 
79
 
  undo = gimp_undo_stack_peek (image->undo_stack);
 
171
  undo = gimp_undo_stack_peek (private->undo_stack);
80
172
 
81
173
  gimp_image_undo (image);
82
174
 
83
175
  while (gimp_undo_is_weak (undo))
84
176
    {
85
 
      undo = gimp_undo_stack_peek (image->undo_stack);
 
177
      undo = gimp_undo_stack_peek (private->undo_stack);
86
178
      if (gimp_undo_is_weak (undo))
87
179
        gimp_image_undo (image);
88
180
    }
90
182
  return TRUE;
91
183
}
92
184
 
93
 
gboolean
94
 
gimp_image_redo (GimpImage *image)
95
 
{
96
 
  g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
97
 
  g_return_val_if_fail (image->pushing_undo_group == GIMP_UNDO_GROUP_NONE,
98
 
                        FALSE);
99
 
 
100
 
  gimp_image_undo_pop_stack (image,
101
 
                             image->redo_stack,
102
 
                             image->undo_stack,
103
 
                             GIMP_UNDO_MODE_REDO);
104
 
 
105
 
  return TRUE;
106
 
}
107
 
 
108
185
/*
109
186
 * this function continues to redo as long as it only sees certain
110
187
 * undo types, in particular visibility changes.  Note that the
114
191
gboolean
115
192
gimp_image_strong_redo (GimpImage *image)
116
193
{
117
 
  GimpUndo *undo;
 
194
  GimpImagePrivate *private;
 
195
  GimpUndo         *undo;
118
196
 
119
197
  g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
120
 
  g_return_val_if_fail (image->pushing_undo_group == GIMP_UNDO_GROUP_NONE,
 
198
 
 
199
  private = GIMP_IMAGE_GET_PRIVATE (image);
 
200
 
 
201
  g_return_val_if_fail (private->pushing_undo_group == GIMP_UNDO_GROUP_NONE,
121
202
                        FALSE);
122
203
 
123
 
  undo = gimp_undo_stack_peek (image->redo_stack);
 
204
  undo = gimp_undo_stack_peek (private->redo_stack);
124
205
 
125
206
  gimp_image_redo (image);
126
207
 
127
208
  while (gimp_undo_is_weak (undo))
128
209
    {
129
 
      undo = gimp_undo_stack_peek (image->redo_stack);
 
210
      undo = gimp_undo_stack_peek (private->redo_stack);
130
211
      if (gimp_undo_is_weak (undo))
131
212
        gimp_image_redo (image);
132
213
    }
134
215
  return TRUE;
135
216
}
136
217
 
 
218
GimpUndoStack *
 
219
gimp_image_get_undo_stack (const GimpImage *image)
 
220
{
 
221
  g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
 
222
 
 
223
  return GIMP_IMAGE_GET_PRIVATE (image)->undo_stack;
 
224
}
 
225
 
 
226
GimpUndoStack *
 
227
gimp_image_get_redo_stack (const GimpImage *image)
 
228
{
 
229
  g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
 
230
 
 
231
  return GIMP_IMAGE_GET_PRIVATE (image)->redo_stack;
 
232
}
 
233
 
137
234
void
138
235
gimp_image_undo_free (GimpImage *image)
139
236
{
 
237
  GimpImagePrivate *private;
 
238
 
140
239
  g_return_if_fail (GIMP_IS_IMAGE (image));
141
240
 
 
241
  private = GIMP_IMAGE_GET_PRIVATE (image);
 
242
 
142
243
  /*  Emit the UNDO_FREE event before actually freeing everything
143
244
   *  so the views can properly detach from the undo items
144
245
   */
145
246
  gimp_image_undo_event (image, GIMP_UNDO_EVENT_UNDO_FREE, NULL);
146
247
 
147
 
  gimp_undo_free (GIMP_UNDO (image->undo_stack), GIMP_UNDO_MODE_UNDO);
148
 
  gimp_undo_free (GIMP_UNDO (image->redo_stack), GIMP_UNDO_MODE_REDO);
 
248
  gimp_undo_free (GIMP_UNDO (private->undo_stack), GIMP_UNDO_MODE_UNDO);
 
249
  gimp_undo_free (GIMP_UNDO (private->redo_stack), GIMP_UNDO_MODE_REDO);
149
250
 
150
251
  /* If the image was dirty, but could become clean by redo-ing
151
252
   * some actions, then it should now become 'infinitely' dirty.
152
253
   * This is because we've just nuked the actions that would allow
153
254
   * the image to become clean again.
154
255
   */
155
 
  if (image->dirty < 0)
156
 
    image->dirty = 100000;
 
256
  if (private->dirty < 0)
 
257
    private->dirty = 100000;
157
258
 
158
259
  /* The same applies to the case where the image would become clean
159
260
   * due to undo actions, but since user can't undo without an undo
161
262
   */
162
263
}
163
264
 
 
265
gint
 
266
gimp_image_get_undo_group_count (const GimpImage *image)
 
267
{
 
268
  g_return_val_if_fail (GIMP_IS_IMAGE (image), 0);
 
269
 
 
270
  return GIMP_IMAGE_GET_PRIVATE (image)->group_count;
 
271
}
 
272
 
164
273
gboolean
165
274
gimp_image_undo_group_start (GimpImage    *image,
166
275
                             GimpUndoType  undo_type,
167
276
                             const gchar  *name)
168
277
{
169
 
  GimpUndoStack *undo_group;
170
 
  GimpDirtyMask  dirty_mask;
 
278
  GimpImagePrivate *private;
 
279
  GimpUndoStack    *undo_group;
 
280
  GimpDirtyMask     dirty_mask;
171
281
 
172
282
  g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
173
283
  g_return_val_if_fail (undo_type >  GIMP_UNDO_GROUP_FIRST &&
174
284
                        undo_type <= GIMP_UNDO_GROUP_LAST, FALSE);
175
285
 
 
286
  private = GIMP_IMAGE_GET_PRIVATE (image);
 
287
 
176
288
  if (! name)
177
289
    name = gimp_undo_type_to_name (undo_type);
178
290
 
179
291
  dirty_mask = gimp_image_undo_dirty_from_type (undo_type);
180
292
 
181
293
  /* Notify listeners that the image will be modified */
182
 
  if (image->group_count == 0 && dirty_mask != GIMP_DIRTY_NONE)
 
294
  if (private->group_count == 0 && dirty_mask != GIMP_DIRTY_NONE)
183
295
    gimp_image_dirty (image, dirty_mask);
184
296
 
185
 
  if (image->undo_freeze_count > 0)
 
297
  if (private->undo_freeze_count > 0)
186
298
    return FALSE;
187
299
 
188
 
  image->group_count++;
 
300
  private->group_count++;
189
301
 
190
302
  /*  If we're already in a group...ignore  */
191
 
  if (image->group_count > 1)
 
303
  if (private->group_count > 1)
192
304
    return TRUE;
193
305
 
194
306
  /*  nuke the redo stack  */
200
312
  GIMP_UNDO (undo_group)->undo_type  = undo_type;
201
313
  GIMP_UNDO (undo_group)->dirty_mask = dirty_mask;
202
314
 
203
 
  gimp_undo_stack_push_undo (image->undo_stack, GIMP_UNDO (undo_group));
 
315
  gimp_undo_stack_push_undo (private->undo_stack, GIMP_UNDO (undo_group));
204
316
 
205
 
  image->pushing_undo_group = undo_type;
 
317
  private->pushing_undo_group = undo_type;
206
318
 
207
319
  return TRUE;
208
320
}
210
322
gboolean
211
323
gimp_image_undo_group_end (GimpImage *image)
212
324
{
 
325
  GimpImagePrivate *private;
 
326
 
213
327
  g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
214
328
 
215
 
  if (image->undo_freeze_count > 0)
 
329
  private = GIMP_IMAGE_GET_PRIVATE (image);
 
330
 
 
331
  if (private->undo_freeze_count > 0)
216
332
    return FALSE;
217
333
 
218
 
  g_return_val_if_fail (image->group_count > 0, FALSE);
219
 
 
220
 
  image->group_count--;
221
 
 
222
 
  if (image->group_count == 0)
 
334
  g_return_val_if_fail (private->group_count > 0, FALSE);
 
335
 
 
336
  private->group_count--;
 
337
 
 
338
  if (private->group_count == 0)
223
339
    {
224
 
      image->pushing_undo_group = GIMP_UNDO_GROUP_NONE;
 
340
      private->pushing_undo_group = GIMP_UNDO_GROUP_NONE;
225
341
 
226
342
      /* Do it here, since undo_push doesn't emit this event while in
227
343
       * the middle of a group
228
344
       */
229
345
      gimp_image_undo_event (image, GIMP_UNDO_EVENT_UNDO_PUSHED,
230
 
                             gimp_undo_stack_peek (image->undo_stack));
 
346
                             gimp_undo_stack_peek (private->undo_stack));
231
347
 
232
348
      gimp_image_undo_free_space (image);
233
349
    }
243
359
                      GimpDirtyMask  dirty_mask,
244
360
                      ...)
245
361
{
246
 
  GParameter *params   = NULL;
247
 
  gint        n_params = 0;
248
 
  va_list     args;
249
 
  GimpUndo   *undo;
 
362
  GimpImagePrivate *private;
 
363
  GParameter       *params   = NULL;
 
364
  gint              n_params = 0;
 
365
  va_list           args;
 
366
  GimpUndo         *undo;
250
367
 
251
368
  g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
252
369
  g_return_val_if_fail (g_type_is_a (object_type, GIMP_TYPE_UNDO), NULL);
253
370
  g_return_val_if_fail (undo_type > GIMP_UNDO_GROUP_LAST, NULL);
254
371
 
 
372
  private = GIMP_IMAGE_GET_PRIVATE (image);
 
373
 
255
374
  /* Does this undo dirty the image?  If so, we always want to mark
256
375
   * image dirty, even if we can't actually push the undo.
257
376
   */
258
377
  if (dirty_mask != GIMP_DIRTY_NONE)
259
378
    gimp_image_dirty (image, dirty_mask);
260
379
 
261
 
  if (image->undo_freeze_count > 0)
 
380
  if (private->undo_freeze_count > 0)
262
381
    return NULL;
263
382
 
264
383
  if (! name)
282
401
  /*  nuke the redo stack  */
283
402
  gimp_image_undo_free_redo (image);
284
403
 
285
 
  if (image->pushing_undo_group == GIMP_UNDO_GROUP_NONE)
 
404
  if (private->pushing_undo_group == GIMP_UNDO_GROUP_NONE)
286
405
    {
287
 
      gimp_undo_stack_push_undo (image->undo_stack, undo);
 
406
      gimp_undo_stack_push_undo (private->undo_stack, undo);
288
407
 
289
408
      gimp_image_undo_event (image, GIMP_UNDO_EVENT_UNDO_PUSHED, undo);
290
409
 
291
410
      gimp_image_undo_free_space (image);
292
411
 
293
412
      /*  freeing undo space may have freed the newly pushed undo  */
294
 
      if (gimp_undo_stack_peek (image->undo_stack) == undo)
 
413
      if (gimp_undo_stack_peek (private->undo_stack) == undo)
295
414
        return undo;
296
415
    }
297
416
  else
298
417
    {
299
418
      GimpUndoStack *undo_group;
300
419
 
301
 
      undo_group = GIMP_UNDO_STACK (gimp_undo_stack_peek (image->undo_stack));
 
420
      undo_group = GIMP_UNDO_STACK (gimp_undo_stack_peek (private->undo_stack));
302
421
 
303
422
      gimp_undo_stack_push_undo (undo_group, undo);
304
423
 
313
432
                              GType         object_type,
314
433
                              GimpUndoType  undo_type)
315
434
{
 
435
  GimpImagePrivate *private;
 
436
 
316
437
  g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
317
438
 
318
 
  if (image->dirty != 0 && ! gimp_undo_stack_peek (image->redo_stack))
 
439
  private = GIMP_IMAGE_GET_PRIVATE (image);
 
440
 
 
441
  if (gimp_image_is_dirty (image) &&
 
442
      ! gimp_undo_stack_peek (private->redo_stack))
319
443
    {
320
 
      GimpUndo *undo = gimp_undo_stack_peek (image->undo_stack);
 
444
      GimpUndo *undo = gimp_undo_stack_peek (private->undo_stack);
321
445
 
322
446
      if (undo && undo->undo_type == undo_type &&
323
447
          g_type_is_a (G_TYPE_FROM_INSTANCE (undo), object_type))
332
456
GimpUndo *
333
457
gimp_image_undo_get_fadeable (GimpImage *image)
334
458
{
335
 
  GimpUndo *undo;
 
459
  GimpImagePrivate *private;
 
460
  GimpUndo         *undo;
336
461
 
337
462
  g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
338
463
 
339
 
  undo = gimp_undo_stack_peek (image->undo_stack);
 
464
  private = GIMP_IMAGE_GET_PRIVATE (image);
 
465
 
 
466
  undo = gimp_undo_stack_peek (private->undo_stack);
340
467
 
341
468
  if (GIMP_IS_UNDO_STACK (undo) && undo->undo_type == GIMP_UNDO_GROUP_PAINT)
342
469
    {
393
520
      if (accum.unit_changed)
394
521
        gimp_image_unit_changed (image);
395
522
 
396
 
      if (accum.quick_mask_changed)
397
 
        gimp_image_quick_mask_changed (image);
398
 
 
399
 
      if (accum.alpha_changed)
400
 
        gimp_image_alpha_changed (image);
401
 
 
402
523
      /* let others know that we just popped an action */
403
524
      gimp_image_undo_event (image,
404
525
                             (undo_mode == GIMP_UNDO_MODE_UNDO) ?
412
533
static void
413
534
gimp_image_undo_free_space (GimpImage *image)
414
535
{
415
 
  GimpContainer *container;
416
 
  gint           min_undo_levels;
417
 
  gint           max_undo_levels;
418
 
  gint64         undo_size;
 
536
  GimpImagePrivate *private = GIMP_IMAGE_GET_PRIVATE (image);
 
537
  GimpContainer    *container;
 
538
  gint              min_undo_levels;
 
539
  gint              max_undo_levels;
 
540
  gint64            undo_size;
419
541
 
420
 
  container = image->undo_stack->undos;
 
542
  container = private->undo_stack->undos;
421
543
 
422
544
  min_undo_levels = image->gimp->config->levels_of_undo;
423
545
  max_undo_levels = 1024; /* FIXME */
425
547
 
426
548
#ifdef DEBUG_IMAGE_UNDO
427
549
  g_printerr ("undo_steps: %d    undo_bytes: %ld\n",
428
 
              gimp_container_num_children (container),
 
550
              gimp_container_get_n_children (container),
429
551
              (glong) gimp_object_get_memsize (GIMP_OBJECT (container), NULL));
430
552
#endif
431
553
 
432
554
  /*  keep at least min_undo_levels undo steps  */
433
 
  if (gimp_container_num_children (container) <= min_undo_levels)
 
555
  if (gimp_container_get_n_children (container) <= min_undo_levels)
434
556
    return;
435
557
 
436
558
  while ((gimp_object_get_memsize (GIMP_OBJECT (container), NULL) > undo_size) ||
437
 
         (gimp_container_num_children (container) > max_undo_levels))
 
559
         (gimp_container_get_n_children (container) > max_undo_levels))
438
560
    {
439
 
      GimpUndo *freed = gimp_undo_stack_free_bottom (image->undo_stack,
 
561
      GimpUndo *freed = gimp_undo_stack_free_bottom (private->undo_stack,
440
562
                                                     GIMP_UNDO_MODE_UNDO);
441
563
 
442
564
#ifdef DEBUG_IMAGE_UNDO
443
565
      g_printerr ("freed one step: undo_steps: %d    undo_bytes: %ld\n",
444
 
                  gimp_container_num_children (container),
 
566
                  gimp_container_get_n_children (container),
445
567
                  (glong) gimp_object_get_memsize (GIMP_OBJECT (container),
446
568
                                                   NULL));
447
569
#endif
450
572
 
451
573
      g_object_unref (freed);
452
574
 
453
 
      if (gimp_container_num_children (container) <= min_undo_levels)
 
575
      if (gimp_container_get_n_children (container) <= min_undo_levels)
454
576
        return;
455
577
    }
456
578
}
458
580
static void
459
581
gimp_image_undo_free_redo (GimpImage *image)
460
582
{
461
 
  GimpContainer *container = image->redo_stack->undos;
 
583
  GimpImagePrivate *private   = GIMP_IMAGE_GET_PRIVATE (image);
 
584
  GimpContainer    *container = private->redo_stack->undos;
462
585
 
463
586
#ifdef DEBUG_IMAGE_UNDO
464
587
  g_printerr ("redo_steps: %d    redo_bytes: %ld\n",
465
 
              gimp_container_num_children (container),
 
588
              gimp_container_get_n_children (container),
466
589
              (glong) gimp_object_get_memsize (GIMP_OBJECT (container), NULL));
467
590
#endif
468
591
 
469
592
  if (gimp_container_is_empty (container))
470
593
    return;
471
594
 
472
 
  while (gimp_container_num_children (container) > 0)
 
595
  while (gimp_container_get_n_children (container) > 0)
473
596
    {
474
 
      GimpUndo *freed = gimp_undo_stack_free_bottom (image->redo_stack,
 
597
      GimpUndo *freed = gimp_undo_stack_free_bottom (private->redo_stack,
475
598
                                                     GIMP_UNDO_MODE_REDO);
476
599
 
477
600
#ifdef DEBUG_IMAGE_UNDO
478
601
      g_printerr ("freed one step: redo_steps: %d    redo_bytes: %ld\n",
479
 
                  gimp_container_num_children (container),
 
602
                  gimp_container_get_n_children (container),
480
603
                  (glong )gimp_object_get_memsize (GIMP_OBJECT (container),
481
604
                                                   NULL));
482
605
#endif
489
612
  /* We need to use <= here because the undo counter has already been
490
613
   * incremented at this point.
491
614
   */
492
 
  if (image->dirty <= 0)
 
615
  if (private->dirty <= 0)
493
616
    {
494
617
      /* If the image was dirty, but could become clean by redo-ing
495
618
       * some actions, then it should now become 'infinitely' dirty.
496
619
       * This is because we've just nuked the actions that would allow
497
620
       * the image to become clean again.
498
621
       */
499
 
      image->dirty = 100000;
 
622
      private->dirty = 100000;
500
623
    }
501
624
}
502
625
 
554
677
    case GIMP_UNDO_GROUP_FS_TO_LAYER:
555
678
    case GIMP_UNDO_GROUP_FS_FLOAT:
556
679
    case GIMP_UNDO_GROUP_FS_ANCHOR:
557
 
    case GIMP_UNDO_GROUP_FS_REMOVE:
558
680
      return GIMP_DIRTY_IMAGE_STRUCTURE;
559
681
 
560
682
    case GIMP_UNDO_GROUP_EDIT_PASTE: