Commit ab0c8fe2 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

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".
parent 78317432
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
......
......@@ -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
......
......@@ -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);
}
......
......@@ -238,10 +238,13 @@ 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);
gimp_image_dirty (gimage);
if (! gimage->undo_on)
return NULL;
......@@ -601,13 +604,16 @@ undo_push_group_start (GimpImage *gimage,
{
Undo *boundary_marker;
if (! gimage->undo_on)
return FALSE;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
/* Bad idea to push 0 as the group type, since that won't
* be recognized as the start of the group later.
/* 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 != 0, FALSE);
g_return_val_if_fail (type > FIRST_UNDO_GROUP &&
type <= LAST_UNDO_GROUP, FALSE);
if (! gimage->undo_on)
return 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") },
......
......@@ -238,10 +238,13 @@ 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);
gimp_image_dirty (gimage);
if (! gimage->undo_on)
return NULL;
......@@ -601,13 +604,16 @@ undo_push_group_start (GimpImage *gimage,
{
Undo *boundary_marker;
if (! gimage->undo_on)
return FALSE;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
/* Bad idea to push 0 as the group type, since that won't
* be recognized as the start of the group later.
/* 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 != 0, FALSE);
g_return_val_if_fail (type > FIRST_UNDO_GROUP &&
type <= LAST_UNDO_GROUP, FALSE);
if (! gimage->undo_on)
return 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") },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment