new directory app/xcf/

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

	* configure.in: new directory app/xcf/

	* app/Makefile.am
	* app/global_edit.[ch]
	* app/xcf.[ch]: removed.

	* app/core/Makefile.am
	* app/core/gimpedit.[ch]: added here...

	* app/xcf/.cvsignore
	* app/xcf/Makefile.am
	* app/xcf/xcf-load.[ch]
	* app/xcf/xcf-private.h
	* app/xcf/xcf-read.[ch]
	* app/xcf/xcf-save.[ch]
	* app/xcf/xcf-seek.[ch]
	* app/xcf/xcf-write.[ch]
	* app/xcf/xcf.[ch]: ...and here (chopped up).

	* app/app_procs.c
	* app/disp_callbacks.c
	* app/floating_sel.c
	* app/gui/edit-commands.c
	* app/gui/toolbox.c
	* app/pdb/edit_cmds.c
	* app/widgets/gimpbufferview.c
	* tools/pdbgen/pdb/edit.pdb: changed accordingly.
This commit is contained in:
Michael Natterer 2001-07-03 18:38:56 +00:00 committed by Michael Natterer
parent 1b8ef8b50e
commit 3e36b8f54b
38 changed files with 3290 additions and 6422 deletions

View File

@ -1,3 +1,33 @@
2001-07-03 Michael Natterer <mitch@gimp.org>
* configure.in: new directory app/xcf/
* app/Makefile.am
* app/global_edit.[ch]
* app/xcf.[ch]: removed.
* app/core/Makefile.am
* app/core/gimpedit.[ch]: added here...
* app/xcf/.cvsignore
* app/xcf/Makefile.am
* app/xcf/xcf-load.[ch]
* app/xcf/xcf-private.h
* app/xcf/xcf-read.[ch]
* app/xcf/xcf-save.[ch]
* app/xcf/xcf-seek.[ch]
* app/xcf/xcf-write.[ch]
* app/xcf/xcf.[ch]: ...and here (chopped up).
* app/app_procs.c
* app/disp_callbacks.c
* app/floating_sel.c
* app/gui/edit-commands.c
* app/gui/toolbox.c
* app/pdb/edit_cmds.c
* app/widgets/gimpbufferview.c
* tools/pdbgen/pdb/edit.pdb: changed accordingly.
2001-07-03 Sven Neumann <sven@gimp.org>
* plug-ins/common/xwd.c: applied patch from Peter Kirchgessner

View File

@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in
SUBDIRS = paint-funcs base core pdb tools widgets gui
SUBDIRS = paint-funcs base core pdb xcf tools widgets gui
scriptdata =
@ -70,8 +70,6 @@ gimp_SOURCES = @STRIP_BEGIN@ \
##
## stuff that needs to be split up in core / ui files
##
global_edit.c \
global_edit.h \
image_map.c \
image_map.h \
module_db.c \
@ -81,51 +79,49 @@ gimp_SOURCES = @STRIP_BEGIN@ \
##
## stuff for core/
##
datafiles.c \
datafiles.h \
floating_sel.c \
floating_sel.h \
parasitelist.c \
parasitelist.h \
##
## stuff that needs to be sorted into yet undecided subsystems, split up,
## removed or otherwise tortured
##
app_procs.c \
app_procs.h \
appenums.h \
appenv.h \
apptypes.h \
batch.c \
batch.h \
context_manager.c \
context_manager.h \
datafiles.c \
datafiles.h \
drawable.c \
drawable.h \
errors.c \
errors.h \
floating_sel.c \
floating_sel.h \
gimage.c \
gimage.h \
gimpparasite.c \
gimpparasite.h \
gimpunit.c \
image_new.c \
image_new.h \
parasitelist.c \
parasitelist.h \
unitrc.h \
##
## config stuff
##
appenv.h \
general.c \
general.h \
gimprc.c \
gimprc.h \
##
## file load/save stuff
##
file-open.c \
file-open.h \
file-save.c \
file-save.h \
file-utils.h \
file-utils.c \
general.c \
general.h \
gimage.c \
gimage.h \
gimphelp.c \
gimphelp.h \
gimpparasite.c \
gimpparasite.h \
gimprc.c \
gimprc.h \
gimpunit.c \
image_new.c \
image_new.h \
libgimp_glue.c \
libgimp_glue.h \
main.c \
##
## stuff for plug-in/
##
plug_in.c \
plug_in.h \
##
## stuff which is about to be replaced by new subsystems
##
path.c \
path.h \
pathP.h \
@ -134,14 +130,26 @@ gimp_SOURCES = @STRIP_BEGIN@ \
path_curves.c \
path_bezier.h \
path_bezier.c \
plug_in.c \
plug_in.h \
undo.c \
undo.h \
undo_types.h \
unitrc.h \
xcf.c \
xcf.h \
##
## stuff
##
app_procs.c \
app_procs.h \
appenums.h \
apptypes.h \
main.c \
\
batch.c \
batch.h \
errors.c \
errors.h \
gimphelp.c \
gimphelp.h \
libgimp_glue.c \
libgimp_glue.h \
$(regex_sources) \
$(mmx_sources) \
@STRIP_END@
@ -178,12 +186,13 @@ INCLUDES = @STRIP_BEGIN@ \
@STRIP_END@
gimp_LDADD = @STRIP_BEGIN@ \
paint-funcs/libapppaint-funcs.a \
pdb/libapppdb.a \
tools/libapptools.a \
gui/libappgui.a \
tools/libapptools.a \
widgets/libappwidgets.a \
xcf/libappxcf.a \
pdb/libapppdb.a \
core/libappcore.a \
paint-funcs/libapppaint-funcs.a \
base/libappbase.a \
$(top_builddir)/libgimpcolor/libgimpcolor-$(LT_RELEASE).la \
$(top_builddir)/libgimpmath/libgimpmath-$(LT_RELEASE).la \

