*** empty log message ***

This commit is contained in:
Marc Lehmann 1999-02-13 18:19:44 +00:00
parent f0eb5d5b76
commit 446a11e938
40 changed files with 502 additions and 15 deletions

View File

@ -1,3 +1,22 @@
Sat Feb 13 19:05:16 CET 1999 Marc Lehmann <pcg@goof.com>
* app/internal_procs.c
* app/parasite_cmds.h
* app/parasite_cmds.c
* app/gimpparasite.h
* app/gimpparasite.c
* app/gimage_cmds.h
* app/gimage_cmds.c
* app/gimpimage.h
* app/gimpimage.c
* app/drawable_cmds.h
* app/drawable_cmds.c
* app/gimpdrawable.h
* app/gimpdrawable.c
Added parasite_list functions for global parasites, drawables and
images as internal (C) and pdb functions.
Wed Feb 10 23:44:00 MET 1999 Sven Neumann <sven@gimp.org> Wed Feb 10 23:44:00 MET 1999 Sven Neumann <sven@gimp.org>
* app/preferences_dialog.c: provide a simple way to change the * app/preferences_dialog.c: provide a simple way to change the
@ -5,12 +24,11 @@ Wed Feb 10 23:44:00 MET 1999 Sven Neumann <sven@gimp.org>
* app/scale.c: also update the title when using the zoom tool * app/scale.c: also update the title when using the zoom tool
Mon Feb 8 18:47:00 CST 1999 Seth Burgess <sjburges@gimp.org> Mon Feb 8 18:47:00 CST 1999 Seth Burgess <sjburges@gimp.org>
* plug-ins/perl/examples/feedback.pl
* plug-ins/perl/examples/feedback.pl * plug-ins/perl/examples/xachblocks.pl
* plug-ins/perl/examples/xachblocks.pl * plug-ins/perl/examples/xachshadows.pl: Updated version
* plug-ins/perl/examples/xachshadows.pl: Updated version
information on my Gimp-Perl plugins that were improved by Marc information on my Gimp-Perl plugins that were improved by Marc
Lehamn so I can keep track better. Lehmann so I can keep track better.
Mon Feb 8 19:17:58 GMT 1999 Adam D. Moss <adam@gimp.org> Mon Feb 8 19:17:58 GMT 1999 Adam D. Moss <adam@gimp.org>

View File

@ -46,5 +46,23 @@ gimp_find_parasite (char *name)
return parasite_list_find(parasites, name); return parasite_list_find(parasites, name);
} }
static void list_func(char *key, Parasite *p, char ***cur)
{
*(*cur)++ = (char *) g_strdup (key);
}
char **
gimp_parasite_list (gint *count)
{
char **list, **cur;
*count = parasite_list_length (parasites);
cur = list = (char **) g_malloc (sizeof (char *) * *count);
parasite_list_foreach (parasites, (GHFunc)list_func, &cur);
return list;
}

View File

@ -24,5 +24,6 @@ void gimp_init_parasites (void);
void gimp_attach_parasite (Parasite *p); void gimp_attach_parasite (Parasite *p);
void gimp_detach_parasite (char *name); void gimp_detach_parasite (char *name);
Parasite * gimp_find_parasite (char *name); Parasite * gimp_find_parasite (char *name);
char ** gimp_parasite_list (gint *count);
#endif /* __GIMP_PARASITE_H__ */ #endif /* __GIMP_PARASITE_H__ */

View File

