mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-19 22:34:37 +00:00
Remove the last code duplication from the undo system (or if not the last
2008-10-09 Michael Natterer <mitch@gimp.org> Remove the last code duplication from the undo system (or if not the last then at least the most ugly): * app/core/gimpimage.[ch] (gimp_image_add_layer,channel,vectors): add "gboolean push_undo" parameter and add the item without touching undo if it's TRUE. Changed assertions from g_object_is_floating() to !gimp_item_is_attached() so they also take items from the undo stack and not only newly created ones. (gimp_image_remove_layer,channel,vectors): add "push_undo" parameter here too. Also add a "new_active" parameter where an optional new active item can be passed. (gimp_image_remove_layer,channel): these functions must not be called with push_undo=FALSE and a floating selection attached to the layer/channel. This can't currently happen; added warnings in case other code is changed and makes it happen anyway. * app/core/gimpchannelundo.c * app/core/gimplayerundo.c * app/vectors/gimpvectorsundo.c: use above functions to add/remove items instead of duplicating (parts of) their code. Pass push_undo=FALSE and the previously active item to the remove() functions. * app/actions/channels-commands.c * app/actions/edit-commands.c * app/actions/layers-commands.c * app/actions/vectors-commands.c * app/core/gimp-edit.c * app/core/gimpchannelundo.c * app/core/gimpimage-crop.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-merge.c * app/core/gimpimage-quick-mask.c * app/core/gimpimage-scale.c * app/core/gimplayer-floating-sel.c * app/core/gimplayerundo.c * app/core/gimpselection.c * app/core/gimptemplate.c * app/display/gimpdisplayshell-dnd.c * app/text/gimptext-compat.c * app/tools/gimptexttool.c * app/tools/gimpvectortool.c * app/vectors/gimpvectors-import.c * app/vectors/gimpvectorsundo.c * app/widgets/gimpchanneltreeview.c * app/widgets/gimpitemtreeview.[ch] * app/widgets/gimplayertreeview.c * app/widgets/gimptoolbox-dnd.c * app/widgets/gimpvectorstreeview.c * app/xcf/xcf-load.c * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/paths.pdb: changed accordingly (pass TRUE unless it's a new image like when loading and XCF file). * app/pdb/image-cmds.c * app/pdb/paths-cmds.c: regenerated. svn path=/trunk/; revision=27200
This commit is contained in:
parent
f959832666
commit
0e4a35a2d8
61
ChangeLog
61
ChangeLog
|
@ -1,3 +1,64 @@
|
|||
2008-10-09 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
Remove the last code duplication from the undo system (or if not
|
||||
the last then at least the most ugly):
|
||||
|
||||
* app/core/gimpimage.[ch] (gimp_image_add_layer,channel,vectors):
|
||||
add "gboolean push_undo" parameter and add the item without
|
||||
touching undo if it's TRUE. Changed assertions from
|
||||
g_object_is_floating() to !gimp_item_is_attached() so they also
|
||||
take items from the undo stack and not only newly created ones.
|
||||
|
||||
(gimp_image_remove_layer,channel,vectors): add "push_undo"
|
||||
parameter here too. Also add a "new_active" parameter where an
|
||||
optional new active item can be passed.
|
||||
|
||||
(gimp_image_remove_layer,channel): these functions must not be
|
||||
called with push_undo=FALSE and a floating selection attached to
|
||||
the layer/channel. This can't currently happen; added warnings in
|
||||
case other code is changed and makes it happen anyway.
|
||||
|
||||
* app/core/gimpchannelundo.c
|
||||
* app/core/gimplayerundo.c
|
||||
* app/vectors/gimpvectorsundo.c: use above functions to add/remove
|
||||
items instead of duplicating (parts of) their code. Pass
|
||||
push_undo=FALSE and the previously active item to the remove()
|
||||
functions.
|
||||
|
||||
* app/actions/channels-commands.c
|
||||
* app/actions/edit-commands.c
|
||||
* app/actions/layers-commands.c
|
||||
* app/actions/vectors-commands.c
|
||||
* app/core/gimp-edit.c
|
||||
* app/core/gimpchannelundo.c
|
||||
* app/core/gimpimage-crop.c
|
||||
* app/core/gimpimage-duplicate.c
|
||||
* app/core/gimpimage-merge.c
|
||||
* app/core/gimpimage-quick-mask.c
|
||||
* app/core/gimpimage-scale.c
|
||||
* app/core/gimplayer-floating-sel.c
|
||||
* app/core/gimplayerundo.c
|
||||
* app/core/gimpselection.c
|
||||
* app/core/gimptemplate.c
|
||||
* app/display/gimpdisplayshell-dnd.c
|
||||
* app/text/gimptext-compat.c
|
||||
* app/tools/gimptexttool.c
|
||||
* app/tools/gimpvectortool.c
|
||||
* app/vectors/gimpvectors-import.c
|
||||
* app/vectors/gimpvectorsundo.c
|
||||
* app/widgets/gimpchanneltreeview.c
|
||||
* app/widgets/gimpitemtreeview.[ch]
|
||||
* app/widgets/gimplayertreeview.c
|
||||
* app/widgets/gimptoolbox-dnd.c
|
||||
* app/widgets/gimpvectorstreeview.c
|
||||
* app/xcf/xcf-load.c
|
||||
* tools/pdbgen/pdb/image.pdb
|
||||
* tools/pdbgen/pdb/paths.pdb: changed accordingly (pass TRUE
|
||||
unless it's a new image like when loading and XCF file).
|
||||
|
||||
* app/pdb/image-cmds.c
|
||||
* app/pdb/paths-cmds.c: regenerated.
|
||||
|
||||
2008-10-09 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* data/images/Makefile.am
|
||||
|
|
|
@ -166,7 +166,7 @@ channels_new_last_vals_cmd_callback (GtkAction *action,
|
|||
action_data_get_context (data),
|
||||
GIMP_TRANSPARENT_FILL);
|
||||
|
||||
gimp_image_add_channel (image, new_channel, -1);
|
||||
gimp_image_add_channel (image, new_channel, -1, TRUE);
|
||||
|
||||
gimp_image_undo_group_end (image);
|
||||
|
||||
|
@ -262,7 +262,7 @@ channels_duplicate_cmd_callback (GtkAction *action,
|
|||
G_TYPE_FROM_INSTANCE (channel)));
|
||||
}
|
||||
|
||||
gimp_image_add_channel (image, new_channel, -1);
|
||||
gimp_image_add_channel (image, new_channel, -1, TRUE);
|
||||
gimp_image_flush (image);
|
||||
}
|
||||
|
||||
|
@ -274,7 +274,7 @@ channels_delete_cmd_callback (GtkAction *action,
|
|||
GimpChannel *channel;
|
||||
return_if_no_channel (image, channel, data);
|
||||
|
||||
gimp_image_remove_channel (image, channel);
|
||||
gimp_image_remove_channel (image, channel, TRUE, NULL);
|
||||
gimp_image_flush (image);
|
||||
}
|
||||
|
||||
|
@ -356,7 +356,7 @@ channels_new_channel_response (GtkWidget *widget,
|
|||
GIMP_TRANSPARENT_FILL);
|
||||
}
|
||||
|
||||
gimp_image_add_channel (options->image, new_channel, -1);
|
||||
gimp_image_add_channel (options->image, new_channel, -1, TRUE);
|
||||
gimp_image_flush (options->image);
|
||||
}
|
||||
|
||||
|
|
|
@ -339,7 +339,7 @@ edit_paste_as_new_layer_cmd_callback (GtkAction *action,
|
|||
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE);
|
||||
g_object_unref (buffer);
|
||||
|
||||
gimp_image_add_layer (image, layer, -1);
|
||||
gimp_image_add_layer (image, layer, -1, TRUE);
|
||||
|
||||
gimp_image_flush (image);
|
||||
}
|
||||
|
|
|
@ -328,7 +328,7 @@ layers_new_last_vals_cmd_callback (GtkAction *action,
|
|||
layer_fill_type);
|
||||
gimp_item_translate (GIMP_ITEM (new_layer), off_x, off_y, FALSE);
|
||||
|
||||
gimp_image_add_layer (image, new_layer, -1);
|
||||
gimp_image_add_layer (image, new_layer, -1, TRUE);
|
||||
|
||||
gimp_image_undo_group_end (image);
|
||||
|
||||
|
@ -351,7 +351,7 @@ layers_new_from_visible_cmd_callback (GtkAction *action,
|
|||
gimp_image_base_type_with_alpha (image),
|
||||
_("Visible"),
|
||||
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE);
|
||||
gimp_image_add_layer (image, layer, -1);
|
||||
gimp_image_add_layer (image, layer, -1, TRUE);
|
||||
|
||||
gimp_image_flush (image);
|
||||
}
|
||||
|
@ -438,7 +438,7 @@ layers_duplicate_cmd_callback (GtkAction *action,
|
|||
|
||||
new_layer = GIMP_LAYER (gimp_item_duplicate (GIMP_ITEM (layer),
|
||||
G_TYPE_FROM_INSTANCE (layer)));
|
||||
gimp_image_add_layer (image, new_layer, -1);
|
||||
gimp_image_add_layer (image, new_layer, -1, TRUE);
|
||||
|
||||
gimp_image_flush (image);
|
||||
}
|
||||
|
@ -482,7 +482,7 @@ layers_delete_cmd_callback (GtkAction *action,
|
|||
if (gimp_layer_is_floating_sel (layer))
|
||||
floating_sel_remove (layer);
|
||||
else
|
||||
gimp_image_remove_layer (image, layer);
|
||||
gimp_image_remove_layer (image, layer, TRUE, NULL);
|
||||
|
||||
gimp_image_flush (image);
|
||||
}
|
||||
|
@ -517,7 +517,7 @@ layers_text_to_vectors_cmd_callback (GtkAction *action,
|
|||
gimp_item_offsets (GIMP_ITEM (layer), &x, &y);
|
||||
gimp_item_translate (GIMP_ITEM (vectors), x, y, FALSE);
|
||||
|
||||
gimp_image_add_vectors (image, vectors, -1);
|
||||
gimp_image_add_vectors (image, vectors, -1, TRUE);
|
||||
gimp_image_set_active_vectors (image, vectors);
|
||||
|
||||
gimp_image_flush (image);
|
||||
|
@ -545,7 +545,7 @@ layers_text_along_vectors_cmd_callback (GtkAction *action,
|
|||
|
||||
gimp_item_set_visible (GIMP_ITEM (new_vectors), TRUE, FALSE);
|
||||
|
||||
gimp_image_add_vectors (image, new_vectors, -1);
|
||||
gimp_image_add_vectors (image, new_vectors, -1, TRUE);
|
||||
gimp_image_set_active_vectors (image, new_vectors);
|
||||
|
||||
gimp_image_flush (image);
|
||||
|
@ -961,7 +961,7 @@ layers_new_layer_response (GtkWidget *widget,
|
|||
gimp_drawable_fill_by_type (GIMP_DRAWABLE (layer),
|
||||
dialog->context,
|
||||
layer_fill_type);
|
||||
gimp_image_add_layer (dialog->image, layer, -1);
|
||||
gimp_image_add_layer (dialog->image, layer, -1, TRUE);
|
||||
|
||||
gimp_image_flush (dialog->image);
|
||||
}
|
||||
|
|
|
@ -187,7 +187,7 @@ vectors_new_last_vals_cmd_callback (GtkAction *action,
|
|||
new_vectors = gimp_vectors_new (image,
|
||||
vectors_name ? vectors_name : _("New Path"));
|
||||
|
||||
gimp_image_add_vectors (image, new_vectors, -1);
|
||||
gimp_image_add_vectors (image, new_vectors, -1, TRUE);
|
||||
|
||||
gimp_image_flush (image);
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ vectors_duplicate_cmd_callback (GtkAction *action,
|
|||
|
||||
new_vectors = GIMP_VECTORS (gimp_item_duplicate (GIMP_ITEM (vectors),
|
||||
G_TYPE_FROM_INSTANCE (vectors)));
|
||||
gimp_image_add_vectors (image, new_vectors, -1);
|
||||
gimp_image_add_vectors (image, new_vectors, -1, TRUE);
|
||||
gimp_image_flush (image);
|
||||
}
|
||||
|
||||
|
@ -263,7 +263,7 @@ vectors_delete_cmd_callback (GtkAction *action,
|
|||
GimpVectors *vectors;
|
||||
return_if_no_vectors (image, vectors, data);
|
||||
|
||||
gimp_image_remove_vectors (image, vectors);
|
||||
gimp_image_remove_vectors (image, vectors, TRUE, NULL);
|
||||
gimp_image_flush (image);
|
||||
}
|
||||
|
||||
|
@ -603,7 +603,7 @@ vectors_new_vectors_response (GtkWidget *widget,
|
|||
|
||||
new_vectors = gimp_vectors_new (options->image, vectors_name);
|
||||
|
||||
gimp_image_add_vectors (options->image, new_vectors, -1);
|
||||
gimp_image_add_vectors (options->image, new_vectors, -1, TRUE);
|
||||
|
||||
gimp_image_flush (options->image);
|
||||
}
|
||||
|
|
|
@ -272,7 +272,7 @@ gimp_edit_paste (GimpImage *image,
|
|||
if (drawable)
|
||||
floating_sel_attach (layer, drawable);
|
||||
else
|
||||
gimp_image_add_layer (image, layer, 0);
|
||||
gimp_image_add_layer (image, layer, 0, TRUE);
|
||||
|
||||
/* end the group undo */
|
||||
gimp_image_undo_group_end (image);
|
||||
|
@ -332,7 +332,7 @@ gimp_edit_paste_as_new (Gimp *gimp,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
gimp_image_add_layer (image, layer, 0);
|
||||
gimp_image_add_layer (image, layer, 0, TRUE);
|
||||
|
||||
gimp_image_undo_enable (image);
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
|
||||
#include "core-types.h"
|
||||
|
||||
#include "gimpcontainer.h"
|
||||
#include "gimpimage.h"
|
||||
#include "gimpchannel.h"
|
||||
#include "gimpchannelundo.h"
|
||||
|
@ -193,17 +192,8 @@ gimp_channel_undo_pop (GimpUndo *undo,
|
|||
channel_undo->prev_position = gimp_image_get_channel_index (undo->image,
|
||||
channel);
|
||||
|
||||
gimp_container_remove (undo->image->channels, GIMP_OBJECT (channel));
|
||||
gimp_item_removed (GIMP_ITEM (channel));
|
||||
|
||||
if (channel == gimp_image_get_active_channel (undo->image))
|
||||
{
|
||||
if (channel_undo->prev_channel)
|
||||
gimp_image_set_active_channel (undo->image,
|
||||
channel_undo->prev_channel);
|
||||
else
|
||||
gimp_image_unset_active_channel (undo->image);
|
||||
}
|
||||
gimp_image_remove_channel (undo->image, channel, FALSE,
|
||||
channel_undo->prev_channel);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -212,9 +202,8 @@ gimp_channel_undo_pop (GimpUndo *undo,
|
|||
/* record the active channel */
|
||||
channel_undo->prev_channel = gimp_image_get_active_channel (undo->image);
|
||||
|
||||
gimp_container_insert (undo->image->channels, GIMP_OBJECT (channel),
|
||||
channel_undo->prev_position);
|
||||
gimp_image_set_active_channel (undo->image, channel);
|
||||
gimp_image_add_channel (undo->image, channel,
|
||||
channel_undo->prev_position, FALSE);
|
||||
|
||||
GIMP_ITEM (channel)->removed = FALSE;
|
||||
}
|
||||
|
|
|
@ -203,7 +203,7 @@ gimp_image_crop (GimpImage *image,
|
|||
-(lx1 - off_x),
|
||||
-(ly1 - off_y));
|
||||
else
|
||||
gimp_image_remove_layer (image, GIMP_LAYER (item));
|
||||
gimp_image_remove_layer (image, GIMP_LAYER (item), TRUE, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -137,7 +137,7 @@ gimp_image_duplicate (GimpImage *image)
|
|||
new_floating_sel_drawable = GIMP_DRAWABLE (new_layer);
|
||||
|
||||
if (floating_layer != new_layer)
|
||||
gimp_image_add_layer (new_image, new_layer, count++);
|
||||
gimp_image_add_layer (new_image, new_layer, count++, FALSE);
|
||||
}
|
||||
|
||||
/* Copy the channels */
|
||||
|
@ -162,7 +162,7 @@ gimp_image_duplicate (GimpImage *image)
|
|||
if (floating_sel_drawable == GIMP_DRAWABLE (channel))
|
||||
new_floating_sel_drawable = GIMP_DRAWABLE (new_channel);
|
||||
|
||||
gimp_image_add_channel (new_image, new_channel, count++);
|
||||
gimp_image_add_channel (new_image, new_channel, count++, FALSE);
|
||||
}
|
||||
|
||||
/* Copy any vectors */
|
||||
|
@ -184,7 +184,7 @@ gimp_image_duplicate (GimpImage *image)
|
|||
if (gimp_image_get_active_vectors (image) == vectors)
|
||||
active_vectors = new_vectors;
|
||||
|
||||
gimp_image_add_vectors (new_image, new_vectors, count++);
|
||||
gimp_image_add_vectors (new_image, new_vectors, count++, FALSE);
|
||||
}
|
||||
|
||||
/* Copy the selection mask */
|
||||
|
|
|
@ -119,7 +119,7 @@ gimp_image_merge_visible_layers (GimpImage *image,
|
|||
GSList *list;
|
||||
|
||||
for (list = invisible_list; list; list = g_slist_next (list))
|
||||
gimp_image_remove_layer (image, list->data);
|
||||
gimp_image_remove_layer (image, list->data, TRUE, NULL);
|
||||
|
||||
gimp_image_undo_group_end (image);
|
||||
g_slist_free (invisible_list);
|
||||
|
@ -260,14 +260,14 @@ gimp_image_merge_visible_vectors (GimpImage *image,
|
|||
target_vectors = GIMP_VECTORS (gimp_item_duplicate (GIMP_ITEM (vectors),
|
||||
GIMP_TYPE_VECTORS));
|
||||
pos = gimp_image_get_vectors_index (image, vectors);
|
||||
gimp_image_remove_vectors (image, vectors);
|
||||
gimp_image_remove_vectors (image, vectors, TRUE, NULL);
|
||||
cur_item = cur_item->next;
|
||||
|
||||
while (cur_item)
|
||||
{
|
||||
vectors = GIMP_VECTORS (cur_item->data);
|
||||
gimp_vectors_add_strokes (vectors, target_vectors);
|
||||
gimp_image_remove_vectors (image, vectors);
|
||||
gimp_image_remove_vectors (image, vectors, TRUE, NULL);
|
||||
|
||||
cur_item = g_slist_next (cur_item);
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ gimp_image_merge_visible_vectors (GimpImage *image,
|
|||
|
||||
g_slist_free (merge_list);
|
||||
|
||||
gimp_image_add_vectors (image, target_vectors, pos);
|
||||
gimp_image_add_vectors (image, target_vectors, pos, TRUE);
|
||||
gimp_unset_busy (image->gimp);
|
||||
|
||||
gimp_image_undo_group_end (image);
|
||||
|
@ -574,7 +574,7 @@ gimp_image_merge_layers (GimpImage *image,
|
|||
active,
|
||||
operation);
|
||||
|
||||
gimp_image_remove_layer (image, layer);
|
||||
gimp_image_remove_layer (image, layer, TRUE, NULL);
|
||||
|
||||
reverse_list = g_slist_next (reverse_list);
|
||||
}
|
||||
|
@ -590,16 +590,18 @@ gimp_image_merge_layers (GimpImage *image,
|
|||
layer = list->data;
|
||||
|
||||
list = g_list_next (list);
|
||||
gimp_image_remove_layer (image, layer);
|
||||
gimp_image_remove_layer (image, layer, TRUE, NULL);
|
||||
}
|
||||
|
||||
gimp_image_add_layer (image, merge_layer, position);
|
||||
gimp_image_add_layer (image, merge_layer, position, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Add the layer to the image */
|
||||
gimp_image_add_layer (image, merge_layer,
|
||||
gimp_container_num_children (image->layers) - position + 1);
|
||||
gimp_image_add_layer
|
||||
(image, merge_layer,
|
||||
gimp_container_num_children (image->layers) - position + 1,
|
||||
TRUE);
|
||||
}
|
||||
|
||||
/* set the name after the original layers have been removed so we
|
||||
|
|
|
@ -117,7 +117,7 @@ gimp_image_set_quick_mask_state (GimpImage *image,
|
|||
if (image->quick_mask_inverted)
|
||||
gimp_channel_invert (mask, FALSE);
|
||||
|
||||
gimp_image_add_channel (image, mask, 0);
|
||||
gimp_image_add_channel (image, mask, 0, TRUE);
|
||||
|
||||
gimp_image_undo_group_end (image);
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ gimp_image_set_quick_mask_state (GimpImage *image,
|
|||
floating_sel_anchor (floating_sel);
|
||||
|
||||
gimp_selection_load (gimp_image_get_mask (image), mask);
|
||||
gimp_image_remove_channel (image, mask);
|
||||
gimp_image_remove_channel (image, mask, TRUE, NULL);
|
||||
|
||||
if (! channel_was_active)
|
||||
gimp_image_unset_active_channel (image);
|
||||
|
|
|
@ -173,7 +173,7 @@ gimp_image_scale (GimpImage *image,
|
|||
{
|
||||
GimpLayer *layer = list->data;
|
||||
|
||||
gimp_image_remove_layer (image, layer);
|
||||
gimp_image_remove_layer (image, layer, TRUE, NULL);
|
||||
}
|
||||
|
||||
g_list_free (remove);
|
||||
|
|
|
@ -2854,7 +2854,8 @@ gimp_image_get_vectors_by_name (const GimpImage *image,
|
|||
gboolean
|
||||
gimp_image_add_layer (GimpImage *image,
|
||||
GimpLayer *layer,
|
||||
gint position)
|
||||
gint position,
|
||||
gboolean push_undo)
|
||||
{
|
||||
GimpLayer *active_layer;
|
||||
GimpLayer *floating_sel;
|
||||
|
@ -2862,7 +2863,7 @@ gimp_image_add_layer (GimpImage *image,
|
|||
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
||||
g_return_val_if_fail (GIMP_IS_LAYER (layer), FALSE);
|
||||
g_return_val_if_fail (g_object_is_floating (layer), FALSE);
|
||||
g_return_val_if_fail (! gimp_item_is_attached (GIMP_ITEM (layer)), FALSE);
|
||||
g_return_val_if_fail (gimp_item_get_image (GIMP_ITEM (layer)) == image,
|
||||
FALSE);
|
||||
|
||||
|
@ -2872,10 +2873,11 @@ gimp_image_add_layer (GimpImage *image,
|
|||
|
||||
old_has_alpha = gimp_image_has_alpha (image);
|
||||
|
||||
gimp_image_undo_push_layer_add (image, _("Add Layer"),
|
||||
layer, active_layer);
|
||||
if (push_undo)
|
||||
gimp_image_undo_push_layer_add (image, _("Add Layer"),
|
||||
layer, active_layer);
|
||||
|
||||
/* If the layer is a floating selection, set the ID */
|
||||
/* If the layer is a floating selection, set the fs pointer */
|
||||
if (gimp_layer_is_floating_sel (layer))
|
||||
image->floating_sel = layer;
|
||||
|
||||
|
@ -2907,7 +2909,7 @@ gimp_image_add_layer (GimpImage *image,
|
|||
gimp_image_set_active_layer (image, layer);
|
||||
|
||||
if (old_has_alpha != gimp_image_has_alpha (image))
|
||||
gimp_image_alpha_changed (image);
|
||||
image->flush_accum.alpha_changed = TRUE;
|
||||
|
||||
if (gimp_layer_is_floating_sel (layer))
|
||||
gimp_image_floating_selection_changed (image);
|
||||
|
@ -2917,7 +2919,9 @@ gimp_image_add_layer (GimpImage *image,
|
|||
|
||||
void
|
||||
gimp_image_remove_layer (GimpImage *image,
|
||||
GimpLayer *layer)
|
||||
GimpLayer *layer,
|
||||
gboolean push_undo,
|
||||
GimpLayer *new_active)
|
||||
{
|
||||
GimpLayer *active_layer;
|
||||
gint index;
|
||||
|
@ -2931,6 +2935,14 @@ gimp_image_remove_layer (GimpImage *image,
|
|||
|
||||
if (gimp_drawable_has_floating_sel (GIMP_DRAWABLE (layer)))
|
||||
{
|
||||
if (! push_undo)
|
||||
{
|
||||
g_warning ("%s() was called from an undo function while the layer "
|
||||
"had a floating selection. Please report this at "
|
||||
"http://www.gimp.org/bugs/", G_STRFUNC);
|
||||
return;
|
||||
}
|
||||
|
||||
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_IMAGE_ITEM_REMOVE,
|
||||
_("Remove Layer"));
|
||||
undo_group = TRUE;
|
||||
|
@ -2945,8 +2957,9 @@ gimp_image_remove_layer (GimpImage *image,
|
|||
|
||||
old_has_alpha = gimp_image_has_alpha (image);
|
||||
|
||||
gimp_image_undo_push_layer_remove (image, _("Remove Layer"),
|
||||
layer, index, active_layer);
|
||||
if (push_undo)
|
||||
gimp_image_undo_push_layer_remove (image, _("Remove Layer"),
|
||||
layer, index, active_layer);
|
||||
|
||||
g_object_ref (layer);
|
||||
|
||||
|
@ -2970,7 +2983,11 @@ gimp_image_remove_layer (GimpImage *image,
|
|||
}
|
||||
else if (layer == active_layer)
|
||||
{
|
||||
if (image->layer_stack)
|
||||
if (new_active)
|
||||
{
|
||||
active_layer = new_active;
|
||||
}
|
||||
else if (image->layer_stack)
|
||||
{
|
||||
active_layer = image->layer_stack->data;
|
||||
}
|
||||
|
@ -2999,7 +3016,7 @@ gimp_image_remove_layer (GimpImage *image,
|
|||
g_object_unref (layer);
|
||||
|
||||
if (old_has_alpha != gimp_image_has_alpha (image))
|
||||
gimp_image_alpha_changed (image);
|
||||
image->flush_accum.alpha_changed = TRUE;
|
||||
|
||||
if (undo_group)
|
||||
gimp_image_undo_group_end (image);
|
||||
|
@ -3063,7 +3080,7 @@ gimp_image_add_layers (GimpImage *image,
|
|||
|
||||
gimp_item_translate (new_item, offset_x, offset_y, FALSE);
|
||||
|
||||
gimp_image_add_layer (image, GIMP_LAYER (new_item), position);
|
||||
gimp_image_add_layer (image, GIMP_LAYER (new_item), position, TRUE);
|
||||
position++;
|
||||
}
|
||||
|
||||
|
@ -3194,20 +3211,22 @@ gimp_image_position_layer (GimpImage *image,
|
|||
gboolean
|
||||
gimp_image_add_channel (GimpImage *image,
|
||||
GimpChannel *channel,
|
||||
gint position)
|
||||
gint position,
|
||||
gboolean push_undo)
|
||||
{
|
||||
GimpChannel *active_channel;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
||||
g_return_val_if_fail (GIMP_IS_CHANNEL (channel), FALSE);
|
||||
g_return_val_if_fail (g_object_is_floating (channel), FALSE);
|
||||
g_return_val_if_fail (! gimp_item_is_attached (GIMP_ITEM (channel)), FALSE);
|
||||
g_return_val_if_fail (gimp_item_get_image (GIMP_ITEM (channel)) == image,
|
||||
FALSE);
|
||||
|
||||
active_channel = gimp_image_get_active_channel (image);
|
||||
|
||||
gimp_image_undo_push_channel_add (image, _("Add Channel"),
|
||||
channel, active_channel);
|
||||
if (push_undo)
|
||||
gimp_image_undo_push_channel_add (image, _("Add Channel"),
|
||||
channel, active_channel);
|
||||
|
||||
/* add the layer to the list at the specified position */
|
||||
if (position == -1)
|
||||
|
@ -3235,7 +3254,9 @@ gimp_image_add_channel (GimpImage *image,
|
|||
|
||||
void
|
||||
gimp_image_remove_channel (GimpImage *image,
|
||||
GimpChannel *channel)
|
||||
GimpChannel *channel,
|
||||
gboolean push_undo,
|
||||
GimpChannel *new_active)
|
||||
{
|
||||
GimpChannel *active_channel;
|
||||
gint index;
|
||||
|
@ -3248,6 +3269,14 @@ gimp_image_remove_channel (GimpImage *image,
|
|||
|
||||
if (gimp_drawable_has_floating_sel (GIMP_DRAWABLE (channel)))
|
||||
{
|
||||
if (! push_undo)
|
||||
{
|
||||
g_warning ("%s() was called from an undo function while the channel "
|
||||
"had a floating selection. Please report this at "
|
||||
"http://www.gimp.org/bugs/", G_STRFUNC);
|
||||
return;
|
||||
}
|
||||
|
||||
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_IMAGE_ITEM_REMOVE,
|
||||
_("Remove Channel"));
|
||||
undo_group = TRUE;
|
||||
|
@ -3260,8 +3289,9 @@ gimp_image_remove_channel (GimpImage *image,
|
|||
index = gimp_container_get_child_index (image->channels,
|
||||
GIMP_OBJECT (channel));
|
||||
|
||||
gimp_image_undo_push_channel_remove (image, _("Remove Channel"),
|
||||
channel, index, active_channel);
|
||||
if (push_undo)
|
||||
gimp_image_undo_push_channel_remove (image, _("Remove Channel"),
|
||||
channel, index, active_channel);
|
||||
|
||||
g_object_ref (channel);
|
||||
|
||||
|
@ -3270,21 +3300,31 @@ gimp_image_remove_channel (GimpImage *image,
|
|||
|
||||
if (channel == active_channel)
|
||||
{
|
||||
gint n_children = gimp_container_num_children (image->channels);
|
||||
|
||||
if (n_children > 0)
|
||||
if (new_active)
|
||||
{
|
||||
index = CLAMP (index, 0, n_children - 1);
|
||||
|
||||
active_channel = (GimpChannel *)
|
||||
gimp_container_get_child_by_index (image->channels, index);
|
||||
|
||||
gimp_image_set_active_channel (image, active_channel);
|
||||
active_channel = new_active;
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_image_unset_active_channel (image);
|
||||
gint n_children = gimp_container_num_children (image->channels);
|
||||
|
||||
if (n_children > 0)
|
||||
{
|
||||
index = CLAMP (index, 0, n_children - 1);
|
||||
|
||||
active_channel = (GimpChannel *)
|
||||
gimp_container_get_child_by_index (image->channels, index);
|
||||
}
|
||||
else
|
||||
{
|
||||
active_channel = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (active_channel)
|
||||
gimp_image_set_active_channel (image, active_channel);
|
||||
else
|
||||
gimp_image_unset_active_channel (image);
|
||||
}
|
||||
|
||||
g_object_unref (channel);
|
||||
|
@ -3417,20 +3457,22 @@ gimp_image_position_channel (GimpImage *image,
|
|||
gboolean
|
||||
gimp_image_add_vectors (GimpImage *image,
|
||||
GimpVectors *vectors,
|
||||
gint position)
|
||||
gint position,
|
||||
gboolean push_undo)
|
||||
{
|
||||
GimpVectors *active_vectors;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
||||
g_return_val_if_fail (GIMP_IS_VECTORS (vectors), FALSE);
|
||||
g_return_val_if_fail (g_object_is_floating (vectors), FALSE);
|
||||
g_return_val_if_fail (! gimp_item_is_attached (GIMP_ITEM (vectors)), FALSE);
|
||||
g_return_val_if_fail (gimp_item_get_image (GIMP_ITEM (vectors)) == image,
|
||||
FALSE);
|
||||
|
||||
active_vectors = gimp_image_get_active_vectors (image);
|
||||
|
||||
gimp_image_undo_push_vectors_add (image, _("Add Path"),
|
||||
vectors, active_vectors);
|
||||
if (push_undo)
|
||||
gimp_image_undo_push_vectors_add (image, _("Add Path"),
|
||||
vectors, active_vectors);
|
||||
|
||||
/* add the layer to the list at the specified position */
|
||||
if (position == -1)
|
||||
|
@ -3458,7 +3500,9 @@ gimp_image_add_vectors (GimpImage *image,
|
|||
|
||||
void
|
||||
gimp_image_remove_vectors (GimpImage *image,
|
||||
GimpVectors *vectors)
|
||||
GimpVectors *vectors,
|
||||
gboolean push_undo,
|
||||
GimpVectors *new_active)
|
||||
{
|
||||
GimpVectors *active_vectors;
|
||||
gint index;
|
||||
|
@ -3473,8 +3517,9 @@ gimp_image_remove_vectors (GimpImage *image,
|
|||
index = gimp_container_get_child_index (image->vectors,
|
||||
GIMP_OBJECT (vectors));
|
||||
|
||||
gimp_image_undo_push_vectors_remove (image, _("Remove Path"),
|
||||
vectors, index, active_vectors);
|
||||
if (push_undo)
|
||||
gimp_image_undo_push_vectors_remove (image, _("Remove Path"),
|
||||
vectors, index, active_vectors);
|
||||
|
||||
g_object_ref (vectors);
|
||||
|
||||
|
@ -3483,18 +3528,25 @@ gimp_image_remove_vectors (GimpImage *image,
|
|||
|
||||
if (vectors == active_vectors)
|
||||
{
|
||||
gint n_children = gimp_container_num_children (image->vectors);
|
||||
|
||||
if (n_children > 0)
|
||||
if (new_active)
|
||||
{
|
||||
index = CLAMP (index, 0, n_children - 1);
|
||||
|
||||
active_vectors = (GimpVectors *)
|
||||
gimp_container_get_child_by_index (image->vectors, index);
|
||||
active_vectors = new_active;
|
||||
}
|
||||
else
|
||||
{
|
||||
active_vectors = NULL;
|
||||
gint n_children = gimp_container_num_children (image->vectors);
|
||||
|
||||
if (n_children > 0)
|
||||
{
|
||||
index = CLAMP (index, 0, n_children - 1);
|
||||
|
||||
active_vectors = (GimpVectors *)
|
||||
gimp_container_get_child_by_index (image->vectors, index);
|
||||
}
|
||||
else
|
||||
{
|
||||
active_vectors = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
gimp_image_set_active_vectors (image, active_vectors);
|
||||
|
|
|
@ -458,9 +458,12 @@ GimpVectors * gimp_image_get_vectors_by_name (const GimpImage *image,
|
|||
|
||||
gboolean gimp_image_add_layer (GimpImage *image,
|
||||
GimpLayer *layer,
|
||||
gint position);
|
||||
gint position,
|
||||
gboolean push_undo);
|
||||
void gimp_image_remove_layer (GimpImage *image,
|
||||
GimpLayer *layer);
|
||||
GimpLayer *layer,
|
||||
gboolean push_undo,
|
||||
GimpLayer *new_active);
|
||||
|
||||
void gimp_image_add_layers (GimpImage *image,
|
||||
GList *layers,
|
||||
|
@ -489,9 +492,12 @@ gboolean gimp_image_position_layer (GimpImage *image,
|
|||
|
||||
gboolean gimp_image_add_channel (GimpImage *image,
|
||||
GimpChannel *channel,
|
||||
gint position);
|
||||
gint position,
|
||||
gboolean push_undo);
|
||||
void gimp_image_remove_channel (GimpImage *image,
|
||||
GimpChannel *channel);
|
||||
GimpChannel *channel,
|
||||
gboolean push_undo,
|
||||
GimpChannel *new_active);
|
||||
|
||||
gboolean gimp_image_raise_channel (GimpImage *image,
|
||||
GimpChannel *channel,
|
||||
|
@ -511,9 +517,12 @@ gboolean gimp_image_position_channel (GimpImage *image,
|
|||
|
||||
gboolean gimp_image_add_vectors (GimpImage *image,
|
||||
GimpVectors *vectors,
|
||||
gint position);
|
||||
gint position,
|
||||
gboolean push_undo);
|
||||
void gimp_image_remove_vectors (GimpImage *image,
|
||||
GimpVectors *vectors);
|
||||
GimpVectors *vectors,
|
||||
gboolean push_undo,
|
||||
GimpVectors *new_active);
|
||||
|
||||
gboolean gimp_image_raise_vectors (GimpImage *image,
|
||||
GimpVectors *vectors,
|
||||
|
|
|
@ -79,7 +79,7 @@ floating_sel_attach (GimpLayer *layer,
|
|||
gimp_drawable_bytes (drawable));
|
||||
|
||||
/* add the layer to the image */
|
||||
gimp_image_add_layer (image, layer, 0);
|
||||
gimp_image_add_layer (image, layer, 0, TRUE);
|
||||
|
||||
/* store the affected area from the drawable in the backing store */
|
||||
floating_sel_rigor (layer, TRUE);
|
||||
|
@ -109,7 +109,7 @@ floating_sel_remove (GimpLayer *layer)
|
|||
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (layer));
|
||||
|
||||
/* remove the layer from the image */
|
||||
gimp_image_remove_layer (image, layer);
|
||||
gimp_image_remove_layer (image, layer, TRUE, NULL);
|
||||
|
||||
gimp_image_undo_group_end (image);
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ floating_sel_anchor (GimpLayer *layer)
|
|||
drawable = layer->fs.drawable;
|
||||
|
||||
/* remove the floating selection */
|
||||
gimp_image_remove_layer (image, layer);
|
||||
gimp_image_remove_layer (image, layer, TRUE, NULL);
|
||||
|
||||
/* end the group undo */
|
||||
gimp_image_undo_group_end (image);
|
||||
|
|
|
@ -22,10 +22,8 @@
|
|||
|
||||
#include "core-types.h"
|
||||
|
||||
#include "gimpcontainer.h"
|
||||
#include "gimpimage.h"
|
||||
#include "gimplayer.h"
|
||||
#include "gimplayer-floating-sel.h"
|
||||
#include "gimplayerundo.h"
|
||||
|
||||
|
||||
|
@ -197,44 +195,8 @@ gimp_layer_undo_pop (GimpUndo *undo,
|
|||
layer_undo->prev_position = gimp_image_get_layer_index (undo->image,
|
||||
layer);
|
||||
|
||||
gimp_container_remove (undo->image->layers, GIMP_OBJECT (layer));
|
||||
undo->image->layer_stack = g_slist_remove (undo->image->layer_stack,
|
||||
layer);
|
||||
|
||||
if (gimp_layer_is_floating_sel (layer))
|
||||
{
|
||||
/* invalidate the boundary *before* setting the
|
||||
* floating_sel pointer to NULL because the selection's
|
||||
* outline is affected by the floating_sel and won't be
|
||||
* completely cleared otherwise (bug #160247).
|
||||
*/
|
||||
gimp_drawable_invalidate_boundary (GIMP_DRAWABLE (layer));
|
||||
|
||||
undo->image->floating_sel = NULL;
|
||||
|
||||
/* activate the underlying drawable */
|
||||
floating_sel_activate_drawable (layer);
|
||||
|
||||
gimp_image_floating_selection_changed (undo->image);
|
||||
}
|
||||
else if (layer == gimp_image_get_active_layer (undo->image))
|
||||
{
|
||||
if (layer_undo->prev_layer)
|
||||
{
|
||||
gimp_image_set_active_layer (undo->image, layer_undo->prev_layer);
|
||||
}
|
||||
else if (undo->image->layer_stack)
|
||||
{
|
||||
gimp_image_set_active_layer (undo->image,
|
||||
undo->image->layer_stack->data);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_image_set_active_layer (undo->image, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
gimp_item_removed (GIMP_ITEM (layer));
|
||||
gimp_image_remove_layer (undo->image, layer, FALSE,
|
||||
layer_undo->prev_layer);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -243,16 +205,8 @@ gimp_layer_undo_pop (GimpUndo *undo,
|
|||
/* record the active layer */
|
||||
layer_undo->prev_layer = gimp_image_get_active_layer (undo->image);
|
||||
|
||||
/* if this is a floating selection, set the fs pointer */
|
||||
if (gimp_layer_is_floating_sel (layer))
|
||||
undo->image->floating_sel = layer;
|
||||
|
||||
gimp_container_insert (undo->image->layers,
|
||||
GIMP_OBJECT (layer), layer_undo->prev_position);
|
||||
gimp_image_set_active_layer (undo->image, layer);
|
||||
|
||||
if (gimp_layer_is_floating_sel (layer))
|
||||
gimp_image_floating_selection_changed (undo->image);
|
||||
gimp_image_add_layer (undo->image, layer,
|
||||
layer_undo->prev_position, FALSE);
|
||||
|
||||
GIMP_ITEM (layer)->removed = FALSE;
|
||||
|
||||
|
|
|
@ -587,7 +587,7 @@ gimp_selection_save (GimpChannel *selection)
|
|||
/* saved selections are not visible by default */
|
||||
gimp_item_set_visible (GIMP_ITEM (new_channel), FALSE, FALSE);
|
||||
|
||||
gimp_image_add_channel (image, new_channel, -1);
|
||||
gimp_image_add_channel (image, new_channel, -1, TRUE);
|
||||
|
||||
return new_channel;
|
||||
}
|
||||
|
@ -766,7 +766,8 @@ gimp_selection_extract (GimpChannel *selection,
|
|||
if (gimp_layer_is_floating_sel (GIMP_LAYER (pickable)))
|
||||
floating_sel_remove (GIMP_LAYER (pickable));
|
||||
else
|
||||
gimp_image_remove_layer (image, GIMP_LAYER (pickable));
|
||||
gimp_image_remove_layer (image, GIMP_LAYER (pickable),
|
||||
TRUE, NULL);
|
||||
}
|
||||
else if (GIMP_IS_LAYER_MASK (pickable))
|
||||
{
|
||||
|
@ -775,7 +776,8 @@ gimp_selection_extract (GimpChannel *selection,
|
|||
}
|
||||
else if (GIMP_IS_CHANNEL (pickable))
|
||||
{
|
||||
gimp_image_remove_channel (image, GIMP_CHANNEL (pickable));
|
||||
gimp_image_remove_channel (image, GIMP_CHANNEL (pickable),
|
||||
TRUE, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -408,7 +408,7 @@ gimp_template_create_image (Gimp *gimp,
|
|||
gimp_drawable_fill_by_type (GIMP_DRAWABLE (layer),
|
||||
context, template->fill_type);
|
||||
|
||||
gimp_image_add_layer (image, layer, 0);
|
||||
gimp_image_add_layer (image, layer, 0, FALSE);
|
||||
|
||||
gimp_image_undo_enable (image);
|
||||
gimp_image_clean_all (image);
|
||||
|
|
|
@ -260,7 +260,7 @@ gimp_display_shell_drop_drawable (GtkWidget *widget,
|
|||
gimp_item_set_visible (new_item, TRUE, FALSE);
|
||||
gimp_item_set_linked (new_item, FALSE, FALSE);
|
||||
|
||||
gimp_image_add_layer (image, new_layer, -1);
|
||||
gimp_image_add_layer (image, new_layer, -1, TRUE);
|
||||
|
||||
gimp_image_undo_group_end (image);
|
||||
|
||||
|
@ -300,7 +300,7 @@ gimp_display_shell_drop_vectors (GtkWidget *widget,
|
|||
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_EDIT_PASTE,
|
||||
_("Drop New Path"));
|
||||
|
||||
gimp_image_add_vectors (image, new_vectors, -1);
|
||||
gimp_image_add_vectors (image, new_vectors, -1, TRUE);
|
||||
|
||||
gimp_image_undo_group_end (image);
|
||||
|
||||
|
@ -571,7 +571,7 @@ gimp_display_shell_drop_component (GtkWidget *widget,
|
|||
|
||||
gimp_display_shell_dnd_position_item (shell, new_item);
|
||||
|
||||
gimp_image_add_layer (dest_image, new_layer, -1);
|
||||
gimp_image_add_layer (dest_image, new_layer, -1, TRUE);
|
||||
|
||||
gimp_image_undo_group_end (dest_image);
|
||||
|
||||
|
@ -643,7 +643,7 @@ gimp_display_shell_drop_pixbuf (GtkWidget *widget,
|
|||
if (! new_image)
|
||||
gimp_display_shell_dnd_position_item (shell, new_item);
|
||||
|
||||
gimp_image_add_layer (image, new_layer, -1);
|
||||
gimp_image_add_layer (image, new_layer, -1, TRUE);
|
||||
|
||||
gimp_image_undo_group_end (image);
|
||||
|
||||
|
|
|
@ -915,7 +915,7 @@ image_add_layer_invoker (GimpProcedure *procedure,
|
|||
GIMP_IMAGE_TYPE_BASE_TYPE (gimp_drawable_type (GIMP_DRAWABLE (layer))),
|
||||
error))
|
||||
{
|
||||
success = gimp_image_add_layer (image, layer, MAX (position, -1));
|
||||
success = gimp_image_add_layer (image, layer, MAX (position, -1), TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -945,7 +945,7 @@ image_remove_layer_invoker (GimpProcedure *procedure,
|
|||
if (success)
|
||||
{
|
||||
if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), error))
|
||||
gimp_image_remove_layer (image, layer);
|
||||
gimp_image_remove_layer (image, layer, TRUE, NULL);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
|
@ -1105,7 +1105,7 @@ image_add_channel_invoker (GimpProcedure *procedure,
|
|||
{
|
||||
if (gimp_pdb_item_is_floating (GIMP_ITEM (channel), image, error))
|
||||
{
|
||||
success = gimp_image_add_channel (image, channel, MAX (position, -1));
|
||||
success = gimp_image_add_channel (image, channel, MAX (position, -1), TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1135,7 +1135,7 @@ image_remove_channel_invoker (GimpProcedure *procedure,
|
|||
if (success)
|
||||
{
|
||||
if (gimp_pdb_item_is_attached (GIMP_ITEM (channel), error))
|
||||
gimp_image_remove_channel (image, channel);
|
||||
gimp_image_remove_channel (image, channel, TRUE, NULL);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
|
@ -1247,7 +1247,7 @@ image_add_vectors_invoker (GimpProcedure *procedure,
|
|||
{
|
||||
if (gimp_pdb_item_is_floating (GIMP_ITEM (vectors), image, error))
|
||||
{
|
||||
success = gimp_image_add_vectors (image, vectors, MAX (position, -1));
|
||||
success = gimp_image_add_vectors (image, vectors, MAX (position, -1), TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1277,7 +1277,7 @@ image_remove_vectors_invoker (GimpProcedure *procedure,
|
|||
if (success)
|
||||
{
|
||||
if (gimp_pdb_item_is_attached (GIMP_ITEM (vectors), error))
|
||||
gimp_image_remove_vectors (image, vectors);
|
||||
gimp_image_remove_vectors (image, vectors, TRUE, NULL);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
|
|
|
@ -162,7 +162,7 @@ path_delete_invoker (GimpProcedure *procedure,
|
|||
GimpVectors *vectors = gimp_image_get_vectors_by_name (image, name);
|
||||
|
||||
if (vectors)
|
||||
gimp_image_remove_vectors (image, vectors);
|
||||
gimp_image_remove_vectors (image, vectors, TRUE, NULL);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
|
@ -303,7 +303,7 @@ path_set_points_invoker (GimpProcedure *procedure,
|
|||
g_free (points);
|
||||
|
||||
if (vectors)
|
||||
success = gimp_image_add_vectors (image, vectors, 0);
|
||||
success = gimp_image_add_vectors (image, vectors, 0, TRUE);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
|
|
|
@ -118,12 +118,16 @@ text_render (GimpImage *image,
|
|||
if (! gimp_channel_is_empty (gimp_image_get_mask (image)))
|
||||
gimp_channel_clear (gimp_image_get_mask (image), NULL, TRUE);
|
||||
|
||||
/* If the drawable is NULL, create a new layer */
|
||||
if (drawable == NULL)
|
||||
gimp_image_add_layer (image, layer, -1);
|
||||
/* Otherwise, instantiate the text as the new floating selection */
|
||||
{
|
||||
/* If the drawable is NULL, create a new layer */
|
||||
gimp_image_add_layer (image, layer, -1, TRUE);
|
||||
}
|
||||
else
|
||||
floating_sel_attach (layer, drawable);
|
||||
{
|
||||
/* Otherwise, instantiate the text as the new floating selection */
|
||||
floating_sel_attach (layer, drawable);
|
||||
}
|
||||
|
||||
/* end the group undo */
|
||||
gimp_image_undo_group_end (image);
|
||||
|
|
|
@ -803,7 +803,7 @@ gimp_text_tool_create_vectors (GimpTextTool *text_tool)
|
|||
gimp_item_translate (GIMP_ITEM (vectors), x, y, FALSE);
|
||||
}
|
||||
|
||||
gimp_image_add_vectors (text_tool->image, vectors, -1);
|
||||
gimp_image_add_vectors (text_tool->image, vectors, -1, TRUE);
|
||||
|
||||
gimp_image_flush (text_tool->image);
|
||||
}
|
||||
|
@ -829,7 +829,7 @@ gimp_text_tool_create_vectors_warped (GimpTextTool *text_tool)
|
|||
|
||||
gimp_vectors_warp_vectors (vectors0, vectors, 0.5 * box_height);
|
||||
|
||||
gimp_image_add_vectors (text_tool->image, vectors, -1);
|
||||
gimp_image_add_vectors (text_tool->image, vectors, -1, TRUE);
|
||||
gimp_image_set_active_vectors (text_tool->image, vectors);
|
||||
gimp_item_set_visible (GIMP_ITEM (vectors), TRUE, FALSE);
|
||||
|
||||
|
@ -892,7 +892,7 @@ gimp_text_tool_create_layer (GimpTextTool *text_tool,
|
|||
GIMP_ITEM (layer)->offset_x = text_tool->x1;
|
||||
GIMP_ITEM (layer)->offset_y = text_tool->y1;
|
||||
|
||||
gimp_image_add_layer (image, layer, -1);
|
||||
gimp_image_add_layer (image, layer, -1, TRUE);
|
||||
|
||||
if (text_tool->text_box_fixed)
|
||||
{
|
||||
|
|
|
@ -303,7 +303,7 @@ gimp_vector_tool_button_press (GimpTool *tool,
|
|||
|
||||
vector_tool->undo_motion = TRUE;
|
||||
|
||||
gimp_image_add_vectors (display->image, vectors, -1);
|
||||
gimp_image_add_vectors (display->image, vectors, -1, TRUE);
|
||||
gimp_image_flush (display->image);
|
||||
|
||||
gimp_vector_tool_set_vectors (vector_tool, vectors);
|
||||
|
|
|
@ -305,7 +305,7 @@ gimp_vectors_import (GimpImage *image,
|
|||
vectors = gimp_vectors_new (image,
|
||||
((merge || !path->id) ?
|
||||
_("Imported Path") : path->id));
|
||||
gimp_image_add_vectors (image, vectors, position);
|
||||
gimp_image_add_vectors (image, vectors, position, TRUE);
|
||||
gimp_vectors_freeze (vectors);
|
||||
|
||||
if (ret_vectors)
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
|
||||
#include "vectors-types.h"
|
||||
|
||||
#include "core/gimpcontainer.h"
|
||||
#include "core/gimpimage.h"
|
||||
|
||||
#include "gimpvectors.h"
|
||||
|
@ -194,12 +193,8 @@ gimp_vectors_undo_pop (GimpUndo *undo,
|
|||
vectors_undo->prev_position = gimp_image_get_vectors_index (undo->image,
|
||||
vectors);
|
||||
|
||||
gimp_container_remove (undo->image->vectors, GIMP_OBJECT (vectors));
|
||||
gimp_item_removed (GIMP_ITEM (vectors));
|
||||
|
||||
if (vectors == gimp_image_get_active_vectors (undo->image))
|
||||
gimp_image_set_active_vectors (undo->image,
|
||||
vectors_undo->prev_vectors);
|
||||
gimp_image_remove_vectors (undo->image, vectors, FALSE,
|
||||
vectors_undo->prev_vectors);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -208,9 +203,8 @@ gimp_vectors_undo_pop (GimpUndo *undo,
|
|||
/* record the active vectors */
|
||||
vectors_undo->prev_vectors = gimp_image_get_active_vectors (undo->image);
|
||||
|
||||
gimp_container_insert (undo->image->vectors, GIMP_OBJECT (vectors),
|
||||
vectors_undo->prev_position);
|
||||
gimp_image_set_active_vectors (undo->image, vectors);
|
||||
gimp_image_add_vectors (undo->image, vectors,
|
||||
vectors_undo->prev_position, FALSE);
|
||||
|
||||
GIMP_ITEM (vectors)->removed = FALSE;
|
||||
}
|
||||
|
|
|
@ -211,7 +211,7 @@ gimp_channel_tree_view_drop_viewable (GimpContainerTreeView *tree_view,
|
|||
|
||||
gimp_item_set_linked (new_item, FALSE, FALSE);
|
||||
|
||||
item_view_class->add_item (item_view->image, new_item, index);
|
||||
item_view_class->add_item (item_view->image, new_item, index, TRUE);
|
||||
gimp_image_flush (item_view->image);
|
||||
return;
|
||||
}
|
||||
|
@ -261,7 +261,8 @@ gimp_channel_tree_view_drop_component (GimpContainerTreeView *tree_view,
|
|||
if (src_image != item_view->image)
|
||||
GIMP_ITEM_GET_CLASS (new_item)->convert (new_item, item_view->image);
|
||||
|
||||
gimp_image_add_channel (item_view->image, GIMP_CHANNEL (new_item), index);
|
||||
gimp_image_add_channel (item_view->image, GIMP_CHANNEL (new_item), index,
|
||||
TRUE);
|
||||
gimp_image_flush (item_view->image);
|
||||
}
|
||||
|
||||
|
@ -320,7 +321,7 @@ gimp_channel_tree_view_item_new (GimpImage *image)
|
|||
gimp_image_get_height (image),
|
||||
_("Empty Channel"), &color);
|
||||
|
||||
gimp_image_add_channel (image, new_channel, -1);
|
||||
gimp_image_add_channel (image, new_channel, -1, TRUE);
|
||||
|
||||
gimp_image_undo_group_end (image);
|
||||
|
||||
|
|
|
@ -734,7 +734,7 @@ gimp_item_tree_view_drop_viewable (GimpContainerTreeView *tree_view,
|
|||
|
||||
gimp_item_set_linked (new_item, FALSE, FALSE);
|
||||
|
||||
item_view_class->add_item (item_view->image, new_item, dest_index);
|
||||
item_view_class->add_item (item_view->image, new_item, dest_index, TRUE);
|
||||
}
|
||||
else if (dest_viewable)
|
||||
{
|
||||
|
|
|
@ -37,9 +37,12 @@ typedef void (* GimpReorderItemFunc) (GimpImage *image,
|
|||
const gchar *undo_desc);
|
||||
typedef void (* GimpAddItemFunc) (GimpImage *image,
|
||||
GimpItem *item,
|
||||
gint index);
|
||||
gint index,
|
||||
gboolean push_undo);
|
||||
typedef void (* GimpRemoveItemFunc) (GimpImage *image,
|
||||
GimpItem *item);
|
||||
GimpItem *item,
|
||||
gboolean push_undo,
|
||||
GimpItem *new_active);
|
||||
typedef GimpItem * (* GimpNewItemFunc) (GimpImage *image);
|
||||
|
||||
|
||||
|
|
|
@ -772,7 +772,7 @@ gimp_layer_tree_view_drop_component (GimpContainerTreeView *tree_view,
|
|||
gimp_object_take_name (GIMP_OBJECT (new_item),
|
||||
g_strdup_printf (_("%s Channel Copy"), desc));
|
||||
|
||||
gimp_image_add_layer (item_view->image, GIMP_LAYER (new_item), index);
|
||||
gimp_image_add_layer (item_view->image, GIMP_LAYER (new_item), index, TRUE);
|
||||
gimp_image_flush (item_view->image);
|
||||
}
|
||||
|
||||
|
@ -801,7 +801,7 @@ gimp_layer_tree_view_drop_pixbuf (GimpContainerTreeView *tree_view,
|
|||
_("Dropped Buffer"),
|
||||
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE);
|
||||
|
||||
gimp_image_add_layer (image, new_layer, index);
|
||||
gimp_image_add_layer (image, new_layer, index, TRUE);
|
||||
gimp_image_flush (image);
|
||||
}
|
||||
|
||||
|
@ -840,7 +840,7 @@ gimp_layer_tree_view_item_new (GimpImage *image)
|
|||
gimp_image_base_type_with_alpha (image),
|
||||
_("Empty Layer"), 1.0, GIMP_NORMAL_MODE);
|
||||
|
||||
gimp_image_add_layer (image, new_layer, -1);
|
||||
gimp_image_add_layer (image, new_layer, -1, TRUE);
|
||||
|
||||
gimp_image_undo_group_end (image);
|
||||
|
||||
|
|
|
@ -226,7 +226,7 @@ gimp_toolbox_drop_drawable (GtkWidget *widget,
|
|||
gimp_layer_set_opacity (new_layer, GIMP_OPACITY_OPAQUE, FALSE);
|
||||
gimp_layer_set_lock_alpha (new_layer, FALSE, FALSE);
|
||||
|
||||
gimp_image_add_layer (new_image, new_layer, 0);
|
||||
gimp_image_add_layer (new_image, new_layer, 0, TRUE);
|
||||
|
||||
gimp_image_undo_enable (new_image);
|
||||
|
||||
|
@ -312,7 +312,7 @@ gimp_toolbox_drop_component (GtkWidget *widget,
|
|||
gimp_object_take_name (GIMP_OBJECT (new_layer),
|
||||
g_strdup_printf (_("%s Channel Copy"), desc));
|
||||
|
||||
gimp_image_add_layer (new_image, new_layer, 0);
|
||||
gimp_image_add_layer (new_image, new_layer, 0, TRUE);
|
||||
|
||||
gimp_image_undo_enable (new_image);
|
||||
|
||||
|
@ -361,7 +361,7 @@ gimp_toolbox_drop_pixbuf (GtkWidget *widget,
|
|||
_("Dropped Buffer"),
|
||||
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE);
|
||||
|
||||
gimp_image_add_layer (new_image, new_layer, 0);
|
||||
gimp_image_add_layer (new_image, new_layer, 0, TRUE);
|
||||
|
||||
gimp_image_undo_enable (new_image);
|
||||
|
||||
|
|
|
@ -252,7 +252,7 @@ gimp_vectors_tree_view_item_new (GimpImage *image)
|
|||
|
||||
new_vectors = gimp_vectors_new (image, _("Empty Path"));
|
||||
|
||||
gimp_image_add_vectors (image, new_vectors, -1);
|
||||
gimp_image_add_vectors (image, new_vectors, -1, TRUE);
|
||||
|
||||
return GIMP_ITEM (new_vectors);
|
||||
}
|
||||
|
|
|
@ -201,7 +201,8 @@ xcf_load_image (Gimp *gimp,
|
|||
/* add the layer to the image if its not the floating selection */
|
||||
if (layer != info->floating_sel)
|
||||
gimp_image_add_layer (image, layer,
|
||||
gimp_container_num_children (image->layers));
|
||||
gimp_container_num_children (image->layers),
|
||||
FALSE);
|
||||
|
||||
/* restore the saved position so we'll be ready to
|
||||
* read the next offset.
|
||||
|
@ -242,7 +243,8 @@ xcf_load_image (Gimp *gimp,
|
|||
/* add the channel to the image if its not the selection */
|
||||
if (channel != gimp_image_get_mask (image))
|
||||
gimp_image_add_channel (image, channel,
|
||||
gimp_container_num_children (image->channels));
|
||||
gimp_container_num_children (image->channels),
|
||||
FALSE);
|
||||
|
||||
/* restore the saved position so we'll be ready to
|
||||
* read the next offset.
|
||||
|
@ -1625,7 +1627,8 @@ xcf_load_old_path (XcfInfo *info,
|
|||
gimp_item_set_tattoo (GIMP_ITEM (vectors), tattoo);
|
||||
|
||||
gimp_image_add_vectors (image, vectors,
|
||||
gimp_container_num_children (image->vectors));
|
||||
gimp_container_num_children (image->vectors),
|
||||
FALSE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1814,7 +1817,8 @@ xcf_load_vector (XcfInfo *info,
|
|||
}
|
||||
|
||||
gimp_image_add_vectors (image, vectors,
|
||||
gimp_container_num_children (image->vectors));
|
||||
gimp_container_num_children (image->vectors),
|
||||
FALSE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -1014,7 +1014,7 @@ HELP
|
|||
GIMP_IMAGE_TYPE_BASE_TYPE (gimp_drawable_type (GIMP_DRAWABLE (layer))),
|
||||
error))
|
||||
{
|
||||
success = gimp_image_add_layer (image, layer, MAX (position, -1));
|
||||
success = gimp_image_add_layer (image, layer, MAX (position, -1), TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1047,7 +1047,7 @@ HELP
|
|||
code => <<'CODE'
|
||||
{
|
||||
if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), error))
|
||||
gimp_image_remove_layer (image, layer);
|
||||
gimp_image_remove_layer (image, layer, TRUE, NULL);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
|
@ -1219,7 +1219,7 @@ HELP
|
|||
{
|
||||
if (gimp_pdb_item_is_floating (GIMP_ITEM (channel), image, error))
|
||||
{
|
||||
success = gimp_image_add_channel (image, channel, MAX (position, -1));
|
||||
success = gimp_image_add_channel (image, channel, MAX (position, -1), TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1251,7 +1251,7 @@ HELP
|
|||
code => <<'CODE'
|
||||
{
|
||||
if (gimp_pdb_item_is_attached (GIMP_ITEM (channel), error))
|
||||
gimp_image_remove_channel (image, channel);
|
||||
gimp_image_remove_channel (image, channel, TRUE, NULL);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
|
@ -1283,7 +1283,7 @@ HELP
|
|||
{
|
||||
if (gimp_pdb_item_is_floating (GIMP_ITEM (vectors), image, error))
|
||||
{
|
||||
success = gimp_image_add_vectors (image, vectors, MAX (position, -1));
|
||||
success = gimp_image_add_vectors (image, vectors, MAX (position, -1), TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1314,7 +1314,7 @@ HELP
|
|||
code => <<'CODE'
|
||||
{
|
||||
if (gimp_pdb_item_is_attached (GIMP_ITEM (vectors), error))
|
||||
gimp_image_remove_vectors (image, vectors);
|
||||
gimp_image_remove_vectors (image, vectors, TRUE, NULL);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
|
|
|
@ -242,7 +242,7 @@ sub path_set_points {
|
|||
g_free (points);
|
||||
|
||||
if (vectors)
|
||||
success = gimp_image_add_vectors (image, vectors, 0);
|
||||
success = gimp_image_add_vectors (image, vectors, 0, TRUE);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
|
@ -462,7 +462,7 @@ sub path_delete {
|
|||
GimpVectors *vectors = gimp_image_get_vectors_by_name (image, name);
|
||||
|
||||
if (vectors)
|
||||
gimp_image_remove_vectors (image, vectors);
|
||||
gimp_image_remove_vectors (image, vectors, TRUE, NULL);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue