Modified Files: ChangeLog app/Makefile.am app/channel.c

Modified Files:
 	ChangeLog app/Makefile.am app/channel.c app/drawable_cmds.c
 	app/drawable_cmds.h app/gimage_cmds.c app/gimage_cmds.h
 	app/gimpdrawable.c app/gimpdrawable.h app/gimpdrawableP.h
 	app/gimpimage.c app/gimpimage.h app/gimpimageP.h
 	app/internal_procs.c app/layer.c app/plug_in.c
 	app/procedural_db.c app/procedural_db.h libgimp/Makefile.am
 	libgimp/gimp.c libgimp/gimp.h libgimp/gimpdrawable.c
 	libgimp/gimpenums.h libgimp/gimpimage.c libgimp/gimpprotocol.c
 	libgimp/gimpprotocol.h plug-ins/dbbrowser/dbbrowser_utils.c
 	plug-ins/script-fu/script-fu.c plug-ins/tiff/tiff.c
 Added Files:
 	app/parasite.c app/parasite.h app/parasiteF.h app/parasiteP.h
 	app/parasite_cmds.c app/parasite_cmds.h libgimp/gimpparasite.c
 	libgimp/gimpparasite.h

   	Allow plug-ins (and scripts) to attach arbitrary data
	(parasites) to images, layers and channels that can be read
	back at a later time.
This commit is contained in:
jaycox 1998-10-08 08:15:21 +00:00
parent 6217c7ee4b
commit e2a601d444
85 changed files with 3085 additions and 11 deletions

View File

@ -1,3 +1,48 @@
Thu Oct 8 01:01:18 1998 Jay Cox (jaycox@earthlink.net)
* app/Makefile.am
* app/channel.c
* app/drawable_cmds.c
* app/drawable_cmds.h
* app/gimage_cmds.c
* app/gimage_cmds.h
* app/gimpdrawable.c
* app/gimpdrawable.h
* app/gimpdrawableP.h
* app/gimpimage.c
* app/gimpimage.h
* app/gimpimageP.h
* app/internal_procs.c
* app/layer.c
* app/plug_in.c
* app/procedural_db.c
* app/procedural_db.h
* libgimp/Makefile.am
* libgimp/gimp.c
* libgimp/gimp.h
* libgimp/gimpdrawable.c
* libgimp/gimpenums.h
* libgimp/gimpimage.c
* libgimp/gimpprotocol.c
* libgimp/gimpprotocol.h
* libgimp/gimpprotocol.h
* libgimp/gimpparasite.c (new file)
* libgimp/gimpparasite.h (new file)
* app/parasite.h (new file)
* app/parasite.c (new file)
* app/parasiteP.h (new file)
* app/parasiteF.h (new file)
* app/parasite_cmds.c (new file)
* app/parasite_cmds.h (new file)
* plug-ins/dbbrowser/dbbrowser_utils.c
* plug-ins/script-fu/script-fu.c:
Allow plug-ins (and scripts) to attach arbitrary data
(parasites) to images, layers and channels that can be read
back at a later time.
* plug-ins/tiff/tiff.c: Utilize parasites to keep track of the
compression type and byte ordering of tiff files.
Wed Oct 7 01:52:01 PDT 1998 Manish Singh <yosh@gimp.org> Wed Oct 7 01:52:01 PDT 1998 Manish Singh <yosh@gimp.org>
* app/text_tool.[ch]: applied gimp-austin-981007-0, use gtkfontsel * app/text_tool.[ch]: applied gimp-austin-981007-0, use gtkfontsel

View File

@ -227,6 +227,12 @@ gimp_SOURCES = \
paint_funcs.h \ paint_funcs.h \
paintbrush.c \ paintbrush.c \
paintbrush.h \ paintbrush.h \
parasite.c \
parasite.h \
parasiteP.h \
parasiteF.h \
parasite_cmds.c \
parasite_cmds.h \
pattern_header.h \ pattern_header.h \
pattern_select.c \ pattern_select.c \
pattern_select.h \ pattern_select.h \

View File

@ -28,6 +28,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "parasite.h"
#include "parasiteP.h" /* ick */
#ifdef HAVE_IPC_H #ifdef HAVE_IPC_H
#include <sys/ipc.h> #include <sys/ipc.h>
@ -2624,6 +2626,13 @@ plug_in_params_to_args (GPParam *params,
case PDB_PATH: case PDB_PATH:
args[i].value.pdb_int = params[i].data.d_path; args[i].value.pdb_int = params[i].data.d_path;
break; break;
case PDB_PARASITE:
if (full_copy)
args[i].value.pdb_pointer = parasite_copy ((Parasite *)
&(params[i].data.d_parasite));
else
args[i].value.pdb_pointer = (void *)&(params[i].data.d_parasite);
break;
case PDB_STATUS: case PDB_STATUS:
args[i].value.pdb_int = params[i].data.d_status; args[i].value.pdb_int = params[i].data.d_status;
break; break;
@ -2782,6 +2791,35 @@ plug_in_args_to_params (Argument *args,
case PDB_PATH: case PDB_PATH:
params[i].data.d_path = args[i].value.pdb_int; params[i].data.d_path = args[i].value.pdb_int;
break; break;
case PDB_PARASITE:
if (full_copy)
{
Parasite *tmp;
tmp = parasite_copy (args[i].value.pdb_pointer);
if (tmp == NULL)
{
params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0;
}
else
{
memcpy (&params[i].data.d_parasite, tmp, sizeof(Parasite));
g_free(tmp);
}
}
else
{
if (args[i].value.pdb_pointer == NULL)
{
params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0;
}
else
memcpy (&params[i].data.d_parasite,
(Parasite *)(args[i].value.pdb_pointer),
sizeof(Parasite));
}
break;
case PDB_STATUS: case PDB_STATUS:
params[i].data.d_status = args[i].value.pdb_int; params[i].data.d_status = args[i].value.pdb_int;
break; break;
@ -2850,6 +2888,15 @@ plug_in_params_destroy (GPParam *params,
case PDB_SELECTION: case PDB_SELECTION:
case PDB_BOUNDARY: case PDB_BOUNDARY:
case PDB_PATH: case PDB_PATH:
break;
case PDB_PARASITE:
if (full_destroy)
if (params[i].data.d_parasite.data)
{
g_free (params[i].data.d_parasite.data);
params[i].data.d_parasite.data = 0;
}
break;
case PDB_STATUS: case PDB_STATUS:
break; break;
case PDB_END: case PDB_END:
@ -2924,6 +2971,14 @@ plug_in_args_destroy (Argument *args,
case PDB_SELECTION: case PDB_SELECTION:
case PDB_BOUNDARY: case PDB_BOUNDARY:
case PDB_PATH: case PDB_PATH:
break;
case PDB_PARASITE:
if (full_destroy)
{
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
args[i].value.pdb_pointer = NULL; */
}
break;
case PDB_STATUS: case PDB_STATUS:
break; break;
case PDB_END: case PDB_END:

View File

@ -27,6 +27,7 @@
#include "gimage_mask.h" #include "gimage_mask.h"
#include "layer.h" #include "layer.h"
#include "paint_funcs.h" #include "paint_funcs.h"
#include "parasite.h"
#include "temp_buf.h" #include "temp_buf.h"
#include "undo.h" #include "undo.h"
@ -204,6 +205,10 @@ channel_copy (Channel *channel)
pixel_region_init (&destPR, GIMP_DRAWABLE(new_channel)->tiles, 0, 0, GIMP_DRAWABLE(channel)->width, GIMP_DRAWABLE(channel)->height, TRUE); pixel_region_init (&destPR, GIMP_DRAWABLE(new_channel)->tiles, 0, 0, GIMP_DRAWABLE(channel)->width, GIMP_DRAWABLE(channel)->height, TRUE);
copy_region (&srcPR, &destPR); copy_region (&srcPR, &destPR);
/* copy the parasites */
GIMP_DRAWABLE(new_channel)->parasites
= parasite_gslist_copy(GIMP_DRAWABLE(channel)->parasites);
/* free up the channel_name memory */ /* free up the channel_name memory */
g_free (channel_name); g_free (channel_name);

View File

@ -27,6 +27,7 @@
#include "gimage_mask.h" #include "gimage_mask.h"
#include "layer.h" #include "layer.h"
#include "paint_funcs.h" #include "paint_funcs.h"
#include "parasite.h"
#include "temp_buf.h" #include "temp_buf.h"
#include "undo.h" #include "undo.h"
@ -204,6 +205,10 @@ channel_copy (Channel *channel)
pixel_region_init (&destPR, GIMP_DRAWABLE(new_channel)->tiles, 0, 0, GIMP_DRAWABLE(channel)->width, GIMP_DRAWABLE(channel)->height, TRUE); pixel_region_init (&destPR, GIMP_DRAWABLE(new_channel)->tiles, 0, 0, GIMP_DRAWABLE(channel)->width, GIMP_DRAWABLE(channel)->height, TRUE);
copy_region (&srcPR, &destPR); copy_region (&srcPR, &destPR);
/* copy the parasites */
GIMP_DRAWABLE(new_channel)->parasites
= parasite_gslist_copy(GIMP_DRAWABLE(channel)->parasites);
/* free up the channel_name memory */ /* free up the channel_name memory */
g_free (channel_name); g_free (channel_name);

View File

@ -27,6 +27,7 @@
#include "gimage_mask.h" #include "gimage_mask.h"
#include "layer.h" #include "layer.h"
#include "paint_funcs.h" #include "paint_funcs.h"
#include "parasite.h"
#include "temp_buf.h" #include "temp_buf.h"
#include "undo.h" #include "undo.h"
@ -204,6 +205,10 @@ channel_copy (Channel *channel)
pixel_region_init (&destPR, GIMP_DRAWABLE(new_channel)->tiles, 0, 0, GIMP_DRAWABLE(channel)->width, GIMP_DRAWABLE(channel)->height, TRUE); pixel_region_init (&destPR, GIMP_DRAWABLE(new_channel)->tiles, 0, 0, GIMP_DRAWABLE(channel)->width, GIMP_DRAWABLE(channel)->height, TRUE);
copy_region (&srcPR, &destPR); copy_region (&srcPR, &destPR);
/* copy the parasites */
GIMP_DRAWABLE(new_channel)->parasites
= parasite_gslist_copy(GIMP_DRAWABLE(channel)->parasites);
/* free up the channel_name memory */ /* free up the channel_name memory */
g_free (channel_name); g_free (channel_name);

View File

@ -24,6 +24,7 @@
#include "gimpsignal.h" #include "gimpsignal.h"
#include "gimage.h" #include "gimage.h"
#include "gimage_mask.h" #include "gimage_mask.h"
#include "parasite.h"
enum { enum {
@ -358,6 +359,28 @@ gimp_drawable_set_name (GimpDrawable *drawable, char *name)
drawable->name = g_strdup(name); drawable->name = g_strdup(name);
} }
Parasite *
gimp_drawable_find_parasite (const GimpDrawable *drawable,
const char *creator, const char *type)
{
return parasite_find_in_gslist(drawable->parasites, creator, type);
}
void
gimp_drawable_attach_parasite (GimpDrawable *drawable, const Parasite *parasite)
{
drawable->parasites = parasite_add_to_gslist(parasite, drawable->parasites);
}
void
gimp_drawable_detach_parasite (GimpDrawable *drawable, Parasite *parasite)
{
drawable->parasites = g_slist_remove (drawable->parasites, parasite);
parasite_free(parasite);
}
int int
gimp_drawable_type_with_alpha (GimpDrawable *drawable) gimp_drawable_type_with_alpha (GimpDrawable *drawable)
{ {
@ -515,6 +538,7 @@ gimp_drawable_init (GimpDrawable *drawable)
drawable->has_alpha = FALSE; drawable->has_alpha = FALSE;
drawable->preview = NULL; drawable->preview = NULL;
drawable->preview_valid = FALSE; drawable->preview_valid = FALSE;
drawable->parasites = FALSE;
drawable->ID = global_drawable_ID++; drawable->ID = global_drawable_ID++;
if (gimp_drawable_table == NULL) if (gimp_drawable_table == NULL)
@ -543,6 +567,9 @@ gimp_drawable_destroy (GtkObject *object)
if (drawable->preview) if (drawable->preview)
temp_buf_free (drawable->preview); temp_buf_free (drawable->preview);
if (drawable->parasites)
parasite_gslist_destroy(drawable->parasites);
if (GTK_OBJECT_CLASS (parent_class)->destroy) if (GTK_OBJECT_CLASS (parent_class)->destroy)
(*GTK_OBJECT_CLASS (parent_class)->destroy) (object); (*GTK_OBJECT_CLASS (parent_class)->destroy) (object);
} }

View File

@ -23,6 +23,7 @@
#include "tile_manager.h" #include "tile_manager.h"
#include "temp_buf.h" #include "temp_buf.h"
#include "gimpimageF.h" #include "gimpimageF.h"
#include "parasiteF.h"
#define GIMP_TYPE_DRAWABLE (gimp_drawable_get_type ()) #define GIMP_TYPE_DRAWABLE (gimp_drawable_get_type ())
#define GIMP_DRAWABLE(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_DRAWABLE, GimpDrawable)) #define GIMP_DRAWABLE(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_DRAWABLE, GimpDrawable))
@ -72,6 +73,12 @@ unsigned char * gimp_drawable_cmap (GimpDrawable *);
char * gimp_drawable_get_name (GimpDrawable *); char * gimp_drawable_get_name (GimpDrawable *);
void gimp_drawable_set_name (GimpDrawable *, char *); void gimp_drawable_set_name (GimpDrawable *, char *);
Parasite * gimp_drawable_find_parasite (const GimpDrawable *,
const char *creator,
const char *type);
void gimp_drawable_attach_parasite (GimpDrawable *, const Parasite *);
void gimp_drawable_detach_parasite (GimpDrawable *, Parasite *);
GimpDrawable * gimp_drawable_get_ID (int); GimpDrawable * gimp_drawable_get_ID (int);
void gimp_drawable_deallocate (GimpDrawable *); void gimp_drawable_deallocate (GimpDrawable *);
GimpImage * gimp_drawable_gimage (GimpDrawable*); GimpImage * gimp_drawable_gimage (GimpDrawable*);

View File

@ -25,6 +25,7 @@
#include "gimage_mask.h" #include "gimage_mask.h"
#include "paint_funcs.h" #include "paint_funcs.h"
#include "palette.h" #include "palette.h"
#include "parasite.h"
#include "undo.h" #include "undo.h"
#include "gimpsignal.h" #include "gimpsignal.h"
@ -150,6 +151,7 @@ static void gimp_image_init (GimpImage *gimage)
gimage->comp_preview_valid[1] = FALSE; gimage->comp_preview_valid[1] = FALSE;
gimage->comp_preview_valid[2] = FALSE; gimage->comp_preview_valid[2] = FALSE;
gimage->comp_preview = NULL; gimage->comp_preview = NULL;
gimage->parasites = NULL;
gimage->resolution = 72.0; /* maybe should be rc-supplied default? */ gimage->resolution = 72.0; /* maybe should be rc-supplied default? */
} }
@ -477,6 +479,8 @@ gimp_image_destroy (GtkObject *object)
gimp_image_free_layers (gimage); gimp_image_free_layers (gimage);
gimp_image_free_channels (gimage); gimp_image_free_channels (gimage);
channel_delete (gimage->selection_mask); channel_delete (gimage->selection_mask);
if (gimage->parasites)
parasite_gslist_destroy(gimage->parasites);
} }
void void
@ -855,6 +859,26 @@ gimp_image_delete_guide (GimpImage *gimage,
} }
Parasite *
gimp_image_find_parasite (const GimpImage *gimage,
const char *creator, const char *type)
{
return parasite_find_in_gslist(gimage->parasites, creator, type);
}
void
gimp_image_attach_parasite (GimpImage *gimage, const Parasite *parasite)
{
gimage->parasites = parasite_add_to_gslist(parasite, gimage->parasites);
}
void
gimp_image_detach_parasite (GimpImage *gimage, Parasite *parasite)
{
gimage->parasites = g_slist_remove (gimage->parasites, parasite);
parasite_free(parasite);
}
/************************************************************/ /************************************************************/
/* Projection functions */ /* Projection functions */
/************************************************************/ /************************************************************/

View File

@ -8,6 +8,7 @@
#include "drawable.h" #include "drawable.h"
#include "channel.h" #include "channel.h"
#include "layer.h" #include "layer.h"
#include "parasiteF.h"
#include "temp_buf.h" #include "temp_buf.h"
#include "tile_manager.h" #include "tile_manager.h"
@ -126,6 +127,11 @@ void gimp_image_add_guide (GimpImage *, Guide *);
void gimp_image_remove_guide (GimpImage *, Guide *); void gimp_image_remove_guide (GimpImage *, Guide *);
void gimp_image_delete_guide (GimpImage *, Guide *); void gimp_image_delete_guide (GimpImage *, Guide *);
Parasite * gimp_image_find_parasite (const GimpImage *,
const char *creator,
const char *type);
void gimp_image_attach_parasite (GimpImage *, const Parasite *);
void gimp_image_detach_parasite (GimpImage *, Parasite *);
/* layer/channel functions */ /* layer/channel functions */

View File

@ -25,6 +25,7 @@
#include "gimage_mask.h" #include "gimage_mask.h"
#include "paint_funcs.h" #include "paint_funcs.h"
#include "palette.h" #include "palette.h"
#include "parasite.h"
#include "undo.h" #include "undo.h"
#include "gimpsignal.h" #include "gimpsignal.h"
@ -150,6 +151,7 @@ static void gimp_image_init (GimpImage *gimage)
gimage->comp_preview_valid[1] = FALSE; gimage->comp_preview_valid[1] = FALSE;
gimage->comp_preview_valid[2] = FALSE; gimage->comp_preview_valid[2] = FALSE;
gimage->comp_preview = NULL; gimage->comp_preview = NULL;
gimage->parasites = NULL;
gimage->resolution = 72.0; /* maybe should be rc-supplied default? */ gimage->resolution = 72.0; /* maybe should be rc-supplied default? */
} }
@ -477,6 +479,8 @@ gimp_image_destroy (GtkObject *object)
gimp_image_free_layers (gimage); gimp_image_free_layers (gimage);
gimp_image_free_channels (gimage); gimp_image_free_channels (gimage);
channel_delete (gimage->selection_mask); channel_delete (gimage->selection_mask);
if (gimage->parasites)
parasite_gslist_destroy(gimage->parasites);
} }
void void
@ -855,6 +859,26 @@ gimp_image_delete_guide (GimpImage *gimage,
} }
Parasite *
gimp_image_find_parasite (const GimpImage *gimage,
const char *creator, const char *type)
{
return parasite_find_in_gslist(gimage->parasites, creator, type);
}
void
gimp_image_attach_parasite (GimpImage *gimage, const Parasite *parasite)
{
gimage->parasites = parasite_add_to_gslist(parasite, gimage->parasites);
}
void
gimp_image_detach_parasite (GimpImage *gimage, Parasite *parasite)
{
gimage->parasites = g_slist_remove (gimage->parasites, parasite);
parasite_free(parasite);
}
/************************************************************/ /************************************************************/
/* Projection functions */ /* Projection functions */
/************************************************************/ /************************************************************/

View File

@ -8,6 +8,7 @@
#include "drawable.h" #include "drawable.h"
#include "channel.h" #include "channel.h"
#include "layer.h" #include "layer.h"
#include "parasiteF.h"
#include "temp_buf.h" #include "temp_buf.h"
#include "tile_manager.h" #include "tile_manager.h"
@ -126,6 +127,11 @@ void gimp_image_add_guide (GimpImage *, Guide *);
void gimp_image_remove_guide (GimpImage *, Guide *); void gimp_image_remove_guide (GimpImage *, Guide *);
void gimp_image_delete_guide (GimpImage *, Guide *); void gimp_image_delete_guide (GimpImage *, Guide *);
Parasite * gimp_image_find_parasite (const GimpImage *,
const char *creator,
const char *type);
void gimp_image_attach_parasite (GimpImage *, const Parasite *);
void gimp_image_detach_parasite (GimpImage *, Parasite *);
/* layer/channel functions */ /* layer/channel functions */

View File