View File

@ -29,6 +29,7 @@
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimpdrawable.h"
#include "core/gimpedit.h"
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
@ -41,7 +42,6 @@
#include "context_manager.h"
#include "gdisplay.h"
#include "global_edit.h"
#include "undo.h"
#include "libgimp/gimpintl.h"

View File

@ -37,6 +37,8 @@
#include "pdb/internal_procs.h"
#include "xcf/xcf.h"
#include "tools/tools.h"
#include "gui/color-notebook.h"
@ -58,7 +60,6 @@
#include "undo.h"
#include "unitrc.h"
#include "xcf.h"
#include "errors.h"
#include "docindex.h"
@ -279,6 +280,8 @@ app_exit_finish (void)
gui_exit ();
}
xcf_exit ();
base_exit ();
/* There used to be gtk_main_quit() here, but there's a chance

View File

@ -39,6 +39,8 @@ libappcore_a_SOURCES = @STRIP_BEGIN@ \
gimpdrawable-offset.h \
gimpdrawable-preview.c \
gimpdrawable-preview.h \
gimpedit.c \
gimpedit.h \
gimpgradient.c \
gimpgradient.h \
gimpimage.c \

View File

@ -34,17 +34,18 @@
#include "paint-funcs/paint-funcs.h"
#include "core/gimpbuffer.h"
#include "core/gimpchannel.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
#include "core/gimplayer.h"
#include "core/gimplist.h"
#include "tools/gimptool.h"
#include "tools/tool_manager.h"
#include "gimpbuffer.h"
#include "gimpchannel.h"
#include "gimpcontext.h"
#include "gimpedit.h"
#include "gimpimage.h"
#include "gimpimage-mask.h"
#include "gimplayer.h"
#include "gimplist.h"
#include "context_manager.h"
#include "drawable.h"
#include "floating_sel.h"
@ -52,7 +53,6 @@
#include "gimage.h"
#include "gimpparasite.h"
#include "gimprc.h"
#include "global_edit.h"
#include "image_new.h"
#include "undo.h"

View File

@ -16,8 +16,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GLOBAL_EDIT_H__
#define __GLOBAL_EDIT_H__
#ifndef __GIMP_EDIT_H__
#define __GIMP_EDIT_H__
TileManager * gimp_edit_cut (GimpImage *gimage,
@ -37,4 +37,4 @@ gboolean gimp_edit_fill (GimpImage *gimage,
GimpFillType fill_type);
#endif /* __GLOBAL_EDIT_H__ */
#endif /* __GIMP_EDIT_H__ */

View File

@ -34,17 +34,18 @@
#include "paint-funcs/paint-funcs.h"
#include "core/gimpbuffer.h"
#include "core/gimpchannel.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
#include "core/gimplayer.h"
#include "core/gimplist.h"
#include "tools/gimptool.h"
#include "tools/tool_manager.h"
#include "gimpbuffer.h"
#include "gimpchannel.h"
#include "gimpcontext.h"
#include "gimpedit.h"
#include "gimpimage.h"
#include "gimpimage-mask.h"
#include "gimplayer.h"
#include "gimplist.h"
#include "context_manager.h"
#include "drawable.h"
#include "floating_sel.h"
@ -52,7 +53,6 @@
#include "gimage.h"
#include "gimpparasite.h"
#include "gimprc.h"
#include "global_edit.h"
#include "image_new.h"
#include "undo.h"

