Commit 75e8e387 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann
Browse files

app/Makefile.am app/apptypes.h app/gimpimage-undo.[ch] app/gimpundo.[ch]

2001-03-05  Sven Neumann  <sven@gimp.org>

	* app/Makefile.am
	* app/apptypes.h
	* app/gimpimage-undo.[ch]
	* app/gimpundo.[ch]
	* app/gimpundostack.[ch]: added new GimpUndo and GimpUndoStack objects
	which will be used for the upcoming new undo system. Actually my
	current plan for the undo system is to keep it pretty much as it is...

	* app/gimpimage.[ch]: added new GimpUndoStacks but temporarily kept
	old GSLists around, so I don't break everything now.
parent a1778515
2001-03-05 Sven Neumann <sven@gimp.org>
* app/Makefile.am
* app/apptypes.h
* app/gimpimage-undo.[ch]
* app/gimpundo.[ch]
* app/gimpundostack.[ch]: added new GimpUndo and GimpUndoStack objects
which will be used for the upcoming new undo system. Actually my
current plan for the undo system is to keep it pretty much as it is...
* app/gimpimage.[ch]: added new GimpUndoStacks but temporarily kept
old GSLists around, so I don't break everything now.
2001-03-04 Michael Natterer <mitch@gimp.org>
* app/gimpbrushpreview.c
......
......@@ -130,6 +130,8 @@ gimp_SOURCES = \
gimphistogram.h \
gimpimage.c \
gimpimage.h \
gimpimage-undo.c \
gimpimage-undo.h \
gimplayer.c \
gimplayer.h \
gimplayermask.c \
......@@ -158,6 +160,10 @@ gimp_SOURCES = \
gimprc.h \
gimpui.c \
gimpui.h \
gimpundo.c \
gimpundo.h \
gimpundostack.c \
gimpundostack.h \
gimpunit.c \
gimpviewable.c \
gimpviewable.h \
......
......@@ -82,6 +82,12 @@ typedef struct _GimpPaintTool GimpPaintTool;
typedef struct _GimpDrawTool GimpDrawTool;
/* undo objects */
typedef struct _GimpUndo GimpUndo;
typedef struct _GimpUndoStack GimpUndoStack;
/* widgets */
typedef struct _GimpPreview GimpPreview;
......
......@@ -34,12 +34,14 @@
#include "gimage_mask.h"
#include "gimpcontext.h"
#include "gimpimage.h"
#include "gimpimage-undo.h"
#include "gimplayer.h"
#include "gimplayermask.h"
#include "gimplist.h"
#include "gimpmarshal.h"
#include "gimprc.h"
#include "gimpparasite.h"
#include "gimpundostack.h"
#include "paint_funcs.h"
#include "parasitelist.h"
#include "path.h"
......@@ -293,7 +295,7 @@ gimp_image_class_init (GimpImageClass *klass)
gtk_marshal_NONE__INT,
GTK_TYPE_NONE, 1,
GTK_TYPE_INT);
gtk_object_class_add_signals (object_class, gimp_image_signals, LAST_SIGNAL);
object_class->destroy = gimp_image_destroy;
......@@ -311,6 +313,8 @@ gimp_image_class_init (GimpImageClass *klass)
klass->restructure = NULL;
klass->colormap_changed = NULL;
klass->undo_event = NULL;
klass->undo = gimp_image_undo;
klass->redo = gimp_image_redo;
}
......@@ -378,6 +382,9 @@ gimp_image_init (GimpImage *gimage)
gimage->pushing_undo_group = UNDO_NULL;
gimage->undo_history = NULL;
gimage->new_undo_stack = gimp_undo_stack_new (gimage);
gimage->new_redo_stack = gimp_undo_stack_new (gimage);
gimage->comp_preview = NULL;
gimage->comp_preview_valid = FALSE;
}
......@@ -404,6 +411,9 @@ gimp_image_destroy (GtkObject *object)
if (gimage->parasites)
gtk_object_unref (GTK_OBJECT (gimage->parasites));
gtk_object_unref (GTK_OBJECT (gimage->new_undo_stack));
gtk_object_unref (GTK_OBJECT (gimage->new_redo_stack));
}
static void
......
......@@ -124,7 +124,7 @@ struct _GimpImage
gboolean qmask_state; /* TRUE if qmask is on */
GimpRGB qmask_color; /* rgba triplet of the color */
/* Undo apparatus */
/* Old undo apparatus */
GSList *undo_stack; /* stack for undo operations */
GSList *redo_stack; /* stack for redo operations */
gint undo_bytes; /* bytes in undo stack */
......@@ -133,6 +133,10 @@ struct _GimpImage
UndoType pushing_undo_group; /* undo group status flag */
GtkWidget *undo_history; /* history viewer, or NULL */
/* New undo apparatus */
GimpUndoStack *new_undo_stack; /* stack for undo operations */
GimpUndoStack *new_redo_stack; /* stack for redo operations */
/* Composite preview */
TempBuf *comp_preview; /* the composite preview */
gboolean comp_preview_valid; /* preview valid-1/channel */
......@@ -157,6 +161,9 @@ struct _GimpImageClass
gint color_index);
void (* undo_event) (GimpImage *gimage,
gint event);
void (* undo) (GimpImage *gimage);
void (* redo) (GimpImage *gimage);
};
......
......@@ -34,12 +34,14 @@
#include "gimage_mask.h"
#include "gimpcontext.h"
#include "gimpimage.h"
#include "gimpimage-undo.h"
#include "gimplayer.h"
#include "gimplayermask.h"
#include "gimplist.h"
#include "gimpmarshal.h"
#include "gimprc.h"
#include "gimpparasite.h"
#include "gimpundostack.h"
#include "paint_funcs.h"
#include "parasitelist.h"
#include "path.h"
......@@ -293,7 +295,7 @@ gimp_image_class_init (GimpImageClass *klass)
gtk_marshal_NONE__INT,
GTK_TYPE_NONE, 1,
GTK_TYPE_INT);
gtk_object_class_add_signals (object_class, gimp_image_signals, LAST_SIGNAL);
object_class->destroy = gimp_image_destroy;
......@@ -311,6 +313,8 @@ gimp_image_class_init (GimpImageClass *klass)
klass->restructure = NULL;
klass->colormap_changed = NULL;
klass->undo_event = NULL;
klass->undo = gimp_image_undo;
klass->redo = gimp_image_redo;
}
......@@ -378,6 +382,9 @@ gimp_image_init (GimpImage *gimage)
gimage->pushing_undo_group = UNDO_NULL;
gimage->undo_history = NULL;
gimage->new_undo_stack = gimp_undo_stack_new (gimage);
gimage->new_redo_stack = gimp_undo_stack_new (gimage);
gimage->comp_preview = NULL;
gimage->comp_preview_valid = FALSE;
}
......@@ -404,6 +411,9 @@ gimp_image_destroy (GtkObject *object)
if (gimage->parasites)
gtk_object_unref (GTK_OBJECT (gimage->parasites));
gtk_object_unref (GTK_OBJECT (gimage->new_undo_stack));
gtk_object_unref (GTK_OBJECT (gimage->new_redo_stack));
}
static void
......
......@@ -124,7 +124,7 @@ struct _GimpImage
gboolean qmask_state; /* TRUE if qmask is on */
GimpRGB qmask_color; /* rgba triplet of the color */
/* Undo apparatus */
/* Old undo apparatus */
GSList *undo_stack; /* stack for undo operations */
GSList *redo_stack; /* stack for redo operations */
gint undo_bytes; /* bytes in undo stack */
......@@ -133,6 +133,10 @@ struct _GimpImage
UndoType pushing_undo_group; /* undo group status flag */
GtkWidget *undo_history; /* history viewer, or NULL */
/* New undo apparatus */
GimpUndoStack *new_undo_stack; /* stack for undo operations */
GimpUndoStack *new_redo_stack; /* stack for redo operations */
/* Composite preview */
TempBuf *comp_preview; /* the composite preview */
gboolean comp_preview_valid; /* preview valid-1/channel */
......@@ -157,6 +161,9 @@ struct _GimpImageClass
gint color_index);
void (* undo_event) (GimpImage *gimage,
gint event);
void (* undo) (GimpImage *gimage);
void (* redo) (GimpImage *gimage);
};
......
......@@ -34,12 +34,14 @@
#include "gimage_mask.h"
#include "gimpcontext.h"
#include "gimpimage.h"
#include "gimpimage-undo.h"
#include "gimplayer.h"
#include "gimplayermask.h"
#include "gimplist.h"
#include "gimpmarshal.h"
#include "gimprc.h"
#include "gimpparasite.h"
#include "gimpundostack.h"
#include "paint_funcs.h"
#include "parasitelist.h"
#include "path.h"
......@@ -293,7 +295,7 @@ gimp_image_class_init (GimpImageClass *klass)
gtk_marshal_NONE__INT,
GTK_TYPE_NONE, 1,
GTK_TYPE_INT);
gtk_object_class_add_signals (object_class, gimp_image_signals, LAST_SIGNAL);
object_class->destroy = gimp_image_destroy;
......@@ -311,6 +313,8 @@ gimp_image_class_init (GimpImageClass *klass)
klass->restructure = NULL;
klass->colormap_changed = NULL;
klass->undo_event = NULL;
klass->undo = gimp_image_undo;
klass->redo = gimp_image_redo;
}
......@@ -378,6 +382,9 @@ gimp_image_init (GimpImage *gimage)
gimage->pushing_undo_group = UNDO_NULL;
gimage->undo_history = NULL;
gimage->new_undo_stack = gimp_undo_stack_new (gimage);
gimage->new_redo_stack = gimp_undo_stack_new (gimage);
gimage->comp_preview = NULL;
gimage->comp_preview_valid = FALSE;
}
......@@ -404,6 +411,9 @@ gimp_image_destroy (GtkObject *object)
if (gimage->parasites)
gtk_object_unref (GTK_OBJECT (gimage->parasites));
gtk_object_unref (GTK_OBJECT (gimage->new_undo_stack));
gtk_object_unref (GTK_OBJECT (gimage->new_redo_stack));
}
static void
......
......@@ -124,7 +124,7 @@ struct _GimpImage
gboolean qmask_state; /* TRUE if qmask is on */
GimpRGB qmask_color; /* rgba triplet of the color */
/* Undo apparatus */
/* Old undo apparatus */
GSList *undo_stack; /* stack for undo operations */
GSList *redo_stack; /* stack for redo operations */
gint undo_bytes; /* bytes in undo stack */
......@@ -133,6 +133,10 @@ struct _GimpImage
UndoType pushing_undo_group; /* undo group status flag */
GtkWidget *undo_history; /* history viewer, or NULL */
/* New undo apparatus */
GimpUndoStack *new_undo_stack; /* stack for undo operations */
GimpUndoStack *new_redo_stack; /* stack for redo operations */
/* Composite preview */
TempBuf *comp_preview; /* the composite preview */
gboolean comp_preview_valid; /* preview valid-1/channel */
......@@ -157,6 +161,9 @@ struct _GimpImageClass
gint color_index);
void (* undo_event) (GimpImage *gimage,
gint event);
void (* undo) (GimpImage *gimage);
void (* redo) (GimpImage *gimage);
};
......
......@@ -34,12 +34,14 @@
#include "gimage_mask.h"
#include "gimpcontext.h"
#include "gimpimage.h"
#include "gimpimage-undo.h"
#include "gimplayer.h"
#include "gimplayermask.h"
#include "gimplist.h"
#include "gimpmarshal.h"
#include "gimprc.h"
#include "gimpparasite.h"
#include "gimpundostack.h"
#include "paint_funcs.h"
#include "parasitelist.h"
#include "path.h"
......@@ -293,7 +295,7 @@ gimp_image_class_init (GimpImageClass *klass)
gtk_marshal_NONE__INT,
GTK_TYPE_NONE, 1,
GTK_TYPE_INT);
gtk_object_class_add_signals (object_class, gimp_image_signals, LAST_SIGNAL);
object_class->destroy = gimp_image_destroy;
......@@ -311,6 +313,8 @@ gimp_image_class_init (GimpImageClass *klass)
klass->restructure = NULL;
klass->colormap_changed = NULL;
klass->undo_event = NULL;
klass->undo = gimp_image_undo;
klass->redo = gimp_image_redo;
}
......@@ -378,6 +382,9 @@ gimp_image_init (GimpImage *gimage)
gimage->pushing_undo_group = UNDO_NULL;
gimage->undo_history = NULL;
gimage->new_undo_stack = gimp_undo_stack_new (gimage);
gimage->new_redo_stack = gimp_undo_stack_new (gimage);
gimage->comp_preview = NULL;
gimage->comp_preview_valid = FALSE;
}
......@@ -404,6 +411,9 @@ gimp_image_destroy (GtkObject *object)
if (gimage->parasites)
gtk_object_unref (GTK_OBJECT (gimage->parasites));
gtk_object_unref (GTK_OBJECT (gimage->new_undo_stack));
gtk_object_unref (GTK_OBJECT (gimage->new_redo_stack));
}
static void
......
......@@ -124,7 +124,7 @@ struct _GimpImage
gboolean qmask_state; /* TRUE if qmask is on */
GimpRGB qmask_color; /* rgba triplet of the color */
/* Undo apparatus */
/* Old undo apparatus */
GSList *undo_stack; /* stack for undo operations */
GSList *redo_stack; /* stack for redo operations */
gint undo_bytes; /* bytes in undo stack */
......@@ -133,6 +133,10 @@ struct _GimpImage
UndoType pushing_undo_group; /* undo group status flag */
GtkWidget *undo_history; /* history viewer, or NULL */
/* New undo apparatus */
GimpUndoStack *new_undo_stack; /* stack for undo operations */
GimpUndoStack *new_redo_stack; /* stack for redo operations */
/* Composite preview */
TempBuf *comp_preview; /* the composite preview */
gboolean comp_preview_valid; /* preview valid-1/channel */
......@@ -157,6 +161,9 @@ struct _GimpImageClass
gint color_index);
void (* undo_event) (GimpImage *gimage,
gint event);
void (* undo) (GimpImage *gimage);
void (* redo) (GimpImage *gimage);
};
......
......@@ -34,12 +34,14 @@
#include "gimage_mask.h"
#include "gimpcontext.h"
#include "gimpimage.h"
#include "gimpimage-undo.h"
#include "gimplayer.h"
#include "gimplayermask.h"
#include "gimplist.h"
#include "gimpmarshal.h"
#include "gimprc.h"
#include "gimpparasite.h"
#include "gimpundostack.h"
#include "paint_funcs.h"
#include "parasitelist.h"
#include "path.h"
......@@ -293,7 +295,7 @@ gimp_image_class_init (GimpImageClass *klass)
gtk_marshal_NONE__INT,
GTK_TYPE_NONE, 1,
GTK_TYPE_INT);
gtk_object_class_add_signals (object_class, gimp_image_signals, LAST_SIGNAL);
object_class->destroy = gimp_image_destroy;
......@@ -311,6 +313,8 @@ gimp_image_class_init (GimpImageClass *klass)
klass->restructure = NULL;
klass->colormap_changed = NULL;
klass->undo_event = NULL;
klass->undo = gimp_image_undo;
klass->redo = gimp_image_redo;
}
......@@ -378,6 +382,9 @@ gimp_image_init (GimpImage *gimage)
gimage->pushing_undo_group = UNDO_NULL;
gimage->undo_history = NULL;
gimage->new_undo_stack = gimp_undo_stack_new (gimage);
gimage->new_redo_stack = gimp_undo_stack_new (gimage);
gimage->comp_preview = NULL;
gimage->comp_preview_valid = FALSE;
}
......@@ -404,6 +411,9 @@ gimp_image_destroy (GtkObject *object)
if (gimage->parasites)
gtk_object_unref (GTK_OBJECT (gimage->parasites));
gtk_object_unref (GTK_OBJECT (gimage->new_undo_stack));
gtk_object_unref (GTK_OBJECT (gimage->new_redo_stack));
}
static void
......
......@@ -124,7 +124,7 @@ struct _GimpImage
gboolean qmask_state; /* TRUE if qmask is on */
GimpRGB qmask_color; /* rgba triplet of the color */
/* Undo apparatus */
/* Old undo apparatus */
GSList *undo_stack; /* stack for undo operations */
GSList *redo_stack; /* stack for redo operations */
gint undo_bytes; /* bytes in undo stack */
......@@ -133,6 +133,10 @@ struct _GimpImage
UndoType pushing_undo_group; /* undo group status flag */
GtkWidget *undo_history; /* history viewer, or NULL */
/* New undo apparatus */
GimpUndoStack *new_undo_stack; /* stack for undo operations */
GimpUndoStack *new_redo_stack; /* stack for redo operations */
/* Composite preview */
TempBuf *comp_preview; /* the composite preview */
gboolean comp_preview_valid; /* preview valid-1/channel */
......@@ -157,6 +161,9 @@ struct _GimpImageClass
gint color_index);
void (* undo_event) (GimpImage *gimage,
gint event);
void (* undo) (GimpImage *gimage);
void (* redo) (GimpImage *gimage);
};
......
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <gtk/gtk.h>
#include "apptypes.h"
#include "gimpimage.h"
#include "gimpimage-undo.h"
#include "gimpundostack.h"
void
gimp_image_undo (GimpImage *gimage)
{
GimpUndo *undo;
undo = GIMP_UNDO (gimp_undo_stack_pop (gimage->new_undo_stack));
if (undo)
gimp_undo_stack_push (gimage->new_redo_stack, undo);
}
void
gimp_image_redo (GimpImage *gimage)
{
GimpUndo *redo;
redo = GIMP_UNDO (gimp_undo_stack_pop (gimage->new_redo_stack));
if (redo)
gimp_undo_stack_push (gimage->new_undo_stack, redo);
}
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_IMAGE_UNDO_H__
#define __GIMP_IMAGE_UNDO_H__
void gimp_image_undo (GimpImage *gimage);
void gimp_image_redo (GimpImage *gimage);
#endif /* __GIMP_IMAGE_UNDO_H__ */
......@@ -34,12 +34,14 @@
#include "gimage_mask.h"
#include "gimpcontext.h"
#include "gimpimage.h"
#include "gimpimage-undo.h"
#include "gimplayer.h"
#include "gimplayermask.h"
#include "gimplist.h"
#include "gimpmarshal.h"
#include "gimprc.h"
#include "gimpparasite.h"
#include "gimpundostack.h"
#include "paint_funcs.h"
#include "parasitelist.h"
#include "path.h"
......@@ -293,7 +295,7 @@ gimp_image_class_init (GimpImageClass *klass)
gtk_marshal_NONE__INT,
GTK_TYPE_NONE, 1,
GTK_TYPE_INT);
gtk_object_class_add_signals (object_class, gimp_image_signals, LAST_SIGNAL);
object_class->destroy = gimp_image_destroy;
......@@ -311,6 +313,8 @@ gimp_image_class_init (GimpImageClass *klass)
klass->restructure = NULL;
klass->colormap_changed = NULL;
klass->undo_event = NULL;
klass->undo = gimp_image_undo;
klass->redo = gimp_image_redo;
}
......@@ -378,6 +382,9 @@ gimp_image_init (GimpImage *gimage)
gimage->pushing_undo_group = UNDO_NULL;
gimage->undo_history = NULL;
gimage->new_undo_stack = gimp_undo_stack_new (gimage);
gimage->new_redo_stack = gimp_undo_stack_new (gimage);
gimage->comp_preview = NULL;
gimage->comp_preview_valid = FALSE;
}
......@@ -404,6 +411,9 @@ gimp_image_destroy (GtkObject *object)
if (gimage->parasites)
gtk_object_unref (GTK_OBJECT (gimage->parasites));
gtk_object_unref (GTK_OBJECT (gimage->new_undo_stack));
gtk_object_unref (GTK_OBJECT (gimage->new_redo_stack));
}
static void
......
......@@ -124,7 +124,7 @@ struct _GimpImage
gboolean qmask_state; /* TRUE if qmask is on */
GimpRGB qmask_color; /* rgba triplet of the color */
/* Undo apparatus */
/* Old undo apparatus */
GSList *undo_stack; /* stack for undo operations */
GSList *redo_stack; /* stack for redo operations */
gint undo_bytes; /* bytes in undo stack */
......@@ -133,6 +133,10 @@ struct _GimpImage
UndoType pushing_undo_group; /* undo group status flag */
GtkWidget *undo_history; /* history viewer, or NULL */
/* New undo apparatus */
GimpUndoStack *new_undo_stack; /* stack for undo operations */
GimpUndoStack *new_redo_stack; /* stack for redo operations */
/* Composite preview */
TempBuf *comp_preview; /* the composite preview */
gboolean comp_preview_valid; /* preview valid-1/channel */
......@@ -157,6 +161,9 @@ struct _GimpImageClass
gint color_index);
void (* undo_event) (GimpImage *gimage,
gint event);
void (* undo) (GimpImage *gimage);
void (* redo) (GimpImage *gimage);
};
......
......@@ -34,12 +34,14 @@
#include "gimage_mask.h"
#include "gimpcontext.h"
#include "gimpimage.h"
#include "gimpimage-undo.h"
#include "gimplayer.h"
#include "gimplayermask.h"