tools/pdbgen/lib.pl added support for deprecated procedures without any

2004-11-19  Michael Natterer  <mitch@gimp.org>

	* tools/pdbgen/lib.pl
	* tools/pdbgen/stddefs.pdb: added support for deprecated procedures
	without any replacement.

	* app/plug-in/plug-in-message.c (plug_in_handle_proc_run): added
	a special warning for procedures without replacement.

	* tools/pdbgen/pdb/drawable.pdb: deprecated drawable_set_image()
	without any replacement and made it a nop (which fails if the
	passed image is different from the drawable's image). It's not
	needed any longer since 2.0 and moreover dangerous to use.

	* app/pdb/drawable_cmds.c
	* libgimp/gimpdrawable_pdb.[ch]: regenerated.

	* app/core/gimpitem.c (gimp_item_set_image): replaced assertion
	for gimp_item_is_floating() by !gimp_item_is_attached(). The
	former warned when adding a layer with already added mask to the
	image (which is a perfectly valid operation).
This commit is contained in:
Michael Natterer 2004-11-19 12:38:34 +00:00 committed by Michael Natterer
parent fb4bfd6e06
commit ebf18dce39
10 changed files with 84 additions and 44 deletions

View File

@ -1,3 +1,25 @@
2004-11-19 Michael Natterer <mitch@gimp.org>
* tools/pdbgen/lib.pl
* tools/pdbgen/stddefs.pdb: added support for deprecated procedures
without any replacement.
* app/plug-in/plug-in-message.c (plug_in_handle_proc_run): added
a special warning for procedures without replacement.
* tools/pdbgen/pdb/drawable.pdb: deprecated drawable_set_image()
without any replacement and made it a nop (which fails if the
passed image is different from the drawable's image). It's not
needed any longer since 2.0 and moreover dangerous to use.
* app/pdb/drawable_cmds.c
* libgimp/gimpdrawable_pdb.[ch]: regenerated.
* app/core/gimpitem.c (gimp_item_set_image): replaced assertion
for gimp_item_is_floating() by !gimp_item_is_attached(). The
former warned when adding a layer with already added mask to the
image (which is a perfectly valid operation).
2004-11-18 Sven Neumann <sven@gimp.org>
* plug-ins/common/wmf.c: added a thumbnail load procedure

View File

@ -1065,8 +1065,8 @@ gimp_item_set_image (GimpItem *item,
GimpImage *gimage)
{
g_return_if_fail (GIMP_IS_ITEM (item));
g_return_if_fail (gimp_item_is_floating (item));
g_return_if_fail (! gimage || GIMP_IS_IMAGE (gimage));
g_return_if_fail (! gimp_item_is_attached (item));
g_return_if_fail (gimage == NULL || GIMP_IS_IMAGE (gimage));
if (gimage == NULL)
{

View File

@ -996,10 +996,7 @@ drawable_set_image_invoker (Gimp *gimp,
if (success)
{
success = gimp_item_is_floating (GIMP_ITEM (drawable));
if (success)
gimp_item_set_image (GIMP_ITEM (drawable), gimage);
success = (gimage == gimp_item_get_image (GIMP_ITEM (drawable)));
}
return procedural_db_return_args (&drawable_set_image_proc, success);
@ -1022,12 +1019,12 @@ static ProcArg drawable_set_image_inargs[] =
static ProcRecord drawable_set_image_proc =
{
"gimp_drawable_set_image",
"Set image where drawable belongs to.",
"Set the image the drawable should be a part of (Use this before adding a drawable to another image).",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL,
"This procedure is deprecated!",
"This procedure is deprecated!",
"",
"",
"",
"NONE",
GIMP_INTERNAL,
2,
drawable_set_image_inargs,

View File

@ -380,12 +380,23 @@ plug_in_handle_proc_run (PlugIn *plug_in,
{
if (plug_in->gimp->pdb_compat_mode == GIMP_PDB_COMPAT_WARN)
{
g_message ("WARNING: Plug-In \"%s\"\n(%s)\n"
"called deprecated procedure '%s'.\n"
"It should call '%s' instead!",
gimp_filename_to_utf8 (plug_in->name),
gimp_filename_to_utf8 (plug_in->prog),
proc_run->name, proc_rec->deprecated);
if (! strcmp (proc_rec->deprecated, "NONE"))
{
g_message ("WARNING: Plug-In \"%s\"\n(%s)\n"
"called deprecated procedure '%s'.",
gimp_filename_to_utf8 (plug_in->name),
gimp_filename_to_utf8 (plug_in->prog),
proc_run->name);
}
else
{
g_message ("WARNING: Plug-In \"%s\"\n(%s)\n"
"called deprecated procedure '%s'.\n"
"It should call '%s' instead!",
gimp_filename_to_utf8 (plug_in->name),
gimp_filename_to_utf8 (plug_in->prog),
proc_run->name, proc_rec->deprecated);
}
}
else if (plug_in->gimp->pdb_compat_mode == GIMP_PDB_COMPAT_OFF)
{

View File

@ -380,12 +380,23 @@ plug_in_handle_proc_run (PlugIn *plug_in,
{
if (plug_in->gimp->pdb_compat_mode == GIMP_PDB_COMPAT_WARN)
{
g_message ("WARNING: Plug-In \"%s\"\n(%s)\n"
"called deprecated procedure '%s'.\n"
"It should call '%s' instead!",
gimp_filename_to_utf8 (plug_in->name),
gimp_filename_to_utf8 (plug_in->prog),
proc_run->name, proc_rec->deprecated);
if (! strcmp (proc_rec->deprecated, "NONE"))
{
g_message ("WARNING: Plug-In \"%s\"\n(%s)\n"
"called deprecated procedure '%s'.",
gimp_filename_to_utf8 (plug_in->name),
gimp_filename_to_utf8 (plug_in->prog),
proc_run->name);
}
else
{
g_message ("WARNING: Plug-In \"%s\"\n(%s)\n"
"called deprecated procedure '%s'.\n"
"It should call '%s' instead!",
gimp_filename_to_utf8 (plug_in->name),
gimp_filename_to_utf8 (plug_in->prog),
proc_run->name, proc_rec->deprecated);
}
}
else if (plug_in->gimp->pdb_compat_mode == GIMP_PDB_COMPAT_OFF)
{

View File

@ -511,10 +511,7 @@ gimp_drawable_get_image (gint32 drawable_ID)
* @drawable_ID: The drawable.
* @image_ID: The image.
*
* Set image where drawable belongs to.
*
* Set the image the drawable should be a part of (Use this before
* adding a drawable to another image).
* This procedure is deprecated!
*
* Returns: TRUE on success.
*/

View File

@ -46,8 +46,10 @@ gboolean gimp_drawable_offsets (gint32 drawable_ID,
gint *offset_x,
gint *offset_y);
gint32 gimp_drawable_get_image (gint32 drawable_ID);
#ifndef GIMP_DISABLE_DEPRECATED
gboolean gimp_drawable_set_image (gint32 drawable_ID,
gint32 image_ID);
#endif /* GIMP_DISABLE_DEPRECATED */
gchar* gimp_drawable_get_name (gint32 drawable_ID);
gboolean gimp_drawable_set_name (gint32 drawable_ID,
const gchar *name);

View File

@ -457,8 +457,13 @@ CODE
}
if ($proc->{deprecated}) {
$procdesc = &desc_wrap("This procedure is deprecated! " .
"Use $proc->{deprecated}() instead.");
if ($proc->{deprecated} eq 'NONE') {
$procdesc = &desc_wrap("This procedure is deprecated!");
}
else {
$procdesc = &desc_wrap("This procedure is deprecated! " .
"Use $proc->{deprecated}() instead.");
}
}
else {
$procdesc = &desc_wrap($proc->{blurb}) . "\n *\n" .

View File

@ -587,14 +587,7 @@ CODE
}
sub drawable_set_image {
$blurb = 'Set image where drawable belongs to.';
$help = <<'HELP';
Set the image the drawable should be a part of (Use this before adding a
drawable to another image).
HELP
&std_pdb_misc;
&std_pdb_deprecated();
@inargs = (
&drawable_arg,
@ -603,10 +596,7 @@ HELP
%invoke = ( code =><<'CODE'
{
success = gimp_item_is_floating (GIMP_ITEM (drawable));
if (success)
gimp_item_set_image (GIMP_ITEM (drawable), gimage);
success = (gimage == gimp_item_get_image (GIMP_ITEM (drawable)));
}
CODE
);

View File

@ -23,9 +23,14 @@ sub std_pdb_misc {
}
sub std_pdb_deprecated {
$blurb = $help = "This procedure is deprecated! Use '@_' instead.";
if (@_) {
$blurb = $help = "This procedure is deprecated! Use '@_' instead.";
$deprecated = "@_";
} else {
$blurb = $help = "This procedure is deprecated!";
$deprecated = "NONE";
}
$author = $copyright = $date = '';
$deprecated = "@_";
}
sub std_image_arg () {{