app/Makefile.am removed...

2002-02-21  Michael Natterer  <mitch@gimp.org>

	* app/Makefile.am
	* app/floating_sel.[ch]: removed...

	* app/core/Makefile.am
	* app/core/gimplayer-floating-sel.[ch]: ...and added here.

	* app/undo.c
	* app/core/gimpdrawable-transform.c
	* app/core/gimpedit.c
	* app/core/gimpimage-convert.c
	* app/core/gimpimage-crop.c
	* app/core/gimpimage-duplicate.c
	* app/core/gimpimage-mask.c
	* app/core/gimpimage-merge.c
	* app/core/gimpimage-projection.c
	* app/core/gimpimage-qmask.c
	* app/core/gimpimage-resize.c
	* app/core/gimpimage-scale.c
	* app/core/gimpimage.c
	* app/core/gimplayer.c
	* app/gui/layers-commands.c
	* app/tools/gimpeditselectiontool.c
	* app/tools/gimpfreeselecttool.c
	* app/tools/gimpmovetool.c
	* app/tools/gimprectselecttool.c
	* app/tools/gimptexttool.c
	* app/tools/gimptransformtool.c
	* app/xcf/xcf-load.c
	* app/xcf/xcf-save.c
	* plug-ins/tools/common/gimpbrushselecttool.c
	* tools/pdbgen/pdb/floating_sel.pdb
	* tools/pdbgen/pdb/layer.pdb: changed includes accordingly.

	* app/pdb/floating_sel_cmds.c
	* app/pdb/layer_cmds.c: regenerated.
This commit is contained in:
Michael Natterer 2002-02-21 22:19:45 +00:00 committed by Michael Natterer
parent 9c510759c5
commit 9f9fa587ec
43 changed files with 92 additions and 652 deletions

View File

@ -1,3 +1,41 @@
2002-02-21 Michael Natterer <mitch@gimp.org>
* app/Makefile.am
* app/floating_sel.[ch]: removed...
* app/core/Makefile.am
* app/core/gimplayer-floating-sel.[ch]: ...and added here.
* app/undo.c
* app/core/gimpdrawable-transform.c
* app/core/gimpedit.c
* app/core/gimpimage-convert.c
* app/core/gimpimage-crop.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.c
* app/core/gimpimage-merge.c
* app/core/gimpimage-projection.c
* app/core/gimpimage-qmask.c
* app/core/gimpimage-resize.c
* app/core/gimpimage-scale.c
* app/core/gimpimage.c
* app/core/gimplayer.c
* app/gui/layers-commands.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpfreeselecttool.c
* app/tools/gimpmovetool.c
* app/tools/gimprectselecttool.c
* app/tools/gimptexttool.c
* app/tools/gimptransformtool.c
* app/xcf/xcf-load.c
* app/xcf/xcf-save.c
* plug-ins/tools/common/gimpbrushselecttool.c
* tools/pdbgen/pdb/floating_sel.pdb
* tools/pdbgen/pdb/layer.pdb: changed includes accordingly.
* app/pdb/floating_sel_cmds.c
* app/pdb/layer_cmds.c: regenerated.
2002-02-21 Michael Natterer <mitch@gimp.org> 2002-02-21 Michael Natterer <mitch@gimp.org>
Made the paint tool PDB wrappers work again (a bit at least...) Made the paint tool PDB wrappers work again (a bit at least...)

View File

@ -37,13 +37,6 @@ core_ui_sources = \
image_map.c \ image_map.c \
image_map.h image_map.h
##
## stuff for core/
##
core_sources = \
floating_sel.c \
floating_sel.h
## ##
## config stuff ## config stuff
## ##
@ -91,7 +84,6 @@ stuff_sources = \
gimp_1_3_SOURCES = @STRIP_BEGIN@ \ gimp_1_3_SOURCES = @STRIP_BEGIN@ \
$(gui_sources) \ $(gui_sources) \
$(core_ui_sources) \ $(core_ui_sources) \
$(core_sources) \
$(config_sources) \ $(config_sources) \
$(bye_sources) \ $(bye_sources) \
$(stuff_sources) \ $(stuff_sources) \

View File

@ -36,6 +36,7 @@
#include "core/gimpimage-mask.h" #include "core/gimpimage-mask.h"
#include "core/gimpimage-merge.h" #include "core/gimpimage-merge.h"
#include "core/gimplayer.h" #include "core/gimplayer.h"
#include "core/gimplayer-floating-sel.h"
#include "core/gimplayermask.h" #include "core/gimplayermask.h"
#include "core/gimplist.h" #include "core/gimplist.h"
@ -50,7 +51,6 @@
#include "offset-dialog.h" #include "offset-dialog.h"
#include "resize-dialog.h" #include "resize-dialog.h"
#include "floating_sel.h"
#include "undo.h" #include "undo.h"
#include "libgimp/gimpintl.h" #include "libgimp/gimpintl.h"

View File

@ -116,6 +116,8 @@ libappcore_a_sources = @STRIP_BEGIN@ \
gimpimagefile.h \ gimpimagefile.h \
gimplayer.c \ gimplayer.c \
gimplayer.h \ gimplayer.h \
gimplayer-floating-sel.c \
gimplayer-floating-sel.h \
gimplayermask.c \ gimplayermask.c \
gimplayermask.h \ gimplayermask.h \
gimplist.c \ gimplist.c \

View File

@ -39,9 +39,9 @@
#include "gimpimage-mask.h" #include "gimpimage-mask.h"
#include "gimpimage-new.h" #include "gimpimage-new.h"
#include "gimplayer.h" #include "gimplayer.h"
#include "gimplayer-floating-sel.h"
#include "gimplist.h" #include "gimplist.h"
#include "floating_sel.h"
#include "undo.h" #include "undo.h"
#include "libgimp/gimpintl.h" #include "libgimp/gimpintl.h"

View File

@ -40,8 +40,8 @@
#include "gimpimage.h" #include "gimpimage.h"
#include "gimpimage-mask.h" #include "gimpimage-mask.h"
#include "gimplayer.h" #include "gimplayer.h"
#include "gimplayer-floating-sel.h"
#include "floating_sel.h"
#include "undo.h" #include "undo.h"
#include "libgimp/gimpintl.h" #include "libgimp/gimpintl.h"

View File

@ -40,8 +40,8 @@
#include "gimpimage.h" #include "gimpimage.h"
#include "gimpimage-mask.h" #include "gimpimage-mask.h"
#include "gimplayer.h" #include "gimplayer.h"
#include "gimplayer-floating-sel.h"
#include "floating_sel.h"
#include "undo.h" #include "undo.h"
#include "libgimp/gimpintl.h" #include "libgimp/gimpintl.h"

View File

@ -39,9 +39,9 @@
#include "gimpimage-mask.h" #include "gimpimage-mask.h"
#include "gimpimage-new.h" #include "gimpimage-new.h"
#include "gimplayer.h" #include "gimplayer.h"
#include "gimplayer-floating-sel.h"
#include "gimplist.h" #include "gimplist.h"
#include "floating_sel.h"
#include "undo.h" #include "undo.h"
#include "libgimp/gimpintl.h" #include "libgimp/gimpintl.h"

View File

@ -141,9 +141,9 @@
#include "gimpimage-projection.h" #include "gimpimage-projection.h"
#include "gimplist.h" #include "gimplist.h"
#include "gimplayer.h" #include "gimplayer.h"
#include "gimplayer-floating-sel.h"
#include "gimppalette.h" #include "gimppalette.h"
#include "floating_sel.h"
#include "undo.h" #include "undo.h"
#include "cpercep.h" #include "cpercep.h"

View File

@ -34,9 +34,9 @@
#include "gimpimage-mask.h" #include "gimpimage-mask.h"
#include "gimpimage-projection.h" #include "gimpimage-projection.h"
#include "gimplayer.h" #include "gimplayer.h"
#include "gimplayer-floating-sel.h"
#include "gimplist.h" #include "gimplist.h"
#include "floating_sel.h"
#include "undo.h" #include "undo.h"

View File

@ -39,10 +39,10 @@
#include "gimpimage-guides.h" #include "gimpimage-guides.h"
#include "gimpimage-new.h" #include "gimpimage-new.h"
#include "gimplayer.h" #include "gimplayer.h"
#include "gimplayer-floating-sel.h"
#include "gimplist.h" #include "gimplist.h"
#include "gimpparasitelist.h" #include "gimpparasitelist.h"
#include "floating_sel.h"
#include "path.h" #include "path.h"
#include "libgimp/gimpintl.h" #include "libgimp/gimpintl.h"

View File

@ -35,10 +35,10 @@
#include "gimpimage.h" #include "gimpimage.h"
#include "gimpimage-mask.h" #include "gimpimage-mask.h"
#include "gimplayer.h" #include "gimplayer.h"
#include "gimplayer-floating-sel.h"
#include "gimplayermask.h" #include "gimplayermask.h"
#include "gimptoolinfo.h" #include "gimptoolinfo.h"
#include "floating_sel.h"
#include "undo.h" #include "undo.h"
#include "libgimp/gimpintl.h" #include "libgimp/gimpintl.h"

View File

@ -39,6 +39,7 @@
#include "gimpimage-projection.h" #include "gimpimage-projection.h"
#include "gimpimage-undo.h" #include "gimpimage-undo.h"
#include "gimplayer.h" #include "gimplayer.h"
#include "gimplayer-floating-sel.h"
#include "gimplayermask.h" #include "gimplayermask.h"
#include "gimplist.h" #include "gimplist.h"
#include "gimpmarshal.h" #include "gimpmarshal.h"
@ -46,7 +47,6 @@
#include "gimpparasitelist.h" #include "gimpparasitelist.h"
#include "gimpundostack.h" #include "gimpundostack.h"
#include "floating_sel.h"
#include "path.h" #include "path.h"
#include "undo.h" #include "undo.h"

View File

@ -34,11 +34,10 @@
#include "gimpimage.h" #include "gimpimage.h"
#include "gimpimage-projection.h" #include "gimpimage-projection.h"
#include "gimplayer.h" #include "gimplayer.h"
#include "gimplayer-floating-sel.h"
#include "gimplayermask.h" #include "gimplayermask.h"
#include "gimplist.h" #include "gimplist.h"
#include "floating_sel.h"
/* local function prototypes */ /* local function prototypes */

View File

@ -32,8 +32,8 @@
#include "gimpimage.h" #include "gimpimage.h"
#include "gimpimage-mask.h" #include "gimpimage-mask.h"
#include "gimpimage-qmask.h" #include "gimpimage-qmask.h"
#include "gimplayer-floating-sel.h"
#include "floating_sel.h"
#include "undo.h" #include "undo.h"
#include "libgimp/gimpintl.h" #include "libgimp/gimpintl.h"

View File

@ -32,8 +32,8 @@
#include "gimpimage.h" #include "gimpimage.h"
#include "gimpimage-mask.h" #include "gimpimage-mask.h"
#include "gimpimage-qmask.h" #include "gimpimage-qmask.h"
#include "gimplayer-floating-sel.h"
#include "floating_sel.h"
#include "undo.h" #include "undo.h"
#include "libgimp/gimpintl.h" #include "libgimp/gimpintl.h"

View File

@ -30,9 +30,9 @@
#include "gimpimage-projection.h" #include "gimpimage-projection.h"
#include "gimpimage-resize.h" #include "gimpimage-resize.h"
#include "gimplayer.h" #include "gimplayer.h"
#include "gimplayer-floating-sel.h"
#include "gimplist.h" #include "gimplist.h"
#include "floating_sel.h"
#include "undo.h" #include "undo.h"

View File

@ -29,9 +29,9 @@
#include "gimpimage-projection.h" #include "gimpimage-projection.h"
#include "gimpimage-scale.h" #include "gimpimage-scale.h"
#include "gimplayer.h" #include "gimplayer.h"
#include "gimplayer-floating-sel.h"
#include "gimplist.h" #include "gimplist.h"
#include "floating_sel.h"
#include "undo.h" #include "undo.h"

View File

@ -43,6 +43,7 @@
#include "core/gimpimage-mask.h" #include "core/gimpimage-mask.h"
#include "core/gimpimage-projection.h" #include "core/gimpimage-projection.h"
#include "core/gimplayer.h" #include "core/gimplayer.h"
#include "core/gimplayer-floating-sel.h"
#include "core/gimplayermask.h" #include "core/gimplayermask.h"
#include "core/gimpparasite.h" #include "core/gimpparasite.h"
#include "core/gimpparasitelist.h" #include "core/gimpparasitelist.h"
@ -56,7 +57,6 @@
#include "tools/gimptransformtool.h" #include "tools/gimptransformtool.h"
#include "tools/tool_manager.h" #include "tools/tool_manager.h"
#include "floating_sel.h"
#include "path_transform.h" #include "path_transform.h"
#include "undo.h" #include "undo.h"

View File

@ -43,6 +43,7 @@
#include "gimpimage-projection.h" #include "gimpimage-projection.h"
#include "gimpimage-undo.h" #include "gimpimage-undo.h"
#include "gimplayer.h" #include "gimplayer.h"
#include "gimplayer-floating-sel.h"
#include "gimplayermask.h" #include "gimplayermask.h"
#include "gimplist.h" #include "gimplist.h"
#include "gimpmarshal.h" #include "gimpmarshal.h"
@ -50,7 +51,6 @@
#include "gimpparasitelist.h" #include "gimpparasitelist.h"
#include "gimpundostack.h" #include "gimpundostack.h"
#include "floating_sel.h"
#include "path.h" #include "path.h"
#include "undo.h" #include "undo.h"

View File

@ -18,11 +18,11 @@
#include "config.h" #include "config.h"
#include <gtk/gtk.h> #include <glib-object.h>
#include "libgimpmath/gimpmath.h" #include "libgimpmath/gimpmath.h"
#include "core/core-types.h" #include "core-types.h"
#include "base/boundary.h" #include "base/boundary.h"
#include "base/pixel-region.h" #include "base/pixel-region.h"
@ -30,12 +30,12 @@
#include "paint-funcs/paint-funcs.h" #include "paint-funcs/paint-funcs.h"
#include "core/gimpimage.h" #include "gimpimage.h"
#include "core/gimpimage-mask.h" #include "gimpimage-mask.h"
#include "core/gimplayer.h" #include "gimplayer.h"
#include "core/gimplayermask.h" #include "gimplayer-floating-sel.h"
#include "gimplayermask.h"
#include "floating_sel.h"
#include "undo.h" #include "undo.h"
#include "libgimp/gimpintl.h" #include "libgimp/gimpintl.h"

View File

@ -16,8 +16,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef __FLOATING_SEL_H__ #ifndef __GIMP_LAYER_FLOATING_SEL_H__
#define __FLOATING_SEL_H__ #define __GIMP_LAYER_FLOATING_SEL_H__
void floating_sel_attach (GimpLayer *layer, void floating_sel_attach (GimpLayer *layer,
@ -51,4 +51,4 @@ BoundSeg * floating_sel_boundary (GimpLayer *layer,
void floating_sel_invalidate (GimpLayer *layer); void floating_sel_invalidate (GimpLayer *layer);
#endif /* __FLOATING_SEL_H__ */ #endif /* __GIMP_LAYER_FLOATING_SEL_H__ */

View File

@ -41,11 +41,11 @@
#include "gimpimage.h" #include "gimpimage.h"
#include "gimpimage-convert.h" #include "gimpimage-convert.h"
#include "gimplayer.h" #include "gimplayer.h"
#include "gimplayer-floating-sel.h"
#include "gimplayermask.h" #include "gimplayermask.h"
#include "gimpmarshal.h" #include "gimpmarshal.h"
#include "gimpparasitelist.h" #include "gimpparasitelist.h"
#include "floating_sel.h"
#include "undo.h" #include "undo.h"
#include "libgimp/gimpintl.h" #include "libgimp/gimpintl.h"

View File

@ -34,11 +34,10 @@
#include "gimpimage.h" #include "gimpimage.h"
#include "gimpimage-projection.h" #include "gimpimage-projection.h"
#include "gimplayer.h" #include "gimplayer.h"
#include "gimplayer-floating-sel.h"
#include "gimplayermask.h" #include "gimplayermask.h"
#include "gimplist.h" #include "gimplist.h"
#include "floating_sel.h"
/* local function prototypes */ /* local function prototypes */

View File

@ -1,535 +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 <gtk/gtk.h>
#include "libgimpmath/gimpmath.h"
#include "core/core-types.h"
#include "base/boundary.h"
#include "base/pixel-region.h"
#include "base/tile-manager.h"
#include "paint-funcs/paint-funcs.h"
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
#include "core/gimplayer.h"
#include "core/gimplayermask.h"
#include "floating_sel.h"
#include "undo.h"
#include "libgimp/gimpintl.h"
void
floating_sel_attach (GimpLayer *layer,
GimpDrawable *drawable)
{
GimpImage *gimage;
GimpLayer *floating_sel;
if (! (gimage = gimp_drawable_gimage (drawable)))
return;
/* If there is already a floating selection, anchor it */
if (gimage->floating_sel != NULL)
{
floating_sel = gimage->floating_sel;
floating_sel_anchor (gimp_image_floating_sel (gimage));
/* if we were pasting to the old floating selection, paste now
* to the drawable
*/
if (drawable == GIMP_DRAWABLE (floating_sel))
drawable = gimp_image_active_drawable (gimage);
}
/* set the drawable and allocate a backing store */
gimp_layer_set_preserve_trans (layer, TRUE);
layer->fs.drawable = drawable;
layer->fs.backing_store =
tile_manager_new (GIMP_DRAWABLE (layer)->width,
GIMP_DRAWABLE (layer)->height,
gimp_drawable_bytes (drawable));
/* because setting the sensitivity in the layers_dialog lock call
* redraws the previews, we need to lock the dialogs before the
* floating sel is actually added. however, they won't lock unless
* we set the gimage's floating sel pointer
*/
gimage->floating_sel = layer;
/* add the layer to the gimage */
gimp_image_add_layer (gimage, layer, 0);
/* store the affected area from the drawable in the backing store */
floating_sel_rigor (layer, TRUE);
gimp_image_floating_selection_changed (gimage);
}
void
floating_sel_remove (GimpLayer *layer)
{
GimpImage *gimage;
if (! (gimage = gimp_drawable_gimage (layer->fs.drawable)))
return;
/* store the affected area from the drawable in the backing store */
floating_sel_relax (layer, TRUE);
/* invalidate the preview of the obscured drawable. We do this here
* because it will not be done until the floating selection is removed,
* at which point the obscured drawable's preview will not be declared invalid
*/
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (layer));
/* remove the layer from the gimage */
gimp_image_remove_layer (gimage, layer);
gimp_image_floating_selection_changed (gimage);
}
void
floating_sel_anchor (GimpLayer *layer)
{
GimpImage *gimage;
if (! (gimage = gimp_drawable_gimage (GIMP_DRAWABLE (layer))))
return;
if (! gimp_layer_is_floating_sel (layer))
{
g_message (_("Cannot anchor this layer because\n"
"it is not a floating selection."));
return;
}
/* Start a floating selection anchoring undo */
undo_push_group_start (gimage, FS_ANCHOR_UNDO);
/* Invalidate the previews of the layer that will be composited
* with the floating section.
*/
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (layer->fs.drawable));
/* Relax the floating selection */
floating_sel_relax (layer, TRUE);
/* Composite the floating selection contents */
floating_sel_composite (layer,
GIMP_DRAWABLE (layer)->offset_x,
GIMP_DRAWABLE (layer)->offset_y,
GIMP_DRAWABLE (layer)->width,
GIMP_DRAWABLE (layer)->height, TRUE);
/* remove the floating selection */
gimp_image_remove_layer (gimage, layer);
/* end the group undo */
undo_push_group_end (gimage);
/* invalidate the boundaries */
gimp_image_mask_invalidate (gimage);
gimp_image_floating_selection_changed (gimage);
}
void
floating_sel_reset (GimpLayer *layer)
{
GimpImage *gimage;
if (! (gimage = gimp_drawable_gimage (GIMP_DRAWABLE (layer))))
return;
/* set the underlying drawable to active */
if (GIMP_IS_LAYER (layer->fs.drawable))
{
gimp_image_set_active_layer (gimage, GIMP_LAYER (layer->fs.drawable));
}
else if (GIMP_IS_LAYER_MASK (layer->fs.drawable))
{
gimp_image_set_active_layer (gimage,
GIMP_LAYER_MASK (layer->fs.drawable)->layer);
}
else if (GIMP_IS_CHANNEL (layer->fs.drawable))
{
gimp_image_set_active_channel (gimage, GIMP_CHANNEL (layer->fs.drawable));
}
}
void
floating_sel_to_layer (GimpLayer *layer)
{
FStoLayerUndo *fsu;
gint off_x, off_y;
gint width, height;
GimpImage *gimage;
if (! (gimage = gimp_drawable_gimage (GIMP_DRAWABLE (layer))))
return;
/* Check if the floating layer belongs to a channel... */
if (GIMP_IS_CHANNEL (layer->fs.drawable))
{
g_message (_("Cannot create a new layer from the floating\n"
"selection because it belongs to a\n"
"layer mask or channel."));
return;
}
/* restore the contents of the drawable */
floating_sel_restore (layer,
GIMP_DRAWABLE (layer)->offset_x,
GIMP_DRAWABLE (layer)->offset_y,
GIMP_DRAWABLE (layer)->width,
GIMP_DRAWABLE (layer)->height);
/* determine whether the resulting layer needs an update */
gimp_drawable_offsets (layer->fs.drawable, &off_x, &off_y);
width = gimp_drawable_width (layer->fs.drawable);
height = gimp_drawable_height (layer->fs.drawable);
/* allocate the undo structure */
fsu = g_new (FStoLayerUndo, 1);
fsu->layer = layer;
fsu->drawable = layer->fs.drawable;
undo_push_fs_to_layer (gimage, fsu);
/* clear the selection */
gimp_layer_invalidate_boundary (layer);
/* Set pointers */
layer->fs.drawable = NULL;
gimage->floating_sel = NULL;
gimp_drawable_set_visible (GIMP_DRAWABLE (layer), TRUE);
gimp_drawable_update (GIMP_DRAWABLE (layer),
0, 0,
GIMP_DRAWABLE (layer)->width,
GIMP_DRAWABLE (layer)->height);
gimp_image_floating_selection_changed (gimage);
}
void
floating_sel_store (GimpLayer *layer,
gint x,
gint y,
gint w,
gint h)
{
PixelRegion srcPR, destPR;
gint offx, offy;
gint x1, y1, x2, y2;
/* Check the backing store & make sure it has the correct dimensions */
if ((tile_manager_width (layer->fs.backing_store) != gimp_drawable_width (GIMP_DRAWABLE(layer))) ||
(tile_manager_height (layer->fs.backing_store) != gimp_drawable_height (GIMP_DRAWABLE(layer))) ||
(tile_manager_bpp (layer->fs.backing_store) != gimp_drawable_bytes (layer->fs.drawable)))
{
/* free the backing store and allocate anew */
tile_manager_destroy (layer->fs.backing_store);
layer->fs.backing_store =
tile_manager_new (GIMP_DRAWABLE (layer)->width,
GIMP_DRAWABLE (layer)->height,
gimp_drawable_bytes (layer->fs.drawable));
}
/* What this function does is save the specified area of the
* drawable that this floating selection obscures. We do this so
* that it will be possible to subsequently restore the drawable's area
*/
gimp_drawable_offsets (layer->fs.drawable, &offx, &offy);
/* Find the minimum area we need to uncover -- in gimage space */
x1 = MAX (GIMP_DRAWABLE (layer)->offset_x, offx);
y1 = MAX (GIMP_DRAWABLE (layer)->offset_y, offy);
x2 = MIN (GIMP_DRAWABLE (layer)->offset_x + GIMP_DRAWABLE (layer)->width,
offx + gimp_drawable_width (layer->fs.drawable));
y2 = MIN (GIMP_DRAWABLE (layer)->offset_y + GIMP_DRAWABLE (layer)->height,
offy + gimp_drawable_height (layer->fs.drawable));
x1 = CLAMP (x, x1, x2);
y1 = CLAMP (y, y1, y2);
x2 = CLAMP (x + w, x1, x2);
y2 = CLAMP (y + h, y1, y2);
if ((x2 - x1) > 0 && (y2 - y1) > 0)
{
/* Copy the area from the drawable to the backing store */
pixel_region_init (&srcPR, gimp_drawable_data (layer->fs.drawable),
(x1 - offx), (y1 - offy), (x2 - x1), (y2 - y1), FALSE);
pixel_region_init (&destPR, layer->fs.backing_store,
(x1 - GIMP_DRAWABLE (layer)->offset_x),
(y1 - GIMP_DRAWABLE (layer)->offset_y),
(x2 - x1), (y2 - y1), TRUE);
copy_region (&srcPR, &destPR);
}
}
void
floating_sel_restore (GimpLayer *layer,
gint x,
gint y,
gint w,
gint h)
{
PixelRegion srcPR, destPR;
gint offx, offy;
gint x1, y1, x2, y2;
/* What this function does is "uncover" the specified area in the
* drawable that this floating selection obscures. We do this so
* that either the floating selection can be removed or it can be
* translated
*/
/* Find the minimum area we need to uncover -- in gimage space */
gimp_drawable_offsets (layer->fs.drawable, &offx, &offy);
x1 = MAX (GIMP_DRAWABLE (layer)->offset_x, offx);
y1 = MAX (GIMP_DRAWABLE (layer)->offset_y, offy);
x2 = MIN (GIMP_DRAWABLE (layer)->offset_x + GIMP_DRAWABLE (layer)->width,
offx + gimp_drawable_width (layer->fs.drawable));
y2 = MIN (GIMP_DRAWABLE(layer)->offset_y + GIMP_DRAWABLE (layer)->height,
offy + gimp_drawable_height (layer->fs.drawable));
x1 = CLAMP (x, x1, x2);
y1 = CLAMP (y, y1, y2);
x2 = CLAMP (x + w, x1, x2);
y2 = CLAMP (y + h, y1, y2);
if ((x2 - x1) > 0 && (y2 - y1) > 0)
{
/* Copy the area from the backing store to the drawable */
pixel_region_init (&srcPR, layer->fs.backing_store,
(x1 - GIMP_DRAWABLE (layer)->offset_x),
(y1 - GIMP_DRAWABLE (layer)->offset_y),
(x2 - x1), (y2 - y1), FALSE);
pixel_region_init (&destPR, gimp_drawable_data (layer->fs.drawable),
(x1 - offx), (y1 - offy), (x2 - x1), (y2 - y1), TRUE);
copy_region (&srcPR, &destPR);
}
}
void
floating_sel_rigor (GimpLayer *layer,
gboolean undo)
{
GimpImage *gimage = GIMP_DRAWABLE (layer)->gimage;
/* store the affected area from the drawable in the backing store */
floating_sel_store (layer,
GIMP_DRAWABLE (layer)->offset_x,
GIMP_DRAWABLE (layer)->offset_y,
GIMP_DRAWABLE (layer)->width,
GIMP_DRAWABLE (layer)->height);
layer->fs.initial = TRUE;
if (undo)
undo_push_fs_rigor (gimage, GIMP_DRAWABLE (layer)->ID);
}
void
floating_sel_relax (GimpLayer *layer,
gboolean undo)
{
GimpImage *gimage = GIMP_DRAWABLE (layer)->gimage;
/* restore the contents of drawable the floating layer is attached to */
if (layer->fs.initial == FALSE)
floating_sel_restore (layer,
GIMP_DRAWABLE (layer)->offset_x,
GIMP_DRAWABLE (layer)->offset_y,
GIMP_DRAWABLE (layer)->width,
GIMP_DRAWABLE (layer)->height);
layer->fs.initial = TRUE;
if (undo)
undo_push_fs_relax (gimage, GIMP_DRAWABLE (layer)->ID);
}
void
floating_sel_composite (GimpLayer *layer,
gint x,
gint y,
gint w,
gint h,
gboolean undo)
{
PixelRegion fsPR;
GimpImage *gimage;
GimpLayer *d_layer;
gint preserve_trans;
gint active[MAX_CHANNELS];
gint offx, offy;
gint x1, y1, x2, y2;
gint i;
d_layer = NULL;
if (! (gimage = gimp_drawable_gimage (GIMP_DRAWABLE (layer))))
return;
/* What this function does is composite the specified area of the
* drawble with the floating selection. We do this when the gimage
* is constructed, before any other composition takes place.
*/
/* If this isn't the first composite,
* restore the image underneath
*/
if (! layer->fs.initial)
floating_sel_restore (layer, x, y, w, h);
else if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
layer->fs.initial = FALSE;
/* First restore what's behind the image if necessary,
* then check for visibility
*/
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
{
/* Find the minimum area we need to composite -- in gimage space */
gimp_drawable_offsets (layer->fs.drawable, &offx, &offy);
x1 = MAX (GIMP_DRAWABLE (layer)->offset_x, offx);
y1 = MAX (GIMP_DRAWABLE (layer)->offset_y, offy);
x2 = MIN (GIMP_DRAWABLE (layer)->offset_x +
GIMP_DRAWABLE (layer)->width,
offx + gimp_drawable_width (layer->fs.drawable));
y2 = MIN (GIMP_DRAWABLE (layer)->offset_y +
GIMP_DRAWABLE (layer)->height,
offy + gimp_drawable_height (layer->fs.drawable));
x1 = CLAMP (x, x1, x2);
y1 = CLAMP (y, y1, y2);
x2 = CLAMP (x + w, x1, x2);
y2 = CLAMP (y + h, y1, y2);
if ((x2 - x1) > 0 && (y2 - y1) > 0)
{
/* composite the area from the layer to the drawable */
pixel_region_init (&fsPR, GIMP_DRAWABLE (layer)->tiles,
(x1 - GIMP_DRAWABLE (layer)->offset_x),
(y1 - GIMP_DRAWABLE (layer)->offset_y),
(x2 - x1), (y2 - y1), FALSE);
/* a kludge here to prevent the case of the drawable
* underneath having preserve transparency on, and disallowing
* the composited floating selection from being shown
*/
if (GIMP_IS_LAYER (layer->fs.drawable))
{
d_layer = GIMP_LAYER (layer->fs.drawable);
if ((preserve_trans = gimp_layer_get_preserve_trans (d_layer)))
gimp_layer_set_preserve_trans (d_layer, FALSE);
}
else
preserve_trans = FALSE;
/* We need to set all gimage channels to active to make sure that
* nothing strange happens while applying the floating selection.
* It wouldn't make sense for the floating selection to be affected
* by the active gimage channels.
*/
for (i = 0; i < MAX_CHANNELS; i++)
{
active[i] = gimage->active[i];
gimage->active[i] = 1;
}
/* apply the fs with the undo specified by the value
* passed to this function
*/
gimp_image_apply_image (gimage, layer->fs.drawable, &fsPR,
undo,
layer->opacity,
layer->mode,
NULL,
(x1 - offx), (y1 - offy));
/* restore preserve transparency */
if (preserve_trans)
gimp_layer_set_preserve_trans (d_layer, TRUE);
/* restore gimage active channels */
for (i = 0; i < MAX_CHANNELS; i++)
gimage->active[i] = active[i];
}
}
}
BoundSeg *
floating_sel_boundary (GimpLayer *layer,
gint *n_segs)
{
PixelRegion bPR;
gint i;
if (layer->fs.boundary_known == FALSE)
{
if (layer->fs.segs)
g_free (layer->fs.segs);
/* find the segments */
pixel_region_init (&bPR, GIMP_DRAWABLE (layer)->tiles,
0, 0,
GIMP_DRAWABLE (layer)->width,
GIMP_DRAWABLE (layer)->height, FALSE);
layer->fs.segs = find_mask_boundary (&bPR, &layer->fs.num_segs,
WithinBounds, 0, 0,
GIMP_DRAWABLE (layer)->width,
GIMP_DRAWABLE (layer)->height);
/* offset the segments */
for (i = 0; i < layer->fs.num_segs; i++)
{
layer->fs.segs[i].x1 += GIMP_DRAWABLE (layer)->offset_x;
layer->fs.segs[i].y1 += GIMP_DRAWABLE (layer)->offset_y;
layer->fs.segs[i].x2 += GIMP_DRAWABLE (layer)->offset_x;
layer->fs.segs[i].y2 += GIMP_DRAWABLE (layer)->offset_y;
}
layer->fs.boundary_known = TRUE;
}
*n_segs = layer->fs.num_segs;
return layer->fs.segs;
}
void
floating_sel_invalidate (GimpLayer *layer)
{
/* Invalidate the attached-to drawable's preview */
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (layer->fs.drawable));
/* Invalidate the boundary */
layer->fs.boundary_known = FALSE;
}

View File

@ -1,54 +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.
*/
#ifndef __FLOATING_SEL_H__
#define __FLOATING_SEL_H__
void floating_sel_attach (GimpLayer *layer,
GimpDrawable *drawable);
void floating_sel_remove (GimpLayer *layer);
void floating_sel_anchor (GimpLayer *layer);
void floating_sel_reset (GimpLayer *layer);
void floating_sel_to_layer (GimpLayer *layer);
void floating_sel_store (GimpLayer *layer,
gint x,
gint y,
gint w,
gint h);
void floating_sel_restore (GimpLayer *layer,
gint x,
gint y,
gint w,
gint h);
void floating_sel_rigor (GimpLayer *layer,
gboolean undo);
void floating_sel_relax (GimpLayer *layer,
gboolean undo);
void floating_sel_composite (GimpLayer *layer,
gint x,
gint y,
gint w,
gint h,
gboolean undo);
BoundSeg * floating_sel_boundary (GimpLayer *layer,
gint *n_segs);
void floating_sel_invalidate (GimpLayer *layer);
#endif /* __FLOATING_SEL_H__ */

View File

@ -36,6 +36,7 @@
#include "core/gimpimage-mask.h" #include "core/gimpimage-mask.h"
#include "core/gimpimage-merge.h" #include "core/gimpimage-merge.h"
#include "core/gimplayer.h" #include "core/gimplayer.h"
#include "core/gimplayer-floating-sel.h"
#include "core/gimplayermask.h" #include "core/gimplayermask.h"
#include "core/gimplist.h" #include "core/gimplist.h"
@ -50,7 +51,6 @@
#include "offset-dialog.h" #include "offset-dialog.h"
#include "resize-dialog.h" #include "resize-dialog.h"
#include "floating_sel.h"
#include "undo.h" #include "undo.h"
#include "libgimp/gimpintl.h" #include "libgimp/gimpintl.h"

View File

@ -29,8 +29,8 @@
#include "procedural_db.h" #include "procedural_db.h"
#include "core/gimpdrawable.h" #include "core/gimpdrawable.h"
#include "core/gimplayer-floating-sel.h"
#include "core/gimplayer.h" #include "core/gimplayer.h"
#include "floating_sel.h"
static ProcRecord floating_sel_remove_proc; static ProcRecord floating_sel_remove_proc;
static ProcRecord floating_sel_anchor_proc; static ProcRecord floating_sel_anchor_proc;

View File

@ -34,10 +34,10 @@
#include "core/gimp.h" #include "core/gimp.h"
#include "core/gimpcoreconfig.h" #include "core/gimpcoreconfig.h"
#include "core/gimpimage.h" #include "core/gimpimage.h"
#include "core/gimplayer-floating-sel.h"
#include "core/gimplayer.h" #include "core/gimplayer.h"
#include "core/gimplayermask.h" #include "core/gimplayermask.h"
#include "core/gimplist.h" #include "core/gimplist.h"
#include "floating_sel.h"
#include "pdb_glue.h" #include "pdb_glue.h"
#include "undo.h" #include "undo.h"

View File

@ -36,6 +36,7 @@
#include "core/gimpimage-guides.h" #include "core/gimpimage-guides.h"
#include "core/gimpimage-mask.h" #include "core/gimpimage-mask.h"
#include "core/gimplayer.h" #include "core/gimplayer.h"
#include "core/gimplayer-floating-sel.h"
#include "core/gimplist.h" #include "core/gimplist.h"
#include "display/gimpdisplay.h" #include "display/gimpdisplay.h"
@ -47,7 +48,6 @@
#include "gimpdrawtool.h" #include "gimpdrawtool.h"
#include "tool_manager.h" #include "tool_manager.h"
#include "floating_sel.h"
#include "gimprc.h" #include "gimprc.h"
#include "path_transform.h" #include "path_transform.h"
#include "undo.h" #include "undo.h"

View File

@ -33,6 +33,7 @@
#include "core/gimpimage.h" #include "core/gimpimage.h"
#include "core/gimpimage-mask.h" #include "core/gimpimage-mask.h"
#include "core/gimpimage-mask-select.h" #include "core/gimpimage-mask-select.h"
#include "core/gimplayer-floating-sel.h"
#include "core/gimptoolinfo.h" #include "core/gimptoolinfo.h"
#include "display/gimpdisplay.h" #include "display/gimpdisplay.h"
@ -42,8 +43,6 @@
#include "gimpfreeselecttool.h" #include "gimpfreeselecttool.h"
#include "selection_options.h" #include "selection_options.h"
#include "floating_sel.h"
#include "libgimp/gimpintl.h" #include "libgimp/gimpintl.h"

View File

@ -30,6 +30,7 @@
#include "core/gimpimage-guides.h" #include "core/gimpimage-guides.h"
#include "core/gimpimage-mask.h" #include "core/gimpimage-mask.h"
#include "core/gimplayer.h" #include "core/gimplayer.h"
#include "core/gimplayer-floating-sel.h"
#include "core/gimptoolinfo.h" #include "core/gimptoolinfo.h"
#include "display/gimpdisplay.h" #include "display/gimpdisplay.h"
@ -40,7 +41,6 @@
#include "gimpmovetool.h" #include "gimpmovetool.h"
#include "tool_options.h" #include "tool_options.h"
#include "floating_sel.h"
#include "undo.h" #include "undo.h"
#include "libgimp/gimpintl.h" #include "libgimp/gimpintl.h"

View File

@ -33,6 +33,7 @@
#include "core/gimpimage-crop.h" #include "core/gimpimage-crop.h"
#include "core/gimpimage-mask.h" #include "core/gimpimage-mask.h"
#include "core/gimpimage-mask-select.h" #include "core/gimpimage-mask-select.h"
#include "core/gimplayer-floating-sel.h"
#include "core/gimpmarshal.h" #include "core/gimpmarshal.h"
#include "core/gimptoolinfo.h" #include "core/gimptoolinfo.h"
@ -43,8 +44,6 @@
#include "gimprectselecttool.h" #include "gimprectselecttool.h"
#include "selection_options.h" #include "selection_options.h"
#include "floating_sel.h"
#include "libgimp/gimpintl.h" #include "libgimp/gimpintl.h"

View File

@ -29,16 +29,17 @@
#include "tools-types.h" #include "tools-types.h"
#include "paint-funcs/paint-funcs.h"
#include "base/base-types.h" #include "base/base-types.h"
#include "base/pixel-region.h" #include "base/pixel-region.h"
#include "base/tile-manager.h" #include "base/tile-manager.h"
#include "paint-funcs/paint-funcs.h"
#include "core/gimpchannel.h" #include "core/gimpchannel.h"
#include "core/gimpimage.h" #include "core/gimpimage.h"
#include "core/gimpimage-mask.h" #include "core/gimpimage-mask.h"
#include "core/gimplayer.h" #include "core/gimplayer.h"
#include "core/gimplayer-floating-sel.h"
#include "core/gimptoolinfo.h" #include "core/gimptoolinfo.h"
#include "widgets/gimpfontselection.h" #include "widgets/gimpfontselection.h"
@ -50,10 +51,8 @@
#include "gimptexttool.h" #include "gimptexttool.h"
#include "tool_options.h" #include "tool_options.h"
#include "floating_sel.h"
#include "undo.h"
#include "gimprc.h" #include "gimprc.h"
#include "undo.h"
#include "libgimp/gimpintl.h" #include "libgimp/gimpintl.h"

View File

@ -50,7 +50,6 @@
#include "tool_manager.h" #include "tool_manager.h"
#include "transform_options.h" #include "transform_options.h"
#include "floating_sel.h"
#include "gimpprogress.h" #include "gimpprogress.h"
#include "undo.h" #include "undo.h"
#include "path_transform.h" #include "path_transform.h"

View File

@ -43,6 +43,7 @@
#include "core/gimpimage-mask.h" #include "core/gimpimage-mask.h"
#include "core/gimpimage-projection.h" #include "core/gimpimage-projection.h"
#include "core/gimplayer.h" #include "core/gimplayer.h"
#include "core/gimplayer-floating-sel.h"
#include "core/gimplayermask.h" #include "core/gimplayermask.h"
#include "core/gimpparasite.h" #include "core/gimpparasite.h"
#include "core/gimpparasitelist.h" #include "core/gimpparasitelist.h"
@ -56,7 +57,6 @@
#include "tools/gimptransformtool.h" #include "tools/gimptransformtool.h"
#include "tools/tool_manager.h" #include "tools/tool_manager.h"
#include "floating_sel.h"
#include "path_transform.h" #include "path_transform.h"
#include "undo.h" #include "undo.h"

View File

@ -40,6 +40,7 @@
#include "core/gimpimage.h" #include "core/gimpimage.h"
#include "core/gimpimage-guides.h" #include "core/gimpimage-guides.h"
#include "core/gimplayer.h" #include "core/gimplayer.h"
#include "core/gimplayer-floating-sel.h"
#include "core/gimplayermask.h" #include "core/gimplayermask.h"
#include "core/gimpparasitelist.h" #include "core/gimpparasitelist.h"
#include "core/gimpunit.h" #include "core/gimpunit.h"
@ -49,7 +50,6 @@
#include "xcf-read.h" #include "xcf-read.h"
#include "xcf-seek.h" #include "xcf-seek.h"
#include "floating_sel.h"
#include "path.h" #include "path.h"
#include "pathP.h" #include "pathP.h"

View File

@ -37,6 +37,7 @@
#include "core/gimpimage.h" #include "core/gimpimage.h"
#include "core/gimpimage-mask.h" #include "core/gimpimage-mask.h"
#include "core/gimplayer.h" #include "core/gimplayer.h"
#include "core/gimplayer-floating-sel.h"
#include "core/gimplayermask.h" #include "core/gimplayermask.h"
#include "core/gimplist.h" #include "core/gimplist.h"
#include "core/gimpparasitelist.h" #include "core/gimpparasitelist.h"
@ -47,7 +48,6 @@
#include "xcf-seek.h" #include "xcf-seek.h"
#include "xcf-write.h" #include "xcf-write.h"
#include "floating_sel.h"
#include "path.h" #include "path.h"
#include "pathP.h" #include "pathP.h"

View File

@ -36,6 +36,7 @@
#include "core/gimpimage.h" #include "core/gimpimage.h"
#include "core/gimpimage-mask.h" #include "core/gimpimage-mask.h"
#include "core/gimpimage-mask-select.h" #include "core/gimpimage-mask-select.h"
#include "core/gimplayer-floating-sel.h"
#include "core/gimptoolinfo.h" #include "core/gimptoolinfo.h"
#include "display/gimpdisplay.h" #include "display/gimpdisplay.h"
@ -45,8 +46,6 @@
#include "gimpbrushselecttool.h" #include "gimpbrushselecttool.h"
#include "selection_options.h" #include "selection_options.h"
#include "floating_sel.h"
#include "libgimp/gimpintl.h" #include "libgimp/gimpintl.h"

View File

@ -1,3 +1,7 @@
2002-02-21 Michael Natterer <mitch@gimp.org>
* POTFILES.in: floating_sel.c -> core/gimplayer-floating-sel.c
2002-01-31 Stanislav Visnovsky <visnovsky@nenya.ms.mff.cuni.cz> 2002-01-31 Stanislav Visnovsky <visnovsky@nenya.ms.mff.cuni.cz>
* sk.po: Updated Slovak translation from Zdenko Podobny <zdpo@mailbox.sk>. * sk.po: Updated Slovak translation from Zdenko Podobny <zdpo@mailbox.sk>.

View File

@ -2,7 +2,6 @@
# marked to allow runtime translation of messages # marked to allow runtime translation of messages
app/app_procs.c app/app_procs.c
app/floating_sel.c
app/gimphelp.c app/gimphelp.c
app/gimpprogress.c app/gimpprogress.c
app/gimprc.c app/gimprc.c
@ -28,6 +27,7 @@ app/core/gimpimage-mask.c
app/core/gimpimage-new.c app/core/gimpimage-new.c
app/core/gimpimage.c app/core/gimpimage.c
app/core/gimplayer.c app/core/gimplayer.c
app/core/gimplayer-floating-sel.c
app/core/gimplayermask.c app/core/gimplayermask.c
app/core/gimppalette-import.c app/core/gimppalette-import.c
app/core/gimppalette.c app/core/gimppalette.c

View File

@ -28,7 +28,7 @@ sub invoke {
my @subname = split /::/, (caller 1)[3]; my @subname = split /::/, (caller 1)[3];
my $cmd = pop @subname; my $cmd = pop @subname;
%invoke = ( %invoke = (
headers => [ qw("floating_sel.h") ], headers => [ qw("core/gimplayer-floating-sel.h") ],
code => <<CODE code => <<CODE
{ {
if (gimp_layer_is_floating_sel (floating_sel)) if (gimp_layer_is_floating_sel (floating_sel))
@ -108,7 +108,7 @@ HELP
); );
%invoke = ( %invoke = (
headers => [ qw("floating_sel.h") ], headers => [ qw("core/gimplayer-floating-sel.h") ],
code => 'floating_sel_attach (layer, drawable);' code => 'floating_sel_attach (layer, drawable);'
); );
} }

View File

@ -41,7 +41,7 @@ sub layer_change_invoke {
while ($code =~ /^\t* {8}/m) { $code =~ s/^(\t*) {8}/$1\t/mg } while ($code =~ /^\t* {8}/m) { $code =~ s/^(\t*) {8}/$1\t/mg }
%invoke = ( %invoke = (
headers => [ qw("undo.h" "floating_sel.h") ], headers => [ qw("undo.h" "core/gimplayer-floating-sel.h") ],
vars => [ 'GimpImage *gimage', 'GimpLayer *floating_layer' ], vars => [ 'GimpImage *gimage', 'GimpLayer *floating_layer' ],
code => <<CODE code => <<CODE
{ {