@ -390,6 +390,24 @@ gimp_drawable_find_parasite (const GimpDrawable *drawable, const char *name)
return parasite_list_find(drawable->parasites, name); return parasite_list_find(drawable->parasites, name);
} }
static void list_func(char *key, Parasite *p, char ***cur)
{
*(*cur)++ = (char *) g_strdup (key);
}
char **
gimp_drawable_parasite_list (GimpDrawable *drawable, gint *count)
{
char **list, **cur;
*count = parasite_list_length (drawable->parasites);
cur = list = (char **) g_malloc (sizeof (char *) * *count);
parasite_list_foreach (drawable->parasites, (GHFunc)list_func, &cur);
return list;
}
void void
gimp_drawable_attach_parasite (GimpDrawable *drawable, Parasite *parasite) gimp_drawable_attach_parasite (GimpDrawable *drawable, Parasite *parasite)
{ {

View File

@ -78,6 +78,10 @@ Parasite * gimp_drawable_find_parasite (const GimpDrawable *,
void gimp_drawable_attach_parasite (GimpDrawable *, Parasite *); void gimp_drawable_attach_parasite (GimpDrawable *, Parasite *);
void gimp_drawable_detach_parasite (GimpDrawable *, void gimp_drawable_detach_parasite (GimpDrawable *,
const char *); const char *);
Parasite * gimp_drawable_find_parasite (const GimpDrawable *,
const char *);
char ** gimp_drawable_parasite_list (GimpDrawable *drawable,
gint *count);
Tattoo gimp_drawable_get_tattoo (const GimpDrawable *); Tattoo gimp_drawable_get_tattoo (const GimpDrawable *);
GimpDrawable * gimp_drawable_get_ID (int); GimpDrawable * gimp_drawable_get_ID (int);

View File

@ -924,6 +924,24 @@ gimp_image_find_parasite (const GimpImage *gimage, const char *name)
return parasite_list_find(gimage->parasites, name); return parasite_list_find(gimage->parasites, name);
} }
static void list_func(char *key, Parasite *p, char ***cur)
{
*(*cur)++ = (char *) g_strdup (key);
}
char **
gimp_image_parasite_list (GimpImage *image, gint *count)
{
char **list, **cur;
*count = parasite_list_length (image->parasites);
cur = list = (char **) g_malloc (sizeof (char *) * *count);
parasite_list_foreach (image->parasites, (GHFunc)list_func, &cur);
return list;
}
void void
gimp_image_attach_parasite (GimpImage *gimage, Parasite *parasite) gimp_image_attach_parasite (GimpImage *gimage, Parasite *parasite)
{ {

View File

@ -141,6 +141,8 @@ void gimp_image_delete_guide (GimpImage *, Guide *);
Parasite * gimp_image_find_parasite (const GimpImage *, Parasite * gimp_image_find_parasite (const GimpImage *,
const char *name); const char *name);
char ** gimp_image_parasite_list (GimpImage *image,
gint *count);
void gimp_image_attach_parasite (GimpImage *, Parasite *); void gimp_image_attach_parasite (GimpImage *, Parasite *);
void gimp_image_detach_parasite (GimpImage *, const char *); void gimp_image_detach_parasite (GimpImage *, const char *);

View File

@ -924,6 +924,24 @@ gimp_image_find_parasite (const GimpImage *gimage, const char *name)
return parasite_list_find(gimage->parasites, name); return parasite_list_find(gimage->parasites, name);
} }
static void list_func(char *key, Parasite *p, char ***cur)
{
*(*cur)++ = (char *) g_strdup (key);
}
char **
gimp_image_parasite_list (GimpImage *image, gint *count)
{
char **list, **cur;
*count = parasite_list_length (image->parasites);
cur = list = (char **) g_malloc (sizeof (char *) * *count);
parasite_list_foreach (image->parasites, (GHFunc)list_func, &cur);
return list;
}
void void
gimp_image_attach_parasite (GimpImage *gimage, Parasite *parasite) gimp_image_attach_parasite (GimpImage *gimage, Parasite *parasite)
{ {

View File

@ -141,6 +141,8 @@ void gimp_image_delete_guide (GimpImage *, Guide *);
Parasite * gimp_image_find_parasite (const GimpImage *, Parasite * gimp_image_find_parasite (const GimpImage *,
const char *name); const char *name);
char ** gimp_image_parasite_list (GimpImage *image,
gint *count);
void gimp_image_attach_parasite (GimpImage *, Parasite *); void gimp_image_attach_parasite (GimpImage *, Parasite *);
void gimp_image_detach_parasite (GimpImage *, const char *); void gimp_image_detach_parasite (GimpImage *, const char *);

View File

@ -924,6 +924,24 @@ gimp_image_find_parasite (const GimpImage *gimage, const char *name)
return parasite_list_find(gimage->parasites, name); return parasite_list_find(gimage->parasites, name);
} }
static void list_func(char *key, Parasite *p, char ***cur)
{
*(*cur)++ = (char *) g_strdup (key);
}
char **
gimp_image_parasite_list (GimpImage *image, gint *count)
{
char **list, **cur;
*count = parasite_list_length (image->parasites);
cur = list = (char **) g_malloc (sizeof (char *) * *count);
parasite_list_foreach (image->parasites, (GHFunc)list_func, &cur);
return list;
}
void void
gimp_image_attach_parasite (GimpImage *gimage, Parasite *parasite) gimp_image_attach_parasite (GimpImage *gimage, Parasite *parasite)
{ {

View File

@ -141,6 +141,8 @@ void gimp_image_delete_guide (GimpImage *, Guide *);
Parasite * gimp_image_find_parasite (const GimpImage *, Parasite * gimp_image_find_parasite (const GimpImage *,
const char *name); const char *name);
char ** gimp_image_parasite_list (GimpImage *image,
gint *count);
void gimp_image_attach_parasite (GimpImage *, Parasite *); void gimp_image_attach_parasite (GimpImage *, Parasite *);
void gimp_image_detach_parasite (GimpImage *, const char *); void gimp_image_detach_parasite (GimpImage *, const char *);

View File

@ -924,6 +924,24 @@ gimp_image_find_parasite (const GimpImage *gimage, const char *name)
return parasite_list_find(gimage->parasites, name); return parasite_list_find(gimage->parasites, name);
} }
static void list_func(char *key, Parasite *p, char ***cur)
{
*(*cur)++ = (char *) g_strdup (key);
}
char **
gimp_image_parasite_list (GimpImage *image, gint *count)
{
char **list, **cur;
*count = parasite_list_length (image->parasites);
cur = list = (char **) g_malloc (sizeof (char *) * *count);
parasite_list_foreach (image->parasites, (GHFunc)list_func, &cur);
return list;
}
void void
gimp_image_attach_parasite (GimpImage *gimage, Parasite *parasite) gimp_image_attach_parasite (GimpImage *gimage, Parasite *parasite)
{ {

View File

@ -141,6 +141,8 @@ void gimp_image_delete_guide (GimpImage *, Guide *);
Parasite * gimp_image_find_parasite (const GimpImage *, Parasite * gimp_image_find_parasite (const GimpImage *,
const char *name); const char *name);
char ** gimp_image_parasite_list (GimpImage *image,
gint *count);
void gimp_image_attach_parasite (GimpImage *, Parasite *); void gimp_image_attach_parasite (GimpImage *, Parasite *);
void gimp_image_detach_parasite (GimpImage *, const char *); void gimp_image_detach_parasite (GimpImage *, const char *);

View File

@ -924,6 +924,24 @@ gimp_image_find_parasite (const GimpImage *gimage, const char *name)
return parasite_list_find(gimage->parasites, name); return parasite_list_find(gimage->parasites, name);
} }
static void list_func(char *key, Parasite *p, char ***cur)
{
*(*cur)++ = (char *) g_strdup (key);
}
char **
gimp_image_parasite_list (GimpImage *image, gint *count)
{
char **list, **cur;
*count = parasite_list_length (image->parasites);
cur = list = (char **) g_malloc (sizeof (char *) * *count);
parasite_list_foreach (image->parasites, (GHFunc)list_func, &cur);
return list;
}
void void
gimp_image_attach_parasite (GimpImage *gimage, Parasite *parasite) gimp_image_attach_parasite (GimpImage *gimage, Parasite *parasite)
{ {

View File

@ -141,6 +141,8 @@ void gimp_image_delete_guide (GimpImage *, Guide *);
Parasite * gimp_image_find_parasite (const GimpImage *, Parasite * gimp_image_find_parasite (const GimpImage *,
const char *name); const char *name);
char ** gimp_image_parasite_list (GimpImage *image,
gint *count);
void gimp_image_attach_parasite (GimpImage *, Parasite *); void gimp_image_attach_parasite (GimpImage *, Parasite *);
void gimp_image_detach_parasite (GimpImage *, const char *); void gimp_image_detach_parasite (GimpImage *, const char *);

View File

@ -924,6 +924,24 @@ gimp_image_find_parasite (const GimpImage *gimage, const char *name)
return parasite_list_find(gimage->parasites, name); return parasite_list_find(gimage->parasites, name);
} }
static void list_func(char *key, Parasite *p, char ***cur)
{
*(*cur)++ = (char *) g_strdup (key);
}
char **
gimp_image_parasite_list (GimpImage *image, gint *count)
{
char **list, **cur;
*count = parasite_list_length (image->parasites);
cur = list = (char **) g_malloc (sizeof (char *) * *count);
parasite_list_foreach (image->parasites, (GHFunc)list_func, &cur);
return list;
}
void void
gimp_image_attach_parasite (GimpImage *gimage, Parasite *parasite) gimp_image_attach_parasite (GimpImage *gimage, Parasite *parasite)
{ {

View File

@ -141,6 +141,8 @@ void gimp_image_delete_guide (GimpImage *, Guide *);
Parasite * gimp_image_find_parasite (const GimpImage *, Parasite * gimp_image_find_parasite (const GimpImage *,
const char *name); const char *name);
char ** gimp_image_parasite_list (GimpImage *image,
gint *count);
void gimp_image_attach_parasite (GimpImage *, Parasite *); void gimp_image_attach_parasite (GimpImage *, Parasite *);
void gimp_image_detach_parasite (GimpImage *, const char *); void gimp_image_detach_parasite (GimpImage *, const char *);

View File

@ -46,5 +46,23 @@ gimp_find_parasite (char *name)
return parasite_list_find(parasites, name); return parasite_list_find(parasites, name);
} }
static void list_func(char *key, Parasite *p, char ***cur)
{
*(*cur)++ = (char *) g_strdup (key);
}
char **
gimp_parasite_list (gint *count)
{
char **list, **cur;
*count = parasite_list_length (parasites);
cur = list = (char **) g_malloc (sizeof (char *) * *count);
parasite_list_foreach (parasites, (GHFunc)list_func, &cur);
return list;
}

View File

@ -24,5 +24,6 @@ void gimp_init_parasites (void);
void gimp_attach_parasite (Parasite *p); void gimp_attach_parasite (Parasite *p);
void gimp_detach_parasite (char *name); void gimp_detach_parasite (char *name);
Parasite * gimp_find_parasite (char *name); Parasite * gimp_find_parasite (char *name);
char ** gimp_parasite_list (gint *count);
#endif /* __GIMP_PARASITE_H__ */ #endif /* __GIMP_PARASITE_H__ */

View File

@ -924,6 +924,24 @@ gimp_image_find_parasite (const GimpImage *gimage, const char *name)
return parasite_list_find(gimage->parasites, name); return parasite_list_find(gimage->parasites, name);
} }
static void list_func(char *key, Parasite *p, char ***cur)
{
*(*cur)++ = (char *) g_strdup (key);
}
char **
gimp_image_parasite_list (GimpImage *image, gint *count)
{
char **list, **cur;
*count = parasite_list_length (image->parasites);
cur = list = (char **) g_malloc (sizeof (char *) * *count);
parasite_list_foreach (image->parasites, (GHFunc)list_func, &cur);
return list;
}
void void
gimp_image_attach_parasite (GimpImage *gimage, Parasite *parasite) gimp_image_attach_parasite (GimpImage *gimage, Parasite *parasite)
{ {

View File

@ -141,6 +141,8 @@ void gimp_image_delete_guide (GimpImage *, Guide *);
Parasite * gimp_image_find_parasite (const GimpImage *, Parasite * gimp_image_find_parasite (const GimpImage *,
const char *name); const char *name);
char ** gimp_image_parasite_list (GimpImage *image,
gint *count);
void gimp_image_attach_parasite (GimpImage *, Parasite *); void gimp_image_attach_parasite (GimpImage *, Parasite *);
void gimp_image_detach_parasite (GimpImage *, const char *); void gimp_image_detach_parasite (GimpImage *, const char *);

View File

@ -1448,6 +1448,7 @@ ProcRecord drawable_get_pixel_proc =
/* The Parasite procs prototypes */ /* The Parasite procs prototypes */
static Argument *gimp_drawable_find_parasite_invoker (Argument *); static Argument *gimp_drawable_find_parasite_invoker (Argument *);
static Argument *gimp_drawable_parasite_list_invoker (Argument *);
static Argument *gimp_drawable_attach_parasite_invoker (Argument *); static Argument *gimp_drawable_attach_parasite_invoker (Argument *);
static Argument *gimp_drawable_detach_parasite_invoker (Argument *); static Argument *gimp_drawable_detach_parasite_invoker (Argument *);
@ -1678,6 +1679,74 @@ gimp_drawable_detach_parasite_invoker (Argument *args)
return return_args; return return_args;
} }
/***** gimp_drawable_parasite_list ****/
ProcArg gimp_drawable_parasite_list_in_args[] =
{
{ PDB_DRAWABLE,
"drawable",
"the drawable"
}
};
ProcArg gimp_drawable_parasite_list_out_args[] =
{
{ PDB_INT32,
"num_parasites",
"the number of attached parasites"
},
{ PDB_STRINGARRAY,
"parasites",
"the names of currently attached parasites"
}
};
ProcRecord gimp_drawable_parasite_list_proc =
{
"gimp_drawable_parasite_list",
"list all parasites",
"Returns a list of all currently attached parasites.",
"Marc Lehmann",
"Marc Lehmann",
"1999",
PDB_INTERNAL,
/* Input arguments */
1,
gimp_drawable_parasite_list_in_args,
/* Output arguments */
2,
gimp_drawable_parasite_list_out_args,
/* Exec method */
{ { gimp_drawable_parasite_list_invoker } },
};
static Argument *
gimp_drawable_parasite_list_invoker (Argument *args)
{
int success = TRUE;
Argument *return_args;
GimpDrawable *gdrawable;
if (success)
{
int_value = args[0].value.pdb_int;
if (! (gdrawable = gimp_drawable_get_ID (int_value)))
success = FALSE;
}
return_args = procedural_db_return_args (&gimp_drawable_parasite_list_proc,
success);
/* The real work */
if (success)
return_args[2].value.pdb_pointer = gimp_drawable_parasite_list (gdrawable,
&return_args[1].value.pdb_int);
return return_args;
}
/************************/ /************************/
/* DRAWABLE_SET_IMAGE */ /* DRAWABLE_SET_IMAGE */

