tools/pdbgen/pdb/channel.pdb removed gimp_layer_delete() and

2003-12-03  Michael Natterer  <mitch@gimp.org>

	* tools/pdbgen/pdb/channel.pdb
	* tools/pdbgen/pdb/layer.pdb: removed gimp_layer_delete() and
	gimp_channel_delete() PDB wrappers...

	* tools/pdbgen/pdb/drawable.pdb: ...added gimp_drawable_delete().

	* libgimp/gimpdrawable.[ch]: removed gimp_drawable_delete()
	(having this function work on the GimpDrawable wrapper and not on
	the drawable_id was more than questionable anyway).

	* libgimp/gimpcompat.h: added gimp_layer_delete and
	gimp_channel_delete cruft #defines.

	* app/pdb/channel_cmds.c
	* app/pdb/drawable_cmds.c
	* app/pdb/internal_procs.c
	* app/pdb/layer_cmds.c
	* libgimp/gimpchannel_pdb.[ch]
	* libgimp/gimpdrawable_pdb.[ch]
	* libgimp/gimplayer_pdb.[ch]: regenerated.

	* plug-ins/script-fu/scripts/add-bevel.scm
	* plug-ins/xjt/xjt.c: changed accordingly.

	* plug-ins/imagemap/imap_main.c: just removed the call to
	gimp_channel_delete(), it was wrong anyway.

2003-12-03  Michael Natterer  <mitch@gimp.org>

	* libgimp/libgimp-sections.txt
	* libgimp/tmpl/gimpchannel.sgml
	* libgimp/tmpl/gimpdrawable.sgml
	* libgimp/tmpl/gimplayer.sgml: updated again.
This commit is contained in:
Michael Natterer 2003-12-03 17:47:15 +00:00 committed by Michael Natterer
parent ce07d9eaa4
commit f2e227e211
25 changed files with 245 additions and 345 deletions

View File

@ -1,3 +1,32 @@
2003-12-03 Michael Natterer <mitch@gimp.org>
* tools/pdbgen/pdb/channel.pdb
* tools/pdbgen/pdb/layer.pdb: removed gimp_layer_delete() and
gimp_channel_delete() PDB wrappers...
* tools/pdbgen/pdb/drawable.pdb: ...added gimp_drawable_delete().
* libgimp/gimpdrawable.[ch]: removed gimp_drawable_delete()
(having this function work on the GimpDrawable wrapper and not on
the drawable_id was more than questionable anyway).
* libgimp/gimpcompat.h: added gimp_layer_delete and
gimp_channel_delete cruft #defines.
* app/pdb/channel_cmds.c
* app/pdb/drawable_cmds.c
* app/pdb/internal_procs.c
* app/pdb/layer_cmds.c
* libgimp/gimpchannel_pdb.[ch]
* libgimp/gimpdrawable_pdb.[ch]
* libgimp/gimplayer_pdb.[ch]: regenerated.
* plug-ins/script-fu/scripts/add-bevel.scm
* plug-ins/xjt/xjt.c: changed accordingly.
* plug-ins/imagemap/imap_main.c: just removed the call to
gimp_channel_delete(), it was wrong anyway.
2003-12-03 Manish Singh <yosh@gimp.org>
* plug-ins/pygimp/pygimp-drawable.c

View File

@ -36,7 +36,6 @@
static ProcRecord channel_new_proc;
static ProcRecord channel_copy_proc;
static ProcRecord channel_delete_proc;
static ProcRecord channel_combine_masks_proc;
static ProcRecord channel_get_show_masked_proc;
static ProcRecord channel_set_show_masked_proc;
@ -50,7 +49,6 @@ register_channel_procs (Gimp *gimp)
{
procedural_db_register (gimp, &channel_new_proc);
procedural_db_register (gimp, &channel_copy_proc);
procedural_db_register (gimp, &channel_delete_proc);
procedural_db_register (gimp, &channel_combine_masks_proc);
procedural_db_register (gimp, &channel_get_show_masked_proc);
procedural_db_register (gimp, &channel_set_show_masked_proc);
@ -230,55 +228,6 @@ static ProcRecord channel_copy_proc =
{ { channel_copy_invoker } }
};
static Argument *
channel_delete_invoker (Gimp *gimp,
Argument *args)
{
gboolean success = TRUE;
GimpChannel *channel;
channel = (GimpChannel *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! GIMP_IS_CHANNEL (channel))
success = FALSE;
if (success)
{
if (! gimp_item_get_image (GIMP_ITEM (channel)))
{
g_object_unref (channel);
success = TRUE;
}
}
return procedural_db_return_args (&channel_delete_proc, success);
}
static ProcArg channel_delete_inargs[] =
{
{
GIMP_PDB_CHANNEL,
"channel",
"The channel to delete"
}
};
static ProcRecord channel_delete_proc =
{
"gimp_channel_delete",
"Delete a channel.",
"This procedure deletes the specified channel. This must not be done if the gimage containing this channel was already deleted or if the channel was already removed from the image. The only case in which this procedure is useful is if you want to get rid of a channel which has not yet been added to an image.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
GIMP_INTERNAL,
1,
channel_delete_inargs,
0,
NULL,
{ { channel_delete_invoker } }
};
static Argument *
channel_combine_masks_invoker (Gimp *gimp,
Argument *args)

