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-12-17 05:37:03 +08:00
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
#include <stdlib.h>
|
2000-03-05 08:06:11 +08:00
|
|
|
|
2000-12-17 05:37:03 +08:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2001-08-06 00:08:19 +08:00
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
|
|
|
|
2001-05-10 06:34:59 +08:00
|
|
|
#include "tools-types.h"
|
2001-01-25 06:36:18 +08:00
|
|
|
|
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"
|
|
|
|
#include "core/gimplayer.h"
|
2001-11-26 21:17:18 +08:00
|
|
|
#include "core/gimptoolinfo.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
|
2001-09-26 07:23:09 +08:00
|
|
|
#include "display/gimpdisplay.h"
|
2001-10-13 20:52:30 +08:00
|
|
|
#include "display/gimpdisplay-foreach.h"
|
2001-11-01 05:20:09 +08:00
|
|
|
#include "display/gimpdisplayshell.h"
|
2001-01-25 06:36:18 +08:00
|
|
|
|
2001-03-08 09:07:03 +08:00
|
|
|
#include "gimpeditselectiontool.h"
|
|
|
|
#include "gimpmovetool.h"
|
2001-11-26 21:17:18 +08:00
|
|
|
#include "tool_options.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-11-01 05:20:09 +08:00
|
|
|
#include "colormaps.h"
|
|
|
|
#include "floating_sel.h"
|
|
|
|
#include "undo.h"
|
|
|
|
|
1998-12-16 08:37:09 +08:00
|
|
|
#include "libgimp/gimpintl.h"
|
|
|
|
|
2000-12-31 12:07:42 +08:00
|
|
|
|
2001-11-26 21:17:18 +08:00
|
|
|
typedef struct _MoveOptions MoveOptions;
|
|
|
|
|
|
|
|
struct _MoveOptions
|
|
|
|
{
|
|
|
|
GimpToolOptions tool_options;
|
|
|
|
|
|
|
|
gboolean move_current;
|
|
|
|
gboolean move_current_d;
|
|
|
|
GtkWidget *move_current_w[2];
|
|
|
|
|
|
|
|
gboolean move_mask;
|
|
|
|
gboolean move_mask_d;
|
|
|
|
GtkWidget *move_mask_w[2];
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* local function prototypes */
|
|
|
|
|
2001-11-11 07:03:22 +08:00
|
|
|
static void gimp_move_tool_class_init (GimpMoveToolClass *klass);
|
|
|
|
static void gimp_move_tool_init (GimpMoveTool *move_tool);
|
|
|
|
|
|
|
|
static void gimp_move_tool_control (GimpTool *tool,
|
|
|
|
ToolAction tool_action,
|
|
|
|
GimpDisplay *gdisp);
|
|
|
|
static void gimp_move_tool_button_press (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp);
|
|
|
|
static void gimp_move_tool_button_release (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp);
|
|
|
|
static void gimp_move_tool_motion (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp);
|
2001-11-26 21:17:18 +08:00
|
|
|
static void gimp_move_tool_modifier_key (GimpTool *tool,
|
|
|
|
GdkModifierType key,
|
|
|
|
gboolean press,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp);
|
2001-11-11 07:03:22 +08:00
|
|
|
static void gimp_move_tool_cursor_update (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp);
|
|
|
|
|
2001-11-12 22:45:58 +08:00
|
|
|
static void gimp_move_tool_draw (GimpDrawTool *draw_tool);
|
2000-12-31 12:07:42 +08:00
|
|
|
|
2001-11-26 21:17:18 +08:00
|
|
|
static GimpToolOptions * move_options_new (GimpToolInfo *tool_info);
|
|
|
|
static void move_options_reset (GimpToolOptions *tool_options);
|
|
|
|
|
2000-12-31 12:07:42 +08:00
|
|
|
|
2001-11-12 22:45:58 +08:00
|
|
|
static GimpDrawToolClass *parent_class = NULL;
|
2001-02-22 05:56:39 +08:00
|
|
|
|
|
|
|
|
|
|
|
void
|
2001-11-21 07:00:47 +08:00
|
|
|
gimp_move_tool_register (Gimp *gimp,
|
|
|
|
GimpToolRegisterCallback callback)
|
2001-02-22 05:56:39 +08:00
|
|
|
{
|
2001-11-21 07:00:47 +08:00
|
|
|
(* callback) (gimp,
|
|
|
|
GIMP_TYPE_MOVE_TOOL,
|
2001-11-26 21:17:18 +08:00
|
|
|
move_options_new,
|
2001-11-21 07:00:47 +08:00
|
|
|
FALSE,
|
|
|
|
"gimp:move_tool",
|
|
|
|
_("Move Tool"),
|
|
|
|
_("Move layers & selections"),
|
|
|
|
N_("/Tools/Transform Tools/Move"), "M",
|
|
|
|
NULL, "tools/move.html",
|
|
|
|
GIMP_STOCK_TOOL_MOVE);
|
2001-02-22 05:56:39 +08:00
|
|
|
}
|
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
GType
|
2001-02-22 05:56:39 +08:00
|
|
|
gimp_move_tool_get_type (void)
|
|
|
|
{
|
2001-08-14 22:53:55 +08:00
|
|
|
static GType tool_type = 0;
|
2001-02-22 05:56:39 +08:00
|
|
|
|
|
|
|
if (! tool_type)
|
|
|
|
{
|
2001-08-14 22:53:55 +08:00
|
|
|
static const GTypeInfo tool_info =
|
2001-02-22 05:56:39 +08:00
|
|
|
{
|
|
|
|
sizeof (GimpMoveToolClass),
|
2001-08-14 22:53:55 +08:00
|
|
|
(GBaseInitFunc) NULL,
|
|
|
|
(GBaseFinalizeFunc) NULL,
|
|
|
|
(GClassInitFunc) gimp_move_tool_class_init,
|
|
|
|
NULL, /* class_finalize */
|
|
|
|
NULL, /* class_data */
|
|
|
|
sizeof (GimpMoveTool),
|
|
|
|
0, /* n_preallocs */
|
|
|
|
(GInstanceInitFunc) gimp_move_tool_init,
|
2001-02-22 05:56:39 +08:00
|
|
|
};
|
2001-08-14 22:53:55 +08:00
|
|
|
|
2001-11-12 22:45:58 +08:00
|
|
|
tool_type = g_type_register_static (GIMP_TYPE_DRAW_TOOL,
|
2001-08-14 22:53:55 +08:00
|
|
|
"GimpMoveTool",
|
|
|
|
&tool_info, 0);
|
2001-02-22 05:56:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return tool_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_move_tool_class_init (GimpMoveToolClass *klass)
|
|
|
|
{
|
2001-11-12 22:45:58 +08:00
|
|
|
GimpToolClass *tool_class;
|
|
|
|
GimpDrawToolClass *draw_tool_class;
|
2001-02-22 05:56:39 +08:00
|
|
|
|
2001-11-12 22:45:58 +08:00
|
|
|
tool_class = GIMP_TOOL_CLASS (klass);
|
|
|
|
draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass);
|
2001-02-22 05:56:39 +08:00
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
2001-02-22 05:56:39 +08:00
|
|
|
|
2001-11-11 07:03:22 +08:00
|
|
|
tool_class->control = gimp_move_tool_control;
|
|
|
|
tool_class->button_press = gimp_move_tool_button_press;
|
|
|
|
tool_class->button_release = gimp_move_tool_button_release;
|
|
|
|
tool_class->motion = gimp_move_tool_motion;
|
2001-02-28 10:53:27 +08:00
|
|
|
tool_class->arrow_key = gimp_edit_selection_tool_arrow_key;
|
2001-11-26 21:17:18 +08:00
|
|
|
tool_class->modifier_key = gimp_move_tool_modifier_key;
|
2001-11-11 07:03:22 +08:00
|
|
|
tool_class->cursor_update = gimp_move_tool_cursor_update;
|
2001-11-12 22:45:58 +08:00
|
|
|
|
|
|
|
draw_tool_class->draw = gimp_move_tool_draw;
|
2001-02-22 05:56:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_move_tool_init (GimpMoveTool *move_tool)
|
|
|
|
{
|
|
|
|
GimpTool *tool;
|
|
|
|
|
|
|
|
tool = GIMP_TOOL (move_tool);
|
|
|
|
|
|
|
|
move_tool->layer = NULL;
|
|
|
|
move_tool->guide = NULL;
|
|
|
|
move_tool->disp = NULL;
|
|
|
|
|
2001-11-09 03:14:51 +08:00
|
|
|
tool->tool_cursor = GIMP_MOVE_TOOL_CURSOR;
|
|
|
|
|
2001-02-22 05:56:39 +08:00
|
|
|
tool->auto_snap_to = FALSE; /* Don't snap to guides */
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-11-11 07:03:22 +08:00
|
|
|
gimp_move_tool_control (GimpTool *tool,
|
|
|
|
ToolAction action,
|
|
|
|
GimpDisplay *gdisp)
|
2001-02-22 05:56:39 +08:00
|
|
|
{
|
|
|
|
GimpMoveTool *move_tool;
|
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
move_tool = GIMP_MOVE_TOOL (tool);
|
2001-02-22 05:56:39 +08:00
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
switch (action)
|
2001-02-22 05:56:39 +08:00
|
|
|
{
|
2001-08-14 22:53:55 +08:00
|
|
|
case PAUSE:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RESUME:
|
2001-02-22 05:56:39 +08:00
|
|
|
if (move_tool->guide)
|
2001-11-01 05:20:09 +08:00
|
|
|
gimp_display_shell_draw_guide (GIMP_DISPLAY_SHELL (gdisp->shell),
|
|
|
|
move_tool->guide, TRUE);
|
2001-08-14 22:53:55 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case HALT:
|
|
|
|
if (move_tool->guide)
|
2001-11-01 05:20:09 +08:00
|
|
|
gimp_display_shell_draw_guide (GIMP_DISPLAY_SHELL (gdisp->shell),
|
|
|
|
move_tool->guide, FALSE);
|
2001-08-14 22:53:55 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
2001-02-22 05:56:39 +08:00
|
|
|
}
|
|
|
|
|
2001-11-11 07:03:22 +08:00
|
|
|
GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
|
2001-02-22 05:56:39 +08:00
|
|
|
}
|
1999-04-09 06:25:54 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
static void
|
2001-11-11 07:03:22 +08:00
|
|
|
gimp_move_tool_button_press (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-11-01 05:20:09 +08:00
|
|
|
GimpMoveTool *move;
|
2001-11-26 21:17:18 +08:00
|
|
|
MoveOptions *options;
|
2001-11-01 05:20:09 +08:00
|
|
|
GimpDisplayShell *shell;
|
|
|
|
GimpLayer *layer;
|
|
|
|
GimpGuide *guide;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-02-22 05:56:39 +08:00
|
|
|
move = GIMP_MOVE_TOOL (tool);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-11-26 21:17:18 +08:00
|
|
|
options = (MoveOptions *) tool->tool_info->tool_options;
|
|
|
|
|
2001-11-01 05:20:09 +08:00
|
|
|
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
|
|
|
|
2000-12-31 12:07:42 +08:00
|
|
|
tool->gdisp = gdisp;
|
1997-11-25 06:05:25 +08:00
|
|
|
move->layer = NULL;
|
|
|
|
move->guide = NULL;
|
1999-10-14 07:07:45 +08:00
|
|
|
move->disp = NULL;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-11-26 21:17:18 +08:00
|
|
|
if (options->move_mask && ! gimage_mask_is_empty (gdisp->gimage))
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-11-09 03:14:51 +08:00
|
|
|
init_edit_selection (tool, gdisp, coords, EDIT_MASK_TRANSLATE);
|
1997-11-25 06:05:25 +08:00
|
|
|
tool->state = ACTIVE;
|
|
|
|
}
|
2001-11-26 21:17:18 +08:00
|
|
|
else if (options->move_current)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-11-09 03:14:51 +08:00
|
|
|
init_edit_selection (tool, gdisp, coords, EDIT_LAYER_TRANSLATE);
|
1997-11-25 06:05:25 +08:00
|
|
|
tool->state = ACTIVE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-03-29 07:39:32 +08:00
|
|
|
if (gdisp->draw_guides &&
|
2001-11-09 03:14:51 +08:00
|
|
|
(guide = gimp_image_find_guide (gdisp->gimage, coords->x, coords->y)))
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
undo_push_guide (gdisp->gimage, guide);
|
|
|
|
|
2001-11-14 23:40:30 +08:00
|
|
|
gimp_image_update_guide (gdisp->gimage, guide);
|
2000-12-29 23:22:01 +08:00
|
|
|
gimp_image_remove_guide (gdisp->gimage, guide);
|
2001-11-11 07:03:22 +08:00
|
|
|
gimp_display_flush (gdisp);
|
2000-12-29 23:22:01 +08:00
|
|
|
gimp_image_add_guide (gdisp->gimage, guide);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
move->guide = guide;
|
2000-03-29 07:39:32 +08:00
|
|
|
move->disp = gdisp;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
tool->scroll_lock = TRUE;
|
2000-03-29 07:39:32 +08:00
|
|
|
tool->state = ACTIVE;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-11-12 22:45:58 +08:00
|
|
|
gimp_draw_tool_start (GIMP_DRAW_TOOL (tool),
|
|
|
|
shell->canvas->window);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2001-11-09 03:14:51 +08:00
|
|
|
else if ((layer = gimp_image_pick_correlate_layer (gdisp->gimage,
|
|
|
|
coords->x,
|
|
|
|
coords->y)))
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-03-29 07:39:32 +08:00
|
|
|
/* If there is a floating selection, and this aint it,
|
|
|
|
* use the move tool
|
|
|
|
*/
|
2000-12-29 23:22:01 +08:00
|
|
|
if (gimp_image_floating_sel (gdisp->gimage) &&
|
2001-01-29 07:25:25 +08:00
|
|
|
! gimp_layer_is_floating_sel (layer))
|
2000-03-29 07:39:32 +08:00
|
|
|
{
|
2000-12-29 23:22:01 +08:00
|
|
|
move->layer = gimp_image_floating_sel (gdisp->gimage);
|
2000-03-29 07:39:32 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
/* Otherwise, init the edit selection */
|
|
|
|
else
|
|
|
|
{
|
2000-12-29 23:22:01 +08:00
|
|
|
gimp_image_set_active_layer (gdisp->gimage, layer);
|
2001-11-09 03:14:51 +08:00
|
|
|
init_edit_selection (tool, gdisp, coords, EDIT_LAYER_TRANSLATE);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
tool->state = ACTIVE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if we've got an active tool grab the pointer */
|
|
|
|
if (tool->state == ACTIVE)
|
2000-02-29 03:25:42 +08:00
|
|
|
{
|
2001-11-01 05:20:09 +08:00
|
|
|
gdk_pointer_grab (shell->canvas->window, FALSE,
|
2000-03-29 07:39:32 +08:00
|
|
|
GDK_POINTER_MOTION_HINT_MASK |
|
|
|
|
GDK_BUTTON1_MOTION_MASK |
|
2000-02-29 03:25:42 +08:00
|
|
|
GDK_BUTTON_RELEASE_MASK,
|
2001-11-09 03:14:51 +08:00
|
|
|
NULL, NULL, time);
|
2000-03-29 07:39:32 +08:00
|
|
|
}
|
1998-03-16 19:13:24 +08:00
|
|
|
}
|
|
|
|
|
1998-03-19 06:35:31 +08:00
|
|
|
static void
|
2001-11-11 07:03:22 +08:00
|
|
|
gimp_move_tool_button_release (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-02-22 05:56:39 +08:00
|
|
|
GimpMoveTool *move;
|
|
|
|
gboolean delete_guide;
|
|
|
|
gint x1, y1;
|
|
|
|
gint x2, y2;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-02-22 05:56:39 +08:00
|
|
|
move = GIMP_MOVE_TOOL (tool);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
tool->state = INACTIVE;
|
2001-11-09 03:14:51 +08:00
|
|
|
|
|
|
|
gdk_pointer_ungrab (time);
|
|
|
|
gdk_flush ();
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
if (move->guide)
|
|
|
|
{
|
2001-11-01 05:20:09 +08:00
|
|
|
GimpDisplayShell *shell;
|
|
|
|
|
|
|
|
shell = GIMP_DISPLAY_SHELL (tool->gdisp->shell);
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
tool->scroll_lock = FALSE;
|
|
|
|
|
1999-10-14 07:07:45 +08:00
|
|
|
delete_guide = FALSE;
|
2001-11-01 05:20:09 +08:00
|
|
|
gdisplay_untransform_coords (gdisp,
|
|
|
|
0, 0,
|
|
|
|
&x1, &y1,
|
|
|
|
FALSE, FALSE);
|
|
|
|
gdisplay_untransform_coords (gdisp,
|
2001-11-02 17:31:21 +08:00
|
|
|
shell->disp_width, shell->disp_height,
|
2001-11-01 05:20:09 +08:00
|
|
|
&x2, &y2,
|
|
|
|
FALSE, FALSE);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
if (x1 < 0) x1 = 0;
|
|
|
|
if (y1 < 0) y1 = 0;
|
2000-03-29 07:39:32 +08:00
|
|
|
if (x2 > gdisp->gimage->width) x2 = gdisp->gimage->width;
|
1997-11-25 06:05:25 +08:00
|
|
|
if (y2 > gdisp->gimage->height) y2 = gdisp->gimage->height;
|
|
|
|
|
|
|
|
switch (move->guide->orientation)
|
|
|
|
{
|
1999-07-29 07:00:08 +08:00
|
|
|
case ORIENTATION_HORIZONTAL:
|
1997-11-25 06:05:25 +08:00
|
|
|
if ((move->guide->position < y1) || (move->guide->position > y2))
|
1999-10-14 07:07:45 +08:00
|
|
|
delete_guide = TRUE;
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
2000-12-29 00:19:55 +08:00
|
|
|
|
1999-07-29 07:00:08 +08:00
|
|
|
case ORIENTATION_VERTICAL:
|
1997-11-25 06:05:25 +08:00
|
|
|
if ((move->guide->position < x1) || (move->guide->position > x2))
|
1999-10-14 07:07:45 +08:00
|
|
|
delete_guide = TRUE;
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
2000-12-29 00:19:55 +08:00
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2001-11-14 23:40:30 +08:00
|
|
|
gimp_image_update_guide (gdisp->gimage, move->guide);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-11-12 22:45:58 +08:00
|
|
|
gimp_draw_tool_stop (GIMP_DRAW_TOOL (tool));
|
2001-11-09 03:14:51 +08:00
|
|
|
|
1999-10-14 07:07:45 +08:00
|
|
|
if (delete_guide)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
1999-10-14 07:07:45 +08:00
|
|
|
gimp_image_delete_guide (gdisp->gimage, move->guide);
|
1997-11-25 06:05:25 +08:00
|
|
|
move->guide = NULL;
|
2001-11-09 03:14:51 +08:00
|
|
|
move->disp = NULL;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
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
|
|
|
gdisplays_flush ();
|
|
|
|
|
|
|
|
if (move->guide)
|
2001-11-01 05:20:09 +08:00
|
|
|
gimp_display_shell_draw_guide (shell, move->guide, TRUE);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1999-10-14 07:07:45 +08:00
|
|
|
/* Take care of the case where the user "cancels" the action */
|
2001-11-09 03:14:51 +08:00
|
|
|
if (! (state & GDK_BUTTON3_MASK))
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
if (move->layer)
|
|
|
|
{
|
|
|
|
floating_sel_anchor (move->layer);
|
|
|
|
gdisplays_flush ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-03-19 06:35:31 +08:00
|
|
|
static void
|
2001-11-11 07:03:22 +08:00
|
|
|
gimp_move_tool_motion (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp)
|
1998-03-16 19:13:24 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-02-22 05:56:39 +08:00
|
|
|
GimpMoveTool *move;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-02-22 05:56:39 +08:00
|
|
|
move = GIMP_MOVE_TOOL (tool);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-03-29 07:39:32 +08:00
|
|
|
if (move->guide)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-11-01 05:20:09 +08:00
|
|
|
GimpDisplayShell *shell;
|
2001-11-09 03:14:51 +08:00
|
|
|
gint tx, ty;
|
2001-11-01 05:20:09 +08:00
|
|
|
|
|
|
|
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
|
|
|
|
2001-11-12 22:45:58 +08:00
|
|
|
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
|
1999-04-06 07:33:50 +08:00
|
|
|
|
2001-11-09 03:14:51 +08:00
|
|
|
gdisplay_transform_coords (gdisp,
|
|
|
|
coords->x, coords->y,
|
|
|
|
&tx, &ty,
|
|
|
|
FALSE);
|
|
|
|
|
|
|
|
if (tx < 0 ||
|
|
|
|
ty < 0 ||
|
|
|
|
tx >= shell->disp_width ||
|
|
|
|
ty >= shell->disp_height)
|
1999-04-06 07:33:50 +08:00
|
|
|
{
|
2000-03-29 07:39:32 +08:00
|
|
|
move->guide->position = -1;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2001-11-09 03:14:51 +08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (move->guide->orientation == ORIENTATION_HORIZONTAL)
|
|
|
|
move->guide->position = ROUND (coords->y);
|
|
|
|
else
|
|
|
|
move->guide->position = ROUND (coords->x);
|
|
|
|
}
|
2001-11-12 22:45:58 +08:00
|
|
|
|
|
|
|
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-11-26 21:17:18 +08:00
|
|
|
static void
|
|
|
|
gimp_move_tool_modifier_key (GimpTool *tool,
|
|
|
|
GdkModifierType key,
|
|
|
|
gboolean press,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp)
|
|
|
|
{
|
|
|
|
MoveOptions *options;
|
|
|
|
|
|
|
|
options = (MoveOptions *) tool->tool_info->tool_options;
|
|
|
|
|
|
|
|
if (key == GDK_CONTROL_MASK)
|
|
|
|
{
|
|
|
|
gimp_radio_group_set_active (GTK_RADIO_BUTTON (options->move_current_w[0]),
|
|
|
|
GINT_TO_POINTER (! options->move_current));
|
|
|
|
}
|
|
|
|
else if (key == GDK_MOD1_MASK)
|
|
|
|
{
|
|
|
|
gimp_radio_group_set_active (GTK_RADIO_BUTTON (options->move_mask_w[0]),
|
|
|
|
GINT_TO_POINTER (! options->move_mask));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-03-19 06:35:31 +08:00
|
|
|
static void
|
2001-11-11 07:03:22 +08:00
|
|
|
gimp_move_tool_cursor_update (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-11-01 05:20:09 +08:00
|
|
|
GimpMoveTool *move;
|
2001-11-26 21:17:18 +08:00
|
|
|
MoveOptions *options;
|
2001-11-01 05:20:09 +08:00
|
|
|
GimpDisplayShell *shell;
|
|
|
|
GimpGuide *guide;
|
|
|
|
GimpLayer *layer;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-02-22 05:56:39 +08:00
|
|
|
move = GIMP_MOVE_TOOL (tool);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-11-26 21:17:18 +08:00
|
|
|
options = (MoveOptions *) tool->tool_info->tool_options;
|
|
|
|
|
2001-11-01 05:20:09 +08:00
|
|
|
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
|
|
|
|
2001-11-26 21:17:18 +08:00
|
|
|
if (options->move_mask && ! gimage_mask_is_empty (gdisp->gimage))
|
2000-03-29 07:39:32 +08:00
|
|
|
{
|
2001-11-01 05:20:09 +08:00
|
|
|
gimp_display_shell_install_tool_cursor (shell,
|
|
|
|
GIMP_MOUSE_CURSOR,
|
|
|
|
GIMP_RECT_SELECT_TOOL_CURSOR,
|
|
|
|
GIMP_CURSOR_MODIFIER_MOVE);
|
2000-03-29 07:39:32 +08:00
|
|
|
}
|
2001-11-26 21:17:18 +08:00
|
|
|
else if (options->move_current)
|
2000-03-29 07:39:32 +08:00
|
|
|
{
|
2001-11-01 05:20:09 +08:00
|
|
|
gimp_display_shell_install_tool_cursor (shell,
|
|
|
|
GIMP_MOUSE_CURSOR,
|
|
|
|
GIMP_MOVE_TOOL_CURSOR,
|
|
|
|
GIMP_CURSOR_MODIFIER_NONE);
|
2000-03-29 07:39:32 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
else
|
|
|
|
{
|
2000-03-29 07:39:32 +08:00
|
|
|
if (gdisp->draw_guides &&
|
2001-11-09 03:14:51 +08:00
|
|
|
(guide = gimp_image_find_guide (gdisp->gimage, coords->x, coords->y)))
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-12-31 12:07:42 +08:00
|
|
|
tool->gdisp = gdisp;
|
2001-11-01 05:20:09 +08:00
|
|
|
|
|
|
|
gimp_display_shell_install_tool_cursor (shell,
|
|
|
|
GDK_HAND2,
|
|
|
|
GIMP_TOOL_CURSOR_NONE,
|
|
|
|
GIMP_CURSOR_MODIFIER_HAND);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
if (tool->state != ACTIVE)
|
|
|
|
{
|
|
|
|
if (move->guide)
|
|
|
|
{
|
1999-10-14 07:07:45 +08:00
|
|
|
gdisp = gdisplays_check_valid (move->disp, move->disp->gimage);
|
2001-11-01 05:20:09 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
if (gdisp)
|
2001-11-01 05:20:09 +08:00
|
|
|
{
|
|
|
|
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
|
|
|
|
|
|
|
gimp_display_shell_draw_guide (shell, move->guide, FALSE);
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2001-11-01 05:20:09 +08:00
|
|
|
gimp_display_shell_draw_guide (shell, guide, TRUE);
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
move->guide = guide;
|
2000-12-31 12:07:42 +08:00
|
|
|
move->disp = gdisp;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
}
|
2001-11-09 03:14:51 +08:00
|
|
|
else if ((layer = gimp_image_pick_correlate_layer (gdisp->gimage,
|
|
|
|
coords->x, coords->y)))
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
/* if there is a floating selection, and this aint it... */
|
2000-12-29 23:22:01 +08:00
|
|
|
if (gimp_image_floating_sel (gdisp->gimage) &&
|
2001-01-29 07:25:25 +08:00
|
|
|
! gimp_layer_is_floating_sel (layer))
|
2001-02-25 03:29:47 +08:00
|
|
|
{
|
2001-11-01 05:20:09 +08:00
|
|
|
gimp_display_shell_install_tool_cursor (shell,
|
|
|
|
GIMP_MOUSE_CURSOR,
|
|
|
|
GIMP_RECT_SELECT_TOOL_CURSOR,
|
|
|
|
GIMP_CURSOR_MODIFIER_ANCHOR);
|
2001-02-25 03:29:47 +08:00
|
|
|
}
|
2001-02-25 22:37:12 +08:00
|
|
|
else if (layer == gimp_image_get_active_layer (gdisp->gimage))
|
2001-02-25 03:29:47 +08:00
|
|
|
{
|
2001-11-01 05:20:09 +08:00
|
|
|
gimp_display_shell_install_tool_cursor (shell,
|
|
|
|
GIMP_MOUSE_CURSOR,
|
|
|
|
GIMP_MOVE_TOOL_CURSOR,
|
|
|
|
GIMP_CURSOR_MODIFIER_NONE);
|
2001-02-25 03:29:47 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
else
|
2001-02-25 03:29:47 +08:00
|
|
|
{
|
2001-11-01 05:20:09 +08:00
|
|
|
gimp_display_shell_install_tool_cursor (shell,
|
|
|
|
GDK_HAND2,
|
|
|
|
GIMP_TOOL_CURSOR_NONE,
|
|
|
|
GIMP_CURSOR_MODIFIER_HAND);
|
2001-02-25 03:29:47 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
else
|
2000-03-29 07:39:32 +08:00
|
|
|
{
|
2001-11-01 05:20:09 +08:00
|
|
|
gimp_display_shell_install_tool_cursor (shell,
|
|
|
|
GIMP_BAD_CURSOR,
|
|
|
|
GIMP_MOVE_TOOL_CURSOR,
|
|
|
|
GIMP_CURSOR_MODIFIER_NONE);
|
2000-03-29 07:39:32 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-11-12 22:45:58 +08:00
|
|
|
gimp_move_tool_draw (GimpDrawTool *draw_tool)
|
2001-11-09 03:14:51 +08:00
|
|
|
{
|
2001-11-12 22:45:58 +08:00
|
|
|
GimpMoveTool *move;
|
|
|
|
GimpTool *tool;
|
|
|
|
GimpGuide *guide;
|
2001-11-09 03:14:51 +08:00
|
|
|
|
2001-11-12 22:45:58 +08:00
|
|
|
move = GIMP_MOVE_TOOL (draw_tool);
|
|
|
|
tool = GIMP_TOOL (draw_tool);
|
2001-11-09 03:14:51 +08:00
|
|
|
|
2001-11-12 22:45:58 +08:00
|
|
|
guide = move->guide;
|
2001-11-09 03:14:51 +08:00
|
|
|
|
2001-11-12 22:45:58 +08:00
|
|
|
if (guide && guide->position != -1)
|
2001-11-09 03:14:51 +08:00
|
|
|
{
|
2001-11-12 22:45:58 +08:00
|
|
|
switch (guide->orientation)
|
|
|
|
{
|
|
|
|
case ORIENTATION_HORIZONTAL:
|
|
|
|
gimp_draw_tool_draw_line (draw_tool,
|
|
|
|
0, guide->position,
|
|
|
|
tool->gdisp->gimage->width, guide->position,
|
|
|
|
FALSE);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ORIENTATION_VERTICAL:
|
|
|
|
gimp_draw_tool_draw_line (draw_tool,
|
|
|
|
guide->position, 0,
|
|
|
|
guide->position, tool->gdisp->gimage->height,
|
|
|
|
FALSE);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2001-11-09 03:14:51 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
void
|
2001-10-29 19:47:11 +08:00
|
|
|
gimp_move_tool_start_hguide (GimpTool *tool,
|
|
|
|
GimpDisplay *gdisp)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-02-22 05:56:39 +08:00
|
|
|
GimpMoveTool *move;
|
|
|
|
|
|
|
|
move = GIMP_MOVE_TOOL (tool);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-11-11 07:03:22 +08:00
|
|
|
gimp_display_shell_selection_visibility (GIMP_DISPLAY_SHELL (gdisp->shell),
|
|
|
|
GIMP_SELECTION_PAUSE);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-12-31 12:07:42 +08:00
|
|
|
tool->gdisp = gdisp;
|
1997-11-25 06:05:25 +08:00
|
|
|
tool->scroll_lock = TRUE;
|
|
|
|
|
2001-02-22 05:56:39 +08:00
|
|
|
if (move->guide && move->disp && move->disp->gimage)
|
2001-11-01 05:20:09 +08:00
|
|
|
gimp_display_shell_draw_guide (GIMP_DISPLAY_SHELL (move->disp->shell),
|
|
|
|
move->guide, FALSE);
|
1999-10-14 07:07:45 +08:00
|
|
|
|
2001-02-22 05:56:39 +08:00
|
|
|
move->guide = gimp_image_add_hguide (gdisp->gimage);
|
|
|
|
move->disp = gdisp;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
tool->state = ACTIVE;
|
|
|
|
|
2001-02-22 05:56:39 +08:00
|
|
|
undo_push_guide (gdisp->gimage, move->guide);
|
2001-11-12 22:45:58 +08:00
|
|
|
|
|
|
|
gimp_draw_tool_start (GIMP_DRAW_TOOL (tool),
|
|
|
|
GIMP_DISPLAY_SHELL (gdisp->shell)->canvas->window);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2001-10-29 19:47:11 +08:00
|
|
|
gimp_move_tool_start_vguide (GimpTool *tool,
|
|
|
|
GimpDisplay *gdisp)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-02-22 05:56:39 +08:00
|
|
|
GimpMoveTool *move;
|
|
|
|
|
|
|
|
move = GIMP_MOVE_TOOL (tool);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-11-11 07:03:22 +08:00
|
|
|
gimp_display_shell_selection_visibility (GIMP_DISPLAY_SHELL (gdisp->shell),
|
|
|
|
GIMP_SELECTION_PAUSE);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-12-31 12:07:42 +08:00
|
|
|
tool->gdisp = gdisp;
|
1997-11-25 06:05:25 +08:00
|
|
|
tool->scroll_lock = TRUE;
|
|
|
|
|
2001-02-22 05:56:39 +08:00
|
|
|
if (move->guide && move->disp && move->disp->gimage)
|
2001-11-01 05:20:09 +08:00
|
|
|
gimp_display_shell_draw_guide (GIMP_DISPLAY_SHELL (move->disp->shell),
|
|
|
|
move->guide, FALSE);
|
1999-10-14 07:07:45 +08:00
|
|
|
|
2001-02-22 05:56:39 +08:00
|
|
|
move->guide = gimp_image_add_vguide (gdisp->gimage);
|
|
|
|
move->disp = gdisp;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
tool->state = ACTIVE;
|
|
|
|
|
2001-02-22 05:56:39 +08:00
|
|
|
undo_push_guide (gdisp->gimage, move->guide);
|
2001-11-12 22:45:58 +08:00
|
|
|
|
|
|
|
gimp_draw_tool_start (GIMP_DRAW_TOOL (tool),
|
|
|
|
GIMP_DISPLAY_SHELL (gdisp->shell)->canvas->window);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2001-11-26 21:17:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
/* tool options stuff */
|
|
|
|
|
|
|
|
static GimpToolOptions *
|
|
|
|
move_options_new (GimpToolInfo *tool_info)
|
|
|
|
{
|
|
|
|
MoveOptions *options;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *frame;
|
|
|
|
|
|
|
|
options = g_new0 (MoveOptions, 1);
|
|
|
|
|
|
|
|
tool_options_init ((GimpToolOptions *) options, tool_info);
|
|
|
|
|
|
|
|
((GimpToolOptions *) options)->reset_func = move_options_reset;
|
|
|
|
|
|
|
|
options->move_current = options->move_current_d = FALSE;
|
|
|
|
options->move_mask = options->move_mask_d = FALSE;
|
|
|
|
|
|
|
|
/* the main vbox */
|
|
|
|
vbox = options->tool_options.main_vbox;
|
|
|
|
|
|
|
|
/* tool toggle */
|
|
|
|
frame = gimp_radio_group_new2 (TRUE, _("Tool Toggle (<Ctrl>)"),
|
|
|
|
G_CALLBACK (gimp_radio_button_update),
|
|
|
|
&options->move_current,
|
|
|
|
GINT_TO_POINTER (options->move_current),
|
|
|
|
|
|
|
|
_("Pick a Layer to Move"),
|
|
|
|
GINT_TO_POINTER (FALSE),
|
|
|
|
&options->move_current_w[0],
|
|
|
|
|
|
|
|
_("Move Current Layer"),
|
|
|
|
GINT_TO_POINTER (TRUE),
|
|
|
|
&options->move_current_w[1],
|
|
|
|
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
|
|
|
/* move mask */
|
|
|
|
frame = gimp_radio_group_new2 (TRUE, _("Move Mode (<Alt>)"),
|
|
|
|
G_CALLBACK (gimp_radio_button_update),
|
|
|
|
&options->move_mask,
|
|
|
|
GINT_TO_POINTER (options->move_mask),
|
|
|
|
|
|
|
|
_("Move Pixels"),
|
|
|
|
GINT_TO_POINTER (FALSE),
|
|
|
|
&options->move_mask_w[0],
|
|
|
|
|
|
|
|
_("Move Selection Outline"),
|
|
|
|
GINT_TO_POINTER (TRUE),
|
|
|
|
&options->move_mask_w[1],
|
|
|
|
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
|
|
|
return (GimpToolOptions *) options;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
move_options_reset (GimpToolOptions *tool_options)
|
|
|
|
{
|
|
|
|
MoveOptions *options;
|
|
|
|
|
|
|
|
options = (MoveOptions *) tool_options;
|
|
|
|
|
|
|
|
gimp_radio_group_set_active (GTK_RADIO_BUTTON (options->move_current_w[0]),
|
|
|
|
GINT_TO_POINTER (options->move_current_d));
|
|
|
|
|
|
|
|
gimp_radio_group_set_active (GTK_RADIO_BUTTON (options->move_mask_w[0]),
|
|
|
|
GINT_TO_POINTER (options->move_mask_d));
|
|
|
|
}
|