2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
1997-11-25 06:05:25 +08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
1997-11-25 06:05:25 +08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
1997-11-25 06:05:25 +08:00
|
|
|
* (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
|
2018-07-12 05:27:07 +08:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
1997-11-25 06:05:25 +08:00
|
|
|
*/
|
2000-12-17 05:37:03 +08:00
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2008-05-23 22:09:55 +08:00
|
|
|
#include <string.h>
|
|
|
|
|
2008-10-10 04:24:04 +08:00
|
|
|
#include <gegl.h>
|
2000-12-17 05:37:03 +08:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2007-03-09 21:00:01 +08:00
|
|
|
#include "libgimpmath/gimpmath.h"
|
2001-08-06 00:08:19 +08:00
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
|
|
|
|
2002-05-03 20:45:22 +08:00
|
|
|
#include "tools-types.h"
|
2001-01-25 06:36:18 +08:00
|
|
|
|
2004-07-14 18:31:59 +08:00
|
|
|
#include "config/gimpdisplayconfig.h"
|
2004-10-30 23:02:39 +08:00
|
|
|
#include "config/gimpguiconfig.h"
|
2004-02-19 04:31:11 +08:00
|
|
|
|
|
|
|
#include "core/gimp.h"
|
2015-12-15 09:54:04 +08:00
|
|
|
#include "core/gimp-cairo.h"
|
app: allow moving an intersecting pair of guides with the Move tool
This commit adds support for moving together an intersecting pair
of guides using the Move tool, by dragging the guides at their
point of intersection. This is useful when the guides are used to
mark a point, rather than a pair of lines (e.g., as is the case for
the mandala symmetry guides, which mark the symmetry's point of
origin).
Add gimp_image_pick_guides(), which can return a set of guides,
rather than a single guide. The API allows an arbitrary set of
guides to be returned, but, in practice, at most two intersecting
guides are returned, as per the above.
In GimpMoveTool and GimpGuideTool, add support for moving multiple
guides together, and, in GimpMoveTool, use gimp_image_pick_guides()
to potentially pick multiple guides.
2019-05-30 13:39:26 +08:00
|
|
|
#include "core/gimp-utils.h"
|
2006-06-07 06:48:57 +08:00
|
|
|
#include "core/gimpguide.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "core/gimpimage.h"
|
2017-06-22 14:16:43 +08:00
|
|
|
#include "core/gimpimage-pick-item.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "core/gimplayer.h"
|
2007-03-07 03:56:08 +08:00
|
|
|
#include "core/gimpimage-undo.h"
|
2004-01-12 22:13:24 +08:00
|
|
|
#include "core/gimplayermask.h"
|
2016-05-20 22:46:26 +08:00
|
|
|
#include "core/gimplayer-floating-selection.h"
|
2007-03-07 03:56:08 +08:00
|
|
|
#include "core/gimpundostack.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
|
2007-03-09 19:10:40 +08:00
|
|
|
#include "widgets/gimphelp-ids.h"
|
2011-10-07 03:59:07 +08:00
|
|
|
#include "widgets/gimpwidgets-utils.h"
|
2007-03-09 19:10:40 +08:00
|
|
|
|
2010-09-30 06:39:15 +08:00
|
|
|
#include "display/gimpcanvasitem.h"
|
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"
|
2006-09-05 01:18:38 +08:00
|
|
|
#include "display/gimpdisplayshell-selection.h"
|
2003-01-04 02:01:30 +08:00
|
|
|
#include "display/gimpdisplayshell-transform.h"
|
2001-01-25 06:36:18 +08:00
|
|
|
|
2001-03-08 09:07:03 +08:00
|
|
|
#include "gimpeditselectiontool.h"
|
2016-04-03 22:27:41 +08:00
|
|
|
#include "gimpguidetool.h"
|
2003-02-05 22:39:40 +08:00
|
|
|
#include "gimpmoveoptions.h"
|
2001-03-08 09:07:03 +08:00
|
|
|
#include "gimpmovetool.h"
|
2003-04-16 00:05:52 +08:00
|
|
|
#include "gimptoolcontrol.h"
|
2018-12-10 21:22:50 +08:00
|
|
|
#include "gimptools-utils.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-03-26 00:38:19 +08:00
|
|
|
#include "gimp-intl.h"
|
1998-12-16 08:37:09 +08:00
|
|
|
|
2007-03-09 19:10:40 +08:00
|
|
|
|
2001-11-26 21:17:18 +08:00
|
|
|
/* local function prototypes */
|
|
|
|
|
app: allow moving an intersecting pair of guides with the Move tool
This commit adds support for moving together an intersecting pair
of guides using the Move tool, by dragging the guides at their
point of intersection. This is useful when the guides are used to
mark a point, rather than a pair of lines (e.g., as is the case for
the mandala symmetry guides, which mark the symmetry's point of
origin).
Add gimp_image_pick_guides(), which can return a set of guides,
rather than a single guide. The API allows an arbitrary set of
guides to be returned, but, in practice, at most two intersecting
guides are returned, as per the above.
In GimpMoveTool and GimpGuideTool, add support for moving multiple
guides together, and, in GimpMoveTool, use gimp_image_pick_guides()
to potentially pick multiple guides.
2019-05-30 13:39:26 +08:00
|
|
|
static void gimp_move_tool_finalize (GObject *object);
|
|
|
|
|
2007-02-28 02:55:12 +08:00
|
|
|
static void gimp_move_tool_button_press (GimpTool *tool,
|
2008-11-01 23:17:36 +08:00
|
|
|
const GimpCoords *coords,
|
2007-02-28 02:55:12 +08:00
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
2009-06-20 23:37:31 +08:00
|
|
|
GimpButtonPressType press_type,
|
2007-02-28 02:55:12 +08:00
|
|
|
GimpDisplay *display);
|
|
|
|
static void gimp_move_tool_button_release (GimpTool *tool,
|
2008-11-01 23:17:36 +08:00
|
|
|
const GimpCoords *coords,
|
2007-02-28 02:55:12 +08:00
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpButtonReleaseType release_type,
|
|
|
|
GimpDisplay *display);
|
2007-03-07 17:34:47 +08:00
|
|
|
static gboolean gimp_move_tool_key_press (GimpTool *tool,
|
|
|
|
GdkEventKey *kevent,
|
|
|
|
GimpDisplay *display);
|
2007-02-28 02:55:12 +08:00
|
|
|
static void gimp_move_tool_modifier_key (GimpTool *tool,
|
|
|
|
GdkModifierType key,
|
|
|
|
gboolean press,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *display);
|
|
|
|
static void gimp_move_tool_oper_update (GimpTool *tool,
|
2008-11-01 23:17:36 +08:00
|
|
|
const GimpCoords *coords,
|
2007-02-28 02:55:12 +08:00
|
|
|
GdkModifierType state,
|
|
|
|
gboolean proximity,
|
|
|
|
GimpDisplay *display);
|
|
|
|
static void gimp_move_tool_cursor_update (GimpTool *tool,
|
2008-11-01 23:17:36 +08:00
|
|
|
const GimpCoords *coords,
|
2007-02-28 02:55:12 +08:00
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *display);
|
|
|
|
|
|
|
|
static void gimp_move_tool_draw (GimpDrawTool *draw_tool);
|
|
|
|
|
2000-12-31 12:07:42 +08:00
|
|
|
|
2006-05-15 17:46:31 +08:00
|
|
|
G_DEFINE_TYPE (GimpMoveTool, gimp_move_tool, GIMP_TYPE_DRAW_TOOL)
|
2005-12-13 17:13:50 +08:00
|
|
|
|
|
|
|
#define parent_class gimp_move_tool_parent_class
|
2001-02-22 05:56:39 +08:00
|
|
|
|
|
|
|
|
|
|
|
void
|
2002-03-29 11:50:29 +08:00
|
|
|
gimp_move_tool_register (GimpToolRegisterCallback callback,
|
2002-05-03 19:31:08 +08:00
|
|
|
gpointer data)
|
2001-02-22 05:56:39 +08:00
|
|
|
{
|
2002-03-29 11:50:29 +08:00
|
|
|
(* callback) (GIMP_TYPE_MOVE_TOOL,
|
2003-02-05 22:39:40 +08:00
|
|
|
GIMP_TYPE_MOVE_OPTIONS,
|
|
|
|
gimp_move_options_gui,
|
2003-06-28 19:20:37 +08:00
|
|
|
0,
|
2002-03-21 20:17:17 +08:00
|
|
|
"gimp-move-tool",
|
2008-05-23 22:09:55 +08:00
|
|
|
C_("tool", "Move"),
|
2006-09-19 02:00:22 +08:00
|
|
|
_("Move Tool: Move layers, selections, and other objects"),
|
2004-04-29 21:19:28 +08:00
|
|
|
N_("_Move"), "M",
|
2003-08-22 09:42:57 +08:00
|
|
|
NULL, GIMP_HELP_TOOL_MOVE,
|
2017-03-05 23:01:59 +08:00
|
|
|
GIMP_ICON_TOOL_MOVE,
|
2002-05-03 19:31:08 +08:00
|
|
|
data);
|
2001-02-22 05:56:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_move_tool_class_init (GimpMoveToolClass *klass)
|
|
|
|
{
|
app: allow moving an intersecting pair of guides with the Move tool
This commit adds support for moving together an intersecting pair
of guides using the Move tool, by dragging the guides at their
point of intersection. This is useful when the guides are used to
mark a point, rather than a pair of lines (e.g., as is the case for
the mandala symmetry guides, which mark the symmetry's point of
origin).
Add gimp_image_pick_guides(), which can return a set of guides,
rather than a single guide. The API allows an arbitrary set of
guides to be returned, but, in practice, at most two intersecting
guides are returned, as per the above.
In GimpMoveTool and GimpGuideTool, add support for moving multiple
guides together, and, in GimpMoveTool, use gimp_image_pick_guides()
to potentially pick multiple guides.
2019-05-30 13:39:26 +08:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
2004-03-09 21:24:15 +08:00
|
|
|
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
|
|
|
|
GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass);
|
2001-02-22 05:56:39 +08:00
|
|
|
|
app: allow moving an intersecting pair of guides with the Move tool
This commit adds support for moving together an intersecting pair
of guides using the Move tool, by dragging the guides at their
point of intersection. This is useful when the guides are used to
mark a point, rather than a pair of lines (e.g., as is the case for
the mandala symmetry guides, which mark the symmetry's point of
origin).
Add gimp_image_pick_guides(), which can return a set of guides,
rather than a single guide. The API allows an arbitrary set of
guides to be returned, but, in practice, at most two intersecting
guides are returned, as per the above.
In GimpMoveTool and GimpGuideTool, add support for moving multiple
guides together, and, in GimpMoveTool, use gimp_image_pick_guides()
to potentially pick multiple guides.
2019-05-30 13:39:26 +08:00
|
|
|
object_class->finalize = gimp_move_tool_finalize;
|
|
|
|
|
2001-11-11 07:03:22 +08:00
|
|
|
tool_class->button_press = gimp_move_tool_button_press;
|
|
|
|
tool_class->button_release = gimp_move_tool_button_release;
|
2007-03-07 03:56:08 +08:00
|
|
|
tool_class->key_press = gimp_move_tool_key_press;
|
2001-11-26 21:17:18 +08:00
|
|
|
tool_class->modifier_key = gimp_move_tool_modifier_key;
|
2003-10-29 23:03:56 +08:00
|
|
|
tool_class->oper_update = gimp_move_tool_oper_update;
|
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)
|
|
|
|
{
|
2003-10-31 19:51:47 +08:00
|
|
|
GimpTool *tool = GIMP_TOOL (move_tool);
|
2001-02-22 05:56:39 +08:00
|
|
|
|
2011-04-04 14:19:12 +08:00
|
|
|
gimp_tool_control_set_snap_to (tool->control, FALSE);
|
|
|
|
gimp_tool_control_set_handle_empty_image (tool->control, TRUE);
|
|
|
|
gimp_tool_control_set_tool_cursor (tool->control,
|
|
|
|
GIMP_TOOL_CURSOR_MOVE);
|
|
|
|
|
2004-10-07 05:04:13 +08:00
|
|
|
move_tool->floating_layer = NULL;
|
app: allow moving an intersecting pair of guides with the Move tool
This commit adds support for moving together an intersecting pair
of guides using the Move tool, by dragging the guides at their
point of intersection. This is useful when the guides are used to
mark a point, rather than a pair of lines (e.g., as is the case for
the mandala symmetry guides, which mark the symmetry's point of
origin).
Add gimp_image_pick_guides(), which can return a set of guides,
rather than a single guide. The API allows an arbitrary set of
guides to be returned, but, in practice, at most two intersecting
guides are returned, as per the above.
In GimpMoveTool and GimpGuideTool, add support for moving multiple
guides together, and, in GimpMoveTool, use gimp_image_pick_guides()
to potentially pick multiple guides.
2019-05-30 13:39:26 +08:00
|
|
|
move_tool->guides = NULL;
|
2003-03-28 21:52:01 +08:00
|
|
|
|
2004-10-07 05:04:13 +08:00
|
|
|
move_tool->saved_type = GIMP_TRANSFORM_TYPE_LAYER;
|
|
|
|
|
|
|
|
move_tool->old_active_layer = NULL;
|
|
|
|
move_tool->old_active_vectors = NULL;
|
2001-02-22 05:56:39 +08:00
|
|
|
}
|
|
|
|
|
app: allow moving an intersecting pair of guides with the Move tool
This commit adds support for moving together an intersecting pair
of guides using the Move tool, by dragging the guides at their
point of intersection. This is useful when the guides are used to
mark a point, rather than a pair of lines (e.g., as is the case for
the mandala symmetry guides, which mark the symmetry's point of
origin).
Add gimp_image_pick_guides(), which can return a set of guides,
rather than a single guide. The API allows an arbitrary set of
guides to be returned, but, in practice, at most two intersecting
guides are returned, as per the above.
In GimpMoveTool and GimpGuideTool, add support for moving multiple
guides together, and, in GimpMoveTool, use gimp_image_pick_guides()
to potentially pick multiple guides.
2019-05-30 13:39:26 +08:00
|
|
|
static void
|
|
|
|
gimp_move_tool_finalize (GObject *object)
|
|
|
|
{
|
|
|
|
GimpMoveTool *move = GIMP_MOVE_TOOL (object);
|
|
|
|
|
|
|
|
g_clear_pointer (&move->guides, g_list_free);
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
static void
|
2009-06-20 23:37:31 +08:00
|
|
|
gimp_move_tool_button_press (GimpTool *tool,
|
|
|
|
const GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpButtonPressType press_type,
|
|
|
|
GimpDisplay *display)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2018-04-19 02:41:54 +08:00
|
|
|
GimpMoveTool *move = GIMP_MOVE_TOOL (tool);
|
|
|
|
GimpMoveOptions *options = GIMP_MOVE_TOOL_GET_OPTIONS (tool);
|
|
|
|
GimpDisplayShell *shell = gimp_display_get_shell (display);
|
|
|
|
GimpImage *image = gimp_display_get_image (display);
|
|
|
|
GimpItem *active_item = NULL;
|
|
|
|
GimpTranslateMode translate_mode = GIMP_TRANSLATE_MODE_MASK;
|
|
|
|
const gchar *null_message = NULL;
|
|
|
|
const gchar *locked_message = NULL;
|
2001-11-26 21:17:18 +08:00
|
|
|
|
2006-03-29 01:55:52 +08:00
|
|
|
tool->display = display;
|
2002-02-05 19:35:03 +08:00
|
|
|
|
app: allow moving an intersecting pair of guides with the Move tool
This commit adds support for moving together an intersecting pair
of guides using the Move tool, by dragging the guides at their
point of intersection. This is useful when the guides are used to
mark a point, rather than a pair of lines (e.g., as is the case for
the mandala symmetry guides, which mark the symmetry's point of
origin).
Add gimp_image_pick_guides(), which can return a set of guides,
rather than a single guide. The API allows an arbitrary set of
guides to be returned, but, in practice, at most two intersecting
guides are returned, as per the above.
In GimpMoveTool and GimpGuideTool, add support for moving multiple
guides together, and, in GimpMoveTool, use gimp_image_pick_guides()
to potentially pick multiple guides.
2019-05-30 13:39:26 +08:00
|
|
|
move->floating_layer = NULL;
|
|
|
|
|
|
|
|
g_clear_pointer (&move->guides, g_list_free);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2004-03-09 21:24:15 +08:00
|
|
|
if (! options->move_current)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2017-06-22 17:35:57 +08:00
|
|
|
const gint snap_distance = display->config->snap_distance;
|
|
|
|
|
2004-03-09 21:24:15 +08:00
|
|
|
if (options->move_type == GIMP_TRANSFORM_TYPE_PATH)
|
2003-09-17 00:23:38 +08:00
|
|
|
{
|
|
|
|
GimpVectors *vectors;
|
|
|
|
|
2017-06-22 17:35:57 +08:00
|
|
|
vectors = gimp_image_pick_vectors (image,
|
|
|
|
coords->x, coords->y,
|
|
|
|
FUNSCALEX (shell, snap_distance),
|
|
|
|
FUNSCALEY (shell, snap_distance));
|
2017-06-22 07:31:41 +08:00
|
|
|
if (vectors)
|
2003-09-17 00:23:38 +08:00
|
|
|
{
|
2004-10-07 05:04:13 +08:00
|
|
|
move->old_active_vectors =
|
2009-10-08 01:00:42 +08:00
|
|
|
gimp_image_get_active_vectors (image);
|
2004-10-07 05:04:13 +08:00
|
|
|
|
2009-10-08 01:00:42 +08:00
|
|
|
gimp_image_set_active_vectors (image, vectors);
|
2003-09-17 00:23:38 +08:00
|
|
|
}
|
2004-01-12 22:13:24 +08:00
|
|
|
else
|
2004-03-09 21:24:15 +08:00
|
|
|
{
|
|
|
|
/* no path picked */
|
|
|
|
return;
|
|
|
|
}
|
2003-09-17 00:23:38 +08:00
|
|
|
}
|
2004-03-09 21:24:15 +08:00
|
|
|
else if (options->move_type == GIMP_TRANSFORM_TYPE_LAYER)
|
|
|
|
{
|
app: allow moving an intersecting pair of guides with the Move tool
This commit adds support for moving together an intersecting pair
of guides using the Move tool, by dragging the guides at their
point of intersection. This is useful when the guides are used to
mark a point, rather than a pair of lines (e.g., as is the case for
the mandala symmetry guides, which mark the symmetry's point of
origin).
Add gimp_image_pick_guides(), which can return a set of guides,
rather than a single guide. The API allows an arbitrary set of
guides to be returned, but, in practice, at most two intersecting
guides are returned, as per the above.
In GimpMoveTool and GimpGuideTool, add support for moving multiple
guides together, and, in GimpMoveTool, use gimp_image_pick_guides()
to potentially pick multiple guides.
2019-05-30 13:39:26 +08:00
|
|
|
GList *guides;
|
|
|
|
GimpLayer *layer;
|
2004-03-09 21:24:15 +08:00
|
|
|
|
|
|
|
if (gimp_display_shell_get_show_guides (shell) &&
|
app: allow moving an intersecting pair of guides with the Move tool
This commit adds support for moving together an intersecting pair
of guides using the Move tool, by dragging the guides at their
point of intersection. This is useful when the guides are used to
mark a point, rather than a pair of lines (e.g., as is the case for
the mandala symmetry guides, which mark the symmetry's point of
origin).
Add gimp_image_pick_guides(), which can return a set of guides,
rather than a single guide. The API allows an arbitrary set of
guides to be returned, but, in practice, at most two intersecting
guides are returned, as per the above.
In GimpMoveTool and GimpGuideTool, add support for moving multiple
guides together, and, in GimpMoveTool, use gimp_image_pick_guides()
to potentially pick multiple guides.
2019-05-30 13:39:26 +08:00
|
|
|
(guides = gimp_image_pick_guides (image,
|
|
|
|
coords->x, coords->y,
|
|
|
|
FUNSCALEX (shell, snap_distance),
|
|
|
|
FUNSCALEY (shell, snap_distance))))
|
2004-03-09 21:24:15 +08:00
|
|
|
{
|
app: allow moving an intersecting pair of guides with the Move tool
This commit adds support for moving together an intersecting pair
of guides using the Move tool, by dragging the guides at their
point of intersection. This is useful when the guides are used to
mark a point, rather than a pair of lines (e.g., as is the case for
the mandala symmetry guides, which mark the symmetry's point of
origin).
Add gimp_image_pick_guides(), which can return a set of guides,
rather than a single guide. The API allows an arbitrary set of
guides to be returned, but, in practice, at most two intersecting
guides are returned, as per the above.
In GimpMoveTool and GimpGuideTool, add support for moving multiple
guides together, and, in GimpMoveTool, use gimp_image_pick_guides()
to potentially pick multiple guides.
2019-05-30 13:39:26 +08:00
|
|
|
move->guides = guides;
|
2004-02-19 04:31:11 +08:00
|
|
|
|
app: allow moving an intersecting pair of guides with the Move tool
This commit adds support for moving together an intersecting pair
of guides using the Move tool, by dragging the guides at their
point of intersection. This is useful when the guides are used to
mark a point, rather than a pair of lines (e.g., as is the case for
the mandala symmetry guides, which mark the symmetry's point of
origin).
Add gimp_image_pick_guides(), which can return a set of guides,
rather than a single guide. The API allows an arbitrary set of
guides to be returned, but, in practice, at most two intersecting
guides are returned, as per the above.
In GimpMoveTool and GimpGuideTool, add support for moving multiple
guides together, and, in GimpMoveTool, use gimp_image_pick_guides()
to potentially pick multiple guides.
2019-05-30 13:39:26 +08:00
|
|
|
gimp_guide_tool_start_edit_many (tool, display, guides);
|
2004-11-09 21:03:07 +08:00
|
|
|
|
2004-03-09 21:24:15 +08:00
|
|
|
return;
|
|
|
|
}
|
2009-10-08 01:00:42 +08:00
|
|
|
else if ((layer = gimp_image_pick_layer (image,
|
2009-08-26 05:18:34 +08:00
|
|
|
coords->x,
|
2018-12-16 06:34:07 +08:00
|
|
|
coords->y,
|
|
|
|
NULL)))
|
2004-03-09 21:24:15 +08:00
|
|
|
{
|
2009-10-08 01:00:42 +08:00
|
|
|
if (gimp_image_get_floating_selection (image) &&
|
2004-03-09 21:24:15 +08:00
|
|
|
! gimp_layer_is_floating_sel (layer))
|
|
|
|
{
|
|
|
|
/* If there is a floating selection, and this aint it,
|
|
|
|
* use the move tool to anchor it.
|
|
|
|
*/
|
2008-11-14 23:01:44 +08:00
|
|
|
move->floating_layer =
|
2009-10-08 01:00:42 +08:00
|
|
|
gimp_image_get_floating_selection (image);
|
2008-11-14 23:01:44 +08:00
|
|
|
|
2004-03-09 21:24:15 +08:00
|
|
|
gimp_tool_control_activate (tool->control);
|
2003-04-13 19:43:47 +08:00
|
|
|
|
2004-03-09 21:24:15 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-10-08 01:00:42 +08:00
|
|
|
move->old_active_layer = gimp_image_get_active_layer (image);
|
2004-10-07 05:04:13 +08:00
|
|
|
|
2009-10-08 01:00:42 +08:00
|
|
|
gimp_image_set_active_layer (image, layer);
|
2004-03-09 21:24:15 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* no guide and no layer picked */
|
2004-03-05 05:01:26 +08:00
|
|
|
|
2004-03-09 21:24:15 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2004-03-05 05:01:26 +08:00
|
|
|
|
2004-03-09 21:24:15 +08:00
|
|
|
switch (options->move_type)
|
|
|
|
{
|
|
|
|
case GIMP_TRANSFORM_TYPE_PATH:
|
2012-11-09 18:17:25 +08:00
|
|
|
{
|
2018-04-19 02:41:54 +08:00
|
|
|
active_item = GIMP_ITEM (gimp_image_get_active_vectors (image));
|
2012-11-09 18:17:25 +08:00
|
|
|
|
2018-04-19 02:41:54 +08:00
|
|
|
translate_mode = GIMP_TRANSLATE_MODE_VECTORS;
|
|
|
|
|
|
|
|
if (! active_item)
|
|
|
|
{
|
|
|
|
null_message = _("There is no path to move.");
|
|
|
|
}
|
|
|
|
else if (gimp_item_is_position_locked (active_item))
|
2012-11-09 18:17:25 +08:00
|
|
|
{
|
2018-04-19 02:41:54 +08:00
|
|
|
locked_message = _("The active path's position is locked.");
|
2012-11-09 18:17:25 +08:00
|
|
|
}
|
|
|
|
}
|
2004-03-09 21:24:15 +08:00
|
|
|
break;
|
2004-03-05 05:01:26 +08:00
|
|
|
|
2004-03-09 21:24:15 +08:00
|
|
|
case GIMP_TRANSFORM_TYPE_SELECTION:
|
2012-11-09 18:17:25 +08:00
|
|
|
{
|
2018-04-19 02:41:54 +08:00
|
|
|
active_item = GIMP_ITEM (gimp_image_get_mask (image));
|
|
|
|
|
2018-12-10 20:34:27 +08:00
|
|
|
if (gimp_channel_is_empty (GIMP_CHANNEL (active_item)))
|
|
|
|
active_item = NULL;
|
|
|
|
|
2018-04-19 02:41:54 +08:00
|
|
|
translate_mode = GIMP_TRANSLATE_MODE_MASK;
|
2012-11-09 18:17:25 +08:00
|
|
|
|
2018-04-19 02:41:54 +08:00
|
|
|
if (! active_item)
|
|
|
|
{
|
|
|
|
/* cannot happen, don't translate this message */
|
|
|
|
null_message = "There is no selection to move.";
|
|
|
|
}
|
|
|
|
else if (gimp_item_is_position_locked (active_item))
|
|
|
|
{
|
|
|
|
locked_message = "The selection's position is locked.";
|
|
|
|
}
|
2012-11-09 18:17:25 +08:00
|
|
|
}
|
2004-03-09 21:24:15 +08:00
|
|
|
break;
|
2004-03-05 05:01:26 +08:00
|
|
|
|
2004-03-09 21:24:15 +08:00
|
|
|
case GIMP_TRANSFORM_TYPE_LAYER:
|
|
|
|
{
|
2018-04-19 02:41:54 +08:00
|
|
|
active_item = GIMP_ITEM (gimp_image_get_active_drawable (image));
|
2004-03-09 21:24:15 +08:00
|
|
|
|
2018-04-19 02:41:54 +08:00
|
|
|
if (! active_item)
|
2011-04-07 02:30:29 +08:00
|
|
|
{
|
2018-04-19 02:41:54 +08:00
|
|
|
null_message = _("There is no layer to move.");
|
|
|
|
}
|
|
|
|
else if (GIMP_IS_LAYER_MASK (active_item))
|
|
|
|
{
|
|
|
|
translate_mode = GIMP_TRANSLATE_MODE_LAYER_MASK;
|
|
|
|
|
|
|
|
if (gimp_item_is_position_locked (active_item))
|
|
|
|
locked_message = _("The active layer's position is locked.");
|
|
|
|
else if (gimp_item_is_content_locked (active_item))
|
|
|
|
locked_message = _("The active layer's pixels are locked.");
|
2011-04-07 02:30:29 +08:00
|
|
|
}
|
2012-11-09 18:17:25 +08:00
|
|
|
else if (GIMP_IS_CHANNEL (active_item))
|
2011-04-07 02:30:29 +08:00
|
|
|
{
|
2018-04-19 02:41:54 +08:00
|
|
|
translate_mode = GIMP_TRANSLATE_MODE_CHANNEL;
|
|
|
|
|
|
|
|
if (gimp_item_is_position_locked (active_item))
|
|
|
|
locked_message = _("The active channel's position is locked.");
|
|
|
|
else if (gimp_item_is_content_locked (active_item))
|
|
|
|
locked_message = _("The active channel's pixels are locked.");
|
2011-04-07 02:30:29 +08:00
|
|
|
}
|
2018-04-19 02:41:54 +08:00
|
|
|
else
|
2011-04-07 02:30:29 +08:00
|
|
|
{
|
2018-04-19 02:41:54 +08:00
|
|
|
translate_mode = GIMP_TRANSLATE_MODE_LAYER;
|
|
|
|
|
|
|
|
if (gimp_item_is_position_locked (active_item))
|
|
|
|
locked_message = _("The active layer's position is locked.");
|
2011-04-07 02:30:29 +08:00
|
|
|
}
|
2004-03-09 21:24:15 +08:00
|
|
|
}
|
|
|
|
break;
|
2019-08-11 03:57:55 +08:00
|
|
|
|
|
|
|
case GIMP_TRANSFORM_TYPE_IMAGE:
|
|
|
|
g_return_if_reached ();
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2012-11-09 18:17:25 +08:00
|
|
|
|
|
|
|
if (! active_item)
|
|
|
|
{
|
|
|
|
gimp_tool_message_literal (tool, display, null_message);
|
2018-12-10 20:34:27 +08:00
|
|
|
gimp_widget_blink (options->type_box);
|
2012-11-09 18:17:25 +08:00
|
|
|
gimp_tool_control (tool, GIMP_TOOL_ACTION_HALT, display);
|
2018-04-19 02:41:54 +08:00
|
|
|
return;
|
2012-11-09 18:17:25 +08:00
|
|
|
}
|
2018-04-19 02:41:54 +08:00
|
|
|
else if (locked_message)
|
2012-11-09 18:17:25 +08:00
|
|
|
{
|
|
|
|
gimp_tool_message_literal (tool, display, locked_message);
|
2018-12-10 21:22:50 +08:00
|
|
|
gimp_tools_blink_lock_box (display->gimp, active_item);
|
2012-11-09 18:17:25 +08:00
|
|
|
gimp_tool_control (tool, GIMP_TOOL_ACTION_HALT, display);
|
2018-04-19 02:41:54 +08:00
|
|
|
return;
|
2012-11-09 18:17:25 +08:00
|
|
|
}
|
2018-04-19 02:41:54 +08:00
|
|
|
|
|
|
|
gimp_tool_control_activate (tool->control);
|
|
|
|
|
|
|
|
gimp_edit_selection_tool_start (tool, display, coords,
|
|
|
|
translate_mode,
|
|
|
|
TRUE);
|
1998-03-16 19:13:24 +08:00
|
|
|
}
|
|
|
|
|
1998-03-19 06:35:31 +08:00
|
|
|
static void
|
2007-02-28 02:55:12 +08:00
|
|
|
gimp_move_tool_button_release (GimpTool *tool,
|
2008-11-01 23:17:36 +08:00
|
|
|
const GimpCoords *coords,
|
2007-02-28 02:55:12 +08:00
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpButtonReleaseType release_type,
|
|
|
|
GimpDisplay *display)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2016-04-03 22:27:41 +08:00
|
|
|
GimpMoveTool *move = GIMP_MOVE_TOOL (tool);
|
|
|
|
GimpGuiConfig *config = GIMP_GUI_CONFIG (display->gimp->config);
|
|
|
|
GimpImage *image = gimp_display_get_image (display);
|
|
|
|
gboolean flush = FALSE;
|
2002-06-27 06:16:59 +08:00
|
|
|
|
2011-04-07 02:30:29 +08:00
|
|
|
gimp_tool_control_halt (tool->control);
|
2001-11-09 03:14:51 +08:00
|
|
|
|
2016-04-03 22:27:41 +08:00
|
|
|
if (! config->move_tool_changes_active ||
|
|
|
|
(release_type == GIMP_BUTTON_RELEASE_CANCEL))
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2016-04-03 22:27:41 +08:00
|
|
|
if (move->old_active_layer)
|
2003-03-28 21:52:01 +08:00
|
|
|
{
|
2016-04-03 22:27:41 +08:00
|
|
|
gimp_image_set_active_layer (image, move->old_active_layer);
|
|
|
|
move->old_active_layer = NULL;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2016-04-03 22:27:41 +08:00
|
|
|
flush = TRUE;
|
2003-03-28 21:52:01 +08:00
|
|
|
}
|
2002-06-27 06:16:59 +08:00
|
|
|
|
2016-04-03 22:27:41 +08:00
|
|
|
if (move->old_active_vectors)
|
2006-04-12 20:49:29 +08:00
|
|
|
{
|
2016-04-03 22:27:41 +08:00
|
|
|
gimp_image_set_active_vectors (image, move->old_active_vectors);
|
|
|
|
move->old_active_vectors = NULL;
|
2008-10-10 23:41:03 +08:00
|
|
|
|
2016-04-03 22:27:41 +08:00
|
|
|
flush = TRUE;
|
2006-04-12 20:49:29 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2016-04-03 22:27:41 +08:00
|
|
|
if (release_type != GIMP_BUTTON_RELEASE_CANCEL)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2016-04-03 22:27:41 +08:00
|
|
|
if (move->floating_layer)
|
2001-11-09 03:14:51 +08:00
|
|
|
{
|
2016-04-03 22:27:41 +08:00
|
|
|
floating_sel_anchor (move->floating_layer);
|
2004-11-09 21:03:07 +08:00
|
|
|
|
2016-04-03 22:27:41 +08:00
|
|
|
flush = TRUE;
|
2001-11-09 03:14:51 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2016-04-03 22:27:41 +08:00
|
|
|
|
|
|
|
if (flush)
|
|
|
|
gimp_image_flush (image);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2007-03-07 17:34:47 +08:00
|
|
|
static gboolean
|
|
|
|
gimp_move_tool_key_press (GimpTool *tool,
|
|
|
|
GdkEventKey *kevent,
|
|
|
|
GimpDisplay *display)
|
|
|
|
{
|
|
|
|
GimpMoveOptions *options = GIMP_MOVE_TOOL_GET_OPTIONS (tool);
|
|
|
|
|
|
|
|
return gimp_edit_selection_tool_translate (tool, kevent,
|
|
|
|
options->move_type,
|
2018-12-10 20:34:27 +08:00
|
|
|
display,
|
|
|
|
options->type_box);
|
2007-03-07 17:34:47 +08:00
|
|
|
}
|
|
|
|
|
2001-11-26 21:17:18 +08:00
|
|
|
static void
|
|
|
|
gimp_move_tool_modifier_key (GimpTool *tool,
|
|
|
|
GdkModifierType key,
|
|
|
|
gboolean press,
|
2006-04-12 20:49:29 +08:00
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *display)
|
2001-11-26 21:17:18 +08:00
|
|
|
{
|
2004-03-09 21:24:15 +08:00
|
|
|
GimpMoveTool *move = GIMP_MOVE_TOOL (tool);
|
2006-09-06 02:25:31 +08:00
|
|
|
GimpMoveOptions *options = GIMP_MOVE_TOOL_GET_OPTIONS (tool);
|
2001-11-26 21:17:18 +08:00
|
|
|
|
2015-10-17 21:31:08 +08:00
|
|
|
if (key == gimp_get_extend_selection_mask ())
|
2001-11-26 21:17:18 +08:00
|
|
|
{
|
2003-09-17 00:23:38 +08:00
|
|
|
g_object_set (options, "move-current", ! options->move_current, NULL);
|
2001-11-26 21:17:18 +08:00
|
|
|
}
|
2011-10-07 03:59:07 +08:00
|
|
|
else if (key == GDK_MOD1_MASK ||
|
|
|
|
key == gimp_get_toggle_behavior_mask ())
|
2001-11-26 21:17:18 +08:00
|
|
|
{
|
2003-09-17 00:23:38 +08:00
|
|
|
GimpTransformType button_type;
|
|
|
|
|
|
|
|
button_type = options->move_type;
|
|
|
|
|
|
|
|
if (press)
|
|
|
|
{
|
2011-10-07 03:59:07 +08:00
|
|
|
if (key == (state & (GDK_MOD1_MASK |
|
|
|
|
gimp_get_toggle_behavior_mask ())))
|
2003-09-17 00:23:38 +08:00
|
|
|
{
|
|
|
|
/* first modifier pressed */
|
|
|
|
|
2004-03-09 21:24:15 +08:00
|
|
|
move->saved_type = options->move_type;
|
2003-09-17 00:23:38 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-10-07 03:59:07 +08:00
|
|
|
if (! (state & (GDK_MOD1_MASK |
|
|
|
|
gimp_get_toggle_behavior_mask ())))
|
2003-09-17 00:23:38 +08:00
|
|
|
{
|
|
|
|
/* last modifier released */
|
|
|
|
|
2004-03-09 21:24:15 +08:00
|
|
|
button_type = move->saved_type;
|
2003-09-17 00:23:38 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (state & GDK_MOD1_MASK)
|
|
|
|
{
|
|
|
|
button_type = GIMP_TRANSFORM_TYPE_SELECTION;
|
|
|
|
}
|
2011-10-07 03:59:07 +08:00
|
|
|
else if (state & gimp_get_toggle_behavior_mask ())
|
2003-09-17 00:23:38 +08:00
|
|
|
{
|
|
|
|
button_type = GIMP_TRANSFORM_TYPE_PATH;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (button_type != options->move_type)
|
|
|
|
{
|
|
|
|
g_object_set (options, "move-type", button_type, NULL);
|
|
|
|
}
|
2001-11-26 21:17:18 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-29 23:03:56 +08:00
|
|
|
static void
|
2008-11-01 23:17:36 +08:00
|
|
|
gimp_move_tool_oper_update (GimpTool *tool,
|
|
|
|
const GimpCoords *coords,
|
|
|
|
GdkModifierType state,
|
|
|
|
gboolean proximity,
|
|
|
|
GimpDisplay *display)
|
2003-10-29 23:03:56 +08:00
|
|
|
{
|
2004-03-09 21:24:15 +08:00
|
|
|
GimpMoveTool *move = GIMP_MOVE_TOOL (tool);
|
2006-09-06 02:25:31 +08:00
|
|
|
GimpMoveOptions *options = GIMP_MOVE_TOOL_GET_OPTIONS (tool);
|
2009-10-05 01:56:39 +08:00
|
|
|
GimpDisplayShell *shell = gimp_display_get_shell (display);
|
2009-10-08 01:00:42 +08:00
|
|
|
GimpImage *image = gimp_display_get_image (display);
|
app: allow moving an intersecting pair of guides with the Move tool
This commit adds support for moving together an intersecting pair
of guides using the Move tool, by dragging the guides at their
point of intersection. This is useful when the guides are used to
mark a point, rather than a pair of lines (e.g., as is the case for
the mandala symmetry guides, which mark the symmetry's point of
origin).
Add gimp_image_pick_guides(), which can return a set of guides,
rather than a single guide. The API allows an arbitrary set of
guides to be returned, but, in practice, at most two intersecting
guides are returned, as per the above.
In GimpMoveTool and GimpGuideTool, add support for moving multiple
guides together, and, in GimpMoveTool, use gimp_image_pick_guides()
to potentially pick multiple guides.
2019-05-30 13:39:26 +08:00
|
|
|
GList *guides = NULL;
|
2003-10-29 23:03:56 +08:00
|
|
|
|
|
|
|
if (options->move_type == GIMP_TRANSFORM_TYPE_LAYER &&
|
|
|
|
! options->move_current &&
|
|
|
|
gimp_display_shell_get_show_guides (shell) &&
|
2006-03-25 22:23:09 +08:00
|
|
|
proximity)
|
2003-10-29 23:03:56 +08:00
|
|
|
{
|
2011-04-05 01:20:04 +08:00
|
|
|
gint snap_distance = display->config->snap_distance;
|
2004-07-14 18:31:59 +08:00
|
|
|
|
app: allow moving an intersecting pair of guides with the Move tool
This commit adds support for moving together an intersecting pair
of guides using the Move tool, by dragging the guides at their
point of intersection. This is useful when the guides are used to
mark a point, rather than a pair of lines (e.g., as is the case for
the mandala symmetry guides, which mark the symmetry's point of
origin).
Add gimp_image_pick_guides(), which can return a set of guides,
rather than a single guide. The API allows an arbitrary set of
guides to be returned, but, in practice, at most two intersecting
guides are returned, as per the above.
In GimpMoveTool and GimpGuideTool, add support for moving multiple
guides together, and, in GimpMoveTool, use gimp_image_pick_guides()
to potentially pick multiple guides.
2019-05-30 13:39:26 +08:00
|
|
|
guides = gimp_image_pick_guides (image, coords->x, coords->y,
|
|
|
|
FUNSCALEX (shell, snap_distance),
|
|
|
|
FUNSCALEY (shell, snap_distance));
|
2003-10-29 23:03:56 +08:00
|
|
|
}
|
|
|
|
|
2019-05-30 15:30:32 +08:00
|
|
|
if (gimp_g_list_compare (guides, move->guides))
|
2010-08-12 06:51:58 +08:00
|
|
|
{
|
2010-09-30 06:18:00 +08:00
|
|
|
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
|
2003-10-29 23:03:56 +08:00
|
|
|
|
2010-09-30 06:29:11 +08:00
|
|
|
gimp_draw_tool_pause (draw_tool);
|
|
|
|
|
|
|
|
if (gimp_draw_tool_is_active (draw_tool) &&
|
|
|
|
draw_tool->display != display)
|
2010-09-30 06:18:00 +08:00
|
|
|
gimp_draw_tool_stop (draw_tool);
|
2004-03-09 21:24:15 +08:00
|
|
|
|
app: allow moving an intersecting pair of guides with the Move tool
This commit adds support for moving together an intersecting pair
of guides using the Move tool, by dragging the guides at their
point of intersection. This is useful when the guides are used to
mark a point, rather than a pair of lines (e.g., as is the case for
the mandala symmetry guides, which mark the symmetry's point of
origin).
Add gimp_image_pick_guides(), which can return a set of guides,
rather than a single guide. The API allows an arbitrary set of
guides to be returned, but, in practice, at most two intersecting
guides are returned, as per the above.
In GimpMoveTool and GimpGuideTool, add support for moving multiple
guides together, and, in GimpMoveTool, use gimp_image_pick_guides()
to potentially pick multiple guides.
2019-05-30 13:39:26 +08:00
|
|
|
g_clear_pointer (&move->guides, g_list_free);
|
|
|
|
|
|
|
|
move->guides = guides;
|
2010-09-30 06:18:00 +08:00
|
|
|
|
2010-09-30 06:29:11 +08:00
|
|
|
if (! gimp_draw_tool_is_active (draw_tool))
|
|
|
|
gimp_draw_tool_start (draw_tool, display);
|
|
|
|
|
|
|
|
gimp_draw_tool_resume (draw_tool);
|
2010-08-12 06:51:58 +08:00
|
|
|
}
|
2019-05-30 14:41:43 +08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
g_list_free (guides);
|
|
|
|
}
|
2003-10-29 23:03:56 +08:00
|
|
|
}
|
|
|
|
|
1998-03-19 06:35:31 +08:00
|
|
|
static void
|
2008-11-01 23:17:36 +08:00
|
|
|
gimp_move_tool_cursor_update (GimpTool *tool,
|
|
|
|
const GimpCoords *coords,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *display)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2017-06-22 17:35:57 +08:00
|
|
|
GimpMoveOptions *options = GIMP_MOVE_TOOL_GET_OPTIONS (tool);
|
|
|
|
GimpDisplayShell *shell = gimp_display_get_shell (display);
|
|
|
|
GimpImage *image = gimp_display_get_image (display);
|
|
|
|
GimpCursorType cursor = GIMP_CURSOR_MOUSE;
|
|
|
|
GimpToolCursorType tool_cursor = GIMP_TOOL_CURSOR_MOVE;
|
|
|
|
GimpCursorModifier modifier = GIMP_CURSOR_MODIFIER_NONE;
|
|
|
|
gint snap_distance = display->config->snap_distance;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-09-17 00:23:38 +08:00
|
|
|
if (options->move_type == GIMP_TRANSFORM_TYPE_PATH)
|
|
|
|
{
|
2004-06-05 07:08:29 +08:00
|
|
|
tool_cursor = GIMP_TOOL_CURSOR_PATHS;
|
2003-10-29 23:03:56 +08:00
|
|
|
modifier = GIMP_CURSOR_MODIFIER_MOVE;
|
|
|
|
|
2003-09-17 00:23:38 +08:00
|
|
|
if (options->move_current)
|
|
|
|
{
|
2012-11-09 18:17:25 +08:00
|
|
|
GimpItem *item = GIMP_ITEM (gimp_image_get_active_vectors (image));
|
|
|
|
|
|
|
|
if (! item || gimp_item_is_position_locked (item))
|
2006-06-02 04:30:52 +08:00
|
|
|
modifier = GIMP_CURSOR_MODIFIER_BAD;
|
2003-09-17 00:23:38 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-06-22 17:35:57 +08:00
|
|
|
if (gimp_image_pick_vectors (image,
|
|
|
|
coords->x, coords->y,
|
|
|
|
FUNSCALEX (shell, snap_distance),
|
|
|
|
FUNSCALEY (shell, snap_distance)))
|
2003-09-17 00:23:38 +08:00
|
|
|
{
|
2004-06-05 07:08:29 +08:00
|
|
|
tool_cursor = GIMP_TOOL_CURSOR_HAND;
|
2003-09-17 00:23:38 +08:00
|
|
|
}
|
2006-06-02 04:30:52 +08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
modifier = GIMP_CURSOR_MODIFIER_BAD;
|
|
|
|
}
|
2003-09-17 00:23:38 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (options->move_type == GIMP_TRANSFORM_TYPE_SELECTION)
|
2000-03-29 07:39:32 +08:00
|
|
|
{
|
2004-06-05 07:08:29 +08:00
|
|
|
tool_cursor = GIMP_TOOL_CURSOR_RECT_SELECT;
|
2003-10-29 23:03:56 +08:00
|
|
|
modifier = GIMP_CURSOR_MODIFIER_MOVE;
|
|
|
|
|
2009-10-08 01:00:42 +08:00
|
|
|
if (gimp_channel_is_empty (gimp_image_get_mask (image)))
|
2006-06-02 04:30:52 +08:00
|
|
|
modifier = GIMP_CURSOR_MODIFIER_BAD;
|
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
|
|
|
{
|
2012-11-09 18:17:25 +08:00
|
|
|
GimpItem *item = GIMP_ITEM (gimp_image_get_active_drawable (image));
|
|
|
|
|
|
|
|
if (! item || gimp_item_is_position_locked (item))
|
2006-06-02 04:30:52 +08:00
|
|
|
modifier = GIMP_CURSOR_MODIFIER_BAD;
|
2000-03-29 07:39:32 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
else
|
|
|
|
{
|
2010-10-05 03:22:28 +08:00
|
|
|
GimpLayer *layer;
|
2001-11-01 05:20:09 +08:00
|
|
|
|
2003-10-29 23:03:56 +08:00
|
|
|
if (gimp_display_shell_get_show_guides (shell) &&
|
2017-06-22 15:43:50 +08:00
|
|
|
gimp_image_pick_guide (image, coords->x, coords->y,
|
2012-08-04 09:20:36 +08:00
|
|
|
FUNSCALEX (shell, snap_distance),
|
|
|
|
FUNSCALEY (shell, snap_distance)))
|
2003-10-29 23:03:56 +08:00
|
|
|
{
|
2004-06-05 07:08:29 +08:00
|
|
|
tool_cursor = GIMP_TOOL_CURSOR_HAND;
|
2003-10-29 23:03:56 +08:00
|
|
|
modifier = GIMP_CURSOR_MODIFIER_MOVE;
|
2006-04-12 20:49:29 +08:00
|
|
|
}
|
2009-10-08 01:00:42 +08:00
|
|
|
else if ((layer = gimp_image_pick_layer (image,
|
2018-12-16 06:34:07 +08:00
|
|
|
coords->x, coords->y,
|
|
|
|
NULL)))
|
2006-04-12 20:49:29 +08:00
|
|
|
{
|
|
|
|
/* if there is a floating selection, and this aint it... */
|
2009-10-08 01:00:42 +08:00
|
|
|
if (gimp_image_get_floating_selection (image) &&
|
2006-04-12 20:49:29 +08:00
|
|
|
! gimp_layer_is_floating_sel (layer))
|
|
|
|
{
|
2004-12-17 23:16:36 +08:00
|
|
|
tool_cursor = GIMP_TOOL_CURSOR_MOVE;
|
2003-10-29 23:03:56 +08:00
|
|
|
modifier = GIMP_CURSOR_MODIFIER_ANCHOR;
|
2006-04-12 20:49:29 +08:00
|
|
|
}
|
2012-11-09 18:17:25 +08:00
|
|
|
else if (gimp_item_is_position_locked (GIMP_ITEM (layer)))
|
|
|
|
{
|
|
|
|
modifier = GIMP_CURSOR_MODIFIER_BAD;
|
|
|
|
}
|
2009-10-08 01:00:42 +08:00
|
|
|
else if (layer != gimp_image_get_active_layer (image))
|
2006-04-12 20:49:29 +08:00
|
|
|
{
|
2004-06-05 07:08:29 +08:00
|
|
|
tool_cursor = GIMP_TOOL_CURSOR_HAND;
|
2016-12-21 11:05:32 +08:00
|
|
|
modifier = GIMP_CURSOR_MODIFIER_MOVE;
|
2006-04-12 20:49:29 +08:00
|
|
|
}
|
|
|
|
}
|
2006-06-02 04:30:52 +08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
modifier = GIMP_CURSOR_MODIFIER_BAD;
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2003-10-29 23:03:56 +08:00
|
|
|
|
|
|
|
gimp_tool_control_set_cursor (tool->control, cursor);
|
|
|
|
gimp_tool_control_set_tool_cursor (tool->control, tool_cursor);
|
|
|
|
gimp_tool_control_set_cursor_modifier (tool->control, modifier);
|
|
|
|
|
2006-03-29 01:55:52 +08:00
|
|
|
GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state, display);
|
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
|
|
|
{
|
2004-03-09 21:24:15 +08:00
|
|
|
GimpMoveTool *move = GIMP_MOVE_TOOL (draw_tool);
|
app: allow moving an intersecting pair of guides with the Move tool
This commit adds support for moving together an intersecting pair
of guides using the Move tool, by dragging the guides at their
point of intersection. This is useful when the guides are used to
mark a point, rather than a pair of lines (e.g., as is the case for
the mandala symmetry guides, which mark the symmetry's point of
origin).
Add gimp_image_pick_guides(), which can return a set of guides,
rather than a single guide. The API allows an arbitrary set of
guides to be returned, but, in practice, at most two intersecting
guides are returned, as per the above.
In GimpMoveTool and GimpGuideTool, add support for moving multiple
guides together, and, in GimpMoveTool, use gimp_image_pick_guides()
to potentially pick multiple guides.
2019-05-30 13:39:26 +08:00
|
|
|
GList *iter;
|
2001-11-09 03:14:51 +08:00
|
|
|
|
app: allow moving an intersecting pair of guides with the Move tool
This commit adds support for moving together an intersecting pair
of guides using the Move tool, by dragging the guides at their
point of intersection. This is useful when the guides are used to
mark a point, rather than a pair of lines (e.g., as is the case for
the mandala symmetry guides, which mark the symmetry's point of
origin).
Add gimp_image_pick_guides(), which can return a set of guides,
rather than a single guide. The API allows an arbitrary set of
guides to be returned, but, in practice, at most two intersecting
guides are returned, as per the above.
In GimpMoveTool and GimpGuideTool, add support for moving multiple
guides together, and, in GimpMoveTool, use gimp_image_pick_guides()
to potentially pick multiple guides.
2019-05-30 13:39:26 +08:00
|
|
|
for (iter = move->guides; iter; iter = g_list_next (iter))
|
2010-09-30 06:18:00 +08:00
|
|
|
{
|
app: allow moving an intersecting pair of guides with the Move tool
This commit adds support for moving together an intersecting pair
of guides using the Move tool, by dragging the guides at their
point of intersection. This is useful when the guides are used to
mark a point, rather than a pair of lines (e.g., as is the case for
the mandala symmetry guides, which mark the symmetry's point of
origin).
Add gimp_image_pick_guides(), which can return a set of guides,
rather than a single guide. The API allows an arbitrary set of
guides to be returned, but, in practice, at most two intersecting
guides are returned, as per the above.
In GimpMoveTool and GimpGuideTool, add support for moving multiple
guides together, and, in GimpMoveTool, use gimp_image_pick_guides()
to potentially pick multiple guides.
2019-05-30 13:39:26 +08:00
|
|
|
GimpGuide *guide = iter->data;
|
2016-02-04 02:38:32 +08:00
|
|
|
GimpCanvasItem *item;
|
|
|
|
GimpGuideStyle style;
|
|
|
|
|
app: allow moving an intersecting pair of guides with the Move tool
This commit adds support for moving together an intersecting pair
of guides using the Move tool, by dragging the guides at their
point of intersection. This is useful when the guides are used to
mark a point, rather than a pair of lines (e.g., as is the case for
the mandala symmetry guides, which mark the symmetry's point of
origin).
Add gimp_image_pick_guides(), which can return a set of guides,
rather than a single guide. The API allows an arbitrary set of
guides to be returned, but, in practice, at most two intersecting
guides are returned, as per the above.
In GimpMoveTool and GimpGuideTool, add support for moving multiple
guides together, and, in GimpMoveTool, use gimp_image_pick_guides()
to potentially pick multiple guides.
2019-05-30 13:39:26 +08:00
|
|
|
style = gimp_guide_get_style (guide);
|
2010-09-30 06:18:00 +08:00
|
|
|
|
2010-09-30 08:03:16 +08:00
|
|
|
item = gimp_draw_tool_add_guide (draw_tool,
|
app: allow moving an intersecting pair of guides with the Move tool
This commit adds support for moving together an intersecting pair
of guides using the Move tool, by dragging the guides at their
point of intersection. This is useful when the guides are used to
mark a point, rather than a pair of lines (e.g., as is the case for
the mandala symmetry guides, which mark the symmetry's point of
origin).
Add gimp_image_pick_guides(), which can return a set of guides,
rather than a single guide. The API allows an arbitrary set of
guides to be returned, but, in practice, at most two intersecting
guides are returned, as per the above.
In GimpMoveTool and GimpGuideTool, add support for moving multiple
guides together, and, in GimpMoveTool, use gimp_image_pick_guides()
to potentially pick multiple guides.
2019-05-30 13:39:26 +08:00
|
|
|
gimp_guide_get_orientation (guide),
|
|
|
|
gimp_guide_get_position (guide),
|
2016-02-04 02:38:32 +08:00
|
|
|
style);
|
2010-09-30 06:18:00 +08:00
|
|
|
gimp_canvas_item_set_highlight (item, TRUE);
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|