app/Makefile.am app/datafiles.[ch] app/gimpparasite.[ch] removed...

2001-07-09  Michael Natterer  <mitch@gimp.org>

	* app/Makefile.am
	* app/datafiles.[ch]
	* app/gimpparasite.[ch]
	* app/parasitelist.[ch]: removed...

	* app/core/Makefile.am
	* app/core/gimpdatafiles.[ch]
	* app/core/gimpparasite.[ch]
	* app/core/gimpparasitelist.[ch]: ...and added here.

	* app/gimprc.c
	* app/module_db.c
	* app/plug_in.c
	* app/undo.c
	* app/core/gimp.c
	* app/core/gimpchannel.c
	* app/core/gimpdatafactory.c
	* app/core/gimpdrawable.c
	* app/core/gimpimage-duplicate.c
	* app/core/gimpimage.c
	* app/core/gimplayer.c
	* app/xcf/xcf-load.c
	* app/xcf/xcf-save.c
	* tools/pdbgen/pdb/parasite.pdb
	* app/pdb/parasite_cmds.c: changed #include's accordingly.
This commit is contained in:
Michael Natterer 2001-07-09 19:48:30 +00:00 committed by Michael Natterer
parent d6364dcc7b
commit d7fde9e68d
58 changed files with 101 additions and 949 deletions

View File

@ -1,3 +1,31 @@
2001-07-09 Michael Natterer <mitch@gimp.org>
* app/Makefile.am
* app/datafiles.[ch]
* app/gimpparasite.[ch]
* app/parasitelist.[ch]: removed...
* app/core/Makefile.am
* app/core/gimpdatafiles.[ch]
* app/core/gimpparasite.[ch]
* app/core/gimpparasitelist.[ch]: ...and added here.
* app/gimprc.c
* app/module_db.c
* app/plug_in.c
* app/undo.c
* app/core/gimp.c
* app/core/gimpchannel.c
* app/core/gimpdatafactory.c
* app/core/gimpdrawable.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage.c
* app/core/gimplayer.c
* app/xcf/xcf-load.c
* app/xcf/xcf-save.c
* tools/pdbgen/pdb/parasite.pdb
* app/pdb/parasite_cmds.c: changed #include's accordingly.
2001-07-09 Dave Neary <dneary@eircom.net>
* app/plug_in.c: One-line fix which is needed, but never showed

View File

@ -79,15 +79,9 @@ gimp_SOURCES = @STRIP_BEGIN@ \
##
## stuff for core/
##
datafiles.c \
datafiles.h \
floating_sel.c \
floating_sel.h \
gimpparasite.c \
gimpparasite.h \
gimpunit.c \
parasitelist.c \
parasitelist.h \
unitrc.h \
##
## config stuff

View File

@ -90,6 +90,7 @@
#include "base/tile-manager.h"
#include "core/gimpcoreconfig.h"
#include "core/gimpdatafiles.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
@ -101,7 +102,6 @@
#include "app_procs.h"
#include "appenv.h"
#include "datafiles.h"
#include "errors.h"
#include "gimpprogress.h"
#include "gimprc.h"

View File

@ -27,6 +27,8 @@ libappcore_a_SOURCES = @STRIP_BEGIN@ \
gimpdata.h \
gimpdatafactory.c \
gimpdatafactory.h \
gimpdatafiles.c \
gimpdatafiles.h \
gimpdatalist.c \
gimpdatalist.h \
gimpdrawable.c \
@ -81,6 +83,10 @@ libappcore_a_SOURCES = @STRIP_BEGIN@ \
gimppalette.h \
gimppalette-import.c \
gimppalette-import.h \
gimpparasite.c \
gimpparasite.h \
gimpparasitelist.c \
gimpparasitelist.h \
gimppreviewcache.c \
gimppreviewcache.h \
gimpscanconvert.c \

View File

@ -26,13 +26,12 @@
#include "libgimpbase/gimpbase.h"
#include "core/core-types.h"
#include "core-types.h"
#include "core/gimp.h"
#include "app_procs.h"
#include "parasitelist.h"
#include "gimp.h"
#include "gimpparasite.h"
#include "gimpparasitelist.h"
#include "gimprc.h"

View File

@ -42,11 +42,11 @@
#include "gimplist.h"
#include "gimppalette.h"
#include "gimppattern.h"
#include "gimpparasite.h"
#include "gimptoolinfo.h"
#include "appenv.h"
#include "app_procs.h"
#include "gimpparasite.h"
#include "libgimp/gimpintl.h"

View File

@ -43,8 +43,8 @@
#include "gimpimage-mask.h"
#include "gimpchannel.h"
#include "gimplayer.h"
#include "gimpparasitelist.h"
#include "parasitelist.h"
#include "undo.h"
#include "libgimp/gimpintl.h"

View File

@ -43,8 +43,8 @@
#include "gimpimage-mask.h"
#include "gimpchannel.h"
#include "gimplayer.h"
#include "gimpparasitelist.h"
#include "parasitelist.h"
#include "undo.h"
#include "libgimp/gimpintl.h"

View File

@ -25,14 +25,13 @@
#include "core-types.h"
#include "gimpdata.h"
#include "gimpdatalist.h"
#include "gimpdatafactory.h"
#include "gimpcontext.h"
#include "gimpdata.h"
#include "gimpdatafactory.h"
#include "gimpdatafiles.h"
#include "gimpdatalist.h"
#include "gimpmarshal.h"
#include "datafiles.h"
#include "libgimp/gimpintl.h"

View File

@ -47,9 +47,9 @@
#include "libgimpbase/gimpbase.h"
#include "core/core-types.h"
#include "core-types.h"
#include "datafiles.h"
#include "gimpdatafiles.h"
static gboolean filestat_valid = FALSE;

View File

@ -44,10 +44,10 @@
#include "gimpimage-mask.h"
#include "gimplayer.h"
#include "gimplist.h"
#include "gimpparasite.h"
#include "gimpparasitelist.h"
#include "gimppreviewcache.h"
#include "gimpparasite.h"
#include "parasitelist.h"
#include "undo.h"
#include "libgimp/gimpintl.h"

View File

@ -42,11 +42,11 @@
#include "gimpimage-new.h"
#include "gimplayer.h"
#include "gimplist.h"
#include "gimpparasitelist.h"
#include "app_procs.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "parasitelist.h"
#include "path.h"
#include "libgimp/gimpintl.h"

View File

@ -50,12 +50,12 @@
#include "gimplist.h"
#include "gimpmarshal.h"
#include "gimpparasite.h"
#include "gimpparasitelist.h"
#include "gimpundostack.h"
#include "app_procs.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "parasitelist.h"
#include "path.h"
#include "undo.h"

View File

@ -50,12 +50,12 @@
#include "gimplist.h"
#include "gimpmarshal.h"
#include "gimpparasite.h"
#include "gimpparasitelist.h"
#include "gimpundostack.h"
#include "app_procs.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "parasitelist.h"
#include "path.h"
#include "undo.h"

View File

@ -50,12 +50,12 @@
#include "gimplist.h"
#include "gimpmarshal.h"
#include "gimpparasite.h"
#include "gimpparasitelist.h"
#include "gimpundostack.h"
#include "app_procs.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "parasitelist.h"
#include "path.h"
#include "undo.h"

View File

@ -50,12 +50,12 @@
#include "gimplist.h"
#include "gimpmarshal.h"
#include "gimpparasite.h"
#include "gimpparasitelist.h"
#include "gimpundostack.h"
#include "app_procs.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "parasitelist.h"
#include "path.h"
#include "undo.h"

View File

@ -50,12 +50,12 @@
#include "gimplist.h"
#include "gimpmarshal.h"
#include "gimpparasite.h"
#include "gimpparasitelist.h"
#include "gimpundostack.h"
#include "app_procs.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "parasitelist.h"
#include "path.h"
#include "undo.h"

View File

@ -41,6 +41,8 @@
#include "core/gimpimage-mask.h"
#include "core/gimplayer.h"
#include "core/gimplayermask.h"
#include "core/gimpparasite.h"
#include "core/gimpparasitelist.h"
#include "tools/gimpbycolorselecttool.h"
#include "tools/gimptool.h"
@ -53,8 +55,6 @@
#include "floating_sel.h"
#include "gdisplay.h"
#include "gdisplay_ops.h"
#include "gimpparasite.h"
#include "parasitelist.h"
#include "path_transform.h"
#include "undo.h"

View File

@ -50,12 +50,12 @@
#include "gimplist.h"
#include "gimpmarshal.h"
#include "gimpparasite.h"
#include "gimpparasitelist.h"
#include "gimpundostack.h"
#include "app_procs.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "parasitelist.h"
#include "path.h"
#include "undo.h"

View File

@ -36,13 +36,14 @@
#include "paint-funcs/paint-funcs.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "gimpdrawable-invert.h"
#include "gimpimage.h"
#include "gimplayer.h"
#include "gimplayermask.h"
#include "parasitelist.h"
#include "gimpparasitelist.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "undo.h"
#include "libgimp/gimpintl.h"

View File

@ -26,13 +26,12 @@
#include "libgimpbase/gimpbase.h"
#include "core/core-types.h"
#include "core-types.h"
#include "core/gimp.h"
#include "app_procs.h"
#include "parasitelist.h"
#include "gimp.h"
#include "gimpparasite.h"
#include "gimpparasitelist.h"
#include "gimprc.h"

View File

@ -23,9 +23,9 @@
#include "libgimpbase/gimpbase.h"
#include "core/core-types.h"
#include "core-types.h"
#include "parasitelist.h"
#include "gimpparasitelist.h"
enum