View File

@ -41,6 +41,7 @@ extern ProcRecord drawable_channel_proc;
extern ProcRecord drawable_set_pixel_proc; extern ProcRecord drawable_set_pixel_proc;
extern ProcRecord drawable_get_pixel_proc; extern ProcRecord drawable_get_pixel_proc;
extern ProcRecord gimp_drawable_find_parasite_proc; extern ProcRecord gimp_drawable_find_parasite_proc;
extern ProcRecord gimp_drawable_parasite_list_proc;
extern ProcRecord gimp_drawable_attach_parasite_proc; extern ProcRecord gimp_drawable_attach_parasite_proc;
extern ProcRecord gimp_drawable_detach_parasite_proc; extern ProcRecord gimp_drawable_detach_parasite_proc;
extern ProcRecord drawable_set_image_proc; extern ProcRecord drawable_set_image_proc;

View File

@ -48,6 +48,7 @@ static Argument* gimp_image_get_guide_position_invoker (Argument*);
/* The Parasite procs prototypes */ /* The Parasite procs prototypes */
static Argument *gimp_image_find_parasite_invoker (Argument *); static Argument *gimp_image_find_parasite_invoker (Argument *);
static Argument *gimp_image_parasite_list_invoker (Argument *);
static Argument *gimp_image_attach_parasite_invoker (Argument *); static Argument *gimp_image_attach_parasite_invoker (Argument *);
static Argument *gimp_image_detach_parasite_invoker (Argument *); static Argument *gimp_image_detach_parasite_invoker (Argument *);
@ -4668,6 +4669,75 @@ gimp_image_find_parasite_invoker (Argument *args)
return return_args; return return_args;
} }
/***** gimp_image_parasite_list ****/
ProcArg gimp_image_parasite_list_in_args[] =
{
{ PDB_IMAGE,
"drawable",
"the drawable"
}
};
ProcArg gimp_image_parasite_list_out_args[] =
{
{ PDB_INT32,
"num_parasites",
"the number of attached parasites"
},
{ PDB_STRINGARRAY,
"parasites",
"the names of currently attached parasites"
}
};
ProcRecord gimp_image_parasite_list_proc =
{
"gimp_image_parasite_list",
"list all parasites",
"Returns a list of all currently attached parasites.",
"Marc Lehmann",
"Marc Lehmann",
"1999",
PDB_INTERNAL,
/* Input arguments */
1,
gimp_image_parasite_list_in_args,
/* Output arguments */
2,
gimp_image_parasite_list_out_args,
/* Exec method */
{ { gimp_image_parasite_list_invoker } },
};
static Argument *
gimp_image_parasite_list_invoker (Argument *args)
{
int success = TRUE;
Argument *return_args;
GimpImage *gimage;
if (success)
{
int_value = args[0].value.pdb_int;
if (! (gimage = gimage_get_ID (int_value)))
success = FALSE;
}
return_args = procedural_db_return_args (&gimp_image_parasite_list_proc,
success);
/* The real work */
if (success)
return_args[2].value.pdb_pointer = gimp_image_parasite_list (gimage,
&return_args[1].value.pdb_int);
return return_args;
}
/*** gimp_image_attach_parasite ***/ /*** gimp_image_attach_parasite ***/
ProcArg gimp_image_attach_parasite_args[] = ProcArg gimp_image_attach_parasite_args[] =

