mirror of https://github.com/GNOME/gimp.git
app/undo.c (undo_pop_layer) emit "alpha_changed" from the image if we
2002-08-28 Michael Natterer <mitch@gimp.org> * app/undo.c (undo_pop_layer) * app/core/gimpimage.c (gimp_image_[add|remove]_layer): emit "alpha_changed" from the image if we started (or ended up) with an image containing one layer without alpha. * app/core/gimplayer.c: use gimp_container_num_children() instead of accessing container->num_children manually.
This commit is contained in:
parent
60959463fd
commit
9c416076b1
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2002-08-28 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/undo.c (undo_pop_layer)
|
||||
* app/core/gimpimage.c (gimp_image_[add|remove]_layer): emit
|
||||
"alpha_changed" from the image if we started (or ended up)
|
||||
with an image containing one layer without alpha.
|
||||
|
||||
* app/core/gimplayer.c: use gimp_container_num_children() instead
|
||||
of accessing container->num_children manually.
|
||||
|
||||
2002-08-28 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* plug-ins/common/rotate.c (rotate): check if the active drawable
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include "core/gimplayer.h"
|
||||
#include "core/gimplayer-floating-sel.h"
|
||||
#include "core/gimplayermask.h"
|
||||
#include "core/gimplist.h"
|
||||
#include "core/gimpparasitelist.h"
|
||||
|
||||
#include "paint/gimppaintcore.h"
|
||||
|
@ -115,6 +116,7 @@ static gboolean resolution_changed = FALSE;
|
|||
static gboolean unit_changed = FALSE;
|
||||
static gboolean mask_changed = FALSE;
|
||||
static gboolean qmask_changed = FALSE;
|
||||
static gboolean alpha_changed = FALSE;
|
||||
|
||||
|
||||
static void
|
||||
|
@ -406,6 +408,14 @@ pop_stack (GimpImage *gimage,
|
|||
qmask_changed = FALSE;
|
||||
}
|
||||
|
||||
/* If the alpha_changed flag was set */
|
||||
if (alpha_changed)
|
||||
{
|
||||
gimp_image_alpha_changed (gimage);
|
||||
|
||||
alpha_changed = FALSE;
|
||||
}
|
||||
|
||||
/* let others know that we just popped an action */
|
||||
gimp_image_undo_event (gimage,
|
||||
(state == UNDO)? UNDO_POPPED : UNDO_REDO);
|
||||
|
@ -1694,6 +1704,12 @@ undo_pop_layer (GimpImage *gimage,
|
|||
0, 0,
|
||||
GIMP_DRAWABLE (lu->layer)->width,
|
||||
GIMP_DRAWABLE (lu->layer)->height);
|
||||
|
||||
if (gimp_container_num_children (gimage->layers) == 1 &&
|
||||
! gimp_drawable_has_alpha (GIMP_LIST (gimage->layers)->list->data))
|
||||
{
|
||||
alpha_changed = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1710,6 +1726,12 @@ undo_pop_layer (GimpImage *gimage,
|
|||
if (gimp_layer_is_floating_sel (lu->layer))
|
||||
gimage->floating_sel = lu->layer;
|
||||
|
||||
if (gimp_container_num_children (gimage->layers) == 1 &&
|
||||
! gimp_drawable_has_alpha (GIMP_LIST (gimage->layers)->list->data))
|
||||
{
|
||||
alpha_changed = TRUE;
|
||||
}
|
||||
|
||||
/* add the new layer */
|
||||
gimp_container_insert (gimage->layers,
|
||||
GIMP_OBJECT (lu->layer), lu->prev_position);
|
||||
|
|
|
@ -2640,6 +2640,8 @@ gimp_image_add_layer (GimpImage *gimage,
|
|||
GimpLayer *layer,
|
||||
gint position)
|
||||
{
|
||||
gboolean alpha_changed = FALSE;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
|
||||
g_return_val_if_fail (GIMP_IS_LAYER (layer), FALSE);
|
||||
|
||||
|
@ -2672,9 +2674,7 @@ gimp_image_add_layer (GimpImage *gimage,
|
|||
|
||||
/* If the layer has a mask, set the mask's gimage */
|
||||
if (layer->mask)
|
||||
{
|
||||
gimp_item_set_image (GIMP_ITEM (layer->mask), gimage);
|
||||
}
|
||||
gimp_item_set_image (GIMP_ITEM (layer->mask), gimage);
|
||||
|
||||
/* add the layer to the list at the specified position */
|
||||
if (position == -1)
|
||||
|
@ -2704,6 +2704,12 @@ gimp_image_add_layer (GimpImage *gimage,
|
|||
position = 1;
|
||||
}
|
||||
|
||||
if (gimp_container_num_children (gimage->layers) == 1 &&
|
||||
! gimp_drawable_has_alpha (GIMP_LIST (gimage->layers)->list->data))
|
||||
{
|
||||
alpha_changed = TRUE;
|
||||
}
|
||||
|
||||
gimp_container_insert (gimage->layers, GIMP_OBJECT (layer), position);
|
||||
g_object_unref (G_OBJECT (layer));
|
||||
|
||||
|
@ -2716,6 +2722,9 @@ gimp_image_add_layer (GimpImage *gimage,
|
|||
gimp_drawable_width (GIMP_DRAWABLE (layer)),
|
||||
gimp_drawable_height (GIMP_DRAWABLE (layer)));
|
||||
|
||||
if (alpha_changed)
|
||||
gimp_image_alpha_changed (gimage);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -2777,6 +2786,12 @@ gimp_image_remove_layer (GimpImage *gimage,
|
|||
gimp_image_update (gimage, x, y, w, h);
|
||||
|
||||
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (gimage));
|
||||
|
||||
if (gimp_container_num_children (gimage->layers) == 1 &&
|
||||
! gimp_drawable_has_alpha (GIMP_LIST (gimage->layers)->list->data))
|
||||
{
|
||||
gimp_image_alpha_changed (gimage);
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
|
|
@ -928,7 +928,7 @@ gimp_layer_add_alpha (GimpLayer *layer)
|
|||
|
||||
gimage = gimp_item_get_image (GIMP_ITEM (layer));
|
||||
|
||||
if (gimage->layers->num_children == 1)
|
||||
if (gimp_container_num_children (gimage->layers) == 1)
|
||||
{
|
||||
gimp_image_alpha_changed (gimage);
|
||||
}
|
||||
|
|
22
app/undo.c
22
app/undo.c
|
@ -46,6 +46,7 @@
|
|||
#include "core/gimplayer.h"
|
||||
#include "core/gimplayer-floating-sel.h"
|
||||
#include "core/gimplayermask.h"
|
||||
#include "core/gimplist.h"
|
||||
#include "core/gimpparasitelist.h"
|
||||
|
||||
#include "paint/gimppaintcore.h"
|
||||
|
@ -115,6 +116,7 @@ static gboolean resolution_changed = FALSE;
|
|||
static gboolean unit_changed = FALSE;
|
||||
static gboolean mask_changed = FALSE;
|
||||
static gboolean qmask_changed = FALSE;
|
||||
static gboolean alpha_changed = FALSE;
|
||||
|
||||
|
||||
static void
|
||||
|
@ -406,6 +408,14 @@ pop_stack (GimpImage *gimage,
|
|||
qmask_changed = FALSE;
|
||||
}
|
||||
|
||||
/* If the alpha_changed flag was set */
|
||||
if (alpha_changed)
|
||||
{
|
||||
gimp_image_alpha_changed (gimage);
|
||||
|
||||
alpha_changed = FALSE;
|
||||
}
|
||||
|
||||
/* let others know that we just popped an action */
|
||||
gimp_image_undo_event (gimage,
|
||||
(state == UNDO)? UNDO_POPPED : UNDO_REDO);
|
||||
|
@ -1694,6 +1704,12 @@ undo_pop_layer (GimpImage *gimage,
|
|||
0, 0,
|
||||
GIMP_DRAWABLE (lu->layer)->width,
|
||||
GIMP_DRAWABLE (lu->layer)->height);
|
||||
|
||||
if (gimp_container_num_children (gimage->layers) == 1 &&
|
||||
! gimp_drawable_has_alpha (GIMP_LIST (gimage->layers)->list->data))
|
||||
{
|
||||
alpha_changed = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1710,6 +1726,12 @@ undo_pop_layer (GimpImage *gimage,
|
|||
if (gimp_layer_is_floating_sel (lu->layer))
|
||||
gimage->floating_sel = lu->layer;
|
||||
|
||||
if (gimp_container_num_children (gimage->layers) == 1 &&
|
||||
! gimp_drawable_has_alpha (GIMP_LIST (gimage->layers)->list->data))
|
||||
{
|
||||
alpha_changed = TRUE;
|
||||
}
|
||||
|
||||
/* add the new layer */
|
||||
gimp_container_insert (gimage->layers,
|
||||
GIMP_OBJECT (lu->layer), lu->prev_position);
|
||||
|
|
Loading…
Reference in New Issue