View File

@ -50,12 +50,12 @@
#include "gimplist.h"
#include "gimpmarshal.h"
#include "gimpparasite.h"
#include "gimpparasitelist.h"
#include "gimpundostack.h"
#include "app_procs.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "parasitelist.h"
#include "path.h"
#include "undo.h"

View File

@ -1,222 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* Datafiles module copyight (C) 1996 Federico Mena Quintero
* federico@nuclecu.unam.mx
*
* 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 "config.h"
#include <glib.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_DIRENT_H
#include <dirent.h>
#endif
#ifdef G_OS_WIN32
#ifndef S_ISDIR
#define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR)
#define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG)
#endif
#ifndef S_IXUSR
#define S_IXUSR _S_IEXEC
#endif
#endif /* G_OS_WIN32 */
#include "libgimpbase/gimpbase.h"
#include "core/core-types.h"
#include "datafiles.h"
static gboolean filestat_valid = FALSE;
static struct stat filestat;
#ifdef G_OS_WIN32
/*
* On Windows there is no concept like the Unix executable flag.
* There is a weak emulation provided by the MS C Runtime using file
* extensions (com, exe, cmd, bat). This needs to be extended to treat
* scripts (Python, Perl, ...) as executables, too. We use the PATHEXT
* variable, which is also used by cmd.exe.
*/
static gboolean
is_script (const gchar *filename)
{
const gchar *ext = strrchr (filename, '.');
gchar *pathext;
static gchar **exts = NULL;
gint i;
if (exts == NULL)
{
pathext = g_getenv ("PATHEXT");
if (pathext != NULL)
{
exts = g_strsplit (pathext, G_SEARCHPATH_SEPARATOR_S, 100);
}
else
{
exts = g_new (gchar *, 1);
exts[0] = NULL;
}
}
i = 0;
while (exts[i] != NULL)
{
if (g_strcasecmp (ext, exts[i]) == 0)
return TRUE;
i++;
}
return FALSE;
}
#else /* !G_OS_WIN32 */
#define is_script(filename) FALSE
#endif
gboolean
gimp_datafiles_check_extension (const gchar *filename,
const gchar *extension)
{
gint name_len;
gint ext_len;
g_return_val_if_fail (filename != NULL, FALSE);
g_return_val_if_fail (extension != NULL, FALSE);
name_len = strlen (filename);
ext_len = strlen (extension);
if (! (name_len && ext_len && (name_len > ext_len)))
return FALSE;
return (strcmp (&filename[name_len - ext_len], extension) == 0);
}
void
gimp_datafiles_read_directories (const gchar *path_str,
GimpDataFileFlags flags,
GimpDataFileLoaderFunc loader_func,
gpointer loader_data)
{
gchar *local_path;
GList *path;
GList *list;
gchar *filename;
gint err;
DIR *dir;
struct dirent *dir_ent;
g_return_if_fail (path_str != NULL);
g_return_if_fail (loader_func != NULL);
local_path = g_strdup (path_str);
#ifdef __EMX__
/*
* Change drive so opendir works.
*/
if (local_path[1] == ':')
{
_chdrive (local_path[0]);
}
#endif
path = gimp_path_parse (local_path, 16, TRUE, NULL);
for (list = path; list; list = g_list_next (list))
{
/* Open directory */
dir = opendir ((gchar *) list->data);
if (!dir)
{
g_message ("error reading datafiles directory \"%s\"",
(gchar *) list->data);
}
else
{
while ((dir_ent = readdir (dir)))
{
filename = g_strdup_printf ("%s%s",
(gchar *) list->data,
dir_ent->d_name);
/* Check the file and see that it is not a sub-directory */
err = stat (filename, &filestat);
if (!err && S_ISREG (filestat.st_mode) &&
(!(flags & MODE_EXECUTABLE) ||
(filestat.st_mode & S_IXUSR) ||
is_script (filename)))
{
filestat_valid = TRUE;
(* loader_func) (filename, loader_data);
filestat_valid = FALSE;
}
g_free (filename);
}
closedir (dir);
}
}
gimp_path_free (path);
g_free (local_path);
}
time_t
gimp_datafile_atime (void)
{
if (filestat_valid)
return filestat.st_atime;
return 0;
}
time_t
gimp_datafile_mtime (void)
{
if (filestat_valid)
return filestat.st_mtime;
return 0;
}
time_t
gimp_datafile_ctime (void)
{
if (filestat_valid)
return filestat.st_ctime;
return 0;
}

View File

@ -1,53 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* Datafiles module copyight (C) 1996 Federico Mena Quintero
* federico@nuclecu.unam.mx
*
* 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_DATAFILES_H__
#define __GIMP_DATAFILES_H__
#include <time.h>
typedef enum
{
INCLUDE_TEMP_DIR = 1 << 0,
MODE_EXECUTABLE = 1 << 1
} GimpDataFileFlags;
gboolean gimp_datafiles_check_extension (const gchar *filename,
const gchar *extension);
void gimp_datafiles_read_directories (const gchar *path_str,
GimpDataFileFlags flags,
GimpDataFileLoaderFunc loader_func,
gpointer loader_data);
/* Return the current datafiles access, modification
* or change time. The current datafile is the one for
* which the "DataFileLoaderFunc" function has been called
* on.
*/
time_t gimp_datafile_atime (void);
time_t gimp_datafile_mtime (void);
time_t gimp_datafile_ctime (void);
#endif /* __GIMP_DATAFILES_H__ */

View File

@ -39,11 +39,11 @@
#include "core/core-types.h"
#include "core/gimpcoreconfig.h"
#include "core/gimpdatafiles.h"
#include "core/gimplist.h"
#include "appenv.h"
#include "module_db.h"
#include "datafiles.h"
#include "gimprc.h"
#include "libgimp/gimpmodule.h"

View File

@ -1,202 +0,0 @@
/* 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 "config.h"
#include <gtk/gtk.h>
#include <stdio.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "libgimpbase/gimpbase.h"
#include "core/core-types.h"
#include "core/gimp.h"
#include "app_procs.h"
#include "parasitelist.h"
#include "gimpparasite.h"
#include "gimprc.h"
void
gimp_parasites_init (Gimp *gimp)
{
g_return_if_fail (gimp->parasites == NULL);
gimp->parasites = gimp_parasite_list_new ();
gtk_object_ref (GTK_OBJECT (gimp->parasites));
gtk_object_sink (GTK_OBJECT (gimp->parasites));
}
void
gimp_parasites_exit (Gimp *gimp)
{
if (gimp->parasites)
{
gtk_object_unref (GTK_OBJECT (gimp->parasites));
gimp->parasites = NULL;
}
}
void
gimp_parasite_attach (Gimp *gimp,
GimpParasite *parasite)
{
gimp_parasite_list_add (gimp->parasites, parasite);
}
void
gimp_parasite_detach (Gimp *gimp,
const gchar *name)
{
gimp_parasite_list_remove (gimp->parasites, name);
}
GimpParasite *
gimp_parasite_find (Gimp *gimp,
const gchar *name)
{
return gimp_parasite_list_find (gimp->parasites, name);
}
static void
list_func (gchar *key,
GimpParasite *p,
gchar ***cur)
{
*(*cur)++ = (char *) g_strdup (key);
}
gchar **
gimp_parasite_list (Gimp *gimp,
gint *count)
{
gchar **list;
gchar **cur;
*count = gimp_parasite_list_length (gimp->parasites);
cur = list = g_new (gchar *, *count);
gimp_parasite_list_foreach (gimp->parasites, (GHFunc) list_func, &cur);
return list;
}
static void
save_func (gchar *key,
GimpParasite *parasite,
FILE *fp)
{
if (gimp_parasite_is_persistent (parasite))
{
gchar *s;
guint32 l;
fprintf (fp, "(parasite \"%s\" %lu \"",
gimp_parasite_name (parasite),
gimp_parasite_flags (parasite));
/*
* the current methodology is: never move the parasiterc from one
* system to another. If you want to do this you should probably
* write out parasites which contain any non-alphanumeric(+some)
* characters as \xHH sequences altogether.
*/
for (s = (gchar *) gimp_parasite_data (parasite),
l = gimp_parasite_data_size (parasite);
l;
l--, s++)
{
switch (*s)
{
case '\\': fputs ("\\\\", fp); break;
case '\0': fputs ("\\0", fp); break;
case '"' : fputs ("\\\"", fp); break;
/* disabled, not portable! */
/* case '\n': fputs ("\\n", fp); break;*/
/* case '\r': fputs ("\\r", fp); break;*/
case 26 : fputs ("\\z", fp); break;
default : fputc (*s, fp); break;
}
}
fputs ("\")\n\n", fp);
}
}
void
gimp_parasiterc_load (Gimp *gimp)
{
gchar *filename;
filename = gimp_personal_rc_file ("parasiterc");
parse_gimprc_file (filename);
g_free (filename);
}
void
gimp_parasiterc_save (Gimp *gimp)
{
gchar *tmp_filename = NULL;
gchar *bak_filename = NULL;
gchar *rc_filename = NULL;
FILE *fp;
tmp_filename = gimp_personal_rc_file ("#parasiterc.tmp~");
bak_filename = gimp_personal_rc_file ("parasiterc.bak");
rc_filename = gimp_personal_rc_file ("parasiterc");
fp = fopen (tmp_filename, "w");
if (!fp)
goto cleanup;
fprintf (fp,
"# GIMP parasiterc\n"
"# This file will be entirely rewritten every time you "
"quit the gimp.\n\n");
gimp_parasite_list_foreach (gimp->parasites, (GHFunc) save_func, fp);
fclose (fp);
#if defined(G_OS_WIN32) || defined(__EMX__)
/* First rename the old parasiterc out of the way */
unlink (bak_filename);
rename (rc_filename, bak_filename);
#endif
if (rename (tmp_filename, rc_filename) != 0)
{
#if defined(G_OS_WIN32) || defined(__EMX__)
/* Rename the old parasiterc back */
rename (bak_filename, rc_filename);
#endif
unlink (tmp_filename);
}
cleanup:
g_free (tmp_filename);
g_free (bak_filename);
g_free (rc_filename);
}