View File

@ -70,6 +70,7 @@ static ProcRecord drawable_set_pixel_proc;
static ProcRecord drawable_set_image_proc;
static ProcRecord drawable_thumbnail_proc;
static ProcRecord drawable_offset_proc;
static ProcRecord drawable_delete_proc;
void
register_drawable_procs (Gimp *gimp)
@ -103,6 +104,7 @@ register_drawable_procs (Gimp *gimp)
procedural_db_register (gimp, &drawable_set_image_proc);
procedural_db_register (gimp, &drawable_thumbnail_proc);
procedural_db_register (gimp, &drawable_offset_proc);
procedural_db_register (gimp, &drawable_delete_proc);
}
static Argument *
@ -1944,3 +1946,50 @@ static ProcRecord drawable_offset_proc =
NULL,
{ { drawable_offset_invoker } }
};
static Argument *
drawable_delete_invoker (Gimp *gimp,
Argument *args)
{
gboolean success = TRUE;
GimpDrawable *drawable;
drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! GIMP_IS_DRAWABLE (drawable))
success = FALSE;
if (success)
{
if (! gimp_item_get_image (GIMP_ITEM (drawable)))
g_object_unref (drawable);
else
success = FALSE;
}
return procedural_db_return_args (&drawable_delete_proc, success);
}
static ProcArg drawable_delete_inargs[] =
{
{
GIMP_PDB_DRAWABLE,
"drawable",
"The drawable to delete"
}
};
static ProcRecord drawable_delete_proc =
{
"gimp_drawable_delete",
"Delete a drawable.",
"This procedure deletes the specified drawable. This must not be done if the gimage containing this drawable was already deleted or if the drawable was already removed from the image. The only case in which this procedure is useful is if you want to get rid of a drawable which has not yet been added to an image.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
GIMP_INTERNAL,
1,
drawable_delete_inargs,
0,
NULL,
{ { drawable_delete_invoker } }
};

View File