View File

@ -16,8 +16,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GLOBAL_EDIT_H__
#define __GLOBAL_EDIT_H__
#ifndef __GIMP_EDIT_H__
#define __GIMP_EDIT_H__
TileManager * gimp_edit_cut (GimpImage *gimage,
@ -37,4 +37,4 @@ gboolean gimp_edit_fill (GimpImage *gimage,
GimpFillType fill_type);
#endif /* __GLOBAL_EDIT_H__ */
#endif /* __GIMP_EDIT_H__ */

View File

@ -37,7 +37,6 @@
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "undo.h"
#include "libgimp/gimpintl.h"

View File

@ -36,6 +36,7 @@
#include "core/gimpbuffer.h"
#include "core/gimpcontext.h"
#include "core/gimpedit.h"
#include "core/gimpimage.h"
#include "core/gimplayer.h"
#include "core/gimppattern.h"
@ -59,7 +60,6 @@
#include "drawable.h"
#include "gdisplay.h"
#include "gimprc.h"
#include "global_edit.h"
#include "scale.h"
#include "scroll.h"
#include "selection.h"

View File

@ -36,6 +36,7 @@
#include "core/gimpbuffer.h"
#include "core/gimpcontext.h"
#include "core/gimpedit.h"
#include "core/gimpimage.h"
#include "core/gimplayer.h"
#include "core/gimppattern.h"
@ -59,7 +60,6 @@
#include "drawable.h"
#include "gdisplay.h"
#include "gimprc.h"
#include "global_edit.h"
#include "scale.h"
#include "scroll.h"
#include "selection.h"

View File

@ -36,6 +36,7 @@
#include "core/gimpbuffer.h"
#include "core/gimpcontext.h"
#include "core/gimpedit.h"
#include "core/gimpimage.h"
#include "core/gimplayer.h"
#include "core/gimppattern.h"
@ -59,7 +60,6 @@
#include "drawable.h"
#include "gdisplay.h"
#include "gimprc.h"
#include "global_edit.h"
#include "scale.h"
#include "scroll.h"
#include "selection.h"

View File

@ -37,7 +37,6 @@
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "undo.h"
#include "libgimp/gimpintl.h"

View File

@ -1,423 +0,0 @@
/* 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.
*/
#include "config.h"
#include <stdlib.h>
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "core/core-types.h"
#include "tools/tools-types.h"
#include "base/pixel-region.h"
#include "base/tile-manager.h"
#include "base/tile-manager-crop.h"
#include "paint-funcs/paint-funcs.h"
#include "core/gimpbuffer.h"
#include "core/gimpchannel.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
#include "core/gimplayer.h"
#include "core/gimplist.h"
#include "tools/gimptool.h"
#include "tools/tool_manager.h"
#include "context_manager.h"
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "gimage.h"
#include "gimpparasite.h"
#include "gimprc.h"
#include "global_edit.h"
#include "image_new.h"
#include "undo.h"
#include "libgimp/gimpintl.h"
TileManager *
gimp_edit_cut (GimpImage *gimage,
GimpDrawable *drawable)
{
TileManager *cut;
TileManager *cropped_cut;
gboolean empty;
g_return_val_if_fail (gimage != NULL, NULL);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
g_return_val_if_fail (drawable != NULL, NULL);
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
/* Start a group undo */
undo_push_group_start (gimage, EDIT_CUT_UNDO);
/* See if the gimage mask is empty */
empty = gimage_mask_is_empty (gimage);
/* Next, cut the mask portion from the gimage */
cut = gimage_mask_extract (gimage, drawable, TRUE, FALSE, TRUE);
if (cut)
image_new_reset_current_cut_buffer ();
/* Only crop if the gimage mask wasn't empty */
if (cut && ! empty)
{
cropped_cut = tile_manager_crop (cut, 0);
if (cropped_cut != cut)
{
tile_manager_destroy (cut);
cut = NULL;
}
}
else if (cut)
cropped_cut = cut;
else
cropped_cut = NULL;
/* end the group undo */
undo_push_group_end (gimage);
if (cropped_cut)
{
/* Free the old global edit buffer */
if (global_buffer)
tile_manager_destroy (global_buffer);
/* Set the global edit buffer */
global_buffer = cropped_cut;
}
return cropped_cut;
}
TileManager *
gimp_edit_copy (GimpImage *gimage,
GimpDrawable *drawable)
{
TileManager *copy;
TileManager *cropped_copy;
gboolean empty;
g_return_val_if_fail (gimage != NULL, NULL);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
g_return_val_if_fail (drawable != NULL, NULL);
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
/* See if the gimage mask is empty */
empty = gimage_mask_is_empty (gimage);
/* First, copy the masked portion of the gimage */
copy = gimage_mask_extract (gimage, drawable, FALSE, FALSE, TRUE);
if (copy)
image_new_reset_current_cut_buffer ();
/* Only crop if the gimage mask wasn't empty */
if (copy && ! empty)
{
cropped_copy = tile_manager_crop (copy, 0);
if (cropped_copy != copy)
{
tile_manager_destroy (copy);
copy = NULL;
}
}
else if (copy)
cropped_copy = copy;
else
cropped_copy = NULL;
if (cropped_copy)
{
/* Free the old global edit buffer */
if (global_buffer)
tile_manager_destroy (global_buffer);
/* Set the global edit buffer */
global_buffer = cropped_copy;
}
return cropped_copy;
}
GimpLayer *
gimp_edit_paste (GimpImage *gimage,
GimpDrawable *drawable,
TileManager *paste,
gboolean paste_into)
{
GimpLayer *layer;
gint x1, y1, x2, y2;
gint cx, cy;
g_return_val_if_fail (gimage != NULL, NULL);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
g_return_val_if_fail (! drawable || GIMP_IS_DRAWABLE (drawable), NULL);
/* Make a new layer: if drawable == NULL,
* user is pasting into an empty image.
*/
if (drawable != NULL)
layer = gimp_layer_new_from_tiles (gimage,
gimp_drawable_type_with_alpha (drawable),
paste,
_("Pasted Layer"),
OPAQUE_OPACITY, NORMAL_MODE);
else
layer = gimp_layer_new_from_tiles (gimage,
gimp_image_base_type_with_alpha (gimage),
paste,
_("Pasted Layer"),
OPAQUE_OPACITY, NORMAL_MODE);
if (! layer)
return NULL;
/* Start a group undo */
undo_push_group_start (gimage, EDIT_PASTE_UNDO);
/* Set the offsets to the center of the image */
if (drawable != NULL)
{
gimp_drawable_offsets (drawable, &cx, &cy);
gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
cx += (x1 + x2) >> 1;
cy += (y1 + y2) >> 1;
}
else
{
cx = gimage->width >> 1;
cy = gimage->height >> 1;
}
GIMP_DRAWABLE (layer)->offset_x = cx - (GIMP_DRAWABLE (layer)->width >> 1);
GIMP_DRAWABLE (layer)->offset_y = cy - (GIMP_DRAWABLE (layer)->height >> 1);
/* If there is a selection mask clear it--
* this might not always be desired, but in general,
* it seems like the correct behavior.
*/
if (! gimage_mask_is_empty (gimage) && ! paste_into)
gimp_channel_clear (gimp_image_get_mask (gimage));
/* if there's a drawable, add a new floating selection */
if (drawable != NULL)
{
floating_sel_attach (layer, drawable);
}
else
{
gimp_drawable_set_gimage (GIMP_DRAWABLE (layer), gimage);
gimp_image_add_layer (gimage, layer, 0);
}
/* end the group undo */
undo_push_group_end (gimage);
return layer;
}
GimpImage *
gimp_edit_paste_as_new (GimpImage *invoke,
TileManager *paste)
{
GimpImage *gimage;
GimpLayer *layer;
GimpParasite *comment_parasite;
GDisplay *gdisp;
if (! global_buffer)
return FALSE;
/* create a new image (always of type RGB) */
gimage = gimage_new (tile_manager_width (paste),
tile_manager_height (paste),
RGB);
gimp_image_undo_disable (gimage);
if (invoke)
{
gimp_image_set_resolution (gimage,
invoke->xresolution, invoke->yresolution);
gimp_image_set_unit (gimage, invoke->unit);
}
if (gimprc.default_comment)
{
comment_parasite = gimp_parasite_new ("gimp-comment",
GIMP_PARASITE_PERSISTENT,
strlen (gimprc.default_comment)+1,
(gpointer) gimprc.default_comment);
gimp_image_parasite_attach (gimage, comment_parasite);
gimp_parasite_free (comment_parasite);
}
layer = gimp_layer_new_from_tiles (gimage,
gimp_image_base_type_with_alpha (gimage),
paste,
_("Pasted Layer"),
OPAQUE_OPACITY, NORMAL_MODE);
if (layer)
{
/* add the new layer to the image */
gimp_drawable_set_gimage (GIMP_DRAWABLE (layer), gimage);
gimp_image_add_layer (gimage, layer, 0);
gimp_image_undo_enable (gimage);
gdisp = gdisplay_new (gimage, 0x0101);
gimp_context_set_display (gimp_context_get_user (), gdisp);
return gimage;
}
return NULL;
}
gboolean
gimp_edit_clear (GimpImage *gimage,
GimpDrawable *drawable)
{
TileManager *buf_tiles;
PixelRegion bufPR;
gint x1, y1, x2, y2;
guchar col[MAX_CHANNELS];
g_return_val_if_fail (gimage != NULL, FALSE);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
g_return_val_if_fail (drawable != NULL, FALSE);
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
gimp_image_get_background (gimage, drawable, col);
if (gimp_drawable_has_alpha (drawable))
col [gimp_drawable_bytes (drawable) - 1] = OPAQUE_OPACITY;
gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
if (!(x2 - x1) || !(y2 - y1))
return TRUE; /* nothing to do, but the clear succeded */
buf_tiles = tile_manager_new ((x2 - x1), (y2 - y1),
gimp_drawable_bytes (drawable));
pixel_region_init (&bufPR, buf_tiles, 0, 0, (x2 - x1), (y2 - y1), TRUE);
color_region (&bufPR, col);
pixel_region_init (&bufPR, buf_tiles, 0, 0, (x2 - x1), (y2 - y1), FALSE);
gimp_image_apply_image (gimage, drawable, &bufPR, TRUE, OPAQUE_OPACITY,
ERASE_MODE, NULL, x1, y1);
/* update the image */
drawable_update (drawable,
x1, y1,
(x2 - x1), (y2 - y1));
/* free the temporary tiles */
tile_manager_destroy (buf_tiles);
return TRUE;
}
gboolean
gimp_edit_fill (GimpImage *gimage,
GimpDrawable *drawable,
GimpFillType fill_type)
{
TileManager *buf_tiles;
PixelRegion bufPR;
gint x1, y1, x2, y2;
guchar col[MAX_CHANNELS];
g_return_val_if_fail (gimage != NULL, FALSE);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
g_return_val_if_fail (drawable != NULL, FALSE);
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
if (gimp_drawable_has_alpha (drawable))
col [gimp_drawable_bytes (drawable) - 1] = OPAQUE_OPACITY;
switch (fill_type)
{
case FOREGROUND_FILL:
gimp_image_get_foreground (gimage, drawable, col);
break;
case BACKGROUND_FILL:
gimp_image_get_background (gimage, drawable, col);
break;
case WHITE_FILL:
col[RED_PIX] = 255;
col[GREEN_PIX] = 255;
col[BLUE_PIX] = 255;
break;
case TRANSPARENT_FILL:
col[RED_PIX] = 0;
col[GREEN_PIX] = 0;
col[BLUE_PIX] = 0;
if (gimp_drawable_has_alpha (drawable))
col [gimp_drawable_bytes (drawable) - 1] = TRANSPARENT_OPACITY;
break;
case NO_FILL:
return TRUE; /* nothing to do, but the fill succeded */
default:
g_warning ("%s(): unknown fill type", G_GNUC_FUNCTION);
gimp_image_get_background (gimage, drawable, col);
break;
}
gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
if (!(x2 - x1) || !(y2 - y1))
return TRUE; /* nothing to do, but the fill succeded */
buf_tiles = tile_manager_new ((x2 - x1), (y2 - y1),
gimp_drawable_bytes (drawable));
pixel_region_init (&bufPR, buf_tiles, 0, 0, (x2 - x1), (y2 - y1), TRUE);
color_region (&bufPR, col);
pixel_region_init (&bufPR, buf_tiles, 0, 0, (x2 - x1), (y2 - y1), FALSE);
gimp_image_apply_image (gimage, drawable, &bufPR, TRUE, OPAQUE_OPACITY,
NORMAL_MODE, NULL, x1, y1);
/* update the image */
drawable_update (drawable,
x1, y1,
(x2 - x1), (y2 - y1));
/* free the temporary tiles */
tile_manager_destroy (buf_tiles);
return TRUE;
}

View File

@ -29,6 +29,7 @@
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimpdrawable.h"
#include "core/gimpedit.h"
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
@ -41,7 +42,6 @@
#include "context_manager.h"
#include "gdisplay.h"
#include "global_edit.h"
#include "undo.h"
#include "libgimp/gimpintl.h"

View File

@ -35,6 +35,7 @@
#include "core/gimpbuffer.h"
#include "core/gimpcontext.h"
#include "core/gimpedit.h"
#include "core/gimpimage.h"
#include "core/gimplayer.h"
#include "core/gimplayermask.h"
@ -54,7 +55,6 @@
#include "dialogs.h"
#include "dialogs-commands.h"
#include "gdisplay.h"
#include "global_edit.h"
#include "indicator-area.h"
#include "menus.h"

View File

@ -29,10 +29,10 @@
#include "procedural_db.h"
#include "core/core-types.h"
#include "core/gimpedit.h"
#include "core/gimpimage-mask.h"
#include "core/gimplayer.h"
#include "drawable.h"
#include "global_edit.h"
extern TileManager *global_buffer;

View File

@ -27,9 +27,10 @@
#include "widgets-types.h"
#include "core/gimpbuffer.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimpbuffer.h"
#include "core/gimpedit.h"
#include "core/gimpimage.h"
#include "gimpcontainerview.h"
@ -37,7 +38,6 @@
#include "gimpdnd.h"
#include "gdisplay.h"
#include "global_edit.h"
#include "libgimp/gimpintl.h"

View File

@ -35,6 +35,7 @@
#include "core/gimpbuffer.h"
#include "core/gimpcontext.h"
#include "core/gimpedit.h"
#include "core/gimpimage.h"
#include "core/gimplayer.h"
#include "core/gimplayermask.h"
@ -54,7 +55,6 @@
#include "dialogs.h"
#include "dialogs-commands.h"
#include "gdisplay.h"
#include "global_edit.h"
#include "indicator-area.h"
#include "menus.h"

3049
app/xcf.c

File diff suppressed because it is too large Load Diff

6
app/xcf/.cvsignore Normal file
View File

@ -0,0 +1,6 @@
Makefile
Makefile.in
.deps
.libs
*.lo
libappxcf.la

38
app/xcf/Makefile.am Normal file
View File

@ -0,0 +1,38 @@
## Process this file with automake to produce Makefile.in
noinst_LIBRARIES = libappxcf.a
libappxcf_a_SOURCES = @STRIP_BEGIN@ \
xcf.c \
xcf.h \
xcf-load.c \
xcf-load.h \
xcf-read.c \
xcf-read.h \
xcf-save.c \
xcf-save.h \
xcf-seek.c \
xcf-seek.h \
xcf-write.c \
xcf-write.h \
@STRIP_END@
AM_CPPFLAGS = @STRIP_BEGIN@ \
-DG_LOG_DOMAIN=\"Gimp-XCF\" \
@GIMP_THREAD_FLAGS@ \
@GIMP_MP_FLAGS@ \
@STRIP_END@
INCLUDES = @STRIP_BEGIN@ \
-I$(top_srcdir) \
-I$(top_srcdir)/app \
$(GTK_CFLAGS) \
-I$(includedir) \
@STRIP_END@
.PHONY: files
files:
@files=`ls $(DISTFILES) 2> /dev/null`; for p in $$files; do \
echo $$p; \
done

1406
app/xcf/xcf-load.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -16,25 +16,11 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GLOBAL_EDIT_H__
#define __GLOBAL_EDIT_H__
#ifndef __XCF_LOAD_H__
#define __XCF_LOAD_H__
TileManager * gimp_edit_cut (GimpImage *gimage,
GimpDrawable *drawable);
TileManager * gimp_edit_copy (GimpImage *gimage,
GimpDrawable *drawable);
GimpLayer * gimp_edit_paste (GimpImage *gimage,
GimpDrawable *drawable,
TileManager *paste,
gboolean paste_into);
GimpImage * gimp_edit_paste_as_new (GimpImage *gimage,
TileManager *tiles);
gboolean gimp_edit_clear (GimpImage *gimage,
GimpDrawable *drawable);
gboolean gimp_edit_fill (GimpImage *gimage,
GimpDrawable *drawable,
GimpFillType fill_type);
GimpImage * xcf_load_image (XcfInfo *info);
#endif /* __GLOBAL_EDIT_H__ */
#endif /* __XCF_LOAD_H__ */

80
app/xcf/xcf-private.h Normal file
View File

@ -0,0 +1,80 @@
/* 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.
*/
#ifndef __XCF_PRIVATE_H__
#define __XCF_PRIVATE_H__
typedef enum
{
PROP_END = 0,
PROP_COLORMAP = 1,
PROP_ACTIVE_LAYER = 2,
PROP_ACTIVE_CHANNEL = 3,
PROP_SELECTION = 4,
PROP_FLOATING_SELECTION = 5,
PROP_OPACITY = 6,
PROP_MODE = 7,
PROP_VISIBLE = 8,
PROP_LINKED = 9,
PROP_PRESERVE_TRANSPARENCY = 10,
PROP_APPLY_MASK = 11,
PROP_EDIT_MASK = 12,
PROP_SHOW_MASK = 13,
PROP_SHOW_MASKED = 14,
PROP_OFFSETS = 15,
PROP_COLOR = 16,
PROP_COMPRESSION = 17,
PROP_GUIDES = 18,
PROP_RESOLUTION = 19,
PROP_TATTOO = 20,
PROP_PARASITES = 21,
PROP_UNIT = 22,
PROP_PATHS = 23,
PROP_USER_UNIT = 24
} PropType;
typedef enum
{
COMPRESS_NONE = 0,
COMPRESS_RLE = 1,
COMPRESS_ZLIB = 2,
COMPRESS_FRACTAL = 3 /* Unused. */
} CompressionType;
typedef struct _XcfInfo XcfInfo;
struct _XcfInfo
{
FILE *fp;
guint cp;
gchar *filename;
GimpLayer *active_layer;
GimpChannel *active_channel;
GimpDrawable *floating_sel_drawable;
GimpLayer *floating_sel;
guint floating_sel_offset;
gint swap_num;
gint *ref_count;
gint compression;
gint file_version;
};
#endif /* __XCF_PRIVATE_H__ */

104
app/xcf/xcf-read.c Normal file
View File

@ -0,0 +1,104 @@
/* 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.
*/
#include "config.h"
#include <stdio.h>
#include <glib.h>
#include "xcf-read.h"
guint
xcf_read_int32 (FILE *fp,
guint32 *data,
gint count)
{
guint total;
total = count;
if (count > 0)
{
xcf_read_int8 (fp, (guint8*) data, count * 4);
while (count--)
{
*data = g_ntohl (*data);
data++;
}
}
return total * 4;
}
guint
xcf_read_float (FILE *fp,
gfloat *data,
gint count)
{
return (xcf_read_int32(fp, (guint32 *)((void *)data), count));
}
guint
xcf_read_int8 (FILE *fp,
guint8 *data,
gint count)
{
guint total;
gint bytes;
total = count;
while (count > 0)
{
bytes = fread ((char*) data, sizeof (char), count, fp);
if (bytes <= 0) /* something bad happened */
break;
count -= bytes;
data += bytes;
}
return total;
}
guint
xcf_read_string (FILE *fp,
gchar **data,
gint count)
{
guint32 tmp;
guint total;
gint i;
total = 0;
for (i = 0; i < count; i++)
{
total += xcf_read_int32 (fp, &tmp, 1);
if (tmp > 0)
{
data[i] = g_new (gchar, tmp);
total += xcf_read_int8 (fp, (guint8*) data[i], tmp);
}
else
{
data[i] = NULL;
}
}
return total;
}

37
app/xcf/xcf-read.h Normal file
View File

@ -0,0 +1,37 @@
/* 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.
*/
#ifndef __XCF_READ_H__
#define __XCF_READ_H__
guint xcf_read_int32 (FILE *fp,
guint32 *data,
gint count);
guint xcf_read_float (FILE *fp,
gfloat *data,
gint count);
guint xcf_read_int8 (FILE *fp,
guint8 *data,
gint count);
guint xcf_read_string (FILE *fp,
gchar **data,
gint count);
#endif /* __XCF_READ_H__ */

1197
app/xcf/xcf-save.c Normal file

File diff suppressed because it is too large Load Diff

29
app/xcf/xcf-save.h Normal file
View File

@ -0,0 +1,29 @@
/* 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.
*/
#ifndef __XCF_SAVE_H__
#define __XCF_SAVE_H__
void xcf_save_choose_format (XcfInfo *info,
GimpImage *gimage);
gint xcf_save_image (XcfInfo *info,
GimpImage *gimage);
#endif /* __XCF_SAVE_H__ */

View File

@ -16,30 +16,32 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __XCF_H__
#define __XCF_H__
#include "config.h"
#include <stdio.h>
#include <glib.h>
#include "core/core-types.h"
#include "xcf-private.h"
#include "xcf-seek.h"
typedef struct _XcfInfo XcfInfo;
struct _XcfInfo
void
xcf_seek_pos (XcfInfo *info,
guint pos)
{
FILE *fp;
guint cp;
gchar *filename;
GimpLayer *active_layer;
GimpChannel *active_channel;
GimpDrawable *floating_sel_drawable;
GimpLayer *floating_sel;
guint floating_sel_offset;
gint swap_num;
gint *ref_count;
gint compression;
gint file_version;
};
if (info->cp != pos)
{
info->cp = pos;
fseek (info->fp, info->cp, SEEK_SET);
}
}
void xcf_init (void);
#endif /* __XCF_H__ */
void
xcf_seek_end (XcfInfo *info)
{
fseek (info->fp, 0, SEEK_END);
info->cp = ftell (info->fp);
}

