got rid of all perl utility functions.

2006-03-18  Michael Natterer  <mitch@gimp.org>

	* tools/pdbgen/pdb/drawable.pdb: got rid of all perl utility
	functions.

	* app/pdb/drawable_cmds.c
	* libgimp/gimpdrawable_pdb.c: regenerated.
This commit is contained in:
Michael Natterer 2006-03-18 13:26:38 +00:00 committed by Michael Natterer
parent bc95134436
commit da5100992f
4 changed files with 654 additions and 205 deletions

View file

@ -1,3 +1,11 @@
2006-03-18 Michael Natterer <mitch@gimp.org>
* tools/pdbgen/pdb/drawable.pdb: got rid of all perl utility
functions.
* app/pdb/drawable_cmds.c
* libgimp/gimpdrawable_pdb.c: regenerated.
2006-03-18 Michael Natterer <mitch@gimp.org> 2006-03-18 Michael Natterer <mitch@gimp.org>
* tools/pdbgen/app.pl: removed support for arg->on_success and * tools/pdbgen/app.pl: removed support for arg->on_success and

View file

@ -177,15 +177,21 @@ drawable_is_layer_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
GimpDrawable *drawable; GimpDrawable *drawable;
gboolean layer = FALSE;
drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int); drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable)))) if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
success = FALSE; success = FALSE;
if (success)
{
layer = GIMP_IS_LAYER (drawable);
}
return_args = procedural_db_return_args (&drawable_is_layer_proc, success); return_args = procedural_db_return_args (&drawable_is_layer_proc, success);
if (success) if (success)
return_args[1].value.pdb_int = GIMP_IS_LAYER (drawable) ? TRUE : FALSE; return_args[1].value.pdb_int = layer;
return return_args; return return_args;
} }
@ -235,15 +241,21 @@ drawable_is_layer_mask_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
GimpDrawable *drawable; GimpDrawable *drawable;
gboolean layer_mask = FALSE;
drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int); drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable)))) if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
success = FALSE; success = FALSE;
if (success)
{
layer_mask = GIMP_IS_LAYER_MASK (drawable);
}
return_args = procedural_db_return_args (&drawable_is_layer_mask_proc, success); return_args = procedural_db_return_args (&drawable_is_layer_mask_proc, success);
if (success) if (success)
return_args[1].value.pdb_int = GIMP_IS_LAYER_MASK (drawable) ? TRUE : FALSE; return_args[1].value.pdb_int = layer_mask;
return return_args; return return_args;
} }
@ -293,15 +305,21 @@ drawable_is_channel_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
GimpDrawable *drawable; GimpDrawable *drawable;
gboolean channel = FALSE;
drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int); drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable)))) if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
success = FALSE; success = FALSE;
if (success)
{
channel = GIMP_IS_CHANNEL (drawable);
}
return_args = procedural_db_return_args (&drawable_is_channel_proc, success); return_args = procedural_db_return_args (&drawable_is_channel_proc, success);
if (success) if (success)
return_args[1].value.pdb_int = GIMP_IS_CHANNEL (drawable) ? TRUE : FALSE; return_args[1].value.pdb_int = channel;
return return_args; return return_args;
} }
@ -351,15 +369,21 @@ drawable_type_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
GimpDrawable *drawable; GimpDrawable *drawable;
gint32 type = 0;
drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int); drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable)))) if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
success = FALSE; success = FALSE;
if (success)
{
type = gimp_drawable_type (drawable);
}
return_args = procedural_db_return_args (&drawable_type_proc, success); return_args = procedural_db_return_args (&drawable_type_proc, success);
if (success) if (success)
return_args[1].value.pdb_int = gimp_drawable_type (drawable); return_args[1].value.pdb_int = type;
return return_args; return return_args;
} }
@ -409,15 +433,21 @@ drawable_type_with_alpha_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
GimpDrawable *drawable; GimpDrawable *drawable;
gint32 type_with_alpha = 0;
drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int); drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable)))) if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
success = FALSE; success = FALSE;
if (success)
{
type_with_alpha = gimp_drawable_type_with_alpha (drawable);
}
return_args = procedural_db_return_args (&drawable_type_with_alpha_proc, success); return_args = procedural_db_return_args (&drawable_type_with_alpha_proc, success);
if (success) if (success)
return_args[1].value.pdb_int = gimp_drawable_type_with_alpha (drawable); return_args[1].value.pdb_int = type_with_alpha;
return return_args; return return_args;
} }
@ -467,15 +497,21 @@ drawable_has_alpha_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
GimpDrawable *drawable; GimpDrawable *drawable;
gboolean has_alpha = FALSE;
drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int); drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable)))) if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
success = FALSE; success = FALSE;
if (success)
{
has_alpha = gimp_drawable_has_alpha (drawable);
}
return_args = procedural_db_return_args (&drawable_has_alpha_proc, success); return_args = procedural_db_return_args (&drawable_has_alpha_proc, success);
if (success) if (success)
return_args[1].value.pdb_int = gimp_drawable_has_alpha (drawable); return_args[1].value.pdb_int = has_alpha;
return return_args; return return_args;
} }
@ -525,15 +561,21 @@ drawable_is_rgb_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
GimpDrawable *drawable; GimpDrawable *drawable;
gboolean is_rgb = FALSE;
drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int); drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable)))) if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
success = FALSE; success = FALSE;
if (success)
{
is_rgb = gimp_drawable_is_rgb (drawable);
}
return_args = procedural_db_return_args (&drawable_is_rgb_proc, success); return_args = procedural_db_return_args (&drawable_is_rgb_proc, success);
if (success) if (success)
return_args[1].value.pdb_int = gimp_drawable_is_rgb (drawable); return_args[1].value.pdb_int = is_rgb;
return return_args; return return_args;
} }
@ -583,15 +625,21 @@ drawable_is_gray_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
GimpDrawable *drawable; GimpDrawable *drawable;
gboolean is_gray = FALSE;
drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int); drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable)))) if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
success = FALSE; success = FALSE;
if (success)
{
is_gray = gimp_drawable_is_gray (drawable);
}
return_args = procedural_db_return_args (&drawable_is_gray_proc, success); return_args = procedural_db_return_args (&drawable_is_gray_proc, success);
if (success) if (success)
return_args[1].value.pdb_int = gimp_drawable_is_gray (drawable); return_args[1].value.pdb_int = is_gray;
return return_args; return return_args;
} }
@ -641,15 +689,21 @@ drawable_is_indexed_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
GimpDrawable *drawable; GimpDrawable *drawable;
gboolean is_indexed = FALSE;
drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int); drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable)))) if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
success = FALSE; success = FALSE;
if (success)
{
is_indexed = gimp_drawable_is_indexed (drawable);
}
return_args = procedural_db_return_args (&drawable_is_indexed_proc, success); return_args = procedural_db_return_args (&drawable_is_indexed_proc, success);
if (success) if (success)
return_args[1].value.pdb_int = gimp_drawable_is_indexed (drawable); return_args[1].value.pdb_int = is_indexed;
return return_args; return return_args;
} }
@ -699,15 +753,21 @@ drawable_bpp_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
GimpDrawable *drawable; GimpDrawable *drawable;
gint32 bpp = 0;
drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int); drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable)))) if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
success = FALSE; success = FALSE;
if (success)
{
bpp = gimp_drawable_bytes (drawable);
}
return_args = procedural_db_return_args (&drawable_bpp_proc, success); return_args = procedural_db_return_args (&drawable_bpp_proc, success);
if (success) if (success)
return_args[1].value.pdb_int = gimp_drawable_bytes (drawable); return_args[1].value.pdb_int = bpp;
return return_args; return return_args;
} }
@ -757,15 +817,21 @@ drawable_width_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
GimpDrawable *drawable; GimpDrawable *drawable;
gint32 width = 0;
drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int); drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable)))) if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
success = FALSE; success = FALSE;
if (success)
{
width = gimp_item_width (GIMP_ITEM (drawable));
}
return_args = procedural_db_return_args (&drawable_width_proc, success); return_args = procedural_db_return_args (&drawable_width_proc, success);
if (success) if (success)
return_args[1].value.pdb_int = gimp_item_width (GIMP_ITEM (drawable)); return_args[1].value.pdb_int = width;
return return_args; return return_args;
} }
@ -815,15 +881,21 @@ drawable_height_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
GimpDrawable *drawable; GimpDrawable *drawable;
gint32 height = 0;
drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int); drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable)))) if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
success = FALSE; success = FALSE;
if (success)
{
height = gimp_item_height (GIMP_ITEM (drawable));
}
return_args = procedural_db_return_args (&drawable_height_proc, success); return_args = procedural_db_return_args (&drawable_height_proc, success);
if (success) if (success)
return_args[1].value.pdb_int = gimp_item_height (GIMP_ITEM (drawable)); return_args[1].value.pdb_int = height;
return return_args; return return_args;
} }
@ -881,7 +953,9 @@ drawable_offsets_invoker (Gimp *gimp,
success = FALSE; success = FALSE;
if (success) if (success)
gimp_item_offsets (GIMP_ITEM (drawable), &offset_x, &offset_y); {
gimp_item_offsets (GIMP_ITEM (drawable), &offset_x, &offset_y);
}
return_args = procedural_db_return_args (&drawable_offsets_proc, success); return_args = procedural_db_return_args (&drawable_offsets_proc, success);
@ -1064,15 +1138,21 @@ drawable_get_name_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
GimpDrawable *drawable; GimpDrawable *drawable;
gchar *name = NULL;
drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int); drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable)))) if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
success = FALSE; success = FALSE;
if (success)
{
name = g_strdup (gimp_object_get_name (GIMP_OBJECT (drawable)));
}
return_args = procedural_db_return_args (&drawable_get_name_proc, success); return_args = procedural_db_return_args (&drawable_get_name_proc, success);
if (success) if (success)
return_args[1].value.pdb_pointer = g_strdup (gimp_object_get_name (GIMP_OBJECT (drawable))); return_args[1].value.pdb_pointer = name;
return return_args; return return_args;
} }
@ -1132,7 +1212,9 @@ drawable_set_name_invoker (Gimp *gimp,
success = FALSE; success = FALSE;
if (success) if (success)
success = gimp_item_rename (GIMP_ITEM (drawable), name); {
success = gimp_item_rename (GIMP_ITEM (drawable), name);
}
return procedural_db_return_args (&drawable_set_name_proc, success); return procedural_db_return_args (&drawable_set_name_proc, success);
} }
@ -1178,15 +1260,21 @@ drawable_get_visible_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
GimpDrawable *drawable; GimpDrawable *drawable;
gboolean visible = FALSE;
drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int); drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable)))) if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
success = FALSE; success = FALSE;
if (success)
{
visible = gimp_item_get_visible (GIMP_ITEM (drawable));
}
return_args = procedural_db_return_args (&drawable_get_visible_proc, success); return_args = procedural_db_return_args (&drawable_get_visible_proc, success);
if (success) if (success)
return_args[1].value.pdb_int = gimp_item_get_visible (GIMP_ITEM (drawable)); return_args[1].value.pdb_int = visible;
return return_args; return return_args;
} }
@ -1244,7 +1332,9 @@ drawable_set_visible_invoker (Gimp *gimp,
visible = args[1].value.pdb_int ? TRUE : FALSE; visible = args[1].value.pdb_int ? TRUE : FALSE;
if (success) if (success)
gimp_item_set_visible (GIMP_ITEM (drawable), visible, TRUE); {
gimp_item_set_visible (GIMP_ITEM (drawable), visible, TRUE);
}
return procedural_db_return_args (&drawable_set_visible_proc, success); return procedural_db_return_args (&drawable_set_visible_proc, success);
} }
@ -1290,15 +1380,21 @@ drawable_get_linked_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
GimpDrawable *drawable; GimpDrawable *drawable;
gboolean linked = FALSE;
drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int); drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable)))) if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
success = FALSE; success = FALSE;
if (success)
{
linked = gimp_item_get_linked (GIMP_ITEM (drawable));
}
return_args = procedural_db_return_args (&drawable_get_linked_proc, success); return_args = procedural_db_return_args (&drawable_get_linked_proc, success);
if (success) if (success)
return_args[1].value.pdb_int = gimp_item_get_linked (GIMP_ITEM (drawable)); return_args[1].value.pdb_int = linked;
return return_args; return return_args;
} }
@ -1356,7 +1452,9 @@ drawable_set_linked_invoker (Gimp *gimp,
linked = args[1].value.pdb_int ? TRUE : FALSE; linked = args[1].value.pdb_int ? TRUE : FALSE;
if (success) if (success)
gimp_item_set_linked (GIMP_ITEM (drawable), linked, TRUE); {
gimp_item_set_linked (GIMP_ITEM (drawable), linked, TRUE);
}
return procedural_db_return_args (&drawable_set_linked_proc, success); return procedural_db_return_args (&drawable_set_linked_proc, success);
} }
@ -1402,15 +1500,21 @@ drawable_get_tattoo_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
GimpDrawable *drawable; GimpDrawable *drawable;
gint32 tattoo = 0;
drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int); drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable)))) if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
success = FALSE; success = FALSE;
if (success)
{
tattoo = gimp_item_get_tattoo (GIMP_ITEM (drawable));
}
return_args = procedural_db_return_args (&drawable_get_tattoo_proc, success); return_args = procedural_db_return_args (&drawable_get_tattoo_proc, success);
if (success) if (success)
return_args[1].value.pdb_int = gimp_item_get_tattoo (GIMP_ITEM (drawable)); return_args[1].value.pdb_int = tattoo;
return return_args; return return_args;
} }
@ -1438,7 +1542,7 @@ static ProcRecord drawable_get_tattoo_proc =
"gimp-drawable-get-tattoo", "gimp-drawable-get-tattoo",
"gimp-drawable-get-tattoo", "gimp-drawable-get-tattoo",
"Get the tattoo of the specified drawable.", "Get the tattoo of the specified drawable.",
"This procedure returns the specified drawable's tattoo. A tattoo is a unique and permanent identifier attached to a drawable that can be used to uniquely identify a drawable within an image even between sessions", "This procedure returns the specified drawable's tattoo. A tattoo is a unique and permanent identifier attached to a drawable that can be used to uniquely identify a drawable within an image even between sessions.",
"Jay Cox", "Jay Cox",
"Jay Cox", "Jay Cox",
"1998", "1998",
@ -1470,7 +1574,9 @@ drawable_set_tattoo_invoker (Gimp *gimp,
success = FALSE; success = FALSE;
if (success) if (success)
gimp_item_set_tattoo (GIMP_ITEM (drawable), tattoo); {
gimp_item_set_tattoo (GIMP_ITEM (drawable), tattoo);
}
return procedural_db_return_args (&drawable_set_tattoo_proc, success); return procedural_db_return_args (&drawable_set_tattoo_proc, success);
} }
@ -1494,7 +1600,7 @@ static ProcRecord drawable_set_tattoo_proc =
"gimp-drawable-set-tattoo", "gimp-drawable-set-tattoo",
"gimp-drawable-set-tattoo", "gimp-drawable-set-tattoo",
"Set the tattoo of the specified drawable.", "Set the tattoo of the specified drawable.",
"This procedure sets the specified drawable's tattoo. A tattoo is a unique and permanent identifier attached to a drawable that can be used to uniquely identify a drawable within an image even between sessions", "This procedure sets the specified drawable's tattoo. A tattoo is a unique and permanent identifier attached to a drawable that can be used to uniquely identify a drawable within an image even between sessions.",
"Jay Cox", "Jay Cox",
"Jay Cox", "Jay Cox",
"1998", "1998",
@ -1527,7 +1633,9 @@ drawable_mask_bounds_invoker (Gimp *gimp,
success = FALSE; success = FALSE;
if (success) if (success)
non_empty = gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2); {
non_empty = gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
}
return_args = procedural_db_return_args (&drawable_mask_bounds_proc, success); return_args = procedural_db_return_args (&drawable_mask_bounds_proc, success);
@ -1619,7 +1727,9 @@ drawable_mask_intersect_invoker (Gimp *gimp,
success = FALSE; success = FALSE;
if (success) if (success)
non_empty = gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height); {
non_empty = gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height);
}
return_args = procedural_db_return_args (&drawable_mask_intersect_proc, success); return_args = procedural_db_return_args (&drawable_mask_intersect_proc, success);
@ -1788,7 +1898,9 @@ drawable_update_invoker (Gimp *gimp,
height = args[4].value.pdb_int; height = args[4].value.pdb_int;
if (success) if (success)
gimp_drawable_update (drawable, x, y, width, height); {
gimp_drawable_update (drawable, x, y, width, height);
}
return procedural_db_return_args (&drawable_update_proc, success); return procedural_db_return_args (&drawable_update_proc, success);
} }
@ -2082,7 +2194,9 @@ drawable_fill_invoker (Gimp *gimp,
success = FALSE; success = FALSE;
if (success) if (success)
gimp_drawable_fill_by_type (drawable, context, (GimpFillType) fill_type); {
gimp_drawable_fill_by_type (drawable, context, (GimpFillType) fill_type);
}
return procedural_db_return_args (&drawable_fill_proc, success); return procedural_db_return_args (&drawable_fill_proc, success);
} }