View File

@ -81,6 +81,7 @@ extern ProcRecord gimp_image_get_guide_orientation_proc;
extern ProcRecord gimp_image_get_guide_position_proc; extern ProcRecord gimp_image_get_guide_position_proc;
extern ProcRecord gimp_image_find_parasite_proc; extern ProcRecord gimp_image_find_parasite_proc;
extern ProcRecord gimp_image_parasite_list_proc;
extern ProcRecord gimp_image_attach_parasite_proc; extern ProcRecord gimp_image_attach_parasite_proc;
extern ProcRecord gimp_image_detach_parasite_proc; extern ProcRecord gimp_image_detach_parasite_proc;

View File

@ -390,6 +390,24 @@ gimp_drawable_find_parasite (const GimpDrawable *drawable, const char *name)
return parasite_list_find(drawable->parasites, name); return parasite_list_find(drawable->parasites, name);
} }
static void list_func(char *key, Parasite *p, char ***cur)
{
*(*cur)++ = (char *) g_strdup (key);
}
char **
gimp_drawable_parasite_list (GimpDrawable *drawable, gint *count)
{
char **list, **cur;
*count = parasite_list_length (drawable->parasites);
cur = list = (char **) g_malloc (sizeof (char *) * *count);
parasite_list_foreach (drawable->parasites, (GHFunc)list_func, &cur);
return list;
}
void void
gimp_drawable_attach_parasite (GimpDrawable *drawable, Parasite *parasite) gimp_drawable_attach_parasite (GimpDrawable *drawable, Parasite *parasite)
{ {

View File

@ -78,6 +78,10 @@ Parasite * gimp_drawable_find_parasite (const GimpDrawable *,
void gimp_drawable_attach_parasite (GimpDrawable *, Parasite *); void gimp_drawable_attach_parasite (GimpDrawable *, Parasite *);
void gimp_drawable_detach_parasite (GimpDrawable *, void gimp_drawable_detach_parasite (GimpDrawable *,
const char *); const char *);
Parasite * gimp_drawable_find_parasite (const GimpDrawable *,
const char *);
char ** gimp_drawable_parasite_list (GimpDrawable *drawable,
gint *count);
Tattoo gimp_drawable_get_tattoo (const GimpDrawable *); Tattoo gimp_drawable_get_tattoo (const GimpDrawable *);
GimpDrawable * gimp_drawable_get_ID (int); GimpDrawable * gimp_drawable_get_ID (int);

View File

@ -924,6 +924,24 @@ gimp_image_find_parasite (const GimpImage *gimage, const char *name)
return parasite_list_find(gimage->parasites, name); return parasite_list_find(gimage->parasites, name);
} }
static void list_func(char *key, Parasite *p, char ***cur)
{
*(*cur)++ = (char *) g_strdup (key);
}
char **
gimp_image_parasite_list (GimpImage *image, gint *count)
{
char **list, **cur;
*count = parasite_list_length (image->parasites);
cur = list = (char **) g_malloc (sizeof (char *) * *count);
parasite_list_foreach (image->parasites, (GHFunc)list_func, &cur);
return list;
}
void void
gimp_image_attach_parasite (GimpImage *gimage, Parasite *parasite) gimp_image_attach_parasite (GimpImage *gimage, Parasite *parasite)
{ {

View File

@ -141,6 +141,8 @@ void gimp_image_delete_guide (GimpImage *, Guide *);
Parasite * gimp_image_find_parasite (const GimpImage *, Parasite * gimp_image_find_parasite (const GimpImage *,
const char *name); const char *name);
char ** gimp_image_parasite_list (GimpImage *image,
gint *count);
void gimp_image_attach_parasite (GimpImage *, Parasite *); void gimp_image_attach_parasite (GimpImage *, Parasite *);
void gimp_image_detach_parasite (GimpImage *, const char *); void gimp_image_detach_parasite (GimpImage *, const char *);

View File

@ -46,5 +46,23 @@ gimp_find_parasite (char *name)
return parasite_list_find(parasites, name); return parasite_list_find(parasites, name);
} }
static void list_func(char *key, Parasite *p, char ***cur)
{
*(*cur)++ = (char *) g_strdup (key);
}
char **
gimp_parasite_list (gint *count)
{
char **list, **cur;
*count = parasite_list_length (parasites);
cur = list = (char **) g_malloc (sizeof (char *) * *count);
parasite_list_foreach (parasites, (GHFunc)list_func, &cur);
return list;
}

View File

@ -24,5 +24,6 @@ void gimp_init_parasites (void);
void gimp_attach_parasite (Parasite *p); void gimp_attach_parasite (Parasite *p);
void gimp_detach_parasite (char *name); void gimp_detach_parasite (char *name);
Parasite * gimp_find_parasite (char *name); Parasite * gimp_find_parasite (char *name);
char ** gimp_parasite_list (gint *count);
#endif /* __GIMP_PARASITE_H__ */ #endif /* __GIMP_PARASITE_H__ */

View File

@ -195,6 +195,7 @@ internal_procs_init ()
procedural_db_register (&gimp_image_get_guide_orientation_proc); pcount++; procedural_db_register (&gimp_image_get_guide_orientation_proc); pcount++;
procedural_db_register (&gimp_image_get_guide_position_proc); pcount++; procedural_db_register (&gimp_image_get_guide_position_proc); pcount++;
procedural_db_register (&gimp_image_find_parasite_proc); pcount++; procedural_db_register (&gimp_image_find_parasite_proc); pcount++;
procedural_db_register (&gimp_image_parasite_list_proc); pcount++;
procedural_db_register (&gimp_image_attach_parasite_proc); pcount++; procedural_db_register (&gimp_image_attach_parasite_proc); pcount++;
procedural_db_register (&gimp_image_detach_parasite_proc); pcount++; procedural_db_register (&gimp_image_detach_parasite_proc); pcount++;
procedural_db_register (&gimp_image_get_layer_by_tattoo_proc); pcount++; procedural_db_register (&gimp_image_get_layer_by_tattoo_proc); pcount++;
@ -301,6 +302,7 @@ internal_procs_init ()
procedural_db_register (&drawable_set_pixel_proc); pcount++; procedural_db_register (&drawable_set_pixel_proc); pcount++;
procedural_db_register (&drawable_get_pixel_proc); pcount++; procedural_db_register (&drawable_get_pixel_proc); pcount++;
procedural_db_register (&gimp_drawable_find_parasite_proc); pcount++; procedural_db_register (&gimp_drawable_find_parasite_proc); pcount++;
procedural_db_register (&gimp_drawable_parasite_list_proc); pcount++;
procedural_db_register (&gimp_drawable_attach_parasite_proc); pcount++; procedural_db_register (&gimp_drawable_attach_parasite_proc); pcount++;
procedural_db_register (&gimp_drawable_detach_parasite_proc); pcount++; procedural_db_register (&gimp_drawable_detach_parasite_proc); pcount++;
procedural_db_register (&drawable_set_image_proc); pcount++; procedural_db_register (&drawable_set_image_proc); pcount++;
@ -410,6 +412,7 @@ internal_procs_init ()
pcount/total_pcount); pcount/total_pcount);
/* parasite procedures */ /* parasite procedures */
procedural_db_register (&parasite_new_proc); pcount++; procedural_db_register (&parasite_new_proc); pcount++;
procedural_db_register (&gimp_parasite_list_proc); pcount++;
procedural_db_register (&gimp_find_parasite_proc); pcount++; procedural_db_register (&gimp_find_parasite_proc); pcount++;
procedural_db_register (&gimp_attach_parasite_proc); pcount++; procedural_db_register (&gimp_attach_parasite_proc); pcount++;
procedural_db_register (&gimp_detach_parasite_proc); pcount++; procedural_db_register (&gimp_detach_parasite_proc); pcount++;