@ -25,6 +25,7 @@
#include "gimage_mask.h" #include "gimage_mask.h"
#include "paint_funcs.h" #include "paint_funcs.h"
#include "palette.h" #include "palette.h"
#include "parasite.h"
#include "undo.h" #include "undo.h"
#include "gimpsignal.h" #include "gimpsignal.h"
@ -150,6 +151,7 @@ static void gimp_image_init (GimpImage *gimage)
gimage->comp_preview_valid[1] = FALSE; gimage->comp_preview_valid[1] = FALSE;
gimage->comp_preview_valid[2] = FALSE; gimage->comp_preview_valid[2] = FALSE;
gimage->comp_preview = NULL; gimage->comp_preview = NULL;
gimage->parasites = NULL;
gimage->resolution = 72.0; /* maybe should be rc-supplied default? */ gimage->resolution = 72.0; /* maybe should be rc-supplied default? */
} }
@ -477,6 +479,8 @@ gimp_image_destroy (GtkObject *object)
gimp_image_free_layers (gimage); gimp_image_free_layers (gimage);
gimp_image_free_channels (gimage); gimp_image_free_channels (gimage);
channel_delete (gimage->selection_mask); channel_delete (gimage->selection_mask);
if (gimage->parasites)
parasite_gslist_destroy(gimage->parasites);
} }
void void
@ -855,6 +859,26 @@ gimp_image_delete_guide (GimpImage *gimage,
} }
Parasite *
gimp_image_find_parasite (const GimpImage *gimage,
const char *creator, const char *type)
{
return parasite_find_in_gslist(gimage->parasites, creator, type);
}
void
gimp_image_attach_parasite (GimpImage *gimage, const Parasite *parasite)
{
gimage->parasites = parasite_add_to_gslist(parasite, gimage->parasites);
}
void
gimp_image_detach_parasite (GimpImage *gimage, Parasite *parasite)
{
gimage->parasites = g_slist_remove (gimage->parasites, parasite);
parasite_free(parasite);
}
/************************************************************/ /************************************************************/
/* Projection functions */ /* Projection functions */
/************************************************************/ /************************************************************/

View File

@ -8,6 +8,7 @@
#include "drawable.h" #include "drawable.h"
#include "channel.h" #include "channel.h"
#include "layer.h" #include "layer.h"
#include "parasiteF.h"
#include "temp_buf.h" #include "temp_buf.h"
#include "tile_manager.h" #include "tile_manager.h"
@ -126,6 +127,11 @@ void gimp_image_add_guide (GimpImage *, Guide *);
void gimp_image_remove_guide (GimpImage *, Guide *); void gimp_image_remove_guide (GimpImage *, Guide *);
void gimp_image_delete_guide (GimpImage *, Guide *); void gimp_image_delete_guide (GimpImage *, Guide *);
Parasite * gimp_image_find_parasite (const GimpImage *,
const char *creator,
const char *type);
void gimp_image_attach_parasite (GimpImage *, const Parasite *);
void gimp_image_detach_parasite (GimpImage *, Parasite *);
/* layer/channel functions */ /* layer/channel functions */

View File

@ -25,6 +25,7 @@
#include "gimage_mask.h" #include "gimage_mask.h"
#include "paint_funcs.h" #include "paint_funcs.h"
#include "palette.h" #include "palette.h"
#include "parasite.h"
#include "undo.h" #include "undo.h"
#include "gimpsignal.h" #include "gimpsignal.h"
@ -150,6 +151,7 @@ static void gimp_image_init (GimpImage *gimage)
gimage->comp_preview_valid[1] = FALSE; gimage->comp_preview_valid[1] = FALSE;
gimage->comp_preview_valid[2] = FALSE; gimage->comp_preview_valid[2] = FALSE;
gimage->comp_preview = NULL; gimage->comp_preview = NULL;
gimage->parasites = NULL;
gimage->resolution = 72.0; /* maybe should be rc-supplied default? */ gimage->resolution = 72.0; /* maybe should be rc-supplied default? */
} }
@ -477,6 +479,8 @@ gimp_image_destroy (GtkObject *object)
gimp_image_free_layers (gimage); gimp_image_free_layers (gimage);
gimp_image_free_channels (gimage); gimp_image_free_channels (gimage);
channel_delete (gimage->selection_mask); channel_delete (gimage->selection_mask);
if (gimage->parasites)
parasite_gslist_destroy(gimage->parasites);
} }
void void
@ -855,6 +859,26 @@ gimp_image_delete_guide (GimpImage *gimage,
} }
Parasite *
gimp_image_find_parasite (const GimpImage *gimage,
const char *creator, const char *type)
{
return parasite_find_in_gslist(gimage->parasites, creator, type);
}
void
gimp_image_attach_parasite (GimpImage *gimage, const Parasite *parasite)
{
gimage->parasites = parasite_add_to_gslist(parasite, gimage->parasites);
}
void
gimp_image_detach_parasite (GimpImage *gimage, Parasite *parasite)
{
gimage->parasites = g_slist_remove (gimage->parasites, parasite);
parasite_free(parasite);
}
/************************************************************/ /************************************************************/
/* Projection functions */ /* Projection functions */
/************************************************************/ /************************************************************/

View File

@ -8,6 +8,7 @@
#include "drawable.h" #include "drawable.h"
#include "channel.h" #include "channel.h"
#include "layer.h" #include "layer.h"
#include "parasiteF.h"
#include "temp_buf.h" #include "temp_buf.h"
#include "tile_manager.h" #include "tile_manager.h"
@ -126,6 +127,11 @@ void gimp_image_add_guide (GimpImage *, Guide *);
void gimp_image_remove_guide (GimpImage *, Guide *); void gimp_image_remove_guide (GimpImage *, Guide *);
void gimp_image_delete_guide (GimpImage *, Guide *); void gimp_image_delete_guide (GimpImage *, Guide *);
Parasite * gimp_image_find_parasite (const GimpImage *,
const char *creator,
const char *type);
void gimp_image_attach_parasite (GimpImage *, const Parasite *);
void gimp_image_detach_parasite (GimpImage *, Parasite *);
/* layer/channel functions */ /* layer/channel functions */

View File

@ -25,6 +25,7 @@
#include "gimage_mask.h" #include "gimage_mask.h"
#include "paint_funcs.h" #include "paint_funcs.h"
#include "palette.h" #include "palette.h"
#include "parasite.h"
#include "undo.h" #include "undo.h"
#include "gimpsignal.h" #include "gimpsignal.h"
@ -150,6 +151,7 @@ static void gimp_image_init (GimpImage *gimage)
gimage->comp_preview_valid[1] = FALSE; gimage->comp_preview_valid[1] = FALSE;
gimage->comp_preview_valid[2] = FALSE; gimage->comp_preview_valid[2] = FALSE;
gimage->comp_preview = NULL; gimage->comp_preview = NULL;
gimage->parasites = NULL;
gimage->resolution = 72.0; /* maybe should be rc-supplied default? */ gimage->resolution = 72.0; /* maybe should be rc-supplied default? */
} }
@ -477,6 +479,8 @@ gimp_image_destroy (GtkObject *object)
gimp_image_free_layers (gimage); gimp_image_free_layers (gimage);
gimp_image_free_channels (gimage); gimp_image_free_channels (gimage);
channel_delete (gimage->selection_mask); channel_delete (gimage->selection_mask);
if (gimage->parasites)
parasite_gslist_destroy(gimage->parasites);
} }
void void
@ -855,6 +859,26 @@ gimp_image_delete_guide (GimpImage *gimage,
} }
Parasite *
gimp_image_find_parasite (const GimpImage *gimage,
const char *creator, const char *type)
{
return parasite_find_in_gslist(gimage->parasites, creator, type);
}
void
gimp_image_attach_parasite (GimpImage *gimage, const Parasite *parasite)
{
gimage->parasites = parasite_add_to_gslist(parasite, gimage->parasites);
}
void
gimp_image_detach_parasite (GimpImage *gimage, Parasite *parasite)
{
gimage->parasites = g_slist_remove (gimage->parasites, parasite);
parasite_free(parasite);
}
/************************************************************/ /************************************************************/
/* Projection functions */ /* Projection functions */
/************************************************************/ /************************************************************/

View File

@ -8,6 +8,7 @@
#include "drawable.h" #include "drawable.h"
#include "channel.h" #include "channel.h"
#include "layer.h" #include "layer.h"
#include "parasiteF.h"
#include "temp_buf.h" #include "temp_buf.h"
#include "tile_manager.h" #include "tile_manager.h"
@ -126,6 +127,11 @@ void gimp_image_add_guide (GimpImage *, Guide *);
void gimp_image_remove_guide (GimpImage *, Guide *); void gimp_image_remove_guide (GimpImage *, Guide *);
void gimp_image_delete_guide (GimpImage *, Guide *); void gimp_image_delete_guide (GimpImage *, Guide *);
Parasite * gimp_image_find_parasite (const GimpImage *,
const char *creator,
const char *type);
void gimp_image_attach_parasite (GimpImage *, const Parasite *);
void gimp_image_detach_parasite (GimpImage *, Parasite *);
/* layer/channel functions */ /* layer/channel functions */

View File

@ -25,6 +25,7 @@
#include "gimage_mask.h" #include "gimage_mask.h"
#include "paint_funcs.h" #include "paint_funcs.h"
#include "palette.h" #include "palette.h"
#include "parasite.h"
#include "undo.h" #include "undo.h"
#include "gimpsignal.h" #include "gimpsignal.h"
@ -150,6 +151,7 @@ static void gimp_image_init (GimpImage *gimage)
gimage->comp_preview_valid[1] = FALSE; gimage->comp_preview_valid[1] = FALSE;
gimage->comp_preview_valid[2] = FALSE; gimage->comp_preview_valid[2] = FALSE;
gimage->comp_preview = NULL; gimage->comp_preview = NULL;
gimage->parasites = NULL;
gimage->resolution = 72.0; /* maybe should be rc-supplied default? */ gimage->resolution = 72.0; /* maybe should be rc-supplied default? */
} }
@ -477,6 +479,8 @@ gimp_image_destroy (GtkObject *object)
gimp_image_free_layers (gimage); gimp_image_free_layers (gimage);
gimp_image_free_channels (gimage); gimp_image_free_channels (gimage);
channel_delete (gimage->selection_mask); channel_delete (gimage->selection_mask);
if (gimage->parasites)
parasite_gslist_destroy(gimage->parasites);
} }
void void
@ -855,6 +859,26 @@ gimp_image_delete_guide (GimpImage *gimage,
} }
Parasite *
gimp_image_find_parasite (const GimpImage *gimage,
const char *creator, const char *type)
{
return parasite_find_in_gslist(gimage->parasites, creator, type);
}
void
gimp_image_attach_parasite (GimpImage *gimage, const Parasite *parasite)
{
gimage->parasites = parasite_add_to_gslist(parasite, gimage->parasites);
}
void
gimp_image_detach_parasite (GimpImage *gimage, Parasite *parasite)
{
gimage->parasites = g_slist_remove (gimage->parasites, parasite);
parasite_free(parasite);
}
/************************************************************/ /************************************************************/
/* Projection functions */ /* Projection functions */
/************************************************************/ /************************************************************/

View File

@ -8,6 +8,7 @@
#include "drawable.h" #include "drawable.h"
#include "channel.h" #include "channel.h"
#include "layer.h" #include "layer.h"
#include "parasiteF.h"
#include "temp_buf.h" #include "temp_buf.h"
#include "tile_manager.h" #include "tile_manager.h"
@ -126,6 +127,11 @@ void gimp_image_add_guide (GimpImage *, Guide *);
void gimp_image_remove_guide (GimpImage *, Guide *); void gimp_image_remove_guide (GimpImage *, Guide *);
void gimp_image_delete_guide (GimpImage *, Guide *); void gimp_image_delete_guide (GimpImage *, Guide *);
Parasite * gimp_image_find_parasite (const GimpImage *,
const char *creator,
const char *type);
void gimp_image_attach_parasite (GimpImage *, const Parasite *);
void gimp_image_detach_parasite (GimpImage *, Parasite *);
/* layer/channel functions */ /* layer/channel functions */

View File

@ -371,6 +371,10 @@ layer_copy (layer, add_alpha)
new_layer->show_mask = layer->show_mask; new_layer->show_mask = layer->show_mask;
} }
/* copy the parasites */
GIMP_DRAWABLE(new_layer)->parasites
= parasite_gslist_copy(GIMP_DRAWABLE(layer)->parasites);
cleanup: cleanup:
/* free up the layer_name memory */ /* free up the layer_name memory */
g_free (layer_name); g_free (layer_name);

View File

@ -25,6 +25,7 @@
#include "gimage_mask.h" #include "gimage_mask.h"
#include "paint_funcs.h" #include "paint_funcs.h"
#include "palette.h" #include "palette.h"
#include "parasite.h"
#include "undo.h" #include "undo.h"
#include "gimpsignal.h" #include "gimpsignal.h"
@ -150,6 +151,7 @@ static void gimp_image_init (GimpImage *gimage)
gimage->comp_preview_valid[1] = FALSE; gimage->comp_preview_valid[1] = FALSE;
gimage->comp_preview_valid[2] = FALSE; gimage->comp_preview_valid[2] = FALSE;
gimage->comp_preview = NULL; gimage->comp_preview = NULL;
gimage->parasites = NULL;
gimage->resolution = 72.0; /* maybe should be rc-supplied default? */ gimage->resolution = 72.0; /* maybe should be rc-supplied default? */
} }
@ -477,6 +479,8 @@ gimp_image_destroy (GtkObject *object)
gimp_image_free_layers (gimage); gimp_image_free_layers (gimage);
gimp_image_free_channels (gimage); gimp_image_free_channels (gimage);
channel_delete (gimage->selection_mask); channel_delete (gimage->selection_mask);
if (gimage->parasites)
parasite_gslist_destroy(gimage->parasites);
} }
void void
@ -855,6 +859,26 @@ gimp_image_delete_guide (GimpImage *gimage,
} }
Parasite *
gimp_image_find_parasite (const GimpImage *gimage,
const char *creator, const char *type)
{
return parasite_find_in_gslist(gimage->parasites, creator, type);
}
void
gimp_image_attach_parasite (GimpImage *gimage, const Parasite *parasite)
{
gimage->parasites = parasite_add_to_gslist(parasite, gimage->parasites);
}
void
gimp_image_detach_parasite (GimpImage *gimage, Parasite *parasite)
{
gimage->parasites = g_slist_remove (gimage->parasites, parasite);
parasite_free(parasite);
}
/************************************************************/ /************************************************************/
/* Projection functions */ /* Projection functions */
/************************************************************/ /************************************************************/

View File

@ -8,6 +8,7 @@
#include "drawable.h" #include "drawable.h"
#include "channel.h" #include "channel.h"
#include "layer.h" #include "layer.h"
#include "parasiteF.h"
#include "temp_buf.h" #include "temp_buf.h"
#include "tile_manager.h" #include "tile_manager.h"
@ -126,6 +127,11 @@ void gimp_image_add_guide (GimpImage *, Guide *);
void gimp_image_remove_guide (GimpImage *, Guide *); void gimp_image_remove_guide (GimpImage *, Guide *);
void gimp_image_delete_guide (GimpImage *, Guide *); void gimp_image_delete_guide (GimpImage *, Guide *);
Parasite * gimp_image_find_parasite (const GimpImage *,
const char *creator,
const char *type);
void gimp_image_attach_parasite (GimpImage *, const Parasite *);
void gimp_image_detach_parasite (GimpImage *, Parasite *);
/* layer/channel functions */ /* layer/channel functions */

View File

@ -22,6 +22,7 @@
#include "gimage.h" #include "gimage.h"
#include "drawable.h" #include "drawable.h"
#include "drawable_cmds.h" #include "drawable_cmds.h"
#include "parasite.h"
#include "tile.h" /* ick. */ #include "tile.h" /* ick. */
@ -1442,3 +1443,250 @@ ProcRecord drawable_get_pixel_proc =
/* Exec method */ /* Exec method */
{ { drawable_get_pixel_invoker } }, { { drawable_get_pixel_invoker } },
}; };
/***************** Parasitic Stuff *****************/
/* The Parasite procs prototypes */
static Argument *gimp_drawable_find_parasite_invoker (Argument *);
static Argument *gimp_drawable_attach_parasite_invoker (Argument *);
static Argument *gimp_drawable_detach_parasite_invoker (Argument *);
/*** gimp_drawable_find_parasite ***/
ProcArg gimp_drawable_find_parasite_args[] =
{
{ PDB_DRAWABLE,
"drawable",
"the input drawable"
},
{ PDB_STRING,
"creator",
"The creator ID of the parasite to find"
},
{ PDB_STRING,
"type",
"The type ID of the parasite to find"
}
};
ProcArg gimp_drawable_find_parasite_out_args[] =
{
{ PDB_PARASITE,
"parasite",
"the found parasite"
},
};
ProcRecord gimp_drawable_find_parasite_proc =
{
"gimp_drawable_find_parasite",
"Finds a parasite of a specified type and creator in an drawable.",
"Finds a parasite of a specified type and creator in an drawable.",
"Jay Cox",
"Jay Cox",
"1998",
PDB_INTERNAL,
/* Input arguments */
3,
gimp_drawable_find_parasite_args,
/* Output arguments */
1,
gimp_drawable_find_parasite_out_args,
/* Exec method */
{ { gimp_drawable_find_parasite_invoker } },
};
static Argument *
gimp_drawable_find_parasite_invoker (Argument *args)
{
int success = TRUE;
int int_value;
GimpDrawable *gdrawable;
Argument *return_args;
char *creator, *type;
/* the GimpDrawable */
if (success)
{
int_value = args[0].value.pdb_int;
if (! (gdrawable = gimp_drawable_get_ID (int_value)))
success = FALSE;
}
/* creator */
if (success)
{
creator = (char *) args[1].value.pdb_pointer;
}
/* type */
if (success)
{
type = (char *) args[2].value.pdb_pointer;
}
return_args = procedural_db_return_args (&gimp_drawable_find_parasite_proc,
success);
/* The real work */
if (success)
{
return_args[1].value.pdb_pointer =
gimp_drawable_find_parasite (gdrawable, creator, type);
if (return_args[1].value.pdb_pointer == NULL)
return_args[1].value.pdb_pointer = parasite_error();
}
return return_args;
}
/*** gimp_drawable_attach_parasite ***/
ProcArg gimp_drawable_attach_parasite_args[] =
{
{ PDB_DRAWABLE,
"drawable",
"the input drawable"
},
{ PDB_PARASITE,
"parasite",
"The parasite to attach to the drawable"
}
};
ProcRecord gimp_drawable_attach_parasite_proc =
{
"gimp_drawable_attach_parasite",
"Add a parasite to an drawable",
"This procedure attaches a parasite to an drawable. It has no return values.",
"Jay Cox",
"Jay Cox",
"1998",
PDB_INTERNAL,
/* Input arguments */
2,
gimp_drawable_attach_parasite_args,
/* Output arguments */
0,
NULL,
/* Exec method */
{ { gimp_drawable_attach_parasite_invoker } },
};
static Argument *
gimp_drawable_attach_parasite_invoker (Argument *args)
{
int success = TRUE;
int int_value;
GimpDrawable *gdrawable;
Parasite *parasite = NULL;
Argument *return_args;
/* the GimpDrawable */
if (success)
{
int_value = args[0].value.pdb_int;
if (! (gdrawable = gimp_drawable_get_ID (int_value)))
success = FALSE;
}
if (success)
{
parasite = (Parasite *)args[1].value.pdb_pointer;
if (parasite == NULL)
success = FALSE;
}
if (success)
{
gimp_drawable_attach_parasite (gdrawable, parasite);
}
return_args = procedural_db_return_args (&gimp_drawable_attach_parasite_proc,
success);
return return_args;
}
/*** gimp_drawable_detach_parasite ***/
ProcArg gimp_drawable_detach_parasite_args[] =
{
{ PDB_DRAWABLE,
"drawable",
"the input drawable"
},
{ PDB_PARASITE,
"parasite",
"The parasite to detach to the drawable"
}
};
ProcRecord gimp_drawable_detach_parasite_proc =
{
"gimp_drawable_detach_parasite",
"Add a parasite to an drawable",
"This procedure detaches a parasite to an drawable. It has no return values.",
"Jay Cox",
"Jay Cox",
"1998",
PDB_INTERNAL,
/* Input arguments */
2,
gimp_drawable_detach_parasite_args,
/* Output arguments */
0,
NULL,
/* Exec method */
{ { gimp_drawable_detach_parasite_invoker } },
};
static Argument *
gimp_drawable_detach_parasite_invoker (Argument *args)
{
int success = TRUE;
int int_value;
GimpDrawable *gdrawable;
Parasite *parasite = NULL;
Argument *return_args;
/* the GimpDrawable */
if (success)
{
int_value = args[0].value.pdb_int;
if (! (gdrawable = gimp_drawable_get_ID (int_value)))
success = FALSE;
}
if (success)
{
parasite = (Parasite *)args[1].value.pdb_pointer;
if (parasite == NULL)
success = FALSE;
}
if (success)
{
gimp_drawable_detach_parasite (gdrawable, parasite);
}
return_args = procedural_db_return_args (&gimp_drawable_detach_parasite_proc,
success);
return return_args;
}