View File

@ -1,39 +0,0 @@
/* 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 __APP_GIMP_PARASITE_H__
#define __APP_GIMP_PARASITE_H__
void gimp_parasites_init (Gimp *gimp);
void gimp_parasites_exit (Gimp *gimp);
void gimp_parasite_attach (Gimp *gimp,
GimpParasite *parasite);
void gimp_parasite_detach (Gimp *gimp,
const gchar *name);
GimpParasite * gimp_parasite_find (Gimp *gimp,
const gchar *name);
gchar ** gimp_parasite_list (Gimp *gimp,
gint *count);
void gimp_parasiterc_load (Gimp *gimp);
void gimp_parasiterc_save (Gimp *gimp);
#endif /* __APP_GIMP_PARASITE_H__ */

View File

@ -44,6 +44,7 @@
#include "base/base-config.c"
#include "core/gimpcoreconfig.h"
#include "core/gimpparasite.h"
#include "core/gimptoolinfo.h"
#include "tools/gimptool.h"
@ -59,7 +60,6 @@
#include "errors.h"
#include "general.h"
#include "gimphelp.h"
#include "gimpparasite.h"
#include "gimprc.h"
#include "plug_in.h"

View File

@ -39,11 +39,11 @@
#include "core/core-types.h"
#include "core/gimpcoreconfig.h"
#include "core/gimpdatafiles.h"
#include "core/gimplist.h"
#include "appenv.h"
#include "module_db.h"
#include "datafiles.h"
#include "gimprc.h"
#include "libgimp/gimpmodule.h"

View File

@ -90,6 +90,7 @@
#include "base/tile-manager.h"
#include "core/gimpcoreconfig.h"
#include "core/gimpdatafiles.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
@ -101,7 +102,6 @@
#include "app_procs.h"
#include "appenv.h"
#include "datafiles.h"
#include "errors.h"
#include "gimpprogress.h"
#include "gimprc.h"

View File

@ -90,6 +90,7 @@
#include "base/tile-manager.h"
#include "core/gimpcoreconfig.h"
#include "core/gimpdatafiles.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
@ -101,7 +102,6 @@
#include "app_procs.h"
#include "appenv.h"
#include "datafiles.h"
#include "errors.h"
#include "gimpprogress.h"
#include "gimprc.h"

View File

@ -90,6 +90,7 @@
#include "base/tile-manager.h"
#include "core/gimpcoreconfig.h"
#include "core/gimpdatafiles.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
@ -101,7 +102,6 @@
#include "app_procs.h"
#include "appenv.h"
#include "datafiles.h"
#include "errors.h"
#include "gimpprogress.h"
#include "gimprc.h"

View File

@ -39,11 +39,11 @@
#include "core/core-types.h"
#include "core/gimpcoreconfig.h"
#include "core/gimpdatafiles.h"
#include "core/gimplist.h"
#include "appenv.h"
#include "module_db.h"
#include "datafiles.h"
#include "gimprc.h"
#include "libgimp/gimpmodule.h"

View File