View file

@ -731,7 +731,7 @@ gimp_drawable_set_linked (gint32 drawable_ID,
* This procedure returns the specified drawable's tattoo. A tattoo is * This procedure returns the specified drawable's tattoo. A tattoo is
* a unique and permanent identifier attached to a drawable that can be * a unique and permanent identifier attached to a drawable that can be
* used to uniquely identify a drawable within an image even between * used to uniquely identify a drawable within an image even between
* sessions * sessions.
* *
* Returns: The drawable tattoo. * Returns: The drawable tattoo.
*/ */
@ -765,7 +765,7 @@ gimp_drawable_get_tattoo (gint32 drawable_ID)
* This procedure sets the specified drawable's tattoo. A tattoo is a * This procedure sets the specified drawable's tattoo. A tattoo is a
* unique and permanent identifier attached to a drawable that can be * unique and permanent identifier attached to a drawable that can be
* used to uniquely identify a drawable within an image even between * used to uniquely identify a drawable within an image even between
* sessions * sessions.
* *
* Returns: TRUE on success. * Returns: TRUE on success.
*/ */

View file

@ -17,134 +17,6 @@
# "Perlized" from C source by Manish Singh <yosh@gimp.org> # "Perlized" from C source by Manish Singh <yosh@gimp.org>
sub drawable_prop_proc {
my ($return, $name, $type, $func, $desc, $core_type, $core_var) = @_;
$core_type = 'drawable' unless $core_type;
$core_var = 'drawable' unless $core_var;
$blurb = "Returns $return.";
&std_pdb_misc;
@inargs = (
{ name => 'drawable', type => 'drawable',
desc => 'The drawable' }
);
@outargs = (
{ name => $name, type => $type, desc => $desc,
alias => "gimp_${core_type}_$func (${core_var})", no_declare => 1 }
);
}
sub drawable_type_proc {
my ($desc, $type, $func) = @_;
$help = <<HELP;
This procedure returns non-zero if the specified drawable is of type
{ $type }.
HELP
&drawable_prop_proc("whether the drawable is $desc type", $func, 'boolean',
$func, "non-zero if the drawable is $desc type");
}
sub drawable_is_proc {
my ($desc, $check) = @_;
my $type = $desc;
$type =~ s/ /_/g;
$help = <<HELP;
This procedure returns non-zero if the specified drawable is a $desc.
HELP
&drawable_prop_proc("whether the drawable is a $desc",
$type, 'boolean', $type,
"Non-zero if the drawable is a $desc");
$outargs[0]->{alias} = $check . ' (drawable) ? TRUE : FALSE';
}
sub drawable_get_prop_proc {
my ($prop, $type, $desc, $undo, $core_type, $core_var) = @_;
$core_type = 'drawable' unless $core_type;
$core_var = 'drawable' unless $core_var;
$blurb = "Get the $desc of the specified drawable.";
$help = "This procedure returns the specified drawable's $desc. ";
&std_pdb_misc;
@inargs = (
{ name => 'drawable', type => 'drawable',
desc => 'The drawable' }
);
@outargs = (
{ name => $prop, type => $type,
desc => "The drawable $desc", no_declare => 1 }
);
my $alias = "gimp_${core_type}_get_$prop ($core_var)";
$alias = "g_strdup ($alias)" if $type eq 'string';
$outargs[0]->{alias} .= "$alias";
}
sub drawable_set_prop_proc {
my ($prop, $type, $desc, $undo, $core_type, $core_var) = @_;
$core_type = 'drawable' unless $core_type;
$core_var = 'drawable' unless $core_var;
$blurb = "Set the $desc of the specified drawable.";
$help = "This procedure sets the specified drawable's $desc. ";
&std_pdb_misc;
@inargs = (
{ name => 'drawable', type => 'drawable',
desc => 'The drawable' },
{ name => $prop, type => $type,
desc => "The new drawable $desc" }
);
if ($type =~ /float/) {
$inargs[1]->{desc} .= ' (%%desc%%)';
}
$invoke{code} = $undo ? "gimp_${core_type}_set_$prop ($core_var, $prop, TRUE);"
: "gimp_${core_type}_set_$prop ($core_var, $prop);";
}
sub drawable_accessors {
my ($prop, $type, $desc, $undo, $extra, $core_type, $core_var) = @_;
$core_type = 'drawable' unless $core_type;
$core_var = 'drawable' unless $core_var;
my (@extra, %extra); my $once = 0;
ref($extra) ? (@extra = @$extra) : (@extra = ($extra, $extra));
%extra = map { $once++ ? 'set' : 'get', $_ ? $_ : "" } @extra;
foreach (sort keys %extra) {
my $proc = "drawable_${_}_$prop";
eval <<SUB;
sub @{[ scalar caller ]}::$proc {
\&drawable_${_}_prop_proc('$prop', '$type', '$desc', $undo,
'$core_type', '$core_var');
$extra{$_}
}
SUB
}
}
sub drawable_merge_shadow { sub drawable_merge_shadow {
$blurb = 'Merge the shadow buffer with the specified drawable.'; $blurb = 'Merge the shadow buffer with the specified drawable.';
@ -211,7 +83,13 @@ HELP
desc => 'The type of fill: %%desc%%' } desc => 'The type of fill: %%desc%%' }
); );
%invoke = ( code => 'gimp_drawable_fill_by_type (drawable, context, (GimpFillType) fill_type);' ); %invoke = (
code => <<'CODE'
{
gimp_drawable_fill_by_type (drawable, context, (GimpFillType) fill_type);
}
CODE
);
} }
sub drawable_update { sub drawable_update {
@ -238,7 +116,13 @@ HELP
desc => 'Height of update region' } desc => 'Height of update region' }
); );
%invoke = ( code => 'gimp_drawable_update (drawable, x, y, width, height);' ); %invoke = (
code => <<'CODE'
{
gimp_drawable_update (drawable, x, y, width, height);
}
CODE
);
} }
sub drawable_mask_bounds { sub drawable_mask_bounds {
@ -284,7 +168,9 @@ HELP
%invoke = ( %invoke = (
code => <<'CODE' code => <<'CODE'
non_empty = gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2); {
non_empty = gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
}
CODE CODE
); );
} }
@ -326,7 +212,9 @@ HELP
%invoke = ( %invoke = (
code => <<'CODE' code => <<'CODE'
non_empty = gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height); {
non_empty = gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height);
}
CODE CODE
); );
} }
@ -354,25 +242,63 @@ sub drawable_get_image {
} }
sub drawable_type { sub drawable_type {
$help = "This procedure returns the drawable's type."; $blurb = "Returns the drawable's type.";
$help = "This procedure returns the drawable's type.";
&drawable_prop_proc("the drawable's type", 'type', 'enum GimpImageType', &std_pdb_misc;
'type', "The drawable's type: { %%desc%% }");
@inargs = (
{ name => 'drawable', type => 'drawable',
desc => 'The drawable' }
);
@outargs = (
{ name => 'type', type => 'enum GimpImageType',
desc => "The drawable's type: { %%desc%% }" }
);
%invoke = (
code => <<'CODE'
{
type = gimp_drawable_type (drawable);
}
CODE
);
} }
sub drawable_has_alpha { sub drawable_has_alpha {
$blurb = 'Returns non-zero if the drawable has an alpha channel.';
$help = <<'HELP'; $help = <<'HELP';
This procedure returns whether the specified drawable has an alpha channel. This procedure returns whether the specified drawable has an alpha channel.
This can only be true for layers, and the associated type will be one of: This can only be true for layers, and the associated type will be one of:
{ RGBA , GRAYA, INDEXEDA }. { RGBA , GRAYA, INDEXEDA }.
HELP HELP
&drawable_prop_proc('non-zero if the drawable has an alpha channel', &std_pdb_misc;
'has_alpha', 'boolean', 'has_alpha',
'Does the drawable have an alpha channel?'); @inargs = (
{ name => 'drawable', type => 'drawable',
desc => 'The drawable' }
);
@outargs = (
{ name => 'has_alpha', type => 'boolean',
desc => 'Does the drawable have an alpha channel?' }
);
%invoke = (
code => <<'CODE'
{
has_alpha = gimp_drawable_has_alpha (drawable);
}
CODE
);
} }
sub drawable_type_with_alpha { sub drawable_type_with_alpha {
$blurb = "Returns the drawable's type with alpha.";
$help = <<'HELP'; $help = <<'HELP';
This procedure returns the drawable's type as if had an alpha This procedure returns the drawable's type as if had an alpha
channel. If the type is currently Gray, for instance, the returned channel. If the type is currently Gray, for instance, the returned
@ -380,48 +306,193 @@ type would be GrayA. If the drawable already has an alpha channel, the
drawable's type is simply returned. drawable's type is simply returned.
HELP HELP
&drawable_prop_proc("the drawable's type with alpha", 'type_with_alpha', &std_pdb_misc;
'enum GimpImageType (no RGB_GIMAGE, GRAY_GIMAGE,
INDEXED_GIMAGE)', 'type_with_alpha', @inargs = (
"The drawable's type with alpha: { %%desc%% }"); { name => 'drawable', type => 'drawable',
desc => 'The drawable' }
);
@outargs = (
{ name => 'type_with_alpha', type => 'enum GimpImageType
(no RGB_GIMAGE, GRAY_GIMAGE,
INDEXED_GIMAGE)',
desc => "The drawable's type with alpha: { %%desc%% }" }
);
%invoke = (
code => <<'CODE'
{
type_with_alpha = gimp_drawable_type_with_alpha (drawable);
}
CODE
);
} }
sub drawable_is_rgb { sub drawable_is_rgb {
&drawable_type_proc('an RGB', 'RGB, RGBA', 'is_rgb'); $blurb = 'Returns whether the drawable is an RGB type.';
$help = <<HELP;
This procedure returns non-zero if the specified drawable
is of type { RGB, RGBA }.
HELP
&std_pdb_misc;
@inargs = (
{ name => 'drawable', type => 'drawable',
desc => 'The drawable' }
);
@outargs = (
{ name => 'is_rgb', type => 'boolean',
desc => 'non-zero if the drawable is an RGB type' }
);
%invoke = (
code => <<'CODE'
{
is_rgb = gimp_drawable_is_rgb (drawable);
}
CODE
);
} }
sub drawable_is_gray { sub drawable_is_gray {
&drawable_type_proc('a grayscale', 'Gray, GrayA', 'is_gray'); $blurb = 'Returns whether the drawable is a grayscale type.';
$help = <<HELP;
This procedure returns non-zero if the specified drawable
is of type { Gray, GrayA }.
HELP
&std_pdb_misc;
@inargs = (
{ name => 'drawable', type => 'drawable',
desc => 'The drawable' }
);
@outargs = (
{ name => 'is_gray', type => 'boolean',
desc => 'non-zero if the drawable is a grayscale type' }
);
%invoke = (
code => <<'CODE'
{
is_gray = gimp_drawable_is_gray (drawable);
}
CODE
);
} }
sub drawable_is_indexed { sub drawable_is_indexed {
&drawable_type_proc('an indexed', 'Indexed, IndexedA', 'is_indexed'); $blurb = 'Returns whether the drawable is an indexed type.';
$help = <<HELP;
This procedure returns non-zero if the specified drawable
is of type { Indexed, IndexedA }.
HELP
&std_pdb_misc;
@inargs = (
{ name => 'drawable', type => 'drawable',
desc => 'The drawable' }
);
@outargs = (
{ name => 'is_indexed', type => 'boolean',
desc => 'non-zero if the drawable is an indexed type' }
);
%invoke = (
code => <<'CODE'
{
is_indexed = gimp_drawable_is_indexed (drawable);
}
CODE
);
} }
sub drawable_bpp { sub drawable_bpp {
$blurb = 'Returns the bytes per pixel.';
$help = <<'HELP'; $help = <<'HELP';
This procedure returns the number of bytes per pixel (or the number of This procedure returns the number of bytes per pixel (or the number of
channels) for the specified drawable. channels) for the specified drawable.
HELP HELP
&drawable_prop_proc('the bytes per pixel', 'bpp', 'int32', 'bytes', &std_pdb_misc;
'Bytes per pixel');
@inargs = (
{ name => 'drawable', type => 'drawable',
desc => 'The drawable' }
);
@outargs = (
{ name => 'bpp', type => 'int32',
desc => 'Bytes per pixel' }
);
%invoke = (
code => <<'CODE'
{
bpp = gimp_drawable_bytes (drawable);
}
CODE
);
} }
sub drawable_width { sub drawable_width {
$help = "This procedure returns the specified drawable's width in pixels."; $blurb = 'Returns the width of the drawable.';
$help = "This procedure returns the specified drawable's width in pixels.";
&drawable_prop_proc('the width of the drawable', 'width', 'int32', &std_pdb_misc;
'width', 'Width of drawable',
'item', 'GIMP_ITEM (drawable)'); @inargs = (
{ name => 'drawable', type => 'drawable',
desc => 'The drawable' }
);
@outargs = (
{ name => 'width', type => 'int32',
desc => 'Width of drawable' }
);
%invoke = (
code => <<'CODE'
{
width = gimp_item_width (GIMP_ITEM (drawable));
}
CODE
);
} }
sub drawable_height { sub drawable_height {
$help = "This procedure returns the specified drawable's height in pixels."; $blurb = 'Returns the height of the drawable.';
$help = "This procedure returns the specified drawable's height in pixels.";
&drawable_prop_proc('the height of the drawable', 'height', 'int32', &std_pdb_misc;
'height', 'Height of drawable',
'item', 'GIMP_ITEM (drawable)'); @inargs = (
{ name => 'drawable', type => 'drawable',
desc => 'The drawable' }
);
@outargs = (
{ name => 'height', type => 'int32',
desc => 'Height of drawable' }
);
%invoke = (
code => <<'CODE'
{
height = gimp_item_height (GIMP_ITEM (drawable));
}
CODE
);
} }
sub drawable_offsets { sub drawable_offsets {
@ -447,48 +518,304 @@ HELP
desc => "y offset of drawable" } desc => "y offset of drawable" }
); );
%invoke = ( code => 'gimp_item_offsets (GIMP_ITEM (drawable), &offset_x, &offset_y);' ); %invoke = (
code => <<'CODE'
{
gimp_item_offsets (GIMP_ITEM (drawable), &offset_x, &offset_y);
}
CODE
);
} }
sub drawable_is_layer { sub drawable_is_layer {
&drawable_is_proc('layer', 'GIMP_IS_LAYER'); $blurb = 'Returns whether the drawable is a layer.';
$help = <<HELP;
This procedure returns non-zero if the specified drawable is a layer.
HELP
&std_pdb_misc;
@inargs = (
{ name => 'drawable', type => 'drawable',
desc => 'The drawable' }
);
@outargs = (
{ name => 'layer', type => 'boolean',
desc => 'Non-zero if the drawable is a layer' }
);
%invoke = (
code => <<'CODE'
{
layer = GIMP_IS_LAYER (drawable);
}
CODE
);
} }
sub drawable_is_layer_mask { sub drawable_is_layer_mask {
&drawable_is_proc('layer mask', 'GIMP_IS_LAYER_MASK'); $blurb = 'Returns whether the drawable is a layer mask.';
$help = <<HELP;
This procedure returns non-zero if the specified drawable is a layer mask.
HELP
&std_pdb_misc;
@inargs = (
{ name => 'drawable', type => 'drawable',
desc => 'The drawable' }
);
@outargs = (
{ name => 'layer_mask', type => 'boolean',
desc => 'Non-zero if the drawable is a layer mask' }
);
%invoke = (
code => <<'CODE'
{
layer_mask = GIMP_IS_LAYER_MASK (drawable);
}
CODE
);
} }
sub drawable_is_channel { sub drawable_is_channel {
&drawable_is_proc('channel', 'GIMP_IS_CHANNEL'); $blurb = 'Returns whether the drawable is a channel.';
$help = <<HELP;
This procedure returns non-zero if the specified drawable is a channel.
HELP
&std_pdb_misc;
@inargs = (
{ name => 'drawable', type => 'drawable',
desc => 'The drawable' }
);
@outargs = (
{ name => 'channel', type => 'boolean',
desc => 'Non-zero if the drawable is a channel' }
);
%invoke = (
code => <<'CODE'
{
channel = GIMP_IS_CHANNEL (drawable);
}
CODE
);
} }
&drawable_accessors('name', 'string', 'name', 0, [ undef, <<'CODE' ], sub drawable_get_name {
$invoke{code} =~ s/gimp_object_set_name/success = gimp_item_rename/; $blurb = "Get the name of the specified drawable.";
$invoke{code} =~ s/GIMP_OBJECT/GIMP_ITEM/;
$help = "This procedure returns the specified drawable's name.";
&std_pdb_misc;
@inargs = (
{ name => 'drawable', type => 'drawable',
desc => 'The drawable' }
);
@outargs = (
{ name => 'name', type => 'string',
desc => "The drawable name" }
);
%invoke = (
code => <<'CODE'
{
name = g_strdup (gimp_object_get_name (GIMP_OBJECT (drawable)));
}
CODE CODE
'object', 'GIMP_OBJECT (drawable)'); );
}
&drawable_accessors('visible', 'boolean', 'visibility', 1, undef, sub drawable_set_name {
'item', 'GIMP_ITEM (drawable)'); $blurb = "Set the name of the specified drawable.";
$help = "This procedure sets the specified drawable's name.";
&std_pdb_misc;
@inargs = (
{ name => 'drawable', type => 'drawable',
desc => 'The drawable' },
{ name => 'name', type => 'string',
desc => "The new drawable name" }
);
%invoke = (
code => <<'CODE'
{
success = gimp_item_rename (GIMP_ITEM (drawable), name);
}
CODE
);
}
sub drawable_get_visible {
$blurb = "Get the visibility of the specified drawable.";
$help = "This procedure returns the specified drawable's visibility.";
&std_pdb_misc;
@inargs = (
{ name => 'drawable', type => 'drawable',
desc => 'The drawable' }
);
@outargs = (
{ name => 'visible', type => 'boolean',
desc => "The drawable visibility" }
);
%invoke = (
code => <<'CODE'
{
visible = gimp_item_get_visible (GIMP_ITEM (drawable));
}
CODE
);
}
sub drawable_set_visible {
$blurb = "Set the visibility of the specified drawable.";
$help = "This procedure sets the specified drawable's visibility.";
&std_pdb_misc;
@inargs = (
{ name => 'drawable', type => 'drawable',
desc => 'The drawable' },
{ name => 'visible', type => 'boolean',
desc => "The new drawable visibility" }
);
%invoke = (
code => <<'CODE'
{
gimp_item_set_visible (GIMP_ITEM (drawable), visible, TRUE);
}
CODE
);
}
sub drawable_get_linked {
$blurb = "Get the linked state of the specified drawable.";
$help = "This procedure returns the specified drawable's linked state.";
&drawable_accessors('linked', 'boolean', 'linked state', 1,
<<'CODE', 'item', 'GIMP_ITEM (drawable)');
&wolfgang_pdb_misc('1998'); &wolfgang_pdb_misc('1998');
if (scalar @outargs) { @inargs = (
$outargs[0]->{desc} .= ' (for moves)' { name => 'drawable', type => 'drawable',
} desc => 'The drawable' }
CODE );
&drawable_accessors('tattoo', 'tattoo', 'tattoo', 0, @outargs = (
<<'CODE', 'item', 'GIMP_ITEM (drawable)'); { name => 'linked', type => 'boolean',
$help .= <<'HELP'; desc => "The drawable linked state (for moves)" }
A tattoo is a unique and permanent identifier attached to a drawable that can be );
used to uniquely identify a drawable within an image even between sessions
%invoke = (
code => <<'CODE'
{
linked = gimp_item_get_linked (GIMP_ITEM (drawable));
}
CODE
);
}
sub drawable_set_linked {
$blurb = "Set the linked state of the specified drawable.";
$help = "This procedure sets the specified drawable's linked state.";
&wolfgang_pdb_misc('1998');
@inargs = (
{ name => 'drawable', type => 'drawable',
desc => 'The drawable' },
{ name => 'linked', type => 'boolean',
desc => "The new drawable linked state" }
);
%invoke = (
code => <<'CODE'
{
gimp_item_set_linked (GIMP_ITEM (drawable), linked, TRUE);
}
CODE
);
}
sub drawable_get_tattoo {
$blurb = "Get the tattoo of the specified drawable.";
$help = <<'HELP';
This procedure returns the specified drawable's tattoo. A tattoo is a
unique and permanent identifier attached to a drawable that can be
used to uniquely identify a drawable within an image even between
sessions.
HELP HELP
&jay_pdb_misc('1998'); &jay_pdb_misc('1998');
@inargs = (
{ name => 'drawable', type => 'drawable',
desc => 'The drawable' }
);
@outargs = (
{ name => 'tattoo', type => 'tattoo',
desc => "The drawable tattoo" }
);
%invoke = (
code => <<'CODE'
{
tattoo = gimp_item_get_tattoo (GIMP_ITEM (drawable));
}
CODE CODE
);
}
sub drawable_set_tattoo {
$blurb = "Set the tattoo of the specified drawable.";
$help = <<'HELP';
This procedure sets the specified drawable's tattoo. A tattoo is a
unique and permanent identifier attached to a drawable that can be
used to uniquely identify a drawable within an image even between
sessions.
HELP
&jay_pdb_misc('1998');
@inargs = (
{ name => 'drawable', type => 'drawable',
desc => 'The drawable' },
{ name => 'tattoo', type => 'tattoo',
desc => "The new drawable tattoo" }
);
%invoke = (
code => <<'CODE'
{
gimp_item_set_tattoo (GIMP_ITEM (drawable), tattoo);
}
CODE
);
}
sub drawable_get_pixel { sub drawable_get_pixel {
$blurb = 'Gets the value of the pixel at the specified coordinates.'; $blurb = 'Gets the value of the pixel at the specified coordinates.';