28
app/xcf/xcf-seek.h Normal file
View File

@ -0,0 +1,28 @@
/* 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.
*/
#ifndef __XCF_SEEK_H__
#define __XCF_SEEK_H__
void xcf_seek_pos (XcfInfo *info,
guint pos);
void xcf_seek_end (XcfInfo *info);
#endif /* __XCF_SEEK_H__ */

100
app/xcf/xcf-write.c Normal file
View File

@ -0,0 +1,100 @@
/* 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.
*/
#include "config.h"
#include <stdio.h>
#include <glib.h>
#include "xcf-write.h"
guint
xcf_write_int32 (FILE *fp,
guint32 *data,
gint count)
{
guint32 tmp;
gint i;
if (count > 0)
{
for (i = 0; i < count; i++)
{
tmp = g_htonl (data[i]);
xcf_write_int8 (fp, (guint8*) &tmp, 4);
}
}
return count * 4;
}
guint
xcf_write_float (FILE *fp,
gfloat *data,
gint count)
{
return (xcf_write_int32(fp, (guint32 *)((void *)data), count));
}
guint
xcf_write_int8 (FILE *fp,
guint8 *data,
gint count)
{
guint total;
gint bytes;
total = count;
while (count > 0)
{
bytes = fwrite ((gchar*) data, sizeof (gchar), count, fp);
count -= bytes;
data += bytes;
}
return total;
}
guint
xcf_write_string (FILE *fp,
gchar **data,
gint count)
{
guint32 tmp;
guint total;
gint i;
total = 0;
for (i = 0; i < count; i++)
{
if (data[i])
tmp = strlen (data[i]) + 1;
else
tmp = 0;
xcf_write_int32 (fp, &tmp, 1);
if (tmp > 0)
xcf_write_int8 (fp, (guint8*) data[i], tmp);
total += 4 + tmp;
}
return total;
}

37
app/xcf/xcf-write.h Normal file
View File

@ -0,0 +1,37 @@
/* 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.
*/
#ifndef __XCF_WRITE_H__
#define __XCF_WRITE_H__
guint xcf_write_int32 (FILE *fp,
guint32 *data,
gint count);
guint xcf_write_float (FILE *fp,
gfloat *data,
gint count);
guint xcf_write_int8 (FILE *fp,
guint8 *data,
gint count);
guint xcf_write_string (FILE *fp,
gchar **data,
gint count);
#endif /* __XCF_WRITE_H__ */

File diff suppressed because it is too large Load Diff

View File

@ -20,26 +20,8 @@
#define __XCF_H__
typedef struct _XcfInfo XcfInfo;
struct _XcfInfo
{
FILE *fp;
guint cp;
gchar *filename;
GimpLayer *active_layer;
GimpChannel *active_channel;
GimpDrawable *floating_sel_drawable;
GimpLayer *floating_sel;
guint floating_sel_offset;
gint swap_num;
gint *ref_count;
gint compression;
gint file_version;
};
void xcf_init (void);
void xcf_init (void);
void xcf_exit (void);
#endif /* __XCF_H__ */

View File

@ -831,6 +831,7 @@ app/paint-funcs/Makefile
app/pdb/Makefile
app/tools/Makefile
app/widgets/Makefile
app/xcf/Makefile
plug-ins/Makefile
plug-ins/makefile.mingw
plug-ins/perl/config.pl

View File

@ -28,7 +28,7 @@ sub inargs {
# Common invoker for checking for image/drawable consistency
sub invoke {
%invoke = (
headers => [ qw("global_edit.h") ],
headers => [ qw("core/gimpedit.h") ],
vars => [ 'GimpImage *gimage' ],
code => <<CODE
{