@ -1,288 +0,0 @@
/* 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 "config.h"
#include <string.h>
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"
#include "core/core-types.h"
#include "parasitelist.h"
enum
{
ADD,
REMOVE,
LAST_SIGNAL
};
static void gimp_parasite_list_class_init (GimpParasiteListClass *klass);
static void gimp_parasite_list_init (GimpParasiteList *list);
static void gimp_parasite_list_destroy (GtkObject *list);
static gint free_a_parasite (gpointer key,
gpointer parasite,
gpointer unused);
static guint parasite_list_signals[LAST_SIGNAL] = { 0 };
static void
gimp_parasite_list_class_init (GimpParasiteListClass *klass)
{
GtkObjectClass *object_class;
object_class = (GtkObjectClass *) klass;
parasite_list_signals[ADD] =
gtk_signal_new ("add",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpParasiteListClass,
add),
gtk_marshal_NONE__POINTER,
GTK_TYPE_NONE, 1,
GTK_TYPE_POINTER);
parasite_list_signals[REMOVE] =
gtk_signal_new ("remove",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpParasiteListClass,
remove),
gtk_marshal_NONE__POINTER,
GTK_TYPE_NONE, 1,
GTK_TYPE_POINTER);
gtk_object_class_add_signals (object_class, parasite_list_signals,
LAST_SIGNAL);
object_class->destroy = gimp_parasite_list_destroy;
klass->add = NULL;
klass->remove = NULL;
}
static void
gimp_parasite_list_init (GimpParasiteList *list)
{
list->table = NULL;
}
GtkType
gimp_parasite_list_get_type (void)
{
static GtkType type = 0;
if (! type)
{
GtkTypeInfo info =
{
"GimpParasiteList",
sizeof (GimpParasiteList),
sizeof (GimpParasiteListClass),
(GtkClassInitFunc) gimp_parasite_list_class_init,
(GtkObjectInitFunc) gimp_parasite_list_init,
NULL,
NULL,
(GtkClassInitFunc) NULL
};
type = gtk_type_unique (GIMP_TYPE_OBJECT, &info);
}
return type;
}
GimpParasiteList *
gimp_parasite_list_new (void)
{
GimpParasiteList *list = gtk_type_new (GIMP_TYPE_PARASITE_LIST);
list = gtk_type_new (GIMP_TYPE_PARASITE_LIST);
return list;
}
static gint
free_a_parasite (void *key,
void *parasite,
void *unused)
{
gimp_parasite_free ((GimpParasite *) parasite);
return TRUE;
}
static void
gimp_parasite_list_destroy (GtkObject *object)
{
GimpParasiteList *list;
g_return_if_fail (object != NULL);
g_return_if_fail (GIMP_IS_PARASITE_LIST (object));
list = GIMP_PARASITE_LIST (object);
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)
{
GimpParasiteList *list = (GimpParasiteList *) data;
GimpParasite *parasite = (GimpParasite *) p;
gimp_parasite_list_add (list, parasite);
}
GimpParasiteList *
gimp_parasite_list_copy (const GimpParasiteList *list)
{
GimpParasiteList *newlist;
newlist = gimp_parasite_list_new ();
if (list->table)
g_hash_table_foreach (list->table, parasite_copy_one, newlist);
return newlist;
}
void
gimp_parasite_list_add (GimpParasiteList *list,
GimpParasite *parasite)
{
g_return_if_fail (list != NULL);
if (list->table == NULL)
list->table = g_hash_table_new (g_str_hash, g_str_equal);
g_return_if_fail (parasite != NULL);
g_return_if_fail (parasite->name != NULL);
gimp_parasite_list_remove (list, parasite->name);
parasite = gimp_parasite_copy (parasite);
g_hash_table_insert (list->table, parasite->name, parasite);
gtk_signal_emit (GTK_OBJECT (list), parasite_list_signals[ADD], parasite);
}
void
gimp_parasite_list_remove (GimpParasiteList *list,
const gchar *name)
{
GimpParasite *parasite;
g_return_if_fail (list != NULL);
if (list->table)
{
parasite = gimp_parasite_list_find (list, name);
if (parasite)
{
g_hash_table_remove (list->table, name);
gtk_signal_emit (GTK_OBJECT (list), parasite_list_signals[REMOVE],
parasite);
gimp_parasite_free (parasite);
}
}
}
gint
gimp_parasite_list_length (GimpParasiteList *list)
{
g_return_val_if_fail (list != NULL, 0);
if (!list->table)
return 0;
return g_hash_table_size (list->table);
}
static void
ppcount_func (gchar *key,
GimpParasite *p,
gint *count)
{
if (gimp_parasite_is_persistent (p))
*count = *count + 1;
}
gint
gimp_parasite_list_persistent_length (GimpParasiteList *list)
{
gint ppcount = 0;
g_return_val_if_fail (list != NULL, 0);
if (!list->table)
return 0;
gimp_parasite_list_foreach (list, (GHFunc) ppcount_func, &ppcount);
return ppcount;
}
void
gimp_parasite_list_foreach (GimpParasiteList *list,
GHFunc function,
gpointer user_data)
{
g_return_if_fail (list != NULL);
if (!list->table)
return;
g_hash_table_foreach (list->table, function, user_data);
}
GimpParasite *
gimp_parasite_list_find (GimpParasiteList *list,
const gchar *name)
{
g_return_val_if_fail (list != NULL, NULL);
if (list->table)
return (GimpParasite *) g_hash_table_lookup (list->table, name);
else
return NULL;
}
void
gimp_parasite_shift_parent (GimpParasite *parasite)
{
if (parasite == NULL)
return;
parasite->flags = (parasite->flags >> 8);
}

View File

@ -1,70 +0,0 @@
/* 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 __GIMP_PARASITE_LIST_H__
#define __GIMP_PARASITE_LIST_H__
#include "core/gimpobject.h"
#define GIMP_TYPE_PARASITE_LIST (gimp_parasite_list_get_type ())
#define GIMP_PARASITE_LIST(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_PARASITE_LIST, GimpParasiteList))
#define GIMP_IS_PARASITE_LIST(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_PARASITE_LIST))
#define PARASITE_LIST_CLASS(class) GIMP_CHECK_CLASS_CAST (class, GIMP_TYPE_PARASITE_LIST, GimpParasiteListClass)
typedef struct _GimpParasiteListClass GimpParasiteListClass;
struct _GimpParasiteList
{
GimpObject object;
GHashTable *table;
};
struct _GimpParasiteListClass
{
GimpObjectClass parent_class;
void (* add) (GimpParasiteList *list,
GimpParasite *parasite);
void (* remove) (GimpParasiteList *list,
GimpParasite *parasite);
};
GtkType gimp_parasite_list_get_type (void);
GimpParasiteList * gimp_parasite_list_new (void);
GimpParasiteList * gimp_parasite_list_copy (const GimpParasiteList *list);
void gimp_parasite_list_add (GimpParasiteList *list,
GimpParasite *parasite);
void gimp_parasite_list_remove (GimpParasiteList *list,
const gchar *name);
gint gimp_parasite_list_length (GimpParasiteList *list);
gint gimp_parasite_list_persistent_length (GimpParasiteList *list);
void gimp_parasite_list_foreach (GimpParasiteList *list,
GHFunc function,
gpointer user_data);
GimpParasite * gimp_parasite_list_find (GimpParasiteList *list,
const gchar *name);
void gimp_parasite_shift_parent (GimpParasite *parasite);
#endif /* __GIMP_PARASITE_LIST_H__ */

View File

@ -30,7 +30,7 @@
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "gimpparasite.h"
#include "core/gimpparasite.h"
#include "libgimpbase/gimpparasite.h"

View File

@ -90,6 +90,7 @@
#include "base/tile-manager.h"
#include "core/gimpcoreconfig.h"
#include "core/gimpdatafiles.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
@ -101,7 +102,6 @@
#include "app_procs.h"
#include "appenv.h"
#include "datafiles.h"
#include "errors.h"
#include "gimpprogress.h"
#include "gimprc.h"

View File

@ -90,6 +90,7 @@
#include "base/tile-manager.h"
#include "core/gimpcoreconfig.h"
#include "core/gimpdatafiles.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
@ -101,7 +102,6 @@
#include "app_procs.h"
#include "appenv.h"
#include "datafiles.h"
#include "errors.h"
#include "gimpprogress.h"
#include "gimprc.h"

View File

@ -90,6 +90,7 @@
#include "base/tile-manager.h"
#include "core/gimpcoreconfig.h"
#include "core/gimpdatafiles.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
@ -101,7 +102,6 @@
#include "app_procs.h"
#include "appenv.h"
#include "datafiles.h"
#include "errors.h"
#include "gimpprogress.h"
#include "gimprc.h"

View File

@ -90,6 +90,7 @@
#include "base/tile-manager.h"
#include "core/gimpcoreconfig.h"
#include "core/gimpdatafiles.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
@ -101,7 +102,6 @@
#include "app_procs.h"
#include "appenv.h"
#include "datafiles.h"
#include "errors.h"
#include "gimpprogress.h"
#include "gimprc.h"

View File

@ -90,6 +90,7 @@
#include "base/tile-manager.h"
#include "core/gimpcoreconfig.h"
#include "core/gimpdatafiles.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
@ -101,7 +102,6 @@
#include "app_procs.h"
#include "appenv.h"
#include "datafiles.h"
#include "errors.h"
#include "gimpprogress.h"
#include "gimprc.h"

View File

@ -90,6 +90,7 @@
#include "base/tile-manager.h"
#include "core/gimpcoreconfig.h"
#include "core/gimpdatafiles.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
@ -101,7 +102,6 @@
#include "app_procs.h"
#include "appenv.h"
#include "datafiles.h"
#include "errors.h"
#include "gimpprogress.h"
#include "gimprc.h"

View File

@ -90,6 +90,7 @@
#include "base/tile-manager.h"
#include "core/gimpcoreconfig.h"
#include "core/gimpdatafiles.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
@ -101,7 +102,6 @@
#include "app_procs.h"
#include "appenv.h"
#include "datafiles.h"
#include "errors.h"
#include "gimpprogress.h"
#include "gimprc.h"

View File

@ -90,6 +90,7 @@
#include "base/tile-manager.h"
#include "core/gimpcoreconfig.h"
#include "core/gimpdatafiles.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
@ -101,7 +102,6 @@
#include "app_procs.h"
#include "appenv.h"
#include "datafiles.h"
#include "errors.h"
#include "gimpprogress.h"
#include "gimprc.h"

View File

