added parasite undo groups.

2002-02-24  Michael Natterer  <mitch@gimp.org>

	* app/core/core-types.h: added parasite undo groups.

	* app/undo.c: added assertions to make undo_push_group_start()
	accept only "UndoType" values and undo_push() only "UndoImplType".

	* app/core/gimpdrawable.c: use the new undo group and don't
	include "undo_types.h".
This commit is contained in:
Michael Natterer 2002-02-24 18:31:48 +00:00 committed by Michael Natterer
parent 7831743211
commit ab0c8fe212
5 changed files with 47 additions and 16 deletions

View File

@ -1,3 +1,13 @@
2002-02-24 Michael Natterer <mitch@gimp.org>
* app/core/core-types.h: added parasite undo groups.
* app/undo.c: added assertions to make undo_push_group_start()
accept only "UndoType" values and undo_push() only "UndoImplType".
* app/core/gimpdrawable.c: use the new undo group and don't
include "undo_types.h".
2002-02-23 Michael Natterer <mitch@gimp.org>
* app/undo_types.h

View File

@ -154,6 +154,8 @@ typedef enum /*< pdb-skip >*/ /*< skip >*/
TEXT_UNDO_GROUP,
TRANSFORM_UNDO_GROUP,
PAINT_UNDO_GROUP,
PARASITE_ATTACH_UNDO_GROUP,
PARASITE_REMOVE_UNDO_GROUP,
MISC_UNDO_GROUP,
LAST_UNDO_GROUP = MISC_UNDO_GROUP

View File

@ -50,7 +50,6 @@
#include "gimpparasitelist.h"
#include "gimppreviewcache.h"
#include "undo_types.h"
#include "undo.h"
#include "libgimp/gimpintl.h"
@ -963,7 +962,7 @@ gimp_drawable_parasite_attach (GimpDrawable *drawable,
if (gimp_parasite_is_undoable (parasite))
{
/* do a group in case we have attach_parent set */
undo_push_group_start (drawable->gimage, PARASITE_ATTACH_UNDO);
undo_push_group_start (drawable->gimage, PARASITE_ATTACH_UNDO_GROUP);
undo_push_drawable_parasite (drawable->gimage, drawable, parasite);
}

View File

@ -238,8 +238,11 @@ undo_push (GimpImage *gimage,
{
Undo *new;
g_return_val_if_fail (type > LAST_UNDO_GROUP, NULL);
/* Does this undo dirty the image? If so, we always want to mark
* image dirty, even if we can't actually push the undo. */
* image dirty, even if we can't actually push the undo.
*/
if (dirties_image)
gimp_image_dirty (gimage);
@ -601,14 +604,17 @@ undo_push_group_start (GimpImage *gimage,
{
Undo *boundary_marker;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
/* Bad idea to push NO_UNDO_GROUP as the group type, since that
* won't be recognized as the start of the group later.
*/
g_return_val_if_fail (type > FIRST_UNDO_GROUP &&
type <= LAST_UNDO_GROUP, FALSE);
if (! gimage->undo_on)
return FALSE;
/* Bad idea to push 0 as the group type, since that won't
* be recognized as the start of the group later.
*/
g_return_val_if_fail (type != 0, FALSE);
gimage->group_count ++;
TRC (("group_start (%s)\n", undo_type_to_name (type)));
@ -649,6 +655,8 @@ undo_push_group_end (GimpImage *gimage)
{
Undo *boundary_marker;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
if (! gimage->undo_on)
return FALSE;
@ -3230,6 +3238,8 @@ undo_name[] =
{ TEXT_UNDO_GROUP, N_("Text") },
{ TRANSFORM_UNDO_GROUP, N_("Transform") },
{ PAINT_UNDO_GROUP, N_("Paint") },
{ PARASITE_ATTACH_UNDO_GROUP, N_("Attach Parasite") },
{ PARASITE_REMOVE_UNDO_GROUP, N_("Remove Parasite") },
{ MISC_UNDO_GROUP, N_("Plug-In") },
{ IMAGE_UNDO, N_("Image") },

View File

@ -238,8 +238,11 @@ undo_push (GimpImage *gimage,
{
Undo *new;
g_return_val_if_fail (type > LAST_UNDO_GROUP, NULL);
/* Does this undo dirty the image? If so, we always want to mark
* image dirty, even if we can't actually push the undo. */
* image dirty, even if we can't actually push the undo.
*/
if (dirties_image)
gimp_image_dirty (gimage);
@ -601,14 +604,17 @@ undo_push_group_start (GimpImage *gimage,
{
Undo *boundary_marker;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
/* Bad idea to push NO_UNDO_GROUP as the group type, since that
* won't be recognized as the start of the group later.
*/
g_return_val_if_fail (type > FIRST_UNDO_GROUP &&
type <= LAST_UNDO_GROUP, FALSE);
if (! gimage->undo_on)
return FALSE;
/* Bad idea to push 0 as the group type, since that won't
* be recognized as the start of the group later.
*/
g_return_val_if_fail (type != 0, FALSE);
gimage->group_count ++;
TRC (("group_start (%s)\n", undo_type_to_name (type)));
@ -649,6 +655,8 @@ undo_push_group_end (GimpImage *gimage)
{
Undo *boundary_marker;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
if (! gimage->undo_on)
return FALSE;
@ -3230,6 +3238,8 @@ undo_name[] =
{ TEXT_UNDO_GROUP, N_("Text") },
{ TRANSFORM_UNDO_GROUP, N_("Transform") },
{ PAINT_UNDO_GROUP, N_("Paint") },
{ PARASITE_ATTACH_UNDO_GROUP, N_("Attach Parasite") },
{ PARASITE_REMOVE_UNDO_GROUP, N_("Remove Parasite") },
{ MISC_UNDO_GROUP, N_("Plug-In") },
{ IMAGE_UNDO, N_("Image") },