tools/pdbgen/pdb/channel.pdb tools/pdbgen/pdb/display.pdb

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

	* tools/pdbgen/pdb/channel.pdb
	* tools/pdbgen/pdb/display.pdb
	* tools/pdbgen/pdb/drawable.pdb
	* tools/pdbgen/pdb/image.pdb: don't use "alias"es just to rename
	variables, they just clutter the code and there is no reason why
	e.g. a GimpDisplay variable must be called "gdisp" instead of
	"display". Cleanup.

	* app/pdb/channel_cmds.c
	* app/pdb/display_cmds.c
	* app/pdb/drawable_cmds.c
	* app/pdb/image_cmds.c: regenerated.
This commit is contained in:
Michael Natterer 2003-12-08 12:28:29 +00:00 committed by Michael Natterer
parent 95c13dad93
commit ad5e1cd055
9 changed files with 106 additions and 75 deletions

View file

@ -1,3 +1,18 @@
2003-12-08 Michael Natterer <mitch@gimp.org>
* tools/pdbgen/pdb/channel.pdb
* tools/pdbgen/pdb/display.pdb
* tools/pdbgen/pdb/drawable.pdb
* tools/pdbgen/pdb/image.pdb: don't use "alias"es just to rename
variables, they just clutter the code and there is no reason why
e.g. a GimpDisplay variable must be called "gdisp" instead of
"display". Cleanup.
* app/pdb/channel_cmds.c
* app/pdb/display_cmds.c
* app/pdb/drawable_cmds.c
* app/pdb/image_cmds.c: regenerated.
2003-12-08 Michael Natterer <mitch@gimp.org>
* tools/pdbgen/pdb/brushes.pdb

View file

@ -177,19 +177,23 @@ channel_copy_invoker (Gimp *gimp,
gboolean success = TRUE;
Argument *return_args;
GimpChannel *channel;
GimpChannel *copy = NULL;
GimpChannel *channel_copy = NULL;
channel = (GimpChannel *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! GIMP_IS_CHANNEL (channel))
success = FALSE;
if (success)
success = (copy = GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (channel), G_TYPE_FROM_INSTANCE (channel), FALSE))) != NULL;
{
channel_copy = GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (channel),
G_TYPE_FROM_INSTANCE (channel), FALSE));
success = (channel_copy != NULL);
}
return_args = procedural_db_return_args (&channel_copy_proc, success);
if (success)
return_args[1].value.pdb_int = gimp_item_get_ID (GIMP_ITEM (copy));
return_args[1].value.pdb_int = gimp_item_get_ID (GIMP_ITEM (channel_copy));
return return_args;
}

View file

@ -56,7 +56,7 @@ display_new_invoker (Gimp *gimp,
gboolean success = TRUE;
Argument *return_args;
GimpImage *gimage;
GimpDisplay *gdisp = NULL;
GimpDisplay *display = NULL;
gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int);
if (! GIMP_IS_IMAGE (gimage))
@ -64,9 +64,9 @@ display_new_invoker (Gimp *gimp,
if (success)
{
gdisp = (GimpDisplay *) gimp_create_display (gimp, gimage, 0x0101);
display = (GimpDisplay *) gimp_create_display (gimp, gimage, 0x0101);
success = (gdisp != NULL);
success = (display != NULL);
/* the first display takes ownership of the image */
if (success && gimage->disp_count == 1)
@ -76,7 +76,7 @@ display_new_invoker (Gimp *gimp,
return_args = procedural_db_return_args (&display_new_proc, success);
if (success)
return_args[1].value.pdb_int = gimp_display_get_ID (gdisp);
return_args[1].value.pdb_int = gimp_display_get_ID (display);
return return_args;
}
@ -120,14 +120,14 @@ display_delete_invoker (Gimp *gimp,
Argument *args)
{
gboolean success = TRUE;
GimpDisplay *gdisp;
GimpDisplay *display;
gdisp = gimp_display_get_by_ID (gimp, args[0].value.pdb_int);
if (! GIMP_IS_DISPLAY (gdisp))
display = gimp_display_get_by_ID (gimp, args[0].value.pdb_int);
if (! GIMP_IS_DISPLAY (display))
success = FALSE;
if (success)
gimp_display_delete (gdisp);
gimp_display_delete (display);
return procedural_db_return_args (&display_delete_proc, success);
}
@ -186,19 +186,19 @@ displays_reconnect_invoker (Gimp *gimp,
Argument *args)
{
gboolean success = TRUE;
GimpImage *gimage_old;
GimpImage *gimage_new;
GimpImage *old_image;
GimpImage *new_image;
gimage_old = gimp_image_get_by_ID (gimp, args[0].value.pdb_int);
if (! GIMP_IS_IMAGE (gimage_old))
old_image = gimp_image_get_by_ID (gimp, args[0].value.pdb_int);
if (! GIMP_IS_IMAGE (old_image))
success = FALSE;
gimage_new = gimp_image_get_by_ID (gimp, args[1].value.pdb_int);
if (! GIMP_IS_IMAGE (gimage_new))
new_image = gimp_image_get_by_ID (gimp, args[1].value.pdb_int);
if (! GIMP_IS_IMAGE (new_image))
success = FALSE;
if (success)
gimp_displays_reconnect (gimp, gimage_old, gimage_new);
gimp_displays_reconnect (gimp, old_image, new_image);
return procedural_db_return_args (&displays_reconnect_proc, success);
}

View file

@ -207,7 +207,7 @@ image_list_invoker (Gimp *gimp,
gint32 num_images = 0;
gint32 *image_ids = NULL;
GList *list = NULL;
int i;
gint i;
gimp_container_foreach (gimp->images, gimlist_cb, &list);
num_images = g_list_length (list);
@ -266,7 +266,7 @@ image_new_invoker (Gimp *gimp,
gint32 width;
gint32 height;
gint32 type;
GimpImage *gimage = NULL;
GimpImage *image = NULL;
width = args[0].value.pdb_int;
if (width <= 0)
@ -281,12 +281,15 @@ image_new_invoker (Gimp *gimp,
success = FALSE;
if (success)
success = (gimage = gimp_create_image (gimp, width, height, type, FALSE)) != NULL;
{
image = gimp_create_image (gimp, width, height, type, FALSE);
success = (image != NULL);
}
return_args = procedural_db_return_args (&image_new_proc, success);
if (success)
return_args[1].value.pdb_int = gimp_image_get_ID (gimage);
return_args[1].value.pdb_int = gimp_image_get_ID (image);
return return_args;
}
@ -783,7 +786,7 @@ image_get_layers_invoker (Gimp *gimp,
gint32 num_layers = 0;
gint32 *layer_ids = NULL;
GList *list = NULL;
int i;
gint i;
gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int);
if (! GIMP_IS_IMAGE (gimage))
@ -862,7 +865,7 @@ image_get_channels_invoker (Gimp *gimp,
gint32 num_channels = 0;
gint32 *channel_ids = NULL;
GList *list = NULL;
int i;
gint i;
gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int);
if (! GIMP_IS_IMAGE (gimage))
@ -2397,6 +2400,7 @@ image_thumbnail_invoker (Gimp *gimp,
width = buf->width;
height = buf->height;
bpp = buf->bytes;
temp_buf_free (buf);
}
}
@ -2598,19 +2602,19 @@ image_duplicate_invoker (Gimp *gimp,
gboolean success = TRUE;
Argument *return_args;
GimpImage *gimage;
GimpImage *new_gimage = NULL;
GimpImage *new_image = NULL;
gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int);
if (! GIMP_IS_IMAGE (gimage))
success = FALSE;
if (success)
success = (new_gimage = gimp_image_duplicate (gimage)) != NULL;
success = (new_image = gimp_image_duplicate (gimage)) != NULL;
return_args = procedural_db_return_args (&image_duplicate_proc, success);
if (success)
return_args[1].value.pdb_int = gimp_image_get_ID (new_gimage);
return_args[1].value.pdb_int = gimp_image_get_ID (new_image);
return return_args;
}

View file

@ -193,10 +193,18 @@ HELP
@outargs = (
{ name => 'channel_copy', type => 'channel', init => 1,
desc => 'The newly copied channel', alias => 'copy' }
desc => 'The newly copied channel' }
);
%invoke = ( code => 'success = (copy = GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (channel), G_TYPE_FROM_INSTANCE (channel), FALSE))) != NULL;' );
%invoke = (
code => <<'CODE'
{
channel_copy = GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (channel),
G_TYPE_FROM_INSTANCE (channel), FALSE));
success = (channel_copy != NULL);
}
CODE
);
}
sub channel_combine_masks {

View file

@ -36,15 +36,15 @@ HELP
@outargs = (
{ name => 'display', type => 'display',
desc => 'The new display', alias => 'gdisp', init => 1 }
desc => 'The new display', init => 1 }
);
%invoke = (
code => <<'CODE'
{
gdisp = (GimpDisplay *) gimp_create_display (gimp, gimage, 0x0101);
display = (GimpDisplay *) gimp_create_display (gimp, gimage, 0x0101);
success = (gdisp != NULL);
success = (display != NULL);
/* the first display takes ownership of the image */
if (success && gimage->disp_count == 1)
@ -66,10 +66,10 @@ HELP
@inargs = (
{ name => 'display', type => 'display',
desc => 'The display to delete', alias => 'gdisp' }
desc => 'The display to delete' }
);
%invoke = ( code => 'gimp_display_delete (gdisp);' );
%invoke = ( code => 'gimp_display_delete (display);' );
}
sub displays_flush {
@ -104,14 +104,12 @@ HELP
@inargs = (
{ name => 'old_image', type => 'image',
desc => 'The old image (should have at least one display)',
alias => 'gimage_old' },
desc => 'The old image (should have at least one display)' },
{ name => 'new_image', type => 'image',
desc => 'The new image (must not have a display)',
alias => 'gimage_new' }
desc => 'The new image (must not have a display)' }
);
%invoke = ( code => 'gimp_displays_reconnect (gimp, gimage_old, gimage_new);' );
%invoke = ( code => 'gimp_displays_reconnect (gimp, old_image, new_image);' );
}
@headers = qw("core/gimp.h" "display/display-types.h" "display/gimpdisplay.h"

View file

@ -57,7 +57,7 @@ HELP
);
%invoke = (
vars => [ 'GList *list = NULL', 'int i' ],
vars => [ 'GList *list = NULL', 'gint i' ],
code => <<CODE
{
list = GIMP_LIST (gimage->${type}s)->list;
@ -256,13 +256,16 @@ HELP
}
@outargs = (
{ name => 'image', type => 'image', alias => 'gimage', init => 1,
{ name => 'image', type => 'image', init => 1,
desc => 'The ID of the newly created image' }
);
%invoke = (
code => <<'CODE'
success = (gimage = gimp_create_image (gimp, width, height, type, FALSE)) != NULL;
{
image = gimp_create_image (gimp, width, height, type, FALSE);
success = (image != NULL);
}
CODE
);
}
@ -1349,6 +1352,7 @@ HELP
width = buf->width;
height = buf->height;
bpp = buf->bytes;
temp_buf_free (buf);
}
}
@ -1406,8 +1410,7 @@ HELP
@inargs = (
&std_image_arg,
{ name => 'tattoo', type => 'int32',
desc => 'The new tattoo state of the image'
}
desc => 'The new tattoo state of the image' }
);
%invoke = (
@ -1434,14 +1437,13 @@ HELP
@outargs = (
{ name => 'new_image', type => 'image',
desc => 'The new, duplicated image',
alias => 'new_gimage', init => 1 }
desc => 'The new, duplicated image', init => 1 }
);
%invoke = (
headers => [ qw("core/gimpimage-duplicate.h") ],
code => <<'CODE'
success = (new_gimage = gimp_image_duplicate (gimage)) != NULL;
success = (new_image = gimp_image_duplicate (gimage)) != NULL;
CODE
);
}