View File

@ -40,5 +40,8 @@ extern ProcRecord drawable_layer_mask_proc;
extern ProcRecord drawable_channel_proc; 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_attach_parasite_proc;
extern ProcRecord gimp_drawable_detach_parasite_proc;
#endif /* __DRAWABLE_CMDS_H__ */ #endif /* __DRAWABLE_CMDS_H__ */

View File

@ -25,6 +25,7 @@
#include "gimage.h" #include "gimage.h"
#include "gimage_cmds.h" #include "gimage_cmds.h"
#include "floating_sel.h" #include "floating_sel.h"
#include "parasite.h"
#include "undo.h" #include "undo.h"
#include "layer_pvt.h" /* ick. */ #include "layer_pvt.h" /* ick. */
@ -44,6 +45,10 @@ static Argument* gimp_image_findnext_guide_invoker (Argument*);
static Argument* gimp_image_get_guide_orientation_invoker (Argument*); static Argument* gimp_image_get_guide_orientation_invoker (Argument*);
static Argument* gimp_image_get_guide_position_invoker (Argument*); static Argument* gimp_image_get_guide_position_invoker (Argument*);
/* The Parasite procs prototypes */
static Argument *gimp_image_find_parasite_invoker (Argument *);
static Argument *gimp_image_attach_parasite_invoker (Argument *);
static Argument *gimp_image_detach_parasite_invoker (Argument *);
static GImage * duplicate (GImage *gimage); static GImage * duplicate (GImage *gimage);
@ -4308,3 +4313,244 @@ gimp_image_get_guide_position_invoker (Argument *args)
return return_args; return return_args;
} }
/***************** Parasitic Stuff *****************/
/*** gimp_image_find_parasite ***/
ProcArg gimp_image_find_parasite_args[] =
{
{ PDB_IMAGE,
"image",
"the input image"
},
{ PDB_STRING,
"creator",
"The creator ID of the parasite to find"
},
{ PDB_STRING,
"type",
"The type ID of the parasite to find"
}
};
ProcArg gimp_image_find_parasite_out_args[] =
{
{ PDB_PARASITE,
"parasite",
"the found parasite"
},
};
ProcRecord gimp_image_find_parasite_proc =
{
"gimp_image_find_parasite",
"Finds a parasite of a specified type and creator in an image.",
"Finds a parasite of a specified type and creator in an image.",
"Jay Cox",
"Jay Cox",
"1998",
PDB_INTERNAL,
/* Input arguments */
3,
gimp_image_find_parasite_args,
/* Output arguments */
1,
gimp_image_find_parasite_out_args,
/* Exec method */
{ { gimp_image_find_parasite_invoker } },
};
static Argument *
gimp_image_find_parasite_invoker (Argument *args)
{
int success = TRUE;
int int_value;
GImage *gimage;
Argument *return_args;
char *creator, *type;
/* the gimage */
if (success)
{
int_value = args[0].value.pdb_int;
if (! (gimage = gimage_get_ID (int_value)))
success = FALSE;
}
/* creator */
if (success)
{
creator = (char *) args[1].value.pdb_pointer;
}
/* type */
if (success)
{
type = (char *) args[2].value.pdb_pointer;
}
return_args = procedural_db_return_args (&gimp_image_find_parasite_proc,
success);
/* The real work */
if (success)
{
return_args[1].value.pdb_pointer =
gimp_image_find_parasite (gimage, creator, type);
if (return_args[1].value.pdb_pointer == NULL)
return_args[1].value.pdb_pointer = parasite_error();
}
return return_args;
}
/*** gimp_image_attach_parasite ***/
ProcArg gimp_image_attach_parasite_args[] =
{
{ PDB_IMAGE,
"image",
"the input image"
},
{ PDB_PARASITE,
"parasite",
"The parasite to attach to the image"
}
};
ProcRecord gimp_image_attach_parasite_proc =
{
"gimp_image_attach_parasite",
"Add a parasite to an image",
"This procedure attaches a parasite to an image. It has no return values.",
"Jay Cox",
"Jay Cox",
"1998",
PDB_INTERNAL,
/* Input arguments */
2,
gimp_image_attach_parasite_args,
/* Output arguments */
0,
NULL,
/* Exec method */
{ { gimp_image_attach_parasite_invoker } },
};
static Argument *
gimp_image_attach_parasite_invoker (Argument *args)
{
int success = TRUE;
int int_value;
GImage *gimage;
Parasite *parasite = NULL;
Argument *return_args;
/* the gimage */
if (success)
{
int_value = args[0].value.pdb_int;
if (! (gimage = gimage_get_ID (int_value)))
success = FALSE;
}
if (success)
{
parasite = (Parasite *)args[1].value.pdb_pointer;
if (parasite == NULL)
success = FALSE;
}
if (success)
{
gimp_image_attach_parasite (gimage, parasite);
}
return_args = procedural_db_return_args (&gimp_image_attach_parasite_proc,
success);
return return_args;
}
/*** gimp_image_detach_parasite ***/
ProcArg gimp_image_detach_parasite_args[] =
{
{ PDB_IMAGE,
"image",
"the input image"
},
{ PDB_PARASITE,
"parasite",
"The parasite to detach to the image"
}
};
ProcRecord gimp_image_detach_parasite_proc =
{
"gimp_image_detach_parasite",
"Add a parasite to an image",
"This procedure detaches a parasite to an image. It has no return values.",
"Jay Cox",
"Jay Cox",
"1998",
PDB_INTERNAL,
/* Input arguments */
2,
gimp_image_detach_parasite_args,
/* Output arguments */
0,
NULL,
/* Exec method */
{ { gimp_image_detach_parasite_invoker } },
};
static Argument *
gimp_image_detach_parasite_invoker (Argument *args)
{
int success = TRUE;
int int_value;
GImage *gimage;
Parasite *parasite = NULL;
Argument *return_args;
/* the gimage */
if (success)
{
int_value = args[0].value.pdb_int;
if (! (gimage = gimage_get_ID (int_value)))
success = FALSE;
}
if (success)
{
parasite = (Parasite *)args[1].value.pdb_pointer;
if (parasite == NULL)
success = FALSE;
}
if (success)
{
gimp_image_detach_parasite (gimage, parasite);
}
return_args = procedural_db_return_args (&gimp_image_detach_parasite_proc,
success);
return return_args;
}

View File

@ -77,4 +77,8 @@ extern ProcRecord gimp_image_findnext_guide_proc;
extern ProcRecord gimp_image_get_guide_orientation_proc; 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_attach_parasite_proc;
extern ProcRecord gimp_image_detach_parasite_proc;
#endif /* __GIMAGE_CMDS_H__ */ #endif /* __GIMAGE_CMDS_H__ */

View File

@ -27,6 +27,7 @@
#include "gimage_mask.h" #include "gimage_mask.h"
#include "layer.h" #include "layer.h"
#include "paint_funcs.h" #include "paint_funcs.h"
#include "parasite.h"
#include "temp_buf.h" #include "temp_buf.h"
#include "undo.h" #include "undo.h"
@ -204,6 +205,10 @@ channel_copy (Channel *channel)
pixel_region_init (&destPR, GIMP_DRAWABLE(new_channel)->tiles, 0, 0, GIMP_DRAWABLE(channel)->width, GIMP_DRAWABLE(channel)->height, TRUE); pixel_region_init (&destPR, GIMP_DRAWABLE(new_channel)->tiles, 0, 0, GIMP_DRAWABLE(channel)->width, GIMP_DRAWABLE(channel)->height, TRUE);
copy_region (&srcPR, &destPR); copy_region (&srcPR, &destPR);
/* copy the parasites */
GIMP_DRAWABLE(new_channel)->parasites
= parasite_gslist_copy(GIMP_DRAWABLE(channel)->parasites);
/* free up the channel_name memory */ /* free up the channel_name memory */
g_free (channel_name); g_free (channel_name);

View File

@ -24,6 +24,7 @@
#include "gimpsignal.h" #include "gimpsignal.h"
#include "gimage.h" #include "gimage.h"
#include "gimage_mask.h" #include "gimage_mask.h"
#include "parasite.h"
enum { enum {
@ -358,6 +359,28 @@ gimp_drawable_set_name (GimpDrawable *drawable, char *name)
drawable->name = g_strdup(name); drawable->name = g_strdup(name);
} }
Parasite *
gimp_drawable_find_parasite (const GimpDrawable *drawable,
const char *creator, const char *type)
{
return parasite_find_in_gslist(drawable->parasites, creator, type);
}
void
gimp_drawable_attach_parasite (GimpDrawable *drawable, const Parasite *parasite)
{
drawable->parasites = parasite_add_to_gslist(parasite, drawable->parasites);
}
void
gimp_drawable_detach_parasite (GimpDrawable *drawable, Parasite *parasite)
{
drawable->parasites = g_slist_remove (drawable->parasites, parasite);
parasite_free(parasite);
}
int int
gimp_drawable_type_with_alpha (GimpDrawable *drawable) gimp_drawable_type_with_alpha (GimpDrawable *drawable)
{ {
@ -515,6 +538,7 @@ gimp_drawable_init (GimpDrawable *drawable)
drawable->has_alpha = FALSE; drawable->has_alpha = FALSE;
drawable->preview = NULL; drawable->preview = NULL;
drawable->preview_valid = FALSE; drawable->preview_valid = FALSE;
drawable->parasites = FALSE;
drawable->ID = global_drawable_ID++; drawable->ID = global_drawable_ID++;
if (gimp_drawable_table == NULL) if (gimp_drawable_table == NULL)
@ -543,6 +567,9 @@ gimp_drawable_destroy (GtkObject *object)
if (drawable->preview) if (drawable->preview)
temp_buf_free (drawable->preview); temp_buf_free (drawable->preview);
if (drawable->parasites)
parasite_gslist_destroy(drawable->parasites);
if (GTK_OBJECT_CLASS (parent_class)->destroy) if (GTK_OBJECT_CLASS (parent_class)->destroy)
(*GTK_OBJECT_CLASS (parent_class)->destroy) (object); (*GTK_OBJECT_CLASS (parent_class)->destroy) (object);
} }

View File

@ -23,6 +23,7 @@
#include "tile_manager.h" #include "tile_manager.h"
#include "temp_buf.h" #include "temp_buf.h"
#include "gimpimageF.h" #include "gimpimageF.h"
#include "parasiteF.h"
#define GIMP_TYPE_DRAWABLE (gimp_drawable_get_type ()) #define GIMP_TYPE_DRAWABLE (gimp_drawable_get_type ())
#define GIMP_DRAWABLE(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_DRAWABLE, GimpDrawable)) #define GIMP_DRAWABLE(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_DRAWABLE, GimpDrawable))
@ -72,6 +73,12 @@ unsigned char * gimp_drawable_cmap (GimpDrawable *);
char * gimp_drawable_get_name (GimpDrawable *); char * gimp_drawable_get_name (GimpDrawable *);
void gimp_drawable_set_name (GimpDrawable *, char *); void gimp_drawable_set_name (GimpDrawable *, char *);
Parasite * gimp_drawable_find_parasite (const GimpDrawable *,
const char *creator,
const char *type);
void gimp_drawable_attach_parasite (GimpDrawable *, const Parasite *);
void gimp_drawable_detach_parasite (GimpDrawable *, Parasite *);
GimpDrawable * gimp_drawable_get_ID (int); GimpDrawable * gimp_drawable_get_ID (int);
void gimp_drawable_deallocate (GimpDrawable *); void gimp_drawable_deallocate (GimpDrawable *);
GimpImage * gimp_drawable_gimage (GimpDrawable*); GimpImage * gimp_drawable_gimage (GimpDrawable*);

View File

@ -38,6 +38,8 @@ struct _GimpDrawable
int type; /* type of drawable */ int type; /* type of drawable */
int has_alpha; /* drawable has alpha */ int has_alpha; /* drawable has alpha */
GSList *parasites; /* Plug-in parasite data */
/* Preview variables */ /* Preview variables */
TempBuf *preview; /* preview of the channel */ TempBuf *preview; /* preview of the channel */
int preview_valid; /* is the preview valid? */ int preview_valid; /* is the preview valid? */

View File

@ -25,6 +25,7 @@
#include "gimage_mask.h" #include "gimage_mask.h"
#include "paint_funcs.h" #include "paint_funcs.h"
#include "palette.h" #include "palette.h"
#include "parasite.h"
#include "undo.h" #include "undo.h"
#include "gimpsignal.h" #include "gimpsignal.h"
@ -150,6 +151,7 @@ static void gimp_image_init (GimpImage *gimage)
gimage->comp_preview_valid[1] = FALSE; gimage->comp_preview_valid[1] = FALSE;
gimage->comp_preview_valid[2] = FALSE; gimage->comp_preview_valid[2] = FALSE;
gimage->comp_preview = NULL; gimage->comp_preview = NULL;
gimage->parasites = NULL;
gimage->resolution = 72.0; /* maybe should be rc-supplied default? */ gimage->resolution = 72.0; /* maybe should be rc-supplied default? */
} }
@ -477,6 +479,8 @@ gimp_image_destroy (GtkObject *object)
gimp_image_free_layers (gimage); gimp_image_free_layers (gimage);
gimp_image_free_channels (gimage); gimp_image_free_channels (gimage);
channel_delete (gimage->selection_mask); channel_delete (gimage->selection_mask);
if (gimage->parasites)
parasite_gslist_destroy(gimage->parasites);
} }
void void
@ -855,6 +859,26 @@ gimp_image_delete_guide (GimpImage *gimage,
} }
Parasite *
gimp_image_find_parasite (const GimpImage *gimage,
const char *creator, const char *type)
{
return parasite_find_in_gslist(gimage->parasites, creator, type);
}
void
gimp_image_attach_parasite (GimpImage *gimage, const Parasite *parasite)
{
gimage->parasites = parasite_add_to_gslist(parasite, gimage->parasites);
}
void
gimp_image_detach_parasite (GimpImage *gimage, Parasite *parasite)
{
gimage->parasites = g_slist_remove (gimage->parasites, parasite);
parasite_free(parasite);
}
/************************************************************/ /************************************************************/
/* Projection functions */ /* Projection functions */
/************************************************************/ /************************************************************/

View File

@ -8,6 +8,7 @@
#include "drawable.h" #include "drawable.h"
#include "channel.h" #include "channel.h"
#include "layer.h" #include "layer.h"
#include "parasiteF.h"
#include "temp_buf.h" #include "temp_buf.h"
#include "tile_manager.h" #include "tile_manager.h"
@ -126,6 +127,11 @@ void gimp_image_add_guide (GimpImage *, Guide *);
void gimp_image_remove_guide (GimpImage *, Guide *); void gimp_image_remove_guide (GimpImage *, Guide *);
void gimp_image_delete_guide (GimpImage *, Guide *); void gimp_image_delete_guide (GimpImage *, Guide *);
Parasite * gimp_image_find_parasite (const GimpImage *,
const char *creator,
const char *type);
void gimp_image_attach_parasite (GimpImage *, const Parasite *);
void gimp_image_detach_parasite (GimpImage *, Parasite *);
/* layer/channel functions */ /* layer/channel functions */

View File

@ -53,6 +53,8 @@ struct _GimpImage
Layer * floating_sel; /* ID of fs layer */ Layer * floating_sel; /* ID of fs layer */
Channel * selection_mask; /* selection mask channel */ Channel * selection_mask; /* selection mask channel */
GSList *parasites; /* Plug-in parasite data */
int visible [MAX_CHANNELS]; /* visible channels */ int visible [MAX_CHANNELS]; /* visible channels */
int active [MAX_CHANNELS]; /* active channels */ int active [MAX_CHANNELS]; /* active channels */

View File

@ -371,6 +371,10 @@ layer_copy (layer, add_alpha)
new_layer->show_mask = layer->show_mask; new_layer->show_mask = layer->show_mask;
} }
/* copy the parasites */
GIMP_DRAWABLE(new_layer)->parasites
= parasite_gslist_copy(GIMP_DRAWABLE(layer)->parasites);
cleanup: cleanup:
/* free up the layer_name memory */ /* free up the layer_name memory */
g_free (layer_name); g_free (layer_name);

View File