@ -69,7 +69,7 @@ void register_transform_tools_procs (Gimp *gimp);
void register_undo_procs (Gimp *gimp);
void register_unit_procs (Gimp *gimp);
/* 345 procedures registered total */
/* 344 procedures registered total */
void
internal_procs_init (Gimp *gimp,
@ -87,94 +87,94 @@ internal_procs_init (Gimp *gimp,
(* status_callback) (NULL, _("Channel"), 0.041);
register_channel_procs (gimp);
(* status_callback) (NULL, _("Color"), 0.07);
(* status_callback) (NULL, _("Color"), 0.067);
register_color_procs (gimp);
(* status_callback) (NULL, _("Convert"), 0.107);
(* status_callback) (NULL, _("Convert"), 0.105);
register_convert_procs (gimp);
(* status_callback) (NULL, _("Display procedures"), 0.116);
(* status_callback) (NULL, _("Display procedures"), 0.113);
register_display_procs (gimp);
(* status_callback) (NULL, _("Drawable procedures"), 0.128);
(* status_callback) (NULL, _("Drawable procedures"), 0.125);
register_drawable_procs (gimp);
(* status_callback) (NULL, _("Edit procedures"), 0.212);
register_edit_procs (gimp);
(* status_callback) (NULL, _("File Operations"), 0.229);
(* status_callback) (NULL, _("File Operations"), 0.23);
register_fileops_procs (gimp);
(* status_callback) (NULL, _("Floating selections"), 0.252);
(* status_callback) (NULL, _("Floating selections"), 0.253);
register_floating_sel_procs (gimp);
(* status_callback) (NULL, _("Font UI"), 0.27);
register_font_select_procs (gimp);
(* status_callback) (NULL, _("Fonts"), 0.278);
(* status_callback) (NULL, _("Fonts"), 0.279);
register_fonts_procs (gimp);
(* status_callback) (NULL, _("Gimprc procedures"), 0.284);
(* status_callback) (NULL, _("Gimprc procedures"), 0.285);
register_gimprc_procs (gimp);
(* status_callback) (NULL, _("Gradient UI"), 0.301);
(* status_callback) (NULL, _("Gradient UI"), 0.302);
register_gradient_select_procs (gimp);
(* status_callback) (NULL, _("Gradients"), 0.31);
(* status_callback) (NULL, _("Gradients"), 0.311);
register_gradients_procs (gimp);
(* status_callback) (NULL, _("Guide procedures"), 0.33);
(* status_callback) (NULL, _("Guide procedures"), 0.331);
register_guides_procs (gimp);
(* status_callback) (NULL, _("Help procedures"), 0.348);
(* status_callback) (NULL, _("Help procedures"), 0.349);
register_help_procs (gimp);
(* status_callback) (NULL, _("Image"), 0.351);
(* status_callback) (NULL, _("Image"), 0.352);
register_image_procs (gimp);
(* status_callback) (NULL, _("Layer"), 0.536);
(* status_callback) (NULL, _("Layer"), 0.538);
register_layer_procs (gimp);
(* status_callback) (NULL, _("Message procedures"), 0.614);
(* status_callback) (NULL, _("Message procedures"), 0.613);
register_message_procs (gimp);
(* status_callback) (NULL, _("Miscellaneous"), 0.623);
(* status_callback) (NULL, _("Miscellaneous"), 0.622);
register_misc_procs (gimp);
(* status_callback) (NULL, _("Misc Tool procedures"), 0.629);
(* status_callback) (NULL, _("Misc Tool procedures"), 0.628);
register_misc_tools_procs (gimp);
(* status_callback) (NULL, _("Paint Tool procedures"), 0.638);
(* status_callback) (NULL, _("Paint Tool procedures"), 0.637);
register_paint_tools_procs (gimp);
(* status_callback) (NULL, _("Palette"), 0.681);
(* status_callback) (NULL, _("Palette"), 0.68);
register_palette_procs (gimp);
(* status_callback) (NULL, _("Palette UI"), 0.699);
(* status_callback) (NULL, _("Palette UI"), 0.698);
register_palette_select_procs (gimp);
(* status_callback) (NULL, _("Palettes"), 0.707);
(* status_callback) (NULL, _("Palettes"), 0.706);
register_palettes_procs (gimp);
(* status_callback) (NULL, _("Parasite procedures"), 0.722);
(* status_callback) (NULL, _("Parasite procedures"), 0.721);
register_parasite_procs (gimp);
(* status_callback) (NULL, _("Paths"), 0.757);
(* status_callback) (NULL, _("Paths"), 0.756);
register_paths_procs (gimp);
(* status_callback) (NULL, _("Pattern UI"), 0.8);
(* status_callback) (NULL, _("Pattern UI"), 0.799);
register_pattern_select_procs (gimp);
(* status_callback) (NULL, _("Patterns"), 0.809);
(* status_callback) (NULL, _("Patterns"), 0.808);
register_patterns_procs (gimp);
(* status_callback) (NULL, _("Plug-in"), 0.823);
register_plug_in_procs (gimp);
(* status_callback) (NULL, _("Procedural database"), 0.841);
(* status_callback) (NULL, _("Procedural database"), 0.84);
register_procedural_db_procs (gimp);
(* status_callback) (NULL, _("Image mask"), 0.864);
(* status_callback) (NULL, _("Image mask"), 0.863);
register_selection_procs (gimp);
(* status_callback) (NULL, _("Selection Tool procedures"), 0.916);

View File

@ -46,7 +46,6 @@ static ProcRecord layer_create_mask_proc;
static ProcRecord layer_scale_proc;
static ProcRecord layer_resize_proc;
static ProcRecord layer_resize_to_image_size_proc;
static ProcRecord layer_delete_proc;
static ProcRecord layer_translate_proc;
static ProcRecord layer_add_alpha_proc;
static ProcRecord layer_set_offsets_proc;
@ -77,7 +76,6 @@ register_layer_procs (Gimp *gimp)
procedural_db_register (gimp, &layer_scale_proc);
procedural_db_register (gimp, &layer_resize_proc);
procedural_db_register (gimp, &layer_resize_to_image_size_proc);
procedural_db_register (gimp, &layer_delete_proc);
procedural_db_register (gimp, &layer_translate_proc);
procedural_db_register (gimp, &layer_add_alpha_proc);
procedural_db_register (gimp, &layer_set_offsets_proc);
@ -598,53 +596,6 @@ static ProcRecord layer_resize_to_image_size_proc =
{ { layer_resize_to_image_size_invoker } }
};
static Argument *
layer_delete_invoker (Gimp *gimp,
Argument *args)
{
gboolean success = TRUE;
GimpLayer *layer;
layer = (GimpLayer *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! GIMP_IS_LAYER (layer))
success = FALSE;
if (success)
{
if (! gimp_item_get_image (GIMP_ITEM (layer)))
g_object_unref (layer);
else
success = FALSE;
}
return procedural_db_return_args (&layer_delete_proc, success);
}
static ProcArg layer_delete_inargs[] =
{
{
GIMP_PDB_LAYER,
"layer",
"The layer to delete"
}
};
static ProcRecord layer_delete_proc =
{
"gimp_layer_delete",
"Delete a layer.",
"This procedure deletes the specified layer. This must not be done if the gimage containing this layer was already deleted or if the layer was already removed from the image. The only case in which this procedure is useful is if you want to get rid of a layer which has not yet been added to an image.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
GIMP_INTERNAL,
1,
layer_delete_inargs,
0,
NULL,
{ { layer_delete_invoker } }
};
static Argument *
layer_translate_invoker (Gimp *gimp,
Argument *args)

View File

@ -1,3 +1,10 @@
2003-12-03 Michael Natterer <mitch@gimp.org>
* libgimp/libgimp-sections.txt
* libgimp/tmpl/gimpchannel.sgml
* libgimp/tmpl/gimpdrawable.sgml
* libgimp/tmpl/gimplayer.sgml: updated again.
2003-12-03 Michael Natterer <mitch@gimp.org>
* libgimp/libgimp-sections.txt

View File

@ -125,7 +125,6 @@ gimp_brushes_set_popup
<FILE>gimpchannel</FILE>
gimp_channel_new
gimp_channel_copy
gimp_channel_delete
gimp_channel_get_show_masked
gimp_channel_set_show_masked
gimp_channel_get_opacity
@ -391,7 +390,6 @@ gimp_layer_create_mask
gimp_layer_scale
gimp_layer_resize
gimp_layer_resize_to_image_size
gimp_layer_delete
gimp_layer_translate
gimp_layer_add_alpha
gimp_layer_set_offsets

View File

@ -37,15 +37,6 @@ Functions for manipulating channels.
@Returns:
<!-- ##### FUNCTION gimp_channel_delete ##### -->
<para>
</para>
@channel_ID:
@Returns:
<!-- ##### FUNCTION gimp_channel_get_show_masked ##### -->
<para>

View File

@ -59,6 +59,9 @@ Functions to manipulate drawables.
</para>
@drawable_ID:
@Returns:
<!-- # Unused Parameters # -->
@drawable:

View File

@ -83,15 +83,6 @@ Operations on single layers.
@Returns:
<!-- ##### FUNCTION gimp_layer_delete ##### -->
<para>
</para>
@layer_ID:
@Returns:
<!-- ##### FUNCTION gimp_layer_translate ##### -->
<para>

View File

@ -106,39 +106,6 @@ gimp_channel_copy (gint32 channel_ID)
return channel_copy_ID;
}
/**
* gimp_channel_delete:
* @channel_ID: The channel to delete.
*
* Delete a channel.
*
* This procedure deletes the specified channel. This must not be done
* if the gimage containing this channel was already deleted or if the
* channel was already removed from the image. The only case in which
* this procedure is useful is if you want to get rid of a channel
* which has not yet been added to an image.
*
* Returns: TRUE on success.
*/
gboolean
gimp_channel_delete (gint32 channel_ID)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp_channel_delete",
&nreturn_vals,
GIMP_PDB_CHANNEL, channel_ID,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_channel_combine_masks:
* @channel1_ID: The channel1.

View File

@ -36,7 +36,6 @@ gint32 _gimp_channel_new (gint32 image_ID,
gdouble opacity,
const GimpRGB *color);
gint32 gimp_channel_copy (gint32 channel_ID);
gboolean gimp_channel_delete (gint32 channel_ID);
gboolean gimp_channel_combine_masks (gint32 channel1_ID,
gint32 channel2_ID,
GimpChannelOps operation,

View File

@ -44,6 +44,7 @@ G_BEGIN_DECLS
#define gimp_crop gimp_image_crop
#define gimp_channel_delete gimp_drawable_delete
#define gimp_channel_get_name gimp_drawable_get_name
#define gimp_channel_set_name gimp_drawable_set_name
#define gimp_channel_get_visible gimp_drawable_get_visible
@ -51,6 +52,7 @@ G_BEGIN_DECLS
#define gimp_channel_get_tattoo gimp_drawable_get_tattoo
#define gimp_channel_set_tattoo gimp_drawable_set_tattoo
#define gimp_layer_delete gimp_drawable_delete
#define gimp_layer_get_name gimp_drawable_get_name
#define gimp_layer_set_name gimp_drawable_set_name
#define gimp_layer_get_visible gimp_drawable_get_visible

View File

@ -52,10 +52,12 @@ gimp_drawable_detach (GimpDrawable *drawable)
if (drawable)
{
gimp_drawable_flush (drawable);
if (drawable->tiles)
g_free (drawable->tiles);
if (drawable->shadow_tiles)
g_free (drawable->shadow_tiles);
g_free (drawable);
}
}
@ -64,45 +66,33 @@ void
gimp_drawable_flush (GimpDrawable *drawable)
{
GimpTile *tiles;
gint ntiles;
gint i;
gint n_tiles;
gint i;
if (drawable)
{
if (drawable->tiles)
{
tiles = drawable->tiles;
ntiles = drawable->ntile_rows * drawable->ntile_cols;
tiles = drawable->tiles;
n_tiles = drawable->ntile_rows * drawable->ntile_cols;
for (i = 0; i < ntiles; i++)
for (i = 0; i < n_tiles; i++)
if ((tiles[i].ref_count > 0) && tiles[i].dirty)
gimp_tile_flush (&tiles[i]);
}
if (drawable->shadow_tiles)
{
tiles = drawable->shadow_tiles;
ntiles = drawable->ntile_rows * drawable->ntile_cols;
tiles = drawable->shadow_tiles;
n_tiles = drawable->ntile_rows * drawable->ntile_cols;
for (i = 0; i < ntiles; i++)
for (i = 0; i < n_tiles; i++)
if ((tiles[i].ref_count > 0) && tiles[i].dirty)
gimp_tile_flush (&tiles[i]);
}
}
}
void
gimp_drawable_delete (GimpDrawable *drawable)
{
if (drawable)
{
if (gimp_drawable_is_layer (drawable->drawable_id))
gimp_layer_delete (drawable->drawable_id);
else
gimp_channel_delete (drawable->drawable_id);
}
}
GimpTile *
gimp_drawable_get_tile (GimpDrawable *drawable,
gboolean shadow,
@ -110,11 +100,11 @@ gimp_drawable_get_tile (GimpDrawable *drawable,
gint col)
{
GimpTile *tiles;
guint right_tile;
guint bottom_tile;
gint ntiles;
gint tile_num;
gint i, j, k;
guint right_tile;
guint bottom_tile;
gint n_tiles;
gint tile_num;
gint i, j, k;
if (drawable)
{
@ -125,8 +115,8 @@ gimp_drawable_get_tile (GimpDrawable *drawable,
if (!tiles)
{
ntiles = drawable->ntile_rows * drawable->ntile_cols;
tiles = g_new (GimpTile, ntiles);
n_tiles = drawable->ntile_rows * drawable->ntile_cols;
tiles = g_new (GimpTile, n_tiles);
right_tile = drawable->width - ((drawable->ntile_cols - 1) * TILE_WIDTH);
bottom_tile = drawable->height - ((drawable->ntile_rows - 1) * TILE_HEIGHT);
@ -162,6 +152,7 @@ gimp_drawable_get_tile (GimpDrawable *drawable,
}
tile_num = row * drawable->ntile_cols + col;
return &tiles[tile_num];
}

View File

@ -43,29 +43,28 @@ struct _GimpDrawable
};
GimpDrawable * gimp_drawable_get (gint32 drawable_ID);
void gimp_drawable_detach (GimpDrawable *drawable);
void gimp_drawable_flush (GimpDrawable *drawable);
void gimp_drawable_delete (GimpDrawable *drawable);
GimpTile * gimp_drawable_get_tile (GimpDrawable *drawable,
gint shadow,
gint row,
gint col);
GimpTile * gimp_drawable_get_tile2 (GimpDrawable *drawable,
gint shadow,
gint x,
gint y);
GimpDrawable * gimp_drawable_get (gint32 drawable_ID);
void gimp_drawable_detach (GimpDrawable *drawable);
void gimp_drawable_flush (GimpDrawable *drawable);
GimpTile * gimp_drawable_get_tile (GimpDrawable *drawable,
gint shadow,
gint row,
gint col);
GimpTile * gimp_drawable_get_tile2 (GimpDrawable *drawable,
gint shadow,
gint x,
gint y);
guchar * gimp_drawable_get_thumbnail_data (gint32 drawable_ID,
gint *width,
gint *height,
gint *bpp);
guchar * gimp_drawable_get_thumbnail_data (gint32 drawable_ID,
gint *width,
gint *height,
gint *bpp);
void gimp_drawable_attach_new_parasite (gint32 drawable_ID,
const gchar *name,
gint flags,
gint size,
gconstpointer data);
void gimp_drawable_attach_new_parasite (gint32 drawable_ID,
const gchar *name,
gint flags,
gint size,
gconstpointer data);
G_END_DECLS

View File

@ -1073,3 +1073,36 @@ gimp_drawable_offset (gint32 drawable_ID,
return success;
}
/**
* gimp_drawable_delete:
* @drawable_ID: The drawable to delete.
*
* Delete a drawable.
*
* This procedure deletes the specified drawable. This must not be done
* if the gimage containing this drawable was already deleted or if the
* drawable was already removed from the image. The only case in which
* this procedure is useful is if you want to get rid of a drawable
* which has not yet been added to an image.
*
* Returns: TRUE on success.
*/
gboolean
gimp_drawable_delete (gint32 drawable_ID)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp_drawable_delete",
&nreturn_vals,
GIMP_PDB_DRAWABLE, drawable_ID,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}

View File

@ -92,6 +92,7 @@ gboolean gimp_drawable_offset (gint32 drawable_ID,
GimpOffsetType fill_type,
gint offset_x,
gint offset_y);
gboolean gimp_drawable_delete (gint32 drawable_ID);
G_END_DECLS

View File

@ -274,39 +274,6 @@ gimp_layer_resize_to_image_size (gint32 layer_ID)
return success;
}
/**
* gimp_layer_delete:
* @layer_ID: The layer to delete.
*
* Delete a layer.
*
* This procedure deletes the specified layer. This must not be done if
* the gimage containing this layer was already deleted or if the layer
* was already removed from the image. The only case in which this
* procedure is useful is if you want to get rid of a layer which has
* not yet been added to an image.
*
* Returns: TRUE on success.
*/
gboolean
gimp_layer_delete (gint32 layer_ID)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp_layer_delete",
&nreturn_vals,
GIMP_PDB_LAYER, layer_ID,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_layer_translate:
* @layer_ID: The layer.

View File

@ -50,7 +50,6 @@ gboolean gimp_layer_resize (gint32 laye
gint offx,
gint offy);
gboolean gimp_layer_resize_to_image_size (gint32 layer_ID);
gboolean gimp_layer_delete (gint32 layer_ID);
gboolean gimp_layer_translate (gint32 layer_ID,
gint offx,
gint offy);

View File

@ -493,7 +493,6 @@ fuzzy_select_on_button_press (GtkWidget *widget,
/* Restore old selection */
(void) gimp_selection_load(channel_ID);
(void) gimp_image_remove_channel(image_ID, channel_ID);
gimp_channel_delete(channel_ID);
}
return FALSE;
}

