mirror of https://github.com/GNOME/gimp.git
Modified Files: ChangeLog app/Makefile.am app/app_procs.c app/channel.c
Modified Files: ChangeLog app/Makefile.am app/app_procs.c app/channel.c app/channel.h app/file_new_dialog.c app/gimage_cmds.c app/gimage_cmds.h app/gimpdrawable.c app/gimpdrawable.h app/gimpdrawableP.h app/gimpimage.c app/gimpimage.h app/gimpimageF.h app/gimpimageP.h app/internal_procs.c app/layer.c app/layer.h app/parasite_cmds.c app/parasite_cmds.h app/plug_in.c app/preferences_dialog.c libgimp/Makefile.am libgimp/gimp.h libgimp/gimpdrawable.c libgimp/gimpfeatures.h.in libgimp/gimpimage.c libgimp/gimpmatrix.h libgimp/parasite.c libgimp/parasite.h plug-ins/script-fu/script-fu-console.c plug-ins/script-fu/script-fu.c Added Files: app/gimpparasite.c app/gimpparasite.h app/parasitelist.c app/parasitelist.h app/parasitelistF.h app/parasitelistP.h libgimp/gimpparasite.c lots of parasite related changes.
This commit is contained in:
parent
fc491e5fa6
commit
682b1f3c65
34
ChangeLog
34
ChangeLog
|
@ -1,3 +1,37 @@
|
|||
Fri Oct 30 01:53:56 1998 Jay Cox (jaycox@earthlink.net)
|
||||
|
||||
* app/parasitelist.c
|
||||
* app/parasitelist.h
|
||||
* app/parasitelistF.h
|
||||
* app/parasitelistP.h: new files to implement a list class for
|
||||
storing parasites in hash tables.
|
||||
|
||||
* app/gimpparasite.c
|
||||
* app/gimpparasite.h: new files for attaching parasites to the gimp.
|
||||
|
||||
* app/Makefile.am, app/app_procs.c, app/channel.c, app/channel.h,
|
||||
* app/file_new_dialog.c, app/gimage_cmds.c, app/gimage_cmds.h,
|
||||
* app/gimpdrawable.c, app/gimpdrawable.h, app/gimpdrawableP.h,
|
||||
* app/gimpimage.c, app/gimpimage.h, app/gimpimageF.h, app/gimpimageP.h,
|
||||
* app/internal_procs.c, app/layer.c, app/layer.h, app/parasite_cmds.c,
|
||||
* app/parasite_cmds.h, app/plug_in.c: various changes to utillize
|
||||
the above new files
|
||||
|
||||
* app/preferences_dialog.c: remove unecessary #include
|
||||
|
||||
* libgimp/gimpfeatures.h.in: #define GIMP_HAVE_PARASITES
|
||||
|
||||
* plug-ins/script-fu/script-fu-console.c: ugly work around for a bug
|
||||
I can't track down. Posibly in gtk+, or unique to my system.
|
||||
|
||||
* plug-ins/script-fu/script-fu.c: fix a bug in parasite parsing
|
||||
|
||||
* libgimp/Makefile.am, libgimp/gimp.h, libgimp/gimpdrawable.c,
|
||||
* libgimp/gimpimage.c, libgimp/gimpparasite.c, libgimp/parasite.c
|
||||
: removed parasite_slist functions. added new parasite functions.
|
||||
|
||||
* libgimp/gimpmatrix.h, libgimp/parasite.h: added extern "C"
|
||||
|
||||
Tue Oct 27 01:21:17 PST 1998 Manish Singh <yosh@gimp.org>
|
||||
|
||||
* app/indexed_palette.c: applied gimp-ruth-981025-0, cosmetic fix
|
||||
|
|
|
@ -160,6 +160,8 @@ gimp_SOURCES = \
|
|||
gimplist.h \
|
||||
gimplistF.h \
|
||||
gimplistP.h \
|
||||
gimpparasite.c \
|
||||
gimpparasite.h \
|
||||
gimprc.c \
|
||||
gimprc.h \
|
||||
global_edit.c \
|
||||
|
@ -229,6 +231,10 @@ gimp_SOURCES = \
|
|||
paintbrush.h \
|
||||
parasite_cmds.c \
|
||||
parasite_cmds.h \
|
||||
parasitelist.c \
|
||||
parasitelist.h \
|
||||
parasitelistF.h \
|
||||
parasitelistP.h \
|
||||
pattern_header.h \
|
||||
pattern_select.c \
|
||||
pattern_select.h \
|
||||
|
|
|
@ -2991,8 +2991,8 @@ plug_in_args_destroy (Argument *args,
|
|||
case PDB_PARASITE:
|
||||
if (full_destroy)
|
||||
{
|
||||
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
|
||||
args[i].value.pdb_pointer = NULL;*/
|
||||
parasite_free ((Parasite *)(args[i].value.pdb_pointer));
|
||||
args[i].value.pdb_pointer = NULL;
|
||||
}
|
||||
break;
|
||||
case PDB_STATUS:
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "errorconsole.h"
|
||||
#include "fileops.h"
|
||||
#include "gimprc.h"
|
||||
#include "gimpparasite.h"
|
||||
#include "gimpset.h"
|
||||
#include "global_edit.h"
|
||||
#include "gradient.h"
|
||||
|
@ -500,6 +501,7 @@ app_init (void)
|
|||
file_ops_pre_init (); /* pre-initialize the file types */
|
||||
RESET_BAR();
|
||||
xcf_init (); /* initialize the xcf file format routines */
|
||||
gimp_init_parasites (); /* initialize the parasite table */
|
||||
|
||||
app_init_update_status (_("Looking for data files"), _("Brushes"), 0.00);
|
||||
brushes_init (no_data); /* initialize the list of gimp brushes */
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "gimage_mask.h"
|
||||
#include "layer.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "libgimp/parasite.h"
|
||||
#include "parasitelist.h"
|
||||
#include "temp_buf.h"
|
||||
#include "undo.h"
|
||||
|
||||
|
@ -209,7 +209,7 @@ channel_copy (Channel *channel)
|
|||
|
||||
/* copy the parasites */
|
||||
GIMP_DRAWABLE(new_channel)->parasites
|
||||
= parasite_gslist_copy(GIMP_DRAWABLE(channel)->parasites);
|
||||
= parasite_list_copy(GIMP_DRAWABLE(channel)->parasites);
|
||||
|
||||
/* free up the channel_name memory */
|
||||
g_free (channel_name);
|
||||
|
@ -477,7 +477,7 @@ channel_invalidate_previews (GimpImage* gimage)
|
|||
}
|
||||
}
|
||||
|
||||
guint32
|
||||
Tattoo
|
||||
channel_get_tattoo(const Channel *channel)
|
||||
{
|
||||
return (gimp_drawable_get_tattoo(GIMP_DRAWABLE(channel)));
|
||||
|
|
|
@ -95,7 +95,7 @@ int channel_toggle_visibility (Channel *);
|
|||
TempBuf * channel_preview (Channel *, int, int);
|
||||
|
||||
void channel_invalidate_previews (GimpImage*);
|
||||
guint32 channel_get_tattoo(const Channel *);
|
||||
Tattoo channel_get_tattoo(const Channel *);
|
||||
|
||||
|
||||
/* selection mask functions */
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
/* gimpparasite.c: Copyright 1998 Jay Cox <jaycox@earthlink.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <glib.h>
|
||||
#include "parasitelist.h"
|
||||
#include "gimpparasite.h"
|
||||
|
||||
static ParasiteList *parasites = NULL;
|
||||
|
||||
void
|
||||
gimp_init_parasites()
|
||||
{
|
||||
g_return_if_fail(parasites == NULL);
|
||||
parasites = parasite_list_new();
|
||||
}
|
||||
|
||||
void
|
||||
gimp_attach_parasite (Parasite *p)
|
||||
{
|
||||
parasite_list_add(parasites, p);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_detach_parasite (char *name)
|
||||
{
|
||||
parasite_list_remove(parasites, name);
|
||||
}
|
||||
|
||||
Parasite *
|
||||
gimp_find_parasite (char *name)
|
||||
{
|
||||
return parasite_list_find(parasites, name);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
/* gimpparasite.h: Copyright 1998 Jay Cox <jaycox@earthlink.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_PARASITE_H__
|
||||
#define __GIMP_PARASITE_H__
|
||||
|
||||
#include "libgimp/parasiteF.h"
|
||||
|
||||
void gimp_init_parasites (void);
|
||||
void gimp_attach_parasite (Parasite *p);
|
||||
void gimp_detach_parasite (char *name);
|
||||
Parasite * gimp_find_parasite (char *name);
|
||||
|
||||
#endif /* __GIMP_PARASITE_H__ */
|
|
@ -27,7 +27,7 @@
|
|||
#include "gimage_mask.h"
|
||||
#include "layer.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "libgimp/parasite.h"
|
||||
#include "parasitelist.h"
|
||||
#include "temp_buf.h"
|
||||
#include "undo.h"
|
||||
|
||||
|
@ -209,7 +209,7 @@ channel_copy (Channel *channel)
|
|||
|
||||
/* copy the parasites */
|
||||
GIMP_DRAWABLE(new_channel)->parasites
|
||||
= parasite_gslist_copy(GIMP_DRAWABLE(channel)->parasites);
|
||||
= parasite_list_copy(GIMP_DRAWABLE(channel)->parasites);
|
||||
|
||||
/* free up the channel_name memory */
|
||||
g_free (channel_name);
|
||||
|
@ -477,7 +477,7 @@ channel_invalidate_previews (GimpImage* gimage)
|
|||
}
|
||||
}
|
||||
|
||||
guint32
|
||||
Tattoo
|
||||
channel_get_tattoo(const Channel *channel)
|
||||
{
|
||||
return (gimp_drawable_get_tattoo(GIMP_DRAWABLE(channel)));
|
||||
|
|
|
@ -95,7 +95,7 @@ int channel_toggle_visibility (Channel *);
|
|||
TempBuf * channel_preview (Channel *, int, int);
|
||||
|
||||
void channel_invalidate_previews (GimpImage*);
|
||||
guint32 channel_get_tattoo(const Channel *);
|
||||
Tattoo channel_get_tattoo(const Channel *);
|
||||
|
||||
|
||||
/* selection mask functions */
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "gimage_mask.h"
|
||||
#include "layer.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "libgimp/parasite.h"
|
||||
#include "parasitelist.h"
|
||||
#include "temp_buf.h"
|
||||
#include "undo.h"
|
||||
|
||||
|
@ -209,7 +209,7 @@ channel_copy (Channel *channel)
|
|||
|
||||
/* copy the parasites */
|
||||
GIMP_DRAWABLE(new_channel)->parasites
|
||||
= parasite_gslist_copy(GIMP_DRAWABLE(channel)->parasites);
|
||||
= parasite_list_copy(GIMP_DRAWABLE(channel)->parasites);
|
||||
|
||||
/* free up the channel_name memory */
|
||||
g_free (channel_name);
|
||||
|
@ -477,7 +477,7 @@ channel_invalidate_previews (GimpImage* gimage)
|
|||
}
|
||||
}
|
||||
|
||||
guint32
|
||||
Tattoo
|
||||
channel_get_tattoo(const Channel *channel)
|
||||
{
|
||||
return (gimp_drawable_get_tattoo(GIMP_DRAWABLE(channel)));
|
||||
|
|
|
@ -95,7 +95,7 @@ int channel_toggle_visibility (Channel *);
|
|||
TempBuf * channel_preview (Channel *, int, int);
|
||||
|
||||
void channel_invalidate_previews (GimpImage*);
|
||||
guint32 channel_get_tattoo(const Channel *);
|
||||
Tattoo channel_get_tattoo(const Channel *);
|
||||
|
||||
|
||||
/* selection mask functions */
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "gimpsignal.h"
|
||||
#include "gimage.h"
|
||||
#include "gimage_mask.h"
|
||||
#include "libgimp/parasite.h"
|
||||
#include "parasitelist.h"
|
||||
|
||||
|
||||
enum {
|
||||
|
@ -375,25 +375,22 @@ gimp_drawable_set_name (GimpDrawable *drawable, char *name)
|
|||
Parasite *
|
||||
gimp_drawable_find_parasite (const GimpDrawable *drawable, const char *name)
|
||||
{
|
||||
return parasite_find_in_gslist(drawable->parasites, name);
|
||||
return parasite_list_find(drawable->parasites, name);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_drawable_attach_parasite (GimpDrawable *drawable, const Parasite *parasite)
|
||||
gimp_drawable_attach_parasite (GimpDrawable *drawable, Parasite *parasite)
|
||||
{
|
||||
drawable->parasites = parasite_add_to_gslist(parasite, drawable->parasites);
|
||||
parasite_list_add(drawable->parasites, parasite);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_drawable_detach_parasite (GimpDrawable *drawable, const char *parasite)
|
||||
{
|
||||
Parasite *p;
|
||||
if ((p = parasite_find_in_gslist(drawable->parasites, parasite)))
|
||||
drawable->parasites = g_slist_remove (drawable->parasites, p);
|
||||
parasite_free(p);
|
||||
parasite_list_remove(drawable->parasites, parasite);
|
||||
}
|
||||
|
||||
guint32
|
||||
Tattoo
|
||||
gimp_drawable_get_tattoo(const GimpDrawable *drawable)
|
||||
{
|
||||
return drawable->tattoo;
|
||||
|
@ -556,7 +553,7 @@ gimp_drawable_init (GimpDrawable *drawable)
|
|||
drawable->has_alpha = FALSE;
|
||||
drawable->preview = NULL;
|
||||
drawable->preview_valid = FALSE;
|
||||
drawable->parasites = FALSE;
|
||||
drawable->parasites = parasite_list_new();
|
||||
drawable->tattoo = 0;
|
||||
gimp_matrix_identity(drawable->transform);
|
||||
|
||||
|
@ -588,7 +585,7 @@ gimp_drawable_destroy (GtkObject *object)
|
|||
temp_buf_free (drawable->preview);
|
||||
|
||||
if (drawable->parasites)
|
||||
parasite_gslist_destroy(drawable->parasites);
|
||||
gtk_object_unref(GTK_OBJECT(drawable->parasites));
|
||||
|
||||
if (GTK_OBJECT_CLASS (parent_class)->destroy)
|
||||
(*GTK_OBJECT_CLASS (parent_class)->destroy) (object);
|
||||
|
|
|
@ -75,10 +75,10 @@ void gimp_drawable_set_name (GimpDrawable *, char *);
|
|||
|
||||
Parasite * gimp_drawable_find_parasite (const GimpDrawable *,
|
||||
const char *name);
|
||||
void gimp_drawable_attach_parasite (GimpDrawable *, const Parasite *);
|
||||
void gimp_drawable_attach_parasite (GimpDrawable *, Parasite *);
|
||||
void gimp_drawable_detach_parasite (GimpDrawable *,
|
||||
const char *);
|
||||
guint32 gimp_drawable_get_tattoo (const GimpDrawable *);
|
||||
Tattoo gimp_drawable_get_tattoo (const GimpDrawable *);
|
||||
|
||||
GimpDrawable * gimp_drawable_get_ID (int);
|
||||
void gimp_drawable_deallocate (GimpDrawable *);
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "paint_funcs.h"
|
||||
#include "palette.h"
|
||||
#include "libgimp/parasite.h"
|
||||
#include "parasitelist.h"
|
||||
#include "undo.h"
|
||||
#include "gimpsignal.h"
|
||||
|
||||
|
@ -152,7 +153,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->parasites = parasite_list_new();
|
||||
gimp_matrix_identity(gimage->transform);
|
||||
gimage->resolution = 72.0; /* maybe should be rc-supplied default? */
|
||||
gimage->save_proc= NULL;
|
||||
|
@ -493,7 +494,7 @@ gimp_image_destroy (GtkObject *object)
|
|||
gimp_image_free_channels (gimage);
|
||||
channel_delete (gimage->selection_mask);
|
||||
if (gimage->parasites)
|
||||
parasite_gslist_destroy(gimage->parasites);
|
||||
gtk_object_unref(GTK_OBJECT(gimage->parasites));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -875,28 +876,28 @@ gimp_image_delete_guide (GimpImage *gimage,
|
|||
Parasite *
|
||||
gimp_image_find_parasite (const GimpImage *gimage, const char *name)
|
||||
{
|
||||
return parasite_find_in_gslist(gimage->parasites, name);
|
||||
return parasite_list_find(gimage->parasites, name);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_image_attach_parasite (GimpImage *gimage, const Parasite *parasite)
|
||||
gimp_image_attach_parasite (GimpImage *gimage, Parasite *parasite)
|
||||
{
|
||||
gimage->parasites = parasite_add_to_gslist(parasite, gimage->parasites);
|
||||
parasite_list_add(gimage->parasites, parasite);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_image_detach_parasite (GimpImage *gimage, const char *parasite)
|
||||
{
|
||||
Parasite *p;
|
||||
if ((p = parasite_find_in_gslist(gimage->parasites, parasite)))
|
||||
gimage->parasites = g_slist_remove (gimage->parasites, p);
|
||||
parasite_free(p);
|
||||
parasite_list_remove(gimage->parasites, parasite);
|
||||
}
|
||||
|
||||
guint32
|
||||
Tattoo
|
||||
gimp_image_get_new_tattoo(GimpImage *image)
|
||||
{
|
||||
return (++image->tattoo_state);
|
||||
image->tattoo_state++;
|
||||
if (image->tattoo_state <= 0)
|
||||
g_warning("Tattoo state has become corrupt (2.1 billion operation limit exceded)");
|
||||
return (image->tattoo_state);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1417,7 +1418,7 @@ gimp_image_get_active_channel (GimpImage *gimage)
|
|||
|
||||
|
||||
Layer *
|
||||
gimp_image_get_layer_by_tattoo (GimpImage *gimage, guint32 tattoo)
|
||||
gimp_image_get_layer_by_tattoo (GimpImage *gimage, Tattoo tattoo)
|
||||
{
|
||||
Layer *layer;
|
||||
GSList *layers = gimage->layers;
|
||||
|
@ -1434,7 +1435,7 @@ gimp_image_get_layer_by_tattoo (GimpImage *gimage, guint32 tattoo)
|
|||
}
|
||||
|
||||
Channel *
|
||||
gimp_image_get_channel_by_tattoo (GimpImage *gimage, guint32 tattoo)
|
||||
gimp_image_get_channel_by_tattoo (GimpImage *gimage, Tattoo tattoo)
|
||||
{
|
||||
Channel *channel;
|
||||
GSList *channels = gimage->channels;
|
||||
|
|
|
@ -114,16 +114,23 @@ GimpImage * gimp_image_get_named (char *);
|
|||
GimpImage * gimp_image_get_ID (int);
|
||||
TileManager * gimp_image_shadow (GimpImage *, int, int, int);
|
||||
void gimp_image_free_shadow (GimpImage *);
|
||||
void gimp_image_apply_image (GimpImage *, GimpDrawable *, PixelRegion *, int, int, int,
|
||||
TileManager *, int, int);
|
||||
void gimp_image_replace_image (GimpImage *, GimpDrawable *, PixelRegion *, int, int,
|
||||
PixelRegion *, int, int);
|
||||
void gimp_image_get_foreground (GimpImage *, GimpDrawable *, unsigned char *);
|
||||
void gimp_image_get_background (GimpImage *, GimpDrawable *, unsigned char *);
|
||||
void gimp_image_get_color (GimpImage *, int, unsigned char *,
|
||||
unsigned char *);
|
||||
void gimp_image_transform_color (GimpImage *, GimpDrawable *, unsigned char *,
|
||||
unsigned char *, int);
|
||||
void gimp_image_apply_image (GimpImage *, GimpDrawable *,
|
||||
PixelRegion *, int,
|
||||
int, int,
|
||||
TileManager *, int, int);
|
||||
void gimp_image_replace_image (GimpImage *, GimpDrawable *,
|
||||
PixelRegion *, int, int,
|
||||
PixelRegion *, int, int);
|
||||
void gimp_image_get_foreground (GimpImage *, GimpDrawable *,
|
||||
unsigned char *);
|
||||
void gimp_image_get_background (GimpImage *, GimpDrawable *,
|
||||
unsigned char *);
|
||||
void gimp_image_get_color (GimpImage *, int,
|
||||
unsigned char *,
|
||||
unsigned char *);
|
||||
void gimp_image_transform_color (GimpImage *, GimpDrawable *,
|
||||
unsigned char *,
|
||||
unsigned char *, int);
|
||||
Guide* gimp_image_add_hguide (GimpImage *);
|
||||
Guide* gimp_image_add_vguide (GimpImage *);
|
||||
void gimp_image_add_guide (GimpImage *, Guide *);
|
||||
|
@ -132,10 +139,10 @@ void gimp_image_delete_guide (GimpImage *, Guide *);
|
|||
|
||||
Parasite * gimp_image_find_parasite (const GimpImage *,
|
||||
const char *name);
|
||||
void gimp_image_attach_parasite (GimpImage *, const Parasite *);
|
||||
void gimp_image_attach_parasite (GimpImage *, Parasite *);
|
||||
void gimp_image_detach_parasite (GimpImage *, const char *);
|
||||
|
||||
guint32 gimp_image_get_new_tattoo (GimpImage *);
|
||||
Tattoo gimp_image_get_new_tattoo (GimpImage *);
|
||||
|
||||
|
||||
/* layer/channel functions */
|
||||
|
@ -144,8 +151,8 @@ int gimp_image_get_layer_index (GimpImage *, Layer *);
|
|||
int gimp_image_get_channel_index (GimpImage *, Channel *);
|
||||
Layer * gimp_image_get_active_layer (GimpImage *);
|
||||
Channel * gimp_image_get_active_channel (GimpImage *);
|
||||
Layer * gimp_image_get_layer_by_tattoo (GimpImage *, guint32);
|
||||
Channel * gimp_image_get_channel_by_tattoo (GimpImage *, guint32);
|
||||
Layer * gimp_image_get_layer_by_tattoo (GimpImage *, Tattoo);
|
||||
Channel * gimp_image_get_channel_by_tattoo (GimpImage *, Tattoo);
|
||||
Channel * gimp_image_get_mask (GimpImage *);
|
||||
int gimp_image_get_component_active (GimpImage *, ChannelType);
|
||||
int gimp_image_get_component_visible (GimpImage *, ChannelType);
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "paint_funcs.h"
|
||||
#include "palette.h"
|
||||
#include "libgimp/parasite.h"
|
||||
#include "parasitelist.h"
|
||||
#include "undo.h"
|
||||
#include "gimpsignal.h"
|
||||
|
||||
|
@ -152,7 +153,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->parasites = parasite_list_new();
|
||||
gimp_matrix_identity(gimage->transform);
|
||||
gimage->resolution = 72.0; /* maybe should be rc-supplied default? */
|
||||
gimage->save_proc= NULL;
|
||||
|
@ -493,7 +494,7 @@ gimp_image_destroy (GtkObject *object)
|
|||
gimp_image_free_channels (gimage);
|
||||
channel_delete (gimage->selection_mask);
|
||||
if (gimage->parasites)
|
||||
parasite_gslist_destroy(gimage->parasites);
|
||||
gtk_object_unref(GTK_OBJECT(gimage->parasites));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -875,28 +876,28 @@ gimp_image_delete_guide (GimpImage *gimage,
|
|||
Parasite *
|
||||
gimp_image_find_parasite (const GimpImage *gimage, const char *name)
|
||||
{
|
||||
return parasite_find_in_gslist(gimage->parasites, name);
|
||||
return parasite_list_find(gimage->parasites, name);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_image_attach_parasite (GimpImage *gimage, const Parasite *parasite)
|
||||
gimp_image_attach_parasite (GimpImage *gimage, Parasite *parasite)
|
||||
{
|
||||
gimage->parasites = parasite_add_to_gslist(parasite, gimage->parasites);
|
||||
parasite_list_add(gimage->parasites, parasite);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_image_detach_parasite (GimpImage *gimage, const char *parasite)
|
||||
{
|
||||
Parasite *p;
|
||||
if ((p = parasite_find_in_gslist(gimage->parasites, parasite)))
|
||||
gimage->parasites = g_slist_remove (gimage->parasites, p);
|
||||
parasite_free(p);
|
||||
parasite_list_remove(gimage->parasites, parasite);
|
||||
}
|
||||
|
||||
guint32
|
||||
Tattoo
|
||||
gimp_image_get_new_tattoo(GimpImage *image)
|
||||
{
|
||||
return (++image->tattoo_state);
|
||||
image->tattoo_state++;
|
||||
if (image->tattoo_state <= 0)
|
||||
g_warning("Tattoo state has become corrupt (2.1 billion operation limit exceded)");
|
||||
return (image->tattoo_state);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1417,7 +1418,7 @@ gimp_image_get_active_channel (GimpImage *gimage)
|
|||
|
||||
|
||||
Layer *
|
||||
gimp_image_get_layer_by_tattoo (GimpImage *gimage, guint32 tattoo)
|
||||
gimp_image_get_layer_by_tattoo (GimpImage *gimage, Tattoo tattoo)
|
||||
{
|
||||
Layer *layer;
|
||||
GSList *layers = gimage->layers;
|
||||
|
@ -1434,7 +1435,7 @@ gimp_image_get_layer_by_tattoo (GimpImage *gimage, guint32 tattoo)
|
|||
}
|
||||
|
||||
Channel *
|
||||
gimp_image_get_channel_by_tattoo (GimpImage *gimage, guint32 tattoo)
|
||||
gimp_image_get_channel_by_tattoo (GimpImage *gimage, Tattoo tattoo)
|
||||
{
|
||||
Channel *channel;
|
||||
GSList *channels = gimage->channels;
|
||||
|
|
|
@ -114,16 +114,23 @@ GimpImage * gimp_image_get_named (char *);
|
|||
GimpImage * gimp_image_get_ID (int);
|
||||
TileManager * gimp_image_shadow (GimpImage *, int, int, int);
|
||||
void gimp_image_free_shadow (GimpImage *);
|
||||
void gimp_image_apply_image (GimpImage *, GimpDrawable *, PixelRegion *, int, int, int,
|
||||
TileManager *, int, int);
|
||||
void gimp_image_replace_image (GimpImage *, GimpDrawable *, PixelRegion *, int, int,
|
||||
PixelRegion *, int, int);
|
||||
void gimp_image_get_foreground (GimpImage *, GimpDrawable *, unsigned char *);
|
||||
void gimp_image_get_background (GimpImage *, GimpDrawable *, unsigned char *);
|
||||
void gimp_image_get_color (GimpImage *, int, unsigned char *,
|
||||
unsigned char *);
|
||||
void gimp_image_transform_color (GimpImage *, GimpDrawable *, unsigned char *,
|
||||
unsigned char *, int);
|
||||
void gimp_image_apply_image (GimpImage *, GimpDrawable *,
|
||||
PixelRegion *, int,
|
||||
int, int,
|
||||
TileManager *, int, int);
|
||||
void gimp_image_replace_image (GimpImage *, GimpDrawable *,
|
||||
PixelRegion *, int, int,
|
||||
PixelRegion *, int, int);
|
||||
void gimp_image_get_foreground (GimpImage *, GimpDrawable *,
|
||||
unsigned char *);
|
||||
void gimp_image_get_background (GimpImage *, GimpDrawable *,
|
||||
unsigned char *);
|
||||
void gimp_image_get_color (GimpImage *, int,
|
||||
unsigned char *,
|
||||
unsigned char *);
|
||||
void gimp_image_transform_color (GimpImage *, GimpDrawable *,
|
||||
unsigned char *,
|
||||
unsigned char *, int);
|
||||
Guide* gimp_image_add_hguide (GimpImage *);
|
||||
Guide* gimp_image_add_vguide (GimpImage *);
|
||||
void gimp_image_add_guide (GimpImage *, Guide *);
|
||||
|
@ -132,10 +139,10 @@ void gimp_image_delete_guide (GimpImage *, Guide *);
|
|||
|
||||
Parasite * gimp_image_find_parasite (const GimpImage *,
|
||||
const char *name);
|
||||
void gimp_image_attach_parasite (GimpImage *, const Parasite *);
|
||||
void gimp_image_attach_parasite (GimpImage *, Parasite *);
|
||||
void gimp_image_detach_parasite (GimpImage *, const char *);
|
||||
|
||||
guint32 gimp_image_get_new_tattoo (GimpImage *);
|
||||
Tattoo gimp_image_get_new_tattoo (GimpImage *);
|
||||
|
||||
|
||||
/* layer/channel functions */
|
||||
|
@ -144,8 +151,8 @@ int gimp_image_get_layer_index (GimpImage *, Layer *);
|
|||
int gimp_image_get_channel_index (GimpImage *, Channel *);
|
||||
Layer * gimp_image_get_active_layer (GimpImage *);
|
||||
Channel * gimp_image_get_active_channel (GimpImage *);
|
||||
Layer * gimp_image_get_layer_by_tattoo (GimpImage *, guint32);
|
||||
Channel * gimp_image_get_channel_by_tattoo (GimpImage *, guint32);
|
||||
Layer * gimp_image_get_layer_by_tattoo (GimpImage *, Tattoo);
|
||||
Channel * gimp_image_get_channel_by_tattoo (GimpImage *, Tattoo);
|
||||
Channel * gimp_image_get_mask (GimpImage *);
|
||||
int gimp_image_get_component_active (GimpImage *, ChannelType);
|
||||
int gimp_image_get_component_visible (GimpImage *, ChannelType);
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "paint_funcs.h"
|
||||
#include "palette.h"
|
||||
#include "libgimp/parasite.h"
|
||||
#include "parasitelist.h"
|
||||
#include "undo.h"
|
||||
#include "gimpsignal.h"
|
||||
|
||||
|
@ -152,7 +153,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->parasites = parasite_list_new();
|
||||
gimp_matrix_identity(gimage->transform);
|
||||
gimage->resolution = 72.0; /* maybe should be rc-supplied default? */
|
||||
gimage->save_proc= NULL;
|
||||
|
@ -493,7 +494,7 @@ gimp_image_destroy (GtkObject *object)
|
|||
gimp_image_free_channels (gimage);
|
||||
channel_delete (gimage->selection_mask);
|
||||
if (gimage->parasites)
|
||||
parasite_gslist_destroy(gimage->parasites);
|
||||
gtk_object_unref(GTK_OBJECT(gimage->parasites));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -875,28 +876,28 @@ gimp_image_delete_guide (GimpImage *gimage,
|
|||
Parasite *
|
||||
gimp_image_find_parasite (const GimpImage *gimage, const char *name)
|
||||
{
|
||||
return parasite_find_in_gslist(gimage->parasites, name);
|
||||
return parasite_list_find(gimage->parasites, name);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_image_attach_parasite (GimpImage *gimage, const Parasite *parasite)
|
||||
gimp_image_attach_parasite (GimpImage *gimage, Parasite *parasite)
|
||||
{
|
||||
gimage->parasites = parasite_add_to_gslist(parasite, gimage->parasites);
|
||||
parasite_list_add(gimage->parasites, parasite);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_image_detach_parasite (GimpImage *gimage, const char *parasite)
|
||||
{
|
||||
Parasite *p;
|
||||
if ((p = parasite_find_in_gslist(gimage->parasites, parasite)))
|
||||
gimage->parasites = g_slist_remove (gimage->parasites, p);
|
||||
parasite_free(p);
|
||||
parasite_list_remove(gimage->parasites, parasite);
|
||||
}
|
||||
|
||||
guint32
|
||||
Tattoo
|
||||
gimp_image_get_new_tattoo(GimpImage *image)
|
||||
{
|
||||
return (++image->tattoo_state);
|
||||
image->tattoo_state++;
|
||||
if (image->tattoo_state <= 0)
|
||||
g_warning("Tattoo state has become corrupt (2.1 billion operation limit exceded)");
|
||||
return (image->tattoo_state);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1417,7 +1418,7 @@ gimp_image_get_active_channel (GimpImage *gimage)
|
|||
|
||||
|
||||
Layer *
|
||||
gimp_image_get_layer_by_tattoo (GimpImage *gimage, guint32 tattoo)
|
||||
gimp_image_get_layer_by_tattoo (GimpImage *gimage, Tattoo tattoo)
|
||||
{
|
||||
Layer *layer;
|
||||
GSList *layers = gimage->layers;
|
||||
|
@ -1434,7 +1435,7 @@ gimp_image_get_layer_by_tattoo (GimpImage *gimage, guint32 tattoo)
|
|||
}
|
||||
|
||||
Channel *
|
||||
gimp_image_get_channel_by_tattoo (GimpImage *gimage, guint32 tattoo)
|
||||
gimp_image_get_channel_by_tattoo (GimpImage *gimage, Tattoo tattoo)
|
||||
{
|
||||
Channel *channel;
|
||||
GSList *channels = gimage->channels;
|
||||
|
|
|
@ -114,16 +114,23 @@ GimpImage * gimp_image_get_named (char *);
|
|||
GimpImage * gimp_image_get_ID (int);
|
||||
TileManager * gimp_image_shadow (GimpImage *, int, int, int);
|
||||
void gimp_image_free_shadow (GimpImage *);
|
||||
void gimp_image_apply_image (GimpImage *, GimpDrawable *, PixelRegion *, int, int, int,
|
||||
TileManager *, int, int);
|
||||
void gimp_image_replace_image (GimpImage *, GimpDrawable *, PixelRegion *, int, int,
|
||||
PixelRegion *, int, int);
|
||||
void gimp_image_get_foreground (GimpImage *, GimpDrawable *, unsigned char *);
|
||||
void gimp_image_get_background (GimpImage *, GimpDrawable *, unsigned char *);
|
||||
void gimp_image_get_color (GimpImage *, int, unsigned char *,
|
||||
unsigned char *);
|
||||
void gimp_image_transform_color (GimpImage *, GimpDrawable *, unsigned char *,
|
||||
unsigned char *, int);
|
||||
void gimp_image_apply_image (GimpImage *, GimpDrawable *,
|
||||
PixelRegion *, int,
|
||||
int, int,
|
||||
TileManager *, int, int);
|
||||
void gimp_image_replace_image (GimpImage *, GimpDrawable *,
|
||||
PixelRegion *, int, int,
|
||||
PixelRegion *, int, int);
|
||||
void gimp_image_get_foreground (GimpImage *, GimpDrawable *,
|
||||
unsigned char *);
|
||||
void gimp_image_get_background (GimpImage *, GimpDrawable *,
|
||||
unsigned char *);
|
||||
void gimp_image_get_color (GimpImage *, int,
|
||||
unsigned char *,
|
||||
unsigned char *);
|
||||
void gimp_image_transform_color (GimpImage *, GimpDrawable *,
|
||||
unsigned char *,
|
||||
unsigned char *, int);
|
||||
Guide* gimp_image_add_hguide (GimpImage *);
|
||||
Guide* gimp_image_add_vguide (GimpImage *);
|
||||
void gimp_image_add_guide (GimpImage *, Guide *);
|
||||
|
@ -132,10 +139,10 @@ void gimp_image_delete_guide (GimpImage *, Guide *);
|
|||
|
||||
Parasite * gimp_image_find_parasite (const GimpImage *,
|
||||
const char *name);
|
||||
void gimp_image_attach_parasite (GimpImage *, const Parasite *);
|
||||
void gimp_image_attach_parasite (GimpImage *, Parasite *);
|
||||
void gimp_image_detach_parasite (GimpImage *, const char *);
|
||||
|
||||
guint32 gimp_image_get_new_tattoo (GimpImage *);
|
||||
Tattoo gimp_image_get_new_tattoo (GimpImage *);
|
||||
|
||||
|
||||
/* layer/channel functions */
|
||||
|
@ -144,8 +151,8 @@ int gimp_image_get_layer_index (GimpImage *, Layer *);
|
|||
int gimp_image_get_channel_index (GimpImage *, Channel *);
|
||||
Layer * gimp_image_get_active_layer (GimpImage *);
|
||||
Channel * gimp_image_get_active_channel (GimpImage *);
|
||||
Layer * gimp_image_get_layer_by_tattoo (GimpImage *, guint32);
|
||||
Channel * gimp_image_get_channel_by_tattoo (GimpImage *, guint32);
|
||||
Layer * gimp_image_get_layer_by_tattoo (GimpImage *, Tattoo);
|
||||
Channel * gimp_image_get_channel_by_tattoo (GimpImage *, Tattoo);
|
||||
Channel * gimp_image_get_mask (GimpImage *);
|
||||
int gimp_image_get_component_active (GimpImage *, ChannelType);
|
||||
int gimp_image_get_component_visible (GimpImage *, ChannelType);
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "paint_funcs.h"
|
||||
#include "palette.h"
|
||||
#include "libgimp/parasite.h"
|
||||
#include "parasitelist.h"
|
||||
#include "undo.h"
|
||||
#include "gimpsignal.h"
|
||||
|
||||
|
@ -152,7 +153,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->parasites = parasite_list_new();
|
||||
gimp_matrix_identity(gimage->transform);
|
||||
gimage->resolution = 72.0; /* maybe should be rc-supplied default? */
|
||||
gimage->save_proc= NULL;
|
||||
|
@ -493,7 +494,7 @@ gimp_image_destroy (GtkObject *object)
|
|||
gimp_image_free_channels (gimage);
|
||||
channel_delete (gimage->selection_mask);
|
||||
if (gimage->parasites)
|
||||
parasite_gslist_destroy(gimage->parasites);
|
||||
gtk_object_unref(GTK_OBJECT(gimage->parasites));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -875,28 +876,28 @@ gimp_image_delete_guide (GimpImage *gimage,
|
|||
Parasite *
|
||||
gimp_image_find_parasite (const GimpImage *gimage, const char *name)
|
||||
{
|
||||
return parasite_find_in_gslist(gimage->parasites, name);
|
||||
return parasite_list_find(gimage->parasites, name);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_image_attach_parasite (GimpImage *gimage, const Parasite *parasite)
|
||||
gimp_image_attach_parasite (GimpImage *gimage, Parasite *parasite)
|
||||
{
|
||||
gimage->parasites = parasite_add_to_gslist(parasite, gimage->parasites);
|
||||
parasite_list_add(gimage->parasites, parasite);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_image_detach_parasite (GimpImage *gimage, const char *parasite)
|
||||
{
|
||||
Parasite *p;
|
||||
if ((p = parasite_find_in_gslist(gimage->parasites, parasite)))
|
||||
gimage->parasites = g_slist_remove (gimage->parasites, p);
|
||||
parasite_free(p);
|
||||
parasite_list_remove(gimage->parasites, parasite);
|
||||
}
|
||||
|
||||
guint32
|
||||
Tattoo
|
||||
gimp_image_get_new_tattoo(GimpImage *image)
|
||||
{
|
||||
return (++image->tattoo_state);
|
||||
image->tattoo_state++;
|
||||
if (image->tattoo_state <= 0)
|
||||
g_warning("Tattoo state has become corrupt (2.1 billion operation limit exceded)");
|
||||
return (image->tattoo_state);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1417,7 +1418,7 @@ gimp_image_get_active_channel (GimpImage *gimage)
|
|||
|
||||
|
||||
Layer *
|
||||
gimp_image_get_layer_by_tattoo (GimpImage *gimage, guint32 tattoo)
|
||||
gimp_image_get_layer_by_tattoo (GimpImage *gimage, Tattoo tattoo)
|
||||
{
|
||||
Layer *layer;
|
||||
GSList *layers = gimage->layers;
|
||||
|
@ -1434,7 +1435,7 @@ gimp_image_get_layer_by_tattoo (GimpImage *gimage, guint32 tattoo)
|
|||
}
|
||||
|
||||
Channel *
|
||||
gimp_image_get_channel_by_tattoo (GimpImage *gimage, guint32 tattoo)
|
||||
gimp_image_get_channel_by_tattoo (GimpImage *gimage, Tattoo tattoo)
|
||||
{
|
||||
Channel *channel;
|
||||
GSList *channels = gimage->channels;
|
||||
|
|
|
@ -114,16 +114,23 @@ GimpImage * gimp_image_get_named (char *);
|
|||
GimpImage * gimp_image_get_ID (int);
|
||||
TileManager * gimp_image_shadow (GimpImage *, int, int, int);
|
||||
void gimp_image_free_shadow (GimpImage *);
|
||||
void gimp_image_apply_image (GimpImage *, GimpDrawable *, PixelRegion *, int, int, int,
|
||||
TileManager *, int, int);
|
||||
void gimp_image_replace_image (GimpImage *, GimpDrawable *, PixelRegion *, int, int,
|
||||
PixelRegion *, int, int);
|
||||
void gimp_image_get_foreground (GimpImage *, GimpDrawable *, unsigned char *);
|
||||
void gimp_image_get_background (GimpImage *, GimpDrawable *, unsigned char *);
|
||||
void gimp_image_get_color (GimpImage *, int, unsigned char *,
|
||||
unsigned char *);
|
||||
void gimp_image_transform_color (GimpImage *, GimpDrawable *, unsigned char *,
|
||||
unsigned char *, int);
|
||||
void gimp_image_apply_image (GimpImage *, GimpDrawable *,
|
||||
PixelRegion *, int,
|
||||
int, int,
|
||||
TileManager *, int, int);
|
||||
void gimp_image_replace_image (GimpImage *, GimpDrawable *,
|
||||
PixelRegion *, int, int,
|
||||
PixelRegion *, int, int);
|
||||
void gimp_image_get_foreground (GimpImage *, GimpDrawable *,
|
||||
unsigned char *);
|
||||
void gimp_image_get_background (GimpImage *, GimpDrawable *,
|
||||
unsigned char *);
|
||||
void gimp_image_get_color (GimpImage *, int,
|
||||
unsigned char *,
|
||||
unsigned char *);
|
||||
void gimp_image_transform_color (GimpImage *, GimpDrawable *,
|
||||
unsigned char *,
|
||||
unsigned char *, int);
|
||||
Guide* gimp_image_add_hguide (GimpImage *);
|
||||
Guide* gimp_image_add_vguide (GimpImage *);
|
||||
void gimp_image_add_guide (GimpImage *, Guide *);
|
||||
|
@ -132,10 +139,10 @@ void gimp_image_delete_guide (GimpImage *, Guide *);
|
|||
|
||||
Parasite * gimp_image_find_parasite (const GimpImage *,
|
||||
const char *name);
|
||||
void gimp_image_attach_parasite (GimpImage *, const Parasite *);
|
||||
void gimp_image_attach_parasite (GimpImage *, Parasite *);
|
||||
void gimp_image_detach_parasite (GimpImage *, const char *);
|
||||
|
||||
guint32 gimp_image_get_new_tattoo (GimpImage *);
|
||||
Tattoo gimp_image_get_new_tattoo (GimpImage *);
|
||||
|
||||
|
||||
/* layer/channel functions */
|
||||
|
@ -144,8 +151,8 @@ int gimp_image_get_layer_index (GimpImage *, Layer *);
|
|||
int gimp_image_get_channel_index (GimpImage *, Channel *);
|
||||
Layer * gimp_image_get_active_layer (GimpImage *);
|
||||
Channel * gimp_image_get_active_channel (GimpImage *);
|
||||
Layer * gimp_image_get_layer_by_tattoo (GimpImage *, guint32);
|
||||
Channel * gimp_image_get_channel_by_tattoo (GimpImage *, guint32);
|
||||
Layer * gimp_image_get_layer_by_tattoo (GimpImage *, Tattoo);
|
||||
Channel * gimp_image_get_channel_by_tattoo (GimpImage *, Tattoo);
|
||||
Channel * gimp_image_get_mask (GimpImage *);
|
||||
int gimp_image_get_component_active (GimpImage *, ChannelType);
|
||||
int gimp_image_get_component_visible (GimpImage *, ChannelType);
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "paint_funcs.h"
|
||||
#include "palette.h"
|
||||
#include "libgimp/parasite.h"
|
||||
#include "parasitelist.h"
|
||||
#include "undo.h"
|
||||
#include "gimpsignal.h"
|
||||
|
||||
|
@ -152,7 +153,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->parasites = parasite_list_new();
|
||||
gimp_matrix_identity(gimage->transform);
|
||||
gimage->resolution = 72.0; /* maybe should be rc-supplied default? */
|
||||
gimage->save_proc= NULL;
|
||||
|
@ -493,7 +494,7 @@ gimp_image_destroy (GtkObject *object)
|
|||
gimp_image_free_channels (gimage);
|
||||
channel_delete (gimage->selection_mask);
|
||||
if (gimage->parasites)
|
||||
parasite_gslist_destroy(gimage->parasites);
|
||||
gtk_object_unref(GTK_OBJECT(gimage->parasites));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -875,28 +876,28 @@ gimp_image_delete_guide (GimpImage *gimage,
|
|||
Parasite *
|
||||
gimp_image_find_parasite (const GimpImage *gimage, const char *name)
|
||||
{
|
||||
return parasite_find_in_gslist(gimage->parasites, name);
|
||||
return parasite_list_find(gimage->parasites, name);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_image_attach_parasite (GimpImage *gimage, const Parasite *parasite)
|
||||
gimp_image_attach_parasite (GimpImage *gimage, Parasite *parasite)
|
||||
{
|
||||
gimage->parasites = parasite_add_to_gslist(parasite, gimage->parasites);
|
||||
parasite_list_add(gimage->parasites, parasite);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_image_detach_parasite (GimpImage *gimage, const char *parasite)
|
||||
{
|
||||
Parasite *p;
|
||||
if ((p = parasite_find_in_gslist(gimage->parasites, parasite)))
|
||||
gimage->parasites = g_slist_remove (gimage->parasites, p);
|
||||
parasite_free(p);
|
||||
parasite_list_remove(gimage->parasites, parasite);
|
||||
}
|
||||
|
||||
guint32
|
||||
Tattoo
|
||||
gimp_image_get_new_tattoo(GimpImage *image)
|
||||
{
|
||||
return (++image->tattoo_state);
|
||||
image->tattoo_state++;
|
||||
if (image->tattoo_state <= 0)
|
||||
g_warning("Tattoo state has become corrupt (2.1 billion operation limit exceded)");
|
||||
return (image->tattoo_state);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1417,7 +1418,7 @@ gimp_image_get_active_channel (GimpImage *gimage)
|
|||
|
||||
|
||||
Layer *
|
||||
gimp_image_get_layer_by_tattoo (GimpImage *gimage, guint32 tattoo)
|
||||
gimp_image_get_layer_by_tattoo (GimpImage *gimage, Tattoo tattoo)
|
||||
{
|
||||
Layer *layer;
|
||||
GSList *layers = gimage->layers;
|
||||
|
@ -1434,7 +1435,7 @@ gimp_image_get_layer_by_tattoo (GimpImage *gimage, guint32 tattoo)
|
|||
}
|
||||
|
||||
Channel *
|
||||
gimp_image_get_channel_by_tattoo (GimpImage *gimage, guint32 tattoo)
|
||||
gimp_image_get_channel_by_tattoo (GimpImage *gimage, Tattoo tattoo)
|
||||
{
|
||||
Channel *channel;
|
||||
GSList *channels = gimage->channels;
|
||||
|
|
|
@ -114,16 +114,23 @@ GimpImage * gimp_image_get_named (char *);
|
|||
GimpImage * gimp_image_get_ID (int);
|
||||
TileManager * gimp_image_shadow (GimpImage *, int, int, int);
|
||||
void gimp_image_free_shadow (GimpImage *);
|
||||
void gimp_image_apply_image (GimpImage *, GimpDrawable *, PixelRegion *, int, int, int,
|
||||
TileManager *, int, int);
|
||||
void gimp_image_replace_image (GimpImage *, GimpDrawable *, PixelRegion *, int, int,
|
||||
PixelRegion *, int, int);
|
||||
void gimp_image_get_foreground (GimpImage *, GimpDrawable *, unsigned char *);
|
||||
void gimp_image_get_background (GimpImage *, GimpDrawable *, unsigned char *);
|
||||
void gimp_image_get_color (GimpImage *, int, unsigned char *,
|
||||
unsigned char *);
|
||||
void gimp_image_transform_color (GimpImage *, GimpDrawable *, unsigned char *,
|
||||
unsigned char *, int);
|
||||
void gimp_image_apply_image (GimpImage *, GimpDrawable *,
|
||||
PixelRegion *, int,
|
||||
int, int,
|
||||
TileManager *, int, int);
|
||||
void gimp_image_replace_image (GimpImage *, GimpDrawable *,
|
||||
PixelRegion *, int, int,
|
||||
PixelRegion *, int, int);
|
||||
void gimp_image_get_foreground (GimpImage *, GimpDrawable *,
|
||||
unsigned char *);
|
||||
void gimp_image_get_background (GimpImage *, GimpDrawable *,
|
||||
unsigned char *);
|
||||
void gimp_image_get_color (GimpImage *, int,
|
||||
unsigned char *,
|
||||
unsigned char *);
|
||||
void gimp_image_transform_color (GimpImage *, GimpDrawable *,
|
||||
unsigned char *,
|
||||
unsigned char *, int);
|
||||
Guide* gimp_image_add_hguide (GimpImage *);
|
||||
Guide* gimp_image_add_vguide (GimpImage *);
|
||||
void gimp_image_add_guide (GimpImage *, Guide *);
|
||||
|
@ -132,10 +139,10 @@ void gimp_image_delete_guide (GimpImage *, Guide *);
|
|||
|
||||
Parasite * gimp_image_find_parasite (const GimpImage *,
|
||||
const char *name);
|
||||
void gimp_image_attach_parasite (GimpImage *, const Parasite *);
|
||||
void gimp_image_attach_parasite (GimpImage *, Parasite *);
|
||||
void gimp_image_detach_parasite (GimpImage *, const char *);
|
||||
|
||||
guint32 gimp_image_get_new_tattoo (GimpImage *);
|
||||
Tattoo gimp_image_get_new_tattoo (GimpImage *);
|
||||
|
||||
|
||||
/* layer/channel functions */
|
||||
|
@ -144,8 +151,8 @@ int gimp_image_get_layer_index (GimpImage *, Layer *);
|
|||
int gimp_image_get_channel_index (GimpImage *, Channel *);
|
||||
Layer * gimp_image_get_active_layer (GimpImage *);
|
||||
Channel * gimp_image_get_active_channel (GimpImage *);
|
||||
Layer * gimp_image_get_layer_by_tattoo (GimpImage *, guint32);
|
||||
Channel * gimp_image_get_channel_by_tattoo (GimpImage *, guint32);
|
||||
Layer * gimp_image_get_layer_by_tattoo (GimpImage *, Tattoo);
|
||||
Channel * gimp_image_get_channel_by_tattoo (GimpImage *, Tattoo);
|
||||
Channel * gimp_image_get_mask (GimpImage *);
|
||||
int gimp_image_get_component_active (GimpImage *, ChannelType);
|
||||
int gimp_image_get_component_visible (GimpImage *, ChannelType);
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "paint_funcs.h"
|
||||
#include "palette.h"
|
||||
#include "libgimp/parasite.h"
|
||||
#include "parasitelist.h"
|
||||
#include "undo.h"
|
||||
#include "gimpsignal.h"
|
||||
|
||||
|
@ -152,7 +153,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->parasites = parasite_list_new();
|
||||
gimp_matrix_identity(gimage->transform);
|
||||
gimage->resolution = 72.0; /* maybe should be rc-supplied default? */
|
||||
gimage->save_proc= NULL;
|
||||
|
@ -493,7 +494,7 @@ gimp_image_destroy (GtkObject *object)
|
|||
gimp_image_free_channels (gimage);
|
||||
channel_delete (gimage->selection_mask);
|
||||
if (gimage->parasites)
|
||||
parasite_gslist_destroy(gimage->parasites);
|
||||
gtk_object_unref(GTK_OBJECT(gimage->parasites));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -875,28 +876,28 @@ gimp_image_delete_guide (GimpImage *gimage,
|
|||
Parasite *
|
||||
gimp_image_find_parasite (const GimpImage *gimage, const char *name)
|
||||
{
|
||||
return parasite_find_in_gslist(gimage->parasites, name);
|
||||
return parasite_list_find(gimage->parasites, name);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_image_attach_parasite (GimpImage *gimage, const Parasite *parasite)
|
||||
gimp_image_attach_parasite (GimpImage *gimage, Parasite *parasite)
|
||||
{
|
||||
gimage->parasites = parasite_add_to_gslist(parasite, gimage->parasites);
|
||||
parasite_list_add(gimage->parasites, parasite);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_image_detach_parasite (GimpImage *gimage, const char *parasite)
|
||||
{
|
||||
Parasite *p;
|
||||
if ((p = parasite_find_in_gslist(gimage->parasites, parasite)))
|
||||
gimage->parasites = g_slist_remove (gimage->parasites, p);
|
||||
parasite_free(p);
|
||||
parasite_list_remove(gimage->parasites, parasite);
|
||||
}
|
||||
|
||||
guint32
|
||||
Tattoo
|
||||
gimp_image_get_new_tattoo(GimpImage *image)
|
||||
{
|
||||
return (++image->tattoo_state);
|
||||
image->tattoo_state++;
|
||||
if (image->tattoo_state <= 0)
|
||||
g_warning("Tattoo state has become corrupt (2.1 billion operation limit exceded)");
|
||||
return (image->tattoo_state);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1417,7 +1418,7 @@ gimp_image_get_active_channel (GimpImage *gimage)
|
|||
|
||||
|
||||
Layer *
|
||||
gimp_image_get_layer_by_tattoo (GimpImage *gimage, guint32 tattoo)
|
||||
gimp_image_get_layer_by_tattoo (GimpImage *gimage, Tattoo tattoo)
|
||||
{
|
||||
Layer *layer;
|
||||
GSList *layers = gimage->layers;
|
||||
|
@ -1434,7 +1435,7 @@ gimp_image_get_layer_by_tattoo (GimpImage *gimage, guint32 tattoo)
|
|||
}
|
||||
|
||||
Channel *
|
||||
gimp_image_get_channel_by_tattoo (GimpImage *gimage, guint32 tattoo)
|
||||
gimp_image_get_channel_by_tattoo (GimpImage *gimage, Tattoo tattoo)
|
||||
{
|
||||
Channel *channel;
|
||||
GSList *channels = gimage->channels;
|
||||
|
|
|
@ -114,16 +114,23 @@ GimpImage * gimp_image_get_named (char *);
|
|||
GimpImage * gimp_image_get_ID (int);
|
||||
TileManager * gimp_image_shadow (GimpImage *, int, int, int);
|
||||
void gimp_image_free_shadow (GimpImage *);
|
||||
void gimp_image_apply_image (GimpImage *, GimpDrawable *, PixelRegion *, int, int, int,
|
||||
TileManager *, int, int);
|
||||
void gimp_image_replace_image (GimpImage *, GimpDrawable *, PixelRegion *, int, int,
|
||||
PixelRegion *, int, int);
|
||||
void gimp_image_get_foreground (GimpImage *, GimpDrawable *, unsigned char *);
|
||||
void gimp_image_get_background (GimpImage *, GimpDrawable *, unsigned char *);
|
||||
void gimp_image_get_color (GimpImage *, int, unsigned char *,
|
||||
unsigned char *);
|
||||
void gimp_image_transform_color (GimpImage *, GimpDrawable *, unsigned char *,
|
||||
unsigned char *, int);
|
||||
void gimp_image_apply_image (GimpImage *, GimpDrawable *,
|
||||
PixelRegion *, int,
|
||||
int, int,
|
||||
TileManager *, int, int);
|
||||
void gimp_image_replace_image (GimpImage *, GimpDrawable *,
|
||||
PixelRegion *, int, int,
|
||||
PixelRegion *, int, int);
|
||||
void gimp_image_get_foreground (GimpImage *, GimpDrawable *,
|
||||
unsigned char *);
|
||||
void gimp_image_get_background (GimpImage *, GimpDrawable *,
|
||||
unsigned char *);
|
||||
void gimp_image_get_color (GimpImage *, int,
|
||||
unsigned char *,
|
||||
unsigned char *);
|
||||
void gimp_image_transform_color (GimpImage *, GimpDrawable *,
|
||||
unsigned char *,
|
||||
unsigned char *, int);
|
||||
Guide* gimp_image_add_hguide (GimpImage *);
|
||||
Guide* gimp_image_add_vguide (GimpImage *);
|
||||
void gimp_image_add_guide (GimpImage *, Guide *);
|
||||
|
@ -132,10 +139,10 @@ void gimp_image_delete_guide (GimpImage *, Guide *);
|
|||
|
||||
Parasite * gimp_image_find_parasite (const GimpImage *,
|
||||
const char *name);
|
||||
void gimp_image_attach_parasite (GimpImage *, const Parasite *);
|
||||
void gimp_image_attach_parasite (GimpImage *, Parasite *);
|
||||
void gimp_image_detach_parasite (GimpImage *, const char *);
|
||||
|
||||
guint32 gimp_image_get_new_tattoo (GimpImage *);
|
||||
Tattoo gimp_image_get_new_tattoo (GimpImage *);
|
||||
|
||||
|
||||
/* layer/channel functions */
|
||||
|
@ -144,8 +151,8 @@ int gimp_image_get_layer_index (GimpImage *, Layer *);
|
|||
int gimp_image_get_channel_index (GimpImage *, Channel *);
|
||||
Layer * gimp_image_get_active_layer (GimpImage *);
|
||||
Channel * gimp_image_get_active_channel (GimpImage *);
|
||||
Layer * gimp_image_get_layer_by_tattoo (GimpImage *, guint32);
|
||||
Channel * gimp_image_get_channel_by_tattoo (GimpImage *, guint32);
|
||||
Layer * gimp_image_get_layer_by_tattoo (GimpImage *, Tattoo);
|
||||
Channel * gimp_image_get_channel_by_tattoo (GimpImage *, Tattoo);
|
||||
Channel * gimp_image_get_mask (GimpImage *);
|
||||
int gimp_image_get_component_active (GimpImage *, ChannelType);
|
||||
int gimp_image_get_component_visible (GimpImage *, ChannelType);
|
||||
|
|
|
@ -30,10 +30,9 @@
|
|||
#include "layer.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "temp_buf.h"
|
||||
#include "parasitelist.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "libgimp/parasite.h"
|
||||
|
||||
#include "layer_pvt.h"
|
||||
#include "tile_manager_pvt.h"
|
||||
#include "tile.h" /* ick. */
|
||||
|
@ -375,7 +374,7 @@ layer_copy (layer, add_alpha)
|
|||
|
||||
/* copy the parasites */
|
||||
GIMP_DRAWABLE(new_layer)->parasites
|
||||
= parasite_gslist_copy(GIMP_DRAWABLE(layer)->parasites);
|
||||
= parasite_list_copy(GIMP_DRAWABLE(layer)->parasites);
|
||||
|
||||
cleanup:
|
||||
/* free up the layer_name memory */
|
||||
|
@ -1172,7 +1171,7 @@ layer_mask_preview (layer, w, h)
|
|||
}
|
||||
}
|
||||
|
||||
guint32
|
||||
Tattoo
|
||||
layer_get_tattoo(const Layer *layer)
|
||||
{
|
||||
return (gimp_drawable_get_tattoo(GIMP_DRAWABLE(layer)));
|
||||
|
|
|
@ -119,7 +119,7 @@ TempBuf * layer_preview (Layer *, int, int);
|
|||
TempBuf * layer_mask_preview (Layer *, int, int);
|
||||
|
||||
void layer_invalidate_previews (GimpImage*);
|
||||
guint32 layer_get_tattoo(const Layer *);
|
||||
Tattoo layer_get_tattoo(const Layer *);
|
||||
|
||||
|
||||
#define drawable_layer GIMP_IS_LAYER
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
/* gimpparasite.c: Copyright 1998 Jay Cox <jaycox@earthlink.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <glib.h>
|
||||
#include "parasitelist.h"
|
||||
#include "gimpparasite.h"
|
||||
|
||||
static ParasiteList *parasites = NULL;
|
||||
|
||||
void
|
||||
gimp_init_parasites()
|
||||
{
|
||||
g_return_if_fail(parasites == NULL);
|
||||
parasites = parasite_list_new();
|
||||
}
|
||||
|
||||
void
|
||||
gimp_attach_parasite (Parasite *p)
|
||||
{
|
||||
parasite_list_add(parasites, p);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_detach_parasite (char *name)
|
||||
{
|
||||
parasite_list_remove(parasites, name);
|
||||
}
|
||||
|
||||
Parasite *
|
||||
gimp_find_parasite (char *name)
|
||||
{
|
||||
return parasite_list_find(parasites, name);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
/* gimpparasite.h: Copyright 1998 Jay Cox <jaycox@earthlink.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_PARASITE_H__
|
||||
#define __GIMP_PARASITE_H__
|
||||
|
||||
#include "libgimp/parasiteF.h"
|
||||
|
||||
void gimp_init_parasites (void);
|
||||
void gimp_attach_parasite (Parasite *p);
|
||||
void gimp_detach_parasite (char *name);
|
||||
Parasite * gimp_find_parasite (char *name);
|
||||
|
||||
#endif /* __GIMP_PARASITE_H__ */
|
|
@ -0,0 +1,179 @@
|
|||
/* parasitelist.c: Copyright 1998 Jay Cox <jaycox@earthlink.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "gimpobjectP.h"
|
||||
#include "gimpobject.h"
|
||||
#include "gimpsignal.h"
|
||||
#include "parasitelistP.h"
|
||||
#include "libgimp/parasite.h"
|
||||
#include "libgimp/parasiteP.h"
|
||||
|
||||
enum
|
||||
{
|
||||
ADD,
|
||||
REMOVE,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint parasite_list_signals[LAST_SIGNAL];
|
||||
|
||||
static void parasite_list_destroy (GtkObject* list);
|
||||
static void parasite_list_init (ParasiteList* list);
|
||||
static void parasite_list_class_init (ParasiteListClass *klass);
|
||||
static int parasite_compare_func (gconstpointer n1, gconstpointer n2);
|
||||
static int free_a_parasite (void *key, void *parasite, void *unused);
|
||||
|
||||
static void
|
||||
parasite_list_init (ParasiteList* list)
|
||||
{
|
||||
list->table=NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
parasite_list_class_init(ParasiteListClass *klass)
|
||||
{
|
||||
GtkObjectClass *class = GTK_OBJECT_CLASS(klass);
|
||||
GtkType type = class->type;
|
||||
|
||||
class->destroy = parasite_list_destroy;
|
||||
|
||||
parasite_list_signals[ADD] =
|
||||
gimp_signal_new("add", GTK_RUN_FIRST, type, 0, gimp_sigtype_pointer);
|
||||
parasite_list_signals[REMOVE] =
|
||||
gimp_signal_new("remove", GTK_RUN_FIRST, type, 0, gimp_sigtype_pointer);
|
||||
gtk_object_class_add_signals (class, parasite_list_signals, LAST_SIGNAL);
|
||||
}
|
||||
|
||||
GtkType
|
||||
parasite_list_get_type()
|
||||
{
|
||||
static GtkType type = 0;
|
||||
if (!type)
|
||||
{
|
||||
GtkTypeInfo info =
|
||||
{
|
||||
"ParasiteList",
|
||||
sizeof (ParasiteList),
|
||||
sizeof (ParasiteListClass),
|
||||
(GtkClassInitFunc) parasite_list_class_init,
|
||||
(GtkObjectInitFunc) parasite_list_init,
|
||||
NULL,
|
||||
NULL,
|
||||
(GtkClassInitFunc) NULL
|
||||
};
|
||||
type = gtk_type_unique(GIMP_TYPE_OBJECT, &info);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
ParasiteList*
|
||||
parasite_list_new()
|
||||
{
|
||||
ParasiteList *list = gtk_type_new(GIMP_TYPE_PARASITE_LIST);
|
||||
list->table = NULL;
|
||||
return list;
|
||||
}
|
||||
|
||||
static int
|
||||
parasite_compare_func(gconstpointer n1, gconstpointer n2)
|
||||
{
|
||||
return (!strcmp((char*)n1, (char*)n2));
|
||||
}
|
||||
|
||||
static int
|
||||
free_a_parasite(void *key, void *parasite, void *unused)
|
||||
{
|
||||
parasite_free((Parasite *)parasite);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
parasite_list_destroy(GtkObject *obj)
|
||||
{
|
||||
ParasiteList *list;
|
||||
|
||||
g_return_if_fail(obj != NULL);
|
||||
g_return_if_fail(GIMP_IS_PARASITE_LIST(obj));
|
||||
|
||||
list = (ParasiteList *)obj;
|
||||
|
||||
if (list->table)
|
||||
{
|
||||
g_hash_table_foreach_remove(list->table, free_a_parasite, NULL);
|
||||
g_hash_table_destroy(list->table);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
parasite_copy_one(void *key, void *p, void *data)
|
||||
{
|
||||
ParasiteList *list = (ParasiteList*)data;
|
||||
Parasite *parasite = (Parasite*)p;
|
||||
parasite_list_add(list, parasite);
|
||||
}
|
||||
|
||||
ParasiteList*
|
||||
parasite_list_copy(const ParasiteList *list)
|
||||
{
|
||||
ParasiteList *newlist;
|
||||
newlist = parasite_list_new();
|
||||
if (list->table)
|
||||
g_hash_table_foreach(list->table, parasite_copy_one, newlist);
|
||||
return newlist;
|
||||
}
|
||||
|
||||
void
|
||||
parasite_list_add(ParasiteList *list, Parasite *p)
|
||||
{
|
||||
g_return_if_fail(list != NULL);
|
||||
if (list->table == NULL)
|
||||
list->table = g_hash_table_new(g_str_hash, parasite_compare_func);
|
||||
g_return_if_fail(p != NULL);
|
||||
g_return_if_fail(p->name != NULL);
|
||||
p = parasite_copy(p);
|
||||
g_hash_table_insert(list->table, p->name, p);
|
||||
gtk_signal_emit (GTK_OBJECT(list), parasite_list_signals[ADD], p);
|
||||
}
|
||||
|
||||
void
|
||||
parasite_list_remove(ParasiteList *list, const char *name)
|
||||
{
|
||||
Parasite *p;
|
||||
g_return_if_fail(list != NULL);
|
||||
if (list->table)
|
||||
{
|
||||
p = parasite_list_find(list, name);
|
||||
if (p)
|
||||
{
|
||||
g_hash_table_remove(list->table, name);
|
||||
gtk_signal_emit (GTK_OBJECT(list), parasite_list_signals[REMOVE], p);
|
||||
parasite_free(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Parasite *
|
||||
parasite_list_find(ParasiteList *list, const char *name)
|
||||
{
|
||||
g_return_val_if_fail(list != NULL, NULL);
|
||||
if (list->table)
|
||||
return (Parasite *)g_hash_table_lookup(list->table, name);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
/* parasitelist.h: Copyright 1998 Jay Cox <jaycox@earthlink.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __PARASITE_LIST_H__
|
||||
#define __PARASITE_LIST_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include "libgimp/parasiteF.h"
|
||||
#include "parasitelistF.h"
|
||||
#include "gimpobject.h"
|
||||
|
||||
#define GIMP_TYPE_PARASITE_LIST (parasite_list_get_type ())
|
||||
#define GIMP_PARASITE_LIST(obj) (GIMP_CHECK_CAST ((obj), GIMP_TYPE_PARASITE_LIST, GimpParasiteList))
|
||||
#define GIMP_IS_PARASITE_LIST(obj) (GIMP_CHECK_TYPE ((obj), GIMP_TYPE_PARASITE_LIST))
|
||||
|
||||
/* Signals:
|
||||
add
|
||||
remove
|
||||
*/
|
||||
|
||||
GtkType parasite_list_get_type (void);
|
||||
|
||||
/* function declarations */
|
||||
|
||||
ParasiteList *parasite_list_new (void);
|
||||
ParasiteList *parasite_list_copy (const ParasiteList *list);
|
||||
void parasite_list_add (ParasiteList *list, Parasite *p);
|
||||
void parasite_list_remove (ParasiteList *list, const char *name);
|
||||
Parasite *parasite_list_find (ParasiteList *list, const char *name);
|
||||
|
||||
#endif /* __GIMP_PARASITE_H__ */
|
|
@ -26,6 +26,7 @@
|
|||
#include "paint_funcs.h"
|
||||
#include "palette.h"
|
||||
#include "libgimp/parasite.h"
|
||||
#include "parasitelist.h"
|
||||
#include "undo.h"
|
||||
#include "gimpsignal.h"
|
||||
|
||||
|
@ -152,7 +153,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->parasites = parasite_list_new();
|
||||
gimp_matrix_identity(gimage->transform);
|
||||
gimage->resolution = 72.0; /* maybe should be rc-supplied default? */
|
||||
gimage->save_proc= NULL;
|
||||
|
@ -493,7 +494,7 @@ gimp_image_destroy (GtkObject *object)
|
|||
gimp_image_free_channels (gimage);
|
||||
channel_delete (gimage->selection_mask);
|
||||
if (gimage->parasites)
|
||||
parasite_gslist_destroy(gimage->parasites);
|
||||
gtk_object_unref(GTK_OBJECT(gimage->parasites));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -875,28 +876,28 @@ gimp_image_delete_guide (GimpImage *gimage,
|
|||
Parasite *
|
||||
gimp_image_find_parasite (const GimpImage *gimage, const char *name)
|
||||
{
|
||||
return parasite_find_in_gslist(gimage->parasites, name);
|
||||
return parasite_list_find(gimage->parasites, name);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_image_attach_parasite (GimpImage *gimage, const Parasite *parasite)
|
||||
gimp_image_attach_parasite (GimpImage *gimage, Parasite *parasite)
|
||||
{
|
||||
gimage->parasites = parasite_add_to_gslist(parasite, gimage->parasites);
|
||||
parasite_list_add(gimage->parasites, parasite);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_image_detach_parasite (GimpImage *gimage, const char *parasite)
|
||||
{
|
||||
Parasite *p;
|
||||
if ((p = parasite_find_in_gslist(gimage->parasites, parasite)))
|
||||
gimage->parasites = g_slist_remove (gimage->parasites, p);
|
||||
parasite_free(p);
|
||||
parasite_list_remove(gimage->parasites, parasite);
|
||||
}
|
||||
|
||||
guint32
|
||||
Tattoo
|
||||
gimp_image_get_new_tattoo(GimpImage *image)
|
||||
{
|
||||
return (++image->tattoo_state);
|
||||
image->tattoo_state++;
|
||||
if (image->tattoo_state <= 0)
|
||||
g_warning("Tattoo state has become corrupt (2.1 billion operation limit exceded)");
|
||||
return (image->tattoo_state);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1417,7 +1418,7 @@ gimp_image_get_active_channel (GimpImage *gimage)
|
|||
|
||||
|
||||
Layer *
|
||||
gimp_image_get_layer_by_tattoo (GimpImage *gimage, guint32 tattoo)
|
||||
gimp_image_get_layer_by_tattoo (GimpImage *gimage, Tattoo tattoo)
|
||||
{
|
||||
Layer *layer;
|
||||
GSList *layers = gimage->layers;
|
||||
|
@ -1434,7 +1435,7 @@ gimp_image_get_layer_by_tattoo (GimpImage *gimage, guint32 tattoo)
|
|||
}
|
||||
|
||||
Channel *
|
||||
gimp_image_get_channel_by_tattoo (GimpImage *gimage, guint32 tattoo)
|
||||
gimp_image_get_channel_by_tattoo (GimpImage *gimage, Tattoo tattoo)
|
||||
{
|
||||
Channel *channel;
|
||||
GSList *channels = gimage->channels;
|
||||
|
|
|
@ -114,16 +114,23 @@ GimpImage * gimp_image_get_named (char *);
|
|||
GimpImage * gimp_image_get_ID (int);
|
||||
TileManager * gimp_image_shadow (GimpImage *, int, int, int);
|
||||
void gimp_image_free_shadow (GimpImage *);
|
||||
void gimp_image_apply_image (GimpImage *, GimpDrawable *, PixelRegion *, int, int, int,
|
||||
TileManager *, int, int);
|
||||
void gimp_image_replace_image (GimpImage *, GimpDrawable *, PixelRegion *, int, int,
|
||||
PixelRegion *, int, int);
|
||||
void gimp_image_get_foreground (GimpImage *, GimpDrawable *, unsigned char *);
|
||||
void gimp_image_get_background (GimpImage *, GimpDrawable *, unsigned char *);
|
||||
void gimp_image_get_color (GimpImage *, int, unsigned char *,
|
||||
unsigned char *);
|
||||
void gimp_image_transform_color (GimpImage *, GimpDrawable *, unsigned char *,
|
||||
unsigned char *, int);
|
||||
void gimp_image_apply_image (GimpImage *, GimpDrawable *,
|
||||
PixelRegion *, int,
|
||||
int, int,
|
||||
TileManager *, int, int);
|
||||
void gimp_image_replace_image (GimpImage *, GimpDrawable *,
|
||||
PixelRegion *, int, int,
|
||||
PixelRegion *, int, int);
|
||||
void gimp_image_get_foreground (GimpImage *, GimpDrawable *,
|
||||
unsigned char *);
|
||||
void gimp_image_get_background (GimpImage *, GimpDrawable *,
|
||||
unsigned char *);
|
||||
void gimp_image_get_color (GimpImage *, int,
|
||||
unsigned char *,
|
||||
unsigned char *);
|
||||
void gimp_image_transform_color (GimpImage *, GimpDrawable *,
|
||||
unsigned char *,
|
||||
unsigned char *, int);
|
||||
Guide* gimp_image_add_hguide (GimpImage *);
|
||||
Guide* gimp_image_add_vguide (GimpImage *);
|
||||
void gimp_image_add_guide (GimpImage *, Guide *);
|
||||
|
@ -132,10 +139,10 @@ void gimp_image_delete_guide (GimpImage *, Guide *);
|
|||
|
||||
Parasite * gimp_image_find_parasite (const GimpImage *,
|
||||
const char *name);
|
||||
void gimp_image_attach_parasite (GimpImage *, const Parasite *);
|
||||
void gimp_image_attach_parasite (GimpImage *, Parasite *);
|
||||
void gimp_image_detach_parasite (GimpImage *, const char *);
|
||||
|
||||
guint32 gimp_image_get_new_tattoo (GimpImage *);
|
||||
Tattoo gimp_image_get_new_tattoo (GimpImage *);
|
||||
|
||||
|
||||
/* layer/channel functions */
|
||||
|
@ -144,8 +151,8 @@ int gimp_image_get_layer_index (GimpImage *, Layer *);
|
|||
int gimp_image_get_channel_index (GimpImage *, Channel *);
|
||||
Layer * gimp_image_get_active_layer (GimpImage *);
|
||||
Channel * gimp_image_get_active_channel (GimpImage *);
|
||||
Layer * gimp_image_get_layer_by_tattoo (GimpImage *, guint32);
|
||||
Channel * gimp_image_get_channel_by_tattoo (GimpImage *, guint32);
|
||||
Layer * gimp_image_get_layer_by_tattoo (GimpImage *, Tattoo);
|
||||
Channel * gimp_image_get_channel_by_tattoo (GimpImage *, Tattoo);
|
||||
Channel * gimp_image_get_mask (GimpImage *);
|
||||
int gimp_image_get_component_active (GimpImage *, ChannelType);
|
||||
int gimp_image_get_component_visible (GimpImage *, ChannelType);
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#include "commands.h"
|
||||
#include "general.h"
|
||||
#include "gimage.h"
|
||||
#include "gimage_cmds.h"
|
||||
#include "gimprc.h"
|
||||
#include "global_edit.h"
|
||||
#include "interface.h"
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "floating_sel.h"
|
||||
#include "gdisplay_ops.h"
|
||||
#include "general.h"
|
||||
#include "gimage_cmds.h"
|
||||
#include "gimage_mask.h"
|
||||
#include "gimprc.h"
|
||||
#include "global_edit.h"
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#include "commands.h"
|
||||
#include "general.h"
|
||||
#include "gimage.h"
|
||||
#include "gimage_cmds.h"
|
||||
#include "gimprc.h"
|
||||
#include "global_edit.h"
|
||||
#include "interface.h"
|
||||
|
|
|
@ -50,6 +50,9 @@ static Argument *gimp_image_find_parasite_invoker (Argument *);
|
|||
static Argument *gimp_image_attach_parasite_invoker (Argument *);
|
||||
static Argument *gimp_image_detach_parasite_invoker (Argument *);
|
||||
|
||||
/* The Tattoo procs prototypes */
|
||||
static Argument *gimp_image_get_layer_by_tattoo_invoker (Argument *);
|
||||
static Argument *gimp_image_get_channel_by_tattoo_invoker (Argument *);
|
||||
|
||||
static GImage * duplicate (GImage *gimage);
|
||||
|
||||
|
@ -4546,3 +4549,185 @@ gimp_image_detach_parasite_invoker (Argument *args)
|
|||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
/******************************/
|
||||
/***** Tattoo functions *****/
|
||||
|
||||
/*** gimp_image_get_layer_by_tattoo ***/
|
||||
|
||||
ProcArg gimp_image_get_layer_by_tattoo_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"the input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"tattoo",
|
||||
"The tattoo of the layer to find"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_get_layer_by_tattoo_out_args[] =
|
||||
{
|
||||
{ PDB_LAYER,
|
||||
"layer",
|
||||
"the layer with the specified tattoo"
|
||||
},
|
||||
};
|
||||
|
||||
ProcRecord gimp_image_get_layer_by_tattoo_proc =
|
||||
{
|
||||
"gimp_image_get_layer_by_tattoo",
|
||||
"Find a layer with a given tattoo in an image",
|
||||
"This procedure returns the layer with the given tattoo in the specified image.",
|
||||
"Jay Cox",
|
||||
"Jay Cox",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_get_layer_by_tattoo_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_get_layer_by_tattoo_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_get_layer_by_tattoo_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_get_layer_by_tattoo_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
GImage *gimage;
|
||||
Tattoo tattoo;
|
||||
Argument *return_args;
|
||||
Layer *layer;
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
tattoo = args[1].value.pdb_int;
|
||||
if (tattoo == 0)
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
layer = gimp_image_get_layer_by_tattoo (gimage, tattoo);
|
||||
if (layer == NULL)
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
return_args =
|
||||
procedural_db_return_args (&gimp_image_get_layer_by_tattoo_proc,
|
||||
success);
|
||||
if (success)
|
||||
{
|
||||
return_args[1].value.pdb_int = drawable_ID(GIMP_DRAWABLE(layer));
|
||||
}
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
/*** gimp_image_get_channel_by_tattoo ***/
|
||||
|
||||
ProcArg gimp_image_get_channel_by_tattoo_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"the input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"tattoo",
|
||||
"The tattoo of the channel to find"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_get_channel_by_tattoo_out_args[] =
|
||||
{
|
||||
{ PDB_CHANNEL,
|
||||
"channel",
|
||||
"the channel with the specified tattoo"
|
||||
},
|
||||
};
|
||||
|
||||
ProcRecord gimp_image_get_channel_by_tattoo_proc =
|
||||
{
|
||||
"gimp_image_get_channel_by_tattoo",
|
||||
"Find a channel with a given tattoo in an image",
|
||||
"This procedure returns the channel with the given tattoo in the specified image.",
|
||||
"Jay Cox",
|
||||
"Jay Cox",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_get_channel_by_tattoo_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_get_channel_by_tattoo_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_get_channel_by_tattoo_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_get_channel_by_tattoo_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
GImage *gimage;
|
||||
Tattoo tattoo;
|
||||
Argument *return_args;
|
||||
Channel *channel;
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
tattoo = args[1].value.pdb_int;
|
||||
if (tattoo == 0)
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
channel = gimp_image_get_channel_by_tattoo (gimage, tattoo);
|
||||
if (channel == NULL)
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
return_args =
|
||||
procedural_db_return_args (&gimp_image_get_channel_by_tattoo_proc,
|
||||
success);
|
||||
if (success)
|
||||
{
|
||||
return_args[1].value.pdb_int = drawable_ID(GIMP_DRAWABLE(channel));
|
||||
}
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -81,4 +81,7 @@ extern ProcRecord gimp_image_find_parasite_proc;
|
|||
extern ProcRecord gimp_image_attach_parasite_proc;
|
||||
extern ProcRecord gimp_image_detach_parasite_proc;
|
||||
|
||||
extern ProcRecord gimp_image_get_layer_by_tattoo_proc;
|
||||
extern ProcRecord gimp_image_get_channel_by_tattoo_proc;
|
||||
|
||||
#endif /* __GIMAGE_CMDS_H__ */
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "gimage_mask.h"
|
||||
#include "layer.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "libgimp/parasite.h"
|
||||
#include "parasitelist.h"
|
||||
#include "temp_buf.h"
|
||||
#include "undo.h"
|
||||
|
||||
|
@ -209,7 +209,7 @@ channel_copy (Channel *channel)
|
|||
|
||||
/* copy the parasites */
|
||||
GIMP_DRAWABLE(new_channel)->parasites
|
||||
= parasite_gslist_copy(GIMP_DRAWABLE(channel)->parasites);
|
||||
= parasite_list_copy(GIMP_DRAWABLE(channel)->parasites);
|
||||
|
||||
/* free up the channel_name memory */
|
||||
g_free (channel_name);
|
||||
|
@ -477,7 +477,7 @@ channel_invalidate_previews (GimpImage* gimage)
|
|||
}
|
||||
}
|
||||
|
||||
guint32
|
||||
Tattoo
|
||||
channel_get_tattoo(const Channel *channel)
|
||||
{
|
||||
return (gimp_drawable_get_tattoo(GIMP_DRAWABLE(channel)));
|
||||
|
|
|
@ -95,7 +95,7 @@ int channel_toggle_visibility (Channel *);
|
|||
TempBuf * channel_preview (Channel *, int, int);
|
||||
|
||||
void channel_invalidate_previews (GimpImage*);
|
||||
guint32 channel_get_tattoo(const Channel *);
|
||||
Tattoo channel_get_tattoo(const Channel *);
|
||||
|
||||
|
||||
/* selection mask functions */
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "gimpsignal.h"
|
||||
#include "gimage.h"
|
||||
#include "gimage_mask.h"
|
||||
#include "libgimp/parasite.h"
|
||||
#include "parasitelist.h"
|
||||
|
||||
|
||||
enum {
|
||||
|
@ -375,25 +375,22 @@ gimp_drawable_set_name (GimpDrawable *drawable, char *name)
|
|||
Parasite *
|
||||
gimp_drawable_find_parasite (const GimpDrawable *drawable, const char *name)
|
||||
{
|
||||
return parasite_find_in_gslist(drawable->parasites, name);
|
||||
return parasite_list_find(drawable->parasites, name);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_drawable_attach_parasite (GimpDrawable *drawable, const Parasite *parasite)
|
||||
gimp_drawable_attach_parasite (GimpDrawable *drawable, Parasite *parasite)
|
||||
{
|
||||
drawable->parasites = parasite_add_to_gslist(parasite, drawable->parasites);
|
||||
parasite_list_add(drawable->parasites, parasite);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_drawable_detach_parasite (GimpDrawable *drawable, const char *parasite)
|
||||
{
|
||||
Parasite *p;
|
||||
if ((p = parasite_find_in_gslist(drawable->parasites, parasite)))
|
||||
drawable->parasites = g_slist_remove (drawable->parasites, p);
|
||||
parasite_free(p);
|
||||
parasite_list_remove(drawable->parasites, parasite);
|
||||
}
|
||||
|
||||
guint32
|
||||
Tattoo
|
||||
gimp_drawable_get_tattoo(const GimpDrawable *drawable)
|
||||
{
|
||||
return drawable->tattoo;
|
||||
|
@ -556,7 +553,7 @@ gimp_drawable_init (GimpDrawable *drawable)
|
|||
drawable->has_alpha = FALSE;
|
||||
drawable->preview = NULL;
|
||||
drawable->preview_valid = FALSE;
|
||||
drawable->parasites = FALSE;
|
||||
drawable->parasites = parasite_list_new();
|
||||
drawable->tattoo = 0;
|
||||
gimp_matrix_identity(drawable->transform);
|
||||
|
||||
|
@ -588,7 +585,7 @@ gimp_drawable_destroy (GtkObject *object)
|
|||
temp_buf_free (drawable->preview);
|
||||
|
||||
if (drawable->parasites)
|
||||
parasite_gslist_destroy(drawable->parasites);
|
||||
gtk_object_unref(GTK_OBJECT(drawable->parasites));
|
||||
|
||||
if (GTK_OBJECT_CLASS (parent_class)->destroy)
|
||||
(*GTK_OBJECT_CLASS (parent_class)->destroy) (object);
|
||||
|
|
|
@ -75,10 +75,10 @@ void gimp_drawable_set_name (GimpDrawable *, char *);
|
|||
|
||||
Parasite * gimp_drawable_find_parasite (const GimpDrawable *,
|
||||
const char *name);
|
||||
void gimp_drawable_attach_parasite (GimpDrawable *, const Parasite *);
|
||||
void gimp_drawable_attach_parasite (GimpDrawable *, Parasite *);
|
||||
void gimp_drawable_detach_parasite (GimpDrawable *,
|
||||
const char *);
|
||||
guint32 gimp_drawable_get_tattoo (const GimpDrawable *);
|
||||
Tattoo gimp_drawable_get_tattoo (const GimpDrawable *);
|
||||
|
||||
GimpDrawable * gimp_drawable_get_ID (int);
|
||||
void gimp_drawable_deallocate (GimpDrawable *);
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include "gimpobjectP.h"
|
||||
#include "gimpdrawable.h"
|
||||
#include "parasitelistF.h"
|
||||
#include "libgimp/gimpmatrix.h"
|
||||
|
||||
struct _GimpDrawable
|
||||
|
@ -40,7 +41,7 @@ struct _GimpDrawable
|
|||
int type; /* type of drawable */
|
||||
int has_alpha; /* drawable has alpha */
|
||||
|
||||
GSList *parasites; /* Plug-in parasite data */
|
||||
ParasiteList *parasites; /* Plug-in parasite data */
|
||||
|
||||
GimpMatrix transform; /* a matrix describing all of the
|
||||
transformations this drawable
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "paint_funcs.h"
|
||||
#include "palette.h"
|
||||
#include "libgimp/parasite.h"
|
||||
#include "parasitelist.h"
|
||||
#include "undo.h"
|
||||
#include "gimpsignal.h"
|
||||
|
||||
|
@ -152,7 +153,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->parasites = parasite_list_new();
|
||||
gimp_matrix_identity(gimage->transform);
|
||||
gimage->resolution = 72.0; /* maybe should be rc-supplied default? */
|
||||
gimage->save_proc= NULL;
|
||||
|
@ -493,7 +494,7 @@ gimp_image_destroy (GtkObject *object)
|
|||
gimp_image_free_channels (gimage);
|
||||
channel_delete (gimage->selection_mask);
|
||||
if (gimage->parasites)
|
||||
parasite_gslist_destroy(gimage->parasites);
|
||||
gtk_object_unref(GTK_OBJECT(gimage->parasites));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -875,28 +876,28 @@ gimp_image_delete_guide (GimpImage *gimage,
|
|||
Parasite *
|
||||
gimp_image_find_parasite (const GimpImage *gimage, const char *name)
|
||||
{
|
||||
return parasite_find_in_gslist(gimage->parasites, name);
|
||||
return parasite_list_find(gimage->parasites, name);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_image_attach_parasite (GimpImage *gimage, const Parasite *parasite)
|
||||
gimp_image_attach_parasite (GimpImage *gimage, Parasite *parasite)
|
||||
{
|
||||
gimage->parasites = parasite_add_to_gslist(parasite, gimage->parasites);
|
||||
parasite_list_add(gimage->parasites, parasite);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_image_detach_parasite (GimpImage *gimage, const char *parasite)
|
||||
{
|
||||
Parasite *p;
|
||||
if ((p = parasite_find_in_gslist(gimage->parasites, parasite)))
|
||||
gimage->parasites = g_slist_remove (gimage->parasites, p);
|
||||
parasite_free(p);
|
||||
parasite_list_remove(gimage->parasites, parasite);
|
||||
}
|
||||
|
||||
guint32
|
||||
Tattoo
|
||||
gimp_image_get_new_tattoo(GimpImage *image)
|
||||
{
|
||||
return (++image->tattoo_state);
|
||||
image->tattoo_state++;
|
||||
if (image->tattoo_state <= 0)
|
||||
g_warning("Tattoo state has become corrupt (2.1 billion operation limit exceded)");
|
||||
return (image->tattoo_state);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1417,7 +1418,7 @@ gimp_image_get_active_channel (GimpImage *gimage)
|
|||
|
||||
|
||||
Layer *
|
||||
gimp_image_get_layer_by_tattoo (GimpImage *gimage, guint32 tattoo)
|
||||
gimp_image_get_layer_by_tattoo (GimpImage *gimage, Tattoo tattoo)
|
||||
{
|
||||
Layer *layer;
|
||||
GSList *layers = gimage->layers;
|
||||
|
@ -1434,7 +1435,7 @@ gimp_image_get_layer_by_tattoo (GimpImage *gimage, guint32 tattoo)
|
|||
}
|
||||
|
||||
Channel *
|
||||
gimp_image_get_channel_by_tattoo (GimpImage *gimage, guint32 tattoo)
|
||||
gimp_image_get_channel_by_tattoo (GimpImage *gimage, Tattoo tattoo)
|
||||
{
|
||||
Channel *channel;
|
||||
GSList *channels = gimage->channels;
|
||||
|
|
|
@ -114,16 +114,23 @@ GimpImage * gimp_image_get_named (char *);
|
|||
GimpImage * gimp_image_get_ID (int);
|
||||
TileManager * gimp_image_shadow (GimpImage *, int, int, int);
|
||||
void gimp_image_free_shadow (GimpImage *);
|
||||
void gimp_image_apply_image (GimpImage *, GimpDrawable *, PixelRegion *, int, int, int,
|
||||
TileManager *, int, int);
|
||||
void gimp_image_replace_image (GimpImage *, GimpDrawable *, PixelRegion *, int, int,
|
||||
PixelRegion *, int, int);
|
||||
void gimp_image_get_foreground (GimpImage *, GimpDrawable *, unsigned char *);
|
||||
void gimp_image_get_background (GimpImage *, GimpDrawable *, unsigned char *);
|
||||
void gimp_image_get_color (GimpImage *, int, unsigned char *,
|
||||
unsigned char *);
|
||||
void gimp_image_transform_color (GimpImage *, GimpDrawable *, unsigned char *,
|
||||
unsigned char *, int);
|
||||
void gimp_image_apply_image (GimpImage *, GimpDrawable *,
|
||||
PixelRegion *, int,
|
||||
int, int,
|
||||
TileManager *, int, int);
|
||||
void gimp_image_replace_image (GimpImage *, GimpDrawable *,
|
||||
PixelRegion *, int, int,
|
||||
PixelRegion *, int, int);
|
||||
void gimp_image_get_foreground (GimpImage *, GimpDrawable *,
|
||||
unsigned char *);
|
||||
void gimp_image_get_background (GimpImage *, GimpDrawable *,
|
||||
unsigned char *);
|
||||
void gimp_image_get_color (GimpImage *, int,
|
||||
unsigned char *,
|
||||
unsigned char *);
|
||||
void gimp_image_transform_color (GimpImage *, GimpDrawable *,
|
||||
unsigned char *,
|
||||
unsigned char *, int);
|
||||
Guide* gimp_image_add_hguide (GimpImage *);
|
||||
Guide* gimp_image_add_vguide (GimpImage *);
|
||||
void gimp_image_add_guide (GimpImage *, Guide *);
|
||||
|
@ -132,10 +139,10 @@ void gimp_image_delete_guide (GimpImage *, Guide *);
|
|||
|
||||
Parasite * gimp_image_find_parasite (const GimpImage *,
|
||||
const char *name);
|
||||
void gimp_image_attach_parasite (GimpImage *, const Parasite *);
|
||||
void gimp_image_attach_parasite (GimpImage *, Parasite *);
|
||||
void gimp_image_detach_parasite (GimpImage *, const char *);
|
||||
|
||||
guint32 gimp_image_get_new_tattoo (GimpImage *);
|
||||
Tattoo gimp_image_get_new_tattoo (GimpImage *);
|
||||
|
||||
|
||||
/* layer/channel functions */
|
||||
|
@ -144,8 +151,8 @@ int gimp_image_get_layer_index (GimpImage *, Layer *);
|
|||
int gimp_image_get_channel_index (GimpImage *, Channel *);
|
||||
Layer * gimp_image_get_active_layer (GimpImage *);
|
||||
Channel * gimp_image_get_active_channel (GimpImage *);
|
||||
Layer * gimp_image_get_layer_by_tattoo (GimpImage *, guint32);
|
||||
Channel * gimp_image_get_channel_by_tattoo (GimpImage *, guint32);
|
||||
Layer * gimp_image_get_layer_by_tattoo (GimpImage *, Tattoo);
|
||||
Channel * gimp_image_get_channel_by_tattoo (GimpImage *, Tattoo);
|
||||
Channel * gimp_image_get_mask (GimpImage *);
|
||||
int gimp_image_get_component_active (GimpImage *, ChannelType);
|
||||
int gimp_image_get_component_visible (GimpImage *, ChannelType);
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
|
||||
typedef struct _GimpImage GimpImage;
|
||||
|
||||
/* Move this someplace else */
|
||||
/* Move these someplace else */
|
||||
typedef struct _Guide Guide;
|
||||
typedef guint32 Tattoo;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "temp_buf.h"
|
||||
#include "channel.h"
|
||||
#include "layer.h"
|
||||
#include "parasitelistF.h"
|
||||
#include "libgimp/gimpmatrix.h"
|
||||
|
||||
|
||||
|
@ -33,7 +34,7 @@ struct _GimpImage
|
|||
int instance_count; /* number of instances */
|
||||
int ref_count; /* number of references */
|
||||
|
||||
guint32 tattoo_state; /* the next unique tattoo to use*/
|
||||
Tattoo tattoo_state; /* the next unique tattoo to use*/
|
||||
|
||||
TileManager *shadow; /* shadow buffer tiles */
|
||||
|
||||
|
@ -57,7 +58,7 @@ struct _GimpImage
|
|||
Layer * floating_sel; /* ID of fs layer */
|
||||
Channel * selection_mask; /* selection mask channel */
|
||||
|
||||
GSList *parasites; /* Plug-in parasite data */
|
||||
ParasiteList *parasites; /* Plug-in parasite data */
|
||||
|
||||
GimpMatrix transform; /* a matrix describing all of the
|
||||
transformations this image
|
||||
|
|
|
@ -30,10 +30,9 @@
|
|||
#include "layer.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "temp_buf.h"
|
||||
#include "parasitelist.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "libgimp/parasite.h"
|
||||
|
||||
#include "layer_pvt.h"
|
||||
#include "tile_manager_pvt.h"
|
||||
#include "tile.h" /* ick. */
|
||||
|
@ -375,7 +374,7 @@ layer_copy (layer, add_alpha)
|
|||
|
||||
/* copy the parasites */
|
||||
GIMP_DRAWABLE(new_layer)->parasites
|
||||
= parasite_gslist_copy(GIMP_DRAWABLE(layer)->parasites);
|
||||
= parasite_list_copy(GIMP_DRAWABLE(layer)->parasites);
|
||||
|
||||
cleanup:
|
||||
/* free up the layer_name memory */
|
||||
|
@ -1172,7 +1171,7 @@ layer_mask_preview (layer, w, h)
|
|||
}
|
||||
}
|
||||
|
||||
guint32
|
||||
Tattoo
|
||||
layer_get_tattoo(const Layer *layer)
|
||||
{
|
||||
return (gimp_drawable_get_tattoo(GIMP_DRAWABLE(layer)));
|
||||
|
|
|
@ -119,7 +119,7 @@ TempBuf * layer_preview (Layer *, int, int);
|
|||
TempBuf * layer_mask_preview (Layer *, int, int);
|
||||
|
||||
void layer_invalidate_previews (GimpImage*);
|
||||
guint32 layer_get_tattoo(const Layer *);
|
||||
Tattoo layer_get_tattoo(const Layer *);
|
||||
|
||||
|
||||
#define drawable_layer GIMP_IS_LAYER
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
/* gimpparasite.c: Copyright 1998 Jay Cox <jaycox@earthlink.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <glib.h>
|
||||
#include "parasitelist.h"
|
||||
#include "gimpparasite.h"
|
||||
|
||||
static ParasiteList *parasites = NULL;
|
||||
|
||||
void
|
||||
gimp_init_parasites()
|
||||
{
|
||||
g_return_if_fail(parasites == NULL);
|
||||
parasites = parasite_list_new();
|
||||
}
|
||||
|
||||
void
|
||||
gimp_attach_parasite (Parasite *p)
|
||||
{
|
||||
parasite_list_add(parasites, p);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_detach_parasite (char *name)
|
||||
{
|
||||
parasite_list_remove(parasites, name);
|
||||
}
|
||||
|
||||
Parasite *
|
||||
gimp_find_parasite (char *name)
|
||||
{
|
||||
return parasite_list_find(parasites, name);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
/* gimpparasite.h: Copyright 1998 Jay Cox <jaycox@earthlink.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_PARASITE_H__
|
||||
#define __GIMP_PARASITE_H__
|
||||
|
||||
#include "libgimp/parasiteF.h"
|
||||
|
||||
void gimp_init_parasites (void);
|
||||
void gimp_attach_parasite (Parasite *p);
|
||||
void gimp_detach_parasite (char *name);
|
||||
Parasite * gimp_find_parasite (char *name);
|
||||
|
||||
#endif /* __GIMP_PARASITE_H__ */
|
|
@ -6,7 +6,6 @@
|
|||
#include "commands.h"
|
||||
#include "general.h"
|
||||
#include "gimage.h"
|
||||
#include "gimage_cmds.h"
|
||||
#include "gimprc.h"
|
||||
#include "global_edit.h"
|
||||
#include "interface.h"
|
||||
|
|
|
@ -2991,8 +2991,8 @@ plug_in_args_destroy (Argument *args,
|
|||
case PDB_PARASITE:
|
||||
if (full_destroy)
|
||||
{
|
||||
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
|
||||
args[i].value.pdb_pointer = NULL;*/
|
||||
parasite_free ((Parasite *)(args[i].value.pdb_pointer));
|
||||
args[i].value.pdb_pointer = NULL;
|
||||
}
|
||||
break;
|
||||
case PDB_STATUS:
|
||||
|
|
|
@ -2991,8 +2991,8 @@ plug_in_args_destroy (Argument *args,
|
|||
case PDB_PARASITE:
|
||||
if (full_destroy)
|
||||
{
|
||||
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
|
||||
args[i].value.pdb_pointer = NULL;*/
|
||||
parasite_free ((Parasite *)(args[i].value.pdb_pointer));
|
||||
args[i].value.pdb_pointer = NULL;
|
||||
}
|
||||
break;
|
||||
case PDB_STATUS:
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "floating_sel.h"
|
||||
#include "gdisplay_ops.h"
|
||||
#include "general.h"
|
||||
#include "gimage_cmds.h"
|
||||
#include "gimage_mask.h"
|
||||
#include "gimprc.h"
|
||||
#include "global_edit.h"
|
||||
|
|
|
@ -80,7 +80,7 @@ internal_procs_init ()
|
|||
{
|
||||
gfloat pcount = 0;
|
||||
/* grep -c procedural_db_register internal_procs.c */
|
||||
gfloat total_pcount = 240;
|
||||
gfloat total_pcount = 245;
|
||||
|
||||
app_init_update_status("Internal Procedures", "Tool procedures",
|
||||
pcount/total_pcount);
|
||||
|
@ -193,6 +193,8 @@ internal_procs_init ()
|
|||
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++;
|
||||
procedural_db_register (&gimp_image_get_layer_by_tattoo_proc); pcount++;
|
||||
procedural_db_register (&gimp_image_get_channel_by_tattoo_proc); pcount++;
|
||||
|
||||
app_init_update_status(NULL, "GImage mask procedures",
|
||||
pcount/total_pcount);
|
||||
|
@ -392,9 +394,11 @@ internal_procs_init ()
|
|||
|
||||
app_init_update_status(NULL, "parasites",
|
||||
pcount/total_pcount);
|
||||
|
||||
/* parasite procedures */
|
||||
procedural_db_register (¶site_new_proc); pcount++;
|
||||
procedural_db_register (&gimp_find_parasite_proc); pcount++;
|
||||
procedural_db_register (&gimp_attach_parasite_proc); pcount++;
|
||||
procedural_db_register (&gimp_detach_parasite_proc); pcount++;
|
||||
|
||||
app_init_update_status(NULL, "Procedural database",
|
||||
pcount/total_pcount);
|
||||
|
|
|
@ -30,10 +30,9 @@
|
|||
#include "layer.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "temp_buf.h"
|
||||
#include "parasitelist.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "libgimp/parasite.h"
|
||||
|
||||
#include "layer_pvt.h"
|
||||
#include "tile_manager_pvt.h"
|
||||
#include "tile.h" /* ick. */
|
||||
|
@ -375,7 +374,7 @@ layer_copy (layer, add_alpha)
|
|||
|
||||
/* copy the parasites */
|
||||
GIMP_DRAWABLE(new_layer)->parasites
|
||||
= parasite_gslist_copy(GIMP_DRAWABLE(layer)->parasites);
|
||||
= parasite_list_copy(GIMP_DRAWABLE(layer)->parasites);
|
||||
|
||||
cleanup:
|
||||
/* free up the layer_name memory */
|
||||
|
@ -1172,7 +1171,7 @@ layer_mask_preview (layer, w, h)
|
|||
}
|
||||
}
|
||||
|
||||
guint32
|
||||
Tattoo
|
||||
layer_get_tattoo(const Layer *layer)
|
||||
{
|
||||
return (gimp_drawable_get_tattoo(GIMP_DRAWABLE(layer)));
|
||||
|
|
|
@ -119,7 +119,7 @@ TempBuf * layer_preview (Layer *, int, int);
|
|||
TempBuf * layer_mask_preview (Layer *, int, int);
|
||||
|
||||
void layer_invalidate_previews (GimpImage*);
|
||||
guint32 layer_get_tattoo(const Layer *);
|
||||
Tattoo layer_get_tattoo(const Layer *);
|
||||
|
||||
|
||||
#define drawable_layer GIMP_IS_LAYER
|
||||
|
|
|
@ -2991,8 +2991,8 @@ plug_in_args_destroy (Argument *args,
|
|||
case PDB_PARASITE:
|
||||
if (full_destroy)
|
||||
{
|
||||
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
|
||||
args[i].value.pdb_pointer = NULL;*/
|
||||
parasite_free ((Parasite *)(args[i].value.pdb_pointer));
|
||||
args[i].value.pdb_pointer = NULL;
|
||||
}
|
||||
break;
|
||||
case PDB_STATUS:
|
||||
|
|
|
@ -18,12 +18,22 @@
|
|||
*/
|
||||
|
||||
#include "libgimp/parasite.h"
|
||||
#include "parasitelist.h"
|
||||
#include "gimpparasite.h"
|
||||
#include "procedural_db.h"
|
||||
#include "appenv.h"
|
||||
#include <stdio.h>
|
||||
|
||||
/* The Parasite procs prototypes */
|
||||
static Argument *parasite_new_invoker (Argument *);
|
||||
static Argument *gimp_find_parasite_invoker (Argument *);
|
||||
static Argument *gimp_attach_parasite_invoker (Argument *);
|
||||
static Argument *gimp_detach_parasite_invoker (Argument *);
|
||||
|
||||
static Argument *parasite_new_invoker (Argument *args);
|
||||
|
||||
|
||||
/***** parasite_new ****/
|
||||
ProcArg parasite_new_args[] =
|
||||
{
|
||||
{ PDB_STRING,
|
||||
|
@ -83,7 +93,7 @@ parasite_new_invoker (Argument *args)
|
|||
guint32 flags, size;
|
||||
void *data;
|
||||
|
||||
/* creator */
|
||||
/* name */
|
||||
if (success)
|
||||
{ name = (char *) args[0].value.pdb_pointer; }
|
||||
/* flags */
|
||||
|
@ -101,13 +111,200 @@ parasite_new_invoker (Argument *args)
|
|||
}
|
||||
|
||||
return_args = procedural_db_return_args (¶site_new_proc,
|
||||
success);
|
||||
/* The real work */
|
||||
if (success)
|
||||
{
|
||||
return_args[1].value.pdb_pointer =
|
||||
parasite_new (name, flags, size, data);
|
||||
}
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
/***** gimp_find_parasite *****/
|
||||
ProcArg gimp_find_parasite_args[] =
|
||||
{
|
||||
{ PDB_STRING,
|
||||
"name",
|
||||
"The name of the parasite to find"
|
||||
},
|
||||
};
|
||||
|
||||
ProcArg gimp_find_parasite_out_args[] =
|
||||
{
|
||||
{ PDB_PARASITE,
|
||||
"parasite",
|
||||
"the found parasite"
|
||||
},
|
||||
};
|
||||
|
||||
ProcRecord gimp_find_parasite_proc =
|
||||
{
|
||||
"gimp_find_parasite",
|
||||
"Finds the named parasite.",
|
||||
"Finds and returns the named parasite that was previously attached to the gimp.",
|
||||
"Jay Cox",
|
||||
"Jay Cox",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
1,
|
||||
gimp_find_parasite_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_find_parasite_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_find_parasite_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_find_parasite_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
Argument *return_args;
|
||||
char *name = NULL;
|
||||
|
||||
/* name */
|
||||
if (success)
|
||||
{
|
||||
name = (char *) args[0].value.pdb_pointer;
|
||||
}
|
||||
|
||||
return_args = procedural_db_return_args (&gimp_find_parasite_proc,
|
||||
success);
|
||||
/* The real work */
|
||||
if (success)
|
||||
{
|
||||
return_args[1].value.pdb_pointer =
|
||||
parasite_new (name, flags, size, data);
|
||||
gimp_find_parasite (name);
|
||||
if (return_args[1].value.pdb_pointer == NULL)
|
||||
return_args[1].value.pdb_pointer = parasite_error();
|
||||
}
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
/*** gimp_attach_parasite ***/
|
||||
|
||||
ProcArg gimp_attach_parasite_args[] =
|
||||
{
|
||||
{ PDB_PARASITE,
|
||||
"parasite",
|
||||
"The parasite to attach to the gimp"
|
||||
}
|
||||
};
|
||||
|
||||
ProcRecord gimp_attach_parasite_proc =
|
||||
{
|
||||
"gimp_attach_parasite",
|
||||
"Add a parasite to the gimp",
|
||||
"This procedure attaches a parasite to the gimp. It has no return values.",
|
||||
"Jay Cox",
|
||||
"Jay Cox",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
1,
|
||||
gimp_attach_parasite_args,
|
||||
|
||||
/* Output arguments */
|
||||
0,
|
||||
NULL,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_attach_parasite_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_attach_parasite_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
Parasite *parasite = NULL;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
|
||||
if (success)
|
||||
{
|
||||
parasite = (Parasite *)args[0].value.pdb_pointer;
|
||||
if (parasite == NULL)
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
gimp_attach_parasite (parasite);
|
||||
}
|
||||
|
||||
return_args = procedural_db_return_args (&gimp_attach_parasite_proc,
|
||||
success);
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
/*** gimp_detach_parasite ***/
|
||||
|
||||
ProcArg gimp_detach_parasite_args[] =
|
||||
{
|
||||
{ PDB_STRING,
|
||||
"name",
|
||||
"The name of the parasite to detach from the gimp"
|
||||
}
|
||||
};
|
||||
|
||||
ProcRecord gimp_detach_parasite_proc =
|
||||
{
|
||||
"gimp_detach_parasite",
|
||||
"Removes a parasite from the gimp.",
|
||||
"This procedure detaches a parasite from the gimp. It has no return values.",
|
||||
"Jay Cox",
|
||||
"Jay Cox",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
1,
|
||||
gimp_detach_parasite_args,
|
||||
|
||||
/* Output arguments */
|
||||
0,
|
||||
NULL,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_detach_parasite_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_detach_parasite_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
char *parasite = NULL;
|
||||
Argument *return_args;
|
||||
|
||||
if (success)
|
||||
{
|
||||
parasite = (char *)args[0].value.pdb_pointer;
|
||||
if (parasite == NULL)
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
gimp_detach_parasite (parasite);
|
||||
}
|
||||
|
||||
return_args = procedural_db_return_args (&gimp_detach_parasite_proc,
|
||||
success);
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
|
|
@ -21,5 +21,8 @@
|
|||
#define __PARASITE_CMDS_H__
|
||||
|
||||
extern ProcRecord parasite_new_proc;
|
||||
extern ProcRecord gimp_find_parasite_proc;
|
||||
extern ProcRecord gimp_attach_parasite_proc;
|
||||
extern ProcRecord gimp_detach_parasite_proc;
|
||||
|
||||
#endif __PARASITE_CMDS_H__
|
||||
|
|
|
@ -0,0 +1,179 @@
|
|||
/* parasitelist.c: Copyright 1998 Jay Cox <jaycox@earthlink.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "gimpobjectP.h"
|
||||
#include "gimpobject.h"
|
||||
#include "gimpsignal.h"
|
||||
#include "parasitelistP.h"
|
||||
#include "libgimp/parasite.h"
|
||||
#include "libgimp/parasiteP.h"
|
||||
|
||||
enum
|
||||
{
|
||||
ADD,
|
||||
REMOVE,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint parasite_list_signals[LAST_SIGNAL];
|
||||
|
||||
static void parasite_list_destroy (GtkObject* list);
|
||||
static void parasite_list_init (ParasiteList* list);
|
||||
static void parasite_list_class_init (ParasiteListClass *klass);
|
||||
static int parasite_compare_func (gconstpointer n1, gconstpointer n2);
|
||||
static int free_a_parasite (void *key, void *parasite, void *unused);
|
||||
|
||||
static void
|
||||
parasite_list_init (ParasiteList* list)
|
||||
{
|
||||
list->table=NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
parasite_list_class_init(ParasiteListClass *klass)
|
||||
{
|
||||
GtkObjectClass *class = GTK_OBJECT_CLASS(klass);
|
||||
GtkType type = class->type;
|
||||
|
||||
class->destroy = parasite_list_destroy;
|
||||
|
||||
parasite_list_signals[ADD] =
|
||||
gimp_signal_new("add", GTK_RUN_FIRST, type, 0, gimp_sigtype_pointer);
|
||||
parasite_list_signals[REMOVE] =
|
||||
gimp_signal_new("remove", GTK_RUN_FIRST, type, 0, gimp_sigtype_pointer);
|
||||
gtk_object_class_add_signals (class, parasite_list_signals, LAST_SIGNAL);
|
||||
}
|
||||
|
||||
GtkType
|
||||
parasite_list_get_type()
|
||||
{
|
||||
static GtkType type = 0;
|
||||
if (!type)
|
||||
{
|
||||
GtkTypeInfo info =
|
||||
{
|
||||
"ParasiteList",
|
||||
sizeof (ParasiteList),
|
||||
sizeof (ParasiteListClass),
|
||||
(GtkClassInitFunc) parasite_list_class_init,
|
||||
(GtkObjectInitFunc) parasite_list_init,
|
||||
NULL,
|
||||
NULL,
|
||||
(GtkClassInitFunc) NULL
|
||||
};
|
||||
type = gtk_type_unique(GIMP_TYPE_OBJECT, &info);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
ParasiteList*
|
||||
parasite_list_new()
|
||||
{
|
||||
ParasiteList *list = gtk_type_new(GIMP_TYPE_PARASITE_LIST);
|
||||
list->table = NULL;
|
||||
return list;
|
||||
}
|
||||
|
||||
static int
|
||||
parasite_compare_func(gconstpointer n1, gconstpointer n2)
|
||||
{
|
||||
return (!strcmp((char*)n1, (char*)n2));
|
||||
}
|
||||
|
||||
static int
|
||||
free_a_parasite(void *key, void *parasite, void *unused)
|
||||
{
|
||||
parasite_free((Parasite *)parasite);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
parasite_list_destroy(GtkObject *obj)
|
||||
{
|
||||
ParasiteList *list;
|
||||
|
||||
g_return_if_fail(obj != NULL);
|
||||
g_return_if_fail(GIMP_IS_PARASITE_LIST(obj));
|
||||
|
||||
list = (ParasiteList *)obj;
|
||||
|
||||
if (list->table)
|
||||
{
|
||||
g_hash_table_foreach_remove(list->table, free_a_parasite, NULL);
|
||||
g_hash_table_destroy(list->table);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
parasite_copy_one(void *key, void *p, void *data)
|
||||
{
|
||||
ParasiteList *list = (ParasiteList*)data;
|
||||
Parasite *parasite = (Parasite*)p;
|
||||
parasite_list_add(list, parasite);
|
||||
}
|
||||
|
||||
ParasiteList*
|
||||
parasite_list_copy(const ParasiteList *list)
|
||||
{
|
||||
ParasiteList *newlist;
|
||||
newlist = parasite_list_new();
|
||||
if (list->table)
|
||||
g_hash_table_foreach(list->table, parasite_copy_one, newlist);
|
||||
return newlist;
|
||||
}
|
||||
|
||||
void
|
||||
parasite_list_add(ParasiteList *list, Parasite *p)
|
||||
{
|
||||
g_return_if_fail(list != NULL);
|
||||
if (list->table == NULL)
|
||||
list->table = g_hash_table_new(g_str_hash, parasite_compare_func);
|
||||
g_return_if_fail(p != NULL);
|
||||
g_return_if_fail(p->name != NULL);
|
||||
p = parasite_copy(p);
|
||||
g_hash_table_insert(list->table, p->name, p);
|
||||
gtk_signal_emit (GTK_OBJECT(list), parasite_list_signals[ADD], p);
|
||||
}
|
||||
|
||||
void
|
||||
parasite_list_remove(ParasiteList *list, const char *name)
|
||||
{
|
||||
Parasite *p;
|
||||
g_return_if_fail(list != NULL);
|
||||
if (list->table)
|
||||
{
|
||||
p = parasite_list_find(list, name);
|
||||
if (p)
|
||||
{
|
||||
g_hash_table_remove(list->table, name);
|
||||
gtk_signal_emit (GTK_OBJECT(list), parasite_list_signals[REMOVE], p);
|
||||
parasite_free(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Parasite *
|
||||
parasite_list_find(ParasiteList *list, const char *name)
|
||||
{
|
||||
g_return_val_if_fail(list != NULL, NULL);
|
||||
if (list->table)
|
||||
return (Parasite *)g_hash_table_lookup(list->table, name);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
/* parasitelist.h: Copyright 1998 Jay Cox <jaycox@earthlink.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __PARASITE_LIST_H__
|
||||
#define __PARASITE_LIST_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include "libgimp/parasiteF.h"
|
||||
#include "parasitelistF.h"
|
||||
#include "gimpobject.h"
|
||||
|
||||
#define GIMP_TYPE_PARASITE_LIST (parasite_list_get_type ())
|
||||
#define GIMP_PARASITE_LIST(obj) (GIMP_CHECK_CAST ((obj), GIMP_TYPE_PARASITE_LIST, GimpParasiteList))
|
||||
#define GIMP_IS_PARASITE_LIST(obj) (GIMP_CHECK_TYPE ((obj), GIMP_TYPE_PARASITE_LIST))
|
||||
|
||||
/* Signals:
|
||||
add
|
||||
remove
|
||||
*/
|
||||
|
||||
GtkType parasite_list_get_type (void);
|
||||
|
||||
/* function declarations */
|
||||
|
||||
ParasiteList *parasite_list_new (void);
|
||||
ParasiteList *parasite_list_copy (const ParasiteList *list);
|
||||
void parasite_list_add (ParasiteList *list, Parasite *p);
|
||||
void parasite_list_remove (ParasiteList *list, const char *name);
|
||||
Parasite *parasite_list_find (ParasiteList *list, const char *name);
|
||||
|
||||
#endif /* __GIMP_PARASITE_H__ */
|
|
@ -0,0 +1,7 @@
|
|||
#ifndef __PARASITE_LIST_F_H__
|
||||
#define __PARASITE_LIST_F_H__
|
||||
|
||||
typedef struct _ParasiteList ParasiteList;
|
||||
|
||||
#endif /* __PARASITE_LIST_F_H__ */
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
/* parasitelistP.h: Copyright 1998 Jay Cox <jaycox@earthlink.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __PARASITE_LIST_P_H__
|
||||
#define __PARASITE_LIST_P_H__
|
||||
|
||||
#include "gimpobjectP.h"
|
||||
#include "parasitelist.h"
|
||||
|
||||
struct _ParasiteList
|
||||
{
|
||||
GimpObject object;
|
||||
GHashTable *table;
|
||||
};
|
||||
|
||||
typedef struct _ParasiteListClass
|
||||
{
|
||||
GimpObjectClass parent_class;
|
||||
void (* add) (ParasiteList *list, Parasite *parasite);
|
||||
void (* remove) (ParasiteList *list, Parasite *parasite);
|
||||
} ParasiteListClass;
|
||||
|
||||
#define PARASITE_LIST_CLASS(class) GIMP_CHECK_CLASS_CAST (class, parasite_list_get_type(), ParasiteListClass)
|
||||
|
||||
#endif /* __GIMP_PARASITE_P_H__ */
|
|
@ -2991,8 +2991,8 @@ plug_in_args_destroy (Argument *args,
|
|||
case PDB_PARASITE:
|
||||
if (full_destroy)
|
||||
{
|
||||
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
|
||||
args[i].value.pdb_pointer = NULL;*/
|
||||
parasite_free ((Parasite *)(args[i].value.pdb_pointer));
|
||||
args[i].value.pdb_pointer = NULL;
|
||||
}
|
||||
break;
|
||||
case PDB_STATUS:
|
||||
|
|
|
@ -2991,8 +2991,8 @@ plug_in_args_destroy (Argument *args,
|
|||
case PDB_PARASITE:
|
||||
if (full_destroy)
|
||||
{
|
||||
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
|
||||
args[i].value.pdb_pointer = NULL;*/
|
||||
parasite_free ((Parasite *)(args[i].value.pdb_pointer));
|
||||
args[i].value.pdb_pointer = NULL;
|
||||
}
|
||||
break;
|
||||
case PDB_STATUS:
|
||||
|
|
|
@ -2991,8 +2991,8 @@ plug_in_args_destroy (Argument *args,
|
|||
case PDB_PARASITE:
|
||||
if (full_destroy)
|
||||
{
|
||||
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
|
||||
args[i].value.pdb_pointer = NULL;*/
|
||||
parasite_free ((Parasite *)(args[i].value.pdb_pointer));
|
||||
args[i].value.pdb_pointer = NULL;
|
||||
}
|
||||
break;
|
||||
case PDB_STATUS:
|
||||
|
|
|
@ -2991,8 +2991,8 @@ plug_in_args_destroy (Argument *args,
|
|||
case PDB_PARASITE:
|
||||
if (full_destroy)
|
||||
{
|
||||
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
|
||||
args[i].value.pdb_pointer = NULL;*/
|
||||
parasite_free ((Parasite *)(args[i].value.pdb_pointer));
|
||||
args[i].value.pdb_pointer = NULL;
|
||||
}
|
||||
break;
|
||||
case PDB_STATUS:
|
||||
|
|
|
@ -2991,8 +2991,8 @@ plug_in_args_destroy (Argument *args,
|
|||
case PDB_PARASITE:
|
||||
if (full_destroy)
|
||||
{
|
||||
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
|
||||
args[i].value.pdb_pointer = NULL;*/
|
||||
parasite_free ((Parasite *)(args[i].value.pdb_pointer));
|
||||
args[i].value.pdb_pointer = NULL;
|
||||
}
|
||||
break;
|
||||
case PDB_STATUS:
|
||||
|
|
|
@ -2991,8 +2991,8 @@ plug_in_args_destroy (Argument *args,
|
|||
case PDB_PARASITE:
|
||||
if (full_destroy)
|
||||
{
|
||||
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
|
||||
args[i].value.pdb_pointer = NULL;*/
|
||||
parasite_free ((Parasite *)(args[i].value.pdb_pointer));
|
||||
args[i].value.pdb_pointer = NULL;
|
||||
}
|
||||
break;
|
||||
case PDB_STATUS:
|
||||
|
|
|
@ -2991,8 +2991,8 @@ plug_in_args_destroy (Argument *args,
|
|||
case PDB_PARASITE:
|
||||
if (full_destroy)
|
||||
{
|
||||
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
|
||||
args[i].value.pdb_pointer = NULL;*/
|
||||
parasite_free ((Parasite *)(args[i].value.pdb_pointer));
|
||||
args[i].value.pdb_pointer = NULL;
|
||||
}
|
||||
break;
|
||||
case PDB_STATUS:
|
||||
|
|
|
@ -2991,8 +2991,8 @@ plug_in_args_destroy (Argument *args,
|
|||
case PDB_PARASITE:
|
||||
if (full_destroy)
|
||||
{
|
||||
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
|
||||
args[i].value.pdb_pointer = NULL;*/
|
||||
parasite_free ((Parasite *)(args[i].value.pdb_pointer));
|
||||
args[i].value.pdb_pointer = NULL;
|
||||
}
|
||||
break;
|
||||
case PDB_STATUS:
|
||||
|
|
|
@ -2991,8 +2991,8 @@ plug_in_args_destroy (Argument *args,
|
|||
case PDB_PARASITE:
|
||||
if (full_destroy)
|
||||
{
|
||||
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
|
||||
args[i].value.pdb_pointer = NULL;*/
|
||||
parasite_free ((Parasite *)(args[i].value.pdb_pointer));
|
||||
args[i].value.pdb_pointer = NULL;
|
||||
}
|
||||
break;
|
||||
case PDB_STATUS:
|
||||
|
|
|
@ -2991,8 +2991,8 @@ plug_in_args_destroy (Argument *args,
|
|||
case PDB_PARASITE:
|
||||
if (full_destroy)
|
||||
{
|
||||
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
|
||||
args[i].value.pdb_pointer = NULL;*/
|
||||
parasite_free ((Parasite *)(args[i].value.pdb_pointer));
|
||||
args[i].value.pdb_pointer = NULL;
|
||||
}
|
||||
break;
|
||||
case PDB_STATUS:
|
||||
|
|
|
@ -2991,8 +2991,8 @@ plug_in_args_destroy (Argument *args,
|
|||
case PDB_PARASITE:
|
||||
if (full_destroy)
|
||||
{
|
||||
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
|
||||
args[i].value.pdb_pointer = NULL;*/
|
||||
parasite_free ((Parasite *)(args[i].value.pdb_pointer));
|
||||
args[i].value.pdb_pointer = NULL;
|
||||
}
|
||||
break;
|
||||
case PDB_STATUS:
|
||||
|
|
|
@ -2991,8 +2991,8 @@ plug_in_args_destroy (Argument *args,
|
|||
case PDB_PARASITE:
|
||||
if (full_destroy)
|
||||
{
|
||||
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
|
||||
args[i].value.pdb_pointer = NULL;*/
|
||||
parasite_free ((Parasite *)(args[i].value.pdb_pointer));
|
||||
args[i].value.pdb_pointer = NULL;
|
||||
}
|
||||
break;
|
||||
case PDB_STATUS:
|
||||
|
|
|
@ -2991,8 +2991,8 @@ plug_in_args_destroy (Argument *args,
|
|||
case PDB_PARASITE:
|
||||
if (full_destroy)
|
||||
{
|
||||
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
|
||||
args[i].value.pdb_pointer = NULL;*/
|
||||
parasite_free ((Parasite *)(args[i].value.pdb_pointer));
|
||||
args[i].value.pdb_pointer = NULL;
|
||||
}
|
||||
break;
|
||||
case PDB_STATUS:
|
||||
|
|
|
@ -2991,8 +2991,8 @@ plug_in_args_destroy (Argument *args,
|
|||
case PDB_PARASITE:
|
||||
if (full_destroy)
|
||||
{
|
||||
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
|
||||
args[i].value.pdb_pointer = NULL;*/
|
||||
parasite_free ((Parasite *)(args[i].value.pdb_pointer));
|
||||
args[i].value.pdb_pointer = NULL;
|
||||
}
|
||||
break;
|
||||
case PDB_STATUS:
|
||||
|
|
|
@ -2991,8 +2991,8 @@ plug_in_args_destroy (Argument *args,
|
|||
case PDB_PARASITE:
|
||||
if (full_destroy)
|
||||
{
|
||||
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
|
||||
args[i].value.pdb_pointer = NULL;*/
|
||||
parasite_free ((Parasite *)(args[i].value.pdb_pointer));
|
||||
args[i].value.pdb_pointer = NULL;
|
||||
}
|
||||
break;
|
||||
case PDB_STATUS:
|
||||
|
|
|
@ -2991,8 +2991,8 @@ plug_in_args_destroy (Argument *args,
|
|||
case PDB_PARASITE:
|
||||
if (full_destroy)
|
||||
{
|
||||
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
|
||||
args[i].value.pdb_pointer = NULL;*/
|
||||
parasite_free ((Parasite *)(args[i].value.pdb_pointer));
|
||||
args[i].value.pdb_pointer = NULL;
|
||||
}
|
||||
break;
|
||||
case PDB_STATUS:
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "floating_sel.h"
|
||||
#include "gdisplay_ops.h"
|
||||
#include "general.h"
|
||||
#include "gimage_cmds.h"
|
||||
#include "gimage_mask.h"
|
||||
#include "gimprc.h"
|
||||
#include "global_edit.h"
|
||||
|
|
|
@ -37,6 +37,7 @@ libgimp_la_SOURCES = \
|
|||
gimpmatrix.c \
|
||||
gimpmatrix.h \
|
||||
gimppalette.c \
|
||||
gimpparasite.c \
|
||||
gimppixelrgn.c \
|
||||
gimpprotocol.c \
|
||||
gimpprotocol.h \
|
||||
|
|
|
@ -432,12 +432,18 @@ Parasite *gimp_image_find_parasite (gint32 image_ID,
|
|||
const char *name);
|
||||
void gimp_image_attach_parasite (gint32 image_ID,
|
||||
const Parasite *p);
|
||||
void gimp_image_attach_new_parasite (gint32 image_ID,
|
||||
const char *name, int flags,
|
||||
int size, const void *data);
|
||||
void gimp_image_detach_parasite (gint32 image_ID,
|
||||
const char *name);
|
||||
void gimp_image_set_resolution (gint32 image_ID,
|
||||
float resolution);
|
||||
float gimp_image_get_resolution (gint32 image_ID);
|
||||
|
||||
gint32 gimp_image_get_layer_by_tattoo (gint32 image_ID,
|
||||
gint32 tattoo);
|
||||
gint32 gimp_image_get_channel_by_tattoo (gint32 image_ID,
|
||||
gint32 tattoo);
|
||||
|
||||
|
||||
/****************************************
|
||||
|
@ -529,12 +535,6 @@ void gimp_layer_set_show_mask (gint32 layer_ID,
|
|||
gint show_mask);
|
||||
void gimp_layer_set_visible (gint32 layer_ID,
|
||||
gint visible);
|
||||
Parasite *gimp_layer_find_parasite (gint32 image_ID,
|
||||
const char *name);
|
||||
void gimp_layer_attach_parasite (gint32 layer_ID,
|
||||
const Parasite *p);
|
||||
void gimp_layer_detach_parasite (gint32 layer_ID,
|
||||
const char *name);
|
||||
|
||||
|
||||
/****************************************
|
||||
|
@ -630,6 +630,9 @@ Parasite *gimp_drawable_find_parasite (gint32 drawable,
|
|||
const char *name);
|
||||
void gimp_drawable_attach_parasite (gint32 drawable,
|
||||
const Parasite *p);
|
||||
void gimp_layer_attach_new_parasite(gint32 drawable,
|
||||
const char *name, int flags,
|
||||
int size, const void *data);
|
||||
void gimp_drawable_detach_parasite (gint32 drawable,
|
||||
const char *name);
|
||||
|
||||
|
@ -738,6 +741,15 @@ gdouble* gimp_gradients_sample_uniform (gint num_samples);
|
|||
gdouble* gimp_gradients_sample_custom (gint num_samples,
|
||||
gdouble *positions);
|
||||
|
||||
/****************************************
|
||||
* Parasites *
|
||||
****************************************/
|
||||
|
||||
Parasite *gimp_find_parasite (const char *name);
|
||||
void gimp_attach_parasite (const Parasite *p);
|
||||
void gimp_attach_new_parasite (const char *name, int flags,
|
||||
int size, const void *data);
|
||||
void gimp_detach_parasite (const char *name);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -619,6 +619,25 @@ gimp_drawable_attach_parasite (gint32 drawable_ID,
|
|||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
gimp_drawable_attach_new_parasite (gint32 drawable, const char *name, int flags,
|
||||
int size, const void *data)
|
||||
{
|
||||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
Parasite *p = parasite_new(name, flags, size, data);
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_drawable_attach_parasite",
|
||||
&nreturn_vals,
|
||||
PARAM_DRAWABLE, drawable,
|
||||
PARAM_PARASITE, p,
|
||||
PARAM_END);
|
||||
|
||||
parasite_free(p);
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_drawable_detach_parasite (gint32 drawable_ID,
|
||||
const char *name)
|
||||
|
|
|
@ -619,6 +619,25 @@ gimp_drawable_attach_parasite (gint32 drawable_ID,
|
|||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
gimp_drawable_attach_new_parasite (gint32 drawable, const char *name, int flags,
|
||||
int size, const void *data)
|
||||
{
|
||||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
Parasite *p = parasite_new(name, flags, size, data);
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_drawable_attach_parasite",
|
||||
&nreturn_vals,
|
||||
PARAM_DRAWABLE, drawable,
|
||||
PARAM_PARASITE, p,
|
||||
PARAM_END);
|
||||
|
||||
parasite_free(p);
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_drawable_detach_parasite (gint32 drawable_ID,
|
||||
const char *name)
|
||||
|
|
|
@ -31,6 +31,7 @@ extern "C" {
|
|||
#define GIMP_VERSION "@GIMP_VERSION@"
|
||||
|
||||
#define GIMP_HAVE_GET_DATA_SIZE 1-1-0
|
||||
#define GIMP_HAVE_PARASITES 1-1-0
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -949,6 +949,24 @@ gimp_image_attach_parasite (gint32 image_ID, const Parasite *p)
|
|||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_image_attach_new_parasite (gint32 image_ID, const char *name, int flags,
|
||||
int size, const void *data)
|
||||
{
|
||||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
Parasite *p = parasite_new(name, flags, size, data);
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_image_attach_parasite",
|
||||
&nreturn_vals,
|
||||
PARAM_IMAGE, image_ID,
|
||||
PARAM_PARASITE, p,
|
||||
PARAM_END);
|
||||
|
||||
parasite_free(p);
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_image_detach_parasite (gint32 image_ID, const char *name)
|
||||
{
|
||||
|
@ -1001,3 +1019,47 @@ gimp_image_set_resolution (gint32 image_ID,
|
|||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
}
|
||||
|
||||
gint32
|
||||
gimp_image_get_layer_by_tattoo (gint32 image_ID, gint32 tattoo)
|
||||
{
|
||||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
gint32 layer = 0;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_image_get_layer_by_tattoo",
|
||||
&nreturn_vals,
|
||||
PARAM_IMAGE, image_ID,
|
||||
PARAM_INT32, tattoo,
|
||||
PARAM_END);
|
||||
|
||||
layer = 0;
|
||||
if (return_vals[0].data.d_status == STATUS_SUCCESS)
|
||||
layer = return_vals[1].data.d_layer;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
gint32
|
||||
gimp_image_get_channel_by_tattoo (gint32 image_ID, gint32 tattoo)
|
||||
{
|
||||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
gint32 channel = 0;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_image_get_channel_by_tattoo",
|
||||
&nreturn_vals,
|
||||
PARAM_IMAGE, image_ID,
|
||||
PARAM_INT32, tattoo,
|
||||
PARAM_END);
|
||||
|
||||
channel = 0;
|
||||
if (return_vals[0].data.d_status == STATUS_SUCCESS)
|
||||
channel = return_vals[1].data.d_channel;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return channel;
|
||||
}
|
||||
|
||||
|
|
|
@ -949,6 +949,24 @@ gimp_image_attach_parasite (gint32 image_ID, const Parasite *p)
|
|||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_image_attach_new_parasite (gint32 image_ID, const char *name, int flags,
|
||||
int size, const void *data)
|
||||
{
|
||||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
Parasite *p = parasite_new(name, flags, size, data);
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_image_attach_parasite",
|
||||
&nreturn_vals,
|
||||
PARAM_IMAGE, image_ID,
|
||||
PARAM_PARASITE, p,
|
||||
PARAM_END);
|
||||
|
||||
parasite_free(p);
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_image_detach_parasite (gint32 image_ID, const char *name)
|
||||
{
|
||||
|
@ -1001,3 +1019,47 @@ gimp_image_set_resolution (gint32 image_ID,
|
|||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
}
|
||||
|
||||
gint32
|
||||
gimp_image_get_layer_by_tattoo (gint32 image_ID, gint32 tattoo)
|
||||
{
|
||||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
gint32 layer = 0;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_image_get_layer_by_tattoo",
|
||||
&nreturn_vals,
|
||||
PARAM_IMAGE, image_ID,
|
||||
PARAM_INT32, tattoo,
|
||||
PARAM_END);
|
||||
|
||||
layer = 0;
|
||||
if (return_vals[0].data.d_status == STATUS_SUCCESS)
|
||||
layer = return_vals[1].data.d_layer;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
gint32
|
||||
gimp_image_get_channel_by_tattoo (gint32 image_ID, gint32 tattoo)
|
||||
{
|
||||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
gint32 channel = 0;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_image_get_channel_by_tattoo",
|
||||
&nreturn_vals,
|
||||
PARAM_IMAGE, image_ID,
|
||||
PARAM_INT32, tattoo,
|
||||
PARAM_END);
|
||||
|
||||
channel = 0;
|
||||
if (return_vals[0].data.d_status == STATUS_SUCCESS)
|
||||
channel = return_vals[1].data.d_channel;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return channel;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,10 @@
|
|||
#ifndef __GIMPMATRIX_H__
|
||||
#define __GIMPMATRIX_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
typedef double GimpMatrix[3][3];
|
||||
|
||||
void gimp_matrix_transform_point (GimpMatrix, double, double,
|
||||
|
@ -34,5 +38,8 @@ void gimp_matrix_yshear (GimpMatrix, double);
|
|||
double gimp_matrix_determinant (GimpMatrix);
|
||||
void gimp_matrix_invert (GimpMatrix m, GimpMatrix m_inv);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __GIMPMATRIX_H__ */
|
||||
|
|
|
@ -22,6 +22,24 @@
|
|||
#include <string.h>
|
||||
#include <glib.h>
|
||||
|
||||
static void parasite_print(Parasite *p)
|
||||
{
|
||||
if (p == NULL)
|
||||
{
|
||||
printf("(pid %d)attempt to print a null parasite\n", getpid());
|
||||
return;
|
||||
}
|
||||
printf("(pid %d), parasite: %X\n", getpid(), p);
|
||||
if (p->name)
|
||||
printf("\tname: %s\n", p->name);
|
||||
else
|
||||
printf("\tname: NULL\n");
|
||||
printf("\tflags: %d\n", p->flags);
|
||||
printf("\tsize: %d\n", p->size);
|
||||
if (p->size > 0)
|
||||
printf("\tdata: %X\n", p->data);
|
||||
}
|
||||
|
||||
Parasite *
|
||||
parasite_new (const char *name, guint32 flags,
|
||||
guint32 size, const void *data)
|
||||
|
@ -41,6 +59,7 @@ parasite_new (const char *name, guint32 flags,
|
|||
return p;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
parasite_free (Parasite *parasite)
|
||||
{
|
||||
|
@ -55,7 +74,7 @@ parasite_free (Parasite *parasite)
|
|||
int
|
||||
parasite_is_type (const Parasite *parasite, const char *name)
|
||||
{
|
||||
if (!parasite)
|
||||
if (!parasite || !parasite->name)
|
||||
return FALSE;
|
||||
return (strcmp(parasite->name, name) == 0);
|
||||
}
|
||||
|
@ -93,53 +112,3 @@ parasite_is_persistant(const Parasite *p)
|
|||
return FALSE;
|
||||
return (p->flags & PARASITE_PERSISTANT);
|
||||
}
|
||||
|
||||
/* parasite list functions */
|
||||
|
||||
Parasite *
|
||||
parasite_find_in_gslist (const GSList *list, const char *name)
|
||||
{
|
||||
while (list)
|
||||
{
|
||||
if (parasite_is_type((Parasite *)(list->data), name))
|
||||
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->name)))
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,10 @@
|
|||
#include <glib.h>
|
||||
#include <libgimp/parasiteF.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define PARASITE_PERSISTANT 1
|
||||
|
||||
Parasite *parasite_new (const char *name, guint32 flags,
|
||||
|
@ -38,12 +42,8 @@ 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 *name);
|
||||
|
||||
GSList *parasite_gslist_copy (const GSList *list);
|
||||
void parasite_gslist_destroy (GSList *list);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif _PARASITE_H_
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
#include "gimp.h"
|
||||
|
||||
Parasite *
|
||||
gimp_find_parasite (const char *name)
|
||||
{
|
||||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
Parasite *parasite;
|
||||
return_vals = gimp_run_procedure ("gimp_find_parasite",
|
||||
&nreturn_vals,
|
||||
PARAM_STRING, name,
|
||||
PARAM_END);
|
||||
|
||||
if (return_vals[0].data.d_status == STATUS_SUCCESS)
|
||||
{
|
||||
parasite = parasite_copy(&return_vals[1].data.d_parasite);
|
||||
}
|
||||
else
|
||||
parasite = NULL;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return parasite;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
gimp_attach_parasite (const Parasite *p)
|
||||
{
|
||||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_attach_parasite",
|
||||
&nreturn_vals,
|
||||
PARAM_PARASITE, p,
|
||||
PARAM_END);
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_attach_new_parasite (const char *name, int flags,
|
||||
int size, const void *data)
|
||||
{
|
||||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
Parasite *p = parasite_new(name, flags, size, data);
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_attach_parasite",
|
||||
&nreturn_vals,
|
||||
PARAM_PARASITE, p,
|
||||
PARAM_END);
|
||||
|
||||
parasite_free(p);
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_detach_parasite (const char *name)
|
||||
{
|
||||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_image_detach_parasite",
|
||||
&nreturn_vals,
|
||||
PARAM_STRING, name,
|
||||
PARAM_END);
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
}
|
|
@ -22,6 +22,24 @@
|
|||
#include <string.h>
|
||||
#include <glib.h>
|
||||
|
||||
static void parasite_print(Parasite *p)
|
||||
{
|
||||
if (p == NULL)
|
||||
{
|
||||
printf("(pid %d)attempt to print a null parasite\n", getpid());
|
||||
return;
|
||||
}
|
||||
printf("(pid %d), parasite: %X\n", getpid(), p);
|
||||
if (p->name)
|
||||
printf("\tname: %s\n", p->name);
|
||||
else
|
||||
printf("\tname: NULL\n");
|
||||
printf("\tflags: %d\n", p->flags);
|
||||
printf("\tsize: %d\n", p->size);
|
||||
if (p->size > 0)
|
||||
printf("\tdata: %X\n", p->data);
|
||||
}
|
||||
|
||||
Parasite *
|
||||
parasite_new (const char *name, guint32 flags,
|
||||
guint32 size, const void *data)
|
||||
|
@ -41,6 +59,7 @@ parasite_new (const char *name, guint32 flags,
|
|||
return p;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
parasite_free (Parasite *parasite)
|
||||
{
|
||||
|
@ -55,7 +74,7 @@ parasite_free (Parasite *parasite)
|
|||
int
|
||||
parasite_is_type (const Parasite *parasite, const char *name)
|
||||
{
|
||||
if (!parasite)
|
||||
if (!parasite || !parasite->name)
|
||||
return FALSE;
|
||||
return (strcmp(parasite->name, name) == 0);
|
||||
}
|
||||
|
@ -93,53 +112,3 @@ parasite_is_persistant(const Parasite *p)
|
|||
return FALSE;
|
||||
return (p->flags & PARASITE_PERSISTANT);
|
||||
}
|
||||
|
||||
/* parasite list functions */
|
||||
|
||||
Parasite *
|
||||
parasite_find_in_gslist (const GSList *list, const char *name)
|
||||
{
|
||||
while (list)
|
||||
{
|
||||
if (parasite_is_type((Parasite *)(list->data), name))
|
||||
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->name)))
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,10 @@
|
|||
#include <glib.h>
|
||||
#include <libgimp/parasiteF.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define PARASITE_PERSISTANT 1
|
||||
|
||||
Parasite *parasite_new (const char *name, guint32 flags,
|
||||
|
@ -38,12 +42,8 @@ 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 *name);
|
||||
|
||||
GSList *parasite_gslist_copy (const GSList *list);
|
||||
void parasite_gslist_destroy (GSList *list);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif _PARASITE_H_
|
||||
|
|
|
@ -22,6 +22,24 @@
|
|||
#include <string.h>
|
||||
#include <glib.h>
|
||||
|
||||
static void parasite_print(Parasite *p)
|
||||
{
|
||||
if (p == NULL)
|
||||
{
|
||||
printf("(pid %d)attempt to print a null parasite\n", getpid());
|
||||
return;
|
||||
}
|
||||
printf("(pid %d), parasite: %X\n", getpid(), p);
|
||||
if (p->name)
|
||||
printf("\tname: %s\n", p->name);
|
||||
else
|
||||
printf("\tname: NULL\n");
|
||||
printf("\tflags: %d\n", p->flags);
|
||||
printf("\tsize: %d\n", p->size);
|
||||
if (p->size > 0)
|
||||
printf("\tdata: %X\n", p->data);
|
||||
}
|
||||
|
||||
Parasite *
|
||||
parasite_new (const char *name, guint32 flags,
|
||||
guint32 size, const void *data)
|
||||
|
@ -41,6 +59,7 @@ parasite_new (const char *name, guint32 flags,
|
|||
return p;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
parasite_free (Parasite *parasite)
|
||||
{
|
||||
|
@ -55,7 +74,7 @@ parasite_free (Parasite *parasite)
|
|||
int
|
||||
parasite_is_type (const Parasite *parasite, const char *name)
|
||||
{
|
||||
if (!parasite)
|
||||
if (!parasite || !parasite->name)
|
||||
return FALSE;
|
||||
return (strcmp(parasite->name, name) == 0);
|
||||
}
|
||||
|
@ -93,53 +112,3 @@ parasite_is_persistant(const Parasite *p)
|
|||
return FALSE;
|
||||
return (p->flags & PARASITE_PERSISTANT);
|
||||
}
|
||||
|
||||
/* parasite list functions */
|
||||
|
||||
Parasite *
|
||||
parasite_find_in_gslist (const GSList *list, const char *name)
|
||||
{
|
||||
while (list)
|
||||
{
|
||||
if (parasite_is_type((Parasite *)(list->data), name))
|
||||
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->name)))
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,10 @@
|
|||
#include <glib.h>
|
||||
#include <libgimp/parasiteF.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define PARASITE_PERSISTANT 1
|
||||
|
||||
Parasite *parasite_new (const char *name, guint32 flags,
|
||||
|
@ -38,12 +42,8 @@ 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 *name);
|
||||
|
||||
GSList *parasite_gslist_copy (const GSList *list);
|
||||
void parasite_gslist_destroy (GSList *list);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif _PARASITE_H_
|
||||
|
|
|
@ -31,6 +31,7 @@ extern "C" {
|
|||
#define GIMP_VERSION "@GIMP_VERSION@"
|
||||
|
||||
#define GIMP_HAVE_GET_DATA_SIZE 1-1-0
|
||||
#define GIMP_HAVE_PARASITES 1-1-0
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -100,6 +100,8 @@ extern char siod_err_msg[];
|
|||
extern FILE *siod_output;
|
||||
|
||||
|
||||
#define message(string) printf("(%s): %d ::: %s\n", __PRETTY_FUNCTION__, __LINE__, string)
|
||||
|
||||
/*
|
||||
* Function definitions
|
||||
*/
|
||||
|
@ -380,12 +382,26 @@ script_fu_siod_read (gpointer data,
|
|||
GdkInputCondition cond)
|
||||
{
|
||||
int count;
|
||||
static int hack = 0;
|
||||
|
||||
if ((count = read (id, read_buffer, BUFSIZE - 1)) != 0)
|
||||
{
|
||||
if (!hack) /* this is a stupid hack, but as of 10/27/98
|
||||
* the script-fu-console will hang on my system without it.
|
||||
* the real cause of this needs to be tracked down.
|
||||
* posibly a problem with the text widget, or the
|
||||
* signal handlers not getting fully initialized or...
|
||||
* no reports of hangs on other platforms, could just be a
|
||||
* problem with my system.
|
||||
*/
|
||||
{
|
||||
hack = 1;
|
||||
return;
|
||||
}
|
||||
read_buffer[count] = '\0';
|
||||
gtk_text_freeze (GTK_TEXT (cint.console));
|
||||
gtk_text_insert (GTK_TEXT (cint.console), cint.font_weak, NULL, NULL, read_buffer, -1);
|
||||
gtk_text_insert (GTK_TEXT (cint.console), cint.font_weak, NULL, NULL,
|
||||
read_buffer, -1);
|
||||
gtk_text_thaw (GTK_TEXT (cint.console));
|
||||
|
||||
script_fu_console_scroll_end (NULL);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue