Commit 20b4769c authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

app/actions/layers-actions.c app/actions/layers-commands.[ch]

2005-07-10  Michael Natterer  <mitch@gimp.org>

	* app/actions/layers-actions.c
	* app/actions/layers-commands.[ch]
	* app/core/core-enums.[ch]
	* app/core/gimpimage-undo-push.[ch]
	* app/core/gimplayer-floating-sel.c
	* app/core/gimplayer.[ch]
	* app/text/gimptextlayer-xcf.c
	* app/widgets/gimphelp-ids.h
	* app/widgets/gimplayertreeview.[ch]
	* app/xcf/xcf-load.c
	* app/xcf/xcf-private.h
	* app/xcf/xcf-save.c
	* tools/pdbgen/pdb/layer.pdb
	* menus/image-menu.xml.in
	* libgimp/gimp.def: did a global s/preserve_trans/lock_alpha/ in
	preparation for more layer locking flags.

	* app/pdb/procedural_db.c
	* libgimp/gimplayer.[ch]: added compat stuff for preserve_trans.

	* app/pdb/layer_cmds.c
	* libgimp/gimplayer_pdb.[ch]: regenerated.

	* plug-ins/common/colortoalpha.c
	* plug-ins/common/iwarp.c
	* plug-ins/common/psd.c
	* plug-ins/common/psd_save.c
	* plug-ins/common/psp.c
	* plug-ins/common/rotate.c
	* plug-ins/common/threshold_alpha.c
	* plug-ins/common/vpropagate.c
	* plug-ins/script-fu/scripts/3d-outline.scm
	* plug-ins/script-fu/scripts/alien-glow-bar.scm
	* plug-ins/script-fu/scripts/alien-glow-bullet.scm
	* plug-ins/script-fu/scripts/alien-glow-logo.scm
	* plug-ins/script-fu/scripts/basic1-logo.scm
	* plug-ins/script-fu/scripts/basic2-logo.scm
	* plug-ins/script-fu/scripts/beveled-pattern-button.scm
	* plug-ins/script-fu/scripts/blend-anim.scm
	* plug-ins/script-fu/scripts/blended-logo.scm
	* plug-ins/script-fu/scripts/bovinated-logo.scm
	* plug-ins/script-fu/scripts/burn-in-anim.scm
	* plug-ins/script-fu/scripts/carved-logo.scm
	* plug-ins/script-fu/scripts/chalk.scm
	* plug-ins/script-fu/scripts/chip-away.scm
	* plug-ins/script-fu/scripts/comic-logo.scm
	* plug-ins/script-fu/scripts/coolmetal-logo.scm
	* plug-ins/script-fu/scripts/crystal-logo.scm
	* plug-ins/script-fu/scripts/drop-shadow.scm
	* plug-ins/script-fu/scripts/gimp-headers.scm
	* plug-ins/script-fu/scripts/gimp-labels.scm
	* plug-ins/script-fu/scripts/glowing-logo.scm
	* plug-ins/script-fu/scripts/gradient-bevel-logo.scm
	* plug-ins/script-fu/scripts/image-structure.scm
	* plug-ins/script-fu/scripts/neon-logo.scm
	* plug-ins/script-fu/scripts/perspective-shadow.scm
	* plug-ins/script-fu/scripts/starburst-logo.scm
	* plug-ins/script-fu/scripts/starscape-logo.scm
	* plug-ins/script-fu/scripts/textured-logo.scm
	* plug-ins/script-fu/scripts/title-header.scm
	* plug-ins/script-fu/scripts/waves-anim.scm
	* plug-ins/xjt/xjt.c: changed accordingly.