@ -90,6 +90,7 @@
#include "base/tile-manager.h"
#include "core/gimpcoreconfig.h"
#include "core/gimpdatafiles.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
@ -101,7 +102,6 @@
#include "app_procs.h"
#include "appenv.h"
#include "datafiles.h"
#include "errors.h"
#include "gimpprogress.h"
#include "gimprc.h"

View File

@ -90,6 +90,7 @@
#include "base/tile-manager.h"
#include "core/gimpcoreconfig.h"
#include "core/gimpdatafiles.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
@ -101,7 +102,6 @@
#include "app_procs.h"
#include "appenv.h"
#include "datafiles.h"
#include "errors.h"
#include "gimpprogress.h"
#include "gimprc.h"

View File

@ -90,6 +90,7 @@
#include "base/tile-manager.h"
#include "core/gimpcoreconfig.h"
#include "core/gimpdatafiles.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
@ -101,7 +102,6 @@
#include "app_procs.h"
#include "appenv.h"
#include "datafiles.h"
#include "errors.h"
#include "gimpprogress.h"
#include "gimprc.h"

View File

@ -90,6 +90,7 @@
#include "base/tile-manager.h"
#include "core/gimpcoreconfig.h"
#include "core/gimpdatafiles.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
@ -101,7 +102,6 @@
#include "app_procs.h"
#include "appenv.h"
#include "datafiles.h"
#include "errors.h"
#include "gimpprogress.h"
#include "gimprc.h"

View File

@ -90,6 +90,7 @@
#include "base/tile-manager.h"
#include "core/gimpcoreconfig.h"
#include "core/gimpdatafiles.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
@ -101,7 +102,6 @@
#include "app_procs.h"
#include "appenv.h"
#include "datafiles.h"
#include "errors.h"
#include "gimpprogress.h"
#include "gimprc.h"

View File

@ -90,6 +90,7 @@
#include "base/tile-manager.h"
#include "core/gimpcoreconfig.h"
#include "core/gimpdatafiles.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
@ -101,7 +102,6 @@
#include "app_procs.h"
#include "appenv.h"
#include "datafiles.h"
#include "errors.h"
#include "gimpprogress.h"
#include "gimprc.h"

View File

@ -90,6 +90,7 @@
#include "base/tile-manager.h"
#include "core/gimpcoreconfig.h"
#include "core/gimpdatafiles.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
@ -101,7 +102,6 @@
#include "app_procs.h"
#include "appenv.h"
#include "datafiles.h"
#include "errors.h"
#include "gimpprogress.h"
#include "gimprc.h"

View File

@ -90,6 +90,7 @@
#include "base/tile-manager.h"
#include "core/gimpcoreconfig.h"
#include "core/gimpdatafiles.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
@ -101,7 +102,6 @@
#include "app_procs.h"
#include "appenv.h"
#include "datafiles.h"
#include "errors.h"
#include "gimpprogress.h"
#include "gimprc.h"

View File

@ -41,6 +41,8 @@
#include "core/gimpimage-mask.h"
#include "core/gimplayer.h"
#include "core/gimplayermask.h"
#include "core/gimpparasite.h"
#include "core/gimpparasitelist.h"
#include "tools/gimpbycolorselecttool.h"
#include "tools/gimptool.h"
@ -53,8 +55,6 @@
#include "floating_sel.h"
#include "gdisplay.h"
#include "gdisplay_ops.h"
#include "gimpparasite.h"
#include "parasitelist.h"
#include "path_transform.h"
#include "undo.h"

View File

@ -40,6 +40,7 @@
#include "core/gimpimage.h"
#include "core/gimplayer.h"
#include "core/gimplayermask.h"
#include "core/gimpparasitelist.h"
#include "xcf-private.h"
#include "xcf-load.h"
@ -47,7 +48,6 @@
#include "xcf-seek.h"
#include "floating_sel.h"
#include "parasitelist.h"
#include "path.h"
#include "pathP.h"

View File

@ -39,6 +39,7 @@
#include "core/gimplayer.h"
#include "core/gimplayermask.h"
#include "core/gimplist.h"
#include "core/gimpparasitelist.h"
#include "xcf-private.h"
#include "xcf-read.h"
@ -46,7 +47,6 @@
#include "xcf-write.h"
#include "floating_sel.h"
#include "parasitelist.h"
#include "path.h"
#include "pathP.h"

View File

@ -47,9 +47,9 @@
#include "libgimpbase/gimpbase.h"
#include "core/core-types.h"
#include "core-types.h"
#include "datafiles.h"
#include "gimpdatafiles.h"
static gboolean filestat_valid = FALSE;

View File

@ -137,7 +137,7 @@ sub parasite_list {
%invoke = ( code => 'parasites = gimp_parasite_list (gimp, &num_parasites);' );
}
@headers = qw("gimpparasite.h" "core/gimpdrawable.h");
@headers = qw("core/gimpparasite.h" "core/gimpdrawable.h");
@procs = qw(parasite_find parasite_attach parasite_detach parasite_list);