Commit 4aa7e67c authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

removed "add_alpha" parameter from gimp_item_duplicate() and

2008-01-08  Sven Neumann  <sven@gimp.org>

	* app/core/gimpitem.[ch]: removed "add_alpha" parameter from
	gimp_item_duplicate() and gimp_item_convert(). This is a relict
	from the time when only the bottom layer was allowed to have no
	alpha channel.

	* app/actions/channels-commands.c
	* app/actions/layers-commands.c
	* app/actions/vectors-commands.c
	* app/core/gimpchannel.c
	* app/core/gimpdrawable.c
	* app/core/gimpimage-duplicate.c
	* app/core/gimpimage-merge.c
	* app/core/gimpimage-quick-mask.c
	* app/core/gimplayer.c
	* app/core/gimplayermask.c
	* app/core/gimpselection.c
	* app/display/gimpdisplayshell-dnd.c
	* app/file/file-open.c
	* app/pdb/channel_cmds.c
	* app/pdb/layer_cmds.c
	* app/text/gimptextlayer.c
	* app/vectors/gimpvectors.c
	* app/vectors/gimpvectorsmodundo.c
	* app/widgets/gimpchanneltreeview.c
	* app/widgets/gimpitemtreeview.c
	* app/widgets/gimplayertreeview.c
	* app/widgets/gimptoolbox-dnd.c
	* tools/pdbgen/pdb/channel.pdb
	* tools/pdbgen/pdb/layer.pdb: changed accordingly.

