[gimp] app: add gimp_item_unset_removed() and move item->removed to private
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: add gimp_item_unset_removed() and move item->removed to private
- Date: Sun, 30 Jan 2011 20:58:11 +0000 (UTC)
commit af160141dbc7c8640ef6952e7748cd70bde6538f
Author: Michael Natterer <mitch gimp org>
Date: Sun Jan 30 21:57:45 2011 +0100
app: add gimp_item_unset_removed() and move item->removed to private
app/core/gimpimage.c | 6 ++++--
app/core/gimpitem.c | 26 +++++++++++++++++++++-----
app/core/gimpitem.h | 3 +--
app/core/gimpitemtree.c | 2 +-
app/core/gimplayer.c | 2 +-
5 files changed, 28 insertions(+), 11 deletions(-)
---
diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c
index 94361e7..e0ab232 100644
--- a/app/core/gimpimage.c
+++ b/app/core/gimpimage.c
@@ -3475,9 +3475,11 @@ gimp_image_add_layer (GimpImage *image,
{
GimpLayerMask *mask = gimp_layer_get_mask (layer);
- /* if the layer came from the undo stack, reset the mask's "removed" state */
+ /* if the layer came from the undo stack,
+ * reset the mask's "removed" state
+ */
if (gimp_item_is_removed (GIMP_ITEM (mask)))
- GIMP_ITEM (mask)->removed = FALSE;
+ gimp_item_unset_removed (GIMP_ITEM (mask));
}
return TRUE;
diff --git a/app/core/gimpitem.c b/app/core/gimpitem.c
index 882343f..ea9ca7b 100644
--- a/app/core/gimpitem.c
+++ b/app/core/gimpitem.c
@@ -91,9 +91,7 @@ struct _GimpItemPrivate
guint linked : 1; /* control linkage */
guint lock_content : 1; /* content editability */
-#if 0
guint removed : 1; /* removed from the image? */
-#endif
GeglNode *node; /* the GEGL node to plug
into the graph */
@@ -305,7 +303,7 @@ gimp_item_init (GimpItem *item)
private->visible = TRUE;
private->linked = FALSE;
private->lock_content = FALSE;
- item->removed = FALSE;
+ private->removed = FALSE;
private->node = NULL;
private->offset_node = NULL;
}
@@ -629,7 +627,7 @@ gimp_item_removed (GimpItem *item)
g_return_if_fail (GIMP_IS_ITEM (item));
- item->removed = TRUE;
+ GET_PRIVATE (item)->removed = TRUE;
children = gimp_viewable_get_children (GIMP_VIEWABLE (item));
@@ -650,7 +648,25 @@ gimp_item_is_removed (const GimpItem *item)
{
g_return_val_if_fail (GIMP_IS_ITEM (item), FALSE);
- return item->removed;
+ return GET_PRIVATE (item)->removed;
+}
+
+/**
+ * gimp_item_unset_removed:
+ * @item: a #GimpItem which was on the undo stack
+ *
+ * Unsets an item's "removed" state. This function is called when an
+ * item was on the undo stack and is added back to its parent
+ * container during and undo or redo. It must never be called from
+ * anywhere else.
+ **/
+void
+gimp_item_unset_removed (GimpItem *item)
+{
+ g_return_if_fail (GIMP_IS_ITEM (item));
+ g_return_if_fail (gimp_item_is_removed (item));
+
+ GET_PRIVATE (item)->removed = FALSE;
}
/**
diff --git a/app/core/gimpitem.h b/app/core/gimpitem.h
index 9377c65..82c7033 100644
--- a/app/core/gimpitem.h
+++ b/app/core/gimpitem.h
@@ -39,8 +39,6 @@ struct _GimpItem
GimpParasiteList *parasites; /* Plug-in parasite data */
gint width, height; /* size in pixels */
-
- guint removed : 1; /* removed from the image? */
};
struct _GimpItemClass
@@ -142,6 +140,7 @@ GType gimp_item_get_type (void) G_GNUC_CONST;
void gimp_item_removed (GimpItem *item);
gboolean gimp_item_is_removed (const GimpItem *item);
+void gimp_item_unset_removed (GimpItem *item);
gboolean gimp_item_is_attached (const GimpItem *item);
diff --git a/app/core/gimpitemtree.c b/app/core/gimpitemtree.c
index a74b9de..ecd4c0b 100644
--- a/app/core/gimpitemtree.c
+++ b/app/core/gimpitemtree.c
@@ -449,7 +449,7 @@ gimp_item_tree_add_item (GimpItemTree *tree,
/* if the item came from the undo stack, reset its "removed" state */
if (gimp_item_is_removed (item))
- item->removed = FALSE;
+ gimp_item_unset_removed (item);
}
GimpItem *
diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c
index c90b25f..d3ba930 100644
--- a/app/core/gimplayer.c
+++ b/app/core/gimplayer.c
@@ -1462,7 +1462,7 @@ gimp_layer_add_mask (GimpLayer *layer,
/* if the mask came from the undo stack, reset its "removed" state */
if (gimp_item_is_removed (GIMP_ITEM (mask)))
- GIMP_ITEM (mask)->removed = FALSE;
+ gimp_item_unset_removed (GIMP_ITEM (mask));
return layer->mask;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]