Honor active components when pasting. Fixes bug #150845:

2006-05-30  Michael Natterer  <mitch@gimp.org>

	Honor active components when pasting. Fixes bug #150845:

	* app/core/gimplayer-floating-sel.c (floating_sel_composite):
	don't temporarily set all image components to active while
	compositing.

	* app/core/gimpimage.c (gimp_image_set_component_active):
	relax()/rigor() the floating selection around setting the "active"
	flag. Also make sure the projection is updated correctly.
This commit is contained in:
Michael Natterer 2006-05-30 21:22:34 +00:00 committed by Michael Natterer
parent e1e77738a0
commit 35c5434b10
3 changed files with 34 additions and 23 deletions

View file

@ -1,3 +1,15 @@
2006-05-30 Michael Natterer <mitch@gimp.org>
Honor active components when pasting. Fixes bug #150845:
* app/core/gimplayer-floating-sel.c (floating_sel_composite):
don't temporarily set all image components to active while
compositing.
* app/core/gimpimage.c (gimp_image_set_component_active):
relax()/rigor() the floating selection around setting the "active"
flag. Also make sure the projection is updated correctly.
2006-05-30 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpdataeditor.c (gimp_data_editor_name_activate)

View file

@ -1569,8 +1569,22 @@ gimp_image_set_component_active (GimpImage *image,
if (index != -1 && active != image->active[index])
{
GimpLayer *floating_sel = gimp_image_floating_sel (image);
if (floating_sel)
floating_sel_relax (floating_sel, FALSE);
image->active[index] = active ? TRUE : FALSE;
if (floating_sel)
{
floating_sel_rigor (floating_sel, FALSE);
gimp_drawable_update (GIMP_DRAWABLE (floating_sel),
0, 0,
GIMP_ITEM (floating_sel)->width,
GIMP_ITEM (floating_sel)->height);
}
/* If there is an active channel and we mess with the components,
* the active channel gets unset...
*/

View file

@ -408,14 +408,7 @@ floating_sel_composite (GimpLayer *layer,
gint h,
gboolean push_undo)
{
PixelRegion fsPR;
GimpImage *image;
GimpLayer *d_layer = NULL;
gint lock_alpha;
gint active[MAX_CHANNELS];
gint offx, offy;
gint x1, y1, x2, y2;
gint i;
GimpImage *image;
g_return_if_fail (GIMP_IS_LAYER (layer));
g_return_if_fail (gimp_layer_is_floating_sel (layer));
@ -441,6 +434,9 @@ floating_sel_composite (GimpLayer *layer,
*/
if (gimp_item_get_visible (GIMP_ITEM (layer)))
{
gint offx, offy;
gint x1, y1, x2, y2;
/* Find the minimum area we need to composite -- in image space */
gimp_item_offsets (GIMP_ITEM (layer->fs.drawable), &offx, &offy);
@ -460,6 +456,10 @@ floating_sel_composite (GimpLayer *layer,
if ((x2 - x1) > 0 && (y2 - y1) > 0)
{
PixelRegion fsPR;
GimpLayer *d_layer = NULL;
gboolean lock_alpha;
/* composite the area from the layer to the drawable */
pixel_region_init (&fsPR, GIMP_DRAWABLE (layer)->tiles,
(x1 - GIMP_ITEM (layer)->offset_x),
@ -479,17 +479,6 @@ floating_sel_composite (GimpLayer *layer,
else
lock_alpha = FALSE;
/* We need to set all image channels to active to make sure that
* nothing strange happens while applying the floating selection.
* It wouldn't make sense for the floating selection to be affected
* by the active image channels.
*/
for (i = 0; i < MAX_CHANNELS; i++)
{
active[i] = image->active[i];
image->active[i] = 1;
}
/* apply the fs with the undo specified by the value
* passed to this function
*/
@ -503,10 +492,6 @@ floating_sel_composite (GimpLayer *layer,
/* restore lock alpha */
if (lock_alpha)
gimp_layer_set_lock_alpha (d_layer, TRUE, FALSE);
/* restore image active channels */
for (i = 0; i < MAX_CHANNELS; i++)
image->active[i] = active[i];
}
}
}