[gimp] Merge the layer, channel and vectors reorder undo into one item undo
- From: Michael Natterer <mitch src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] Merge the layer, channel and vectors reorder undo into one item undo
- Date: Sat, 6 Feb 2010 15:46:19 +0000 (UTC)
commit 7bfd5dcf75499f71d6c3336bff24c70efbda4615
Author: Michael Natterer <mitch gimp org>
Date: Sat Feb 6 16:41:54 2010 +0100
Merge the layer, channel and vectors reorder undo into one item undo
- get rid of the individual undo types and add GIMP_UNDO_ITEM_REORDER.
- replace the pushing functions by a single one.
- merge all the actual undo code into gimpitempropundo.[ch].
- use gimp_item_tree_reorder_item() to do the actual reordering.
- fix gimp_item_tree_reorder_item() to use an ordinary "push_undo"
boolean again instead of a pointer to an undo function.
GimpVectorsPropUndo is now a completely empty skeleton. Keep it around
anyway, maybe we'll get vectors properties to undo soon.
app/core/core-enums.c | 8 +---
app/core/core-enums.h | 4 +--
app/core/gimpchannelpropundo.c | 23 -------------
app/core/gimpchannelpropundo.h | 2 -
app/core/gimpimage-undo-push.c | 64 +++++++++---------------------------
app/core/gimpimage-undo-push.h | 13 ++------
app/core/gimpimage.c | 18 ++---------
app/core/gimpitempropundo.c | 24 ++++++++++++++
app/core/gimpitempropundo.h | 2 +
app/core/gimpitemtree.c | 17 +++++-----
app/core/gimpitemtree.h | 28 ++++++----------
app/core/gimplayerpropundo.c | 23 -------------
app/core/gimplayerpropundo.h | 2 -
app/vectors/gimpvectorspropundo.c | 23 -------------
app/vectors/gimpvectorspropundo.h | 3 --
15 files changed, 70 insertions(+), 184 deletions(-)
---
diff --git a/app/core/core-enums.c b/app/core/core-enums.c
index 0f8f6fd..c87886c 100644
--- a/app/core/core-enums.c
+++ b/app/core/core-enums.c
@@ -829,13 +829,13 @@ gimp_undo_type_get_type (void)
{ GIMP_UNDO_DRAWABLE, "GIMP_UNDO_DRAWABLE", "drawable" },
{ GIMP_UNDO_DRAWABLE_MOD, "GIMP_UNDO_DRAWABLE_MOD", "drawable-mod" },
{ GIMP_UNDO_MASK, "GIMP_UNDO_MASK", "mask" },
+ { GIMP_UNDO_ITEM_REORDER, "GIMP_UNDO_ITEM_REORDER", "item-reorder" },
{ GIMP_UNDO_ITEM_RENAME, "GIMP_UNDO_ITEM_RENAME", "item-rename" },
{ GIMP_UNDO_ITEM_DISPLACE, "GIMP_UNDO_ITEM_DISPLACE", "item-displace" },
{ GIMP_UNDO_ITEM_VISIBILITY, "GIMP_UNDO_ITEM_VISIBILITY", "item-visibility" },
{ GIMP_UNDO_ITEM_LINKED, "GIMP_UNDO_ITEM_LINKED", "item-linked" },
{ GIMP_UNDO_LAYER_ADD, "GIMP_UNDO_LAYER_ADD", "layer-add" },
{ GIMP_UNDO_LAYER_REMOVE, "GIMP_UNDO_LAYER_REMOVE", "layer-remove" },
- { GIMP_UNDO_LAYER_REORDER, "GIMP_UNDO_LAYER_REORDER", "layer-reorder" },
{ GIMP_UNDO_LAYER_MODE, "GIMP_UNDO_LAYER_MODE", "layer-mode" },
{ GIMP_UNDO_LAYER_OPACITY, "GIMP_UNDO_LAYER_OPACITY", "layer-opacity" },
{ GIMP_UNDO_LAYER_LOCK_ALPHA, "GIMP_UNDO_LAYER_LOCK_ALPHA", "layer-lock-alpha" },
@@ -850,12 +850,10 @@ gimp_undo_type_get_type (void)
{ GIMP_UNDO_LAYER_MASK_SHOW, "GIMP_UNDO_LAYER_MASK_SHOW", "layer-mask-show" },
{ GIMP_UNDO_CHANNEL_ADD, "GIMP_UNDO_CHANNEL_ADD", "channel-add" },
{ GIMP_UNDO_CHANNEL_REMOVE, "GIMP_UNDO_CHANNEL_REMOVE", "channel-remove" },
- { GIMP_UNDO_CHANNEL_REORDER, "GIMP_UNDO_CHANNEL_REORDER", "channel-reorder" },
{ GIMP_UNDO_CHANNEL_COLOR, "GIMP_UNDO_CHANNEL_COLOR", "channel-color" },
{ GIMP_UNDO_VECTORS_ADD, "GIMP_UNDO_VECTORS_ADD", "vectors-add" },
{ GIMP_UNDO_VECTORS_REMOVE, "GIMP_UNDO_VECTORS_REMOVE", "vectors-remove" },
{ GIMP_UNDO_VECTORS_MOD, "GIMP_UNDO_VECTORS_MOD", "vectors-mod" },
- { GIMP_UNDO_VECTORS_REORDER, "GIMP_UNDO_VECTORS_REORDER", "vectors-reorder" },
{ GIMP_UNDO_FS_TO_LAYER, "GIMP_UNDO_FS_TO_LAYER", "fs-to-layer" },
{ GIMP_UNDO_TRANSFORM, "GIMP_UNDO_TRANSFORM", "transform" },
{ GIMP_UNDO_PAINT, "GIMP_UNDO_PAINT", "paint" },
@@ -917,13 +915,13 @@ gimp_undo_type_get_type (void)
{ GIMP_UNDO_DRAWABLE, NC_("undo-type", "Layer/Channel"), NULL },
{ GIMP_UNDO_DRAWABLE_MOD, NC_("undo-type", "Layer/Channel modification"), NULL },
{ GIMP_UNDO_MASK, NC_("undo-type", "Selection mask"), NULL },
+ { GIMP_UNDO_ITEM_REORDER, NC_("undo-type", "Reorder item"), NULL },
{ GIMP_UNDO_ITEM_RENAME, NC_("undo-type", "Rename item"), NULL },
{ GIMP_UNDO_ITEM_DISPLACE, NC_("undo-type", "Move item"), NULL },
{ GIMP_UNDO_ITEM_VISIBILITY, NC_("undo-type", "Item visibility"), NULL },
{ GIMP_UNDO_ITEM_LINKED, NC_("undo-type", "Link/Unlink item"), NULL },
{ GIMP_UNDO_LAYER_ADD, NC_("undo-type", "New layer"), NULL },
{ GIMP_UNDO_LAYER_REMOVE, NC_("undo-type", "Delete layer"), NULL },
- { GIMP_UNDO_LAYER_REORDER, NC_("undo-type", "Reorder layer"), NULL },
{ GIMP_UNDO_LAYER_MODE, NC_("undo-type", "Set layer mode"), NULL },
{ GIMP_UNDO_LAYER_OPACITY, NC_("undo-type", "Set layer opacity"), NULL },
{ GIMP_UNDO_LAYER_LOCK_ALPHA, NC_("undo-type", "Lock/Unlock alpha channel"), NULL },
@@ -938,12 +936,10 @@ gimp_undo_type_get_type (void)
{ GIMP_UNDO_LAYER_MASK_SHOW, NC_("undo-type", "Show layer mask"), NULL },
{ GIMP_UNDO_CHANNEL_ADD, NC_("undo-type", "New channel"), NULL },
{ GIMP_UNDO_CHANNEL_REMOVE, NC_("undo-type", "Delete channel"), NULL },
- { GIMP_UNDO_CHANNEL_REORDER, NC_("undo-type", "Reorder channel"), NULL },
{ GIMP_UNDO_CHANNEL_COLOR, NC_("undo-type", "Channel color"), NULL },
{ GIMP_UNDO_VECTORS_ADD, NC_("undo-type", "New path"), NULL },
{ GIMP_UNDO_VECTORS_REMOVE, NC_("undo-type", "Delete path"), NULL },
{ GIMP_UNDO_VECTORS_MOD, NC_("undo-type", "Path modification"), NULL },
- { GIMP_UNDO_VECTORS_REORDER, NC_("undo-type", "Reorder path"), NULL },
{ GIMP_UNDO_FS_TO_LAYER, NC_("undo-type", "Floating selection to layer"), NULL },
{ GIMP_UNDO_TRANSFORM, NC_("undo-type", "Transform"), NULL },
{ GIMP_UNDO_PAINT, NC_("undo-type", "Paint"), NULL },
diff --git a/app/core/core-enums.h b/app/core/core-enums.h
index 486d4b8..1d34bdf 100644
--- a/app/core/core-enums.h
+++ b/app/core/core-enums.h
@@ -410,13 +410,13 @@ typedef enum /*< pdb-skip >*/
GIMP_UNDO_DRAWABLE, /*< desc="Layer/Channel" >*/
GIMP_UNDO_DRAWABLE_MOD, /*< desc="Layer/Channel modification" >*/
GIMP_UNDO_MASK, /*< desc="Selection mask" >*/
+ GIMP_UNDO_ITEM_REORDER, /*< desc="Reorder item" >*/
GIMP_UNDO_ITEM_RENAME, /*< desc="Rename item" >*/
GIMP_UNDO_ITEM_DISPLACE, /*< desc="Move item" >*/
GIMP_UNDO_ITEM_VISIBILITY, /*< desc="Item visibility" >*/
GIMP_UNDO_ITEM_LINKED, /*< desc="Link/Unlink item" >*/
GIMP_UNDO_LAYER_ADD, /*< desc="New layer" >*/
GIMP_UNDO_LAYER_REMOVE, /*< desc="Delete layer" >*/
- GIMP_UNDO_LAYER_REORDER, /*< desc="Reorder layer" >*/
GIMP_UNDO_LAYER_MODE, /*< desc="Set layer mode" >*/
GIMP_UNDO_LAYER_OPACITY, /*< desc="Set layer opacity" >*/
GIMP_UNDO_LAYER_LOCK_ALPHA, /*< desc="Lock/Unlock alpha channel" >*/
@@ -431,12 +431,10 @@ typedef enum /*< pdb-skip >*/
GIMP_UNDO_LAYER_MASK_SHOW, /*< desc="Show layer mask" >*/
GIMP_UNDO_CHANNEL_ADD, /*< desc="New channel" >*/
GIMP_UNDO_CHANNEL_REMOVE, /*< desc="Delete channel" >*/
- GIMP_UNDO_CHANNEL_REORDER, /*< desc="Reorder channel" >*/
GIMP_UNDO_CHANNEL_COLOR, /*< desc="Channel color" >*/
GIMP_UNDO_VECTORS_ADD, /*< desc="New path" >*/
GIMP_UNDO_VECTORS_REMOVE, /*< desc="Delete path" >*/
GIMP_UNDO_VECTORS_MOD, /*< desc="Path modification" >*/
- GIMP_UNDO_VECTORS_REORDER, /*< desc="Reorder path" >*/
GIMP_UNDO_FS_TO_LAYER, /*< desc="Floating selection to layer" >*/
GIMP_UNDO_TRANSFORM, /*< desc="Transform" >*/
GIMP_UNDO_PAINT, /*< desc="Paint" >*/
diff --git a/app/core/gimpchannelpropundo.c b/app/core/gimpchannelpropundo.c
index 582d5b3..43190d9 100644
--- a/app/core/gimpchannelpropundo.c
+++ b/app/core/gimpchannelpropundo.c
@@ -79,11 +79,6 @@ gimp_channel_prop_undo_constructor (GType type,
switch (GIMP_UNDO (object)->undo_type)
{
- case GIMP_UNDO_CHANNEL_REORDER:
- channel_prop_undo->parent = GIMP_CHANNEL (gimp_viewable_get_parent (GIMP_VIEWABLE (channel)));
- channel_prop_undo->position = gimp_item_get_index (GIMP_ITEM (channel));
- break;
-
case GIMP_UNDO_CHANNEL_COLOR:
gimp_channel_get_color (channel, &channel_prop_undo->color);
break;
@@ -107,24 +102,6 @@ gimp_channel_prop_undo_pop (GimpUndo *undo,
switch (undo->undo_type)
{
- case GIMP_UNDO_CHANNEL_REORDER:
- {
- GimpChannel *parent;
- gint position;
-
- parent = GIMP_CHANNEL (gimp_viewable_get_parent (GIMP_VIEWABLE (channel)));
- position = gimp_item_get_index (GIMP_ITEM (channel));
-
- gimp_image_reorder_channel (undo->image, channel,
- channel_prop_undo->parent,
- channel_prop_undo->position,
- FALSE, NULL);
-
- channel_prop_undo->parent = parent;
- channel_prop_undo->position = position;
- }
- break;
-
case GIMP_UNDO_CHANNEL_COLOR:
{
GimpRGB color;
diff --git a/app/core/gimpchannelpropundo.h b/app/core/gimpchannelpropundo.h
index 4d66a73..5b8ea31 100644
--- a/app/core/gimpchannelpropundo.h
+++ b/app/core/gimpchannelpropundo.h
@@ -36,8 +36,6 @@ struct _GimpChannelPropUndo
{
GimpItemUndo parent_instance;
- GimpChannel *parent;
- gint position;
GimpRGB color;
};
diff --git a/app/core/gimpimage-undo-push.c b/app/core/gimpimage-undo-push.c
index 51a4b55..5b5e157 100644
--- a/app/core/gimpimage-undo-push.c
+++ b/app/core/gimpimage-undo-push.c
@@ -296,6 +296,22 @@ gimp_image_undo_push_mask (GimpImage *image,
/****************/
GimpUndo *
+gimp_image_undo_push_item_reorder (GimpImage *image,
+ const gchar *undo_desc,
+ GimpItem *item)
+{
+ g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
+ g_return_val_if_fail (GIMP_IS_ITEM (item), NULL);
+ g_return_val_if_fail (gimp_item_is_attached (item), NULL);
+
+ return gimp_image_undo_push (image, GIMP_TYPE_ITEM_PROP_UNDO,
+ GIMP_UNDO_ITEM_REORDER, undo_desc,
+ GIMP_DIRTY_IMAGE_STRUCTURE,
+ "item", item,
+ NULL);
+}
+
+GimpUndo *
gimp_image_undo_push_item_rename (GimpImage *image,
const gchar *undo_desc,
GimpItem *item)
@@ -451,22 +467,6 @@ gimp_image_undo_push_layer_remove (GimpImage *image,
}
GimpUndo *
-gimp_image_undo_push_layer_reorder (GimpImage *image,
- const gchar *undo_desc,
- GimpLayer *layer)
-{
- g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
- g_return_val_if_fail (GIMP_IS_LAYER (layer), NULL);
- g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (layer)), NULL);
-
- return gimp_image_undo_push (image, GIMP_TYPE_LAYER_PROP_UNDO,
- GIMP_UNDO_LAYER_REORDER, undo_desc,
- GIMP_DIRTY_IMAGE_STRUCTURE,
- "item", layer,
- NULL);
-}
-
-GimpUndo *
gimp_image_undo_push_layer_mode (GimpImage *image,
const gchar *undo_desc,
GimpLayer *layer)
@@ -737,22 +737,6 @@ gimp_image_undo_push_channel_remove (GimpImage *image,
}
GimpUndo *
-gimp_image_undo_push_channel_reorder (GimpImage *image,
- const gchar *undo_desc,
- GimpChannel *channel)
-{
- g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
- g_return_val_if_fail (GIMP_IS_CHANNEL (channel), NULL);
- g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (channel)), NULL);
-
- return gimp_image_undo_push (image, GIMP_TYPE_CHANNEL_PROP_UNDO,
- GIMP_UNDO_CHANNEL_REORDER, undo_desc,
- GIMP_DIRTY_IMAGE_STRUCTURE,
- "item", channel,
- NULL);
-}
-
-GimpUndo *
gimp_image_undo_push_channel_color (GimpImage *image,
const gchar *undo_desc,
GimpChannel *channel)
@@ -835,22 +819,6 @@ gimp_image_undo_push_vectors_mod (GimpImage *image,
NULL);
}
-GimpUndo *
-gimp_image_undo_push_vectors_reorder (GimpImage *image,
- const gchar *undo_desc,
- GimpVectors *vectors)
-{
- g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
- g_return_val_if_fail (GIMP_IS_VECTORS (vectors), NULL);
- g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (vectors)), NULL);
-
- return gimp_image_undo_push (image, GIMP_TYPE_VECTORS_PROP_UNDO,
- GIMP_UNDO_VECTORS_REORDER, undo_desc,
- GIMP_DIRTY_IMAGE_STRUCTURE,
- "item", vectors,
- NULL);
-}
-
/******************************/
/* Floating Selection Undos */
diff --git a/app/core/gimpimage-undo-push.h b/app/core/gimpimage-undo-push.h
index 6c21c6a..5ff1ec2 100644
--- a/app/core/gimpimage-undo-push.h
+++ b/app/core/gimpimage-undo-push.h
@@ -79,6 +79,9 @@ GimpUndo * gimp_image_undo_push_mask (GimpImage *image,
/* item undos */
+GimpUndo * gimp_image_undo_push_item_reorder (GimpImage *image,
+ const gchar *undo_desc,
+ GimpItem *item);
GimpUndo * gimp_image_undo_push_item_rename (GimpImage *image,
const gchar *undo_desc,
GimpItem *item);
@@ -101,7 +104,6 @@ GimpUndo * gimp_image_undo_push_item_parasite_remove(GimpImage *image,
const gchar *name);
-
/* layer undos */
GimpUndo * gimp_image_undo_push_layer_add (GimpImage *image,
@@ -114,9 +116,6 @@ GimpUndo * gimp_image_undo_push_layer_remove (GimpImage *image,
GimpLayer *prev_parent,
gint prev_position,
GimpLayer *prev_layer);
-GimpUndo * gimp_image_undo_push_layer_reorder (GimpImage *image,
- const gchar *undo_desc,
- GimpLayer *layer);
GimpUndo * gimp_image_undo_push_layer_mode (GimpImage *image,
const gchar *undo_desc,
GimpLayer *layer);
@@ -182,9 +181,6 @@ GimpUndo * gimp_image_undo_push_channel_remove (GimpImage *image,
GimpChannel *prev_parent,
gint prev_position,
GimpChannel *prev_channel);
-GimpUndo * gimp_image_undo_push_channel_reorder (GimpImage *image,
- const gchar *undo_desc,
- GimpChannel *channel);
GimpUndo * gimp_image_undo_push_channel_color (GimpImage *image,
const gchar *undo_desc,
GimpChannel *channel);
@@ -205,9 +201,6 @@ GimpUndo * gimp_image_undo_push_vectors_remove (GimpImage *image,
GimpUndo * gimp_image_undo_push_vectors_mod (GimpImage *image,
const gchar *undo_desc,
GimpVectors *vectors);
-GimpUndo * gimp_image_undo_push_vectors_reorder (GimpImage *image,
- const gchar *undo_desc,
- GimpVectors *vectors);
/* floating selection undos */
diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c
index 63feaf7..8aa0ed0 100644
--- a/app/core/gimpimage.c
+++ b/app/core/gimpimage.c
@@ -3723,11 +3723,7 @@ gimp_image_reorder_layer (GimpImage *image,
(GimpItem *) layer,
(GimpItem *) new_parent,
new_index,
- (GimpItemReorderUndoFunc)
- (push_undo ?
- gimp_image_undo_push_layer_reorder :
- NULL),
- undo_desc);
+ push_undo, undo_desc);
}
gboolean
@@ -3997,11 +3993,7 @@ gimp_image_reorder_channel (GimpImage *image,
(GimpItem *) channel,
(GimpItem *) new_parent,
new_index,
- (GimpItemReorderUndoFunc)
- (push_undo ?
- gimp_image_undo_push_channel_reorder :
- NULL),
- undo_desc);
+ push_undo, undo_desc);
}
gboolean
@@ -4245,11 +4237,7 @@ gimp_image_reorder_vectors (GimpImage *image,
(GimpItem *) vectors,
(GimpItem *) new_parent,
new_index,
- (GimpItemReorderUndoFunc)
- (push_undo ?
- gimp_image_undo_push_vectors_reorder :
- NULL),
- undo_desc);
+ push_undo, undo_desc);
}
GimpLayer *
diff --git a/app/core/gimpitempropundo.c b/app/core/gimpitempropundo.c
index c0e52cd..65d8f86 100644
--- a/app/core/gimpitempropundo.c
+++ b/app/core/gimpitempropundo.c
@@ -25,6 +25,7 @@
#include "gimp-utils.h"
#include "gimpitem.h"
+#include "gimpitemtree.h"
#include "gimpitempropundo.h"
#include "gimpparasitelist.h"
@@ -109,6 +110,11 @@ gimp_item_prop_undo_constructor (GType type,
switch (GIMP_UNDO (object)->undo_type)
{
+ case GIMP_UNDO_ITEM_REORDER:
+ item_prop_undo->parent = GIMP_ITEM (gimp_viewable_get_parent (GIMP_VIEWABLE (item)));
+ item_prop_undo->position = gimp_item_get_index (item);
+ break;
+
case GIMP_UNDO_ITEM_RENAME:
item_prop_undo->name = g_strdup (gimp_object_get_name (item));
break;
@@ -209,6 +215,24 @@ gimp_item_prop_undo_pop (GimpUndo *undo,
switch (undo->undo_type)
{
+ case GIMP_UNDO_ITEM_REORDER:
+ {
+ GimpItem *parent;
+ gint position;
+
+ parent = GIMP_ITEM (gimp_viewable_get_parent (GIMP_VIEWABLE (item)));
+ position = gimp_item_get_index (item);
+
+ gimp_item_tree_reorder_item (gimp_item_get_tree (item), item,
+ item_prop_undo->parent,
+ item_prop_undo->position,
+ FALSE, NULL);
+
+ item_prop_undo->parent = parent;
+ item_prop_undo->position = position;
+ }
+ break;
+
case GIMP_UNDO_ITEM_RENAME:
{
gchar *name;
diff --git a/app/core/gimpitempropundo.h b/app/core/gimpitempropundo.h
index 934c99b..e20eb13 100644
--- a/app/core/gimpitempropundo.h
+++ b/app/core/gimpitempropundo.h
@@ -36,6 +36,8 @@ struct _GimpItemPropUndo
{
GimpItemUndo parent_instance;
+ GimpItem *parent;
+ gint position;
gchar *name;
gint offset_x;
gint offset_y;
diff --git a/app/core/gimpitemtree.c b/app/core/gimpitemtree.c
index 3f09d05..82ce61d 100644
--- a/app/core/gimpitemtree.c
+++ b/app/core/gimpitemtree.c
@@ -27,6 +27,7 @@
#include "core-types.h"
#include "gimpimage.h"
+#include "gimpimage-undo-push.h"
#include "gimpitem.h"
#include "gimpitemstack.h"
#include "gimpitemtree.h"
@@ -250,12 +251,12 @@ gimp_item_tree_new (GimpImage *image,
}
gboolean
-gimp_item_tree_reorder_item (GimpItemTree *tree,
- GimpItem *item,
- GimpItem *new_parent,
- gint new_index,
- GimpItemReorderUndoFunc undo_func,
- const gchar *undo_desc)
+gimp_item_tree_reorder_item (GimpItemTree *tree,
+ GimpItem *item,
+ GimpItem *new_parent,
+ gint new_index,
+ gboolean push_undo,
+ const gchar *undo_desc)
{
GimpItemTreePrivate *private;
GimpContainer *container;
@@ -300,8 +301,8 @@ gimp_item_tree_reorder_item (GimpItemTree *tree,
if (new_container != container ||
new_index != gimp_item_get_index (item))
{
- if (undo_func)
- undo_func (private->image, undo_desc, item);
+ if (push_undo)
+ gimp_image_undo_push_item_reorder (private->image, undo_desc, item);
if (new_container != container)
{
diff --git a/app/core/gimpitemtree.h b/app/core/gimpitemtree.h
index fbcff18..0531de1 100644
--- a/app/core/gimpitemtree.h
+++ b/app/core/gimpitemtree.h
@@ -25,14 +25,6 @@
#include "gimpobject.h"
-/* this is temporary, reorder undo will operate generically on the
- * item tree too
- */
-typedef GimpUndo * (* GimpItemReorderUndoFunc) (GimpImage *image,
- const gchar *undo_desc,
- GimpItem *item);
-
-
#define GIMP_TYPE_ITEM_TREE (gimp_item_tree_get_type ())
#define GIMP_ITEM_TREE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_ITEM_TREE, GimpItemTree))
#define GIMP_ITEM_TREE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_ITEM_TREE, GimpItemTreeClass))
@@ -56,15 +48,15 @@ struct _GimpItemTreeClass
GType gimp_item_tree_get_type (void) G_GNUC_CONST;
-GimpItemTree * gimp_item_tree_new (GimpImage *image,
- GType container_type,
- GType item_type);
-
-gboolean gimp_item_tree_reorder_item (GimpItemTree *tree,
- GimpItem *item,
- GimpItem *new_parent,
- gint new_index,
- GimpItemReorderUndoFunc undo_func,
- const gchar *undo_desc);
+GimpItemTree * gimp_item_tree_new (GimpImage *image,
+ GType container_type,
+ GType item_type);
+
+gboolean gimp_item_tree_reorder_item (GimpItemTree *tree,
+ GimpItem *item,
+ GimpItem *new_parent,
+ gint new_index,
+ gboolean push_undo,
+ const gchar *undo_desc);
#endif /* __GIMP_ITEM_TREE_H__ */
diff --git a/app/core/gimplayerpropundo.c b/app/core/gimplayerpropundo.c
index 80c20af..8326466 100644
--- a/app/core/gimplayerpropundo.c
+++ b/app/core/gimplayerpropundo.c
@@ -79,11 +79,6 @@ gimp_layer_prop_undo_constructor (GType type,
switch (GIMP_UNDO (object)->undo_type)
{
- case GIMP_UNDO_LAYER_REORDER:
- layer_prop_undo->parent = GIMP_LAYER (gimp_viewable_get_parent (GIMP_VIEWABLE (layer)));
- layer_prop_undo->position = gimp_item_get_index (GIMP_ITEM (layer));
- break;
-
case GIMP_UNDO_LAYER_MODE:
layer_prop_undo->mode = gimp_layer_get_mode (layer);
break;
@@ -115,24 +110,6 @@ gimp_layer_prop_undo_pop (GimpUndo *undo,
switch (undo->undo_type)
{
- case GIMP_UNDO_LAYER_REORDER:
- {
- GimpLayer *parent;
- gint position;
-
- parent = GIMP_LAYER (gimp_viewable_get_parent (GIMP_VIEWABLE (layer)));
- position = gimp_item_get_index (GIMP_ITEM (layer));
-
- gimp_image_reorder_layer (undo->image, layer,
- layer_prop_undo->parent,
- layer_prop_undo->position,
- FALSE, NULL);
-
- layer_prop_undo->parent = parent;
- layer_prop_undo->position = position;
- }
- break;
-
case GIMP_UNDO_LAYER_MODE:
{
GimpLayerModeEffects mode;
diff --git a/app/core/gimplayerpropundo.h b/app/core/gimplayerpropundo.h
index e3032a1..e826e90 100644
--- a/app/core/gimplayerpropundo.h
+++ b/app/core/gimplayerpropundo.h
@@ -36,8 +36,6 @@ struct _GimpLayerPropUndo
{
GimpItemUndo parent_instance;
- GimpLayer *parent;
- gint position;
GimpLayerModeEffects mode;
gdouble opacity;
gboolean lock_alpha;
diff --git a/app/vectors/gimpvectorspropundo.c b/app/vectors/gimpvectorspropundo.c
index 7aed3d4..e28a842 100644
--- a/app/vectors/gimpvectorspropundo.c
+++ b/app/vectors/gimpvectorspropundo.c
@@ -78,11 +78,6 @@ gimp_vectors_prop_undo_constructor (GType type,
switch (GIMP_UNDO (object)->undo_type)
{
- case GIMP_UNDO_VECTORS_REORDER:
- vectors_prop_undo->parent = GIMP_VECTORS (gimp_viewable_get_parent (GIMP_VIEWABLE (vectors)));
- vectors_prop_undo->position = gimp_item_get_index (GIMP_ITEM (vectors));
- break;
-
default:
g_assert_not_reached ();
}
@@ -102,24 +97,6 @@ gimp_vectors_prop_undo_pop (GimpUndo *undo,
switch (undo->undo_type)
{
- case GIMP_UNDO_VECTORS_REORDER:
- {
- GimpVectors *parent;
- gint position;
-
- parent = GIMP_VECTORS (gimp_viewable_get_parent (GIMP_VIEWABLE (vectors)));
- position = gimp_item_get_index (GIMP_ITEM (vectors));
-
- gimp_image_reorder_vectors (undo->image, vectors,
- vectors_prop_undo->parent,
- vectors_prop_undo->position,
- FALSE, NULL);
-
- vectors_prop_undo->parent = parent;
- vectors_prop_undo->position = position;
- }
- break;
-
default:
g_assert_not_reached ();
}
diff --git a/app/vectors/gimpvectorspropundo.h b/app/vectors/gimpvectorspropundo.h
index fde7d3a..96ef514 100644
--- a/app/vectors/gimpvectorspropundo.h
+++ b/app/vectors/gimpvectorspropundo.h
@@ -35,9 +35,6 @@ typedef struct _GimpVectorsPropUndoClass GimpVectorsPropUndoClass;
struct _GimpVectorsPropUndo
{
GimpItemUndo parent_instance;
-
- GimpVectors *parent;
- gint position;
};
struct _GimpVectorsPropUndoClass
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]