mirror of https://github.com/GNOME/gimp.git
add member "gboolean floating_selection_changed".
2008-11-14 Michael Natterer <mitch@gimp.org> * app/core/gimpimage.[ch] (struct GimpImageFlushAccumulator): add member "gboolean floating_selection_changed". (gimp_image_set_floating_selection): new function which sets the image's floating_sel pointer and sets the flag in the accumulator to TRUE for later signal emission on flush. (gimp_image_projectable_flush): emit "floating-selection-changed" if the flag in the accumulator is TRUE. * app/core/gimpimage.c (gimp_image_add,remove_layer) * app/core/gimpfloatingselundo.c (gimp_floating_sel_undo_pop) * app/core/gimplayer-floating-sel.c (floating_sel_to_layer): use gimp_image_set_floating_selection() instead of setting image->floating_sel menually and remove all calls to gimp_image_floating_selection_changed(). svn path=/trunk/; revision=27650
This commit is contained in:
parent
fb1660a4ea
commit
f275cddbbf
19
ChangeLog
19
ChangeLog
|
@ -1,3 +1,22 @@
|
|||
2008-11-14 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/core/gimpimage.[ch] (struct GimpImageFlushAccumulator):
|
||||
add member "gboolean floating_selection_changed".
|
||||
|
||||
(gimp_image_set_floating_selection): new function which sets
|
||||
the image's floating_sel pointer and sets the flag in the
|
||||
accumulator to TRUE for later signal emission on flush.
|
||||
|
||||
(gimp_image_projectable_flush): emit "floating-selection-changed"
|
||||
if the flag in the accumulator is TRUE.
|
||||
|
||||
* app/core/gimpimage.c (gimp_image_add,remove_layer)
|
||||
* app/core/gimpfloatingselundo.c (gimp_floating_sel_undo_pop)
|
||||
* app/core/gimplayer-floating-sel.c (floating_sel_to_layer): use
|
||||
gimp_image_set_floating_selection() instead of setting
|
||||
image->floating_sel menually and remove all calls to
|
||||
gimp_image_floating_selection_changed().
|
||||
|
||||
2008-11-14 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/core/gimpimage.[ch]: rename gimp_image_floating_sel() to
|
||||
|
|
|
@ -110,7 +110,7 @@ gimp_floating_sel_undo_pop (GimpUndo *undo,
|
|||
|
||||
floating_layer->fs.drawable = floating_sel_undo->drawable;
|
||||
gimp_image_set_active_layer (undo->image, floating_layer);
|
||||
undo->image->floating_sel = floating_layer;
|
||||
gimp_image_set_floating_selection (undo->image, floating_layer);
|
||||
|
||||
/* clear the selection */
|
||||
gimp_drawable_invalidate_boundary (GIMP_DRAWABLE (floating_layer));
|
||||
|
@ -125,7 +125,7 @@ gimp_floating_sel_undo_pop (GimpUndo *undo,
|
|||
|
||||
/* update the pointers */
|
||||
floating_layer->fs.drawable = NULL;
|
||||
undo->image->floating_sel = NULL;
|
||||
gimp_image_set_floating_selection (undo->image, NULL);
|
||||
}
|
||||
|
||||
gimp_object_name_changed (GIMP_OBJECT (floating_layer));
|
||||
|
@ -134,8 +134,6 @@ gimp_floating_sel_undo_pop (GimpUndo *undo,
|
|||
0, 0,
|
||||
gimp_item_get_width (GIMP_ITEM (floating_layer)),
|
||||
gimp_item_get_height (GIMP_ITEM (floating_layer)));
|
||||
|
||||
gimp_image_floating_selection_changed (undo->image);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -667,9 +667,10 @@ gimp_image_init (GimpImage *image)
|
|||
|
||||
image->preview = NULL;
|
||||
|
||||
image->flush_accum.alpha_changed = FALSE;
|
||||
image->flush_accum.mask_changed = FALSE;
|
||||
image->flush_accum.preview_invalidated = FALSE;
|
||||
image->flush_accum.alpha_changed = FALSE;
|
||||
image->flush_accum.mask_changed = FALSE;
|
||||
image->flush_accum.floating_selection_changed = FALSE;
|
||||
image->flush_accum.preview_invalidated = FALSE;
|
||||
}
|
||||
|
||||
static GObject *
|
||||
|
@ -1185,6 +1186,12 @@ gimp_image_projectable_flush (GimpProjectable *projectable,
|
|||
image->flush_accum.mask_changed = FALSE;
|
||||
}
|
||||
|
||||
if (image->flush_accum.floating_selection_changed)
|
||||
{
|
||||
gimp_image_floating_selection_changed (image);
|
||||
image->flush_accum.floating_selection_changed = FALSE;
|
||||
}
|
||||
|
||||
if (image->flush_accum.preview_invalidated)
|
||||
{
|
||||
/* don't invalidate the preview here, the projection does this when
|
||||
|
@ -1615,6 +1622,21 @@ gimp_image_is_empty (const GimpImage *image)
|
|||
return gimp_container_is_empty (image->layers);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_image_set_floating_selection (GimpImage *image,
|
||||
GimpLayer *floating_sel)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_IMAGE (image));
|
||||
g_return_if_fail (floating_sel == NULL || GIMP_IS_LAYER (floating_sel));
|
||||
|
||||
if (image->floating_sel != floating_sel)
|
||||
{
|
||||
image->floating_sel = floating_sel;
|
||||
|
||||
image->flush_accum.floating_selection_changed = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
GimpLayer *
|
||||
gimp_image_get_floating_selection (const GimpImage *image)
|
||||
{
|
||||
|
@ -2929,10 +2951,6 @@ gimp_image_add_layer (GimpImage *image,
|
|||
gimp_image_undo_push_layer_add (image, _("Add Layer"),
|
||||
layer, active_layer);
|
||||
|
||||
/* If the layer is a floating selection, set the fs pointer */
|
||||
if (gimp_layer_is_floating_sel (layer))
|
||||
image->floating_sel = layer;
|
||||
|
||||
/* add the layer to the list at the specified position */
|
||||
if (position == -1)
|
||||
{
|
||||
|
@ -2957,12 +2975,13 @@ 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 (gimp_layer_is_floating_sel (layer))
|
||||
gimp_image_set_floating_selection (image, layer);
|
||||
|
||||
if (old_has_alpha != gimp_image_has_alpha (image))
|
||||
image->flush_accum.alpha_changed = TRUE;
|
||||
|
||||
if (gimp_layer_is_floating_sel (layer))
|
||||
gimp_image_floating_selection_changed (image);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -3042,11 +3061,9 @@ gimp_image_remove_layer (GimpImage *image,
|
|||
/* If this was the floating selection, reset the fs pointer
|
||||
* and activate the underlying drawable
|
||||
*/
|
||||
image->floating_sel = NULL;
|
||||
gimp_image_set_floating_selection (image, NULL);
|
||||
|
||||
floating_sel_activate_drawable (layer);
|
||||
|
||||
gimp_image_floating_selection_changed (image);
|
||||
}
|
||||
else if (layer == active_layer)
|
||||
{
|
||||
|
|
|
@ -82,6 +82,7 @@ struct _GimpImageFlushAccumulator
|
|||
{
|
||||
gboolean alpha_changed;
|
||||
gboolean mask_changed;
|
||||
gboolean floating_selection_changed;
|
||||
gboolean preview_invalidated;
|
||||
};
|
||||
|
||||
|
@ -280,6 +281,8 @@ gint gimp_image_get_height (const GimpImage *image);
|
|||
gboolean gimp_image_has_alpha (const GimpImage *image);
|
||||
gboolean gimp_image_is_empty (const GimpImage *image);
|
||||
|
||||
void gimp_image_set_floating_selection (GimpImage *image,
|
||||
GimpLayer *floating_sel);
|
||||
GimpLayer * gimp_image_get_floating_selection (const GimpImage *image);
|
||||
void gimp_image_floating_selection_changed (GimpImage *image);
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ floating_sel_to_layer (GimpLayer *layer,
|
|||
|
||||
/* Set pointers */
|
||||
layer->fs.drawable = NULL;
|
||||
image->floating_sel = NULL;
|
||||
gimp_image_set_floating_selection (image, NULL);
|
||||
|
||||
gimp_item_set_visible (item, TRUE, TRUE);
|
||||
gimp_layer_set_lock_alpha (layer, FALSE, TRUE);
|
||||
|
@ -165,8 +165,6 @@ floating_sel_to_layer (GimpLayer *layer,
|
|||
gimp_item_get_width (item),
|
||||
gimp_item_get_height (item));
|
||||
|
||||
gimp_image_floating_selection_changed (image);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue