Commit 3e36b8f5 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

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.
parent 1b8ef8b5
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
......
## 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/
##
context_manager.c \
context_manager.h \
datafiles.c \
datafiles.h \
drawable.c \
drawable.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 \
##
## stuff that needs to be sorted into yet undecided subsystems, split up,
## removed or otherwise tortured
## config stuff
##
app_procs.c \
app_procs.h \
appenums.h \
appenv.h \
apptypes.h \
batch.c \
batch.h \
context_manager.c \
context_manager.h \
drawable.c \
drawable.h \
errors.c \
errors.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 \
......
......@@ -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"
......
......@@ -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
......
......@@ -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 \
......
......@@ -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"
......
......@@ -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__ */
......@@ -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"
......
......@@ -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__ */
......@@ -37,7 +37,6 @@
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "undo.h"
#include "libgimp/gimpintl.h"
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
......@@ -37,7 +37,6 @@
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "undo.h"
#include "libgimp/gimpintl.h"
......
/* 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];