View File

@ -188,7 +188,7 @@
(begin
(gimp-image-add-layer image bump-layer 1)
(gimp-drawable-set-visible bump-layer 0))
(gimp-layer-delete bump-layer)
(gimp-drawable-delete bump-layer)
)
(gimp-image-set-active-layer image pic-layer)

View File

@ -3570,24 +3570,25 @@ load_xjt_image (const gchar *filename)
}
/* Handle channel parasites */
p_check_and_add_parasite(l_channel_id,
l_dirname,
l_image_prp_ptr->parasite_props,
l_channel_prp_ptr->channel_pos,
XJT_CHANNEL_PARASITE);
p_check_and_add_parasite (l_channel_id,
l_dirname,
l_image_prp_ptr->parasite_props,
l_channel_prp_ptr->channel_pos,
XJT_CHANNEL_PARASITE);
if(l_channel_prp_ptr->tattoo >= 0)
if (l_channel_prp_ptr->tattoo >= 0)
{
gimp_drawable_set_tattoo(l_channel_id, l_channel_prp_ptr->tattoo);
gimp_drawable_set_tattoo (l_channel_id, l_channel_prp_ptr->tattoo);
}
if(l_channel_prp_ptr->selection)
if (l_channel_prp_ptr->selection)
{
if(xjt_debug) printf("XJT-DEBUG: SELECTION loaded channel id = %d\n", (int)l_channel_id);
if (xjt_debug) printf("XJT-DEBUG: SELECTION loaded channel id = %d\n", (int)l_channel_id);
gimp_selection_load (l_channel_id);
/* delete the channel after load into selection */
gimp_channel_delete (l_channel_id);
gimp_drawable_delete (l_channel_id);
}
else
{
@ -3598,12 +3599,12 @@ load_xjt_image (const gchar *filename)
gimp_drawable_set_visible (l_channel_id, l_channel_prp_ptr->visible);
gimp_channel_set_show_masked (l_channel_id, l_channel_prp_ptr->show_masked);
if(l_channel_prp_ptr->floating_attached)
if (l_channel_prp_ptr->floating_attached)
{
l_fsel_attached_to_id = l_channel_id; /* the floating_selection is attached to this channel */
}
if(l_channel_prp_ptr->active_channel)
if (l_channel_prp_ptr->active_channel)
{
l_active_channel_id = l_channel_id;
}
@ -3613,7 +3614,7 @@ load_xjt_image (const gchar *filename)
/* attach the floating selection... */
if ((l_fsel_id >= 0) && (l_fsel_attached_to_id >= 0))
{
if(xjt_debug) printf("XJT-DEBUG: attaching floating_selection id=%d to id %d\n",
if (xjt_debug) printf("XJT-DEBUG: attaching floating_selection id=%d to id %d\n",
(int)l_fsel_id, (int)l_fsel_attached_to_id);
if (gimp_floating_sel_attach (l_fsel_id, l_fsel_attached_to_id) < 0)
{
@ -3628,36 +3629,39 @@ load_xjt_image (const gchar *filename)
/* set active layer/channel */
if (l_active_channel_id >= 0)
{
if(xjt_debug) printf("SET active channel\n");
if (xjt_debug) printf("SET active channel\n");
gimp_image_set_active_channel (l_image_id, l_active_channel_id);
}
if (l_active_layer_id >= 0)
{
if(xjt_debug) printf("SET active layer\n");
if (xjt_debug) printf("SET active layer\n");
gimp_image_set_active_layer (l_image_id, l_active_layer_id);
}
/* set guides */
for (l_guide_prp_ptr = l_image_prp_ptr->guide_props;
l_guide_prp_ptr != NULL;
l_guide_prp_ptr = (t_guide_props *)l_guide_prp_ptr->next)
l_guide_prp_ptr = (t_guide_props *) l_guide_prp_ptr->next)
{
if (l_guide_prp_ptr->orientation == GIMP_ORIENTATION_HORIZONTAL)
gimp_image_add_hguide(l_image_id, l_guide_prp_ptr->position);
gimp_image_add_hguide (l_image_id, l_guide_prp_ptr->position);
else
gimp_image_add_vguide(l_image_id, l_guide_prp_ptr->position);
gimp_image_add_vguide (l_image_id, l_guide_prp_ptr->position);
}
/* create paths */
if (l_image_prp_ptr->path_props)
{
p_add_paths(l_image_id, l_image_prp_ptr->path_props);
p_add_paths (l_image_id, l_image_prp_ptr->path_props);
}
/* set tattoo_state */
if (l_image_prp_ptr->tattoo_state > 0)
{
gimp_image_set_tattoo_state(l_image_id, l_image_prp_ptr->tattoo_state);
gimp_image_set_tattoo_state (l_image_id, l_image_prp_ptr->tattoo_state);
}
cleanup:
@ -3682,4 +3686,4 @@ load_xjt_image (const gchar *filename)
/* destroy the tmp image */
gimp_image_delete (l_image_id);
return -1;
} /* end load_xjt_image */
}

View File

@ -199,34 +199,6 @@ HELP
%invoke = ( code => 'success = (copy = GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (channel), G_TYPE_FROM_INSTANCE (channel), FALSE))) != NULL;' );
}
sub channel_delete {
$blurb = 'Delete a channel.';
$help = <<'HELP';
This procedure deletes the specified channel. This must not be done if the
gimage containing this channel was already deleted or if the channel was
already removed from the image. The only case in which this procedure is
useful is if you want to get rid of a channel which has not yet been
added to an image.
HELP
&std_pdb_misc;
@inargs = ( &channel_arg );
$inargs[0]->{desc} .= ' to delete';
%invoke = ( code => <<'CODE' );
{
if (! gimp_item_get_image (GIMP_ITEM (channel)))
{
g_object_unref (channel);
success = TRUE;
}
}
CODE
}
sub channel_combine_masks {
$blurb = 'Combine two channel masks.';
@ -278,8 +250,7 @@ CODE
&channel_accessors('color', 'color', 'compositing color', 0,
[ '$outargs[0]->{void_ret} = 1', '' ]);
unshift @procs, qw(channel_new channel_copy channel_delete
channel_combine_masks);
unshift @procs, qw(channel_new channel_copy channel_combine_masks);
%exports = (app => [@procs], lib => [@procs]);
$desc = 'Channel';

View File

@ -656,6 +656,32 @@ CODE
);
}
sub drawable_delete {
$blurb = 'Delete a drawable.';
$help = <<'HELP';
This procedure deletes the specified drawable. This must not be done if the
gimage containing this drawable was already deleted or if the drawable was
already removed from the image. The only case in which this procedure is
useful is if you want to get rid of a drawable which has not yet been
added to an image.
HELP
&std_pdb_misc;
@inargs = ( &drawable_arg );
$inargs[0]->{desc} .= ' to delete';
%invoke = ( code => <<'CODE' );
{
if (! gimp_item_get_image (GIMP_ITEM (drawable)))
g_object_unref (drawable);
else
success = FALSE;
}
CODE
}
@headers = qw("core/gimp.h" "core/gimplayer.h" "core/gimplayermask.h"
"core/gimpchannel.h" "core/gimpdrawable.h"
"core/gimpdrawable-offset.h" "base/tile.h" "base/tile-manager.h"
@ -671,7 +697,7 @@ CODE
drawable_get_visible drawable_set_visible
drawable_get_tattoo drawable_set_tattoo
drawable_get_pixel drawable_set_pixel drawable_set_image
drawable_thumbnail drawable_offset);
drawable_thumbnail drawable_offset drawable_delete);
%exports = (app => [@procs], lib => [@procs]);
$desc = 'Drawable procedures';

View File

@ -378,32 +378,6 @@ HELP
CODE
}
sub layer_delete {
$blurb = 'Delete a layer.';
$help = <<'HELP';
This procedure deletes the specified layer. This must not be done if the
gimage containing this layer was already deleted or if the layer was
already removed from the image. The only case in which this procedure is
useful is if you want to get rid of a layer which has not yet been
added to an image.
HELP
&std_pdb_misc;
@inargs = ( &layer_arg );
$inargs[0]->{desc} .= ' to delete';
%invoke = ( code => <<'CODE' );
{
if (! gimp_item_get_image (GIMP_ITEM (layer)))
g_object_unref (layer);
else
success = FALSE;
}
CODE
}
sub layer_translate {
$blurb = 'Translate the layer by the specified offsets.';
@ -629,7 +603,7 @@ CODE
"core/gimpitem-linked.h" "pdb_glue.h" "gimp-intl.h");
unshift @procs, qw(layer_new layer_copy layer_create_mask layer_scale
layer_resize layer_resize_to_image_size layer_delete
layer_resize layer_resize_to_image_size
layer_translate layer_add_alpha layer_set_offsets layer_mask
layer_is_floating_sel layer_new_from_drawable);
%exports = (app => [@procs], lib => [@procs]);