svn path=/trunk/; revision=24570
parent ef5cda6a
2008-01-08 Sven Neumann <sven@gimp.org>
* app/core/gimpitem.[ch]: removed "add_alpha" parameter from
gimp_item_duplicate() and gimp_item_convert(). This is a relict
from the time when only the bottom layer was allowed to have no
alpha channel.
* app/actions/channels-commands.c
* app/actions/layers-commands.c
* app/actions/vectors-commands.c
* app/core/gimpchannel.c
* app/core/gimpdrawable.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-merge.c
* app/core/gimpimage-quick-mask.c
* app/core/gimplayer.c
* app/core/gimplayermask.c
* app/core/gimpselection.c
* app/display/gimpdisplayshell-dnd.c
* app/file/file-open.c
* app/pdb/channel_cmds.c
* app/pdb/layer_cmds.c
* app/text/gimptextlayer.c
* app/vectors/gimpvectors.c
* app/vectors/gimpvectorsmodundo.c
* app/widgets/gimpchanneltreeview.c
* app/widgets/gimpitemtreeview.c
* app/widgets/gimplayertreeview.c
* app/widgets/gimptoolbox-dnd.c
* tools/pdbgen/pdb/channel.pdb
* tools/pdbgen/pdb/layer.pdb: changed accordingly.
2008-01-08 Sven Neumann <sven@gimp.org>
* app/file/file-open.c (file_open_layers): moved code to a utility
......
......@@ -259,8 +259,7 @@ channels_duplicate_cmd_callback (GtkAction *action,
new_channel =
GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (channel),
G_TYPE_FROM_INSTANCE (channel),
TRUE));
G_TYPE_FROM_INSTANCE (channel)));
}
gimp_image_add_channel (image, new_channel, -1);
......@@ -339,8 +338,7 @@ channels_new_channel_response (GtkWidget *widget,
new_channel =
GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (selection),
GIMP_TYPE_CHANNEL,
FALSE));
GIMP_TYPE_CHANNEL));
gimp_object_set_name (GIMP_OBJECT (new_channel), channel_name);
gimp_channel_set_color (new_channel, &channel_color, FALSE);
......
......@@ -414,10 +414,8 @@ layers_duplicate_cmd_callback (GtkAction *action,
GimpLayer *new_layer;
return_if_no_layer (image, layer, data);
new_layer =
GIMP_LAYER (gimp_item_duplicate (GIMP_ITEM (layer),
G_TYPE_FROM_INSTANCE (layer),
TRUE));
new_layer = GIMP_LAYER (gimp_item_duplicate (GIMP_ITEM (layer),
G_TYPE_FROM_INSTANCE (layer)));
gimp_image_add_layer (image, new_layer, -1);
gimp_image_flush (image);
......
......@@ -249,10 +249,8 @@ vectors_duplicate_cmd_callback (GtkAction *action,
GimpVectors *new_vectors;
return_if_no_vectors (image, vectors, data);
new_vectors =
GIMP_VECTORS (gimp_item_duplicate (GIMP_ITEM (vectors),
G_TYPE_FROM_INSTANCE (vectors),
TRUE));
new_vectors = GIMP_VECTORS (gimp_item_duplicate (GIMP_ITEM (vectors),
G_TYPE_FROM_INSTANCE (vectors)));
gimp_image_add_vectors (image, new_vectors, -1);
gimp_image_flush (image);
}
......
......@@ -77,8 +77,7 @@ static gchar * gimp_channel_get_description (GimpViewable *viewable,
static gboolean gimp_channel_is_attached (GimpItem *item);
static GimpItem * gimp_channel_duplicate (GimpItem *item,
GType new_type,
gboolean add_alpha);
GType new_type);
static void gimp_channel_convert (GimpItem *item,
GimpImage *dest_image);
static void gimp_channel_translate (GimpItem *item,
......@@ -376,18 +375,13 @@ gimp_channel_is_attached (GimpItem *item)
static GimpItem *
gimp_channel_duplicate (GimpItem *item,
GType new_type,
gboolean add_alpha)
GType new_type)
{
GimpItem *new_item;
g_return_val_if_fail (g_type_is_a (new_type, GIMP_TYPE_DRAWABLE), NULL);
if (g_type_is_a (new_type, GIMP_TYPE_CHANNEL))
add_alpha = FALSE;
new_item = GIMP_ITEM_CLASS (parent_class)->duplicate (item, new_type,
add_alpha);
new_item = GIMP_ITEM_CLASS (parent_class)->duplicate (item, new_type);
if (GIMP_IS_CHANNEL (new_item))
{
......
......@@ -75,8 +75,7 @@ static gboolean gimp_drawable_get_size (GimpViewable *viewable,
static void gimp_drawable_invalidate_preview (GimpViewable *viewable);
static GimpItem * gimp_drawable_duplicate (GimpItem *item,
GType new_type,
gboolean add_alpha);
GType new_type);
static void gimp_drawable_translate (GimpItem *item,
gint offset_x,
gint offset_y,
......@@ -307,36 +306,28 @@ gimp_drawable_invalidate_preview (GimpViewable *viewable)
static GimpItem *
gimp_drawable_duplicate (GimpItem *item,
GType new_type,
gboolean add_alpha)
GType new_type)
{
GimpItem *new_item;
g_return_val_if_fail (g_type_is_a (new_type, GIMP_TYPE_DRAWABLE), NULL);
new_item = GIMP_ITEM_CLASS (parent_class)->duplicate (item, new_type,
add_alpha);
new_item = GIMP_ITEM_CLASS (parent_class)->duplicate (item, new_type);
if (GIMP_IS_DRAWABLE (new_item))
{
GimpDrawable *drawable = GIMP_DRAWABLE (item);
GimpDrawable *new_drawable = GIMP_DRAWABLE (new_item);
GimpImageType new_image_type;
PixelRegion srcPR;
PixelRegion destPR;
if (add_alpha)
new_image_type = gimp_drawable_type_with_alpha (drawable);
else
new_image_type = gimp_drawable_type (drawable);
gimp_drawable_configure (new_drawable,
gimp_item_get_image (item),
item->offset_x,
item->offset_y,
gimp_item_width (item),
gimp_item_height (item),
new_image_type,
gimp_drawable_type (drawable),
GIMP_OBJECT (new_drawable)->name);
pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
......@@ -350,10 +341,7 @@ gimp_drawable_duplicate (GimpItem *item,
gimp_item_height (new_item),
TRUE);
if (new_image_type == drawable->type)
copy_region (&srcPR, &destPR);
else
add_alpha_region (&srcPR, &destPR);
copy_region (&srcPR, &destPR);
}
return new_item;
......
......@@ -114,8 +114,7 @@ gimp_image_duplicate (GimpImage *image)
new_layer = GIMP_LAYER (gimp_item_convert (GIMP_ITEM (layer),
new_image,
G_TYPE_FROM_INSTANCE (layer),
FALSE));
G_TYPE_FROM_INSTANCE (layer)));
/* Make sure the copied layer doesn't say: "<old layer> copy" */
gimp_object_set_name (GIMP_OBJECT (new_layer),
......@@ -149,11 +148,9 @@ gimp_image_duplicate (GimpImage *image)
GimpChannel *channel = list->data;
GimpChannel *new_channel;
new_channel =
GIMP_CHANNEL (gimp_item_convert (GIMP_ITEM (channel),
new_image,
G_TYPE_FROM_INSTANCE (channel),
FALSE));
new_channel = GIMP_CHANNEL (gimp_item_convert (GIMP_ITEM (channel),
new_image,
G_TYPE_FROM_INSTANCE (channel)));
/* Make sure the copied channel doesn't say: "<old channel> copy" */
gimp_object_set_name (GIMP_OBJECT (new_channel),
......@@ -176,11 +173,9 @@ gimp_image_duplicate (GimpImage *image)
GimpVectors *vectors = list->data;
GimpVectors *new_vectors;
new_vectors =
GIMP_VECTORS (gimp_item_convert (GIMP_ITEM (vectors),
new_image,
G_TYPE_FROM_INSTANCE (vectors),
FALSE));
new_vectors = GIMP_VECTORS (gimp_item_convert (GIMP_ITEM (vectors),
new_image,
G_TYPE_FROM_INSTANCE (vectors)));
/* Make sure the copied vectors doesn't say: "<old vectors> copy" */
gimp_object_set_name (GIMP_OBJECT (new_vectors),
......
......@@ -257,10 +257,8 @@ gimp_image_merge_visible_vectors (GimpImage *image,
vectors = GIMP_VECTORS (cur_item->data);
name = g_strdup (gimp_object_get_name (GIMP_OBJECT (vectors)));
target_vectors = GIMP_VECTORS (
gimp_item_duplicate (GIMP_ITEM (vectors),
GIMP_TYPE_VECTORS,
FALSE));
target_vectors = GIMP_VECTORS (gimp_item_duplicate (GIMP_ITEM (vectors),
GIMP_TYPE_VECTORS));
pos = gimp_image_get_vectors_index (image, vectors);
gimp_image_remove_vectors (image, vectors);
cur_item = cur_item->next;
......
......@@ -104,8 +104,7 @@ gimp_image_set_quick_mask_state (GimpImage *image,
/* if selection */
mask = GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (selection),
GIMP_TYPE_CHANNEL,
FALSE));
GIMP_TYPE_CHANNEL));
/* Clear the selection */
gimp_channel_clear (selection, NULL, TRUE);
......
......@@ -78,8 +78,7 @@ static gint64 gimp_item_get_memsize (GimpObject *object,
gint64 *gui_size);
static GimpItem * gimp_item_real_duplicate (GimpItem *item,
GType new_type,
gboolean add_alpha);
GType new_type);
static void gimp_item_real_convert (GimpItem *item,
GimpImage *dest_image);
static gboolean gimp_item_real_rename (GimpItem *item,
......@@ -289,8 +288,7 @@ gimp_item_get_memsize (GimpObject *object,
static GimpItem *
gimp_item_real_duplicate (GimpItem *item,
GType new_type,
gboolean add_alpha)
GType new_type)
{
GimpItem *new_item;
gchar *new_name;
......@@ -525,22 +523,20 @@ gimp_item_is_attached (GimpItem *item)
/**
* gimp_item_duplicate:
* @item: The #GimpItem to duplicate.
* @new_type: The type to make the new item.
* @add_alpha: #TRUE if an alpha channel should be added to the new item.
* @item: The #GimpItem to duplicate.
* @new_type: The type to make the new item.
*
* Returns: the newly created item.
*/
GimpItem *
gimp_item_duplicate (GimpItem *item,
GType new_type,
gboolean add_alpha)
GType new_type)
{
g_return_val_if_fail (GIMP_IS_ITEM (item), NULL);
g_return_val_if_fail (GIMP_IS_IMAGE (item->image), NULL);
g_return_val_if_fail (g_type_is_a (new_type, GIMP_TYPE_ITEM), NULL);
return GIMP_ITEM_GET_CLASS (item)->duplicate (item, new_type, add_alpha);
return GIMP_ITEM_GET_CLASS (item)->duplicate (item, new_type);
}
/**
......@@ -548,15 +544,13 @@ gimp_item_duplicate (GimpItem *item,
* @item: The #GimpItem to convert.
* @dest_image: The #GimpImage in which to place the converted item.
* @new_type: The type to convert the item to.
* @add_alpha: #TRUE if an alpha channel should be added to the converted item.
*
* Returns: the new item that results from the conversion.
*/
GimpItem *
gimp_item_convert (GimpItem *item,
GimpImage *dest_image,
GType new_type,
gboolean add_alpha)
GType new_type)
{
GimpItem *new_item;
......@@ -565,7 +559,7 @@ gimp_item_convert (GimpItem *item,
g_return_val_if_fail (GIMP_IS_IMAGE (dest_image), NULL);
g_return_val_if_fail (g_type_is_a (new_type, GIMP_TYPE_ITEM), NULL);
new_item = gimp_item_duplicate (item, new_type, add_alpha);
new_item = gimp_item_duplicate (item, new_type);
if (new_item)
GIMP_ITEM_GET_CLASS (new_item)->convert (new_item, dest_image);
......
......@@ -65,8 +65,7 @@ struct _GimpItemClass
/* virtual functions */
gboolean (* is_attached) (GimpItem *item);
GimpItem * (* duplicate) (GimpItem *item,
GType new_type,
gboolean add_alpha);
GType new_type);
void (* convert) (GimpItem *item,
GimpImage *dest_image);
gboolean (* rename) (GimpItem *item,
......@@ -142,12 +141,10 @@ void gimp_item_configure (GimpItem *item,
gint height,
const gchar *name);
GimpItem * gimp_item_duplicate (GimpItem *item,
GType new_type,
gboolean add_alpha);
GType new_type);
GimpItem * gimp_item_convert (GimpItem *item,
GimpImage *dest_image,
GType new_type,
gboolean add_alpha);
GType new_type);
gboolean gimp_item_rename (GimpItem *item,
const gchar *new_name,
......
......@@ -93,8 +93,7 @@ static gchar * gimp_layer_get_description (GimpViewable *viewable,
static void gimp_layer_removed (GimpItem *item);
static gboolean gimp_layer_is_attached (GimpItem *item);
static GimpItem * gimp_layer_duplicate (GimpItem *item,
GType new_type,
gboolean add_alpha);
GType new_type);
static void gimp_layer_convert (GimpItem *item,
GimpImage *dest_image);
static gboolean gimp_layer_rename (GimpItem *item,
......@@ -512,15 +511,13 @@ gimp_layer_is_attached (GimpItem *item)
static GimpItem *
gimp_layer_duplicate (GimpItem *item,
GType new_type,
gboolean add_alpha)
GType new_type)
{
GimpItem *new_item;
g_return_val_if_fail (g_type_is_a (new_type, GIMP_TYPE_DRAWABLE), NULL);
new_item = GIMP_ITEM_CLASS (parent_class)->duplicate (item, new_type,
add_alpha);
new_item = GIMP_ITEM_CLASS (parent_class)->duplicate (item, new_type);
if (GIMP_IS_LAYER (new_item))
{
......@@ -537,11 +534,11 @@ gimp_layer_duplicate (GimpItem *item,
/* duplicate the layer mask if necessary */
if (layer->mask)
{
GimpItem *new_mask =
gimp_item_duplicate (GIMP_ITEM (layer->mask),
G_TYPE_FROM_INSTANCE (layer->mask),
FALSE);
gimp_layer_add_mask (new_layer, GIMP_LAYER_MASK (new_mask), FALSE);
GimpItem *mask;
mask = gimp_item_duplicate (GIMP_ITEM (layer->mask),
G_TYPE_FROM_INSTANCE (layer->mask));
gimp_layer_add_mask (new_layer, GIMP_LAYER_MASK (mask), FALSE);
}
}
......
......@@ -47,8 +47,7 @@ enum
static gboolean gimp_layer_mask_is_attached (GimpItem *item);
static GimpItem * gimp_layer_mask_duplicate (GimpItem *item,
GType new_type,
gboolean add_alpha);
GType new_type);
static gboolean gimp_layer_mask_rename (GimpItem *item,
const gchar *new_name,
const gchar *undo_desc,
......@@ -129,15 +128,13 @@ gimp_layer_mask_is_attached (GimpItem *item)
static GimpItem *
gimp_layer_mask_duplicate (GimpItem *item,
GType new_type,
gboolean add_alpha)
GType new_type)
{
GimpItem *new_item;
g_return_val_if_fail (g_type_is_a (new_type, GIMP_TYPE_DRAWABLE), NULL);
new_item = GIMP_ITEM_CLASS (parent_class)->duplicate (item, new_type,
add_alpha);
new_item = GIMP_ITEM_CLASS (parent_class)->duplicate (item, new_type);
if (GIMP_IS_LAYER_MASK (new_item))
{
......
......@@ -582,8 +582,7 @@ gimp_selection_save (GimpChannel *selection)
image = gimp_item_get_image (GIMP_ITEM (selection));
new_channel = GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (selection),
GIMP_TYPE_CHANNEL,
FALSE));
GIMP_TYPE_CHANNEL));
/* saved selections are not visible by default */
gimp_item_set_visible (GIMP_ITEM (new_channel), FALSE, FALSE);
......
......@@ -195,7 +195,7 @@ gimp_display_shell_drop_drawable (GtkWidget *widget,
else
new_type = GIMP_TYPE_LAYER;
new_item = gimp_item_convert (GIMP_ITEM (viewable), image, new_type, TRUE);
new_item = gimp_item_convert (GIMP_ITEM (viewable), image, new_type);
if (new_item)
{
......@@ -243,8 +243,8 @@ gimp_display_shell_drop_vectors (GtkWidget *widget,
if (image->gimp->busy)
return;
new_item = gimp_item_convert (GIMP_ITEM (viewable), image,
G_TYPE_FROM_INSTANCE (viewable), TRUE);
new_item = gimp_item_convert (GIMP_ITEM (viewable),
image, G_TYPE_FROM_INSTANCE (viewable));
if (new_item)
{
......@@ -472,9 +472,8 @@ gimp_display_shell_drop_component (GtkWidget *widget,
channel = gimp_channel_new_from_component (image, component, NULL, NULL);
new_item = gimp_item_convert (GIMP_ITEM (channel), dest_image,
GIMP_TYPE_LAYER, TRUE);
new_item = gimp_item_convert (GIMP_ITEM (channel),
dest_image, GIMP_TYPE_LAYER);
g_object_unref (channel);
if (new_item)
......
......@@ -571,8 +571,7 @@ file_open_convert_items (GimpImage *dest_image,
GimpItem *src = list->data;
GimpItem *item;
item = gimp_item_convert (src, dest_image,
G_TYPE_FROM_INSTANCE (src), TRUE);
item = gimp_item_convert (src, dest_image, G_TYPE_FROM_INSTANCE (src));
if (g_list_length (items) == 1)
{
......
......@@ -140,7 +140,7 @@ channel_copy_invoker (GimpProcedure *procedure,
if (success)
{
channel_copy = GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (channel),
G_TYPE_FROM_INSTANCE (channel), FALSE));
G_TYPE_FROM_INSTANCE (channel)));
if (! channel_copy)
success = FALSE;
......
......@@ -115,9 +115,9 @@ layer_new_from_drawable_invoker (GimpProcedure *procedure,
new_type = GIMP_TYPE_LAYER;
if (dest_image == gimp_item_get_image (GIMP_ITEM (drawable)))
new_item = gimp_item_duplicate (GIMP_ITEM (drawable), new_type, TRUE);
new_item = gimp_item_duplicate (GIMP_ITEM (drawable), new_type);
else
new_item = gimp_item_convert (GIMP_ITEM (drawable), dest_image, new_type, TRUE);
new_item = gimp_item_convert (GIMP_ITEM (drawable), dest_image, new_type);
if (new_item)
layer_copy = GIMP_LAYER (new_item);
......@@ -153,10 +153,16 @@ layer_copy_invoker (GimpProcedure *procedure,
if (success)
{
layer_copy = GIMP_LAYER (gimp_item_duplicate (GIMP_ITEM (layer),
G_TYPE_FROM_INSTANCE (layer),
add_alpha));
if (! layer_copy)
success = FALSE;
G_TYPE_FROM_INSTANCE (layer)));
if (layer_copy)
{
if (add_alpha)
gimp_layer_add_alpha (layer_copy);
}
else
{
success = FALSE;
}
}
return_vals = gimp_procedure_get_return_values (procedure, success);
......
......@@ -75,8 +75,7 @@ static gint64 gimp_text_layer_get_memsize (GimpObject *object,
gint64 *gui_size);
static GimpItem * gimp_text_layer_duplicate (GimpItem *item,
GType new_type,
gboolean add_alpha);
GType new_type);
static gboolean gimp_text_layer_rename (GimpItem *item,
const gchar *new_name,
const gchar *undo_desc,
......@@ -239,16 +238,13 @@ gimp_text_layer_get_memsize (GimpObject *object,
static GimpItem *
gimp_text_layer_duplicate (GimpItem *item,
GType new_type,
gboolean add_alpha)
GType new_type)
{
GimpItem *new_item;
g_return_val_if_fail (g_type_is_a (new_type, GIMP_TYPE_DRAWABLE), NULL);
new_item = GIMP_ITEM_CLASS (parent_class)->duplicate (item,
new_type,
add_alpha);
new_item = GIMP_ITEM_CLASS (parent_class)->duplicate (item, new_type);
if (GIMP_IS_TEXT_LAYER (new_item))
{
......
......@@ -65,8 +65,7 @@ static gint64 gimp_vectors_get_memsize (GimpObject *object,
static gboolean gimp_vectors_is_attached (GimpItem *item);
static GimpItem * gimp_vectors_duplicate (GimpItem *item,
GType new_type,
gboolean add_alpha);
GType new_type);
static void gimp_vectors_convert (GimpItem *item,
GimpImage *dest_image);
static void gimp_vectors_translate (GimpItem *item,
......@@ -271,15 +270,13 @@ gimp_vectors_is_attached (GimpItem *item)
static GimpItem *
gimp_vectors_duplicate (GimpItem *item,
GType new_type,
gboolean add_alpha)
GType new_type)
{
GimpItem *new_item;
g_return_val_if_fail (g_type_is_a (new_type, GIMP_TYPE_VECTORS), NULL);
new_item = GIMP_ITEM_CLASS (parent_class)->duplicate (item, new_type,
add_alpha);
new_item = GIMP_ITEM_CLASS (parent_class)->duplicate (item, new_type);
if (GIMP_IS_VECTORS (new_item))
{
......
......@@ -84,8 +84,7 @@ gimp_vectors_mod_undo_constructor (GType type,
vectors_mod_undo->vectors =
GIMP_VECTORS (gimp_item_duplicate (GIMP_ITEM (vectors),
G_TYPE_FROM_INSTANCE (vectors),
FALSE));
G_TYPE_FROM_INSTANCE (vectors)));
return object;
}
......@@ -119,8 +118,7 @@ gimp_vectors_mod_undo_pop (GimpUndo *undo,
vectors_mod_undo->vectors =
GIMP_VECTORS (gimp_item_duplicate (GIMP_ITEM (vectors),
G_TYPE_FROM_INSTANCE (vectors),
FALSE));
G_TYPE_FROM_INSTANCE (vectors)));
gimp_vectors_freeze (vectors);
......
......@@ -207,7 +207,7 @@ gimp_channel_tree_view_drop_viewable (GimpContainerTreeView *tree_view,
new_item = gimp_item_convert (GIMP_ITEM (src_viewable),
item_view->image,
item_view_class->item_type, FALSE);
item_view_class->item_type);
gimp_item_set_linked (new_item, FALSE, FALSE);
......
......@@ -736,7 +736,7 @@ gimp_item_tree_view_drop_viewable (GimpContainerTreeView *tree_view,
dest_index++;
new_item = gimp_item_convert (GIMP_ITEM (src_viewable),
item_view->image, item_type, TRUE);
item_view->image, item_type);
gimp_item_set_linked (new_item, FALSE, FALSE);
......
......@@ -764,7 +764,7 @@ gimp_layer_tree_view_drop_component (GimpContainerTreeView *tree_view,
channel = gimp_channel_new_from_component (src_image, component, NULL, NULL);
new_item = gimp_item_convert (GIMP_ITEM (channel), item_view->image,
GIMP_TYPE_LAYER, TRUE);
GIMP_TYPE_LAYER);
g_object_unref (channel);
......
......@@ -212,8 +212,8 @@ gimp_toolbox_drop_drawable (GtkWidget *widget,
else
new_type = GIMP_TYPE_LAYER;
new_layer = GIMP_LAYER (gimp_item_convert (GIMP_ITEM (drawable), new_image,
new_type, FALSE));
new_layer = GIMP_LAYER (gimp_item_convert (GIMP_ITEM (drawable),
new_image, new_type));
gimp_object_set_name (GIMP_OBJECT (new_layer),
gimp_object_get_name (GIMP_OBJECT (drawable)));
......@@ -303,9 +303,8 @@ gimp_toolbox_drop_component (GtkWidget *widget,
channel = gimp_channel_new_from_component (image, component, NULL, NULL);
new_layer = GIMP_LAYER (gimp_item_convert (GIMP_ITEM (channel), new_image,
GIMP_TYPE_LAYER, FALSE));
new_layer = GIMP_LAYER (gimp_item_convert (GIMP_ITEM (channel),
new_image, GIMP_TYPE_LAYER));
g_object_unref (channel);
gimp_enum_get_value (GIMP_TYPE_CHANNEL_TYPE, component,
......
......@@ -90,7 +90,7 @@ HELP
code => <<'CODE'
{
channel_copy = GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (channel),
G_TYPE_FROM_INSTANCE (channel), FALSE));
G_TYPE_FROM_INSTANCE (channel)));
if (! channel_copy)
success = FALSE;
......
......@@ -94,10 +94,16 @@ HELP
code => <<'CODE'
{
layer_copy = GIMP_LAYER (gimp_item_duplicate (GIMP_ITEM (layer),
G_TYPE_FROM_INSTANCE (layer),
add_alpha));
if (! layer_copy)
success = FALSE;
G_TYPE_FROM_INSTANCE (layer)));
if (layer_copy)
{
if (add_alpha)
gimp_layer_add_alpha (layer_copy);
}
else
{
success = FALSE;
}
}
CODE
);
......@@ -588,9 +594,9 @@ HELP
new_type = GIMP_TYPE_LAYER;
if (dest_image == gimp_item_get_image (GIMP_ITEM (drawable)))
new_item = gimp_item_duplicate (GIMP_ITEM (drawable), new_type, TRUE);
new_item = gimp_item_duplicate (GIMP_ITEM (drawable), new_type);
else
new_item = gimp_item_convert (GIMP_ITEM (drawable), dest_image, new_type, TRUE);
new_item = gimp_item_convert (GIMP_ITEM (drawable), dest_image, new_type);
if (new_item)
layer_copy = GIMP_LAYER (new_item);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment