[gimp] No need to pass the active item to GimpItemTree functions any longer
- From: Michael Natterer <mitch src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] No need to pass the active item to GimpItemTree functions any longer
- Date: Sun, 7 Feb 2010 14:07:54 +0000 (UTC)
commit e00c59461acc0e9ad941b2efa21b960da14c72da
Author: Michael Natterer <mitch gimp org>
Date: Sun Feb 7 15:01:31 2010 +0100
No need to pass the active item to GimpItemTree functions any longer
app/core/gimpimage.c | 36 ++++++++++--------------------------
app/core/gimpitemtree.c | 25 +++++++++++++------------
app/core/gimpitemtree.h | 20 +++++++++-----------
3 files changed, 32 insertions(+), 49 deletions(-)
---
diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c
index 0e8d6b3..39442f8 100644
--- a/app/core/gimpimage.c
+++ b/app/core/gimpimage.c
@@ -3260,7 +3260,6 @@ gimp_image_add_layer (GimpImage *image,
gboolean push_undo)
{
GimpImagePrivate *private;
- GimpLayer *active_layer;
GimpLayer *floating_sel;
gboolean old_has_alpha;
@@ -3286,12 +3285,9 @@ gimp_image_add_layer (GimpImage *image,
private = GIMP_IMAGE_GET_PRIVATE (image);
- active_layer = gimp_image_get_active_layer (image);
-
parent = GIMP_LAYER (gimp_item_tree_get_insert_pos (private->layers,
(GimpItem *) parent,
- &position,
- GIMP_ITEM (active_layer)));
+ &position));
floating_sel = gimp_image_get_floating_selection (image);
@@ -3305,7 +3301,8 @@ gimp_image_add_layer (GimpImage *image,
if (push_undo)
gimp_image_undo_push_layer_add (image, _("Add Layer"),
- layer, active_layer);
+ layer,
+ gimp_image_get_active_layer (image));
gimp_item_tree_add_item (private->layers, GIMP_ITEM (layer),
GIMP_ITEM (parent), position);
@@ -3414,7 +3411,6 @@ gimp_image_remove_layer (GimpImage *image,
new_active =
GIMP_LAYER (gimp_item_tree_remove_item (private->layers,
GIMP_ITEM (layer),
- GIMP_ITEM (active_layer),
GIMP_ITEM (new_active)));
if (gimp_layer_is_floating_sel (layer))
@@ -3449,7 +3445,6 @@ gimp_image_add_layers (GimpImage *image,
const gchar *undo_desc)
{
GimpImagePrivate *private;
- GimpLayer *active_layer;
GList *list;
gint layers_x = G_MAXINT;
gint layers_y = G_MAXINT;
@@ -3475,12 +3470,9 @@ gimp_image_add_layers (GimpImage *image,
private = GIMP_IMAGE_GET_PRIVATE (image);
- active_layer = gimp_image_get_active_layer (image);
-
parent = GIMP_LAYER (gimp_item_tree_get_insert_pos (private->layers,
(GimpItem *) parent,
- &position,
- GIMP_ITEM (active_layer)));
+ &position));
for (list = layers; list; list = g_list_next (list))
{
@@ -3631,7 +3623,6 @@ gimp_image_add_channel (GimpImage *image,
gboolean push_undo)
{
GimpImagePrivate *private;
- GimpChannel *active_channel;
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
g_return_val_if_fail (GIMP_IS_CHANNEL (channel), FALSE);
@@ -3655,16 +3646,14 @@ gimp_image_add_channel (GimpImage *image,
private = GIMP_IMAGE_GET_PRIVATE (image);
- active_channel = gimp_image_get_active_channel (image);
-
parent = GIMP_CHANNEL (gimp_item_tree_get_insert_pos (private->channels,
(GimpItem *) parent,
- &position,
- GIMP_ITEM (active_channel)));
+ &position));
if (push_undo)
gimp_image_undo_push_channel_add (image, _("Add Channel"),
- channel, active_channel);
+ channel,
+ gimp_image_get_active_channel (image));
gimp_item_tree_add_item (private->channels, GIMP_ITEM (channel),
GIMP_ITEM (parent), position);
@@ -3720,7 +3709,6 @@ gimp_image_remove_channel (GimpImage *image,
new_active =
GIMP_CHANNEL (gimp_item_tree_remove_item (private->channels,
GIMP_ITEM (channel),
- GIMP_ITEM (active_channel),
GIMP_ITEM (new_active)));
if (channel == active_channel)
@@ -3847,7 +3835,6 @@ gimp_image_add_vectors (GimpImage *image,
gboolean push_undo)
{
GimpImagePrivate *private;
- GimpVectors *active_vectors;
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
g_return_val_if_fail (GIMP_IS_VECTORS (vectors), FALSE);
@@ -3871,16 +3858,14 @@ gimp_image_add_vectors (GimpImage *image,
private = GIMP_IMAGE_GET_PRIVATE (image);
- active_vectors = gimp_image_get_active_vectors (image);
-
parent = GIMP_VECTORS (gimp_item_tree_get_insert_pos (private->vectors,
(GimpItem *) parent,
- &position,
- GIMP_ITEM (active_vectors)));
+ &position));
if (push_undo)
gimp_image_undo_push_vectors_add (image, _("Add Path"),
- vectors, active_vectors);
+ vectors,
+ gimp_image_get_active_vectors (image));
gimp_item_tree_add_item (private->vectors, GIMP_ITEM (vectors),
GIMP_ITEM (parent), position);
@@ -3917,7 +3902,6 @@ gimp_image_remove_vectors (GimpImage *image,
new_active =
GIMP_VECTORS (gimp_item_tree_remove_item (private->vectors,
GIMP_ITEM (vectors),
- GIMP_ITEM (active_vectors),
GIMP_ITEM (new_active)));
if (vectors == active_vectors)
diff --git a/app/core/gimpitemtree.c b/app/core/gimpitemtree.c
index abdf04f..451647d 100644
--- a/app/core/gimpitemtree.c
+++ b/app/core/gimpitemtree.c
@@ -298,32 +298,34 @@ gimp_item_tree_set_active_item (GimpItemTree *tree,
}
GimpItem *
-gimp_item_tree_get_insert_pos (GimpItemTree *tree,
- GimpItem *parent,
- gint *position,
- GimpItem *active_item)
+gimp_item_tree_get_insert_pos (GimpItemTree *tree,
+ GimpItem *parent,
+ gint *position)
{
- GimpContainer *container;
+ GimpItemTreePrivate *private;
+ GimpContainer *container;
g_return_val_if_fail (GIMP_IS_ITEM_TREE (tree), NULL);
+ private = GIMP_ITEM_TREE_GET_PRIVATE (tree);
+
/* if we want to insert in the active item's parent container */
if (parent == GIMP_IMAGE_ACTIVE_PARENT)
{
- if (active_item)
+ if (private->active_item)
{
/* if the active item is a branch, add to the top of that
* branch; add to the active item's parent container
* otherwise
*/
- if (gimp_viewable_get_children (GIMP_VIEWABLE (active_item)))
+ if (gimp_viewable_get_children (GIMP_VIEWABLE (private->active_item)))
{
- parent = active_item;
+ parent = private->active_item;
*position = 0;
}
else
{
- parent = gimp_item_get_parent (active_item);
+ parent = gimp_item_get_parent (private->active_item);
}
}
else
@@ -341,9 +343,9 @@ gimp_item_tree_get_insert_pos (GimpItemTree *tree,
/* if we want to add on top of the active item */
if (*position == -1)
{
- if (active_item)
+ if (private->active_item)
*position = gimp_container_get_child_index (container,
- GIMP_OBJECT (active_item));
+ GIMP_OBJECT (private->active_item));
/* if the active item is not in the specified parent container,
* fall back to index 0
@@ -384,7 +386,6 @@ gimp_item_tree_add_item (GimpItemTree *tree,
GimpItem *
gimp_item_tree_remove_item (GimpItemTree *tree,
GimpItem *item,
- GimpItem *current_active,
GimpItem *new_active)
{
GimpItem *parent;
diff --git a/app/core/gimpitemtree.h b/app/core/gimpitemtree.h
index 243d242..1901db2 100644
--- a/app/core/gimpitemtree.h
+++ b/app/core/gimpitemtree.h
@@ -48,18 +48,17 @@ 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);
+GimpItemTree * gimp_item_tree_new (GimpImage *image,
+ GType container_type,
+ GType item_type);
-GimpItem * gimp_item_tree_get_active_item (GimpItemTree *tree);
-void gimp_item_tree_set_active_item (GimpItemTree *tree,
- GimpItem *item);
+GimpItem * gimp_item_tree_get_active_item (GimpItemTree *tree);
+void gimp_item_tree_set_active_item (GimpItemTree *tree,
+ GimpItem *item);
-GimpItem * gimp_item_tree_get_insert_pos (GimpItemTree *tree,
- GimpItem *parent,
- gint *position,
- GimpItem *active_item);
+GimpItem * gimp_item_tree_get_insert_pos (GimpItemTree *tree,
+ GimpItem *parent,
+ gint *position);
void gimp_item_tree_add_item (GimpItemTree *tree,
GimpItem *item,
@@ -67,7 +66,6 @@ void gimp_item_tree_add_item (GimpItemTree *tree,
gint position);
GimpItem * gimp_item_tree_remove_item (GimpItemTree *tree,
GimpItem *item,
- GimpItem *current_active,
GimpItem *new_active);
gboolean gimp_item_tree_reorder_item (GimpItemTree *tree,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]