View File

@ -29,6 +29,7 @@ static Argument *parasite_new_invoker (Argument *);
static Argument *gimp_find_parasite_invoker (Argument *); static Argument *gimp_find_parasite_invoker (Argument *);
static Argument *gimp_attach_parasite_invoker (Argument *); static Argument *gimp_attach_parasite_invoker (Argument *);
static Argument *gimp_detach_parasite_invoker (Argument *); static Argument *gimp_detach_parasite_invoker (Argument *);
static Argument *gimp_parasite_list_invoker (Argument *);
static Argument *parasite_new_invoker (Argument *args); static Argument *parasite_new_invoker (Argument *args);
@ -306,3 +307,55 @@ gimp_detach_parasite_invoker (Argument *args)
return return_args; return return_args;
} }
/***** gimp_parasite_list ****/
ProcArg gimp_parasite_list_out_args[] =
{
{ PDB_INT32,
"num_parasites",
"the number of attached parasites"
},
{ PDB_STRINGARRAY,
"parasites",
"the names of currently attached parasites"
}
};
ProcRecord gimp_parasite_list_proc =
{
"gimp_parasite_list",
"list all parasites",
"Returns a list of all currently attached parasites.",
"Marc Lehmann",
"Marc Lehmann",
"1999",
PDB_INTERNAL,
/* Input arguments */
0,
NULL,
/* Output arguments */
2,
gimp_parasite_list_out_args,
/* Exec method */
{ { gimp_parasite_list_invoker } },
};
static Argument *
gimp_parasite_list_invoker (Argument *args)
{
int success = TRUE;
Argument *return_args;
return_args = procedural_db_return_args (&gimp_parasite_list_proc,
success);
/* The real work */
if (success)
return_args[2].value.pdb_pointer = gimp_parasite_list (&return_args[1].value.pdb_int);
return return_args;
}

