2000-02-25 00:11:26 +08:00
|
|
|
/* The GIMP -- an image manipulation program
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
2000-12-17 05:37:03 +08:00
|
|
|
|
1999-02-21 07:20:54 +08:00
|
|
|
#include "config.h"
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
#include <errno.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2001-08-17 22:27:31 +08:00
|
|
|
#include <glib-object.h>
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2004-01-19 09:54:11 +08:00
|
|
|
#include "libgimpbase/gimpbase.h"
|
|
|
|
|
2001-05-10 06:34:59 +08:00
|
|
|
#include "core/core-types.h"
|
2000-12-29 23:22:01 +08:00
|
|
|
|
removed the gimp_busy boolean, check whether user_installation is needed
2001-07-10 Michael Natterer <mitch@gimp.org>
* app/app_procs.[ch]: removed the gimp_busy boolean, check whether
user_installation is needed here, not in user_install.c, parse
gtkrc an friends only if(!no_interface), create the Gimp object
before parsing gimp's rc files an pas it to the parse functions,
many other cleanups.
* app/appenums.h: added MessageHandlerType and StackTraceMode.
* app/appenv.h: removed MessageHandlerType, declare all global
variables from main.c (no more hidden global stuff please).
* app/errors.[ch]: added the fatal message func here (from main.c),
removed the StackTraceMode enum.
* app/gimprc.[ch]: renamed functions to gimprc_*(), pass a Gimp
pointer to some functions.
* app/gimpunit.c
* app/unitrc.h: ok, this is ugly: renamed all functions to
_gimp_unit_*() and made them public. The unit list is part
of the Gimp object now, so pass a Gimp* to all functions.
* app/libgimp_glue.[ch]: added EEKy wrappers for all gimp_unit_*()
functions which are used by widgets.
* app/main.c: cleaned up the global variables, removed the fatal
message handler, call app_init() directly, not via the
user_install stuff, misc. cleanups.
* app/user_install.[ch]: removed the check if user_installation is
needed (done by app_procs.c now).
* app/core/gimp.[ch]: added the user_unit list and the "busy"
boolean. Moved gimp_[set|unset]_busy() here. Added
gimp_initialize() which is called after unitrc and gimprc are
parsed.
* app/batch.c
* app/colormaps.c
* app/devices.c
* app/disp_callbacks.c
* app/gdisplay_ops.c
* app/gimphelp.c
* app/module_db.c
* app/nav_window.c
* app/plug_in.c
* app/core/gimpcontext.c
* app/core/gimpdatafiles.c
* app/core/gimpimage-convert.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage.c
* app/core/gimpparasite.c
* app/core/gimpparasitelist.h
* app/gui/file-open-dialog.c
* app/gui/gui.[ch]
* app/gui/info-dialog.c
* app/gui/info-window.c
* app/gui/preferences-dialog.c
* app/gui/session.c
* app/gui/tips-dialog.c
* app/gui/toolbox.c
* app/tools/gimpblendtool.c
* app/tools/gimpbucketfilltool.c
* app/tools/gimpcolorpickertool.c
* app/tools/gimpfuzzyselecttool.c
* app/tools/gimptransformtool.c
* app/tools/tool_manager.c
* app/widgets/gimpcolorpanel.c
* app/widgets/gimpcursor.c
* app/xcf/xcf-load.c
* app/xcf/xcf-save.c
* app/xcf/xcf.c
* tools/pdbgen/Makefile.am
* tools/pdbgen/app.pl
* tools/pdbgen/enums.pl
* tools/pdbgen/pdb/image.pdb
* tools/pdbgen/pdb/message.pdb
* tools/pdbgen/pdb/unit.pdb
* app/pdb/image_cmds.c
* app/pdb/message_cmds.c
* app/pdb/unit_cmds.c: changed accordingly, minor cleanups.
2001-07-11 03:16:16 +08:00
|
|
|
#include "core/gimp.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "core/gimpimage.h"
|
2001-07-04 02:38:56 +08:00
|
|
|
|
2001-12-01 08:14:14 +08:00
|
|
|
#include "pdb/procedural_db.h"
|
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
#include "plug-in/plug-ins.h"
|
2001-12-19 08:13:16 +08:00
|
|
|
#include "plug-in/plug-in-proc.h"
|
2001-12-01 08:14:14 +08:00
|
|
|
|
2001-07-04 02:38:56 +08:00
|
|
|
#include "xcf.h"
|
|
|
|
#include "xcf-private.h"
|
|
|
|
#include "xcf-load.h"
|
|
|
|
#include "xcf-read.h"
|
|
|
|
#include "xcf-save.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
|
2003-03-26 00:38:19 +08:00
|
|
|
#include "gimp-intl.h"
|
2000-04-28 01:27:28 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-07-05 03:31:35 +08:00
|
|
|
typedef GimpImage * GimpXcfLoaderFunc (Gimp *gimp,
|
|
|
|
XcfInfo *info);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
|
2004-04-15 22:58:42 +08:00
|
|
|
static Argument * xcf_load_invoker (Gimp *gimp,
|
|
|
|
GimpContext *context,
|
|
|
|
Argument *args);
|
|
|
|
static Argument * xcf_save_invoker (Gimp *gimp,
|
|
|
|
GimpContext *context,
|
|
|
|
Argument *args);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
|
|
|
|
static ProcArg xcf_load_args[] =
|
|
|
|
{
|
2001-05-21 21:58:46 +08:00
|
|
|
{ GIMP_PDB_INT32,
|
1997-11-25 06:05:25 +08:00
|
|
|
"dummy_param",
|
1998-12-16 08:37:09 +08:00
|
|
|
"dummy parameter" },
|
2001-05-21 21:58:46 +08:00
|
|
|
{ GIMP_PDB_STRING,
|
1997-11-25 06:05:25 +08:00
|
|
|
"filename",
|
2003-09-10 12:07:53 +08:00
|
|
|
"The name of the file to load, in the on-disk character set and encoding" },
|
2001-05-21 21:58:46 +08:00
|
|
|
{ GIMP_PDB_STRING,
|
1997-11-25 06:05:25 +08:00
|
|
|
"raw_filename",
|
2004-05-19 05:19:43 +08:00
|
|
|
"The basename of the file, in UTF-8" }
|
1997-11-25 06:05:25 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static ProcArg xcf_load_return_vals[] =
|
|
|
|
{
|
2001-05-21 21:58:46 +08:00
|
|
|
{ GIMP_PDB_IMAGE,
|
1997-11-25 06:05:25 +08:00
|
|
|
"image",
|
2004-05-19 05:19:43 +08:00
|
|
|
"Output image" }
|
1997-11-25 06:05:25 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static PlugInProcDef xcf_plug_in_load_proc =
|
|
|
|
{
|
|
|
|
"gimp_xcf_load",
|
2004-05-14 08:01:11 +08:00
|
|
|
N_("GIMP XCF image"),
|
2004-05-06 21:51:56 +08:00
|
|
|
NULL,
|
2004-05-19 05:19:43 +08:00
|
|
|
GIMP_ICON_TYPE_STOCK_ID,
|
|
|
|
-1,
|
|
|
|
"gimp-wilber",
|
1997-11-25 06:05:25 +08:00
|
|
|
NULL, /* ignored for load */
|
|
|
|
0, /* ignored for load */
|
2004-05-19 05:19:43 +08:00
|
|
|
0,
|
|
|
|
FALSE,
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
"gimp_xcf_load",
|
1998-12-16 08:37:09 +08:00
|
|
|
"loads file saved in the .xcf file format",
|
2004-05-19 05:19:43 +08:00
|
|
|
"The xcf file format has been designed specifically for loading and "
|
|
|
|
"saving tiled and layered images in the GIMP. This procedure will load "
|
|
|
|
"the specified file.",
|
1998-12-16 08:37:09 +08:00
|
|
|
"Spencer Kimball & Peter Mattis",
|
|
|
|
"Spencer Kimball & Peter Mattis",
|
1997-11-25 06:05:25 +08:00
|
|
|
"1995-1996",
|
2001-05-21 21:58:46 +08:00
|
|
|
GIMP_INTERNAL,
|
1997-11-25 06:05:25 +08:00
|
|
|
3,
|
|
|
|
xcf_load_args,
|
|
|
|
1,
|
|
|
|
xcf_load_return_vals,
|
|
|
|
{ { xcf_load_invoker } },
|
|
|
|
},
|
2004-05-19 05:19:43 +08:00
|
|
|
"xcf",
|
|
|
|
"",
|
|
|
|
"0,string,gimp\\040xcf\\040",
|
|
|
|
"image/x-xcf",
|
1997-11-25 06:05:25 +08:00
|
|
|
NULL, /* fill me in at runtime */
|
2001-12-28 01:58:30 +08:00
|
|
|
NULL, /* fill me in at runtime */
|
2004-05-19 05:19:43 +08:00
|
|
|
NULL /* fill me in at runtime */
|
1997-11-25 06:05:25 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static ProcArg xcf_save_args[] =
|
|
|
|
{
|
2001-05-21 21:58:46 +08:00
|
|
|
{ GIMP_PDB_INT32,
|
1997-11-25 06:05:25 +08:00
|
|
|
"dummy_param",
|
1998-12-16 08:37:09 +08:00
|
|
|
"dummy parameter" },
|
2001-05-21 21:58:46 +08:00
|
|
|
{ GIMP_PDB_IMAGE,
|
1997-11-25 06:05:25 +08:00
|
|
|
"image",
|
1998-12-16 08:37:09 +08:00
|
|
|
"Input image" },
|
2001-05-21 21:58:46 +08:00
|
|
|
{ GIMP_PDB_DRAWABLE,
|
1997-11-25 06:05:25 +08:00
|
|
|
"drawable",
|
1998-12-16 08:37:09 +08:00
|
|
|
"Active drawable of input image" },
|
2001-05-21 21:58:46 +08:00
|
|
|
{ GIMP_PDB_STRING,
|
1997-11-25 06:05:25 +08:00
|
|
|
"filename",
|
2003-09-10 12:07:53 +08:00
|
|
|
"The name of the file to save the image in, in the on-disk character set and encoding" },
|
2001-05-21 21:58:46 +08:00
|
|
|
{ GIMP_PDB_STRING,
|
1997-11-25 06:05:25 +08:00
|
|
|
"raw_filename",
|
2004-05-19 05:19:43 +08:00
|
|
|
"The basename of the file, in UTF-8" }
|
1997-11-25 06:05:25 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static PlugInProcDef xcf_plug_in_save_proc =
|
|
|
|
{
|
|
|
|
"gimp_xcf_save",
|
2004-05-14 08:01:11 +08:00
|
|
|
N_("GIMP XCF image"),
|
2004-05-06 21:51:56 +08:00
|
|
|
NULL,
|
2004-05-19 05:19:43 +08:00
|
|
|
GIMP_ICON_TYPE_STOCK_ID,
|
|
|
|
-1,
|
|
|
|
"gimp-wilber",
|
1997-11-25 06:05:25 +08:00
|
|
|
"RGB*, GRAY*, INDEXED*",
|
|
|
|
0, /* fill me in at runtime */
|
2004-05-19 05:19:43 +08:00
|
|
|
0,
|
|
|
|
FALSE,
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
"gimp_xcf_save",
|
1998-12-16 08:37:09 +08:00
|
|
|
"saves file in the .xcf file format",
|
2004-05-19 05:19:43 +08:00
|
|
|
"The xcf file format has been designed specifically for loading and "
|
|
|
|
"saving tiled and layered images in the GIMP. This procedure will save "
|
|
|
|
"the specified image in the xcf file format.",
|
1998-12-16 08:37:09 +08:00
|
|
|
"Spencer Kimball & Peter Mattis",
|
|
|
|
"Spencer Kimball & Peter Mattis",
|
1997-11-25 06:05:25 +08:00
|
|
|
"1995-1996",
|
2001-05-21 21:58:46 +08:00
|
|
|
GIMP_INTERNAL,
|
1997-11-25 06:05:25 +08:00
|
|
|
5,
|
|
|
|
xcf_save_args,
|
|
|
|
0,
|
|
|
|
NULL,
|
|
|
|
{ { xcf_save_invoker } },
|
|
|
|
},
|
2004-05-19 05:19:43 +08:00
|
|
|
"xcf",
|
|
|
|
"",
|
|
|
|
NULL,
|
|
|
|
"image/x-xcf",
|
1997-11-25 06:05:25 +08:00
|
|
|
NULL, /* fill me in at runtime */
|
2001-12-28 01:58:30 +08:00
|
|
|
NULL, /* fill me in at runtime */
|
2004-05-19 05:19:43 +08:00
|
|
|
NULL /* fill me in at runtime */
|
1997-11-25 06:05:25 +08:00
|
|
|
};
|
|
|
|
|
2001-07-04 02:38:56 +08:00
|
|
|
|
|
|
|
static GimpXcfLoaderFunc *xcf_loaders[] =
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2002-12-20 20:56:11 +08:00
|
|
|
xcf_load_image, /* version 0 */
|
2002-11-06 18:07:31 +08:00
|
|
|
xcf_load_image, /* version 1 */
|
|
|
|
xcf_load_image /* version 2 */
|
1997-11-25 06:05:25 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2001-07-05 03:31:35 +08:00
|
|
|
xcf_init (Gimp *gimp)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-10-19 01:27:36 +08:00
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
|
2004-07-17 06:54:53 +08:00
|
|
|
/* So this is sort of a hack, but its better than it was before. To
|
|
|
|
* do this right there would be a file load-save handler type and
|
|
|
|
* the whole interface would change but there isn't, and currently
|
|
|
|
* the plug-in structure contains all the load-save info, so it
|
|
|
|
* makes sense to use that for the XCF load/save handlers, even
|
|
|
|
* though they are internal. The only thing it requires is using a
|
|
|
|
* PlugInProcDef struct. -josh
|
2001-07-04 02:38:56 +08:00
|
|
|
*/
|
2001-07-05 03:31:35 +08:00
|
|
|
procedural_db_register (gimp, &xcf_plug_in_save_proc.db_info);
|
2004-07-17 06:54:53 +08:00
|
|
|
xcf_plug_in_save_proc.menu_paths = g_list_append (NULL, "<Save>");
|
2001-07-04 02:38:56 +08:00
|
|
|
xcf_plug_in_save_proc.image_types_val =
|
2002-03-21 01:46:13 +08:00
|
|
|
plug_ins_image_types_parse (xcf_plug_in_save_proc.image_types);
|
2004-07-17 06:54:53 +08:00
|
|
|
plug_ins_add_internal (gimp, &xcf_plug_in_save_proc);
|
|
|
|
|
|
|
|
procedural_db_register (gimp, &xcf_plug_in_load_proc.db_info);
|
|
|
|
xcf_plug_in_load_proc.menu_paths = g_list_append (NULL, "<Load>");
|
2001-07-04 02:38:56 +08:00
|
|
|
xcf_plug_in_load_proc.image_types_val =
|
2002-03-21 01:46:13 +08:00
|
|
|
plug_ins_image_types_parse (xcf_plug_in_load_proc.image_types);
|
2003-02-11 20:07:31 +08:00
|
|
|
plug_ins_add_internal (gimp, &xcf_plug_in_load_proc);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2001-07-04 02:38:56 +08:00
|
|
|
void
|
2001-10-19 01:27:36 +08:00
|
|
|
xcf_exit (Gimp *gimp)
|
2001-07-04 02:38:56 +08:00
|
|
|
{
|
2001-10-19 01:27:36 +08:00
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
2001-07-04 02:38:56 +08:00
|
|
|
}
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
static Argument*
|
2004-04-15 22:58:42 +08:00
|
|
|
xcf_load_invoker (Gimp *gimp,
|
|
|
|
GimpContext *context,
|
|
|
|
Argument *args)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-03-08 10:01:52 +08:00
|
|
|
XcfInfo info;
|
|
|
|
Argument *return_args;
|
|
|
|
GimpImage *gimage;
|
|
|
|
gchar *filename;
|
|
|
|
gboolean success;
|
|
|
|
gchar id[14];
|
1997-11-25 06:05:25 +08:00
|
|
|
|
removed the gimp_busy boolean, check whether user_installation is needed
2001-07-10 Michael Natterer <mitch@gimp.org>
* app/app_procs.[ch]: removed the gimp_busy boolean, check whether
user_installation is needed here, not in user_install.c, parse
gtkrc an friends only if(!no_interface), create the Gimp object
before parsing gimp's rc files an pas it to the parse functions,
many other cleanups.
* app/appenums.h: added MessageHandlerType and StackTraceMode.
* app/appenv.h: removed MessageHandlerType, declare all global
variables from main.c (no more hidden global stuff please).
* app/errors.[ch]: added the fatal message func here (from main.c),
removed the StackTraceMode enum.
* app/gimprc.[ch]: renamed functions to gimprc_*(), pass a Gimp
pointer to some functions.
* app/gimpunit.c
* app/unitrc.h: ok, this is ugly: renamed all functions to
_gimp_unit_*() and made them public. The unit list is part
of the Gimp object now, so pass a Gimp* to all functions.
* app/libgimp_glue.[ch]: added EEKy wrappers for all gimp_unit_*()
functions which are used by widgets.
* app/main.c: cleaned up the global variables, removed the fatal
message handler, call app_init() directly, not via the
user_install stuff, misc. cleanups.
* app/user_install.[ch]: removed the check if user_installation is
needed (done by app_procs.c now).
* app/core/gimp.[ch]: added the user_unit list and the "busy"
boolean. Moved gimp_[set|unset]_busy() here. Added
gimp_initialize() which is called after unitrc and gimprc are
parsed.
* app/batch.c
* app/colormaps.c
* app/devices.c
* app/disp_callbacks.c
* app/gdisplay_ops.c
* app/gimphelp.c
* app/module_db.c
* app/nav_window.c
* app/plug_in.c
* app/core/gimpcontext.c
* app/core/gimpdatafiles.c
* app/core/gimpimage-convert.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage.c
* app/core/gimpparasite.c
* app/core/gimpparasitelist.h
* app/gui/file-open-dialog.c
* app/gui/gui.[ch]
* app/gui/info-dialog.c
* app/gui/info-window.c
* app/gui/preferences-dialog.c
* app/gui/session.c
* app/gui/tips-dialog.c
* app/gui/toolbox.c
* app/tools/gimpblendtool.c
* app/tools/gimpbucketfilltool.c
* app/tools/gimpcolorpickertool.c
* app/tools/gimpfuzzyselecttool.c
* app/tools/gimptransformtool.c
* app/tools/tool_manager.c
* app/widgets/gimpcolorpanel.c
* app/widgets/gimpcursor.c
* app/xcf/xcf-load.c
* app/xcf/xcf-save.c
* app/xcf/xcf.c
* tools/pdbgen/Makefile.am
* tools/pdbgen/app.pl
* tools/pdbgen/enums.pl
* tools/pdbgen/pdb/image.pdb
* tools/pdbgen/pdb/message.pdb
* tools/pdbgen/pdb/unit.pdb
* app/pdb/image_cmds.c
* app/pdb/message_cmds.c
* app/pdb/unit_cmds.c: changed accordingly, minor cleanups.
2001-07-11 03:16:16 +08:00
|
|
|
gimp_set_busy (gimp);
|
1999-01-11 07:36:29 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
gimage = NULL;
|
|
|
|
|
|
|
|
success = FALSE;
|
|
|
|
|
|
|
|
filename = args[1].value.pdb_pointer;
|
|
|
|
|
1998-05-30 03:42:32 +08:00
|
|
|
info.fp = fopen (filename, "rb");
|
2001-07-04 02:38:56 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
if (info.fp)
|
|
|
|
{
|
2001-07-04 02:38:56 +08:00
|
|
|
info.cp = 0;
|
|
|
|
info.filename = filename;
|
2003-12-06 23:53:26 +08:00
|
|
|
info.tattoo_state = 0;
|
2001-07-04 02:38:56 +08:00
|
|
|
info.active_layer = NULL;
|
|
|
|
info.active_channel = NULL;
|
1998-01-22 15:02:57 +08:00
|
|
|
info.floating_sel_drawable = NULL;
|
2001-07-04 02:38:56 +08:00
|
|
|
info.floating_sel = NULL;
|
|
|
|
info.floating_sel_offset = 0;
|
|
|
|
info.swap_num = 0;
|
|
|
|
info.ref_count = NULL;
|
|
|
|
info.compression = COMPRESS_NONE;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
success = TRUE;
|
2001-07-04 02:38:56 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
info.cp += xcf_read_int8 (info.fp, (guint8*) id, 14);
|
2001-07-04 02:38:56 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
if (strncmp (id, "gimp xcf ", 9) != 0)
|
2001-07-04 02:38:56 +08:00
|
|
|
{
|
|
|
|
success = FALSE;
|
|
|
|
}
|
2003-09-10 18:40:57 +08:00
|
|
|
else if (strcmp (id+9, "file") == 0)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
info.file_version = 0;
|
2003-09-10 18:40:57 +08:00
|
|
|
}
|
|
|
|
else if (id[9] == 'v')
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
info.file_version = atoi(id + 10);
|
|
|
|
}
|
2001-07-04 02:38:56 +08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
success = FALSE;
|
|
|
|
}
|
2003-09-10 18:40:57 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
if (success)
|
|
|
|
{
|
2002-12-20 20:56:11 +08:00
|
|
|
if (info.file_version < G_N_ELEMENTS (xcf_loaders))
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-07-05 03:31:35 +08:00
|
|
|
gimage = (*(xcf_loaders[info.file_version])) (gimp, &info);
|
2001-07-04 02:38:56 +08:00
|
|
|
|
|
|
|
if (! gimage)
|
1998-04-13 17:17:27 +08:00
|
|
|
success = FALSE;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2003-09-10 18:40:57 +08:00
|
|
|
else
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-07-04 02:38:56 +08:00
|
|
|
g_message (_("XCF error: unsupported XCF file version %d "
|
|
|
|
"encountered"), info.file_version);
|
1997-11-25 06:05:25 +08:00
|
|
|
success = FALSE;
|
|
|
|
}
|
|
|
|
}
|
2001-07-04 02:38:56 +08:00
|
|
|
|
1997-12-17 01:26:00 +08:00
|
|
|
fclose (info.fp);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2003-11-14 23:33:40 +08:00
|
|
|
else
|
2004-01-14 10:03:37 +08:00
|
|
|
g_message (_("Could not open '%s' for reading: %s"),
|
2004-01-19 09:08:43 +08:00
|
|
|
gimp_filename_to_utf8 (filename), g_strerror (errno));
|
2003-09-10 18:40:57 +08:00
|
|
|
|
2001-07-04 02:38:56 +08:00
|
|
|
return_args = procedural_db_return_args (&xcf_plug_in_load_proc.db_info,
|
|
|
|
success);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
if (success)
|
2001-04-13 22:50:43 +08:00
|
|
|
return_args[1].value.pdb_int = gimp_image_get_ID (gimage);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
removed the gimp_busy boolean, check whether user_installation is needed
2001-07-10 Michael Natterer <mitch@gimp.org>
* app/app_procs.[ch]: removed the gimp_busy boolean, check whether
user_installation is needed here, not in user_install.c, parse
gtkrc an friends only if(!no_interface), create the Gimp object
before parsing gimp's rc files an pas it to the parse functions,
many other cleanups.
* app/appenums.h: added MessageHandlerType and StackTraceMode.
* app/appenv.h: removed MessageHandlerType, declare all global
variables from main.c (no more hidden global stuff please).
* app/errors.[ch]: added the fatal message func here (from main.c),
removed the StackTraceMode enum.
* app/gimprc.[ch]: renamed functions to gimprc_*(), pass a Gimp
pointer to some functions.
* app/gimpunit.c
* app/unitrc.h: ok, this is ugly: renamed all functions to
_gimp_unit_*() and made them public. The unit list is part
of the Gimp object now, so pass a Gimp* to all functions.
* app/libgimp_glue.[ch]: added EEKy wrappers for all gimp_unit_*()
functions which are used by widgets.
* app/main.c: cleaned up the global variables, removed the fatal
message handler, call app_init() directly, not via the
user_install stuff, misc. cleanups.
* app/user_install.[ch]: removed the check if user_installation is
needed (done by app_procs.c now).
* app/core/gimp.[ch]: added the user_unit list and the "busy"
boolean. Moved gimp_[set|unset]_busy() here. Added
gimp_initialize() which is called after unitrc and gimprc are
parsed.
* app/batch.c
* app/colormaps.c
* app/devices.c
* app/disp_callbacks.c
* app/gdisplay_ops.c
* app/gimphelp.c
* app/module_db.c
* app/nav_window.c
* app/plug_in.c
* app/core/gimpcontext.c
* app/core/gimpdatafiles.c
* app/core/gimpimage-convert.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage.c
* app/core/gimpparasite.c
* app/core/gimpparasitelist.h
* app/gui/file-open-dialog.c
* app/gui/gui.[ch]
* app/gui/info-dialog.c
* app/gui/info-window.c
* app/gui/preferences-dialog.c
* app/gui/session.c
* app/gui/tips-dialog.c
* app/gui/toolbox.c
* app/tools/gimpblendtool.c
* app/tools/gimpbucketfilltool.c
* app/tools/gimpcolorpickertool.c
* app/tools/gimpfuzzyselecttool.c
* app/tools/gimptransformtool.c
* app/tools/tool_manager.c
* app/widgets/gimpcolorpanel.c
* app/widgets/gimpcursor.c
* app/xcf/xcf-load.c
* app/xcf/xcf-save.c
* app/xcf/xcf.c
* tools/pdbgen/Makefile.am
* tools/pdbgen/app.pl
* tools/pdbgen/enums.pl
* tools/pdbgen/pdb/image.pdb
* tools/pdbgen/pdb/message.pdb
* tools/pdbgen/pdb/unit.pdb
* app/pdb/image_cmds.c
* app/pdb/message_cmds.c
* app/pdb/unit_cmds.c: changed accordingly, minor cleanups.
2001-07-11 03:16:16 +08:00
|
|
|
gimp_unset_busy (gimp);
|
1999-01-11 07:36:29 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
return return_args;
|
|
|
|
}
|
|
|
|
|
2001-03-08 10:01:52 +08:00
|
|
|
static Argument *
|
2004-04-15 22:58:42 +08:00
|
|
|
xcf_save_invoker (Gimp *gimp,
|
|
|
|
GimpContext *context,
|
|
|
|
Argument *args)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-03-08 10:01:52 +08:00
|
|
|
XcfInfo info;
|
|
|
|
Argument *return_args;
|
|
|
|
GimpImage *gimage;
|
|
|
|
gchar *filename;
|
|
|
|
gboolean success;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
removed the gimp_busy boolean, check whether user_installation is needed
2001-07-10 Michael Natterer <mitch@gimp.org>
* app/app_procs.[ch]: removed the gimp_busy boolean, check whether
user_installation is needed here, not in user_install.c, parse
gtkrc an friends only if(!no_interface), create the Gimp object
before parsing gimp's rc files an pas it to the parse functions,
many other cleanups.
* app/appenums.h: added MessageHandlerType and StackTraceMode.
* app/appenv.h: removed MessageHandlerType, declare all global
variables from main.c (no more hidden global stuff please).
* app/errors.[ch]: added the fatal message func here (from main.c),
removed the StackTraceMode enum.
* app/gimprc.[ch]: renamed functions to gimprc_*(), pass a Gimp
pointer to some functions.
* app/gimpunit.c
* app/unitrc.h: ok, this is ugly: renamed all functions to
_gimp_unit_*() and made them public. The unit list is part
of the Gimp object now, so pass a Gimp* to all functions.
* app/libgimp_glue.[ch]: added EEKy wrappers for all gimp_unit_*()
functions which are used by widgets.
* app/main.c: cleaned up the global variables, removed the fatal
message handler, call app_init() directly, not via the
user_install stuff, misc. cleanups.
* app/user_install.[ch]: removed the check if user_installation is
needed (done by app_procs.c now).
* app/core/gimp.[ch]: added the user_unit list and the "busy"
boolean. Moved gimp_[set|unset]_busy() here. Added
gimp_initialize() which is called after unitrc and gimprc are
parsed.
* app/batch.c
* app/colormaps.c
* app/devices.c
* app/disp_callbacks.c
* app/gdisplay_ops.c
* app/gimphelp.c
* app/module_db.c
* app/nav_window.c
* app/plug_in.c
* app/core/gimpcontext.c
* app/core/gimpdatafiles.c
* app/core/gimpimage-convert.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage.c
* app/core/gimpparasite.c
* app/core/gimpparasitelist.h
* app/gui/file-open-dialog.c
* app/gui/gui.[ch]
* app/gui/info-dialog.c
* app/gui/info-window.c
* app/gui/preferences-dialog.c
* app/gui/session.c
* app/gui/tips-dialog.c
* app/gui/toolbox.c
* app/tools/gimpblendtool.c
* app/tools/gimpbucketfilltool.c
* app/tools/gimpcolorpickertool.c
* app/tools/gimpfuzzyselecttool.c
* app/tools/gimptransformtool.c
* app/tools/tool_manager.c
* app/widgets/gimpcolorpanel.c
* app/widgets/gimpcursor.c
* app/xcf/xcf-load.c
* app/xcf/xcf-save.c
* app/xcf/xcf.c
* tools/pdbgen/Makefile.am
* tools/pdbgen/app.pl
* tools/pdbgen/enums.pl
* tools/pdbgen/pdb/image.pdb
* tools/pdbgen/pdb/message.pdb
* tools/pdbgen/pdb/unit.pdb
* app/pdb/image_cmds.c
* app/pdb/message_cmds.c
* app/pdb/unit_cmds.c: changed accordingly, minor cleanups.
2001-07-11 03:16:16 +08:00
|
|
|
gimp_set_busy (gimp);
|
1999-01-11 07:36:29 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
success = FALSE;
|
|
|
|
|
2001-07-11 20:39:49 +08:00
|
|
|
gimage = gimp_image_get_by_ID (gimp, args[1].value.pdb_int);
|
1997-11-25 06:05:25 +08:00
|
|
|
filename = args[3].value.pdb_pointer;
|
|
|
|
|
1998-05-30 03:42:32 +08:00
|
|
|
info.fp = fopen (filename, "wb");
|
2001-07-04 02:38:56 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
if (info.fp)
|
|
|
|
{
|
2001-07-04 02:38:56 +08:00
|
|
|
info.cp = 0;
|
|
|
|
info.filename = filename;
|
|
|
|
info.active_layer = NULL;
|
|
|
|
info.active_channel = NULL;
|
1998-01-22 15:02:57 +08:00
|
|
|
info.floating_sel_drawable = NULL;
|
2001-07-04 02:38:56 +08:00
|
|
|
info.floating_sel = NULL;
|
|
|
|
info.floating_sel_offset = 0;
|
|
|
|
info.swap_num = 0;
|
|
|
|
info.ref_count = NULL;
|
|
|
|
info.compression = COMPRESS_RLE;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
xcf_save_choose_format (&info, gimage);
|
|
|
|
|
|
|
|
success = xcf_save_image (&info, gimage);
|
2002-12-20 14:26:34 +08:00
|
|
|
if (fclose (info.fp) == EOF)
|
|
|
|
{
|
|
|
|
g_message (_("Error saving XCF file: %s"), g_strerror (errno));
|
|
|
|
|
|
|
|
success = FALSE;
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
else
|
2004-01-14 10:03:37 +08:00
|
|
|
g_message (_("Could not open '%s' for writing: %s"),
|
2004-01-19 09:08:43 +08:00
|
|
|
gimp_filename_to_utf8 (filename), g_strerror (errno));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-07-04 02:38:56 +08:00
|
|
|
return_args = procedural_db_return_args (&xcf_plug_in_save_proc.db_info,
|
|
|
|
success);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
removed the gimp_busy boolean, check whether user_installation is needed
2001-07-10 Michael Natterer <mitch@gimp.org>
* app/app_procs.[ch]: removed the gimp_busy boolean, check whether
user_installation is needed here, not in user_install.c, parse
gtkrc an friends only if(!no_interface), create the Gimp object
before parsing gimp's rc files an pas it to the parse functions,
many other cleanups.
* app/appenums.h: added MessageHandlerType and StackTraceMode.
* app/appenv.h: removed MessageHandlerType, declare all global
variables from main.c (no more hidden global stuff please).
* app/errors.[ch]: added the fatal message func here (from main.c),
removed the StackTraceMode enum.
* app/gimprc.[ch]: renamed functions to gimprc_*(), pass a Gimp
pointer to some functions.
* app/gimpunit.c
* app/unitrc.h: ok, this is ugly: renamed all functions to
_gimp_unit_*() and made them public. The unit list is part
of the Gimp object now, so pass a Gimp* to all functions.
* app/libgimp_glue.[ch]: added EEKy wrappers for all gimp_unit_*()
functions which are used by widgets.
* app/main.c: cleaned up the global variables, removed the fatal
message handler, call app_init() directly, not via the
user_install stuff, misc. cleanups.
* app/user_install.[ch]: removed the check if user_installation is
needed (done by app_procs.c now).
* app/core/gimp.[ch]: added the user_unit list and the "busy"
boolean. Moved gimp_[set|unset]_busy() here. Added
gimp_initialize() which is called after unitrc and gimprc are
parsed.
* app/batch.c
* app/colormaps.c
* app/devices.c
* app/disp_callbacks.c
* app/gdisplay_ops.c
* app/gimphelp.c
* app/module_db.c
* app/nav_window.c
* app/plug_in.c
* app/core/gimpcontext.c
* app/core/gimpdatafiles.c
* app/core/gimpimage-convert.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage.c
* app/core/gimpparasite.c
* app/core/gimpparasitelist.h
* app/gui/file-open-dialog.c
* app/gui/gui.[ch]
* app/gui/info-dialog.c
* app/gui/info-window.c
* app/gui/preferences-dialog.c
* app/gui/session.c
* app/gui/tips-dialog.c
* app/gui/toolbox.c
* app/tools/gimpblendtool.c
* app/tools/gimpbucketfilltool.c
* app/tools/gimpcolorpickertool.c
* app/tools/gimpfuzzyselecttool.c
* app/tools/gimptransformtool.c
* app/tools/tool_manager.c
* app/widgets/gimpcolorpanel.c
* app/widgets/gimpcursor.c
* app/xcf/xcf-load.c
* app/xcf/xcf-save.c
* app/xcf/xcf.c
* tools/pdbgen/Makefile.am
* tools/pdbgen/app.pl
* tools/pdbgen/enums.pl
* tools/pdbgen/pdb/image.pdb
* tools/pdbgen/pdb/message.pdb
* tools/pdbgen/pdb/unit.pdb
* app/pdb/image_cmds.c
* app/pdb/message_cmds.c
* app/pdb/unit_cmds.c: changed accordingly, minor cleanups.
2001-07-11 03:16:16 +08:00
|
|
|
gimp_unset_busy (gimp);
|
1999-01-11 07:36:29 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
return return_args;
|
|
|
|
}
|