parent da0adc4f
2005-07-10 Michael Natterer <mitch@gimp.org>
* app/actions/layers-actions.c
* app/actions/layers-commands.[ch]
* app/core/core-enums.[ch]
* app/core/gimpimage-undo-push.[ch]
* app/core/gimplayer-floating-sel.c
* app/core/gimplayer.[ch]
* app/text/gimptextlayer-xcf.c
* app/widgets/gimphelp-ids.h
* app/widgets/gimplayertreeview.[ch]
* app/xcf/xcf-load.c
* app/xcf/xcf-private.h
* app/xcf/xcf-save.c
* tools/pdbgen/pdb/layer.pdb
* menus/image-menu.xml.in
* libgimp/gimp.def: did a global s/preserve_trans/lock_alpha/ in
preparation for more layer locking flags.
* app/pdb/procedural_db.c
* libgimp/gimplayer.[ch]: added compat stuff for preserve_trans.
* app/pdb/layer_cmds.c
* libgimp/gimplayer_pdb.[ch]: regenerated.
* plug-ins/common/colortoalpha.c
* plug-ins/common/iwarp.c
* plug-ins/common/psd.c
* plug-ins/common/psd_save.c
* plug-ins/common/psp.c
* plug-ins/common/rotate.c
* plug-ins/common/threshold_alpha.c
* plug-ins/common/vpropagate.c
* plug-ins/script-fu/scripts/3d-outline.scm
* plug-ins/script-fu/scripts/alien-glow-bar.scm
* plug-ins/script-fu/scripts/alien-glow-bullet.scm
* plug-ins/script-fu/scripts/alien-glow-logo.scm
* plug-ins/script-fu/scripts/basic1-logo.scm
* plug-ins/script-fu/scripts/basic2-logo.scm
* plug-ins/script-fu/scripts/beveled-pattern-button.scm
* plug-ins/script-fu/scripts/blend-anim.scm
* plug-ins/script-fu/scripts/blended-logo.scm
* plug-ins/script-fu/scripts/bovinated-logo.scm
* plug-ins/script-fu/scripts/burn-in-anim.scm
* plug-ins/script-fu/scripts/carved-logo.scm
* plug-ins/script-fu/scripts/chalk.scm
* plug-ins/script-fu/scripts/chip-away.scm
* plug-ins/script-fu/scripts/comic-logo.scm
* plug-ins/script-fu/scripts/coolmetal-logo.scm
* plug-ins/script-fu/scripts/crystal-logo.scm
* plug-ins/script-fu/scripts/drop-shadow.scm
* plug-ins/script-fu/scripts/gimp-headers.scm
* plug-ins/script-fu/scripts/gimp-labels.scm
* plug-ins/script-fu/scripts/glowing-logo.scm
* plug-ins/script-fu/scripts/gradient-bevel-logo.scm
* plug-ins/script-fu/scripts/image-structure.scm
* plug-ins/script-fu/scripts/neon-logo.scm
* plug-ins/script-fu/scripts/perspective-shadow.scm
* plug-ins/script-fu/scripts/starburst-logo.scm
* plug-ins/script-fu/scripts/starscape-logo.scm
* plug-ins/script-fu/scripts/textured-logo.scm
* plug-ins/script-fu/scripts/title-header.scm
* plug-ins/script-fu/scripts/waves-anim.scm
* plug-ins/xjt/xjt.c: changed accordingly.
2005-07-10 Sven Neumann <sven@gimp.org> 2005-07-10 Sven Neumann <sven@gimp.org>
* app/batch.c (batch_run): unified strings. * app/batch.c (batch_run): unified strings.
......
...@@ -177,11 +177,11 @@ static GimpActionEntry layers_actions[] = ...@@ -177,11 +177,11 @@ static GimpActionEntry layers_actions[] =
static GimpToggleActionEntry layers_toggle_actions[] = static GimpToggleActionEntry layers_toggle_actions[] =
{ {
{ "layers-preserve-transparency", GIMP_STOCK_TRANSPARENCY, { "layers-lock-alpha", GIMP_STOCK_TRANSPARENCY,
N_("Kee_p Transparency"), NULL, NULL, N_("Lock Alph_a Channel"), NULL, NULL,
G_CALLBACK (layers_preserve_trans_cmd_callback), G_CALLBACK (layers_lock_alpha_cmd_callback),
FALSE, FALSE,
GIMP_HELP_LAYER_KEEP_TRANSPARENCY }, GIMP_HELP_LAYER_LOCK_ALPHA },
{ "layers-mask-edit", GIMP_STOCK_EDIT, { "layers-mask-edit", GIMP_STOCK_EDIT,
N_("_Edit Layer Mask"), NULL, NULL, N_("_Edit Layer Mask"), NULL, NULL,
...@@ -391,7 +391,7 @@ layers_actions_update (GimpActionGroup *group, ...@@ -391,7 +391,7 @@ layers_actions_update (GimpActionGroup *group,
gboolean sel = FALSE; gboolean sel = FALSE;
gboolean alpha = FALSE; /* alpha channel present */ gboolean alpha = FALSE; /* alpha channel present */
gboolean indexed = FALSE; /* is indexed */ gboolean indexed = FALSE; /* is indexed */
gboolean preserve = FALSE; gboolean lock_alpha = FALSE;
gboolean text_layer = FALSE; gboolean text_layer = FALSE;
GList *next = NULL; GList *next = NULL;
GList *prev = NULL; GList *prev = NULL;
...@@ -409,9 +409,9 @@ layers_actions_update (GimpActionGroup *group, ...@@ -409,9 +409,9 @@ layers_actions_update (GimpActionGroup *group,
{ {
GList *list; GList *list;
mask = gimp_layer_get_mask (layer); mask = gimp_layer_get_mask (layer);
preserve = gimp_layer_get_preserve_trans (layer); lock_alpha = gimp_layer_get_lock_alpha (layer);
alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (layer)); alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (layer));
list = g_list_find (GIMP_LIST (gimage->layers)->list, layer); list = g_list_find (GIMP_LIST (gimage->layers)->list, layer);
...@@ -465,8 +465,8 @@ layers_actions_update (GimpActionGroup *group, ...@@ -465,8 +465,8 @@ layers_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("layers-alpha-add", layer && !fs && !alpha); SET_SENSITIVE ("layers-alpha-add", layer && !fs && !alpha);
SET_SENSITIVE ("layers-preserve-transparency", layer); SET_SENSITIVE ("layers-lock-alpha", layer);
SET_ACTIVE ("layers-preserve-transparency", preserve); SET_ACTIVE ("layers-lock-alpha", lock_alpha);
SET_SENSITIVE ("layers-mask-add", layer && !fs && !ac && !mask); SET_SENSITIVE ("layers-mask-add", layer && !fs && !ac && !mask);
SET_SENSITIVE ("layers-mask-apply", layer && !fs && !ac && mask); SET_SENSITIVE ("layers-mask-apply", layer && !fs && !ac && mask);
......
...@@ -779,28 +779,28 @@ layers_mode_cmd_callback (GtkAction *action, ...@@ -779,28 +779,28 @@ layers_mode_cmd_callback (GtkAction *action,
} }
void void
layers_preserve_trans_cmd_callback (GtkAction *action, layers_lock_alpha_cmd_callback (GtkAction *action,
gpointer data) gpointer data)
{ {
GimpImage *gimage; GimpImage *gimage;
GimpLayer *layer; GimpLayer *layer;
gboolean preserve; gboolean lock_alpha;
return_if_no_layer (gimage, layer, data); return_if_no_layer (gimage, layer, data);
preserve = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); lock_alpha = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
if (preserve != gimp_layer_get_preserve_trans (layer)) if (lock_alpha != gimp_layer_get_lock_alpha (layer))
{ {
GimpUndo *undo; GimpUndo *undo;
gboolean push_undo = TRUE; gboolean push_undo = TRUE;
undo = gimp_image_undo_can_compress (gimage, GIMP_TYPE_ITEM_UNDO, undo = gimp_image_undo_can_compress (gimage, GIMP_TYPE_ITEM_UNDO,
GIMP_UNDO_LAYER_PRESERVE_TRANS); GIMP_UNDO_LAYER_LOCK_ALPHA);
if (undo && GIMP_ITEM_UNDO (undo)->item == GIMP_ITEM (layer)) if (undo && GIMP_ITEM_UNDO (undo)->item == GIMP_ITEM (layer))
push_undo = FALSE; push_undo = FALSE;
gimp_layer_set_preserve_trans (layer, preserve, push_undo); gimp_layer_set_lock_alpha (layer, lock_alpha, push_undo);
gimp_image_flush (gimage); gimp_image_flush (gimage);
} }
} }
......
...@@ -90,7 +90,7 @@ void layers_mode_cmd_callback (GtkAction *action, ...@@ -90,7 +90,7 @@ void layers_mode_cmd_callback (GtkAction *action,
gint value, gint value,
gpointer data); gpointer data);
void layers_preserve_trans_cmd_callback (GtkAction *action, void layers_lock_alpha_cmd_callback (GtkAction *action,
gpointer data); gpointer data);
......
...@@ -772,7 +772,7 @@ gimp_undo_type_get_type (void) ...@@ -772,7 +772,7 @@ gimp_undo_type_get_type (void)
{ GIMP_UNDO_LAYER_REPOSITION, "GIMP_UNDO_LAYER_REPOSITION", "layer-reposition" }, { GIMP_UNDO_LAYER_REPOSITION, "GIMP_UNDO_LAYER_REPOSITION", "layer-reposition" },
{ GIMP_UNDO_LAYER_MODE, "GIMP_UNDO_LAYER_MODE", "layer-mode" }, { GIMP_UNDO_LAYER_MODE, "GIMP_UNDO_LAYER_MODE", "layer-mode" },
{ GIMP_UNDO_LAYER_OPACITY, "GIMP_UNDO_LAYER_OPACITY", "layer-opacity" }, { GIMP_UNDO_LAYER_OPACITY, "GIMP_UNDO_LAYER_OPACITY", "layer-opacity" },
{ GIMP_UNDO_LAYER_PRESERVE_TRANS, "GIMP_UNDO_LAYER_PRESERVE_TRANS", "layer-preserve-trans" }, { GIMP_UNDO_LAYER_LOCK_ALPHA, "GIMP_UNDO_LAYER_LOCK_ALPHA", "layer-lock-alpha" },
{ GIMP_UNDO_TEXT_LAYER, "GIMP_UNDO_TEXT_LAYER", "text-layer" }, { GIMP_UNDO_TEXT_LAYER, "GIMP_UNDO_TEXT_LAYER", "text-layer" },
{ GIMP_UNDO_TEXT_LAYER_MODIFIED, "GIMP_UNDO_TEXT_LAYER_MODIFIED", "text-layer-modified" }, { GIMP_UNDO_TEXT_LAYER_MODIFIED, "GIMP_UNDO_TEXT_LAYER_MODIFIED", "text-layer-modified" },
{ GIMP_UNDO_LAYER_MASK_ADD, "GIMP_UNDO_LAYER_MASK_ADD", "layer-mask-add" }, { GIMP_UNDO_LAYER_MASK_ADD, "GIMP_UNDO_LAYER_MASK_ADD", "layer-mask-add" },
...@@ -858,7 +858,7 @@ gimp_undo_type_get_type (void) ...@@ -858,7 +858,7 @@ gimp_undo_type_get_type (void)
{ GIMP_UNDO_LAYER_REPOSITION, N_("Reposition layer"), NULL }, { GIMP_UNDO_LAYER_REPOSITION, N_("Reposition layer"), NULL },
{ GIMP_UNDO_LAYER_MODE, N_("Set layer mode"), NULL }, { GIMP_UNDO_LAYER_MODE, N_("Set layer mode"), NULL },
{ GIMP_UNDO_LAYER_OPACITY, N_("Set layer opacity"), NULL }, { GIMP_UNDO_LAYER_OPACITY, N_("Set layer opacity"), NULL },
{ GIMP_UNDO_LAYER_PRESERVE_TRANS, N_("Set preserve trans"), NULL }, { GIMP_UNDO_LAYER_LOCK_ALPHA, N_("Lock/Unlock alpha channel"), NULL },
{ GIMP_UNDO_TEXT_LAYER, N_("Text"), NULL }, { GIMP_UNDO_TEXT_LAYER, N_("Text"), NULL },
{ GIMP_UNDO_TEXT_LAYER_MODIFIED, N_("Text modified"), NULL }, { GIMP_UNDO_TEXT_LAYER_MODIFIED, N_("Text modified"), NULL },
{ GIMP_UNDO_LAYER_MASK_ADD, N_("Add layer mask"), NULL }, { GIMP_UNDO_LAYER_MASK_ADD, N_("Add layer mask"), NULL },
......
...@@ -401,7 +401,7 @@ typedef enum /*< pdb-skip >*/ ...@@ -401,7 +401,7 @@ typedef enum /*< pdb-skip >*/
GIMP_UNDO_LAYER_REPOSITION, /*< desc="Reposition layer" >*/ GIMP_UNDO_LAYER_REPOSITION, /*< desc="Reposition layer" >*/
GIMP_UNDO_LAYER_MODE, /*< desc="Set layer mode" >*/ GIMP_UNDO_LAYER_MODE, /*< desc="Set layer mode" >*/
GIMP_UNDO_LAYER_OPACITY, /*< desc="Set layer opacity" >*/ GIMP_UNDO_LAYER_OPACITY, /*< desc="Set layer opacity" >*/
GIMP_UNDO_LAYER_PRESERVE_TRANS, /*< desc="Set preserve trans" >*/ GIMP_UNDO_LAYER_LOCK_ALPHA, /*< desc="Lock/Unlock alpha channel" >*/
GIMP_UNDO_TEXT_LAYER, /*< desc="Text" >*/ GIMP_UNDO_TEXT_LAYER, /*< desc="Text" >*/
GIMP_UNDO_TEXT_LAYER_MODIFIED, /*< desc="Text modified" >*/ GIMP_UNDO_TEXT_LAYER_MODIFIED, /*< desc="Text modified" >*/
GIMP_UNDO_LAYER_MASK_ADD, /*< desc="Add layer mask" >*/ GIMP_UNDO_LAYER_MASK_ADD, /*< desc="Add layer mask" >*/
......
...@@ -1669,7 +1669,7 @@ struct _LayerPropertiesUndo ...@@ -1669,7 +1669,7 @@ struct _LayerPropertiesUndo
{ {
GimpLayerModeEffects old_mode; GimpLayerModeEffects old_mode;
gdouble old_opacity; gdouble old_opacity;
gboolean old_preserve_trans; gboolean old_lock_alpha;
}; };
static gboolean undo_push_layer_properties (GimpImage *gimage, static gboolean undo_push_layer_properties (GimpImage *gimage,
...@@ -1701,11 +1701,11 @@ gimp_image_undo_push_layer_opacity (GimpImage *gimage, ...@@ -1701,11 +1701,11 @@ gimp_image_undo_push_layer_opacity (GimpImage *gimage,
} }
gboolean gboolean
gimp_image_undo_push_layer_preserve_trans (GimpImage *gimage, gimp_image_undo_push_layer_lock_alpha (GimpImage *gimage,
const gchar *undo_desc, const gchar *undo_desc,
GimpLayer *layer) GimpLayer *layer)
{ {
return undo_push_layer_properties (gimage, GIMP_UNDO_LAYER_PRESERVE_TRANS, return undo_push_layer_properties (gimage, GIMP_UNDO_LAYER_LOCK_ALPHA,
undo_desc, layer); undo_desc, layer);
} }
...@@ -1733,9 +1733,9 @@ undo_push_layer_properties (GimpImage *gimage, ...@@ -1733,9 +1733,9 @@ undo_push_layer_properties (GimpImage *gimage,
{ {
LayerPropertiesUndo *lpu = new->data; LayerPropertiesUndo *lpu = new->data;
lpu->old_mode = gimp_layer_get_mode (layer); lpu->old_mode = gimp_layer_get_mode (layer);
lpu->old_opacity = gimp_layer_get_opacity (layer); lpu->old_opacity = gimp_layer_get_opacity (layer);
lpu->old_preserve_trans = gimp_layer_get_preserve_trans (layer); lpu->old_lock_alpha = gimp_layer_get_lock_alpha (layer);
return TRUE; return TRUE;
} }
...@@ -1773,13 +1773,13 @@ undo_pop_layer_properties (GimpUndo *undo, ...@@ -1773,13 +1773,13 @@ undo_pop_layer_properties (GimpUndo *undo,
} }
break; break;
case GIMP_UNDO_LAYER_PRESERVE_TRANS: case GIMP_UNDO_LAYER_LOCK_ALPHA:
{ {
gboolean preserve_trans; gboolean lock_alpha;
preserve_trans = gimp_layer_get_preserve_trans (layer); lock_alpha = gimp_layer_get_lock_alpha (layer);
gimp_layer_set_preserve_trans (layer, lpu->old_preserve_trans, FALSE); gimp_layer_set_lock_alpha (layer, lpu->old_lock_alpha, FALSE);
lpu->old_preserve_trans = preserve_trans; lpu->old_lock_alpha = lock_alpha;
} }
break; break;
......
...@@ -101,7 +101,7 @@ gboolean gimp_image_undo_push_layer_mode (GimpImage *gimage, ...@@ -101,7 +101,7 @@ gboolean gimp_image_undo_push_layer_mode (GimpImage *gimage,
gboolean gimp_image_undo_push_layer_opacity (GimpImage *gimage, gboolean gimp_image_undo_push_layer_opacity (GimpImage *gimage,
const gchar *undo_desc, const gchar *undo_desc,
GimpLayer *layer); GimpLayer *layer);
gboolean gimp_image_undo_push_layer_preserve_trans (GimpImage *gimage, gboolean gimp_image_undo_push_layer_lock_alpha (GimpImage *gimage,
const gchar *undo_desc, const gchar *undo_desc,
GimpLayer *layer); GimpLayer *layer);
......
...@@ -71,7 +71,7 @@ floating_sel_attach (GimpLayer *layer, ...@@ -71,7 +71,7 @@ floating_sel_attach (GimpLayer *layer,
} }
/* set the drawable and allocate a backing store */ /* set the drawable and allocate a backing store */
gimp_layer_set_preserve_trans (layer, FALSE, FALSE); gimp_layer_set_lock_alpha (layer, FALSE, FALSE);
layer->fs.drawable = drawable; layer->fs.drawable = drawable;
layer->fs.backing_store = tile_manager_new (GIMP_ITEM (layer)->width, layer->fs.backing_store = tile_manager_new (GIMP_ITEM (layer)->width,
GIMP_ITEM (layer)->height, GIMP_ITEM (layer)->height,
...@@ -411,7 +411,7 @@ floating_sel_composite (GimpLayer *layer, ...@@ -411,7 +411,7 @@ floating_sel_composite (GimpLayer *layer,
PixelRegion fsPR; PixelRegion fsPR;
GimpImage *gimage; GimpImage *gimage;
GimpLayer *d_layer = NULL; GimpLayer *d_layer = NULL;
gint preserve_trans; gint lock_alpha;
gint active[MAX_CHANNELS]; gint active[MAX_CHANNELS];
gint offx, offy; gint offx, offy;
gint x1, y1, x2, y2; gint x1, y1, x2, y2;
...@@ -467,17 +467,17 @@ floating_sel_composite (GimpLayer *layer, ...@@ -467,17 +467,17 @@ floating_sel_composite (GimpLayer *layer,
(x2 - x1), (y2 - y1), FALSE); (x2 - x1), (y2 - y1), FALSE);
/* a kludge here to prevent the case of the drawable /* a kludge here to prevent the case of the drawable
* underneath having preserve transparency on, and disallowing * underneath having lock alpha on, and disallowing
* the composited floating selection from being shown * the composited floating selection from being shown
*/ */
if (GIMP_IS_LAYER (layer->fs.drawable)) if (GIMP_IS_LAYER (layer->fs.drawable))
{ {
d_layer = GIMP_LAYER (layer->fs.drawable); d_layer = GIMP_LAYER (layer->fs.drawable);
if ((preserve_trans = gimp_layer_get_preserve_trans (d_layer))) if ((lock_alpha = gimp_layer_get_lock_alpha (d_layer)))
gimp_layer_set_preserve_trans (d_layer, FALSE, FALSE); gimp_layer_set_lock_alpha (d_layer, FALSE, FALSE);
} }
else else
preserve_trans = FALSE; lock_alpha = FALSE;
/* We need to set all gimage channels to active to make sure that /* We need to set all gimage channels to active to make sure that
* nothing strange happens while applying the floating selection. * nothing strange happens while applying the floating selection.
...@@ -500,9 +500,9 @@ floating_sel_composite (GimpLayer *layer, ...@@ -500,9 +500,9 @@ floating_sel_composite (GimpLayer *layer,
NULL, NULL,
(x1 - offx), (y1 - offy)); (x1 - offx), (y1 - offy));
/* restore preserve transparency */ /* restore lock alpha */
if (preserve_trans) if (lock_alpha)
gimp_layer_set_preserve_trans (d_layer, TRUE, FALSE); gimp_layer_set_lock_alpha (d_layer, TRUE, FALSE);
/* restore gimage active channels */ /* restore gimage active channels */
for (i = 0; i < MAX_CHANNELS; i++) for (i = 0; i < MAX_CHANNELS; i++)
......
...@@ -54,7 +54,7 @@ enum ...@@ -54,7 +54,7 @@ enum
{ {
OPACITY_CHANGED, OPACITY_CHANGED,
MODE_CHANGED, MODE_CHANGED,
PRESERVE_TRANS_CHANGED, LOCK_ALPHA_CHANGED,
MASK_CHANGED, MASK_CHANGED,
LAST_SIGNAL LAST_SIGNAL
}; };
...@@ -208,11 +208,11 @@ gimp_layer_class_init (GimpLayerClass *klass) ...@@ -208,11 +208,11 @@ gimp_layer_class_init (GimpLayerClass *klass)
gimp_marshal_VOID__VOID, gimp_marshal_VOID__VOID,
G_TYPE_NONE, 0); G_TYPE_NONE, 0);
layer_signals[PRESERVE_TRANS_CHANGED] = layer_signals[LOCK_ALPHA_CHANGED] =
g_signal_new ("preserve-trans-changed", g_signal_new ("lock-alpha-changed",
G_TYPE_FROM_CLASS (klass), G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST, G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpLayerClass, preserve_trans_changed), G_STRUCT_OFFSET (GimpLayerClass, lock_alpha_changed),
NULL, NULL, NULL, NULL,
gimp_marshal_VOID__VOID, gimp_marshal_VOID__VOID,
G_TYPE_NONE, 0); G_TYPE_NONE, 0);
...@@ -262,18 +262,18 @@ gimp_layer_class_init (GimpLayerClass *klass) ...@@ -262,18 +262,18 @@ gimp_layer_class_init (GimpLayerClass *klass)
klass->opacity_changed = NULL; klass->opacity_changed = NULL;
klass->mode_changed = NULL; klass->mode_changed = NULL;
klass->preserve_trans_changed = NULL; klass->lock_alpha_changed = NULL;
klass->mask_changed = NULL; klass->mask_changed = NULL;
} }
static void static void
gimp_layer_init (GimpLayer *layer) gimp_layer_init (GimpLayer *layer)
{ {
layer->opacity = GIMP_OPACITY_OPAQUE; layer->opacity = GIMP_OPACITY_OPAQUE;
layer->mode = GIMP_NORMAL_MODE; layer->mode = GIMP_NORMAL_MODE;
layer->preserve_trans = FALSE; layer->lock_alpha = FALSE;
layer->mask = NULL; layer->mask = NULL;
/* floating selection */ /* floating selection */
layer->fs.backing_store = NULL; layer->fs.backing_store = NULL;
...@@ -402,7 +402,7 @@ gimp_layer_get_active_components (const GimpDrawable *drawable, ...@@ -402,7 +402,7 @@ gimp_layer_get_active_components (const GimpDrawable *drawable,
for (i = 0; i < MAX_CHANNELS; i++) for (i = 0; i < MAX_CHANNELS; i++)
active[i] = gimage->active[i]; active[i] = gimage->active[i];
if (gimp_drawable_has_alpha (drawable) && layer->preserve_trans) if (gimp_drawable_has_alpha (drawable) && layer->lock_alpha)
active[gimp_drawable_bytes (drawable) - 1] = FALSE; active[gimp_drawable_bytes (drawable) - 1] = FALSE;
} }
...@@ -468,9 +468,9 @@ gimp_layer_duplicate (GimpItem *item, ...@@ -468,9 +468,9 @@ gimp_layer_duplicate (GimpItem *item,
layer = GIMP_LAYER (item); layer = GIMP_LAYER (item);
new_layer = GIMP_LAYER (new_item); new_layer = GIMP_LAYER (new_item);
new_layer->mode = layer->mode; new_layer->mode = layer->mode;
new_layer->opacity = layer->opacity; new_layer->opacity = layer->opacity;
new_layer->preserve_trans = layer->preserve_trans; new_layer->lock_alpha = layer->lock_alpha;
/* duplicate the layer mask if necessary */ /* duplicate the layer mask if necessary */
if (layer->mask) if (layer->mask)
...@@ -1741,31 +1741,33 @@ gimp_layer_get_mode (const GimpLayer *layer) ...@@ -1741,31 +1741,33 @@ gimp_layer_get_mode (const GimpLayer *layer)
} }
void void
gimp_layer_set_preserve_trans (GimpLayer *layer, gimp_layer_set_lock_alpha (GimpLayer *layer,
gboolean preserve, gboolean lock_alpha,
gboolean push_undo) gboolean push_undo)
{ {
g_return_if_fail (GIMP_IS_LAYER (layer)); g_return_if_fail (GIMP_IS_LAYER (layer));
if (layer->preserve_trans != preserve) lock_alpha = lock_alpha ? TRUE : FALSE;
if (layer->lock_alpha != lock_alpha)
{ {
if (push_undo && gimp_item_is_attached (GIMP_ITEM (layer))) if (push_undo && gimp_item_is_attached (GIMP_ITEM (layer)))
{ {
GimpImage *gimage = gimp_item_get_image (GIMP_ITEM (layer)); GimpImage *gimage = gimp_item_get_image (GIMP_ITEM (layer));
gimp_image_undo_push_layer_preserve_trans (gimage, NULL, layer); gimp_image_undo_push_layer_lock_alpha (gimage, NULL, layer);
} }
layer->preserve_trans = preserve ? TRUE : FALSE; layer->lock_alpha = lock_alpha;
g_signal_emit (layer, layer_signals[PRESERVE_TRANS_CHANGED], 0); g_signal_emit (layer, layer_signals[LOCK_ALPHA_CHANGED], 0);
} }
} }
gboolean gboolean
gimp_layer_get_preserve_trans (const GimpLayer *layer) gimp_layer_get_lock_alpha (const GimpLayer *layer)
{ {
g_return_val_if_fail (GIMP_IS_LAYER (layer), FALSE); g_return_val_if_fail (GIMP_IS_LAYER (layer), FALSE);
return layer->preserve_trans; return layer->lock_alpha;
} }
...@@ -39,7 +39,7 @@ struct _GimpLayer ...@@ -39,7 +39,7 @@ struct _GimpLayer
gdouble opacity; /* layer opacity */ gdouble opacity; /* layer opacity */
GimpLayerModeEffects mode; /* layer combination mode */ GimpLayerModeEffects mode; /* layer combination mode */
gboolean preserve_trans; /* preserve transparency */ gboolean lock_alpha; /* lock the alpha channel */
GimpLayerMask *mask; /* possible layer mask */ GimpLayerMask *mask; /* possible layer mask */
...@@ -60,10 +60,10 @@ struct _GimpLayerClass ...@@ -60,10 +60,10 @@ struct _GimpLayerClass
{ {
GimpDrawableClass parent_class; GimpDrawableClass parent_class;
void (* opacity_changed) (GimpLayer *layer); void (* opacity_changed) (GimpLayer *layer);
void (* mode_changed) (GimpLayer *layer); void (* mode_changed) (GimpLayer *layer);
void (* preserve_trans_changed) (GimpLayer *layer); void (* lock_alpha_changed) (GimpLayer *layer);
void (* mask_changed) (GimpLayer *layer); void (* mask_changed) (GimpLayer *layer);
}; };
...@@ -130,10 +130,10 @@ void gimp_layer_set_mode (GimpLayer *layer, ...@@ -130,10 +130,10 @@ void gimp_layer_set_mode (GimpLayer *layer,
gboolean push_undo); gboolean push_undo);
GimpLayerModeEffects gimp_layer_get_mode (const GimpLayer *layer); GimpLayerModeEffects gimp_layer_get_mode (const GimpLayer *layer);
void gimp_layer_set_preserve_trans (GimpLayer *layer,