@ -28,6 +28,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "parasite.h"
#include "parasiteP.h" /* ick */
#ifdef HAVE_IPC_H #ifdef HAVE_IPC_H
#include <sys/ipc.h> #include <sys/ipc.h>
@ -2624,6 +2626,13 @@ plug_in_params_to_args (GPParam *params,
case PDB_PATH: case PDB_PATH:
args[i].value.pdb_int = params[i].data.d_path; args[i].value.pdb_int = params[i].data.d_path;
break; break;
case PDB_PARASITE:
if (full_copy)
args[i].value.pdb_pointer = parasite_copy ((Parasite *)
&(params[i].data.d_parasite));
else
args[i].value.pdb_pointer = (void *)&(params[i].data.d_parasite);
break;
case PDB_STATUS: case PDB_STATUS:
args[i].value.pdb_int = params[i].data.d_status; args[i].value.pdb_int = params[i].data.d_status;
break; break;
@ -2782,6 +2791,35 @@ plug_in_args_to_params (Argument *args,
case PDB_PATH: case PDB_PATH:
params[i].data.d_path = args[i].value.pdb_int; params[i].data.d_path = args[i].value.pdb_int;
break; break;
case PDB_PARASITE:
if (full_copy)
{
Parasite *tmp;
tmp = parasite_copy (args[i].value.pdb_pointer);
if (tmp == NULL)
{
params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0;
}
else
{
memcpy (&params[i].data.d_parasite, tmp, sizeof(Parasite));
g_free(tmp);
}
}
else
{
if (args[i].value.pdb_pointer == NULL)
{
params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0;
}
else
memcpy (&params[i].data.d_parasite,
(Parasite *)(args[i].value.pdb_pointer),
sizeof(Parasite));
}
break;
case PDB_STATUS: case PDB_STATUS:
params[i].data.d_status = args[i].value.pdb_int; params[i].data.d_status = args[i].value.pdb_int;
break; break;
@ -2850,6 +2888,15 @@ plug_in_params_destroy (GPParam *params,
case PDB_SELECTION: case PDB_SELECTION:
case PDB_BOUNDARY: case PDB_BOUNDARY:
case PDB_PATH: case PDB_PATH:
break;
case PDB_PARASITE:
if (full_destroy)
if (params[i].data.d_parasite.data)
{
g_free (params[i].data.d_parasite.data);
params[i].data.d_parasite.data = 0;
}
break;
case PDB_STATUS: case PDB_STATUS:
break; break;
case PDB_END: case PDB_END:
@ -2924,6 +2971,14 @@ plug_in_args_destroy (Argument *args,
case PDB_SELECTION: case PDB_SELECTION:
case PDB_BOUNDARY: case PDB_BOUNDARY:
case PDB_PATH: case PDB_PATH:
break;
case PDB_PARASITE:
if (full_destroy)
{
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
args[i].value.pdb_pointer = NULL; */
}
break;
case PDB_STATUS: case PDB_STATUS:
break; break;
case PDB_END: case PDB_END:

View File

@ -28,6 +28,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "parasite.h"
#include "parasiteP.h" /* ick */
#ifdef HAVE_IPC_H #ifdef HAVE_IPC_H
#include <sys/ipc.h> #include <sys/ipc.h>
@ -2624,6 +2626,13 @@ plug_in_params_to_args (GPParam *params,
case PDB_PATH: case PDB_PATH:
args[i].value.pdb_int = params[i].data.d_path; args[i].value.pdb_int = params[i].data.d_path;
break; break;
case PDB_PARASITE:
if (full_copy)
args[i].value.pdb_pointer = parasite_copy ((Parasite *)
&(params[i].data.d_parasite));
else
args[i].value.pdb_pointer = (void *)&(params[i].data.d_parasite);
break;
case PDB_STATUS: case PDB_STATUS:
args[i].value.pdb_int = params[i].data.d_status; args[i].value.pdb_int = params[i].data.d_status;
break; break;
@ -2782,6 +2791,35 @@ plug_in_args_to_params (Argument *args,
case PDB_PATH: case PDB_PATH:
params[i].data.d_path = args[i].value.pdb_int; params[i].data.d_path = args[i].value.pdb_int;
break; break;
case PDB_PARASITE:
if (full_copy)
{
Parasite *tmp;
tmp = parasite_copy (args[i].value.pdb_pointer);
if (tmp == NULL)
{
params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0;
}
else
{
memcpy (&params[i].data.d_parasite, tmp, sizeof(Parasite));
g_free(tmp);
}
}
else
{
if (args[i].value.pdb_pointer == NULL)
{
params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0;
}
else
memcpy (&params[i].data.d_parasite,
(Parasite *)(args[i].value.pdb_pointer),
sizeof(Parasite));
}
break;
case PDB_STATUS: case PDB_STATUS:
params[i].data.d_status = args[i].value.pdb_int; params[i].data.d_status = args[i].value.pdb_int;
break; break;
@ -2850,6 +2888,15 @@ plug_in_params_destroy (GPParam *params,
case PDB_SELECTION: case PDB_SELECTION:
case PDB_BOUNDARY: case PDB_BOUNDARY:
case PDB_PATH: case PDB_PATH:
break;
case PDB_PARASITE:
if (full_destroy)
if (params[i].data.d_parasite.data)
{
g_free (params[i].data.d_parasite.data);
params[i].data.d_parasite.data = 0;
}
break;
case PDB_STATUS: case PDB_STATUS:
break; break;
case PDB_END: case PDB_END:
@ -2924,6 +2971,14 @@ plug_in_args_destroy (Argument *args,
case PDB_SELECTION: case PDB_SELECTION:
case PDB_BOUNDARY: case PDB_BOUNDARY:
case PDB_PATH: case PDB_PATH:
break;
case PDB_PARASITE:
if (full_destroy)
{
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
args[i].value.pdb_pointer = NULL; */
}
break;
case PDB_STATUS: case PDB_STATUS:
break; break;
case PDB_END: case PDB_END:

View File

@ -71,6 +71,7 @@
#include "text_tool.h" #include "text_tool.h"
#include "threshold.h" #include "threshold.h"
#include "undo_cmds.h" #include "undo_cmds.h"
#include "parasite_cmds.h"
#include "procedural_db.h" #include "procedural_db.h"
@ -79,7 +80,8 @@ internal_procs_init ()
{ {
gfloat pcount = 0; gfloat pcount = 0;
/* grep -c procedural_db_register internal_procs.c */ /* grep -c procedural_db_register internal_procs.c */
gfloat total_pcount = 219; gfloat total_pcount = 235;
app_init_update_status("Internal Procedures", "Tool procedures", app_init_update_status("Internal Procedures", "Tool procedures",
pcount/total_pcount); pcount/total_pcount);
@ -188,6 +190,9 @@ internal_procs_init ()
procedural_db_register (&gimp_image_findnext_guide_proc); pcount++; procedural_db_register (&gimp_image_findnext_guide_proc); pcount++;
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_attach_parasite_proc); pcount++;
procedural_db_register (&gimp_image_detach_parasite_proc); pcount++;
app_init_update_status(NULL, "GImage mask procedures", app_init_update_status(NULL, "GImage mask procedures",
pcount/total_pcount); pcount/total_pcount);
@ -285,6 +290,9 @@ internal_procs_init ()
procedural_db_register (&drawable_channel_proc); pcount++; procedural_db_register (&drawable_channel_proc); pcount++;
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_attach_parasite_proc); pcount++;
procedural_db_register (&gimp_drawable_detach_parasite_proc); pcount++;
app_init_update_status(NULL, "Floating selections", app_init_update_status(NULL, "Floating selections",
pcount/total_pcount); pcount/total_pcount);
@ -372,9 +380,17 @@ internal_procs_init ()
procedural_db_register (&channel_ops_duplicate_proc); pcount++; procedural_db_register (&channel_ops_duplicate_proc); pcount++;
procedural_db_register (&channel_ops_offset_proc); pcount++; procedural_db_register (&channel_ops_offset_proc); pcount++;
app_init_update_status(NULL, "gimprc ops",
pcount/total_pcount);
/* Gimprc procedures */ /* Gimprc procedures */
procedural_db_register (&gimprc_query_proc); pcount++; procedural_db_register (&gimprc_query_proc); pcount++;
app_init_update_status(NULL, "parasites",
pcount/total_pcount);
/* parasite procedures */
procedural_db_register (&parasite_new_proc); pcount++;
app_init_update_status(NULL, "Procedural database", app_init_update_status(NULL, "Procedural database",
pcount/total_pcount); pcount/total_pcount);

View File

@ -371,6 +371,10 @@ layer_copy (layer, add_alpha)
new_layer->show_mask = layer->show_mask; new_layer->show_mask = layer->show_mask;
} }
/* copy the parasites */
GIMP_DRAWABLE(new_layer)->parasites
= parasite_gslist_copy(GIMP_DRAWABLE(layer)->parasites);
cleanup: cleanup:
/* free up the layer_name memory */ /* free up the layer_name memory */
g_free (layer_name); g_free (layer_name);

View File

@ -28,6 +28,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "parasite.h"
#include "parasiteP.h" /* ick */
#ifdef HAVE_IPC_H #ifdef HAVE_IPC_H
#include <sys/ipc.h> #include <sys/ipc.h>
@ -2624,6 +2626,13 @@ plug_in_params_to_args (GPParam *params,
case PDB_PATH: case PDB_PATH:
args[i].value.pdb_int = params[i].data.d_path; args[i].value.pdb_int = params[i].data.d_path;
break; break;
case PDB_PARASITE:
if (full_copy)
args[i].value.pdb_pointer = parasite_copy ((Parasite *)
&(params[i].data.d_parasite));
else
args[i].value.pdb_pointer = (void *)&(params[i].data.d_parasite);
break;
case PDB_STATUS: case PDB_STATUS:
args[i].value.pdb_int = params[i].data.d_status; args[i].value.pdb_int = params[i].data.d_status;
break; break;
@ -2782,6 +2791,35 @@ plug_in_args_to_params (Argument *args,
case PDB_PATH: case PDB_PATH:
params[i].data.d_path = args[i].value.pdb_int; params[i].data.d_path = args[i].value.pdb_int;
break; break;
case PDB_PARASITE:
if (full_copy)
{
Parasite *tmp;
tmp = parasite_copy (args[i].value.pdb_pointer);
if (tmp == NULL)
{
params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0;
}
else
{
memcpy (&params[i].data.d_parasite, tmp, sizeof(Parasite));
g_free(tmp);
}
}
else
{
if (args[i].value.pdb_pointer == NULL)
{
params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0;
}
else
memcpy (&params[i].data.d_parasite,
(Parasite *)(args[i].value.pdb_pointer),
sizeof(Parasite));
}
break;
case PDB_STATUS: case PDB_STATUS:
params[i].data.d_status = args[i].value.pdb_int; params[i].data.d_status = args[i].value.pdb_int;
break; break;
@ -2850,6 +2888,15 @@ plug_in_params_destroy (GPParam *params,
case PDB_SELECTION: case PDB_SELECTION:
case PDB_BOUNDARY: case PDB_BOUNDARY:
case PDB_PATH: case PDB_PATH:
break;
case PDB_PARASITE:
if (full_destroy)
if (params[i].data.d_parasite.data)
{
g_free (params[i].data.d_parasite.data);
params[i].data.d_parasite.data = 0;
}
break;
case PDB_STATUS: case PDB_STATUS:
break; break;
case PDB_END: case PDB_END:
@ -2924,6 +2971,14 @@ plug_in_args_destroy (Argument *args,
case PDB_SELECTION: case PDB_SELECTION:
case PDB_BOUNDARY: case PDB_BOUNDARY:
case PDB_PATH: case PDB_PATH:
break;
case PDB_PARASITE:
if (full_destroy)
{
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
args[i].value.pdb_pointer = NULL; */
}
break;
case PDB_STATUS: case PDB_STATUS:
break; break;
case PDB_END: case PDB_END:

155
app/parasite.c Normal file
View File

@ -0,0 +1,155 @@
/* parasite.c
* Copyright (C) 1998 Jay Cox <jaycox@earthlink.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "parasiteP.h"
#include "parasite.h"
#include <string.h>
#include <glib.h>
Parasite *
parasite_new (const char *creator, const char *type, guint32 flags,
guint32 size, const void *data)
{
Parasite *p;
p = (Parasite *)g_malloc(sizeof(Parasite));
if (creator)
memcpy(p->creator, creator, 4);
else
memset(p->creator, 0, 4);
if (type)
memcpy(p->type, type, 4);
else
memset(p->type, 0, 4);
p->flags = flags;
p->size = size;
if (size)
p->data = g_memdup(data, size);
else
p->data = NULL;
return p;
}
void
parasite_free (Parasite *parasite)
{
g_return_if_fail(parasite != NULL);
if (parasite->data)
g_free(parasite->data);
g_free(parasite);
}
int
parasite_has_type (const Parasite *parasite, const char *creator, const char *type)
{
if (!parasite)
return FALSE;
if (creator && parasite->creator && strncmp(creator, parasite->creator, 4) != 0)
return FALSE;
if (creator != 0 && parasite->creator == 0)
return FALSE;
if (type && parasite->type && strncmp(type, parasite->type, 4) != 0)
return FALSE;
if (type != 0 && parasite->type == 0)
return FALSE;
return TRUE;
}
Parasite *
parasite_copy (const Parasite *parasite)
{
if (parasite == NULL)
return NULL;
return parasite_new (&parasite->creator[0], &parasite->type[0],
parasite->flags, parasite->size, parasite->data);
}
Parasite *
parasite_error()
{
static Parasite *error_p = NULL;
if (!error_p)
error_p = parasite_new("eror", "eror", 0, 0, NULL);
return error_p;
}
int
parasite_is_error(const Parasite *p)
{
if (p == NULL)
return TRUE;
return parasite_has_type(p, "eror", "eror");
}
int
parasite_is_persistant(const Parasite *p)
{
if (p == NULL)
return FALSE;
return (p->flags & PARASITE_PERSISTANT);
}
/* parasite list functions */
Parasite *
parasite_find_in_gslist (const GSList *list, const char *creator, const char *type)
{
while (list)
{
if (parasite_has_type((Parasite *)(list->data), creator, type))
return (Parasite *)(list->data);
list = list->next;
}
return NULL;
}
GSList*
parasite_add_to_gslist (const Parasite *parasite, GSList *list)
{
Parasite *p;
if (parasite_is_error(parasite))
return list;
if ((p = parasite_find_in_gslist(list, parasite->creator, parasite->type)))
{
list = g_slist_remove(list, p);
parasite_free(p);
}
return g_slist_prepend (list, parasite_copy(parasite));
}
GSList*
parasite_gslist_copy (const GSList *list)
{
GSList *copy = NULL;
while (list)
{
copy = g_slist_append (copy, parasite_copy((Parasite *)list->data));
list = list->next;
}
return copy;
}
void
parasite_gslist_destroy (GSList *list)
{
while (list)
{
parasite_free((Parasite *)list->data);
list = g_slist_remove (list, list->data);
}
}

51
app/parasite.h Normal file
View File

@ -0,0 +1,51 @@
/* parasite.h
* Copyright (C) 1998 Jay Cox <jaycox@earthlink.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef _PARASITE_H_
#define _PARASITE_H_
#include <glib.h>
#include <parasiteF.h>
#define PARASITE_PERSISTANT 1
Parasite *parasite_new (const char *creator, const char *type, guint32 flags,
guint32 size, const void *data);
void parasite_free (Parasite *parasite);
int parasite_has_type (const Parasite *parasite, const char *creator,
const char *type);
Parasite *parasite_copy (const Parasite *parasite);
Parasite *parasite_error ();
int parasite_is_error (const Parasite *p);
int parasite_is_persistant (const Parasite *p);
/* parasite list functions */
GSList *parasite_add_to_gslist (const Parasite *parasite, GSList *list);
Parasite *parasite_find_in_gslist (const GSList *list, const char *creator,
const char *type);
GSList *parasite_gslist_copy (const GSList *list);
void parasite_gslist_destroy (GSList *list);
#endif _PARASITE_H_

25
app/parasiteF.h Normal file
View File

@ -0,0 +1,25 @@
/* parasiteF.h
* Copyright (C) 1998 Jay Cox <jaycox@earthlink.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef _PARASITEF_H_
#define _PARASITEF_H_
typedef struct _Parasite Parasite;
#endif _PARASITEF_H_

35
app/parasiteP.h Normal file
View File

@ -0,0 +1,35 @@
/* parasiteP.h
* Copyright (C) 1998 Jay Cox <jaycox@earthlink.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef _PARASITEP_H_
#define _PARASITEP_H_
#include <glib.h>
struct _Parasite
{
guchar creator[4]; /* the creator code of the plug-in/author */
guchar type[4]; /* the data type of the parasite */
guint32 flags; /* save Parasite in XCF file, etc. */
guint32 size; /* amount of data */
void *data; /* a pointer to the data. plugin is *
* responsible for tracking byte order */
};
#endif _PARASITEP_H_

120
app/parasite_cmds.c Normal file
View File

@ -0,0 +1,120 @@
/* parasite_cmds.c
* Copyright (C) 1998 Jay Cox <jaycox@earthlink.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "parasite.h"
#include "procedural_db.h"
#include "appenv.h"
#include <stdio.h>
static Argument *parasite_new_invoker (Argument *args);
ProcArg parasite_new_args[] =
{
{ PDB_STRING,
"creator",
"The creator ID of the parasite to create"
},
{ PDB_STRING,
"type",
"The type ID of the parasite to create"
},
{ PDB_INT32,
"flags",
"The flags ( 1 == persistance )"
},
{ PDB_INT32,
"size",
"The size of the data in bytes"
},
{ PDB_STRING,
"data",
"The data"
}
};
ProcArg parasite_new_out_args[] =
{
{ PDB_PARASITE,
"parasite",
"the new parasite"
},
};
ProcRecord parasite_new_proc =
{
"parasite_new",
"creates a new parasite.",
"creates a new parasite unatached to to any image or drawable",
"Jay Cox",
"Jay Cox",
"1998",
PDB_INTERNAL,
/* Input arguments */
5,
parasite_new_args,
/* Output arguments */
1,
parasite_new_out_args,
/* Exec method */
{ { parasite_new_invoker } },
};
static Argument *
parasite_new_invoker (Argument *args)
{
int success = TRUE;
Argument *return_args;
char *creator, *type;
guint32 flags, size;
void *data;
/* creator */
if (success)
{ creator = (char *) args[0].value.pdb_pointer; }
/* type */
if (success)
{ type = (char *) args[1].value.pdb_pointer; }
/* flags */
if (success)
{ flags = args[2].value.pdb_int; }
/* size */
if (success)
{ size = args[3].value.pdb_int; }
/* data */
if (success)
{
data = args[4].value.pdb_pointer;
if (size > 0 && data == 0)
success = FALSE;
}
return_args = procedural_db_return_args (&parasite_new_proc,
success);
/* The real work */
if (success)
{
return_args[1].value.pdb_pointer =
parasite_new (creator, type, flags, size, data);
}
return return_args;
}

25
app/parasite_cmds.h Normal file
View File

@ -0,0 +1,25 @@
/* parasite_cmds.c
* Copyright (C) 1998 Jay Cox <jaycox@earthlink.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __PARASITE_CMDS_H__
#define __PARASITE_CMDS_H__
extern ProcRecord parasite_new_proc;
#endif __PARASITE_CMDS_H__

View File

@ -28,6 +28,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "parasite.h"
#include "parasiteP.h" /* ick */
#ifdef HAVE_IPC_H #ifdef HAVE_IPC_H
#include <sys/ipc.h> #include <sys/ipc.h>
@ -2624,6 +2626,13 @@ plug_in_params_to_args (GPParam *params,
case PDB_PATH: case PDB_PATH:
args[i].value.pdb_int = params[i].data.d_path; args[i].value.pdb_int = params[i].data.d_path;
break; break;
case PDB_PARASITE:
if (full_copy)
args[i].value.pdb_pointer = parasite_copy ((Parasite *)
&(params[i].data.d_parasite));
else
args[i].value.pdb_pointer = (void *)&(params[i].data.d_parasite);
break;
case PDB_STATUS: case PDB_STATUS:
args[i].value.pdb_int = params[i].data.d_status; args[i].value.pdb_int = params[i].data.d_status;
break; break;
@ -2782,6 +2791,35 @@ plug_in_args_to_params (Argument *args,
case PDB_PATH: case PDB_PATH:
params[i].data.d_path = args[i].value.pdb_int; params[i].data.d_path = args[i].value.pdb_int;
break; break;
case PDB_PARASITE:
if (full_copy)
{
Parasite *tmp;
tmp = parasite_copy (args[i].value.pdb_pointer);
if (tmp == NULL)
{
params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0;
}
else
{
memcpy (&params[i].data.d_parasite, tmp, sizeof(Parasite));
g_free(tmp);
}
}
else
{
if (args[i].value.pdb_pointer == NULL)
{
params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0;
}
else
memcpy (&params[i].data.d_parasite,
(Parasite *)(args[i].value.pdb_pointer),
sizeof(Parasite));
}
break;
case PDB_STATUS: case PDB_STATUS:
params[i].data.d_status = args[i].value.pdb_int; params[i].data.d_status = args[i].value.pdb_int;
break; break;
@ -2850,6 +2888,15 @@ plug_in_params_destroy (GPParam *params,
case PDB_SELECTION: case PDB_SELECTION:
case PDB_BOUNDARY: case PDB_BOUNDARY:
case PDB_PATH: case PDB_PATH:
break;
case PDB_PARASITE:
if (full_destroy)
if (params[i].data.d_parasite.data)
{
g_free (params[i].data.d_parasite.data);
params[i].data.d_parasite.data = 0;
}
break;
case PDB_STATUS: case PDB_STATUS:
break; break;
case PDB_END: case PDB_END:
@ -2924,6 +2971,14 @@ plug_in_args_destroy (Argument *args,
case PDB_SELECTION: case PDB_SELECTION:
case PDB_BOUNDARY: case PDB_BOUNDARY:
case PDB_PATH: case PDB_PATH:
break;
case PDB_PARASITE:
if (full_destroy)
{
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
args[i].value.pdb_pointer = NULL; */
}
break;
case PDB_STATUS: case PDB_STATUS:
break; break;
case PDB_END: case PDB_END:

View File

@ -28,6 +28,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "parasite.h"
#include "parasiteP.h" /* ick */
#ifdef HAVE_IPC_H #ifdef HAVE_IPC_H
#include <sys/ipc.h> #include <sys/ipc.h>
@ -2624,6 +2626,13 @@ plug_in_params_to_args (GPParam *params,
case PDB_PATH: case PDB_PATH:
args[i].value.pdb_int = params[i].data.d_path; args[i].value.pdb_int = params[i].data.d_path;
break; break;
case PDB_PARASITE:
if (full_copy)
args[i].value.pdb_pointer = parasite_copy ((Parasite *)
&(params[i].data.d_parasite));
else
args[i].value.pdb_pointer = (void *)&(params[i].data.d_parasite);
break;
case PDB_STATUS: case PDB_STATUS:
args[i].value.pdb_int = params[i].data.d_status; args[i].value.pdb_int = params[i].data.d_status;
break; break;
@ -2782,6 +2791,35 @@ plug_in_args_to_params (Argument *args,
case PDB_PATH: case PDB_PATH:
params[i].data.d_path = args[i].value.pdb_int; params[i].data.d_path = args[i].value.pdb_int;
break; break;
case PDB_PARASITE:
if (full_copy)
{
Parasite *tmp;
tmp = parasite_copy (args[i].value.pdb_pointer);
if (tmp == NULL)
{
params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0;
}
else
{
memcpy (&params[i].data.d_parasite, tmp, sizeof(Parasite));
g_free(tmp);
}
}
else
{
if (args[i].value.pdb_pointer == NULL)
{
params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0;
}
else
memcpy (&params[i].data.d_parasite,
(Parasite *)(args[i].value.pdb_pointer),
sizeof(Parasite));
}
break;
case PDB_STATUS: case PDB_STATUS:
params[i].data.d_status = args[i].value.pdb_int; params[i].data.d_status = args[i].value.pdb_int;
break; break;
@ -2850,6 +2888,15 @@ plug_in_params_destroy (GPParam *params,
case PDB_SELECTION: case PDB_SELECTION:
case PDB_BOUNDARY: case PDB_BOUNDARY:
case PDB_PATH: case PDB_PATH:
break;
case PDB_PARASITE:
if (full_destroy)
if (params[i].data.d_parasite.data)
{
g_free (params[i].data.d_parasite.data);
params[i].data.d_parasite.data = 0;
}
break;
case PDB_STATUS: case PDB_STATUS:
break; break;
case PDB_END: case PDB_END:
@ -2924,6 +2971,14 @@ plug_in_args_destroy (Argument *args,
case PDB_SELECTION: case PDB_SELECTION:
case PDB_BOUNDARY: case PDB_BOUNDARY:
case PDB_PATH: case PDB_PATH:
break;
case PDB_PARASITE:
if (full_destroy)
{
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
args[i].value.pdb_pointer = NULL; */
}
break;
case PDB_STATUS: case PDB_STATUS:
break; break;
case PDB_END: case PDB_END:

View File

@ -28,6 +28,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "parasite.h"
#include "parasiteP.h" /* ick */
#ifdef HAVE_IPC_H #ifdef HAVE_IPC_H
#include <sys/ipc.h> #include <sys/ipc.h>
@ -2624,6 +2626,13 @@ plug_in_params_to_args (GPParam *params,
case PDB_PATH: case PDB_PATH:
args[i].value.pdb_int = params[i].data.d_path; args[i].value.pdb_int = params[i].data.d_path;
break; break;
case PDB_PARASITE:
if (full_copy)
args[i].value.pdb_pointer = parasite_copy ((Parasite *)
&(params[i].data.d_parasite));
else
args[i].value.pdb_pointer = (void *)&(params[i].data.d_parasite);
break;
case PDB_STATUS: case PDB_STATUS:
args[i].value.pdb_int = params[i].data.d_status; args[i].value.pdb_int = params[i].data.d_status;
break; break;
@ -2782,6 +2791,35 @@ plug_in_args_to_params (Argument *args,
case PDB_PATH: case PDB_PATH:
params[i].data.d_path = args[i].value.pdb_int; params[i].data.d_path = args[i].value.pdb_int;
break; break;
case PDB_PARASITE:
if (full_copy)
{
Parasite *tmp;
tmp = parasite_copy (args[i].value.pdb_pointer);
if (tmp == NULL)
{
params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0;
}
else
{
memcpy (&params[i].data.d_parasite, tmp, sizeof(Parasite));
g_free(tmp);
}
}
else
{
if (args[i].value.pdb_pointer == NULL)
{
params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0;
}
else
memcpy (&params[i].data.d_parasite,
(Parasite *)(args[i].value.pdb_pointer),
sizeof(Parasite));
}
break;
case PDB_STATUS: case PDB_STATUS:
params[i].data.d_status = args[i].value.pdb_int; params[i].data.d_status = args[i].value.pdb_int;
break; break;
@ -2850,6 +2888,15 @@ plug_in_params_destroy (GPParam *params,
case PDB_SELECTION: case PDB_SELECTION:
case PDB_BOUNDARY: case PDB_BOUNDARY:
case PDB_PATH: case PDB_PATH:
break;
case PDB_PARASITE:
if (full_destroy)
if (params[i].data.d_parasite.data)
{
g_free (params[i].data.d_parasite.data);
params[i].data.d_parasite.data = 0;
}
break;
case PDB_STATUS: case PDB_STATUS:
break; break;
case PDB_END: case PDB_END:
@ -2924,6 +2971,14 @@ plug_in_args_destroy (Argument *args,
case PDB_SELECTION: case PDB_SELECTION:
case PDB_BOUNDARY: case PDB_BOUNDARY:
case PDB_PATH: case PDB_PATH:
break;
case PDB_PARASITE:
if (full_destroy)
{
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
args[i].value.pdb_pointer = NULL; */
}
break;
case PDB_STATUS: case PDB_STATUS:
break; break;
case PDB_END: case PDB_END:

View File

@ -28,6 +28,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "parasite.h"
#include "parasiteP.h" /* ick */
#ifdef HAVE_IPC_H #ifdef HAVE_IPC_H
#include <sys/ipc.h> #include <sys/ipc.h>
@ -2624,6 +2626,13 @@ plug_in_params_to_args (GPParam *params,
case PDB_PATH: case PDB_PATH:
args[i].value.pdb_int = params[i].data.d_path; args[i].value.pdb_int = params[i].data.d_path;
break; break;
case PDB_PARASITE:
if (full_copy)
args[i].value.pdb_pointer = parasite_copy ((Parasite *)
&(params[i].data.d_parasite));
else
args[i].value.pdb_pointer = (void *)&(params[i].data.d_parasite);
break;
case PDB_STATUS: case PDB_STATUS:
args[i].value.pdb_int = params[i].data.d_status; args[i].value.pdb_int = params[i].data.d_status;
break; break;
@ -2782,6 +2791,35 @@ plug_in_args_to_params (Argument *args,
case PDB_PATH: case PDB_PATH:
params[i].data.d_path = args[i].value.pdb_int; params[i].data.d_path = args[i].value.pdb_int;
break; break;
case PDB_PARASITE:
if (full_copy)
{
Parasite *tmp;
tmp = parasite_copy (args[i].value.pdb_pointer);
if (tmp == NULL)
{
params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0;
}
else
{
memcpy (&params[i].data.d_parasite, tmp, sizeof(Parasite));
g_free(tmp);
}
}
else
{
if (args[i].value.pdb_pointer == NULL)
{
params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0;
}
else
memcpy (&params[i].data.d_parasite,
(Parasite *)(args[i].value.pdb_pointer),
sizeof(Parasite));
}
break;
case PDB_STATUS: case PDB_STATUS:
params[i].data.d_status = args[i].value.pdb_int; params[i].data.d_status = args[i].value.pdb_int;
break; break;
@ -2850,6 +2888,15 @@ plug_in_params_destroy (GPParam *params,
case PDB_SELECTION: case PDB_SELECTION:
case PDB_BOUNDARY: case PDB_BOUNDARY:
case PDB_PATH: case PDB_PATH:
break;
case PDB_PARASITE:
if (full_destroy)
if (params[i].data.d_parasite.data)
{
g_free (params[i].data.d_parasite.data);
params[i].data.d_parasite.data = 0;
}
break;
case PDB_STATUS: case PDB_STATUS:
break; break;
case PDB_END: case PDB_END:
@ -2924,6 +2971,14 @@ plug_in_args_destroy (Argument *args,
case PDB_SELECTION: case PDB_SELECTION:
case PDB_BOUNDARY: case PDB_BOUNDARY:
case PDB_PATH: case PDB_PATH:
break;
case PDB_PARASITE:
if (full_destroy)
{
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
args[i].value.pdb_pointer = NULL; */
}
break;
case PDB_STATUS: case PDB_STATUS:
break; break;
case PDB_END: case PDB_END:

View File

@ -28,6 +28,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "parasite.h"
#include "parasiteP.h" /* ick */
#ifdef HAVE_IPC_H #ifdef HAVE_IPC_H
#include <sys/ipc.h> #include <sys/ipc.h>
@ -2624,6 +2626,13 @@ plug_in_params_to_args (GPParam *params,
case PDB_PATH: case PDB_PATH:
args[i].value.pdb_int = params[i].data.d_path; args[i].value.pdb_int = params[i].data.d_path;
break; break;
case PDB_PARASITE:
if (full_copy)
args[i].value.pdb_pointer = parasite_copy ((Parasite *)
&(params[i].data.d_parasite));
else
args[i].value.pdb_pointer = (void *)&(params[i].data.d_parasite);
break;
case PDB_STATUS: case PDB_STATUS:
args[i].value.pdb_int = params[i].data.d_status; args[i].value.pdb_int = params[i].data.d_status;
break; break;
@ -2782,6 +2791,35 @@ plug_in_args_to_params (Argument *args,
case PDB_PATH: case PDB_PATH:
params[i].data.d_path = args[i].value.pdb_int; params[i].data.d_path = args[i].value.pdb_int;
break; break;
case PDB_PARASITE:
if (full_copy)
{
Parasite *tmp;
tmp = parasite_copy (args[i].value.pdb_pointer);
if (tmp == NULL)
{
params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0;
}
else
{
memcpy (&params[i].data.d_parasite, tmp, sizeof(Parasite));
g_free(tmp);
}
}
else
{
if (args[i].value.pdb_pointer == NULL)
{
params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0;
}
else
memcpy (&params[i].data.d_parasite,
(Parasite *)(args[i].value.pdb_pointer),
sizeof(Parasite));
}
break;
case PDB_STATUS: case PDB_STATUS:
params[i].data.d_status = args[i].value.pdb_int; params[i].data.d_status = args[i].value.pdb_int;
break; break;
@ -2850,6 +2888,15 @@ plug_in_params_destroy (GPParam *params,
case PDB_SELECTION: case PDB_SELECTION:
case PDB_BOUNDARY: case PDB_BOUNDARY:
case PDB_PATH: case PDB_PATH:
break;
case PDB_PARASITE:
if (full_destroy)
if (params[i].data.d_parasite.data)
{
g_free (params[i].data.d_parasite.data);
params[i].data.d_parasite.data = 0;
}
break;
case PDB_STATUS: case PDB_STATUS:
break; break;
case PDB_END: case PDB_END:
@ -2924,6 +2971,14 @@ plug_in_args_destroy (Argument *args,
case PDB_SELECTION: case PDB_SELECTION:
case PDB_BOUNDARY: case PDB_BOUNDARY:
case PDB_PATH: case PDB_PATH:
break;
case PDB_PARASITE:
if (full_destroy)
{
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
args[i].value.pdb_pointer = NULL; */
}
break;
case PDB_STATUS: case PDB_STATUS:
break; break;
case PDB_END: case PDB_END:

View File

@ -28,6 +28,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "parasite.h"
#include "parasiteP.h" /* ick */
#ifdef HAVE_IPC_H #ifdef HAVE_IPC_H
#include <sys/ipc.h> #include <sys/ipc.h>
@ -2624,6 +2626,13 @@ plug_in_params_to_args (GPParam *params,
case PDB_PATH: case PDB_PATH:
args[i].value.pdb_int = params[i].data.d_path; args[i].value.pdb_int = params[i].data.d_path;
break; break;
case PDB_PARASITE:
if (full_copy)
args[i].value.pdb_pointer = parasite_copy ((Parasite *)
&(params[i].data.d_parasite));
else
args[i].value.pdb_pointer = (void *)&(params[i].data.d_parasite);
break;
case PDB_STATUS: case PDB_STATUS:
args[i].value.pdb_int = params[i].data.d_status; args[i].value.pdb_int = params[i].data.d_status;
break; break;
@ -2782,6 +2791,35 @@ plug_in_args_to_params (Argument *args,
case PDB_PATH: case PDB_PATH:
params[i].data.d_path = args[i].value.pdb_int; params[i].data.d_path = args[i].value.pdb_int;
break; break;
case PDB_PARASITE:
if (full_copy)
{
Parasite *tmp;
tmp = parasite_copy (args[i].value.pdb_pointer);
if (tmp == NULL)
{
params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0;
}
else
{
memcpy (&params[i].data.d_parasite, tmp, sizeof(Parasite));
g_free(tmp);
}
}
else
{
if (args[i].value.pdb_pointer == NULL)
{
params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0;
}
else
memcpy (&params[i].data.d_parasite,
(Parasite *)(args[i].value.pdb_pointer),
sizeof(Parasite));
}
break;
case PDB_STATUS: case PDB_STATUS:
params[i].data.d_status = args[i].value.pdb_int; params[i].data.d_status = args[i].value.pdb_int;
break; break;
@ -2850,6 +2888,15 @@ plug_in_params_destroy (GPParam *params,
case PDB_SELECTION: case PDB_SELECTION:
case PDB_BOUNDARY: case PDB_BOUNDARY:
case PDB_PATH: case PDB_PATH:
break;
case PDB_PARASITE:
if (full_destroy)
if (params[i].data.d_parasite.data)
{
g_free (params[i].data.d_parasite.data);
params[i].data.d_parasite.data = 0;
}
break;
case PDB_STATUS: case PDB_STATUS:
break; break;
case PDB_END: case PDB_END:
@ -2924,6 +2971,14 @@ plug_in_args_destroy (Argument *args,
case PDB_SELECTION: case PDB_SELECTION:
case PDB_BOUNDARY: case PDB_BOUNDARY:
case PDB_PATH: case PDB_PATH:
break;
case PDB_PARASITE:
if (full_destroy)
{
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
args[i].value.pdb_pointer = NULL; */
}
break;
case PDB_STATUS: case PDB_STATUS:
break; break;
case PDB_END: case PDB_END:

View File

@ -28,6 +28,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "parasite.h"
#include "parasiteP.h" /* ick */
#ifdef HAVE_IPC_H #ifdef HAVE_IPC_H
#include <sys/ipc.h> #include <sys/ipc.h>
@ -2624,6 +2626,13 @@ plug_in_params_to_args (GPParam *params,
case PDB_PATH: case PDB_PATH:
args[i].value.pdb_int = params[i].data.d_path; args[i].value.pdb_int = params[i].data.d_path;
break; break;
case PDB_PARASITE:
if (full_copy)
args[i].value.pdb_pointer = parasite_copy ((Parasite *)
&(params[i].data.d_parasite));
else
args[i].value.pdb_pointer = (void *)&(params[i].data.d_parasite);
break;
case PDB_STATUS: case PDB_STATUS:
args[i].value.pdb_int = params[i].data.d_status; args[i].value.pdb_int = params[i].data.d_status;
break; break;
@ -2782,6 +2791,35 @@ plug_in_args_to_params (Argument *args,
case PDB_PATH: case PDB_PATH:
params[i].data.d_path = args[i].value.pdb_int; params[i].data.d_path = args[i].value.pdb_int;
break; break;
case PDB_PARASITE:
if (full_copy)
{
Parasite *tmp;
tmp = parasite_copy (args[i].value.pdb_pointer);
if (tmp == NULL)
{
params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0;
}
else
{
memcpy (&params[i].data.d_parasite, tmp, sizeof(Parasite));
g_free(tmp);
}
}
else
{
if (args[i].value.pdb_pointer == NULL)
{
params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0;
}
else
memcpy (&params[i].data.d_parasite,
(Parasite *)(args[i].value.pdb_pointer),
sizeof(Parasite));
}
break;
case PDB_STATUS: case PDB_STATUS:
params[i].data.d_status = args[i].value.pdb_int; params[i].data.d_status = args[i].value.pdb_int;
break; break;
@ -2850,6 +2888,15 @@ plug_in_params_destroy (GPParam *params,
case PDB_SELECTION: case PDB_SELECTION:
case PDB_BOUNDARY: case PDB_BOUNDARY:
case PDB_PATH: case PDB_PATH:
break;
case PDB_PARASITE:
if (full_destroy)
if (params[i].data.d_parasite.data)
{
g_free (params[i].data.d_parasite.data);
params[i].data.d_parasite.data = 0;
}
break;
case PDB_STATUS: case PDB_STATUS:
break; break;
case PDB_END: case PDB_END:
@ -2924,6 +2971,14 @@ plug_in_args_destroy (Argument *args,
case PDB_SELECTION: case PDB_SELECTION:
case PDB_BOUNDARY: case PDB_BOUNDARY:
case PDB_PATH: case PDB_PATH:
break;
case PDB_PARASITE:
if (full_destroy)
{
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
args[i].value.pdb_pointer = NULL; */
}
break;
case PDB_STATUS: case PDB_STATUS:
break; break;
case PDB_END: case PDB_END:

View File

@ -28,6 +28,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "parasite.h"
#include "parasiteP.h" /* ick */
#ifdef HAVE_IPC_H #ifdef HAVE_IPC_H
#include <sys/ipc.h> #include <sys/ipc.h>
@ -2624,6 +2626,13 @@ plug_in_params_to_args (GPParam *params,
case PDB_PATH: case PDB_PATH:
args[i].value.pdb_int = params[i].data.d_path; args[i].value.pdb_int = params[i].data.d_path;
break; break;
case PDB_PARASITE:
if (full_copy)
args[i].value.pdb_pointer = parasite_copy ((Parasite *)
&(params[i].data.d_parasite));
else
args[i].value.pdb_pointer = (void *)&(params[i].data.d_parasite);
break;
case PDB_STATUS: case PDB_STATUS:
args[i].value.pdb_int = params[i].data.d_status; args[i].value.pdb_int = params[i].data.d_status;
break; break;
@ -2782,6 +2791,35 @@ plug_in_args_to_params (Argument *args,
case PDB_PATH: case PDB_PATH:
params[i].data.d_path = args[i].value.pdb_int; params[i].data.d_path = args[i].value.pdb_int;
break; break;
case PDB_PARASITE:
if (full_copy)
{
Parasite *tmp;
tmp = parasite_copy (args[i].value.pdb_pointer);
if (tmp == NULL)
{
params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0;
}
else
{
memcpy (&params[i].data.d_parasite, tmp, sizeof(Parasite));
g_free(tmp);
}
}
else
{
if (args[i].value.pdb_pointer == NULL)
{
params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0;
}
else
memcpy (&params[i].data.d_parasite,
(Parasite *)(args[i].value.pdb_pointer),
sizeof(Parasite));
}
break;
case PDB_STATUS: case PDB_STATUS:
params[i].data.d_status = args[i].value.pdb_int; params[i].data.d_status = args[i].value.pdb_int;
break; break;
@ -2850,6 +2888,15 @@ plug_in_params_destroy (GPParam *params,
case PDB_SELECTION: case PDB_SELECTION:
case PDB_BOUNDARY: case PDB_BOUNDARY:
case PDB_PATH: case PDB_PATH:
break;
case PDB_PARASITE:
if (full_destroy)
if (params[i].data.d_parasite.data)
{
g_free (params[i].data.d_parasite.data);
params[i].data.d_parasite.data = 0;
}
break;
case PDB_STATUS: case PDB_STATUS:
break; break;
case PDB_END: case PDB_END:
@ -2924,6 +2971,14 @@ plug_in_args_destroy (Argument *args,
case PDB_SELECTION: case PDB_SELECTION:
case PDB_BOUNDARY: case PDB_BOUNDARY:
case PDB_PATH: case PDB_PATH:
break;
case PDB_PARASITE:
if (full_destroy)
{
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
args[i].value.pdb_pointer = NULL; */
}
break;
case PDB_STATUS: case PDB_STATUS:
break; break;
case PDB_END: case PDB_END:

View File

@ -28,6 +28,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "parasite.h"
#include "parasiteP.h" /* ick */
#ifdef HAVE_IPC_H #ifdef HAVE_IPC_H
#include <sys/ipc.h> #include <sys/ipc.h>
@ -2624,6 +2626,13 @@ plug_in_params_to_args (GPParam *params,
case PDB_PATH: case PDB_PATH:
args[i].value.pdb_int = params[i].data.d_path; args[i].value.pdb_int = params[i].data.d_path;
break; break;
case PDB_PARASITE:
if (full_copy)
args[i].value.pdb_pointer = parasite_copy ((Parasite *)
&(params[i].data.d_parasite));
else
args[i].value.pdb_pointer = (void *)&(params[i].data.d_parasite);
break;
case PDB_STATUS: case PDB_STATUS:
args[i].value.pdb_int = params[i].data.d_status; args[i].value.pdb_int = params[i].data.d_status;
break; break;
@ -2782,6 +2791,35 @@ plug_in_args_to_params (Argument *args,
case PDB_PATH: case PDB_PATH:
params[i].data.d_path = args[i].value.pdb_int; params[i].data.d_path = args[i].value.pdb_int;
break; break;
case PDB_PARASITE:
if (full_copy)
{
Parasite *tmp;
tmp = parasite_copy (args[i].value.pdb_pointer);
if (tmp == NULL)
{
params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0;
}
else
{
memcpy (&params[i].data.d_parasite, tmp, sizeof(Parasite));
g_free(tmp);
}
}
else
{
if (args[i].value.pdb_pointer == NULL)
{
params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0;
}
else
memcpy (&params[i].data.d_parasite,
(Parasite *)(args[i].value.pdb_pointer),
sizeof(Parasite));
}
break;
case PDB_STATUS: case PDB_STATUS:
params[i].data.d_status = args[i].value.pdb_int; params[i].data.d_status = args[i].value.pdb_int;
break; break;
@ -2850,6 +2888,15 @@ plug_in_params_destroy (GPParam *params,
case PDB_SELECTION: case PDB_SELECTION:
case PDB_BOUNDARY: case PDB_BOUNDARY:
case PDB_PATH: case PDB_PATH:
break;
case PDB_PARASITE:
if (full_destroy)
if (params[i].data.d_parasite.data)
{
g_free (params[i].data.d_parasite.data);
params[i].data.d_parasite.data = 0;
}
break;
case PDB_STATUS: case PDB_STATUS:
break; break;
case PDB_END: case PDB_END:
@ -2924,6 +2971,14 @@ plug_in_args_destroy (Argument *args,
case PDB_SELECTION: case PDB_SELECTION:
case PDB_BOUNDARY: case PDB_BOUNDARY:
case PDB_PATH: case PDB_PATH:
break;
case PDB_PARASITE:
if (full_destroy)
{
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
args[i].value.pdb_pointer = NULL; */
}
break;
case PDB_STATUS: case PDB_STATUS:
break; break;
case PDB_END: case PDB_END:

View File

@ -28,6 +28,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "parasite.h"
#include "parasiteP.h" /* ick */
#ifdef HAVE_IPC_H #ifdef HAVE_IPC_H
#include <sys/ipc.h> #include <sys/ipc.h>
@ -2624,6 +2626,13 @@ plug_in_params_to_args (GPParam *params,
case PDB_PATH: case PDB_PATH:
args[i].value.pdb_int = params[i].data.d_path; args[i].value.pdb_int = params[i].data.d_path;
break; break;
case PDB_PARASITE:
if (full_copy)
args[i].value.pdb_pointer = parasite_copy ((Parasite *)
&(params[i].data.d_parasite));
else
args[i].value.pdb_pointer = (void *)&(params[i].data.d_parasite);
break;
case PDB_STATUS: case PDB_STATUS:
args[i].value.pdb_int = params[i].data.d_status; args[i].value.pdb_int = params[i].data.d_status;
break; break;
@ -2782,6 +2791,35 @@ plug_in_args_to_params (Argument *args,
case PDB_PATH: case PDB_PATH:
params[i].data.d_path = args[i].value.pdb_int; params[i].data.d_path = args[i].value.pdb_int;
break; break;
case PDB_PARASITE:
if (full_copy)
{
Parasite *tmp;
tmp = parasite_copy (args[i].value.pdb_pointer);
if (tmp == NULL)
{
params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0;
}
else
{
memcpy (&params[i].data.d_parasite, tmp, sizeof(Parasite));
g_free(tmp);
}
}
else
{
if (args[i].value.pdb_pointer == NULL)
{
params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0;
}
else
memcpy (&params[i].data.d_parasite,
(Parasite *)(args[i].value.pdb_pointer),
sizeof(Parasite));
}
break;
case PDB_STATUS: case PDB_STATUS:
params[i].data.d_status = args[i].value.pdb_int; params[i].data.d_status = args[i].value.pdb_int;
break; break;
@ -2850,6 +2888,15 @@ plug_in_params_destroy (GPParam *params,
case PDB_SELECTION: case PDB_SELECTION:
case PDB_BOUNDARY: case PDB_BOUNDARY:
case PDB_PATH: case PDB_PATH:
break;
case PDB_PARASITE:
if (full_destroy)
if (params[i].data.d_parasite.data)
{
g_free (params[i].data.d_parasite.data);
params[i].data.d_parasite.data = 0;
}
break;
case PDB_STATUS: case PDB_STATUS:
break; break;
case PDB_END: case PDB_END:
@ -2924,6 +2971,14 @@ plug_in_args_destroy (Argument *args,
case PDB_SELECTION: case PDB_SELECTION:
case PDB_BOUNDARY: case PDB_BOUNDARY:
case PDB_PATH: case PDB_PATH:
break;
case PDB_PARASITE:
if (full_destroy)
{
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
args[i].value.pdb_pointer = NULL; */
}
break;
case PDB_STATUS: case PDB_STATUS:
break; break;
case PDB_END: case PDB_END:

View File

@ -28,6 +28,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "parasite.h"
#include "parasiteP.h" /* ick */
#ifdef HAVE_IPC_H #ifdef HAVE_IPC_H
#include <sys/ipc.h> #include <sys/ipc.h>
@ -2624,6 +2626,13 @@ plug_in_params_to_args (GPParam *params,
case PDB_PATH: case PDB_PATH:
args[i].value.pdb_int = params[i].data.d_path; args[i].value.pdb_int = params[i].data.d_path;
break; break;
case PDB_PARASITE:
if (full_copy)
args[i].value.pdb_pointer = parasite_copy ((Parasite *)
&(params[i].data.d_parasite));
else
args[i].value.pdb_pointer = (void *)&(params[i].data.d_parasite);
break;
case PDB_STATUS: case PDB_STATUS:
args[i].value.pdb_int = params[i].data.d_status; args[i].value.pdb_int = params[i].data.d_status;
break; break;
@ -2782,6 +2791,35 @@ plug_in_args_to_params (Argument *args,
case PDB_PATH: case PDB_PATH:
params[i].data.d_path = args[i].value.pdb_int; params[i].data.d_path = args[i].value.pdb_int;
break; break;
case PDB_PARASITE:
if (full_copy)
{
Parasite *tmp;
tmp = parasite_copy (args[i].value.pdb_pointer);
if (tmp == NULL)
{
params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0;
}
else
{
memcpy (&params[i].data.d_parasite, tmp, sizeof(Parasite));
g_free(tmp);
}
}
else
{
if (args[i].value.pdb_pointer == NULL)
{
params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0;
}
else
memcpy (&params[i].data.d_parasite,
(Parasite *)(args[i].value.pdb_pointer),
sizeof(Parasite));
}
break;
case PDB_STATUS: case PDB_STATUS:
params[i].data.d_status = args[i].value.pdb_int; params[i].data.d_status = args[i].value.pdb_int;
break; break;
@ -2850,6 +2888,15 @@ plug_in_params_destroy (GPParam *params,
case PDB_SELECTION: case PDB_SELECTION:
case PDB_BOUNDARY: case PDB_BOUNDARY:
case PDB_PATH: case PDB_PATH:
break;
case PDB_PARASITE:
if (full_destroy)
if (params[i].data.d_parasite.data)
{
g_free (params[i].data.d_parasite.data);
params[i].data.d_parasite.data = 0;
}
break;
case PDB_STATUS: case PDB_STATUS:
break; break;
case PDB_END: case PDB_END:
@ -2924,6 +2971,14 @@ plug_in_args_destroy (Argument *args,
case PDB_SELECTION: case PDB_SELECTION:
case PDB_BOUNDARY: case PDB_BOUNDARY:
case PDB_PATH: case PDB_PATH:
break;
case PDB_PARASITE:
if (full_destroy)
{
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
args[i].value.pdb_pointer = NULL; */
}
break;
case PDB_STATUS: case PDB_STATUS:
break; break;
case PDB_END: case PDB_END:

View File

@ -28,6 +28,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "parasite.h"
#include "parasiteP.h" /* ick */
#ifdef HAVE_IPC_H #ifdef HAVE_IPC_H
#include <sys/ipc.h> #include <sys/ipc.h>
@ -2624,6 +2626,13 @@ plug_in_params_to_args (GPParam *params,
case PDB_PATH: case PDB_PATH:
args[i].value.pdb_int = params[i].data.d_path; args[i].value.pdb_int = params[i].data.d_path;
break; break;
case PDB_PARASITE:
if (full_copy)
args[i].value.pdb_pointer = parasite_copy ((Parasite *)
&(params[i].data.d_parasite));
else
args[i].value.pdb_pointer = (void *)&(params[i].data.d_parasite);
break;
case PDB_STATUS: case PDB_STATUS:
args[i].value.pdb_int = params[i].data.d_status; args[i].value.pdb_int = params[i].data.d_status;
break; break;
@ -2782,6 +2791,35 @@ plug_in_args_to_params (Argument *args,
case PDB_PATH: case PDB_PATH:
params[i].data.d_path = args[i].value.pdb_int; params[i].data.d_path = args[i].value.pdb_int;
break; break;
case PDB_PARASITE:
if (full_copy)
{
Parasite *tmp;
tmp = parasite_copy (args[i].value.pdb_pointer);
if (tmp == NULL)
{
params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0;
}
else
{
memcpy (&params[i].data.d_parasite, tmp, sizeof(Parasite));
g_free(tmp);
}
}
else
{
if (args[i].value.pdb_pointer == NULL)
{
params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0;
}
else
memcpy (&params[i].data.d_parasite,
(Parasite *)(args[i].value.pdb_pointer),
sizeof(Parasite));
}
break;
case PDB_STATUS: case PDB_STATUS:
params[i].data.d_status = args[i].value.pdb_int; params[i].data.d_status = args[i].value.pdb_int;
break; break;
@ -2850,6 +2888,15 @@ plug_in_params_destroy (GPParam *params,
case PDB_SELECTION: case PDB_SELECTION:
case PDB_BOUNDARY: case PDB_BOUNDARY:
case PDB_PATH: case PDB_PATH:
break;
case PDB_PARASITE:
if (full_destroy)
if (params[i].data.d_parasite.data)
{
g_free (params[i].data.d_parasite.data);
params[i].data.d_parasite.data = 0;
}
break;
case PDB_STATUS: case PDB_STATUS:
break; break;
case PDB_END: case PDB_END:
@ -2924,6 +2971,14 @@ plug_in_args_destroy (Argument *args,
case PDB_SELECTION: case PDB_SELECTION:
case PDB_BOUNDARY: case PDB_BOUNDARY:
case PDB_PATH: case PDB_PATH:
break;
case PDB_PARASITE:
if (full_destroy)
{
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
args[i].value.pdb_pointer = NULL; */
}
break;
case PDB_STATUS: case PDB_STATUS:
break; break;
case PDB_END: case PDB_END:

View File

@ -28,6 +28,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "parasite.h"
#include "parasiteP.h" /* ick */
#ifdef HAVE_IPC_H #ifdef HAVE_IPC_H
#include <sys/ipc.h> #include <sys/ipc.h>
@ -2624,6 +2626,13 @@ plug_in_params_to_args (GPParam *params,
case PDB_PATH: case PDB_PATH:
args[i].value.pdb_int = params[i].data.d_path; args[i].value.pdb_int = params[i].data.d_path;
break; break;
case PDB_PARASITE:
if (full_copy)
args[i].value.pdb_pointer = parasite_copy ((Parasite *)
&(params[i].data.d_parasite));
else
args[i].value.pdb_pointer = (void *)&(params[i].data.d_parasite);
break;
case PDB_STATUS: case PDB_STATUS:
args[i].value.pdb_int = params[i].data.d_status; args[i].value.pdb_int = params[i].data.d_status;
break; break;
@ -2782,6 +2791,35 @@ plug_in_args_to_params (Argument *args,
case PDB_PATH: case PDB_PATH:
params[i].data.d_path = args[i].value.pdb_int; params[i].data.d_path = args[i].value.pdb_int;
break; break;
case PDB_PARASITE:
if (full_copy)
{
Parasite *tmp;
tmp = parasite_copy (args[i].value.pdb_pointer);
if (tmp == NULL)
{
params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0;
}
else
{
memcpy (&params[i].data.d_parasite, tmp, sizeof(Parasite));
g_free(tmp);
}
}
else
{
if (args[i].value.pdb_pointer == NULL)
{
params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0;
}
else
memcpy (&params[i].data.d_parasite,
(Parasite *)(args[i].value.pdb_pointer),
sizeof(Parasite));
}
break;
case PDB_STATUS: case PDB_STATUS:
params[i].data.d_status = args[i].value.pdb_int; params[i].data.d_status = args[i].value.pdb_int;
break; break;
@ -2850,6 +2888,15 @@ plug_in_params_destroy (GPParam *params,
case PDB_SELECTION: case PDB_SELECTION:
case PDB_BOUNDARY: case PDB_BOUNDARY:
case PDB_PATH: case PDB_PATH:
break;
case PDB_PARASITE:
if (full_destroy)
if (params[i].data.d_parasite.data)
{
g_free (params[i].data.d_parasite.data);
params[i].data.d_parasite.data = 0;
}
break;
case PDB_STATUS: case PDB_STATUS:
break; break;
case PDB_END: case PDB_END:
@ -2924,6 +2971,14 @@ plug_in_args_destroy (Argument *args,
case PDB_SELECTION: case PDB_SELECTION:
case PDB_BOUNDARY: case PDB_BOUNDARY:
case PDB_PATH: case PDB_PATH:
break;
case PDB_PARASITE:
if (full_destroy)
{
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
args[i].value.pdb_pointer = NULL; */
}
break;
case PDB_STATUS: case PDB_STATUS:
break; break;
case PDB_END: case PDB_END:

View File

@ -28,6 +28,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "parasite.h"
#include "parasiteP.h" /* ick */
#ifdef HAVE_IPC_H #ifdef HAVE_IPC_H
#include <sys/ipc.h> #include <sys/ipc.h>
@ -2624,6 +2626,13 @@ plug_in_params_to_args (GPParam *params,
case PDB_PATH: case PDB_PATH:
args[i].value.pdb_int = params[i].data.d_path; args[i].value.pdb_int = params[i].data.d_path;
break; break;
case PDB_PARASITE:
if (full_copy)
args[i].value.pdb_pointer = parasite_copy ((Parasite *)
&(params[i].data.d_parasite));
else
args[i].value.pdb_pointer = (void *)&(params[i].data.d_parasite);
break;
case PDB_STATUS: case PDB_STATUS:
args[i].value.pdb_int = params[i].data.d_status; args[i].value.pdb_int = params[i].data.d_status;
break; break;
@ -2782,6 +2791,35 @@ plug_in_args_to_params (Argument *args,
case PDB_PATH: case PDB_PATH:
params[i].data.d_path = args[i].value.pdb_int; params[i].data.d_path = args[i].value.pdb_int;
break; break;
case PDB_PARASITE:
if (full_copy)
{
Parasite *tmp;
tmp = parasite_copy (args[i].value.pdb_pointer);
if (tmp == NULL)
{
params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0;
}
else
{
memcpy (&params[i].data.d_parasite, tmp, sizeof(Parasite));
g_free(tmp);
}
}
else
{
if (args[i].value.pdb_pointer == NULL)
{
params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0;
}
else
memcpy (&params[i].data.d_parasite,
(Parasite *)(args[i].value.pdb_pointer),
sizeof(Parasite));
}
break;
case PDB_STATUS: case PDB_STATUS:
params[i].data.d_status = args[i].value.pdb_int; params[i].data.d_status = args[i].value.pdb_int;
break; break;
@ -2850,6 +2888,15 @@ plug_in_params_destroy (GPParam *params,
case PDB_SELECTION: case PDB_SELECTION:
case PDB_BOUNDARY: case PDB_BOUNDARY:
case PDB_PATH: case PDB_PATH:
break;
case PDB_PARASITE:
if (full_destroy)
if (params[i].data.d_parasite.data)
{
g_free (params[i].data.d_parasite.data);
params[i].data.d_parasite.data = 0;
}
break;
case PDB_STATUS: case PDB_STATUS:
break; break;
case PDB_END: case PDB_END:
@ -2924,6 +2971,14 @@ plug_in_args_destroy (Argument *args,
case PDB_SELECTION: case PDB_SELECTION:
case PDB_BOUNDARY: case PDB_BOUNDARY:
case PDB_PATH: case PDB_PATH:
break;
case PDB_PARASITE:
if (full_destroy)
{
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
args[i].value.pdb_pointer = NULL; */
}
break;
case PDB_STATUS: case PDB_STATUS:
break; break;
case PDB_END: case PDB_END:

View File

@ -28,6 +28,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "parasite.h"
#include "parasiteP.h" /* ick */
#ifdef HAVE_IPC_H #ifdef HAVE_IPC_H
#include <sys/ipc.h> #include <sys/ipc.h>
@ -2624,6 +2626,13 @@ plug_in_params_to_args (GPParam *params,
case PDB_PATH: case PDB_PATH:
args[i].value.pdb_int = params[i].data.d_path; args[i].value.pdb_int = params[i].data.d_path;
break; break;
case PDB_PARASITE:
if (full_copy)
args[i].value.pdb_pointer = parasite_copy ((Parasite *)
&(params[i].data.d_parasite));
else
args[i].value.pdb_pointer = (void *)&(params[i].data.d_parasite);
break;
case PDB_STATUS: case PDB_STATUS:
args[i].value.pdb_int = params[i].data.d_status; args[i].value.pdb_int = params[i].data.d_status;
break; break;
@ -2782,6 +2791,35 @@ plug_in_args_to_params (Argument *args,
case PDB_PATH: case PDB_PATH:
params[i].data.d_path = args[i].value.pdb_int; params[i].data.d_path = args[i].value.pdb_int;
break; break;
case PDB_PARASITE:
if (full_copy)
{
Parasite *tmp;
tmp = parasite_copy (args[i].value.pdb_pointer);
if (tmp == NULL)
{
params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0;
}
else
{
memcpy (&params[i].data.d_parasite, tmp, sizeof(Parasite));
g_free(tmp);
}
}
else
{
if (args[i].value.pdb_pointer == NULL)
{
params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0;
}
else
memcpy (&params[i].data.d_parasite,
(Parasite *)(args[i].value.pdb_pointer),
sizeof(Parasite));
}
break;
case PDB_STATUS: case PDB_STATUS:
params[i].data.d_status = args[i].value.pdb_int; params[i].data.d_status = args[i].value.pdb_int;
break; break;
@ -2850,6 +2888,15 @@ plug_in_params_destroy (GPParam *params,
case PDB_SELECTION: case PDB_SELECTION:
case PDB_BOUNDARY: case PDB_BOUNDARY:
case PDB_PATH: case PDB_PATH:
break;
case PDB_PARASITE:
if (full_destroy)
if (params[i].data.d_parasite.data)
{
g_free (params[i].data.d_parasite.data);
params[i].data.d_parasite.data = 0;
}
break;
case PDB_STATUS: case PDB_STATUS:
break; break;
case PDB_END: case PDB_END:
@ -2924,6 +2971,14 @@ plug_in_args_destroy (Argument *args,
case PDB_SELECTION: case PDB_SELECTION:
case PDB_BOUNDARY: case PDB_BOUNDARY:
case PDB_PATH: case PDB_PATH:
break;
case PDB_PARASITE:
if (full_destroy)
{
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
args[i].value.pdb_pointer = NULL; */
}
break;
case PDB_STATUS: case PDB_STATUS:
break; break;
case PDB_END: case PDB_END:

View File

@ -28,6 +28,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "parasite.h"
#include "parasiteP.h" /* ick */
#ifdef HAVE_IPC_H #ifdef HAVE_IPC_H
#include <sys/ipc.h> #include <sys/ipc.h>
@ -2624,6 +2626,13 @@ plug_in_params_to_args (GPParam *params,
case PDB_PATH: case PDB_PATH:
args[i].value.pdb_int = params[i].data.d_path; args[i].value.pdb_int = params[i].data.d_path;
break; break;
case PDB_PARASITE:
if (full_copy)
args[i].value.pdb_pointer = parasite_copy ((Parasite *)
&(params[i].data.d_parasite));
else
args[i].value.pdb_pointer = (void *)&(params[i].data.d_parasite);
break;
case PDB_STATUS: case PDB_STATUS:
args[i].value.pdb_int = params[i].data.d_status; args[i].value.pdb_int = params[i].data.d_status;
break; break;
@ -2782,6 +2791,35 @@ plug_in_args_to_params (Argument *args,
case PDB_PATH: case PDB_PATH:
params[i].data.d_path = args[i].value.pdb_int; params[i].data.d_path = args[i].value.pdb_int;
break; break;
case PDB_PARASITE:
if (full_copy)
{
Parasite *tmp;
tmp = parasite_copy (args[i].value.pdb_pointer);
if (tmp == NULL)
{
params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0;
}
else
{
memcpy (&params[i].data.d_parasite, tmp, sizeof(Parasite));
g_free(tmp);
}
}
else
{
if (args[i].value.pdb_pointer == NULL)
{
params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0;
}
else
memcpy (&params[i].data.d_parasite,
(Parasite *)(args[i].value.pdb_pointer),
sizeof(Parasite));
}
break;
case PDB_STATUS: case PDB_STATUS:
params[i].data.d_status = args[i].value.pdb_int; params[i].data.d_status = args[i].value.pdb_int;
break; break;
@ -2850,6 +2888,15 @@ plug_in_params_destroy (GPParam *params,
case PDB_SELECTION: case PDB_SELECTION:
case PDB_BOUNDARY: case PDB_BOUNDARY:
case PDB_PATH: case PDB_PATH:
break;
case PDB_PARASITE:
if (full_destroy)
if (params[i].data.d_parasite.data)
{
g_free (params[i].data.d_parasite.data);
params[i].data.d_parasite.data = 0;
}
break;
case PDB_STATUS: case PDB_STATUS:
break; break;
case PDB_END: case PDB_END:
@ -2924,6 +2971,14 @@ plug_in_args_destroy (Argument *args,
case PDB_SELECTION: case PDB_SELECTION:
case PDB_BOUNDARY: case PDB_BOUNDARY:
case PDB_PATH: case PDB_PATH:
break;
case PDB_PARASITE:
if (full_destroy)
{
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
args[i].value.pdb_pointer = NULL; */
}
break;
case PDB_STATUS: case PDB_STATUS:
break; break;
case PDB_END: case PDB_END:

View File

@ -26,6 +26,7 @@
#include "gdisplay.h" #include "gdisplay.h"
#include "plug_in.h" #include "plug_in.h"
#include "procedural_db.h" #include "procedural_db.h"
#include "parasite.h"
#include "config.h" #include "config.h"
#include "regex.h" #include "regex.h"
@ -99,6 +100,7 @@ static char *type_str[] =
"PDB_SELECTION", "PDB_SELECTION",
"PDB_BOUNDARY", "PDB_BOUNDARY",
"PDB_PATH", "PDB_PATH",
"PDB_PARASITE",
"PDB_STATUS", "PDB_STATUS",
"PDB_END" "PDB_END"
}; };
@ -234,7 +236,7 @@ static ProcArg procedural_db_proc_arg_out_args[] =
{ {
{ PDB_INT32, { PDB_INT32,
"arg_type", "arg_type",
"the type of argument { PDB_INT32 (0), PDB_INT16 (1), PDB_INT8 (2), PDB_FLOAT (3), PDB_STRING (4), PDB_INT32ARRAY (5), PDB_INT16ARRAY (6), PDB_INT8ARRAY (7), PDB_FLOATARRAY (8), PDB_STRINGARRAY (9), PDB_COLOR (10), PDB_REGION (11), PDB_DISPLAY (12), PDB_IMAGE (13), PDB_LAYER (14), PDB_CHANNEL (15), PDB_DRAWABLE (16), PDB_SELECTION (17), PDB_BOUNDARY (18), PDB_PATH (19), PDB_STATUS (20) }" "the type of argument { PDB_INT32 (0), PDB_INT16 (1), PDB_INT8 (2), PDB_FLOAT (3), PDB_STRING (4), PDB_INT32ARRAY (5), PDB_INT16ARRAY (6), PDB_INT8ARRAY (7), PDB_FLOATARRAY (8), PDB_STRINGARRAY (9), PDB_COLOR (10), PDB_REGION (11), PDB_DISPLAY (12), PDB_IMAGE (13), PDB_LAYER (14), PDB_CHANNEL (15), PDB_DRAWABLE (16), PDB_SELECTION (17), PDB_BOUNDARY (18), PDB_PATH (19), PDB_PARASITE (20), PDB_STATUS (21) }"
}, },
{ PDB_STRING, { PDB_STRING,
"arg_name", "arg_name",
@ -288,7 +290,7 @@ static ProcArg procedural_db_proc_val_out_args[] =
{ {
{ PDB_INT32, { PDB_INT32,
"val_type", "val_type",
"the type of return value { PDB_INT32 (0), PDB_INT16 (1), PDB_INT8 (2), PDB_FLOAT (3), PDB_STRING (4), PDB_INT32ARRAY (5), PDB_INT16ARRAY (6), PDB_INT8ARRAY (7), PDB_FLOATARRAY (8), PDB_STRINGARRAY (9), PDB_COLOR (10), PDB_REGION (11), PDB_DISPLAY (12), PDB_IMAGE (13), PDB_LAYER (14), PDB_CHANNEL (15), PDB_DRAWABLE (16), PDB_SELECTION (17), PDB_BOUNDARY (18), PDB_PATH (19), PDB_STATUS (20) }" "the type of return value { PDB_INT32 (0), PDB_INT16 (1), PDB_INT8 (2), PDB_FLOAT (3), PDB_STRING (4), PDB_INT32ARRAY (5), PDB_INT16ARRAY (6), PDB_INT8ARRAY (7), PDB_FLOATARRAY (8), PDB_STRINGARRAY (9), PDB_COLOR (10), PDB_REGION (11), PDB_DISPLAY (12), PDB_IMAGE (13), PDB_LAYER (14), PDB_CHANNEL (15), PDB_DRAWABLE (16), PDB_SELECTION (17), PDB_BOUNDARY (18), PDB_PATH (19), PDB_PARASITE (20), PDB_STATUS (21) }"
}, },
{ PDB_STRING, { PDB_STRING,
"val_name", "val_name",
@ -734,6 +736,11 @@ procedural_db_run_proc (gchar *name,
case PDB_SELECTION: case PDB_SELECTION:
case PDB_BOUNDARY: case PDB_BOUNDARY:
case PDB_PATH: case PDB_PATH:
params[i].value.pdb_int = (gint32) va_arg (args, int);
break;
case PDB_PARASITE:
params[i].value.pdb_pointer = va_arg (args, void *);
break;
case PDB_STATUS: case PDB_STATUS:
params[i].value.pdb_int = (gint32) va_arg (args, int); params[i].value.pdb_int = (gint32) va_arg (args, int);
break; break;
@ -825,6 +832,7 @@ procedural_db_destroy_args (Argument *args,
case PDB_SELECTION: case PDB_SELECTION:
case PDB_BOUNDARY: case PDB_BOUNDARY:
case PDB_PATH: case PDB_PATH:
case PDB_PARASITE:
case PDB_STATUS: case PDB_STATUS:
case PDB_END: case PDB_END:
break; break;

View File

@ -43,6 +43,7 @@ typedef enum
PDB_SELECTION, PDB_SELECTION,
PDB_BOUNDARY, PDB_BOUNDARY,
PDB_PATH, PDB_PATH,
PDB_PARASITE,
PDB_STATUS, PDB_STATUS,
PDB_END PDB_END
} PDBArgType; } PDBArgType;

View File

@ -32,7 +32,9 @@ libgimp_la_SOURCES = \
gimpprotocol.h \ gimpprotocol.h \
gimptile.c \ gimptile.c \
gimpwire.c \ gimpwire.c \
gimpwire.h gimpwire.h \
gimpparasite.c \
gimpparasite.h
libgimpui_la_SOURCES = \ libgimpui_la_SOURCES = \
gimpmenu.c \ gimpmenu.c \
@ -44,7 +46,8 @@ gimpinclude_HEADERS = \
gimpfeatures.h \ gimpfeatures.h \
gimpmenu.h \ gimpmenu.h \
gimpui.h \ gimpui.h \
gimpintl.h gimpintl.h \
gimpparasite.h
libgimp_la_LDFLAGS = \ libgimp_la_LDFLAGS = \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -release $(LT_RELEASE) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -release $(LT_RELEASE)

View File

@ -623,6 +623,9 @@ gimp_run_procedure (char *name,
case PARAM_COLOR: case PARAM_COLOR:
(void) va_arg (args, guchar*); (void) va_arg (args, guchar*);
break; break;
case PARAM_PARASITE:
(void) va_arg (args, GParasite*);
break;
case PARAM_REGION: case PARAM_REGION:
break; break;
case PARAM_END: case PARAM_END:
@ -707,6 +710,22 @@ gimp_run_procedure (char *name,
case PARAM_PATH: case PARAM_PATH:
proc_run.params[i].data.d_path = va_arg (args, gint32); proc_run.params[i].data.d_path = va_arg (args, gint32);
break; break;
case PARAM_PARASITE:
{
GParasite *p = va_arg (args, GParasite*);
if (p == NULL)
p = gparasite_error();
memcpy(proc_run.params[i].data.d_parasite.creator, p->creator, 4);
memcpy(proc_run.params[i].data.d_parasite.type, p->type, 4);
proc_run.params[i].data.d_parasite.flags = p->flags;
proc_run.params[i].data.d_parasite.size = p->size;
if (p->size > 0)
proc_run.params[i].data.d_parasite.data = g_memdup (p->data,
p->size);
else
proc_run.params[i].data.d_parasite.data = NULL;
} break;
case PARAM_STATUS: case PARAM_STATUS:
proc_run.params[i].data.d_status = va_arg (args, gint32); proc_run.params[i].data.d_status = va_arg (args, gint32);
break; break;

View File

@ -23,6 +23,7 @@
#include <glib.h> #include <glib.h>
#include <libgimp/gimpenums.h> #include <libgimp/gimpenums.h>
#include <libgimp/gimpfeatures.h> #include <libgimp/gimpfeatures.h>
#include <libgimp/gimpparasite.h>
#ifdef __cplusplus #ifdef __cplusplus
@ -157,6 +158,7 @@ union _GParamData
gint32 d_selection; gint32 d_selection;
gint32 d_boundary; gint32 d_boundary;
gint32 d_path; gint32 d_path;
GParasite d_parasite;
gint32 d_status; gint32 d_status;
}; };
@ -425,6 +427,13 @@ void gimp_image_set_component_visible (gint32 image_ID,
gint visible); gint visible);
void gimp_image_set_filename (gint32 image_ID, void gimp_image_set_filename (gint32 image_ID,
char *name); char *name);
GParasite *gimp_image_find_parasite (gint32 image_ID,
const char *creator,
const char *type);
void gimp_image_attach_parasite (gint32 image_ID,
const GParasite *p);
void gimp_image_detach_parasite (gint32 image_ID,
GParasite *p);
void gimp_image_set_resolution (gint32 image_ID, void gimp_image_set_resolution (gint32 image_ID,
float resolution); float resolution);
float gimp_image_get_resolution (gint32 image_ID); float gimp_image_get_resolution (gint32 image_ID);
@ -520,6 +529,13 @@ void gimp_layer_set_show_mask (gint32 layer_ID,
gint show_mask); gint show_mask);
void gimp_layer_set_visible (gint32 layer_ID, void gimp_layer_set_visible (gint32 layer_ID,
gint visible); gint visible);
GParasite *gimp_layer_find_parasite (gint32 image_ID,
const char *creator,
const char *type);
void gimp_layer_attach_parasite (gint32 layer_ID,
const GParasite *p);
void gimp_layer_detach_parasite (gint32 layer_ID,
GParasite *p);
/**************************************** /****************************************
@ -611,7 +627,13 @@ GTile* gimp_drawable_get_tile2 (GDrawable *drawable,
gint shadow, gint shadow,
gint x, gint x,
gint y); gint y);
GParasite *gimp_drawable_find_parasite (gint32 drawable,
const char *creator,
const char *type);
void gimp_drawable_attach_parasite (gint32 drawable,
const GParasite *p);
void gimp_drawable_detach_parasite (gint32 drawable,
GParasite *p);
/**************************************** /****************************************
* GTiles * * GTiles *

View File

@ -575,3 +575,66 @@ gimp_drawable_get_tile2 (GDrawable *drawable,
return gimp_drawable_get_tile (drawable, shadow, row, col); return gimp_drawable_get_tile (drawable, shadow, row, col);
} }
GParasite *
gimp_drawable_find_parasite (gint32 drawable_ID,
const char *creator,
const char *type)
{
GParam *return_vals;
int nreturn_vals;
GParasite *parasite;
return_vals = gimp_run_procedure ("gimp_drawable_find_parasite",
&nreturn_vals,
PARAM_DRAWABLE, drawable_ID,
PARAM_STRING, creator,
PARAM_STRING, type,
PARAM_END);
if (return_vals[0].data.d_status == STATUS_SUCCESS)
{
parasite = gparasite_copy(&return_vals[1].data.d_parasite);
}
else
parasite = NULL;
gimp_destroy_params (return_vals, nreturn_vals);
return parasite;
}
void
gimp_drawable_attach_parasite (gint32 drawable_ID,
const GParasite *p)
{
GParam *return_vals;
int nreturn_vals;
return_vals = gimp_run_procedure ("gimp_drawable_attach_parasite",
&nreturn_vals,
PARAM_DRAWABLE, drawable_ID,
PARAM_PARASITE, p,
PARAM_END);
gimp_destroy_params (return_vals, nreturn_vals);
}
void
gimp_drawable_detach_parasite (gint32 drawable_ID,
GParasite *p)
{
GParam *return_vals;
int nreturn_vals;
return_vals = gimp_run_procedure ("gimp_drawable_detach_parasite",
&nreturn_vals,
PARAM_DRAWABLE, drawable_ID,
PARAM_PARASITE, p,
PARAM_END);
gimp_destroy_params (return_vals, nreturn_vals);
}

View File

@ -575,3 +575,66 @@ gimp_drawable_get_tile2 (GDrawable *drawable,
return gimp_drawable_get_tile (drawable, shadow, row, col); return gimp_drawable_get_tile (drawable, shadow, row, col);
} }
GParasite *
gimp_drawable_find_parasite (gint32 drawable_ID,
const char *creator,
const char *type)
{
GParam *return_vals;
int nreturn_vals;
GParasite *parasite;
return_vals = gimp_run_procedure ("gimp_drawable_find_parasite",
&nreturn_vals,
PARAM_DRAWABLE, drawable_ID,
PARAM_STRING, creator,
PARAM_STRING, type,
PARAM_END);
if (return_vals[0].data.d_status == STATUS_SUCCESS)
{
parasite = gparasite_copy(&return_vals[1].data.d_parasite);
}
else
parasite = NULL;
gimp_destroy_params (return_vals, nreturn_vals);
return parasite;
}
void
gimp_drawable_attach_parasite (gint32 drawable_ID,
const GParasite *p)
{
GParam *return_vals;
int nreturn_vals;
return_vals = gimp_run_procedure ("gimp_drawable_attach_parasite",
&nreturn_vals,
PARAM_DRAWABLE, drawable_ID,
PARAM_PARASITE, p,
PARAM_END);
gimp_destroy_params (return_vals, nreturn_vals);
}
void
gimp_drawable_detach_parasite (gint32 drawable_ID,
GParasite *p)
{
GParam *return_vals;
int nreturn_vals;
return_vals = gimp_run_procedure ("gimp_drawable_detach_parasite",
&nreturn_vals,
PARAM_DRAWABLE, drawable_ID,
PARAM_PARASITE, p,
PARAM_END);
gimp_destroy_params (return_vals, nreturn_vals);
}

View File

@ -94,10 +94,12 @@ typedef enum
PARAM_SELECTION, PARAM_SELECTION,
PARAM_BOUNDARY, PARAM_BOUNDARY,
PARAM_PATH, PARAM_PATH,
PARAM_PARASITE,
PARAM_STATUS, PARAM_STATUS,
PARAM_END PARAM_END
} GParamType; } GParamType;
typedef enum typedef enum
{ {
PROC_PLUG_IN = 1, PROC_PLUG_IN = 1,

View File

@ -910,6 +910,66 @@ gimp_image_set_filename (gint32 image_ID,
gimp_destroy_params (return_vals, nreturn_vals); gimp_destroy_params (return_vals, nreturn_vals);
} }
GParasite *
gimp_image_find_parasite (gint32 image_ID,
const char *creator,
const char *type)
{
GParam *return_vals;
int nreturn_vals;
GParasite *parasite;
return_vals = gimp_run_procedure ("gimp_image_find_parasite",
&nreturn_vals,
PARAM_IMAGE, image_ID,
PARAM_STRING, creator,
PARAM_STRING, type,
PARAM_END);
if (return_vals[0].data.d_status == STATUS_SUCCESS)
{
parasite = gparasite_copy(&return_vals[1].data.d_parasite);
}
else
parasite = NULL;
gimp_destroy_params (return_vals, nreturn_vals);
return parasite;
}
void
gimp_image_attach_parasite (gint32 image_ID,
const GParasite *p)
{
GParam *return_vals;
int nreturn_vals;
return_vals = gimp_run_procedure ("gimp_image_attach_parasite",
&nreturn_vals,
PARAM_IMAGE, image_ID,
PARAM_PARASITE, p,
PARAM_END);
gimp_destroy_params (return_vals, nreturn_vals);
}
void
gimp_image_detach_parasite (gint32 image_ID,
GParasite *p)
{
GParam *return_vals;
int nreturn_vals;
return_vals = gimp_run_procedure ("gimp_image_detach_parasite",
&nreturn_vals,
PARAM_IMAGE, image_ID,
PARAM_PARASITE, p,
PARAM_END);
gimp_destroy_params (return_vals, nreturn_vals);
}
float float
gimp_image_get_resolution (gint32 image_ID) gimp_image_get_resolution (gint32 image_ID)
{ {
@ -946,3 +1006,4 @@ gimp_image_set_resolution (gint32 image_ID,
gimp_destroy_params (return_vals, nreturn_vals); gimp_destroy_params (return_vals, nreturn_vals);
} }

View File

@ -910,6 +910,66 @@ gimp_image_set_filename (gint32 image_ID,
gimp_destroy_params (return_vals, nreturn_vals); gimp_destroy_params (return_vals, nreturn_vals);
} }
GParasite *
gimp_image_find_parasite (gint32 image_ID,
const char *creator,
const char *type)
{
GParam *return_vals;
int nreturn_vals;
GParasite *parasite;
return_vals = gimp_run_procedure ("gimp_image_find_parasite",
&nreturn_vals,
PARAM_IMAGE, image_ID,
PARAM_STRING, creator,
PARAM_STRING, type,
PARAM_END);
if (return_vals[0].data.d_status == STATUS_SUCCESS)
{
parasite = gparasite_copy(&return_vals[1].data.d_parasite);
}
else
parasite = NULL;
gimp_destroy_params (return_vals, nreturn_vals);
return parasite;
}
void
gimp_image_attach_parasite (gint32 image_ID,
const GParasite *p)
{
GParam *return_vals;
int nreturn_vals;
return_vals = gimp_run_procedure ("gimp_image_attach_parasite",
&nreturn_vals,
PARAM_IMAGE, image_ID,
PARAM_PARASITE, p,
PARAM_END);
gimp_destroy_params (return_vals, nreturn_vals);
}
void
gimp_image_detach_parasite (gint32 image_ID,
GParasite *p)
{
GParam *return_vals;
int nreturn_vals;
return_vals = gimp_run_procedure ("gimp_image_detach_parasite",
&nreturn_vals,
PARAM_IMAGE, image_ID,
PARAM_PARASITE, p,
PARAM_END);
gimp_destroy_params (return_vals, nreturn_vals);
}
float float
gimp_image_get_resolution (gint32 image_ID) gimp_image_get_resolution (gint32 image_ID)
{ {
@ -946,3 +1006,4 @@ gimp_image_set_resolution (gint32 image_ID,
gimp_destroy_params (return_vals, nreturn_vals); gimp_destroy_params (return_vals, nreturn_vals);
} }

110
libgimp/gimpparasite_pdb.c Normal file
View File

@ -0,0 +1,110 @@
/* gimpparasite.c
* Copyright (C) 1998 Jay Cox <jaycox@earthlink.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "gimpparasite.h"
#include <string.h>
#include <glib.h>
#include <stdio.h>
GParasite *
gparasite_new (const char *creator, const char *type, guint32 flags, guint32 size,
const void *data)
{
GParasite *p;
p = (GParasite *)g_malloc(sizeof(GParasite));
if (creator)
memcpy(p->creator, creator, 4);
else
memset(p->creator, 0, 4);
if (type)
memcpy(p->type, type, 4);
else
memset(p->type, 0, 4);
p->flags = flags;
p->size = size;
if (size)
p->data = g_memdup(data, size);
else
p->data = NULL;
return p;
}
void
gparasite_free (GParasite *parasite)
{
if (!parasite)
return;
if (parasite->data)
g_free(parasite->data);
g_free(parasite);
}
int
gparasite_has_type (const GParasite *parasite, const char *creator, const char *type)
{
if (!parasite)
return FALSE;
if (creator && parasite->creator && strncmp(creator, parasite->creator, 4) != 0)
return FALSE;
if (creator != 0 && parasite->creator == 0)
return FALSE;
if (type && parasite->type && strncmp(type, parasite->type, 4) != 0)
return FALSE;
if (type != 0 && parasite->type == 0)
return FALSE;
return TRUE;
}
GParasite *
gparasite_copy (const GParasite *parasite)
{
GParasite *p;
p = (GParasite *)g_malloc(sizeof(GParasite));
if (parasite->creator)
memcpy(p->creator, parasite->creator, 4);
else
memset(p->creator, 0, 4);
if (parasite->type)
memcpy(p->type, parasite->type, 4);
else
memset(p->type, 0, 4);
p->size = parasite->size;
if (parasite->size)
p->data = g_memdup(parasite->data, parasite->size);
else
p->data = NULL;
return p;
}
int
gparasite_is_error(const GParasite *p)
{
if (p == NULL)
return TRUE;
return gparasite_has_type(p, "eror", "eror");
}
GParasite *
gparasite_error()
{
static GParasite *error_p = NULL;
if (!error_p)
error_p = gparasite_new("eror", "eror", 0, 0, NULL);
return error_p;
}

View File

@ -649,6 +649,7 @@ GParamType2char(GParamType t)
case PARAM_SELECTION: return "SELECTION"; case PARAM_SELECTION: return "SELECTION";
case PARAM_BOUNDARY: return "BOUNDARY"; case PARAM_BOUNDARY: return "BOUNDARY";
case PARAM_PATH: return "PATH"; case PARAM_PATH: return "PATH";
case PARAM_PARASITE: return "PARASITE";
case PARAM_STATUS: return "STATUS"; case PARAM_STATUS: return "STATUS";
case PARAM_END: return "END"; case PARAM_END: return "END";
default: return "UNKNOWN?"; default: return "UNKNOWN?";

View File

@ -649,6 +649,7 @@ GParamType2char(GParamType t)
case PARAM_SELECTION: return "SELECTION"; case PARAM_SELECTION: return "SELECTION";
case PARAM_BOUNDARY: return "BOUNDARY"; case PARAM_BOUNDARY: return "BOUNDARY";
case PARAM_PATH: return "PATH"; case PARAM_PATH: return "PATH";
case PARAM_PARASITE: return "PARASITE";
case PARAM_STATUS: return "STATUS"; case PARAM_STATUS: return "STATUS";
case PARAM_END: return "END"; case PARAM_END: return "END";
default: return "UNKNOWN?"; default: return "UNKNOWN?";

View File

@ -19,6 +19,8 @@
#include "gimpenums.h" #include "gimpenums.h"
#include "gimpprotocol.h" #include "gimpprotocol.h"
#include "gimpwire.h" #include "gimpwire.h"
#include "gimpparasite.h"
#include <stdio.h>
static void _gp_quit_read (int fd, WireMessage *msg); static void _gp_quit_read (int fd, WireMessage *msg);
@ -907,6 +909,31 @@ _gp_params_read (int fd, GPParam **params, guint *nparams)
if (!wire_read_int32 (fd, (guint32*) &(*params)[i].data.d_path, 1)) if (!wire_read_int32 (fd, (guint32*) &(*params)[i].data.d_path, 1))
return; return;
break; break;
case PARAM_PARASITE:
{
if (!wire_read_int8 (fd, &((*params)[i].data.d_parasite.creator[0]),
4))
return;
if (!wire_read_int8 (fd, &((*params)[i].data.d_parasite.type[0]), 4))
return;
if (!wire_read_int32 (fd, &((*params)[i].data.d_parasite.flags), 1))
return;
if (!wire_read_int32 (fd, &((*params)[i].data.d_parasite.size), 1))
return;
if ((*params)[i].data.d_parasite.size > 0)
{
(*params)[i].data.d_parasite.data = g_malloc((*params)[i].data.d_parasite.size);
if (!wire_read_int8 (fd, (*params)[i].data.d_parasite.data,
(*params)[i].data.d_parasite.size))
{
g_free((*params)[i].data.d_parasite.data);
(*params)[i].data.d_parasite.data = NULL;
return;
}
}
else
(*params)[i].data.d_parasite.data = NULL;
} break;
case PARAM_STATUS: case PARAM_STATUS:
if (!wire_read_int32 (fd, (guint32*) &(*params)[i].data.d_status, 1)) if (!wire_read_int32 (fd, (guint32*) &(*params)[i].data.d_status, 1))
return; return;
@ -1019,6 +1046,23 @@ _gp_params_write (int fd, GPParam *params, int nparams)
if (!wire_write_int32 (fd, (guint32*) &params[i].data.d_path, 1)) if (!wire_write_int32 (fd, (guint32*) &params[i].data.d_path, 1))
return; return;
break; break;
case PARAM_PARASITE:
{
GParasite *p = (GParasite *)&params[i].data.d_parasite;
if (!wire_write_int8 (fd, &p->creator[0], 4))
return;
if (!wire_write_int8 (fd, &p->type[0], 4))
return;
if (!wire_write_int32 (fd, &p->flags, 1))
return;
if (!wire_write_int32 (fd, &p->size, 1))
return;
if (p->size > 0)
{
if (!wire_write_int8 (fd, p->data, p->size))
return;
}
} break;
case PARAM_STATUS: case PARAM_STATUS:
if (!wire_write_int32 (fd, (guint32*) &params[i].data.d_status, 1)) if (!wire_write_int32 (fd, (guint32*) &params[i].data.d_status, 1))
return; return;
@ -1095,6 +1139,10 @@ _gp_params_destroy (GPParam *params, int nparams)
g_free (params[i].data.d_stringarray); g_free (params[i].data.d_stringarray);
} }
break; break;
case PARAM_PARASITE:
if (params[i].data.d_parasite.data)
g_free(params[i].data.d_parasite.data);
break;
case PARAM_END: case PARAM_END:
break; break;
} }

View File

@ -22,7 +22,6 @@
#include <glib.h> #include <glib.h>
/* Increment every time the protocol changes /* Increment every time the protocol changes
*/ */
#define GP_VERSION 0x0003 #define GP_VERSION 0x0003
@ -122,6 +121,14 @@ struct _GPParam
gint32 d_selection; gint32 d_selection;
gint32 d_boundary; gint32 d_boundary;
gint32 d_path; gint32 d_path;
struct
{
guchar creator[4];
guchar type[4];
guint32 flags;
guint32 size;
void *data;
} d_parasite;
gint32 d_status; gint32 d_status;
} data; } data;
}; };

View File

@ -19,6 +19,8 @@
#include "gimpenums.h" #include "gimpenums.h"
#include "gimpprotocol.h" #include "gimpprotocol.h"
#include "gimpwire.h" #include "gimpwire.h"
#include "gimpparasite.h"
#include <stdio.h>
static void _gp_quit_read (int fd, WireMessage *msg); static void _gp_quit_read (int fd, WireMessage *msg);
@ -907,6 +909,31 @@ _gp_params_read (int fd, GPParam **params, guint *nparams)
if (!wire_read_int32 (fd, (guint32*) &(*params)[i].data.d_path, 1)) if (!wire_read_int32 (fd, (guint32*) &(*params)[i].data.d_path, 1))
return; return;
break; break;
case PARAM_PARASITE:
{
if (!wire_read_int8 (fd, &((*params)[i].data.d_parasite.creator[0]),
4))
return;
if (!wire_read_int8 (fd, &((*params)[i].data.d_parasite.type[0]), 4))
return;
if (!wire_read_int32 (fd, &((*params)[i].data.d_parasite.flags), 1))
return;
if (!wire_read_int32 (fd, &((*params)[i].data.d_parasite.size), 1))
return;
if ((*params)[i].data.d_parasite.size > 0)
{
(*params)[i].data.d_parasite.data = g_malloc((*params)[i].data.d_parasite.size);
if (!wire_read_int8 (fd, (*params)[i].data.d_parasite.data,
(*params)[i].data.d_parasite.size))
{
g_free((*params)[i].data.d_parasite.data);
(*params)[i].data.d_parasite.data = NULL;
return;
}
}
else
(*params)[i].data.d_parasite.data = NULL;
} break;
case PARAM_STATUS: case PARAM_STATUS:
if (!wire_read_int32 (fd, (guint32*) &(*params)[i].data.d_status, 1)) if (!wire_read_int32 (fd, (guint32*) &(*params)[i].data.d_status, 1))
return; return;
@ -1019,6 +1046,23 @@ _gp_params_write (int fd, GPParam *params, int nparams)
if (!wire_write_int32 (fd, (guint32*) &params[i].data.d_path, 1)) if (!wire_write_int32 (fd, (guint32*) &params[i].data.d_path, 1))
return; return;
break; break;
case PARAM_PARASITE:
{
GParasite *p = (GParasite *)&params[i].data.d_parasite;
if (!wire_write_int8 (fd, &p->creator[0], 4))
return;
if (!wire_write_int8 (fd, &p->type[0], 4))
return;
if (!wire_write_int32 (fd, &p->flags, 1))
return;
if (!wire_write_int32 (fd, &p->size, 1))
return;
if (p->size > 0)
{
if (!wire_write_int8 (fd, p->data, p->size))
return;
}
} break;
case PARAM_STATUS: case PARAM_STATUS:
if (!wire_write_int32 (fd, (guint32*) &params[i].data.d_status, 1)) if (!wire_write_int32 (fd, (guint32*) &params[i].data.d_status, 1))
return; return;
@ -1095,6 +1139,10 @@ _gp_params_destroy (GPParam *params, int nparams)
g_free (params[i].data.d_stringarray); g_free (params[i].data.d_stringarray);
} }
break; break;
case PARAM_PARASITE:
if (params[i].data.d_parasite.data)
g_free(params[i].data.d_parasite.data);
break;
case PARAM_END: case PARAM_END:
break; break;
} }

View File

@ -22,7 +22,6 @@
#include <glib.h> #include <glib.h>
/* Increment every time the protocol changes /* Increment every time the protocol changes
*/ */
#define GP_VERSION 0x0003 #define GP_VERSION 0x0003
@ -122,6 +121,14 @@ struct _GPParam
gint32 d_selection; gint32 d_selection;
gint32 d_boundary; gint32 d_boundary;
gint32 d_path; gint32 d_path;
struct
{
guchar creator[4];
guchar type[4];
guint32 flags;
guint32 size;
void *data;
} d_parasite;
gint32 d_status; gint32 d_status;
} data; } data;
}; };

View File

@ -186,16 +186,26 @@ run (char *name,
} }
else if (strcmp (name, "file_tiff_save") == 0) else if (strcmp (name, "file_tiff_save") == 0)
{ {
int image = param[1].data.d_int32;
switch (run_mode) switch (run_mode)
{ {
case RUN_INTERACTIVE: case RUN_INTERACTIVE:
{
GParasite *parasite;
/* Possibly retrieve data */ /* Possibly retrieve data */
gimp_get_data ("file_tiff_save", &tsvals); gimp_get_data ("file_tiff_save", &tsvals);
parasite = gimp_image_find_parasite(image, "tiff", "sopt");
if (!gparasite_is_error(parasite))
{
tsvals.compression = ((TiffSaveVals *)parasite->data)->compression;
tsvals.fillorder = ((TiffSaveVals *)parasite->data)->fillorder;
}
gparasite_free(parasite);
/* First acquire information with a dialog */ /* First acquire information with a dialog */
if (! save_dialog ()) if (! save_dialog ())
return; return;
break; } break;
case RUN_NONINTERACTIVE: case RUN_NONINTERACTIVE:
/* Make sure all the arguments are there! */ /* Make sure all the arguments are there! */
@ -220,7 +230,17 @@ run (char *name,
case RUN_WITH_LAST_VALS: case RUN_WITH_LAST_VALS:
/* Possibly retrieve data */ /* Possibly retrieve data */
{
GParasite *parasite;
gimp_get_data ("file_tiff_save", &tsvals); gimp_get_data ("file_tiff_save", &tsvals);
parasite = gimp_image_find_parasite(image, "tiff", "sopt");
if (!gparasite_is_error(parasite))
{
tsvals.compression = ((TiffSaveVals *)parasite->data)->compression;
tsvals.fillorder = ((TiffSaveVals *)parasite->data)->fillorder;
}
gparasite_free(parasite);
}
break; break;
default: default:
@ -272,6 +292,9 @@ static gint32 load_image (char *filename) {
channel_data *channel= NULL; channel_data *channel= NULL;
TiffSaveVals save_vals;
GParasite *parasite;
guint16 tmp;
tif = TIFFOpen (filename, "r"); tif = TIFFOpen (filename, "r");
if (!tif) { if (!tif) {
g_message("TIFF Can't open \n%s", filename); g_message("TIFF Can't open \n%s", filename);
@ -364,6 +387,19 @@ static gint32 load_image (char *filename) {
} }
gimp_image_set_filename (image, filename); gimp_image_set_filename (image, filename);
/* attach a parasite containing the compression/fillorder */
if (!TIFFGetField (tif, TIFFTAG_COMPRESSION, &tmp))
save_vals.compression = COMPRESSION_NONE;
else
save_vals.compression = tmp;
if (!TIFFGetField (tif, TIFFTAG_FILLORDER, &tmp))
save_vals.fillorder = FILLORDER_LSB2MSB;
else
save_vals.fillorder = tmp;
parasite = gparasite_new("tiff", "sopt", 0, sizeof(save_vals), &save_vals);
gimp_image_attach_parasite(image, parasite);
gparasite_free(parasite);
/* any resolution info in the file? */ /* any resolution info in the file? */
{ {
@ -741,6 +777,8 @@ static gint save_image (char *filename, gint32 image, gint32 layer) {
break; break;
case INDEXEDA_IMAGE: case INDEXEDA_IMAGE:
return 0; return 0;
default:
return 0;
} }
if (rowsperstrip == 0) if (rowsperstrip == 0)

View File

@ -649,6 +649,7 @@ GParamType2char(GParamType t)
case PARAM_SELECTION: return "SELECTION"; case PARAM_SELECTION: return "SELECTION";
case PARAM_BOUNDARY: return "BOUNDARY"; case PARAM_BOUNDARY: return "BOUNDARY";
case PARAM_PATH: return "PATH"; case PARAM_PATH: return "PATH";
case PARAM_PARASITE: return "PARASITE";
case PARAM_STATUS: return "STATUS"; case PARAM_STATUS: return "STATUS";
case PARAM_END: return "END"; case PARAM_END: return "END";
default: return "UNKNOWN?"; default: return "UNKNOWN?";

View File

@ -649,6 +649,7 @@ GParamType2char(GParamType t)
case PARAM_SELECTION: return "SELECTION"; case PARAM_SELECTION: return "SELECTION";
case PARAM_BOUNDARY: return "BOUNDARY"; case PARAM_BOUNDARY: return "BOUNDARY";
case PARAM_PATH: return "PATH"; case PARAM_PATH: return "PATH";
case PARAM_PARASITE: return "PARASITE";
case PARAM_STATUS: return "STATUS"; case PARAM_STATUS: return "STATUS";
case PARAM_END: return "END"; case PARAM_END: return "END";
default: return "UNKNOWN?"; default: return "UNKNOWN?";

View File

@ -649,6 +649,7 @@ GParamType2char(GParamType t)
case PARAM_SELECTION: return "SELECTION"; case PARAM_SELECTION: return "SELECTION";
case PARAM_BOUNDARY: return "BOUNDARY"; case PARAM_BOUNDARY: return "BOUNDARY";
case PARAM_PATH: return "PATH"; case PARAM_PATH: return "PATH";
case PARAM_PARASITE: return "PARASITE";
case PARAM_STATUS: return "STATUS"; case PARAM_STATUS: return "STATUS";
case PARAM_END: return "END"; case PARAM_END: return "END";
default: return "UNKNOWN?"; default: return "UNKNOWN?";

View File

@ -354,13 +354,14 @@ init_procedures ()
static void static void
init_constants () init_constants ()
{ {
GParam *return_vals; GParam *return_vals = NULL;
gint nreturn_vals; gint nreturn_vals;
return_vals = gimp_run_procedure ("gimp_gimprc_query", return_vals = gimp_run_procedure ("gimp_gimprc_query",
&nreturn_vals, &nreturn_vals,
PARAM_STRING, "gimp_data_dir", PARAM_STRING, "gimp_data_dir",
PARAM_END); PARAM_END);
if (return_vals[0].data.d_status == STATUS_SUCCESS) if (return_vals[0].data.d_status == STATUS_SUCCESS)
setvar (cintern ("gimp-data-dir"), strcons (-1, return_vals[1].data.d_string), NIL); setvar (cintern ("gimp-data-dir"), strcons (-1, return_vals[1].data.d_string), NIL);
gimp_destroy_params (return_vals, nreturn_vals); gimp_destroy_params (return_vals, nreturn_vals);
@ -767,6 +768,36 @@ marshall_proc_db_call (LISP a)
case PARAM_PATH: case PARAM_PATH:
return my_err ("Paths are currently unsupported as arguments", car (a)); return my_err ("Paths are currently unsupported as arguments", car (a));
break; break;
case PARAM_PARASITE:
if (!TYPEP (car (a), tc_cons))
success = FALSE;
if (success)
{
args[i].type = PARAM_PARASITE;
/* parasite->creator */
intermediate_val = car (a);
memcpy(args[i].data.d_parasite.creator,
get_c_string (car (intermediate_val)), 4);
/* parasite->type */
intermediate_val = cdr (intermediate_val);
memcpy(args[i].data.d_parasite.type,
get_c_string (car (intermediate_val)), 4);
/* parasite->flags */
intermediate_val = cdr (intermediate_val);
args[i].data.d_parasite.flags = get_c_long ( (intermediate_val));
/* parasite->size */
intermediate_val = cdr (intermediate_val);
args[i].data.d_parasite.size = (car (intermediate_val))->storage_as.string.dim;
/* parasite->data */
args[i].data.d_parasite.data = (void*) (car (intermediate_val))->storage_as.string.data;
}
break;
case PARAM_STATUS: case PARAM_STATUS:
return my_err ("Status is for return types, not arguments", car (a)); return my_err ("Status is for return types, not arguments", car (a));
break; break;
@ -917,6 +948,22 @@ marshall_proc_db_call (LISP a)
case PARAM_PATH: case PARAM_PATH:
return my_err ("Paths are currently unsupported as return values", NIL); return my_err ("Paths are currently unsupported as return values", NIL);
break; break;
case PARAM_PARASITE:
{
LISP creator, type, flags, data;
creator = strcons (4, values[i + 1].data.d_parasite.creator);
type = strcons (4, values[i + 1].data.d_parasite.type);
flags = flocons (values[i + 1].data.d_parasite.flags);
data = arcons (tc_byte_array, values[i+1].data.d_parasite.size, 0);
memcpy(data->storage_as.string.data,
values[i+1].data.d_parasite.data,
values[i+1].data.d_parasite.size);
intermediate_val = cons (creator, cons(type, cons(flags,
cons(data, NIL))));
return_val = cons (intermediate_val, return_val);
}
break;
case PARAM_STATUS: case PARAM_STATUS:
return my_err ("Procedural database execution returned multiple status values", NIL); return my_err ("Procedural database execution returned multiple status values", NIL);
break; break;

View File

@ -186,16 +186,26 @@ run (char *name,
} }
else if (strcmp (name, "file_tiff_save") == 0) else if (strcmp (name, "file_tiff_save") == 0)
{ {
int image = param[1].data.d_int32;
switch (run_mode) switch (run_mode)
{ {
case RUN_INTERACTIVE: case RUN_INTERACTIVE:
{
GParasite *parasite;
/* Possibly retrieve data */ /* Possibly retrieve data */
gimp_get_data ("file_tiff_save", &tsvals); gimp_get_data ("file_tiff_save", &tsvals);
parasite = gimp_image_find_parasite(image, "tiff", "sopt");
if (!gparasite_is_error(parasite))
{
tsvals.compression = ((TiffSaveVals *)parasite->data)->compression;
tsvals.fillorder = ((TiffSaveVals *)parasite->data)->fillorder;
}
gparasite_free(parasite);
/* First acquire information with a dialog */ /* First acquire information with a dialog */
if (! save_dialog ()) if (! save_dialog ())
return; return;
break; } break;
case RUN_NONINTERACTIVE: case RUN_NONINTERACTIVE:
/* Make sure all the arguments are there! */ /* Make sure all the arguments are there! */
@ -220,7 +230,17 @@ run (char *name,
case RUN_WITH_LAST_VALS: case RUN_WITH_LAST_VALS:
/* Possibly retrieve data */ /* Possibly retrieve data */
{
GParasite *parasite;
gimp_get_data ("file_tiff_save", &tsvals); gimp_get_data ("file_tiff_save", &tsvals);
parasite = gimp_image_find_parasite(image, "tiff", "sopt");
if (!gparasite_is_error(parasite))
{
tsvals.compression = ((TiffSaveVals *)parasite->data)->compression;
tsvals.fillorder = ((TiffSaveVals *)parasite->data)->fillorder;
}
gparasite_free(parasite);
}
break; break;
default: default:
@ -272,6 +292,9 @@ static gint32 load_image (char *filename) {
channel_data *channel= NULL; channel_data *channel= NULL;
TiffSaveVals save_vals;
GParasite *parasite;
guint16 tmp;
tif = TIFFOpen (filename, "r"); tif = TIFFOpen (filename, "r");
if (!tif) { if (!tif) {
g_message("TIFF Can't open \n%s", filename); g_message("TIFF Can't open \n%s", filename);
@ -364,6 +387,19 @@ static gint32 load_image (char *filename) {
} }
gimp_image_set_filename (image, filename); gimp_image_set_filename (image, filename);
/* attach a parasite containing the compression/fillorder */
if (!TIFFGetField (tif, TIFFTAG_COMPRESSION, &tmp))
save_vals.compression = COMPRESSION_NONE;
else
save_vals.compression = tmp;
if (!TIFFGetField (tif, TIFFTAG_FILLORDER, &tmp))
save_vals.fillorder = FILLORDER_LSB2MSB;
else
save_vals.fillorder = tmp;
parasite = gparasite_new("tiff", "sopt", 0, sizeof(save_vals), &save_vals);
gimp_image_attach_parasite(image, parasite);
gparasite_free(parasite);
/* any resolution info in the file? */ /* any resolution info in the file? */
{ {
@ -741,6 +777,8 @@ static gint save_image (char *filename, gint32 image, gint32 layer) {
break; break;
case INDEXEDA_IMAGE: case INDEXEDA_IMAGE:
return 0; return 0;
default:
return 0;
} }
if (rowsperstrip == 0) if (rowsperstrip == 0)