View File

@ -24,5 +24,6 @@ extern ProcRecord parasite_new_proc;
extern ProcRecord gimp_find_parasite_proc; extern ProcRecord gimp_find_parasite_proc;
extern ProcRecord gimp_attach_parasite_proc; extern ProcRecord gimp_attach_parasite_proc;
extern ProcRecord gimp_detach_parasite_proc; extern ProcRecord gimp_detach_parasite_proc;
extern ProcRecord gimp_parasite_list_proc;
#endif /* __PARASITE_CMDS_H__ */ #endif /* __PARASITE_CMDS_H__ */

View File

@ -1,5 +1,8 @@
Revision history for Gimp-Perl extension. Revision history for Gimp-Perl extension.
- more errornous argument types are detected now, without
just calling abort().
1.052 Tue Feb 9 18:16:15 CET 1999 1.052 Tue Feb 9 18:16:15 CET 1999
- moved the xlfd_size function from Gimp::Fu into Gimp - moved the xlfd_size function from Gimp::Fu into Gimp
(and maybe later into Gimp::Util?) (and maybe later into Gimp::Util?)

View File

@ -12,7 +12,7 @@ use base qw(DynaLoader);
require DynaLoader; require DynaLoader;
$VERSION = 1.052; $VERSION = 1.053;
@_param = qw( @_param = qw(
PARAM_BOUNDARY PARAM_CHANNEL PARAM_COLOR PARAM_DISPLAY PARAM_DRAWABLE PARAM_BOUNDARY PARAM_CHANNEL PARAM_COLOR PARAM_DISPLAY PARAM_DRAWABLE

View File

@ -65,6 +65,9 @@
#define PKG_ANY ((char *)0) #define PKG_ANY ((char *)0)
static char pkg_anyable[] = PKG_DRAWABLE ", " PKG_LAYER " or " PKG_CHANNEL;
#define PKG_ANYABLE (pkg_anyable)
static int trace = TRACE_NONE; static int trace = TRACE_NONE;
typedef gint32 IMAGE; typedef gint32 IMAGE;
@ -452,7 +455,11 @@ static gint32
unbless (SV *sv, char *type, char *croak_str) unbless (SV *sv, char *type, char *croak_str)
{ {
if (SvROK (sv)) if (SvROK (sv))
if (type == PKG_ANY || sv_derived_from (sv, type)) if (type == PKG_ANY
|| (type == PKG_ANYABLE && (sv_derived_from (sv, PKG_DRAWABLE)
|| sv_derived_from (sv, PKG_LAYER)
|| sv_derived_from (sv, PKG_CHANNEL)))
|| sv_derived_from (sv, type))
{ {
if (SvTYPE (SvRV (sv)) == SVt_PVMG) if (SvTYPE (SvRV (sv)) == SVt_PVMG)
return SvIV (SvRV (sv)); return SvIV (SvRV (sv));
@ -467,7 +474,7 @@ unbless (SV *sv, char *type, char *croak_str)
else else
return SvIV (sv); return SvIV (sv);
abort (); /* calm down gcc */ return -1;
} }
static void static void
@ -648,9 +655,9 @@ convert_sv2gimp (char *croak_str, GParam *arg, SV *sv)
case PARAM_FLOAT: arg->data.d_float = sv2gimp_extract_noref (SvNV, "FLOAT");; case PARAM_FLOAT: arg->data.d_float = sv2gimp_extract_noref (SvNV, "FLOAT");;
case PARAM_STRING: arg->data.d_string = sv2gimp_extract_noref (SvPv, "STRING");; case PARAM_STRING: arg->data.d_string = sv2gimp_extract_noref (SvPv, "STRING");;
case PARAM_DISPLAY: arg->data.d_display = unbless(sv, PKG_DISPLAY , croak_str); break; case PARAM_DISPLAY: arg->data.d_display = unbless(sv, PKG_DISPLAY , croak_str); break;
case PARAM_LAYER: arg->data.d_layer = unbless(sv, PKG_ANY , croak_str); break; case PARAM_LAYER: arg->data.d_layer = unbless(sv, PKG_ANYABLE , croak_str); break;
case PARAM_CHANNEL: arg->data.d_channel = unbless(sv, PKG_ANY , croak_str); break; case PARAM_CHANNEL: arg->data.d_channel = unbless(sv, PKG_ANYABLE , croak_str); break;
case PARAM_DRAWABLE: arg->data.d_drawable = unbless(sv, PKG_ANY , croak_str); break; case PARAM_DRAWABLE: arg->data.d_drawable = unbless(sv, PKG_ANYABLE , croak_str); break;
case PARAM_SELECTION: arg->data.d_selection = unbless(sv, PKG_SELECTION, croak_str); break; case PARAM_SELECTION: arg->data.d_selection = unbless(sv, PKG_SELECTION, croak_str); break;
case PARAM_BOUNDARY: arg->data.d_boundary = sv2gimp_extract_noref (SvIV, "BOUNDARY");; case PARAM_BOUNDARY: arg->data.d_boundary = sv2gimp_extract_noref (SvIV, "BOUNDARY");;
case PARAM_PATH: arg->data.d_path = sv2gimp_extract_noref (SvIV, "PATH");; case PARAM_PATH: arg->data.d_path = sv2gimp_extract_noref (SvIV, "PATH");;
@ -664,7 +671,7 @@ convert_sv2gimp (char *croak_str, GParam *arg, SV *sv)
arg->data.d_image = gimp_channel_get_image_id (unbless(sv, PKG_CHANNEL , croak_str)); arg->data.d_image = gimp_channel_get_image_id (unbless(sv, PKG_CHANNEL , croak_str));
else if (sv_derived_from (sv, PKG_IMAGE) || !SvROK (sv)) else if (sv_derived_from (sv, PKG_IMAGE) || !SvROK (sv))
{ {
arg->data.d_image =unbless(sv, PKG_IMAGE , croak_str); break; arg->data.d_image = unbless(sv, PKG_IMAGE , croak_str); break;
} }
else else
strcpy (croak_str, "argument incompatible with type IMAGE"); strcpy (croak_str, "argument incompatible with type IMAGE");

View File

@ -1,4 +1,4 @@
#!/usr/bin/perl -w #!/usr/app/bin/perl
# Revision 1.0: Released it # Revision 1.0: Released it
# 1.1: Marc Lehman added undo capability! <pcg@goof.com> # 1.1: Marc Lehman added undo capability! <pcg@goof.com>

View File

@ -1,4 +1,4 @@
#!/usr/bin/perl -w #!/usr/app/bin/perl
# This is (hopefully) a demonstration of how pathetically easy it is to script # This is (hopefully) a demonstration of how pathetically easy it is to script
# a neato effect you've come up with. This lil' effect was created by xach, # a neato effect you've come up with. This lil' effect was created by xach,
# and translated by sjburges (me). You can consider it released under the GPL # and translated by sjburges (me). You can consider it released under the GPL

View File

@ -1,4 +1,4 @@
#!/usr/bin/perl -w #!/usr/app/bin/perl
#[Xach] start off with an image, then pixelize it #[Xach] start off with an image, then pixelize it
#[Xach] then add alpha->add layer mask [20:21] #[Xach] then add alpha->add layer mask [20:21]
#[Xach] render a checkerboard into the layer mask #[Xach] render a checkerboard into the layer mask