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

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>
* app/batch.c (batch_run): unified strings.
......
......@@ -177,11 +177,11 @@ static GimpActionEntry layers_actions[] =
static GimpToggleActionEntry layers_toggle_actions[] =
{
{ "layers-preserve-transparency", GIMP_STOCK_TRANSPARENCY,
N_("Kee_p Transparency"), NULL, NULL,
G_CALLBACK (layers_preserve_trans_cmd_callback),
{ "layers-lock-alpha", GIMP_STOCK_TRANSPARENCY,
N_("Lock Alph_a Channel"), NULL, NULL,
G_CALLBACK (layers_lock_alpha_cmd_callback),
FALSE,
GIMP_HELP_LAYER_KEEP_TRANSPARENCY },
GIMP_HELP_LAYER_LOCK_ALPHA },
{ "layers-mask-edit", GIMP_STOCK_EDIT,
N_("_Edit Layer Mask"), NULL, NULL,
......@@ -391,7 +391,7 @@ layers_actions_update (GimpActionGroup *group,
gboolean sel = FALSE;
gboolean alpha = FALSE; /* alpha channel present */
gboolean indexed = FALSE; /* is indexed */
gboolean preserve = FALSE;
gboolean lock_alpha = FALSE;
gboolean text_layer = FALSE;
GList *next = NULL;
GList *prev = NULL;
......@@ -409,9 +409,9 @@ layers_actions_update (GimpActionGroup *group,
{
GList *list;
mask = gimp_layer_get_mask (layer);
preserve = gimp_layer_get_preserve_trans (layer);
alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (layer));
mask = gimp_layer_get_mask (layer);
lock_alpha = gimp_layer_get_lock_alpha (layer);
alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (layer));
list = g_list_find (GIMP_LIST (gimage->layers)->list, layer);
......@@ -465,8 +465,8 @@ layers_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("layers-alpha-add", layer && !fs && !alpha);
SET_SENSITIVE ("layers-preserve-transparency", layer);
SET_ACTIVE ("layers-preserve-transparency", preserve);
SET_SENSITIVE ("layers-lock-alpha", layer);
SET_ACTIVE ("layers-lock-alpha", lock_alpha);
SET_SENSITIVE ("layers-mask-add", layer && !fs && !ac && !mask);
SET_SENSITIVE ("layers-mask-apply", layer && !fs && !ac && mask);
......
......@@ -779,28 +779,28 @@ layers_mode_cmd_callback (GtkAction *action,
}
void
layers_preserve_trans_cmd_callback (GtkAction *action,
gpointer data)
layers_lock_alpha_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *gimage;
GimpLayer *layer;
gboolean preserve;
gboolean lock_alpha;
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;
gboolean push_undo = TRUE;
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))
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);
}
}
......
......@@ -90,7 +90,7 @@ void layers_mode_cmd_callback (GtkAction *action,
gint value,
gpointer data);
void layers_preserve_trans_cmd_callback (GtkAction *action,
void layers_lock_alpha_cmd_callback (GtkAction *action,
gpointer data);
......
......@@ -772,7 +772,7 @@ gimp_undo_type_get_type (void)
{ GIMP_UNDO_LAYER_REPOSITION, "GIMP_UNDO_LAYER_REPOSITION", "layer-reposition" },
{ GIMP_UNDO_LAYER_MODE, "GIMP_UNDO_LAYER_MODE", "layer-mode" },
{ 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_MODIFIED, "GIMP_UNDO_TEXT_LAYER_MODIFIED", "text-layer-modified" },
{ GIMP_UNDO_LAYER_MASK_ADD, "GIMP_UNDO_LAYER_MASK_ADD", "layer-mask-add" },
......@@ -858,7 +858,7 @@ gimp_undo_type_get_type (void)
{ GIMP_UNDO_LAYER_REPOSITION, N_("Reposition layer"), NULL },
{ GIMP_UNDO_LAYER_MODE, N_("Set layer mode"), 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_MODIFIED, N_("Text modified"), NULL },
{ GIMP_UNDO_LAYER_MASK_ADD, N_("Add layer mask"), NULL },
......
......@@ -401,7 +401,7 @@ typedef enum /*< pdb-skip >*/
GIMP_UNDO_LAYER_REPOSITION, /*< desc="Reposition layer" >*/
GIMP_UNDO_LAYER_MODE, /*< desc="Set layer mode" >*/
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_MODIFIED, /*< desc="Text modified" >*/
GIMP_UNDO_LAYER_MASK_ADD, /*< desc="Add layer mask" >*/
......
......@@ -1669,7 +1669,7 @@ struct _LayerPropertiesUndo
{
GimpLayerModeEffects old_mode;
gdouble old_opacity;
gboolean old_preserve_trans;
gboolean old_lock_alpha;
};
static gboolean undo_push_layer_properties (GimpImage *gimage,
......@@ -1701,11 +1701,11 @@ gimp_image_undo_push_layer_opacity (GimpImage *gimage,
}
gboolean
gimp_image_undo_push_layer_preserve_trans (GimpImage *gimage,
const gchar *undo_desc,
GimpLayer *layer)
gimp_image_undo_push_layer_lock_alpha (GimpImage *gimage,
const gchar *undo_desc,
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);
}
......@@ -1733,9 +1733,9 @@ undo_push_layer_properties (GimpImage *gimage,
{
LayerPropertiesUndo *lpu = new->data;
lpu->old_mode = gimp_layer_get_mode (layer);
lpu->old_opacity = gimp_layer_get_opacity (layer);
lpu->old_preserve_trans = gimp_layer_get_preserve_trans (layer);
lpu->old_mode = gimp_layer_get_mode (layer);
lpu->old_opacity = gimp_layer_get_opacity (layer);
lpu->old_lock_alpha = gimp_layer_get_lock_alpha (layer);
return TRUE;
}
......@@ -1773,13 +1773,13 @@ undo_pop_layer_properties (GimpUndo *undo,
}
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);
gimp_layer_set_preserve_trans (layer, lpu->old_preserve_trans, FALSE);
lpu->old_preserve_trans = preserve_trans;
lock_alpha = gimp_layer_get_lock_alpha (layer);
gimp_layer_set_lock_alpha (layer, lpu->old_lock_alpha, FALSE);
lpu->old_lock_alpha = lock_alpha;
}
break;
......
......@@ -101,7 +101,7 @@ gboolean gimp_image_undo_push_layer_mode (GimpImage *gimage,
gboolean gimp_image_undo_push_layer_opacity (GimpImage *gimage,
const gchar *undo_desc,
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,
GimpLayer *layer);
......
......@@ -71,7 +71,7 @@ floating_sel_attach (GimpLayer *layer,
}
/* 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.backing_store = tile_manager_new (GIMP_ITEM (layer)->width,
GIMP_ITEM (layer)->height,
......@@ -411,7 +411,7 @@ floating_sel_composite (GimpLayer *layer,
PixelRegion fsPR;
GimpImage *gimage;
GimpLayer *d_layer = NULL;
gint preserve_trans;
gint lock_alpha;
gint active[MAX_CHANNELS];
gint offx, offy;
gint x1, y1, x2, y2;
......@@ -467,17 +467,17 @@ floating_sel_composite (GimpLayer *layer,
(x2 - x1), (y2 - y1), FALSE);
/* 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
*/
if (GIMP_IS_LAYER (layer->fs.drawable))
{
d_layer = GIMP_LAYER (layer->fs.drawable);
if ((preserve_trans = gimp_layer_get_preserve_trans (d_layer)))
gimp_layer_set_preserve_trans (d_layer, FALSE, FALSE);
if ((lock_alpha = gimp_layer_get_lock_alpha (d_layer)))
gimp_layer_set_lock_alpha (d_layer, FALSE, FALSE);
}
else
preserve_trans = FALSE;
lock_alpha = FALSE;
/* We need to set all gimage channels to active to make sure that
* nothing strange happens while applying the floating selection.
......@@ -500,9 +500,9 @@ floating_sel_composite (GimpLayer *layer,
NULL,
(x1 - offx), (y1 - offy));
/* restore preserve transparency */
if (preserve_trans)
gimp_layer_set_preserve_trans (d_layer, TRUE, FALSE);
/* restore lock alpha */
if (lock_alpha)
gimp_layer_set_lock_alpha (d_layer, TRUE, FALSE);
/* restore gimage active channels */
for (i = 0; i < MAX_CHANNELS; i++)
......
......@@ -54,7 +54,7 @@ enum
{
OPACITY_CHANGED,
MODE_CHANGED,
PRESERVE_TRANS_CHANGED,
LOCK_ALPHA_CHANGED,
MASK_CHANGED,
LAST_SIGNAL
};
......@@ -208,11 +208,11 @@ gimp_layer_class_init (GimpLayerClass *klass)
gimp_marshal_VOID__VOID,
G_TYPE_NONE, 0);
layer_signals[PRESERVE_TRANS_CHANGED] =
g_signal_new ("preserve-trans-changed",
layer_signals[LOCK_ALPHA_CHANGED] =
g_signal_new ("lock-alpha-changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpLayerClass, preserve_trans_changed),
G_STRUCT_OFFSET (GimpLayerClass, lock_alpha_changed),
NULL, NULL,
gimp_marshal_VOID__VOID,
G_TYPE_NONE, 0);
......@@ -262,18 +262,18 @@ gimp_layer_class_init (GimpLayerClass *klass)
klass->opacity_changed = NULL;
klass->mode_changed = NULL;
klass->preserve_trans_changed = NULL;
klass->lock_alpha_changed = NULL;
klass->mask_changed = NULL;
}
static void
gimp_layer_init (GimpLayer *layer)
{
layer->opacity = GIMP_OPACITY_OPAQUE;
layer->mode = GIMP_NORMAL_MODE;
layer->preserve_trans = FALSE;
layer->opacity = GIMP_OPACITY_OPAQUE;
layer->mode = GIMP_NORMAL_MODE;
layer->lock_alpha = FALSE;
layer->mask = NULL;
layer->mask = NULL;
/* floating selection */
layer->fs.backing_store = NULL;
......@@ -402,7 +402,7 @@ gimp_layer_get_active_components (const GimpDrawable *drawable,
for (i = 0; i < MAX_CHANNELS; 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;
}
......@@ -468,9 +468,9 @@ gimp_layer_duplicate (GimpItem *item,
layer = GIMP_LAYER (item);
new_layer = GIMP_LAYER (new_item);
new_layer->mode = layer->mode;
new_layer->opacity = layer->opacity;
new_layer->preserve_trans = layer->preserve_trans;
new_layer->mode = layer->mode;
new_layer->opacity = layer->opacity;
new_layer->lock_alpha = layer->lock_alpha;
/* duplicate the layer mask if necessary */
if (layer->mask)
......@@ -1741,31 +1741,33 @@ gimp_layer_get_mode (const GimpLayer *layer)
}
void
gimp_layer_set_preserve_trans (GimpLayer *layer,
gboolean preserve,
gboolean push_undo)
gimp_layer_set_lock_alpha (GimpLayer *layer,
gboolean lock_alpha,
gboolean push_undo)
{
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)))
{
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
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);
return layer->preserve_trans;
return layer->lock_alpha;
}
......@@ -39,7 +39,7 @@ struct _GimpLayer
gdouble opacity; /* layer opacity */
GimpLayerModeEffects mode; /* layer combination mode */
gboolean preserve_trans; /* preserve transparency */
gboolean lock_alpha; /* lock the alpha channel */
GimpLayerMask *mask; /* possible layer mask */
......@@ -60,10 +60,10 @@ struct _GimpLayerClass
{
GimpDrawableClass parent_class;
void (* opacity_changed) (GimpLayer *layer);
void (* mode_changed) (GimpLayer *layer);
void (* preserve_trans_changed) (GimpLayer *layer);
void (* mask_changed) (GimpLayer *layer);
void (* opacity_changed) (GimpLayer *layer);
void (* mode_changed) (GimpLayer *layer);
void (* lock_alpha_changed) (GimpLayer *layer);
void (* mask_changed) (GimpLayer *layer);
};
......@@ -130,10 +130,10 @@ void gimp_layer_set_mode (GimpLayer *layer,
gboolean push_undo);
GimpLayerModeEffects gimp_layer_get_mode (const GimpLayer *layer);
void gimp_layer_set_preserve_trans (GimpLayer *layer,
gboolean preserve,
void gimp_layer_set_lock_alpha (GimpLayer *layer,
gboolean lock_alpha,
gboolean push_undo);
gboolean gimp_layer_get_preserve_trans (const GimpLayer *layer);
gboolean gimp_layer_get_lock_alpha (const GimpLayer *layer);
#endif /* __GIMP_LAYER_H__ */
......@@ -164,7 +164,10 @@ procedural_db_init_procs (Gimp *gimp,
{ "gimp_undo_push_group_start", "gimp_image_undo_group_start" },
{ "gimp_undo_push_group_end", "gimp_image_undo_group_end" },
{ "gimp_channel_ops_duplicate", "gimp_image_duplicate" },
{ "gimp_channel_ops_offset", "gimp_drawable_offset" }
{ "gimp_channel_ops_offset", "gimp_drawable_offset" },
{ "gimp_layer_get_preserve_trans", "gimp_drawable_set_lock_alpha" },
{ "gimp_layer_set_preserve_trans", "gimp_drawable_set_lock_alpha" }
};
g_return_if_fail (GIMP_IS_GIMP (gimp));
......
......@@ -164,7 +164,10 @@ procedural_db_init_procs (Gimp *gimp,
{ "gimp_undo_push_group_start", "gimp_image_undo_group_start" },
{ "gimp_undo_push_group_end", "gimp_image_undo_group_end" },
{ "gimp_channel_ops_duplicate", "gimp_image_duplicate" },
{ "gimp_channel_ops_offset", "gimp_drawable_offset" }
{ "gimp_channel_ops_offset", "gimp_drawable_offset" },
{ "gimp_layer_get_preserve_trans", "gimp_drawable_set_lock_alpha" },
{ "gimp_layer_set_preserve_trans", "gimp_drawable_set_lock_alpha" }
};
g_return_if_fail (GIMP_IS_GIMP (gimp));
......
......@@ -164,7 +164,10 @@ procedural_db_init_procs (Gimp *gimp,
{ "gimp_undo_push_group_start", "gimp_image_undo_group_start" },
{ "gimp_undo_push_group_end", "gimp_image_undo_group_end" },
{ "gimp_channel_ops_duplicate", "gimp_image_duplicate" },
{ "gimp_channel_ops_offset", "gimp_drawable_offset" }
{ "gimp_channel_ops_offset", "gimp_drawable_offset" },
{ "gimp_layer_get_preserve_trans", "gimp_drawable_set_lock_alpha" },
{ "gimp_layer_set_preserve_trans", "gimp_drawable_set_lock_alpha" }
};
g_return_if_fail (GIMP_IS_GIMP (gimp));
......
......@@ -52,8 +52,8 @@ static ProcRecord layer_from_mask_proc;
static ProcRecord layer_add_mask_proc;
static ProcRecord layer_remove_mask_proc;
static ProcRecord layer_is_floating_sel_proc;
static ProcRecord layer_get_preserve_trans_proc;
static ProcRecord layer_set_preserve_trans_proc;
static ProcRecord layer_get_lock_alpha_proc;
static ProcRecord layer_set_lock_alpha_proc;
static ProcRecord layer_get_apply_mask_proc;
static ProcRecord layer_set_apply_mask_proc;
static ProcRecord layer_get_show_mask_proc;
......@@ -83,8 +83,8 @@ register_layer_procs (Gimp *gimp)
procedural_db_register (gimp, &layer_add_mask_proc);
procedural_db_register (gimp, &layer_remove_mask_proc);
procedural_db_register (gimp, &layer_is_floating_sel_proc);
procedural_db_register (gimp, &layer_get_preserve_trans_proc);
procedural_db_register (gimp, &layer_set_preserve_trans_proc);
procedural_db_register (gimp, &layer_get_lock_alpha_proc);
procedural_db_register (gimp, &layer_set_lock_alpha_proc);
procedural_db_register (gimp, &layer_get_apply_mask_proc);
procedural_db_register (gimp, &layer_set_apply_mask_proc);
procedural_db_register (gimp, &layer_get_show_mask_proc);
......@@ -1157,10 +1157,10 @@ static ProcRecord layer_is_floating_sel_proc =
};
static Argument *
layer_get_preserve_trans_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
layer_get_lock_alpha_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
Argument *return_args;
......@@ -1170,15 +1170,15 @@ layer_get_preserve_trans_invoker (Gimp *gimp,
if (! (GIMP_IS_LAYER (layer) && ! gimp_item_is_removed (GIMP_ITEM (layer))))
success = FALSE;
return_args = procedural_db_return_args (&layer_get_preserve_trans_proc, success);
return_args = procedural_db_return_args (&layer_get_lock_alpha_proc, success);
if (success)
return_args[1].value.pdb_int = gimp_layer_get_preserve_trans (layer);
return_args[1].value.pdb_int = gimp_layer_get_lock_alpha (layer);
return return_args;
}
static ProcArg layer_get_preserve_trans_inargs[] =
static ProcArg layer_get_lock_alpha_inargs[] =
{
{
GIMP_PDB_LAYER,
......@@ -1187,55 +1187,55 @@ static ProcArg layer_get_preserve_trans_inargs[] =
}
};
static ProcArg layer_get_preserve_trans_outargs[] =
static ProcArg layer_get_lock_alpha_outargs[] =
{
{
GIMP_PDB_INT32,
"preserve_trans",
"The layer's preserve transperancy setting"
"lock_alpha",
"The layer's lock alpha channel setting"
}
};
static ProcRecord layer_get_preserve_trans_proc =
static ProcRecord layer_get_lock_alpha_proc =
{
"gimp_layer_get_preserve_trans",
"Get the preserve transperancy setting of the specified layer.",
"This procedure returns the specified layer's preserve transperancy setting.",
"gimp_layer_get_lock_alpha",
"Get the lock alpha channel setting of the specified layer.",
"This procedure returns the specified layer's lock alpha channel setting.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL,
GIMP_INTERNAL,
1,
layer_get_preserve_trans_inargs,
layer_get_lock_alpha_inargs,
1,
layer_get_preserve_trans_outargs,
{ { layer_get_preserve_trans_invoker } }
layer_get_lock_alpha_outargs,
{ { layer_get_lock_alpha_invoker } }
};
static Argument *
layer_set_preserve_trans_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
layer_set_lock_alpha_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
GimpLayer *layer;
gboolean preserve_trans;
gboolean lock_alpha;
layer = (GimpLayer *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_LAYER (layer) && ! gimp_item_is_removed (GIMP_ITEM (layer))))
success = FALSE;
preserve_trans = args[1].value.pdb_int ? TRUE : FALSE;
lock_alpha = args[1].value.pdb_int ? TRUE : FALSE;
if (success)
gimp_layer_set_preserve_trans (layer, preserve_trans, TRUE);
gimp_layer_set_lock_alpha (layer, lock_alpha, TRUE);
return procedural_db_return_args (&layer_set_preserve_trans_proc, success);
return procedural_db_return_args (&layer_set_lock_alpha_proc, success);
}
static ProcArg layer_set_preserve_trans_inargs[] =
static ProcArg layer_set_lock_alpha_inargs[] =
{
{
GIMP_PDB_LAYER,
......@@ -1244,26 +1244,26 @@ static ProcArg layer_set_preserve_trans_inargs[] =
},
{
GIMP_PDB_INT32,
"preserve_trans",
"The new layer's preserve transperancy setting"
"lock_alpha",
"The new layer's lock alpha channel setting"
}
};
static ProcRecord layer_set_preserve_trans_proc =
static ProcRecord layer_set_lock_alpha_proc =
{
"gimp_layer_set_preserve_trans",
"Set the preserve transperancy setting of the specified layer.",
"This procedure sets the specified layer's preserve transperancy setting.",
"gimp_layer_set_lock_alpha",
"Set the lock alpha channel setting of the specified layer.",
"This procedure sets the specified layer's lock alpha channel setting.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL,
GIMP_INTERNAL,
2,
layer_set_preserve_trans_inargs,
layer_set_lock_alpha_inargs,
0,
NULL,
{ { layer_set_preserve_trans_invoker } }
{ { layer_set_lock_alpha_invoker } }
};
static Argument *
......
......@@ -164,7 +164,10 @@ procedural_db_init_procs (Gimp *gimp,
{ "gimp_undo_push_group_start", "gimp_image_undo_group_start" },
{ "gimp_undo_push_group_end", "gimp_image_undo_group_end" },
{ "gimp_channel_ops_duplicate", "gimp_image_duplicate" },
{ "gimp_channel_ops_offset", "gimp_drawable_offset" }
{ "gimp_channel_ops_offset", "gimp_drawable_offset" },
{ "gimp_layer_get_preserve_trans", "gimp_drawable_set_lock_alpha" },
{ "gimp_layer_set_preserve_trans", "gimp_drawable_set_lock_alpha" }
};
g_return_if_fail (GIMP_IS_GIMP (gimp));
......
......@@ -215,9 +215,9 @@ gimp_text_layer_from_layer (GimpLayer *layer,
drawable->type = gimp_drawable_type (GIMP_DRAWABLE (layer));
drawable->has_alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (layer));
GIMP_LAYER (text_layer)->opacity = gimp_layer_get_opacity (layer);
GIMP_LAYER (text_layer)->mode = gimp_layer_get_mode (layer);
GIMP_LAYER (text_layer)->preserve_trans = gimp_layer_get_preserve_trans (layer);
GIMP_LAYER (text_layer)->opacity = gimp_layer_get_opacity (layer);
GIMP_LAYER (text_layer)->mode = gimp_layer_get_mode (layer);
GIMP_LAYER (text_layer)->lock_alpha = gimp_layer_get_lock_alpha (layer);
gimp_text_layer_set_text (text_layer, text);
......
......@@ -127,8 +127,8 @@
#define GIMP_HELP_LAYER_DIALOG "gimp-layer-dialog"