Commit e2a601d4 authored by jaycox's avatar jaycox

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.
parent 6217c7ee
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>
* app/text_tool.[ch]: applied gimp-austin-981007-0, use gtkfontsel
......
......@@ -227,6 +227,12 @@ gimp_SOURCES = \
paint_funcs.h \
paintbrush.c \
paintbrush.h \
parasite.c \
parasite.h \
parasiteP.h \
parasiteF.h \
parasite_cmds.c \
parasite_cmds.h \
pattern_header.h \
pattern_select.c \
pattern_select.h \
......
......@@ -28,6 +28,8 @@
#include <sys/stat.h>
#include <time.h>
#include <unistd.h>
#include "parasite.h"
#include "parasiteP.h" /* ick */
#ifdef HAVE_IPC_H
#include <sys/ipc.h>
......@@ -2624,6 +2626,13 @@ plug_in_params_to_args (GPParam *params,
case PDB_PATH:
args[i].value.pdb_int = params[i].data.d_path;
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:
args[i].value.pdb_int = params[i].data.d_status;
break;
......@@ -2782,6 +2791,35 @@ plug_in_args_to_params (Argument *args,
case PDB_PATH:
params[i].data.d_path = args[i].value.pdb_int;
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:
params[i].data.d_status = args[i].value.pdb_int;
break;
......@@ -2850,6 +2888,15 @@ plug_in_params_destroy (GPParam *params,
case PDB_SELECTION:
case PDB_BOUNDARY:
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:
break;
case PDB_END:
......@@ -2924,6 +2971,14 @@ plug_in_args_destroy (Argument *args,
case PDB_SELECTION:
case PDB_BOUNDARY:
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:
break;
case PDB_END:
......
......@@ -27,6 +27,7 @@
#include "gimage_mask.h"
#include "layer.h"
#include "paint_funcs.h"
#include "parasite.h"
#include "temp_buf.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);
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 */
g_free (channel_name);
......
......@@ -27,6 +27,7 @@
#include "gimage_mask.h"
#include "layer.h"
#include "paint_funcs.h"
#include "parasite.h"
#include "temp_buf.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);
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 */
g_free (channel_name);
......
......@@ -27,6 +27,7 @@
#include "gimage_mask.h"
#include "layer.h"
#include "paint_funcs.h"
#include "parasite.h"
#include "temp_buf.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);
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 */
g_free (channel_name);
......
......@@ -24,6 +24,7 @@
#include "gimpsignal.h"
#include "gimage.h"
#include "gimage_mask.h"
#include "parasite.h"
enum {
......@@ -358,6 +359,28 @@ gimp_drawable_set_name (GimpDrawable *drawable, char *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
gimp_drawable_type_with_alpha (GimpDrawable *drawable)
{
......@@ -515,6 +538,7 @@ gimp_drawable_init (GimpDrawable *drawable)
drawable->has_alpha = FALSE;
drawable->preview = NULL;
drawable->preview_valid = FALSE;
drawable->parasites = FALSE;
drawable->ID = global_drawable_ID++;
if (gimp_drawable_table == NULL)
......@@ -543,6 +567,9 @@ gimp_drawable_destroy (GtkObject *object)
if (drawable->preview)
temp_buf_free (drawable->preview);
if (drawable->parasites)
parasite_gslist_destroy(drawable->parasites);
if (GTK_OBJECT_CLASS (parent_class)->destroy)
(*GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
......
......@@ -23,6 +23,7 @@
#include "tile_manager.h"
#include "temp_buf.h"
#include "gimpimageF.h"
#include "parasiteF.h"
#define GIMP_TYPE_DRAWABLE (gimp_drawable_get_type ())
#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 *);
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);
void gimp_drawable_deallocate (GimpDrawable *);
GimpImage * gimp_drawable_gimage (GimpDrawable*);
......
......@@ -25,6 +25,7 @@
#include "gimage_mask.h"
#include "paint_funcs.h"
#include "palette.h"
#include "parasite.h"
#include "undo.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[2] = FALSE;
gimage->comp_preview = NULL;
gimage->parasites = NULL;
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_channels (gimage);
channel_delete (gimage->selection_mask);
if (gimage->parasites)
parasite_gslist_destroy(gimage->parasites);
}
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 */
/************************************************************/
......
......@@ -8,6 +8,7 @@
#include "drawable.h"
#include "channel.h"
#include "layer.h"
#include "parasiteF.h"
#include "temp_buf.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_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 */
......
......@@ -25,6 +25,7 @@
#include "gimage_mask.h"
#include "paint_funcs.h"
#include "palette.h"
#include "parasite.h"
#include "undo.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[2] = FALSE;
gimage->comp_preview = NULL;
gimage->parasites = NULL;
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_channels (gimage);
channel_delete (gimage->selection_mask);
if (gimage->parasites)
parasite_gslist_destroy(gimage->parasites);
}
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 */
/************************************************************/
......
......@@ -8,6 +8,7 @@
#include "drawable.h"
#include "channel.h"
#include "layer.h"
#include "parasiteF.h"
#include "temp_buf.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_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 */
......
......@@ -25,6 +25,7 @@
#include "gimage_mask.h"
#include "paint_funcs.h"
#include "palette.h"
#include "parasite.h"
#include "undo.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[2] = FALSE;
gimage->comp_preview = NULL;
gimage->parasites = NULL;
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_channels (gimage);
channel_delete (gimage->selection_mask);
if (gimage->parasites)
parasite_gslist_destroy(gimage->parasites);
}
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 */
/************************************************************/
......
......@@ -8,6 +8,7 @@
#include "drawable.h"
#include "channel.h"
#include "layer.h"
#include "parasiteF.h"
#include "temp_buf.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_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 */
......
......@@ -25,6 +25,7 @@
#include "gimage_mask.h"
#include "paint_funcs.h"
#include "palette.h"
#include "parasite.h"
#include "undo.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[2] = FALSE;
gimage->comp_preview = NULL;
gimage->parasites = NULL;
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_channels (gimage);
channel_delete (gimage->selection_mask);
if (gimage->parasites)
parasite_gslist_destroy(gimage->parasites);
}
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 */
/************************************************************/
......
......@@ -8,6 +8,7 @@
#include "drawable.h"
#include "channel.h"
#include "layer.h"
#include "parasiteF.h"
#include "temp_buf.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_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 */
......
......@@ -25,6 +25,7 @@
#include "gimage_mask.h"
#include "paint_funcs.h"
#include "palette.h"
#include "parasite.h"
#include "undo.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[2] = FALSE;
gimage->comp_preview = NULL;
gimage->parasites = NULL;
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_channels (gimage);
channel_delete (gimage->selection_mask);
if (gimage->parasites)
parasite_gslist_destroy(gimage->parasites);
}
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 */
/************************************************************/
......
......@@ -8,6 +8,7 @@
#include "drawable.h"
#include "channel.h"
#include "layer.h"
#include "parasiteF.h"
#include "temp_buf.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_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 */
......
......@@ -25,6 +25,7 @@
#include "gimage_mask.h"
#include "paint_funcs.h"
#include "palette.h"
#include "parasite.h"
#include "undo.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[2] = FALSE;
gimage->comp_preview = NULL;
gimage->parasites = NULL;
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_channels (gimage);
channel_delete (gimage->selection_mask);
if (gimage->parasites)
parasite_gslist_destroy(gimage->parasites);
}
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 */
/************************************************************/
......
......@@ -8,6 +8,7 @@
#include "drawable.h"
#include "channel.h"
#include "layer.h"
#include "parasiteF.h"
#include "temp_buf.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_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 */
......
......@@ -371,6 +371,10 @@ layer_copy (layer, add_alpha)
new_layer->show_mask = layer->show_mask;
}
/* copy the parasites */
GIMP_DRAWABLE(new_layer)->parasites
= parasite_gslist_copy(GIMP_DRAWABLE(layer)->parasites);
cleanup: