1997-11-25 06:05:25 +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
|
1998-04-13 13:44:11 +08:00
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
1997-11-25 06:05:25 +08:00
|
|
|
*/
|
2000-10-23 17:05:45 +08:00
|
|
|
|
2000-02-16 21:52:33 +08:00
|
|
|
#include "config.h"
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
#include <stdlib.h>
|
1998-07-20 22:05:33 +08:00
|
|
|
#include <stdarg.h>
|
2000-02-29 03:25:42 +08:00
|
|
|
|
2000-12-17 05:37:03 +08:00
|
|
|
#include <gtk/gtk.h>
|
2000-02-29 03:25:42 +08:00
|
|
|
#include <gdk/gdkkeysyms.h>
|
|
|
|
|
2001-01-24 07:56:18 +08:00
|
|
|
#include "libgimpmath/gimpmath.h"
|
2001-05-21 21:58:46 +08:00
|
|
|
#include "libgimpbase/gimpbase.h"
|
2001-01-24 07:56:18 +08:00
|
|
|
|
2002-05-03 20:45:22 +08:00
|
|
|
#include "tools-types.h"
|
2000-12-17 05:37:03 +08:00
|
|
|
|
2001-05-15 19:25:25 +08:00
|
|
|
#include "base/boundary.h"
|
|
|
|
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "core/gimpimage.h"
|
include the new "paint-funcs/paint-funcs-types.h".
2001-11-28 Michael Natterer <mitch@gimp.org>
* app/base/base-types.h: include the new
"paint-funcs/paint-funcs-types.h".
* app/paint-funcs/Makefile.am
* app/paint-funcs/paint-funcs-types.h: new file. Includes
"base/base-types.h".
* app/paint-funcs/paint-funcs.[ch]: removed the enums here,
include "paint-funcs-types.h".
* app/widgets/widgets-types.h: include "display/display-types.h"
* app/display/display-types.h: include "widgets/widgets-types.h".
* app/tools/tools-types.h: include "display/display-types.h"
* app/gui/gui-types.h: include "tools/tools-types.h".
The order of namespaces/dependencies should be (but is not):
(base, paint-funcs) -> (core, file, xcf, pdb) ->
(widgets, display) -> tools -> gui
* app/path.c: include "tools/tools-types.h".
* app/core/Makefile.am
* app/core/gimpimage-guides.[ch]
* app/core/gimpimage-merge.[ch]
* app/core/gimpimage-resize.[ch]
* app/core/gimpimage-scale.[ch]: new files.
* app/core/gimpimage.[ch]: removed the stuff which is in the new
files. Reordered all functions in both the .h and .c files,
commented the groups of functions.
* app/core/gimpcontainer.c: create the handler_id using a counter,
not the address of a pointer, because the address *may* be the
same twice, added debugging output.
* app/core/gimpviewable.[ch]: added primitive support for getting
a preview GdkPixbuf.
* app/nav_window.c
* app/undo.c
* app/undo_history.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.[ch]
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-dnd.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/palette-import-dialog.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/widgets/gimpcontainerview-utils.c
* app/xcf/xcf-load.c: changed accordingly, some cleanup.
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/image.pdb: changed accordingly, reordered functions.
* app/plug_in.c: set the labels of the "Repeat" and "Re-Show" menu
items to the name of the last plug-in (Fixes #50986).
* app/display/gimpdisplayshell.[ch]: set the labels of "Undo" and
"Redo" to the resp. undo names. Much simplified the WM icon stuff
by removing most code and using gimp_viewable_get_new_preview_pixbuf().
* app/widgets/gimpbrushfactoryview.c: forgot to assign the GQuark
returned by gimp_container_add_handler().
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpimage_pdb.[ch]: regenerated.
2001-11-29 01:51:06 +08:00
|
|
|
#include "core/gimpimage-guides.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "core/gimpimage-mask.h"
|
2003-02-13 01:11:34 +08:00
|
|
|
#include "core/gimpimage-undo.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "core/gimplayer.h"
|
2002-02-22 06:19:45 +08:00
|
|
|
#include "core/gimplayer-floating-sel.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "core/gimplist.h"
|
2003-03-19 00:42:45 +08:00
|
|
|
#include "core/gimpundostack.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
|
2001-09-26 07:23:09 +08:00
|
|
|
#include "display/gimpdisplay.h"
|
2001-11-01 05:20:09 +08:00
|
|
|
#include "display/gimpdisplayshell.h"
|
2003-03-20 19:31:33 +08:00
|
|
|
#include "display/gimpdisplayshell-appearance.h"
|
2001-11-11 07:03:22 +08:00
|
|
|
#include "display/gimpdisplayshell-selection.h"
|
2003-01-04 02:01:30 +08:00
|
|
|
#include "display/gimpdisplayshell-transform.h"
|
2001-11-01 05:20:09 +08:00
|
|
|
|
|
|
|
#include "gimpdrawtool.h"
|
2003-04-16 00:05:52 +08:00
|
|
|
#include "gimpeditselectiontool.h"
|
|
|
|
#include "gimptoolcontrol.h"
|
2001-11-01 05:20:09 +08:00
|
|
|
#include "tool_manager.h"
|
2001-09-26 07:23:09 +08:00
|
|
|
|
2003-03-26 00:38:19 +08:00
|
|
|
#include "gimp-intl.h"
|
2000-12-29 23:22:01 +08:00
|
|
|
|
2000-10-23 17:05:45 +08:00
|
|
|
|
1999-07-03 01:40:10 +08:00
|
|
|
#define EDIT_SELECT_SCROLL_LOCK FALSE
|
1997-11-25 06:05:25 +08:00
|
|
|
#define ARROW_VELOCITY 25
|
|
|
|
|
2000-10-23 17:05:45 +08:00
|
|
|
|
2001-02-28 10:29:25 +08:00
|
|
|
#define GIMP_TYPE_EDIT_SELECTION_TOOL (gimp_edit_selection_tool_get_type ())
|
|
|
|
#define GIMP_EDIT_SELECTION_TOOL(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_EDIT_SELECTION_TOOL, GimpEditSelectionTool))
|
|
|
|
#define GIMP_EDIT_SELECTION_TOOL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_EDIT_SELECTION_TOOL, GimpEditSelectionToolClass))
|
2001-08-14 22:53:55 +08:00
|
|
|
#define GIMP_IS_EDIT_SELECTION_TOOL(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_EDIT_SELECTION_TOOL))
|
2001-02-28 10:29:25 +08:00
|
|
|
#define GIMP_IS_EDIT_SELECTION_TOOL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_EDIT_SELECTION_TOOL))
|
2000-12-29 23:22:01 +08:00
|
|
|
|
2001-02-28 10:29:25 +08:00
|
|
|
|
|
|
|
typedef struct _GimpEditSelectionTool GimpEditSelectionTool;
|
|
|
|
typedef struct _GimpEditSelectionToolClass GimpEditSelectionToolClass;
|
|
|
|
|
|
|
|
struct _GimpEditSelectionTool
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-02-28 10:29:25 +08:00
|
|
|
GimpDrawTool parent_instance;
|
|
|
|
|
2000-02-10 22:23:11 +08:00
|
|
|
gint origx, origy; /* last x and y coords */
|
|
|
|
gint cumlx, cumly; /* cumulative changes to x and yed */
|
|
|
|
gint x, y; /* current x and y coords */
|
2000-06-17 06:48:10 +08:00
|
|
|
gint num_segs_in; /* Num seg in selection boundary */
|
|
|
|
gint num_segs_out; /* Num seg in selection boundary */
|
2000-10-23 17:05:45 +08:00
|
|
|
BoundSeg *segs_in; /* Pointer to the channel sel. segs */
|
|
|
|
BoundSeg *segs_out; /* Pointer to the channel sel. segs */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-02-10 22:23:11 +08:00
|
|
|
gint x1, y1; /* bounding box of selection mask */
|
|
|
|
gint x2, y2;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-02-07 23:16:45 +08:00
|
|
|
EditType edit_type; /* translate the mask or layer? */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-11-05 22:39:04 +08:00
|
|
|
gboolean first_move; /* we undo_freeze after the first */
|
1997-11-25 06:05:25 +08:00
|
|
|
};
|
|
|
|
|
2001-02-28 10:29:25 +08:00
|
|
|
struct _GimpEditSelectionToolClass
|
|
|
|
{
|
|
|
|
GimpDrawToolClass parent_class;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2002-03-19 21:14:25 +08:00
|
|
|
static GType gimp_edit_selection_tool_get_type (void) G_GNUC_CONST;
|
2001-11-09 03:14:51 +08:00
|
|
|
|
|
|
|
static void gimp_edit_selection_tool_class_init (GimpEditSelectionToolClass *klass);
|
|
|
|
static void gimp_edit_selection_tool_init (GimpEditSelectionTool *edit_selection_tool);
|
|
|
|
|
|
|
|
static void gimp_edit_selection_tool_button_release (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp);
|
|
|
|
static void gimp_edit_selection_tool_motion (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp);
|
|
|
|
void gimp_edit_selection_tool_arrow_key (GimpTool *tool,
|
|
|
|
GdkEventKey *kevent,
|
|
|
|
GimpDisplay *gdisp);
|
|
|
|
|
|
|
|
static void gimp_edit_selection_tool_draw (GimpDrawTool *tool);
|
2001-02-28 10:29:25 +08:00
|
|
|
|
|
|
|
|
|
|
|
static GimpDrawToolClass *parent_class = NULL;
|
|
|
|
|
|
|
|
|
2002-03-19 21:14:25 +08:00
|
|
|
static GType
|
2001-02-28 10:29:25 +08:00
|
|
|
gimp_edit_selection_tool_get_type (void)
|
|
|
|
{
|
2001-08-14 22:53:55 +08:00
|
|
|
static GType tool_type = 0;
|
2001-02-28 10:29:25 +08:00
|
|
|
|
|
|
|
if (! tool_type)
|
|
|
|
{
|
2001-08-14 22:53:55 +08:00
|
|
|
static const GTypeInfo tool_info =
|
2001-02-28 10:29:25 +08:00
|
|
|
{
|
|
|
|
sizeof (GimpEditSelectionToolClass),
|
2001-08-14 22:53:55 +08:00
|
|
|
(GBaseInitFunc) NULL,
|
|
|
|
(GBaseFinalizeFunc) NULL,
|
|
|
|
(GClassInitFunc) gimp_edit_selection_tool_class_init,
|
|
|
|
NULL, /* class_finalize */
|
|
|
|
NULL, /* class_data */
|
|
|
|
sizeof (GimpEditSelectionTool),
|
|
|
|
0, /* n_preallocs */
|
|
|
|
(GInstanceInitFunc) gimp_edit_selection_tool_init,
|
2001-02-28 10:29:25 +08:00
|
|
|
};
|
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
tool_type = g_type_register_static (GIMP_TYPE_DRAW_TOOL,
|
2003-07-10 06:40:27 +08:00
|
|
|
"GimpEditSelectionTool",
|
2001-08-14 22:53:55 +08:00
|
|
|
&tool_info, 0);
|
2001-02-28 10:29:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return tool_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_edit_selection_tool_class_init (GimpEditSelectionToolClass *klass)
|
|
|
|
{
|
|
|
|
GimpToolClass *tool_class;
|
|
|
|
GimpDrawToolClass *draw_class;
|
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
tool_class = GIMP_TOOL_CLASS (klass);
|
|
|
|
draw_class = GIMP_DRAW_TOOL_CLASS (klass);
|
2001-02-28 10:29:25 +08:00
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-02-28 10:29:25 +08:00
|
|
|
tool_class->button_release = gimp_edit_selection_tool_button_release;
|
|
|
|
tool_class->motion = gimp_edit_selection_tool_motion;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-02-28 10:29:25 +08:00
|
|
|
draw_class->draw = gimp_edit_selection_tool_draw;
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
static void
|
2001-02-28 10:29:25 +08:00
|
|
|
gimp_edit_selection_tool_init (GimpEditSelectionTool *edit_selection_tool)
|
|
|
|
{
|
|
|
|
GimpTool *tool;
|
|
|
|
|
|
|
|
tool = GIMP_TOOL (edit_selection_tool);
|
|
|
|
|
2002-05-03 05:03:27 +08:00
|
|
|
gimp_tool_control_set_scroll_lock (tool->control, EDIT_SELECT_SCROLL_LOCK);
|
|
|
|
gimp_tool_control_set_motion_mode (tool->control, GIMP_MOTION_MODE_COMPRESS);
|
2002-03-29 11:50:29 +08:00
|
|
|
|
2001-02-28 10:29:25 +08:00
|
|
|
edit_selection_tool->origx = 0;
|
|
|
|
edit_selection_tool->origy = 0;
|
|
|
|
|
|
|
|
edit_selection_tool->cumlx = 0;
|
|
|
|
edit_selection_tool->cumly = 0;
|
|
|
|
|
|
|
|
edit_selection_tool->first_move = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-05-06 02:45:58 +08:00
|
|
|
gimp_edit_selection_tool_calc_coords (GimpEditSelectionTool *edit_select,
|
|
|
|
GimpDisplay *gdisp,
|
|
|
|
gdouble x,
|
|
|
|
gdouble y)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-03-20 19:31:33 +08:00
|
|
|
GimpDisplayShell *shell;
|
|
|
|
gdouble x1, y1;
|
|
|
|
gdouble dx, dy;
|
|
|
|
|
|
|
|
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-02-28 10:29:25 +08:00
|
|
|
dx = x - edit_select->origx;
|
|
|
|
dy = y - edit_select->origy;
|
2003-07-10 06:40:27 +08:00
|
|
|
|
2001-02-28 10:29:25 +08:00
|
|
|
x1 = edit_select->x1 + dx;
|
|
|
|
y1 = edit_select->y1 + dy;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-05-06 02:45:58 +08:00
|
|
|
edit_select->x = (gint) floor (x1) - (edit_select->x1 - edit_select->origx);
|
|
|
|
edit_select->y = (gint) floor (y1) - (edit_select->y1 - edit_select->origy);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2001-11-09 03:14:51 +08:00
|
|
|
init_edit_selection (GimpTool *tool,
|
|
|
|
GimpDisplay *gdisp,
|
|
|
|
GimpCoords *coords,
|
|
|
|
EditType edit_type)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-02-28 10:29:25 +08:00
|
|
|
GimpEditSelectionTool *edit_select;
|
2001-11-01 05:20:09 +08:00
|
|
|
GimpDisplayShell *shell;
|
2003-04-17 10:57:33 +08:00
|
|
|
GimpDrawable *active_drawable;
|
2001-11-09 03:14:51 +08:00
|
|
|
gint off_x, off_y;
|
2003-03-20 00:58:17 +08:00
|
|
|
const gchar *undo_desc;
|
2001-02-28 10:29:25 +08:00
|
|
|
|
2001-08-10 22:41:39 +08:00
|
|
|
edit_select = g_object_new (GIMP_TYPE_EDIT_SELECTION_TOOL, NULL);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-11-01 05:20:09 +08:00
|
|
|
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* Make a check to see if it should be a floating selection translation */
|
2000-12-29 23:22:01 +08:00
|
|
|
if (edit_type == EDIT_MASK_TO_LAYER_TRANSLATE &&
|
|
|
|
gimp_image_floating_sel (gdisp->gimage))
|
2001-02-28 10:29:25 +08:00
|
|
|
{
|
|
|
|
edit_type = EDIT_FLOATING_SEL_TRANSLATE;
|
|
|
|
}
|
1999-05-05 17:10:35 +08:00
|
|
|
|
2000-10-23 17:05:45 +08:00
|
|
|
if (edit_type == EDIT_LAYER_TRANSLATE)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-02-28 10:29:25 +08:00
|
|
|
GimpLayer *layer;
|
|
|
|
|
2000-12-29 23:22:01 +08:00
|
|
|
layer = gimp_image_get_active_layer (gdisp->gimage);
|
2001-02-28 10:29:25 +08:00
|
|
|
|
2001-01-29 07:25:25 +08:00
|
|
|
if (gimp_layer_is_floating_sel (layer))
|
2000-10-23 17:05:45 +08:00
|
|
|
edit_type = EDIT_FLOATING_SEL_TRANSLATE;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2003-03-20 00:58:17 +08:00
|
|
|
if (edit_type == EDIT_MASK_TRANSLATE)
|
2003-04-07 17:31:28 +08:00
|
|
|
undo_desc = _("Move Selection");
|
2003-03-20 00:58:17 +08:00
|
|
|
else if (edit_type == EDIT_LAYER_TRANSLATE)
|
|
|
|
undo_desc = _("Move Layer");
|
|
|
|
else
|
|
|
|
undo_desc = _("Move Floating Layer");
|
|
|
|
|
|
|
|
gimp_image_undo_group_start (gdisp->gimage,
|
|
|
|
edit_type == EDIT_MASK_TRANSLATE ?
|
|
|
|
GIMP_UNDO_GROUP_MASK :
|
2003-05-09 04:26:01 +08:00
|
|
|
GIMP_UNDO_GROUP_ITEM_DISPLACE,
|
2003-03-20 00:58:17 +08:00
|
|
|
undo_desc);
|
|
|
|
|
2003-04-17 10:57:33 +08:00
|
|
|
active_drawable = gimp_image_active_drawable (gdisp->gimage);
|
|
|
|
|
2003-05-08 22:06:03 +08:00
|
|
|
gimp_item_offsets (GIMP_ITEM (active_drawable), &off_x, &off_y);
|
2003-03-20 00:58:17 +08:00
|
|
|
|
2001-02-28 10:29:25 +08:00
|
|
|
edit_select->edit_type = edit_type;
|
1999-11-05 22:39:04 +08:00
|
|
|
|
2003-03-20 00:58:17 +08:00
|
|
|
edit_select->x = edit_select->origx = coords->x - off_x;
|
|
|
|
edit_select->y = edit_select->origy = coords->y - off_y;
|
|
|
|
|
|
|
|
gimp_image_mask_boundary (gdisp->gimage,
|
|
|
|
&edit_select->segs_in,
|
|
|
|
&edit_select->segs_out,
|
|
|
|
&edit_select->num_segs_in,
|
|
|
|
&edit_select->num_segs_out);
|
|
|
|
|
2003-04-13 19:43:47 +08:00
|
|
|
edit_select->segs_in = g_memdup (edit_select->segs_in,
|
|
|
|
edit_select->num_segs_in *
|
|
|
|
sizeof (BoundSeg));
|
|
|
|
edit_select->segs_out = g_memdup (edit_select->segs_out,
|
|
|
|
edit_select->num_segs_out *
|
|
|
|
sizeof (BoundSeg));
|
|
|
|
|
1999-03-21 23:38:11 +08:00
|
|
|
/* find the bounding box of the selection mask -
|
2000-10-23 17:05:45 +08:00
|
|
|
* this is used for the case of a EDIT_MASK_TO_LAYER_TRANSLATE,
|
1997-11-25 06:05:25 +08:00
|
|
|
* where the translation will result in floating the selection
|
|
|
|
* mask and translating the resulting layer
|
|
|
|
*/
|
2003-04-17 10:57:33 +08:00
|
|
|
gimp_drawable_mask_bounds (active_drawable,
|
2001-02-28 10:29:25 +08:00
|
|
|
&edit_select->x1, &edit_select->y1,
|
|
|
|
&edit_select->x2, &edit_select->y2);
|
|
|
|
|
2003-05-06 02:45:58 +08:00
|
|
|
gimp_edit_selection_tool_calc_coords (edit_select, gdisp,
|
|
|
|
edit_select->origx,
|
|
|
|
edit_select->origy);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-04-17 10:57:33 +08:00
|
|
|
{
|
|
|
|
gint x1, y1, x2, y2;
|
|
|
|
|
|
|
|
switch (edit_select->edit_type)
|
|
|
|
{
|
|
|
|
case EDIT_MASK_TRANSLATE:
|
|
|
|
gimp_image_mask_bounds (gdisp->gimage, &x1, &y1, &x2, &y2);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EDIT_MASK_TO_LAYER_TRANSLATE:
|
2003-05-16 20:10:47 +08:00
|
|
|
case EDIT_MASK_COPY_TO_LAYER_TRANSLATE:
|
2003-04-17 10:57:33 +08:00
|
|
|
x1 = edit_select->x1 + off_x;
|
|
|
|
y1 = edit_select->y1 + off_y;
|
|
|
|
x2 = edit_select->x2 + off_x;
|
|
|
|
y2 = edit_select->y2 + off_y;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EDIT_LAYER_TRANSLATE:
|
|
|
|
case EDIT_FLOATING_SEL_TRANSLATE:
|
2003-05-09 21:05:37 +08:00
|
|
|
x1 = off_x;
|
|
|
|
y1 = off_y;
|
|
|
|
x2 = x1 + gimp_item_width (GIMP_ITEM (active_drawable));
|
|
|
|
y2 = y1 + gimp_item_height (GIMP_ITEM (active_drawable));
|
|
|
|
|
|
|
|
if (gimp_item_get_linked (GIMP_ITEM (active_drawable)))
|
|
|
|
{
|
|
|
|
GList *list;
|
|
|
|
|
|
|
|
/* Expand the rectangle to include all linked layers as well */
|
|
|
|
for (list = GIMP_LIST (gdisp->gimage->layers)->list;
|
|
|
|
list;
|
|
|
|
list = g_list_next (list))
|
|
|
|
{
|
|
|
|
GimpItem *item = list->data;
|
|
|
|
|
|
|
|
if ((item != (GimpItem *) active_drawable) &&
|
|
|
|
gimp_item_get_linked (item))
|
|
|
|
{
|
|
|
|
gint x3, y3, x4, y4;
|
2003-04-17 10:57:33 +08:00
|
|
|
|
2003-05-09 21:05:37 +08:00
|
|
|
gimp_item_offsets (item, &x3, &y3);
|
2003-04-17 10:57:33 +08:00
|
|
|
|
2003-05-09 21:05:37 +08:00
|
|
|
x4 = x3 + gimp_item_width (item);
|
|
|
|
y4 = y3 + gimp_item_height (item);
|
2003-04-17 10:57:33 +08:00
|
|
|
|
2003-05-09 21:05:37 +08:00
|
|
|
if (x3 < x1)
|
|
|
|
x1 = x3;
|
|
|
|
if (y3 < y1)
|
|
|
|
y1 = y3;
|
|
|
|
if (x4 > x2)
|
|
|
|
x2 = x4;
|
|
|
|
if (y4 > y2)
|
|
|
|
y2 = y4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2003-04-17 10:57:33 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
gimp_tool_control_set_snap_offsets (GIMP_TOOL (edit_select)->control,
|
|
|
|
x1 - coords->x,
|
|
|
|
y1 - coords->y,
|
|
|
|
x2 - x1,
|
|
|
|
y2 - y1);
|
|
|
|
}
|
|
|
|
|
2002-05-03 19:31:08 +08:00
|
|
|
gimp_tool_control_activate (GIMP_TOOL (edit_select)->control);
|
2002-06-27 06:16:59 +08:00
|
|
|
GIMP_TOOL (edit_select)->gdisp = gdisp;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_object_ref (edit_select);
|
2001-02-28 10:29:25 +08:00
|
|
|
|
2001-07-08 01:36:00 +08:00
|
|
|
tool_manager_push_tool (gdisp->gimage->gimp,
|
|
|
|
GIMP_TOOL (edit_select));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* pause the current selection */
|
2002-02-03 20:10:23 +08:00
|
|
|
gimp_display_shell_selection_visibility (shell, GIMP_SELECTION_PAUSE);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1998-07-24 02:33:01 +08:00
|
|
|
/* initialize the statusbar display */
|
2002-02-03 20:10:23 +08:00
|
|
|
gimp_tool_push_status (tool, _("Move: 0, 0"));
|
|
|
|
|
|
|
|
gimp_draw_tool_start (GIMP_DRAW_TOOL (edit_select), gdisp);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-02-28 10:29:25 +08:00
|
|
|
static void
|
2001-11-09 03:14:51 +08:00
|
|
|
gimp_edit_selection_tool_button_release (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-02-28 10:29:25 +08:00
|
|
|
GimpEditSelectionTool *edit_select;
|
2001-11-01 05:20:09 +08:00
|
|
|
GimpDisplayShell *shell;
|
2001-02-28 10:29:25 +08:00
|
|
|
GimpLayer *layer;
|
|
|
|
|
|
|
|
edit_select = GIMP_EDIT_SELECTION_TOOL (tool);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-11-01 05:20:09 +08:00
|
|
|
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
|
|
|
|
2002-02-05 19:35:03 +08:00
|
|
|
/* resume the current selection */
|
2001-11-11 07:03:22 +08:00
|
|
|
gimp_display_shell_selection_visibility (shell, GIMP_SELECTION_RESUME);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-02-03 20:10:23 +08:00
|
|
|
gimp_tool_pop_status (tool);
|
1998-07-24 02:33:01 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* Stop and free the selection core */
|
2001-02-28 10:29:25 +08:00
|
|
|
gimp_draw_tool_stop (GIMP_DRAW_TOOL (edit_select));
|
|
|
|
|
2001-07-08 01:36:00 +08:00
|
|
|
tool_manager_pop_tool (gdisp->gimage->gimp);
|
2001-02-28 10:29:25 +08:00
|
|
|
|
2000-10-23 17:05:45 +08:00
|
|
|
/* EDIT_MASK_TRANSLATE is performed here at movement end, not 'live' like
|
1999-12-18 04:59:37 +08:00
|
|
|
* the other translation types.
|
|
|
|
*/
|
2001-02-28 10:29:25 +08:00
|
|
|
if (edit_select->edit_type == EDIT_MASK_TRANSLATE)
|
2000-02-10 22:23:11 +08:00
|
|
|
{
|
2003-05-06 02:45:58 +08:00
|
|
|
gimp_edit_selection_tool_calc_coords (edit_select,
|
|
|
|
gdisp,
|
|
|
|
coords->x,
|
|
|
|
coords->y);
|
2001-02-28 10:29:25 +08:00
|
|
|
|
2000-02-10 22:23:11 +08:00
|
|
|
/* move the selection -- whether there has been net movement or not!
|
|
|
|
* (to ensure that there's something on the undo stack)
|
|
|
|
*/
|
2001-11-29 06:42:19 +08:00
|
|
|
gimp_image_mask_translate (gdisp->gimage,
|
|
|
|
edit_select->cumlx,
|
2003-03-19 00:42:45 +08:00
|
|
|
edit_select->cumly,
|
|
|
|
TRUE);
|
2001-02-28 10:29:25 +08:00
|
|
|
|
|
|
|
if (edit_select->first_move)
|
2000-02-10 22:23:11 +08:00
|
|
|
{
|
|
|
|
gimp_image_undo_freeze (gdisp->gimage);
|
2001-02-28 10:29:25 +08:00
|
|
|
edit_select->first_move = FALSE;
|
2000-02-10 22:23:11 +08:00
|
|
|
}
|
|
|
|
}
|
2001-02-28 10:29:25 +08:00
|
|
|
|
1999-11-05 22:39:04 +08:00
|
|
|
/* thaw the undo again */
|
|
|
|
gimp_image_undo_thaw (gdisp->gimage);
|
|
|
|
|
2003-04-10 00:29:58 +08:00
|
|
|
if (edit_select->cumlx != 0 || edit_select->cumly != 0)
|
1999-04-25 04:58:55 +08:00
|
|
|
{
|
2000-12-29 23:22:01 +08:00
|
|
|
layer = gimp_image_get_active_layer (gdisp->gimage);
|
2001-02-05 06:10:54 +08:00
|
|
|
|
2003-05-09 21:05:37 +08:00
|
|
|
if (! (state & GDK_BUTTON3_MASK) &&
|
|
|
|
edit_select->edit_type == EDIT_LAYER_TRANSLATE &&
|
|
|
|
gimp_item_get_linked (GIMP_ITEM (layer)))
|
|
|
|
{
|
|
|
|
GList *list;
|
|
|
|
GimpItem *item;
|
|
|
|
|
|
|
|
/* translate all linked channels and vectors as well */
|
|
|
|
for (list = GIMP_LIST (gdisp->gimage->channels)->list;
|
|
|
|
list;
|
|
|
|
list = g_list_next (list))
|
|
|
|
{
|
|
|
|
item = (GimpItem *) list->data;
|
|
|
|
|
|
|
|
if (gimp_item_get_linked (item))
|
|
|
|
gimp_item_translate (item,
|
|
|
|
edit_select->cumlx,
|
|
|
|
edit_select->cumly,
|
|
|
|
TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (list = GIMP_LIST (gdisp->gimage->vectors)->list;
|
|
|
|
list;
|
|
|
|
list = g_list_next (list))
|
|
|
|
{
|
|
|
|
item = (GimpItem *) list->data;
|
|
|
|
|
|
|
|
if (gimp_item_get_linked (item))
|
|
|
|
gimp_item_translate (item,
|
|
|
|
edit_select->cumlx,
|
|
|
|
edit_select->cumly,
|
|
|
|
TRUE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-02-05 06:10:54 +08:00
|
|
|
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (layer));
|
1999-10-19 04:55:25 +08:00
|
|
|
}
|
2001-02-28 10:29:25 +08:00
|
|
|
|
2003-02-13 19:23:50 +08:00
|
|
|
gimp_image_undo_group_end (gdisp->gimage);
|
1999-03-21 23:38:11 +08:00
|
|
|
|
2001-11-09 03:14:51 +08:00
|
|
|
if (state & GDK_BUTTON3_MASK) /* OPERATION CANCELLED */
|
1999-03-21 23:38:11 +08:00
|
|
|
{
|
|
|
|
/* Operation cancelled - undo the undo-group! */
|
2003-02-13 01:11:34 +08:00
|
|
|
gimp_image_undo (gdisp->gimage);
|
1999-03-21 23:38:11 +08:00
|
|
|
}
|
|
|
|
|
2002-05-09 01:48:24 +08:00
|
|
|
gimp_image_flush (gdisp->gimage);
|
2001-02-28 10:29:25 +08:00
|
|
|
|
2003-04-13 19:43:47 +08:00
|
|
|
g_free (edit_select->segs_in);
|
|
|
|
g_free (edit_select->segs_out);
|
|
|
|
|
|
|
|
edit_select->segs_in = NULL;
|
|
|
|
edit_select->segs_out = NULL;
|
|
|
|
edit_select->num_segs_in = 0;
|
|
|
|
edit_select->num_segs_out = 0;
|
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_object_unref (edit_select);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-02-28 10:29:25 +08:00
|
|
|
static void
|
2001-11-09 03:14:51 +08:00
|
|
|
gimp_edit_selection_tool_motion (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-02-28 10:29:25 +08:00
|
|
|
GimpEditSelectionTool *edit_select;
|
2001-11-01 05:20:09 +08:00
|
|
|
GimpDisplayShell *shell;
|
2003-05-08 22:06:03 +08:00
|
|
|
gint off_x, off_y;
|
2002-03-19 21:14:25 +08:00
|
|
|
gdouble motion_x, motion_y;
|
2001-02-28 10:29:25 +08:00
|
|
|
|
|
|
|
edit_select = GIMP_EDIT_SELECTION_TOOL (tool);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-11-01 05:20:09 +08:00
|
|
|
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
|
|
|
|
2000-10-23 17:05:45 +08:00
|
|
|
gdk_flush ();
|
1999-02-07 23:16:45 +08:00
|
|
|
|
2001-02-28 10:29:25 +08:00
|
|
|
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-05-08 22:06:03 +08:00
|
|
|
gimp_item_offsets (GIMP_ITEM (gimp_image_active_drawable (gdisp->gimage)),
|
|
|
|
&off_x, &off_y);
|
2001-11-09 03:14:51 +08:00
|
|
|
|
2003-05-08 22:06:03 +08:00
|
|
|
motion_x = coords->x - off_x;
|
|
|
|
motion_y = coords->y - off_y;
|
2000-02-29 03:25:42 +08:00
|
|
|
|
|
|
|
/* now do the actual move. */
|
|
|
|
|
2003-05-06 02:45:58 +08:00
|
|
|
gimp_edit_selection_tool_calc_coords (edit_select,
|
|
|
|
gdisp,
|
|
|
|
motion_x,
|
|
|
|
motion_y);
|
2000-02-29 03:25:42 +08:00
|
|
|
|
|
|
|
/******************************************* adam's live move *******/
|
1999-03-21 23:38:11 +08:00
|
|
|
/********************************************************************/
|
|
|
|
{
|
2003-05-09 21:05:37 +08:00
|
|
|
gint x, y;
|
1999-03-21 23:38:11 +08:00
|
|
|
|
2001-02-28 10:29:25 +08:00
|
|
|
x = edit_select->x;
|
|
|
|
y = edit_select->y;
|
1999-03-21 23:38:11 +08:00
|
|
|
|
|
|
|
/* if there has been movement, move the selection */
|
2001-02-28 10:29:25 +08:00
|
|
|
if (edit_select->origx != x || edit_select->origy != y)
|
1999-03-21 23:38:11 +08:00
|
|
|
{
|
|
|
|
gint xoffset, yoffset;
|
2003-07-10 06:40:27 +08:00
|
|
|
|
2001-02-28 10:29:25 +08:00
|
|
|
xoffset = x - edit_select->origx;
|
|
|
|
yoffset = y - edit_select->origy;
|
1999-03-21 23:38:11 +08:00
|
|
|
|
2001-02-28 10:29:25 +08:00
|
|
|
edit_select->cumlx += xoffset;
|
|
|
|
edit_select->cumly += yoffset;
|
1999-03-21 23:38:11 +08:00
|
|
|
|
2001-02-28 10:29:25 +08:00
|
|
|
switch (edit_select->edit_type)
|
1999-03-21 23:38:11 +08:00
|
|
|
{
|
2000-10-23 17:05:45 +08:00
|
|
|
case EDIT_MASK_TRANSLATE:
|
1999-12-18 04:59:37 +08:00
|
|
|
/* we don't do the actual edit selection move here. */
|
2001-02-28 10:29:25 +08:00
|
|
|
edit_select->origx = x;
|
|
|
|
edit_select->origy = y;
|
1999-03-21 23:38:11 +08:00
|
|
|
break;
|
2001-11-09 03:14:51 +08:00
|
|
|
|
2000-10-23 17:05:45 +08:00
|
|
|
case EDIT_LAYER_TRANSLATE:
|
2003-05-09 21:05:37 +08:00
|
|
|
{
|
|
|
|
GimpLayer *floating_layer;
|
|
|
|
GimpItem *active_item;
|
2003-03-20 00:58:17 +08:00
|
|
|
|
2003-05-09 21:05:37 +08:00
|
|
|
floating_layer = gimp_image_floating_sel (gdisp->gimage);
|
|
|
|
active_item = GIMP_ITEM (gdisp->gimage->active_layer);
|
2001-11-09 03:14:51 +08:00
|
|
|
|
2003-05-09 21:05:37 +08:00
|
|
|
if (floating_layer)
|
|
|
|
floating_sel_relax (floating_layer, TRUE);
|
2001-11-09 03:14:51 +08:00
|
|
|
|
2003-05-09 21:05:37 +08:00
|
|
|
gimp_item_translate (active_item, xoffset, yoffset, TRUE);
|
1999-11-05 22:39:04 +08:00
|
|
|
|
2003-05-09 21:05:37 +08:00
|
|
|
if (gimp_item_get_linked (active_item))
|
|
|
|
{
|
|
|
|
GList *list;
|
|
|
|
|
|
|
|
/* translate all linked items as well */
|
|
|
|
for (list = GIMP_LIST (gdisp->gimage->layers)->list;
|
|
|
|
list;
|
|
|
|
list = g_list_next (list))
|
|
|
|
{
|
|
|
|
GimpItem *item = list->data;
|
|
|
|
|
|
|
|
if (item != active_item && gimp_item_get_linked (item))
|
|
|
|
gimp_item_translate (item, xoffset, yoffset, TRUE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (floating_layer)
|
|
|
|
floating_sel_rigor (floating_layer, TRUE);
|
|
|
|
|
|
|
|
if (edit_select->first_move)
|
|
|
|
{
|
|
|
|
gimp_image_undo_freeze (gdisp->gimage);
|
|
|
|
edit_select->first_move = FALSE;
|
|
|
|
}
|
|
|
|
}
|
1999-03-21 23:38:11 +08:00
|
|
|
break;
|
2001-11-09 03:14:51 +08:00
|
|
|
|
2000-10-23 17:05:45 +08:00
|
|
|
case EDIT_MASK_TO_LAYER_TRANSLATE:
|
2003-05-16 20:10:47 +08:00
|
|
|
case EDIT_MASK_COPY_TO_LAYER_TRANSLATE:
|
2003-07-10 06:40:27 +08:00
|
|
|
if (! gimp_image_mask_float (gdisp->gimage,
|
2001-11-29 06:42:19 +08:00
|
|
|
gimp_image_active_drawable (gdisp->gimage),
|
2003-05-16 20:10:47 +08:00
|
|
|
edit_select->edit_type ==
|
|
|
|
EDIT_MASK_TO_LAYER_TRANSLATE,
|
2001-11-29 06:42:19 +08:00
|
|
|
0, 0))
|
2000-02-10 22:43:51 +08:00
|
|
|
{
|
|
|
|
/* no region to float, abort safely */
|
2001-02-28 10:29:25 +08:00
|
|
|
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
|
|
|
|
|
|
|
|
return;
|
2000-02-10 22:43:51 +08:00
|
|
|
}
|
2000-02-10 22:23:11 +08:00
|
|
|
|
2003-03-20 00:58:17 +08:00
|
|
|
/* this is always the first move, since we switch to
|
|
|
|
* EDIT_FLOATING_SEL_TRANSLATE when finished here
|
|
|
|
*/
|
2000-02-10 22:23:11 +08:00
|
|
|
gimp_image_undo_freeze (gdisp->gimage);
|
2003-07-10 06:40:27 +08:00
|
|
|
edit_select->first_move = FALSE;
|
1999-04-25 04:58:55 +08:00
|
|
|
|
2001-02-28 10:29:25 +08:00
|
|
|
edit_select->origx -= edit_select->x1;
|
|
|
|
edit_select->origy -= edit_select->y1;
|
|
|
|
edit_select->x2 -= edit_select->x1;
|
|
|
|
edit_select->y2 -= edit_select->y1;
|
|
|
|
edit_select->x1 = 0;
|
|
|
|
edit_select->y1 = 0;
|
2000-02-10 22:23:11 +08:00
|
|
|
|
2001-02-28 10:29:25 +08:00
|
|
|
edit_select->edit_type = EDIT_FLOATING_SEL_TRANSLATE;
|
2003-04-07 17:31:28 +08:00
|
|
|
|
|
|
|
/* fall through */
|
2001-11-09 03:14:51 +08:00
|
|
|
|
2000-10-23 17:05:45 +08:00
|
|
|
case EDIT_FLOATING_SEL_TRANSLATE:
|
2003-05-09 21:05:37 +08:00
|
|
|
{
|
|
|
|
GimpLayer *layer = gimp_image_get_active_layer (gdisp->gimage);
|
2001-11-09 03:14:51 +08:00
|
|
|
|
2003-05-09 21:05:37 +08:00
|
|
|
floating_sel_relax (layer, TRUE);
|
|
|
|
gimp_item_translate (GIMP_ITEM (layer), xoffset, yoffset, TRUE);
|
|
|
|
floating_sel_rigor (layer, TRUE);
|
1999-03-21 23:38:11 +08:00
|
|
|
|
2003-05-09 21:05:37 +08:00
|
|
|
if (edit_select->first_move)
|
|
|
|
{
|
|
|
|
gimp_image_undo_freeze (gdisp->gimage);
|
|
|
|
edit_select->first_move = FALSE;
|
|
|
|
}
|
|
|
|
}
|
1999-03-21 23:38:11 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
g_warning ("esm / BAD FALLTHROUGH");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-11-11 07:03:22 +08:00
|
|
|
gimp_display_flush (gdisp);
|
1999-03-21 23:38:11 +08:00
|
|
|
}
|
|
|
|
/********************************************************************/
|
|
|
|
/********************************************************************/
|
1999-02-07 23:16:45 +08:00
|
|
|
|
2002-02-03 20:10:23 +08:00
|
|
|
gimp_tool_pop_status (tool);
|
2001-02-28 10:29:25 +08:00
|
|
|
|
2002-02-03 20:10:23 +08:00
|
|
|
gimp_tool_push_status_coords (tool,
|
|
|
|
_("Move: "),
|
|
|
|
edit_select->cumlx,
|
|
|
|
", ",
|
|
|
|
edit_select->cumly);
|
1998-07-24 02:33:01 +08:00
|
|
|
|
2001-02-28 10:29:25 +08:00
|
|
|
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2001-02-28 10:29:25 +08:00
|
|
|
static void
|
|
|
|
gimp_edit_selection_tool_draw (GimpDrawTool *draw_tool)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-02-28 10:29:25 +08:00
|
|
|
GimpEditSelectionTool *edit_select;
|
|
|
|
GimpTool *tool;
|
2001-10-29 19:47:11 +08:00
|
|
|
GimpDisplay *gdisp;
|
2003-07-10 06:40:27 +08:00
|
|
|
GimpDisplayShell *shell;
|
2001-02-28 10:29:25 +08:00
|
|
|
Selection *select;
|
|
|
|
|
|
|
|
edit_select = GIMP_EDIT_SELECTION_TOOL (draw_tool);
|
|
|
|
tool = GIMP_TOOL (draw_tool);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-12-31 12:07:42 +08:00
|
|
|
gdisp = tool->gdisp;
|
2003-07-10 06:40:27 +08:00
|
|
|
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
|
|
|
select = shell->select;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-02-28 10:29:25 +08:00
|
|
|
switch (edit_select->edit_type)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-10-23 17:05:45 +08:00
|
|
|
case EDIT_MASK_TRANSLATE:
|
2003-05-09 21:05:37 +08:00
|
|
|
{
|
|
|
|
GimpLayer *layer = gimp_image_get_active_layer (gdisp->gimage);
|
|
|
|
gboolean floating_sel = gimp_layer_is_floating_sel (layer);
|
|
|
|
GdkSegment *segs_copy;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-05-09 21:05:37 +08:00
|
|
|
if (! floating_sel)
|
|
|
|
{
|
2003-07-10 06:40:27 +08:00
|
|
|
segs_copy =
|
|
|
|
gimp_display_shell_transform_boundary (shell,
|
|
|
|
edit_select->segs_in,
|
|
|
|
edit_select->num_segs_in,
|
|
|
|
edit_select->cumlx,
|
|
|
|
edit_select->cumly);
|
2001-02-28 10:29:25 +08:00
|
|
|
|
2003-05-09 21:05:37 +08:00
|
|
|
/* Draw the items */
|
|
|
|
gdk_draw_segments (draw_tool->win, draw_tool->gc,
|
|
|
|
segs_copy, select->num_segs_in);
|
2001-11-09 03:14:51 +08:00
|
|
|
|
2003-05-09 21:05:37 +08:00
|
|
|
g_free (segs_copy);
|
|
|
|
}
|
1999-03-21 23:38:11 +08:00
|
|
|
|
2003-07-10 06:40:27 +08:00
|
|
|
segs_copy =
|
|
|
|
gimp_display_shell_transform_boundary (shell,
|
|
|
|
edit_select->segs_out,
|
|
|
|
edit_select->num_segs_out,
|
|
|
|
edit_select->cumlx,
|
|
|
|
edit_select->cumly);
|
2001-02-28 10:29:25 +08:00
|
|
|
|
2003-05-09 21:05:37 +08:00
|
|
|
/* Draw the items */
|
|
|
|
gdk_draw_segments (draw_tool->win, draw_tool->gc,
|
|
|
|
segs_copy, select->num_segs_out);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-05-09 21:05:37 +08:00
|
|
|
g_free (segs_copy);
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
|
2000-10-23 17:05:45 +08:00
|
|
|
case EDIT_MASK_TO_LAYER_TRANSLATE:
|
2003-05-16 20:10:47 +08:00
|
|
|
case EDIT_MASK_COPY_TO_LAYER_TRANSLATE:
|
2001-11-12 22:45:58 +08:00
|
|
|
gimp_draw_tool_draw_rectangle (draw_tool,
|
|
|
|
FALSE,
|
|
|
|
edit_select->x1,
|
|
|
|
edit_select->y1,
|
|
|
|
edit_select->x2 - edit_select->x1,
|
|
|
|
edit_select->y2 - edit_select->y1,
|
|
|
|
TRUE);
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
|
2000-10-23 17:05:45 +08:00
|
|
|
case EDIT_LAYER_TRANSLATE:
|
2003-05-09 21:05:37 +08:00
|
|
|
{
|
|
|
|
GimpItem *active_item;
|
|
|
|
gint x1, y1, x2, y2;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-05-09 21:05:37 +08:00
|
|
|
active_item = GIMP_ITEM (gdisp->gimage->active_layer);
|
2001-02-19 21:06:09 +08:00
|
|
|
|
2003-05-09 21:05:37 +08:00
|
|
|
gimp_item_offsets (active_item, &x1, &y1);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-05-09 21:05:37 +08:00
|
|
|
x2 = x1 + gimp_item_width (active_item);
|
|
|
|
y2 = y1 + gimp_item_height (active_item);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-05-09 21:05:37 +08:00
|
|
|
if (gimp_item_get_linked (active_item))
|
|
|
|
{
|
|
|
|
GList *list;
|
2000-06-14 05:44:48 +08:00
|
|
|
|
2003-05-09 21:05:37 +08:00
|
|
|
/* Expand the rectangle to include all linked layers as well */
|
|
|
|
for (list = GIMP_LIST (gdisp->gimage->layers)->list;
|
|
|
|
list;
|
|
|
|
list = g_list_next (list))
|
|
|
|
{
|
|
|
|
GimpItem *item = list->data;
|
2000-02-10 22:43:51 +08:00
|
|
|
|
2003-05-09 21:05:37 +08:00
|
|
|
if (item != active_item && gimp_item_get_linked (item))
|
|
|
|
{
|
|
|
|
gint x3, y3, x4, y4;
|
2001-02-28 10:29:25 +08:00
|
|
|
|
2003-05-09 21:05:37 +08:00
|
|
|
gimp_item_offsets (item, &x3, &y3);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-05-09 21:05:37 +08:00
|
|
|
x4 = x3 + gimp_item_width (item);
|
|
|
|
y4 = y3 + gimp_item_height (item);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-05-09 21:05:37 +08:00
|
|
|
if (x3 < x1)
|
|
|
|
x1 = x3;
|
|
|
|
if (y3 < y1)
|
|
|
|
y1 = y3;
|
|
|
|
if (x4 > x2)
|
|
|
|
x2 = x4;
|
|
|
|
if (y4 > y2)
|
|
|
|
y2 = y4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1999-06-22 06:12:07 +08:00
|
|
|
|
2003-05-09 21:05:37 +08:00
|
|
|
gimp_draw_tool_draw_rectangle (draw_tool,
|
|
|
|
FALSE,
|
|
|
|
x1, y1,
|
|
|
|
x2 - x1, y2 - y1,
|
|
|
|
FALSE);
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
1999-06-22 06:12:07 +08:00
|
|
|
|
2003-05-09 21:05:37 +08:00
|
|
|
case EDIT_FLOATING_SEL_TRANSLATE:
|
|
|
|
{
|
2003-07-10 06:40:27 +08:00
|
|
|
GdkSegment *segs_copy;
|
2003-05-09 21:05:37 +08:00
|
|
|
|
2003-07-10 06:40:27 +08:00
|
|
|
segs_copy =
|
|
|
|
gimp_display_shell_transform_boundary (shell,
|
|
|
|
edit_select->segs_in,
|
|
|
|
edit_select->num_segs_in,
|
|
|
|
edit_select->cumlx,
|
|
|
|
edit_select->cumly);
|
2003-05-09 21:05:37 +08:00
|
|
|
|
|
|
|
/* Draw the items */
|
|
|
|
gdk_draw_segments (draw_tool->win, draw_tool->gc,
|
|
|
|
segs_copy, select->num_segs_in);
|
|
|
|
|
|
|
|
g_free (segs_copy);
|
|
|
|
}
|
1999-06-22 06:12:07 +08:00
|
|
|
break;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-03-19 00:42:45 +08:00
|
|
|
/* could move this function to a more central location
|
|
|
|
* so it can be used by other tools?
|
|
|
|
*/
|
2000-02-10 22:23:11 +08:00
|
|
|
static gint
|
2003-07-10 06:40:27 +08:00
|
|
|
process_event_queue_keys (GdkEventKey *kevent,
|
2003-03-19 00:42:45 +08:00
|
|
|
... /* GdkKeyType, GdkModifierType, value ... 0 */)
|
1998-07-20 22:05:33 +08:00
|
|
|
{
|
2001-11-09 03:14:51 +08:00
|
|
|
|
1998-07-20 22:05:33 +08:00
|
|
|
#define FILTER_MAX_KEYS 50
|
2001-11-09 03:14:51 +08:00
|
|
|
|
2000-12-29 23:22:01 +08:00
|
|
|
va_list argp;
|
|
|
|
GdkEvent *event;
|
|
|
|
GList *event_list = NULL;
|
|
|
|
GList *list;
|
|
|
|
guint keys[FILTER_MAX_KEYS];
|
|
|
|
GdkModifierType modifiers[FILTER_MAX_KEYS];
|
|
|
|
gint values[FILTER_MAX_KEYS];
|
2003-03-19 00:42:45 +08:00
|
|
|
gint i = 0;
|
|
|
|
gint n_keys = 0;
|
|
|
|
gint value = 0;
|
|
|
|
gboolean done = FALSE;
|
2001-11-09 03:14:51 +08:00
|
|
|
GtkWidget *orig_widget;
|
1998-07-20 22:05:33 +08:00
|
|
|
|
2000-10-23 17:05:45 +08:00
|
|
|
va_start (argp, kevent);
|
2001-11-09 03:14:51 +08:00
|
|
|
|
2003-03-19 00:42:45 +08:00
|
|
|
while (n_keys < FILTER_MAX_KEYS && (keys[n_keys] = va_arg (argp, guint)) != 0)
|
2000-10-23 17:05:45 +08:00
|
|
|
{
|
2003-03-19 00:42:45 +08:00
|
|
|
modifiers[n_keys] = va_arg (argp, GdkModifierType);
|
|
|
|
values[n_keys] = va_arg (argp, gint);
|
|
|
|
n_keys++;
|
2000-10-23 17:05:45 +08:00
|
|
|
}
|
2001-11-09 03:14:51 +08:00
|
|
|
|
|
|
|
va_end (argp);
|
1998-07-20 22:05:33 +08:00
|
|
|
|
2003-03-19 00:42:45 +08:00
|
|
|
for (i = 0; i < n_keys; i++)
|
|
|
|
if (kevent->keyval == keys[i] &&
|
|
|
|
(kevent->state & modifiers[i]) == modifiers[i])
|
|
|
|
value += values[i];
|
1998-07-20 22:05:33 +08:00
|
|
|
|
2001-11-09 03:14:51 +08:00
|
|
|
orig_widget = gtk_get_event_widget ((GdkEvent *) kevent);
|
2000-10-23 17:05:45 +08:00
|
|
|
|
2001-11-09 03:14:51 +08:00
|
|
|
while (gdk_events_pending () > 0 && ! done)
|
|
|
|
{
|
2003-03-19 00:42:45 +08:00
|
|
|
gboolean discard_event = FALSE;
|
|
|
|
|
2001-11-09 03:14:51 +08:00
|
|
|
event = gdk_event_get ();
|
2000-10-23 17:05:45 +08:00
|
|
|
|
2001-11-09 03:14:51 +08:00
|
|
|
if (! event || orig_widget != gtk_get_event_widget (event))
|
|
|
|
{
|
|
|
|
done = TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (event->any.type == GDK_KEY_PRESS)
|
|
|
|
{
|
2003-03-19 00:42:45 +08:00
|
|
|
for (i = 0; i < n_keys; i++)
|
|
|
|
if (event->key.keyval == keys[i] &&
|
|
|
|
(event->key.state & modifiers[i]) == modifiers[i])
|
2001-11-09 03:14:51 +08:00
|
|
|
{
|
|
|
|
discard_event = TRUE;
|
|
|
|
value += values[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (! discard_event)
|
|
|
|
done = TRUE;
|
|
|
|
}
|
|
|
|
/* should there be more types here? */
|
|
|
|
else if (event->any.type != GDK_KEY_RELEASE &&
|
|
|
|
event->any.type != GDK_MOTION_NOTIFY &&
|
|
|
|
event->any.type != GDK_EXPOSE)
|
|
|
|
done = FALSE;
|
2003-03-19 00:42:45 +08:00
|
|
|
}
|
1998-07-20 22:05:33 +08:00
|
|
|
|
2003-03-19 00:42:45 +08:00
|
|
|
if (! event)
|
|
|
|
; /* Do nothing */
|
|
|
|
else if (! discard_event)
|
|
|
|
event_list = g_list_prepend (event_list, event);
|
|
|
|
else
|
|
|
|
gdk_event_free (event);
|
|
|
|
}
|
2000-10-23 17:05:45 +08:00
|
|
|
|
|
|
|
event_list = g_list_reverse (event_list);
|
|
|
|
|
|
|
|
/* unget the unused events and free the list */
|
2001-11-09 03:14:51 +08:00
|
|
|
for (list = event_list; list; list = g_list_next (list))
|
2000-10-23 17:05:45 +08:00
|
|
|
{
|
2001-11-09 03:14:51 +08:00
|
|
|
gdk_event_put ((GdkEvent *) list->data);
|
|
|
|
gdk_event_free ((GdkEvent *) list->data);
|
2000-10-23 17:05:45 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
g_list_free (event_list);
|
|
|
|
|
1998-07-20 22:05:33 +08:00
|
|
|
return value;
|
2001-11-09 03:14:51 +08:00
|
|
|
|
1998-07-20 22:05:33 +08:00
|
|
|
#undef FILTER_MAX_KEYS
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-02-28 10:53:27 +08:00
|
|
|
void
|
2001-02-28 10:29:25 +08:00
|
|
|
gimp_edit_selection_tool_arrow_key (GimpTool *tool,
|
|
|
|
GdkEventKey *kevent,
|
2001-10-29 19:47:11 +08:00
|
|
|
GimpDisplay *gdisp)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-03-20 00:58:17 +08:00
|
|
|
gint mask_inc_x = 0;
|
|
|
|
gint mask_inc_y = 0;
|
|
|
|
gint inc_x = 0;
|
|
|
|
gint inc_y = 0;
|
|
|
|
GimpUndo *undo;
|
|
|
|
gboolean push_undo = TRUE;
|
|
|
|
gboolean translate_mask = FALSE;
|
|
|
|
gboolean translate_layer = FALSE;
|
|
|
|
GimpLayer *layer = NULL;
|
|
|
|
EditType edit_type = EDIT_MASK_TRANSLATE;
|
|
|
|
GimpUndoType undo_type;
|
2003-03-19 00:42:45 +08:00
|
|
|
|
|
|
|
/* check for mask translation first because the translate_layer
|
|
|
|
* modifiers match the translate_mask ones...
|
|
|
|
*/
|
2003-07-10 06:40:27 +08:00
|
|
|
mask_inc_x =
|
2000-10-23 17:05:45 +08:00
|
|
|
process_event_queue_keys (kevent,
|
2003-03-19 00:42:45 +08:00
|
|
|
GDK_Left, (GDK_MOD1_MASK | GDK_SHIFT_MASK),
|
|
|
|
-1 * ARROW_VELOCITY,
|
|
|
|
|
|
|
|
GDK_Left, GDK_MOD1_MASK,
|
|
|
|
-1,
|
|
|
|
|
|
|
|
GDK_Right, (GDK_MOD1_MASK | GDK_SHIFT_MASK),
|
|
|
|
1 * ARROW_VELOCITY,
|
|
|
|
|
|
|
|
GDK_Right, GDK_MOD1_MASK,
|
|
|
|
1,
|
|
|
|
|
2000-10-23 17:05:45 +08:00
|
|
|
0);
|
2003-03-19 00:42:45 +08:00
|
|
|
|
|
|
|
mask_inc_y =
|
2000-10-23 17:05:45 +08:00
|
|
|
process_event_queue_keys (kevent,
|
2003-03-19 00:42:45 +08:00
|
|
|
GDK_Up, (GDK_MOD1_MASK | GDK_SHIFT_MASK),
|
|
|
|
-1 * ARROW_VELOCITY,
|
2000-10-23 17:05:45 +08:00
|
|
|
|
2003-03-19 00:42:45 +08:00
|
|
|
GDK_Up, GDK_MOD1_MASK,
|
|
|
|
-1,
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-03-19 00:42:45 +08:00
|
|
|
GDK_Down, (GDK_MOD1_MASK | GDK_SHIFT_MASK),
|
|
|
|
1 * ARROW_VELOCITY,
|
|
|
|
|
|
|
|
GDK_Down, GDK_MOD1_MASK,
|
|
|
|
1,
|
|
|
|
|
|
|
|
0);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1998-07-20 22:05:33 +08:00
|
|
|
if (mask_inc_x != 0 || mask_inc_y != 0)
|
2003-03-19 00:42:45 +08:00
|
|
|
{
|
|
|
|
translate_mask = TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
inc_x = process_event_queue_keys (kevent,
|
|
|
|
GDK_Left, GDK_SHIFT_MASK,
|
|
|
|
-1 * ARROW_VELOCITY,
|
|
|
|
|
|
|
|
GDK_Left, 0,
|
|
|
|
-1,
|
|
|
|
|
|
|
|
GDK_Right, GDK_SHIFT_MASK,
|
|
|
|
1 * ARROW_VELOCITY,
|
|
|
|
|
|
|
|
GDK_Right, 0,
|
|
|
|
1,
|
|
|
|
|
|
|
|
0);
|
|
|
|
|
|
|
|
inc_y = process_event_queue_keys (kevent,
|
|
|
|
GDK_Up, GDK_SHIFT_MASK,
|
|
|
|
-1 * ARROW_VELOCITY,
|
|
|
|
|
|
|
|
GDK_Up, 0,
|
|
|
|
-1,
|
|
|
|
|
|
|
|
GDK_Down, GDK_SHIFT_MASK,
|
|
|
|
1 * ARROW_VELOCITY,
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-03-19 00:42:45 +08:00
|
|
|
GDK_Down, 0,
|
|
|
|
1,
|
|
|
|
|
|
|
|
0);
|
|
|
|
|
|
|
|
if (inc_x != 0 || inc_y != 0)
|
|
|
|
{
|
|
|
|
translate_layer = TRUE;
|
|
|
|
|
|
|
|
layer = gimp_image_get_active_layer (gdisp->gimage);
|
|
|
|
|
|
|
|
if (gimp_layer_is_floating_sel (layer))
|
|
|
|
edit_type = EDIT_FLOATING_SEL_TRANSLATE;
|
|
|
|
else
|
|
|
|
edit_type = EDIT_LAYER_TRANSLATE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-03-20 00:58:17 +08:00
|
|
|
if (translate_mask)
|
|
|
|
undo_type = GIMP_UNDO_GROUP_MASK;
|
|
|
|
else
|
2003-05-09 04:26:01 +08:00
|
|
|
undo_type = GIMP_UNDO_GROUP_ITEM_DISPLACE;
|
2003-03-20 00:58:17 +08:00
|
|
|
|
2003-03-19 00:42:45 +08:00
|
|
|
undo = gimp_undo_stack_peek (gdisp->gimage->undo_stack);
|
|
|
|
|
2003-03-20 00:58:17 +08:00
|
|
|
if (GIMP_IS_UNDO_STACK (undo) && undo->undo_type == undo_type)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-03-19 00:42:45 +08:00
|
|
|
if (g_object_get_data (G_OBJECT (undo), "edit-selection-tool") ==
|
|
|
|
(gpointer) tool &&
|
|
|
|
g_object_get_data (G_OBJECT (undo), "edit-selection-mask") ==
|
|
|
|
GINT_TO_POINTER (translate_mask) &&
|
|
|
|
g_object_get_data (G_OBJECT (undo), "edit-selection-layer") ==
|
|
|
|
(gpointer) layer &&
|
|
|
|
g_object_get_data (G_OBJECT (undo), "edit-selection-type") ==
|
|
|
|
GINT_TO_POINTER (edit_type))
|
|
|
|
{
|
|
|
|
push_undo = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (push_undo)
|
|
|
|
{
|
|
|
|
const gchar *undo_desc;
|
|
|
|
|
|
|
|
if (translate_mask)
|
|
|
|
undo_desc = _("Move Selection");
|
|
|
|
else if (edit_type == EDIT_FLOATING_SEL_TRANSLATE)
|
|
|
|
undo_desc = _("Move Floating Layer");
|
2000-10-23 17:05:45 +08:00
|
|
|
else
|
2003-03-19 00:42:45 +08:00
|
|
|
undo_desc = _("Move Layer");
|
|
|
|
|
2003-03-20 00:58:17 +08:00
|
|
|
if (gimp_image_undo_group_start (gdisp->gimage, undo_type, undo_desc))
|
2003-03-19 00:42:45 +08:00
|
|
|
{
|
|
|
|
undo = gimp_undo_stack_peek (gdisp->gimage->undo_stack);
|
|
|
|
|
2003-03-20 00:58:17 +08:00
|
|
|
if (GIMP_IS_UNDO_STACK (undo) && undo->undo_type == undo_type)
|
2003-03-19 00:42:45 +08:00
|
|
|
{
|
|
|
|
g_object_set_data (G_OBJECT (undo), "edit-selection-tool",
|
|
|
|
tool);
|
|
|
|
g_object_set_data (G_OBJECT (undo), "edit-selection-mask",
|
|
|
|
GINT_TO_POINTER (translate_mask));
|
|
|
|
g_object_set_data (G_OBJECT (undo), "edit-selection-layer",
|
|
|
|
layer);
|
|
|
|
g_object_set_data (G_OBJECT (undo), "edit-selection-type",
|
|
|
|
GINT_TO_POINTER (edit_type));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (translate_mask)
|
|
|
|
{
|
|
|
|
gimp_image_mask_translate (gdisp->gimage, mask_inc_x, mask_inc_y,
|
|
|
|
push_undo);
|
|
|
|
}
|
|
|
|
else if (translate_layer)
|
|
|
|
{
|
2000-10-23 17:05:45 +08:00
|
|
|
switch (edit_type)
|
|
|
|
{
|
|
|
|
case EDIT_MASK_TRANSLATE:
|
|
|
|
case EDIT_MASK_TO_LAYER_TRANSLATE:
|
2003-05-16 20:10:47 +08:00
|
|
|
case EDIT_MASK_COPY_TO_LAYER_TRANSLATE:
|
|
|
|
/* this won't happen */
|
2000-10-23 17:05:45 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case EDIT_LAYER_TRANSLATE:
|
2003-05-09 21:05:37 +08:00
|
|
|
{
|
|
|
|
GimpLayer *floating_layer;
|
|
|
|
GimpItem *active_item;
|
|
|
|
|
|
|
|
floating_layer = gimp_image_floating_sel (gdisp->gimage);
|
|
|
|
active_item = GIMP_ITEM (gdisp->gimage->active_layer);
|
|
|
|
|
|
|
|
if (floating_layer)
|
|
|
|
floating_sel_relax (floating_layer, push_undo);
|
|
|
|
|
|
|
|
gimp_item_translate (active_item, inc_x, inc_y, push_undo);
|
|
|
|
|
|
|
|
if (gimp_item_get_linked (active_item))
|
|
|
|
{
|
|
|
|
GList *list;
|
|
|
|
|
|
|
|
/* translate all linked items as well */
|
|
|
|
for (list = GIMP_LIST (gdisp->gimage->layers)->list;
|
2003-07-10 06:40:27 +08:00
|
|
|
list;
|
2003-05-09 21:05:37 +08:00
|
|
|
list = g_list_next (list))
|
|
|
|
{
|
|
|
|
GimpItem *item = list->data;
|
|
|
|
|
|
|
|
if (item != active_item && gimp_item_get_linked (item))
|
|
|
|
gimp_item_translate (item, inc_x, inc_y, push_undo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (floating_layer)
|
|
|
|
floating_sel_rigor (floating_layer, push_undo);
|
|
|
|
}
|
2000-10-23 17:05:45 +08:00
|
|
|
break;
|
2003-03-19 00:42:45 +08:00
|
|
|
|
2000-10-23 17:05:45 +08:00
|
|
|
case EDIT_FLOATING_SEL_TRANSLATE:
|
2003-03-19 00:42:45 +08:00
|
|
|
floating_sel_relax (layer, push_undo);
|
2003-05-09 04:26:01 +08:00
|
|
|
gimp_item_translate (GIMP_ITEM (layer), inc_x, inc_y, push_undo);
|
2003-03-19 00:42:45 +08:00
|
|
|
floating_sel_rigor (layer, push_undo);
|
2000-10-23 17:05:45 +08:00
|
|
|
break;
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2000-10-23 17:05:45 +08:00
|
|
|
|
2003-03-19 00:42:45 +08:00
|
|
|
if (push_undo)
|
|
|
|
gimp_image_undo_group_end (gdisp->gimage);
|
|
|
|
|
2002-05-09 01:48:24 +08:00
|
|
|
gimp_image_flush (gdisp->gimage);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|