mirror of https://github.com/GNOME/gimp.git
Simplify floating selection handling a bit more:
2009-02-07 Michael Natterer <mitch@gimp.org> Simplify floating selection handling a bit more: * app/core/gimpdrawable.c (gimp_drawable_attach_floating_sel) (gimp_drawable_detach_floating_sel): call gimp_image_set_floating_selection() from these functions. * app/core/gimpfloatingselundo.c (gimp_floating_sel_undo_pop) * app/core/gimpimage.c (gimp_image_add,remove_layer) * app/core/gimplayer-floating-sel.c (floating_sel_to_layer): don't call it here because we already call above functions. svn path=/trunk/; revision=28000
This commit is contained in:
parent
bfb8e1e115
commit
cb0f8d8d51
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
|||
2009-02-07 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
Simplify floating selection handling a bit more:
|
||||
|
||||
* app/core/gimpdrawable.c
|
||||
(gimp_drawable_attach_floating_sel)
|
||||
(gimp_drawable_detach_floating_sel): call
|
||||
gimp_image_set_floating_selection() from these functions.
|
||||
|
||||
* app/core/gimpfloatingselundo.c (gimp_floating_sel_undo_pop)
|
||||
* app/core/gimpimage.c (gimp_image_add,remove_layer)
|
||||
* app/core/gimplayer-floating-sel.c (floating_sel_to_layer): don't
|
||||
call it here because we already call above functions.
|
||||
|
||||
2009-02-07 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/core/gimpdrawable.c
|
||||
|
|
|
@ -1809,11 +1809,18 @@ void
|
|||
gimp_drawable_attach_floating_sel (GimpDrawable *drawable,
|
||||
GimpLayer *floating_sel)
|
||||
{
|
||||
GimpImage *image;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
|
||||
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
|
||||
g_return_if_fail (GIMP_IS_LAYER (floating_sel));
|
||||
|
||||
g_printerr ("%s\n", G_STRFUNC);
|
||||
|
||||
image = gimp_item_get_image (GIMP_ITEM (drawable));
|
||||
|
||||
gimp_image_set_floating_selection (image, floating_sel);
|
||||
|
||||
/* clear the selection */
|
||||
gimp_drawable_invalidate_boundary (GIMP_DRAWABLE (floating_sel));
|
||||
|
||||
|
@ -1829,11 +1836,15 @@ void
|
|||
gimp_drawable_detach_floating_sel (GimpDrawable *drawable,
|
||||
GimpLayer *floating_sel)
|
||||
{
|
||||
GimpImage *image;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
|
||||
g_return_if_fail (GIMP_IS_LAYER (floating_sel));
|
||||
|
||||
g_printerr ("%s\n", G_STRFUNC);
|
||||
|
||||
image = gimp_item_get_image (GIMP_ITEM (drawable));
|
||||
|
||||
gimp_drawable_sync_source_node (drawable, TRUE);
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
@ -1850,4 +1861,6 @@ gimp_drawable_detach_floating_sel (GimpDrawable *drawable,
|
|||
|
||||
/* clear the selection */
|
||||
gimp_drawable_invalidate_boundary (GIMP_DRAWABLE (floating_sel));
|
||||
|
||||
gimp_image_set_floating_selection (image, NULL);
|
||||
}
|
||||
|
|
|
@ -110,7 +110,6 @@ gimp_floating_sel_undo_pop (GimpUndo *undo,
|
|||
gimp_layer_set_floating_sel_drawable (floating_layer,
|
||||
floating_sel_undo->drawable);
|
||||
gimp_image_set_active_layer (undo->image, floating_layer);
|
||||
gimp_image_set_floating_selection (undo->image, floating_layer);
|
||||
|
||||
gimp_drawable_attach_floating_sel (gimp_layer_get_floating_sel_drawable (floating_layer),
|
||||
floating_layer);
|
||||
|
@ -120,9 +119,7 @@ gimp_floating_sel_undo_pop (GimpUndo *undo,
|
|||
gimp_drawable_detach_floating_sel (gimp_layer_get_floating_sel_drawable (floating_layer),
|
||||
floating_layer);
|
||||
|
||||
/* update the pointers */
|
||||
gimp_layer_set_floating_sel_drawable (floating_layer, NULL);
|
||||
gimp_image_set_floating_selection (undo->image, NULL);
|
||||
}
|
||||
|
||||
gimp_object_name_changed (GIMP_OBJECT (floating_layer));
|
||||
|
|
|
@ -2967,14 +2967,10 @@ gimp_image_add_layer (GimpImage *image,
|
|||
/* notify the layers dialog of the currently active layer */
|
||||
gimp_image_set_active_layer (image, layer);
|
||||
|
||||
/* If the layer is a floating selection, set the fs pointer */
|
||||
/* If the layer is a floating selection, attach it to the drawable */
|
||||
if (gimp_layer_is_floating_sel (layer))
|
||||
{
|
||||
gimp_image_set_floating_selection (image, layer);
|
||||
|
||||
gimp_drawable_attach_floating_sel (gimp_layer_get_floating_sel_drawable (layer),
|
||||
layer);
|
||||
}
|
||||
gimp_drawable_attach_floating_sel (gimp_layer_get_floating_sel_drawable (layer),
|
||||
layer);
|
||||
|
||||
if (old_has_alpha != gimp_image_has_alpha (image))
|
||||
image->flush_accum.alpha_changed = TRUE;
|
||||
|
@ -3049,13 +3045,10 @@ gimp_image_remove_layer (GimpImage *image,
|
|||
gimp_container_remove (image->layers, GIMP_OBJECT (layer));
|
||||
image->layer_stack = g_slist_remove (image->layer_stack, layer);
|
||||
|
||||
if (gimp_image_get_floating_selection (image) == layer)
|
||||
if (gimp_layer_is_floating_sel (layer))
|
||||
{
|
||||
/* If this was the floating selection, reset the fs pointer
|
||||
* and activate the underlying drawable
|
||||
/* If this was the floating selection, activate the underlying drawable
|
||||
*/
|
||||
gimp_image_set_floating_selection (image, NULL);
|
||||
|
||||
floating_sel_activate_drawable (layer);
|
||||
}
|
||||
else if (layer == active_layer)
|
||||
|
|
|
@ -142,9 +142,7 @@ floating_sel_to_layer (GimpLayer *layer,
|
|||
gimp_drawable_detach_floating_sel (gimp_layer_get_floating_sel_drawable (layer),
|
||||
layer);
|
||||
|
||||
/* Set pointers */
|
||||
gimp_layer_set_floating_sel_drawable (layer, NULL);
|
||||
gimp_image_set_floating_selection (image, NULL);
|
||||
|
||||
gimp_item_set_visible (item, TRUE, TRUE);
|
||||
gimp_layer_set_lock_alpha (layer, FALSE, TRUE);
|
||||
|
|
Loading…
Reference in New Issue