2006-12-09 13:33:38 -08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2001-03-02 07:24:12 -08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
|
*
|
2009-01-17 14:28:01 -08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
2001-03-02 07:24:12 -08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-17 14:28:01 -08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2001-03-02 07:24:12 -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
|
2009-01-17 14:28:01 -08:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2001-03-02 07:24:12 -08:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
2008-10-09 13:24:04 -07:00
|
|
|
#include <gegl.h>
|
2001-03-02 07:24:12 -08:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
#include <gdk/gdkkeysyms.h>
|
|
|
|
|
|
2001-11-22 05:01:26 -08:00
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
|
|
|
|
|
2001-05-09 15:34:59 -07:00
|
|
|
#include "tools-types.h"
|
2001-03-02 07:24:12 -08:00
|
|
|
|
2003-09-03 08:13:19 -07:00
|
|
|
#include "core/gimpchannel.h"
|
2001-05-08 19:32:03 -07:00
|
|
|
#include "core/gimpimage.h"
|
2005-07-11 12:21:52 -07:00
|
|
|
#include "core/gimppickable.h"
|
2001-05-08 19:32:03 -07:00
|
|
|
|
2001-09-25 16:23:09 -07:00
|
|
|
#include "display/gimpdisplay.h"
|
|
|
|
|
|
2006-08-03 02:06:36 -07:00
|
|
|
#include "widgets/gimpwidgets-utils.h"
|
|
|
|
|
|
2002-03-03 02:38:37 -08:00
|
|
|
#include "gimpeditselectiontool.h"
|
2001-03-02 07:24:12 -08:00
|
|
|
#include "gimpselectiontool.h"
|
2003-02-08 13:12:03 -08:00
|
|
|
#include "gimpselectionoptions.h"
|
2003-04-15 09:05:52 -07:00
|
|
|
#include "gimptoolcontrol.h"
|
2001-03-02 07:24:12 -08:00
|
|
|
|
2005-05-07 06:24:47 -07:00
|
|
|
#include "gimp-intl.h"
|
|
|
|
|
|
2001-03-02 07:24:12 -08:00
|
|
|
|
2008-11-01 08:17:36 -07:00
|
|
|
static void gimp_selection_tool_modifier_key (GimpTool *tool,
|
|
|
|
|
GdkModifierType key,
|
|
|
|
|
gboolean press,
|
|
|
|
|
GdkModifierType state,
|
|
|
|
|
GimpDisplay *display);
|
|
|
|
|
static void gimp_selection_tool_oper_update (GimpTool *tool,
|
|
|
|
|
const GimpCoords *coords,
|
|
|
|
|
GdkModifierType state,
|
|
|
|
|
gboolean proximity,
|
|
|
|
|
GimpDisplay *display);
|
|
|
|
|
static void gimp_selection_tool_cursor_update (GimpTool *tool,
|
|
|
|
|
const GimpCoords *coords,
|
|
|
|
|
GdkModifierType state,
|
|
|
|
|
GimpDisplay *display);
|
2001-03-02 07:24:12 -08:00
|
|
|
|
|
|
|
|
|
2006-05-15 02:46:31 -07:00
|
|
|
G_DEFINE_TYPE (GimpSelectionTool, gimp_selection_tool, GIMP_TYPE_DRAW_TOOL)
|
2001-03-02 07:24:12 -08:00
|
|
|
|
2005-12-13 01:13:50 -08:00
|
|
|
#define parent_class gimp_selection_tool_parent_class
|
2001-03-02 07:24:12 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gimp_selection_tool_class_init (GimpSelectionToolClass *klass)
|
|
|
|
|
{
|
2004-03-10 04:45:11 -08:00
|
|
|
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
|
2001-03-02 07:24:12 -08:00
|
|
|
|
2001-11-20 19:54:09 -08:00
|
|
|
tool_class->modifier_key = gimp_selection_tool_modifier_key;
|
2004-06-12 11:41:52 -07:00
|
|
|
tool_class->key_press = gimp_edit_selection_tool_key_press;
|
2001-03-02 07:24:12 -08:00
|
|
|
tool_class->oper_update = gimp_selection_tool_oper_update;
|
2001-11-08 11:14:51 -08:00
|
|
|
tool_class->cursor_update = gimp_selection_tool_cursor_update;
|
2001-03-02 07:24:12 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gimp_selection_tool_init (GimpSelectionTool *selection_tool)
|
|
|
|
|
{
|
Separate selection tool function (select, move, cut, ...) from selection
2006-10-18 Michael Natterer <mitch@gimp.org>
Separate selection tool function (select, move, cut, ...) from
selection mode (replace, add, ...). Fixes bug #313634 (that bug
wasn't triggered any more in HEAD, but was still there).
* app/tools/tools-enums.h: renamed enum SelectOp to SelectFunction
and replaced the values REPLACE, ADD, SUBTRACT and INTERSECT by a
single value SELECT.
* app/tools/gimpselectiontool.h (struct GimpSelectionTool):
renamed member "op" to "function". Changed "SelectOps saved_op" to
"GimpChannelOps saved_operation".
* app/tools/gimpselectiontool.c: we always have the right
GimpChannelOps in the tool options, so simply use it instead of
mixing up unrelated stuff in one enum. Results is some medium-ugly
nested switches, but is generally much cleaner than before.
* app/tools/gimpforegroundselecttool.c
* app/tools/gimpfreeselecttool.c
* app/tools/gimpiscissorstool.c
* app/tools/gimpregionselecttool.c: changed accordingly. Use the
operation from the tool options instead of selection_tool->op when
making the actual selection.
2006-10-18 01:04:55 -07:00
|
|
|
selection_tool->function = SELECTION_SELECT;
|
|
|
|
|
selection_tool->saved_operation = GIMP_CHANNEL_OP_REPLACE;
|
2006-06-02 08:23:47 -07:00
|
|
|
|
Separate selection tool function (select, move, cut, ...) from selection
2006-10-18 Michael Natterer <mitch@gimp.org>
Separate selection tool function (select, move, cut, ...) from
selection mode (replace, add, ...). Fixes bug #313634 (that bug
wasn't triggered any more in HEAD, but was still there).
* app/tools/tools-enums.h: renamed enum SelectOp to SelectFunction
and replaced the values REPLACE, ADD, SUBTRACT and INTERSECT by a
single value SELECT.
* app/tools/gimpselectiontool.h (struct GimpSelectionTool):
renamed member "op" to "function". Changed "SelectOps saved_op" to
"GimpChannelOps saved_operation".
* app/tools/gimpselectiontool.c: we always have the right
GimpChannelOps in the tool options, so simply use it instead of
mixing up unrelated stuff in one enum. Results is some medium-ugly
nested switches, but is generally much cleaner than before.
* app/tools/gimpforegroundselecttool.c
* app/tools/gimpfreeselecttool.c
* app/tools/gimpiscissorstool.c
* app/tools/gimpregionselecttool.c: changed accordingly. Use the
operation from the tool options instead of selection_tool->op when
making the actual selection.
2006-10-18 01:04:55 -07:00
|
|
|
selection_tool->allow_move = TRUE;
|
2001-11-20 19:54:09 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gimp_selection_tool_modifier_key (GimpTool *tool,
|
|
|
|
|
GdkModifierType key,
|
|
|
|
|
gboolean press,
|
|
|
|
|
GdkModifierType state,
|
2006-03-28 09:55:52 -08:00
|
|
|
GimpDisplay *display)
|
2001-11-20 19:54:09 -08:00
|
|
|
{
|
2004-07-26 07:50:51 -07:00
|
|
|
GimpSelectionTool *selection_tool = GIMP_SELECTION_TOOL (tool);
|
2003-02-05 06:39:40 -08:00
|
|
|
GimpSelectionOptions *options;
|
2001-11-20 19:54:09 -08:00
|
|
|
|
2006-09-05 11:25:31 -07:00
|
|
|
options = GIMP_SELECTION_TOOL_GET_OPTIONS (tool);
|
2001-11-20 19:54:09 -08:00
|
|
|
|
2006-08-25 15:07:26 -07:00
|
|
|
if (key == GDK_SHIFT_MASK ||
|
|
|
|
|
key == GDK_CONTROL_MASK ||
|
|
|
|
|
key == GDK_MOD1_MASK)
|
2001-11-20 19:54:09 -08:00
|
|
|
{
|
Separate selection tool function (select, move, cut, ...) from selection
2006-10-18 Michael Natterer <mitch@gimp.org>
Separate selection tool function (select, move, cut, ...) from
selection mode (replace, add, ...). Fixes bug #313634 (that bug
wasn't triggered any more in HEAD, but was still there).
* app/tools/tools-enums.h: renamed enum SelectOp to SelectFunction
and replaced the values REPLACE, ADD, SUBTRACT and INTERSECT by a
single value SELECT.
* app/tools/gimpselectiontool.h (struct GimpSelectionTool):
renamed member "op" to "function". Changed "SelectOps saved_op" to
"GimpChannelOps saved_operation".
* app/tools/gimpselectiontool.c: we always have the right
GimpChannelOps in the tool options, so simply use it instead of
mixing up unrelated stuff in one enum. Results is some medium-ugly
nested switches, but is generally much cleaner than before.
* app/tools/gimpforegroundselecttool.c
* app/tools/gimpfreeselecttool.c
* app/tools/gimpiscissorstool.c
* app/tools/gimpregionselecttool.c: changed accordingly. Use the
operation from the tool options instead of selection_tool->op when
making the actual selection.
2006-10-18 01:04:55 -07:00
|
|
|
GimpChannelOps button_op = options->operation;
|
2003-09-17 04:16:55 -07:00
|
|
|
|
2006-11-11 02:44:02 -08:00
|
|
|
if (press)
|
2001-11-20 19:54:09 -08:00
|
|
|
{
|
2006-11-11 02:44:02 -08:00
|
|
|
if (key == (state & (GDK_SHIFT_MASK |
|
|
|
|
|
GDK_CONTROL_MASK |
|
|
|
|
|
GDK_MOD1_MASK)))
|
2001-11-20 19:54:09 -08:00
|
|
|
{
|
2006-11-11 02:44:02 -08:00
|
|
|
/* first modifier pressed */
|
2002-03-14 14:42:50 -08:00
|
|
|
|
2006-11-11 02:44:02 -08:00
|
|
|
selection_tool->saved_operation = options->operation;
|
2001-11-20 19:54:09 -08:00
|
|
|
}
|
2006-11-11 02:44:02 -08:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (! (state & (GDK_SHIFT_MASK |
|
|
|
|
|
GDK_CONTROL_MASK |
|
|
|
|
|
GDK_MOD1_MASK)))
|
2006-08-25 15:07:26 -07:00
|
|
|
{
|
2006-11-11 02:44:02 -08:00
|
|
|
/* last modifier released */
|
2001-11-20 19:54:09 -08:00
|
|
|
|
2006-11-11 02:44:02 -08:00
|
|
|
button_op = selection_tool->saved_operation;
|
2006-08-25 15:07:26 -07:00
|
|
|
}
|
2006-11-11 02:44:02 -08:00
|
|
|
}
|
2006-08-25 15:07:26 -07:00
|
|
|
|
2006-11-11 02:44:02 -08:00
|
|
|
if (state & GDK_MOD1_MASK)
|
|
|
|
|
{
|
|
|
|
|
/* if alt is down, pretend that neither
|
|
|
|
|
* shift nor control are down
|
|
|
|
|
*/
|
|
|
|
|
button_op = selection_tool->saved_operation;
|
|
|
|
|
}
|
|
|
|
|
else if ((state & GDK_CONTROL_MASK) && (state & GDK_SHIFT_MASK))
|
|
|
|
|
{
|
|
|
|
|
button_op = GIMP_CHANNEL_OP_INTERSECT;
|
|
|
|
|
}
|
|
|
|
|
else if (state & GDK_SHIFT_MASK)
|
|
|
|
|
{
|
|
|
|
|
button_op = GIMP_CHANNEL_OP_ADD;
|
|
|
|
|
}
|
|
|
|
|
else if (state & GDK_CONTROL_MASK)
|
|
|
|
|
{
|
|
|
|
|
button_op = GIMP_CHANNEL_OP_SUBTRACT;
|
2001-11-20 19:54:09 -08:00
|
|
|
}
|
|
|
|
|
|
2003-02-07 09:12:21 -08:00
|
|
|
if (button_op != options->operation)
|
2001-11-20 19:54:09 -08:00
|
|
|
{
|
2003-02-27 17:14:30 -08:00
|
|
|
g_object_set (options, "operation", button_op, NULL);
|
2001-11-20 19:54:09 -08:00
|
|
|
}
|
|
|
|
|
}
|
2001-11-08 11:14:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2008-11-01 08:17:36 -07:00
|
|
|
gimp_selection_tool_oper_update (GimpTool *tool,
|
|
|
|
|
const GimpCoords *coords,
|
|
|
|
|
GdkModifierType state,
|
|
|
|
|
gboolean proximity,
|
|
|
|
|
GimpDisplay *display)
|
2001-11-08 11:14:51 -08:00
|
|
|
{
|
2004-07-26 07:50:51 -07:00
|
|
|
GimpSelectionTool *selection_tool = GIMP_SELECTION_TOOL (tool);
|
2003-02-05 06:39:40 -08:00
|
|
|
GimpSelectionOptions *options;
|
2009-10-06 10:20:44 -07:00
|
|
|
GimpImage *image;
|
2003-09-03 08:13:19 -07:00
|
|
|
GimpChannel *selection;
|
2006-08-03 11:17:42 -07:00
|
|
|
GimpDrawable *drawable;
|
2003-02-05 06:39:40 -08:00
|
|
|
GimpLayer *layer;
|
|
|
|
|
GimpLayer *floating_sel;
|
2003-05-16 05:10:47 -07:00
|
|
|
gboolean move_layer = FALSE;
|
|
|
|
|
gboolean move_floating_sel = FALSE;
|
2006-08-03 11:17:42 -07:00
|
|
|
gboolean selection_empty;
|
2001-11-08 11:14:51 -08:00
|
|
|
|
2006-09-05 11:25:31 -07:00
|
|
|
options = GIMP_SELECTION_TOOL_GET_OPTIONS (tool);
|
2001-11-20 19:54:09 -08:00
|
|
|
|
2009-10-06 10:20:44 -07:00
|
|
|
image = gimp_display_get_image (display);
|
|
|
|
|
selection = gimp_image_get_mask (image);
|
|
|
|
|
drawable = gimp_image_get_active_drawable (image);
|
|
|
|
|
layer = gimp_image_pick_layer (image, coords->x, coords->y);
|
|
|
|
|
floating_sel = gimp_image_get_floating_selection (image);
|
2001-11-08 11:14:51 -08:00
|
|
|
|
2006-08-03 11:17:42 -07:00
|
|
|
if (drawable)
|
2003-05-16 05:10:47 -07:00
|
|
|
{
|
|
|
|
|
if (floating_sel)
|
|
|
|
|
{
|
|
|
|
|
if (layer == floating_sel)
|
|
|
|
|
move_floating_sel = TRUE;
|
|
|
|
|
}
|
2006-08-03 11:17:42 -07:00
|
|
|
else if (gimp_drawable_mask_intersect (drawable,
|
|
|
|
|
NULL, NULL, NULL, NULL))
|
2003-05-16 05:10:47 -07:00
|
|
|
{
|
|
|
|
|
move_layer = TRUE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-08-03 11:17:42 -07:00
|
|
|
selection_empty = gimp_channel_is_empty (selection);
|
|
|
|
|
|
Separate selection tool function (select, move, cut, ...) from selection
2006-10-18 Michael Natterer <mitch@gimp.org>
Separate selection tool function (select, move, cut, ...) from
selection mode (replace, add, ...). Fixes bug #313634 (that bug
wasn't triggered any more in HEAD, but was still there).
* app/tools/tools-enums.h: renamed enum SelectOp to SelectFunction
and replaced the values REPLACE, ADD, SUBTRACT and INTERSECT by a
single value SELECT.
* app/tools/gimpselectiontool.h (struct GimpSelectionTool):
renamed member "op" to "function". Changed "SelectOps saved_op" to
"GimpChannelOps saved_operation".
* app/tools/gimpselectiontool.c: we always have the right
GimpChannelOps in the tool options, so simply use it instead of
mixing up unrelated stuff in one enum. Results is some medium-ugly
nested switches, but is generally much cleaner than before.
* app/tools/gimpforegroundselecttool.c
* app/tools/gimpfreeselecttool.c
* app/tools/gimpiscissorstool.c
* app/tools/gimpregionselecttool.c: changed accordingly. Use the
operation from the tool options instead of selection_tool->op when
making the actual selection.
2006-10-18 01:04:55 -07:00
|
|
|
selection_tool->function = SELECTION_SELECT;
|
|
|
|
|
|
2006-06-02 08:23:47 -07:00
|
|
|
if (selection_tool->allow_move &&
|
|
|
|
|
(state & GDK_MOD1_MASK) && (state & GDK_CONTROL_MASK) && move_layer)
|
2003-05-16 05:10:47 -07:00
|
|
|
{
|
Separate selection tool function (select, move, cut, ...) from selection
2006-10-18 Michael Natterer <mitch@gimp.org>
Separate selection tool function (select, move, cut, ...) from
selection mode (replace, add, ...). Fixes bug #313634 (that bug
wasn't triggered any more in HEAD, but was still there).
* app/tools/tools-enums.h: renamed enum SelectOp to SelectFunction
and replaced the values REPLACE, ADD, SUBTRACT and INTERSECT by a
single value SELECT.
* app/tools/gimpselectiontool.h (struct GimpSelectionTool):
renamed member "op" to "function". Changed "SelectOps saved_op" to
"GimpChannelOps saved_operation".
* app/tools/gimpselectiontool.c: we always have the right
GimpChannelOps in the tool options, so simply use it instead of
mixing up unrelated stuff in one enum. Results is some medium-ugly
nested switches, but is generally much cleaner than before.
* app/tools/gimpforegroundselecttool.c
* app/tools/gimpfreeselecttool.c
* app/tools/gimpiscissorstool.c
* app/tools/gimpregionselecttool.c: changed accordingly. Use the
operation from the tool options instead of selection_tool->op when
making the actual selection.
2006-10-18 01:04:55 -07:00
|
|
|
/* move the selection */
|
|
|
|
|
selection_tool->function = SELECTION_MOVE;
|
2003-05-16 05:10:47 -07:00
|
|
|
}
|
2006-06-02 08:23:47 -07:00
|
|
|
else if (selection_tool->allow_move &&
|
|
|
|
|
(state & GDK_MOD1_MASK) && (state & GDK_SHIFT_MASK) && move_layer)
|
|
|
|
|
{
|
Separate selection tool function (select, move, cut, ...) from selection
2006-10-18 Michael Natterer <mitch@gimp.org>
Separate selection tool function (select, move, cut, ...) from
selection mode (replace, add, ...). Fixes bug #313634 (that bug
wasn't triggered any more in HEAD, but was still there).
* app/tools/tools-enums.h: renamed enum SelectOp to SelectFunction
and replaced the values REPLACE, ADD, SUBTRACT and INTERSECT by a
single value SELECT.
* app/tools/gimpselectiontool.h (struct GimpSelectionTool):
renamed member "op" to "function". Changed "SelectOps saved_op" to
"GimpChannelOps saved_operation".
* app/tools/gimpselectiontool.c: we always have the right
GimpChannelOps in the tool options, so simply use it instead of
mixing up unrelated stuff in one enum. Results is some medium-ugly
nested switches, but is generally much cleaner than before.
* app/tools/gimpforegroundselecttool.c
* app/tools/gimpfreeselecttool.c
* app/tools/gimpiscissorstool.c
* app/tools/gimpregionselecttool.c: changed accordingly. Use the
operation from the tool options instead of selection_tool->op when
making the actual selection.
2006-10-18 01:04:55 -07:00
|
|
|
/* move a copy of the selection */
|
|
|
|
|
selection_tool->function = SELECTION_MOVE_COPY;
|
2006-06-02 08:23:47 -07:00
|
|
|
}
|
|
|
|
|
else if (selection_tool->allow_move &&
|
2006-08-03 11:17:42 -07:00
|
|
|
(state & GDK_MOD1_MASK) && ! selection_empty)
|
2001-11-08 11:14:51 -08:00
|
|
|
{
|
Separate selection tool function (select, move, cut, ...) from selection
2006-10-18 Michael Natterer <mitch@gimp.org>
Separate selection tool function (select, move, cut, ...) from
selection mode (replace, add, ...). Fixes bug #313634 (that bug
wasn't triggered any more in HEAD, but was still there).
* app/tools/tools-enums.h: renamed enum SelectOp to SelectFunction
and replaced the values REPLACE, ADD, SUBTRACT and INTERSECT by a
single value SELECT.
* app/tools/gimpselectiontool.h (struct GimpSelectionTool):
renamed member "op" to "function". Changed "SelectOps saved_op" to
"GimpChannelOps saved_operation".
* app/tools/gimpselectiontool.c: we always have the right
GimpChannelOps in the tool options, so simply use it instead of
mixing up unrelated stuff in one enum. Results is some medium-ugly
nested switches, but is generally much cleaner than before.
* app/tools/gimpforegroundselecttool.c
* app/tools/gimpfreeselecttool.c
* app/tools/gimpiscissorstool.c
* app/tools/gimpregionselecttool.c: changed accordingly. Use the
operation from the tool options instead of selection_tool->op when
making the actual selection.
2006-10-18 01:04:55 -07:00
|
|
|
/* move the selection mask */
|
|
|
|
|
selection_tool->function = SELECTION_MOVE_MASK;
|
2001-11-08 11:14:51 -08:00
|
|
|
}
|
2006-06-02 08:23:47 -07:00
|
|
|
else if (selection_tool->allow_move &&
|
|
|
|
|
! (state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK)) &&
|
|
|
|
|
move_floating_sel)
|
2001-11-08 11:14:51 -08:00
|
|
|
{
|
Separate selection tool function (select, move, cut, ...) from selection
2006-10-18 Michael Natterer <mitch@gimp.org>
Separate selection tool function (select, move, cut, ...) from
selection mode (replace, add, ...). Fixes bug #313634 (that bug
wasn't triggered any more in HEAD, but was still there).
* app/tools/tools-enums.h: renamed enum SelectOp to SelectFunction
and replaced the values REPLACE, ADD, SUBTRACT and INTERSECT by a
single value SELECT.
* app/tools/gimpselectiontool.h (struct GimpSelectionTool):
renamed member "op" to "function". Changed "SelectOps saved_op" to
"GimpChannelOps saved_operation".
* app/tools/gimpselectiontool.c: we always have the right
GimpChannelOps in the tool options, so simply use it instead of
mixing up unrelated stuff in one enum. Results is some medium-ugly
nested switches, but is generally much cleaner than before.
* app/tools/gimpforegroundselecttool.c
* app/tools/gimpfreeselecttool.c
* app/tools/gimpiscissorstool.c
* app/tools/gimpregionselecttool.c: changed accordingly. Use the
operation from the tool options instead of selection_tool->op when
making the actual selection.
2006-10-18 01:04:55 -07:00
|
|
|
/* move the selection */
|
|
|
|
|
selection_tool->function = SELECTION_MOVE;
|
2001-11-08 11:14:51 -08:00
|
|
|
}
|
Separate selection tool function (select, move, cut, ...) from selection
2006-10-18 Michael Natterer <mitch@gimp.org>
Separate selection tool function (select, move, cut, ...) from
selection mode (replace, add, ...). Fixes bug #313634 (that bug
wasn't triggered any more in HEAD, but was still there).
* app/tools/tools-enums.h: renamed enum SelectOp to SelectFunction
and replaced the values REPLACE, ADD, SUBTRACT and INTERSECT by a
single value SELECT.
* app/tools/gimpselectiontool.h (struct GimpSelectionTool):
renamed member "op" to "function". Changed "SelectOps saved_op" to
"GimpChannelOps saved_operation".
* app/tools/gimpselectiontool.c: we always have the right
GimpChannelOps in the tool options, so simply use it instead of
mixing up unrelated stuff in one enum. Results is some medium-ugly
nested switches, but is generally much cleaner than before.
* app/tools/gimpforegroundselecttool.c
* app/tools/gimpfreeselecttool.c
* app/tools/gimpiscissorstool.c
* app/tools/gimpregionselecttool.c: changed accordingly. Use the
operation from the tool options instead of selection_tool->op when
making the actual selection.
2006-10-18 01:04:55 -07:00
|
|
|
else if ((state & GDK_CONTROL_MASK) || (state & GDK_SHIFT_MASK))
|
2001-11-08 11:14:51 -08:00
|
|
|
{
|
Separate selection tool function (select, move, cut, ...) from selection
2006-10-18 Michael Natterer <mitch@gimp.org>
Separate selection tool function (select, move, cut, ...) from
selection mode (replace, add, ...). Fixes bug #313634 (that bug
wasn't triggered any more in HEAD, but was still there).
* app/tools/tools-enums.h: renamed enum SelectOp to SelectFunction
and replaced the values REPLACE, ADD, SUBTRACT and INTERSECT by a
single value SELECT.
* app/tools/gimpselectiontool.h (struct GimpSelectionTool):
renamed member "op" to "function". Changed "SelectOps saved_op" to
"GimpChannelOps saved_operation".
* app/tools/gimpselectiontool.c: we always have the right
GimpChannelOps in the tool options, so simply use it instead of
mixing up unrelated stuff in one enum. Results is some medium-ugly
nested switches, but is generally much cleaner than before.
* app/tools/gimpforegroundselecttool.c
* app/tools/gimpfreeselecttool.c
* app/tools/gimpiscissorstool.c
* app/tools/gimpregionselecttool.c: changed accordingly. Use the
operation from the tool options instead of selection_tool->op when
making the actual selection.
2006-10-18 01:04:55 -07:00
|
|
|
/* select */
|
|
|
|
|
selection_tool->function = SELECTION_SELECT;
|
2001-11-08 11:14:51 -08:00
|
|
|
}
|
|
|
|
|
else if (floating_sel)
|
|
|
|
|
{
|
Separate selection tool function (select, move, cut, ...) from selection
2006-10-18 Michael Natterer <mitch@gimp.org>
Separate selection tool function (select, move, cut, ...) from
selection mode (replace, add, ...). Fixes bug #313634 (that bug
wasn't triggered any more in HEAD, but was still there).
* app/tools/tools-enums.h: renamed enum SelectOp to SelectFunction
and replaced the values REPLACE, ADD, SUBTRACT and INTERSECT by a
single value SELECT.
* app/tools/gimpselectiontool.h (struct GimpSelectionTool):
renamed member "op" to "function". Changed "SelectOps saved_op" to
"GimpChannelOps saved_operation".
* app/tools/gimpselectiontool.c: we always have the right
GimpChannelOps in the tool options, so simply use it instead of
mixing up unrelated stuff in one enum. Results is some medium-ugly
nested switches, but is generally much cleaner than before.
* app/tools/gimpforegroundselecttool.c
* app/tools/gimpfreeselecttool.c
* app/tools/gimpiscissorstool.c
* app/tools/gimpregionselecttool.c: changed accordingly. Use the
operation from the tool options instead of selection_tool->op when
making the actual selection.
2006-10-18 01:04:55 -07:00
|
|
|
/* anchor the selection */
|
|
|
|
|
selection_tool->function = SELECTION_ANCHOR;
|
2001-11-08 11:14:51 -08:00
|
|
|
}
|
2005-05-07 06:24:47 -07:00
|
|
|
|
2006-03-28 09:55:52 -08:00
|
|
|
gimp_tool_pop_status (tool, display);
|
2006-03-25 05:51:13 -08:00
|
|
|
|
2006-03-25 06:23:09 -08:00
|
|
|
if (proximity)
|
2005-05-07 06:24:47 -07:00
|
|
|
{
|
2008-05-17 06:08:19 -07:00
|
|
|
const gchar *status = NULL;
|
2006-08-03 02:06:36 -07:00
|
|
|
gboolean free_status = FALSE;
|
2006-08-03 11:17:42 -07:00
|
|
|
GdkModifierType modifiers = (GDK_SHIFT_MASK | GDK_CONTROL_MASK);
|
2006-03-25 05:51:13 -08:00
|
|
|
|
2006-08-03 11:17:42 -07:00
|
|
|
if (! selection_empty)
|
2006-08-03 02:06:36 -07:00
|
|
|
modifiers |= GDK_MOD1_MASK;
|
2006-08-03 11:17:42 -07:00
|
|
|
|
Separate selection tool function (select, move, cut, ...) from selection
2006-10-18 Michael Natterer <mitch@gimp.org>
Separate selection tool function (select, move, cut, ...) from
selection mode (replace, add, ...). Fixes bug #313634 (that bug
wasn't triggered any more in HEAD, but was still there).
* app/tools/tools-enums.h: renamed enum SelectOp to SelectFunction
and replaced the values REPLACE, ADD, SUBTRACT and INTERSECT by a
single value SELECT.
* app/tools/gimpselectiontool.h (struct GimpSelectionTool):
renamed member "op" to "function". Changed "SelectOps saved_op" to
"GimpChannelOps saved_operation".
* app/tools/gimpselectiontool.c: we always have the right
GimpChannelOps in the tool options, so simply use it instead of
mixing up unrelated stuff in one enum. Results is some medium-ugly
nested switches, but is generally much cleaner than before.
* app/tools/gimpforegroundselecttool.c
* app/tools/gimpfreeselecttool.c
* app/tools/gimpiscissorstool.c
* app/tools/gimpregionselecttool.c: changed accordingly. Use the
operation from the tool options instead of selection_tool->op when
making the actual selection.
2006-10-18 01:04:55 -07:00
|
|
|
switch (selection_tool->function)
|
2005-05-07 06:24:47 -07:00
|
|
|
{
|
Separate selection tool function (select, move, cut, ...) from selection
2006-10-18 Michael Natterer <mitch@gimp.org>
Separate selection tool function (select, move, cut, ...) from
selection mode (replace, add, ...). Fixes bug #313634 (that bug
wasn't triggered any more in HEAD, but was still there).
* app/tools/tools-enums.h: renamed enum SelectOp to SelectFunction
and replaced the values REPLACE, ADD, SUBTRACT and INTERSECT by a
single value SELECT.
* app/tools/gimpselectiontool.h (struct GimpSelectionTool):
renamed member "op" to "function". Changed "SelectOps saved_op" to
"GimpChannelOps saved_operation".
* app/tools/gimpselectiontool.c: we always have the right
GimpChannelOps in the tool options, so simply use it instead of
mixing up unrelated stuff in one enum. Results is some medium-ugly
nested switches, but is generally much cleaner than before.
* app/tools/gimpforegroundselecttool.c
* app/tools/gimpfreeselecttool.c
* app/tools/gimpiscissorstool.c
* app/tools/gimpregionselecttool.c: changed accordingly. Use the
operation from the tool options instead of selection_tool->op when
making the actual selection.
2006-10-18 01:04:55 -07:00
|
|
|
case SELECTION_SELECT:
|
|
|
|
|
switch (options->operation)
|
2006-08-03 02:06:36 -07:00
|
|
|
{
|
Separate selection tool function (select, move, cut, ...) from selection
2006-10-18 Michael Natterer <mitch@gimp.org>
Separate selection tool function (select, move, cut, ...) from
selection mode (replace, add, ...). Fixes bug #313634 (that bug
wasn't triggered any more in HEAD, but was still there).
* app/tools/tools-enums.h: renamed enum SelectOp to SelectFunction
and replaced the values REPLACE, ADD, SUBTRACT and INTERSECT by a
single value SELECT.
* app/tools/gimpselectiontool.h (struct GimpSelectionTool):
renamed member "op" to "function". Changed "SelectOps saved_op" to
"GimpChannelOps saved_operation".
* app/tools/gimpselectiontool.c: we always have the right
GimpChannelOps in the tool options, so simply use it instead of
mixing up unrelated stuff in one enum. Results is some medium-ugly
nested switches, but is generally much cleaner than before.
* app/tools/gimpforegroundselecttool.c
* app/tools/gimpfreeselecttool.c
* app/tools/gimpiscissorstool.c
* app/tools/gimpregionselecttool.c: changed accordingly. Use the
operation from the tool options instead of selection_tool->op when
making the actual selection.
2006-10-18 01:04:55 -07:00
|
|
|
case GIMP_CHANNEL_OP_REPLACE:
|
|
|
|
|
if (! selection_empty)
|
|
|
|
|
{
|
|
|
|
|
status = gimp_suggest_modifiers (_("Click-Drag to replace the "
|
|
|
|
|
"current selection"),
|
|
|
|
|
modifiers & ~state,
|
|
|
|
|
NULL, NULL, NULL);
|
|
|
|
|
free_status = TRUE;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
status = _("Click-Drag to create a new selection");
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case GIMP_CHANNEL_OP_ADD:
|
|
|
|
|
status = gimp_suggest_modifiers (_("Click-Drag to add to the "
|
2006-09-11 23:37:54 -07:00
|
|
|
"current selection"),
|
Separate selection tool function (select, move, cut, ...) from selection
2006-10-18 Michael Natterer <mitch@gimp.org>
Separate selection tool function (select, move, cut, ...) from
selection mode (replace, add, ...). Fixes bug #313634 (that bug
wasn't triggered any more in HEAD, but was still there).
* app/tools/tools-enums.h: renamed enum SelectOp to SelectFunction
and replaced the values REPLACE, ADD, SUBTRACT and INTERSECT by a
single value SELECT.
* app/tools/gimpselectiontool.h (struct GimpSelectionTool):
renamed member "op" to "function". Changed "SelectOps saved_op" to
"GimpChannelOps saved_operation".
* app/tools/gimpselectiontool.c: we always have the right
GimpChannelOps in the tool options, so simply use it instead of
mixing up unrelated stuff in one enum. Results is some medium-ugly
nested switches, but is generally much cleaner than before.
* app/tools/gimpforegroundselecttool.c
* app/tools/gimpfreeselecttool.c
* app/tools/gimpiscissorstool.c
* app/tools/gimpregionselecttool.c: changed accordingly. Use the
operation from the tool options instead of selection_tool->op when
making the actual selection.
2006-10-18 01:04:55 -07:00
|
|
|
modifiers
|
|
|
|
|
& ~(state | GDK_SHIFT_MASK),
|
2006-08-03 02:06:36 -07:00
|
|
|
NULL, NULL, NULL);
|
|
|
|
|
free_status = TRUE;
|
Separate selection tool function (select, move, cut, ...) from selection
2006-10-18 Michael Natterer <mitch@gimp.org>
Separate selection tool function (select, move, cut, ...) from
selection mode (replace, add, ...). Fixes bug #313634 (that bug
wasn't triggered any more in HEAD, but was still there).
* app/tools/tools-enums.h: renamed enum SelectOp to SelectFunction
and replaced the values REPLACE, ADD, SUBTRACT and INTERSECT by a
single value SELECT.
* app/tools/gimpselectiontool.h (struct GimpSelectionTool):
renamed member "op" to "function". Changed "SelectOps saved_op" to
"GimpChannelOps saved_operation".
* app/tools/gimpselectiontool.c: we always have the right
GimpChannelOps in the tool options, so simply use it instead of
mixing up unrelated stuff in one enum. Results is some medium-ugly
nested switches, but is generally much cleaner than before.
* app/tools/gimpforegroundselecttool.c
* app/tools/gimpfreeselecttool.c
* app/tools/gimpiscissorstool.c
* app/tools/gimpregionselecttool.c: changed accordingly. Use the
operation from the tool options instead of selection_tool->op when
making the actual selection.
2006-10-18 01:04:55 -07:00
|
|
|
break;
|
2006-07-30 13:15:07 -07:00
|
|
|
|
Separate selection tool function (select, move, cut, ...) from selection
2006-10-18 Michael Natterer <mitch@gimp.org>
Separate selection tool function (select, move, cut, ...) from
selection mode (replace, add, ...). Fixes bug #313634 (that bug
wasn't triggered any more in HEAD, but was still there).
* app/tools/tools-enums.h: renamed enum SelectOp to SelectFunction
and replaced the values REPLACE, ADD, SUBTRACT and INTERSECT by a
single value SELECT.
* app/tools/gimpselectiontool.h (struct GimpSelectionTool):
renamed member "op" to "function". Changed "SelectOps saved_op" to
"GimpChannelOps saved_operation".
* app/tools/gimpselectiontool.c: we always have the right
GimpChannelOps in the tool options, so simply use it instead of
mixing up unrelated stuff in one enum. Results is some medium-ugly
nested switches, but is generally much cleaner than before.
* app/tools/gimpforegroundselecttool.c
* app/tools/gimpfreeselecttool.c
* app/tools/gimpiscissorstool.c
* app/tools/gimpregionselecttool.c: changed accordingly. Use the
operation from the tool options instead of selection_tool->op when
making the actual selection.
2006-10-18 01:04:55 -07:00
|
|
|
case GIMP_CHANNEL_OP_SUBTRACT:
|
|
|
|
|
status = gimp_suggest_modifiers (_("Click-Drag to subtract from the "
|
|
|
|
|
"current selection"),
|
|
|
|
|
modifiers
|
|
|
|
|
& ~(state | GDK_CONTROL_MASK),
|
|
|
|
|
NULL, NULL, NULL);
|
|
|
|
|
free_status = TRUE;
|
|
|
|
|
break;
|
2006-07-30 13:15:07 -07:00
|
|
|
|
Separate selection tool function (select, move, cut, ...) from selection
2006-10-18 Michael Natterer <mitch@gimp.org>
Separate selection tool function (select, move, cut, ...) from
selection mode (replace, add, ...). Fixes bug #313634 (that bug
wasn't triggered any more in HEAD, but was still there).
* app/tools/tools-enums.h: renamed enum SelectOp to SelectFunction
and replaced the values REPLACE, ADD, SUBTRACT and INTERSECT by a
single value SELECT.
* app/tools/gimpselectiontool.h (struct GimpSelectionTool):
renamed member "op" to "function". Changed "SelectOps saved_op" to
"GimpChannelOps saved_operation".
* app/tools/gimpselectiontool.c: we always have the right
GimpChannelOps in the tool options, so simply use it instead of
mixing up unrelated stuff in one enum. Results is some medium-ugly
nested switches, but is generally much cleaner than before.
* app/tools/gimpforegroundselecttool.c
* app/tools/gimpfreeselecttool.c
* app/tools/gimpiscissorstool.c
* app/tools/gimpregionselecttool.c: changed accordingly. Use the
operation from the tool options instead of selection_tool->op when
making the actual selection.
2006-10-18 01:04:55 -07:00
|
|
|
case GIMP_CHANNEL_OP_INTERSECT:
|
|
|
|
|
status = gimp_suggest_modifiers (_("Click-Drag to intersect with "
|
|
|
|
|
"the current selection"),
|
|
|
|
|
modifiers & ~state,
|
|
|
|
|
NULL, NULL, NULL);
|
|
|
|
|
free_status = TRUE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2006-07-30 13:15:07 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case SELECTION_MOVE_MASK:
|
2006-08-03 02:06:36 -07:00
|
|
|
status = gimp_suggest_modifiers (_("Click-Drag to move the "
|
2006-09-11 23:37:54 -07:00
|
|
|
"selection mask"),
|
2006-08-03 02:06:36 -07:00
|
|
|
modifiers & ~state,
|
|
|
|
|
NULL, NULL, NULL);
|
|
|
|
|
free_status = TRUE;
|
2006-07-30 13:15:07 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case SELECTION_MOVE:
|
2006-09-11 23:37:54 -07:00
|
|
|
status = _("Click-Drag to move the selected pixels");
|
2006-07-30 13:15:07 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case SELECTION_MOVE_COPY:
|
2006-09-11 23:37:54 -07:00
|
|
|
status = _("Click-Drag to move a copy of the selected pixels");
|
2006-07-30 13:15:07 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case SELECTION_ANCHOR:
|
2006-09-11 23:37:54 -07:00
|
|
|
status = _("Click to anchor the floating selection");
|
2006-07-30 13:15:07 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
g_return_if_reached ();
|
2005-05-07 06:24:47 -07:00
|
|
|
}
|
|
|
|
|
|
2006-03-25 05:51:13 -08:00
|
|
|
if (status)
|
2008-11-04 04:33:09 -08:00
|
|
|
gimp_tool_push_status (tool, display, "%s", status);
|
2006-08-03 02:06:36 -07:00
|
|
|
|
|
|
|
|
if (free_status)
|
2008-05-17 06:08:19 -07:00
|
|
|
g_free ((gchar *) status);
|
2006-03-25 05:51:13 -08:00
|
|
|
}
|
2001-03-02 07:24:12 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2008-11-01 08:17:36 -07:00
|
|
|
gimp_selection_tool_cursor_update (GimpTool *tool,
|
|
|
|
|
const GimpCoords *coords,
|
|
|
|
|
GdkModifierType state,
|
|
|
|
|
GimpDisplay *display)
|
2001-03-02 07:24:12 -08:00
|
|
|
{
|
Separate selection tool function (select, move, cut, ...) from selection
2006-10-18 Michael Natterer <mitch@gimp.org>
Separate selection tool function (select, move, cut, ...) from
selection mode (replace, add, ...). Fixes bug #313634 (that bug
wasn't triggered any more in HEAD, but was still there).
* app/tools/tools-enums.h: renamed enum SelectOp to SelectFunction
and replaced the values REPLACE, ADD, SUBTRACT and INTERSECT by a
single value SELECT.
* app/tools/gimpselectiontool.h (struct GimpSelectionTool):
renamed member "op" to "function". Changed "SelectOps saved_op" to
"GimpChannelOps saved_operation".
* app/tools/gimpselectiontool.c: we always have the right
GimpChannelOps in the tool options, so simply use it instead of
mixing up unrelated stuff in one enum. Results is some medium-ugly
nested switches, but is generally much cleaner than before.
* app/tools/gimpforegroundselecttool.c
* app/tools/gimpfreeselecttool.c
* app/tools/gimpiscissorstool.c
* app/tools/gimpregionselecttool.c: changed accordingly. Use the
operation from the tool options instead of selection_tool->op when
making the actual selection.
2006-10-18 01:04:55 -07:00
|
|
|
GimpSelectionTool *selection_tool = GIMP_SELECTION_TOOL (tool);
|
|
|
|
|
GimpSelectionOptions *options;
|
|
|
|
|
GimpToolCursorType tool_cursor;
|
|
|
|
|
GimpCursorModifier modifier;
|
|
|
|
|
|
|
|
|
|
options = GIMP_SELECTION_TOOL_GET_OPTIONS (tool);
|
2001-03-02 07:24:12 -08:00
|
|
|
|
2002-05-03 04:31:08 -07:00
|
|
|
tool_cursor = gimp_tool_control_get_tool_cursor (tool->control);
|
2006-06-02 08:23:47 -07:00
|
|
|
modifier = GIMP_CURSOR_MODIFIER_NONE;
|
2001-10-31 13:20:09 -08:00
|
|
|
|
Separate selection tool function (select, move, cut, ...) from selection
2006-10-18 Michael Natterer <mitch@gimp.org>
Separate selection tool function (select, move, cut, ...) from
selection mode (replace, add, ...). Fixes bug #313634 (that bug
wasn't triggered any more in HEAD, but was still there).
* app/tools/tools-enums.h: renamed enum SelectOp to SelectFunction
and replaced the values REPLACE, ADD, SUBTRACT and INTERSECT by a
single value SELECT.
* app/tools/gimpselectiontool.h (struct GimpSelectionTool):
renamed member "op" to "function". Changed "SelectOps saved_op" to
"GimpChannelOps saved_operation".
* app/tools/gimpselectiontool.c: we always have the right
GimpChannelOps in the tool options, so simply use it instead of
mixing up unrelated stuff in one enum. Results is some medium-ugly
nested switches, but is generally much cleaner than before.
* app/tools/gimpforegroundselecttool.c
* app/tools/gimpfreeselecttool.c
* app/tools/gimpiscissorstool.c
* app/tools/gimpregionselecttool.c: changed accordingly. Use the
operation from the tool options instead of selection_tool->op when
making the actual selection.
2006-10-18 01:04:55 -07:00
|
|
|
switch (selection_tool->function)
|
2001-03-02 07:24:12 -08:00
|
|
|
{
|
Separate selection tool function (select, move, cut, ...) from selection
2006-10-18 Michael Natterer <mitch@gimp.org>
Separate selection tool function (select, move, cut, ...) from
selection mode (replace, add, ...). Fixes bug #313634 (that bug
wasn't triggered any more in HEAD, but was still there).
* app/tools/tools-enums.h: renamed enum SelectOp to SelectFunction
and replaced the values REPLACE, ADD, SUBTRACT and INTERSECT by a
single value SELECT.
* app/tools/gimpselectiontool.h (struct GimpSelectionTool):
renamed member "op" to "function". Changed "SelectOps saved_op" to
"GimpChannelOps saved_operation".
* app/tools/gimpselectiontool.c: we always have the right
GimpChannelOps in the tool options, so simply use it instead of
mixing up unrelated stuff in one enum. Results is some medium-ugly
nested switches, but is generally much cleaner than before.
* app/tools/gimpforegroundselecttool.c
* app/tools/gimpfreeselecttool.c
* app/tools/gimpiscissorstool.c
* app/tools/gimpregionselecttool.c: changed accordingly. Use the
operation from the tool options instead of selection_tool->op when
making the actual selection.
2006-10-18 01:04:55 -07:00
|
|
|
case SELECTION_SELECT:
|
|
|
|
|
switch (options->operation)
|
|
|
|
|
{
|
|
|
|
|
case GIMP_CHANNEL_OP_REPLACE:
|
|
|
|
|
break;
|
|
|
|
|
case GIMP_CHANNEL_OP_ADD:
|
|
|
|
|
modifier = GIMP_CURSOR_MODIFIER_PLUS;
|
|
|
|
|
break;
|
|
|
|
|
case GIMP_CHANNEL_OP_SUBTRACT:
|
|
|
|
|
modifier = GIMP_CURSOR_MODIFIER_MINUS;
|
|
|
|
|
break;
|
|
|
|
|
case GIMP_CHANNEL_OP_INTERSECT:
|
|
|
|
|
modifier = GIMP_CURSOR_MODIFIER_INTERSECT;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2001-03-02 07:24:12 -08:00
|
|
|
break;
|
Separate selection tool function (select, move, cut, ...) from selection
2006-10-18 Michael Natterer <mitch@gimp.org>
Separate selection tool function (select, move, cut, ...) from
selection mode (replace, add, ...). Fixes bug #313634 (that bug
wasn't triggered any more in HEAD, but was still there).
* app/tools/tools-enums.h: renamed enum SelectOp to SelectFunction
and replaced the values REPLACE, ADD, SUBTRACT and INTERSECT by a
single value SELECT.
* app/tools/gimpselectiontool.h (struct GimpSelectionTool):
renamed member "op" to "function". Changed "SelectOps saved_op" to
"GimpChannelOps saved_operation".
* app/tools/gimpselectiontool.c: we always have the right
GimpChannelOps in the tool options, so simply use it instead of
mixing up unrelated stuff in one enum. Results is some medium-ugly
nested switches, but is generally much cleaner than before.
* app/tools/gimpforegroundselecttool.c
* app/tools/gimpfreeselecttool.c
* app/tools/gimpiscissorstool.c
* app/tools/gimpregionselecttool.c: changed accordingly. Use the
operation from the tool options instead of selection_tool->op when
making the actual selection.
2006-10-18 01:04:55 -07:00
|
|
|
|
2001-03-02 07:24:12 -08:00
|
|
|
case SELECTION_MOVE_MASK:
|
2006-06-02 08:23:47 -07:00
|
|
|
modifier = GIMP_CURSOR_MODIFIER_MOVE;
|
2001-03-02 07:24:12 -08:00
|
|
|
break;
|
Separate selection tool function (select, move, cut, ...) from selection
2006-10-18 Michael Natterer <mitch@gimp.org>
Separate selection tool function (select, move, cut, ...) from
selection mode (replace, add, ...). Fixes bug #313634 (that bug
wasn't triggered any more in HEAD, but was still there).
* app/tools/tools-enums.h: renamed enum SelectOp to SelectFunction
and replaced the values REPLACE, ADD, SUBTRACT and INTERSECT by a
single value SELECT.
* app/tools/gimpselectiontool.h (struct GimpSelectionTool):
renamed member "op" to "function". Changed "SelectOps saved_op" to
"GimpChannelOps saved_operation".
* app/tools/gimpselectiontool.c: we always have the right
GimpChannelOps in the tool options, so simply use it instead of
mixing up unrelated stuff in one enum. Results is some medium-ugly
nested switches, but is generally much cleaner than before.
* app/tools/gimpforegroundselecttool.c
* app/tools/gimpfreeselecttool.c
* app/tools/gimpiscissorstool.c
* app/tools/gimpregionselecttool.c: changed accordingly. Use the
operation from the tool options instead of selection_tool->op when
making the actual selection.
2006-10-18 01:04:55 -07:00
|
|
|
|
2001-03-02 07:24:12 -08:00
|
|
|
case SELECTION_MOVE:
|
2003-05-16 05:10:47 -07:00
|
|
|
case SELECTION_MOVE_COPY:
|
2004-06-04 16:08:29 -07:00
|
|
|
tool_cursor = GIMP_TOOL_CURSOR_MOVE;
|
2001-03-02 07:24:12 -08:00
|
|
|
break;
|
Separate selection tool function (select, move, cut, ...) from selection
2006-10-18 Michael Natterer <mitch@gimp.org>
Separate selection tool function (select, move, cut, ...) from
selection mode (replace, add, ...). Fixes bug #313634 (that bug
wasn't triggered any more in HEAD, but was still there).
* app/tools/tools-enums.h: renamed enum SelectOp to SelectFunction
and replaced the values REPLACE, ADD, SUBTRACT and INTERSECT by a
single value SELECT.
* app/tools/gimpselectiontool.h (struct GimpSelectionTool):
renamed member "op" to "function". Changed "SelectOps saved_op" to
"GimpChannelOps saved_operation".
* app/tools/gimpselectiontool.c: we always have the right
GimpChannelOps in the tool options, so simply use it instead of
mixing up unrelated stuff in one enum. Results is some medium-ugly
nested switches, but is generally much cleaner than before.
* app/tools/gimpforegroundselecttool.c
* app/tools/gimpfreeselecttool.c
* app/tools/gimpiscissorstool.c
* app/tools/gimpregionselecttool.c: changed accordingly. Use the
operation from the tool options instead of selection_tool->op when
making the actual selection.
2006-10-18 01:04:55 -07:00
|
|
|
|
2001-03-02 07:24:12 -08:00
|
|
|
case SELECTION_ANCHOR:
|
2006-06-02 08:23:47 -07:00
|
|
|
modifier = GIMP_CURSOR_MODIFIER_ANCHOR;
|
2001-03-02 07:24:12 -08:00
|
|
|
break;
|
|
|
|
|
}
|
2002-04-21 00:31:12 -07:00
|
|
|
|
2006-06-03 08:41:40 -07:00
|
|
|
/* we don't set the bad modifier ourselves, so a subclass has set
|
|
|
|
|
* it, always leave it there since it's more important than what we
|
|
|
|
|
* have to say.
|
|
|
|
|
*/
|
|
|
|
|
if (gimp_tool_control_get_cursor_modifier (tool->control) ==
|
|
|
|
|
GIMP_CURSOR_MODIFIER_BAD)
|
|
|
|
|
{
|
|
|
|
|
modifier = GIMP_CURSOR_MODIFIER_BAD;
|
|
|
|
|
}
|
|
|
|
|
|
2006-06-02 08:23:47 -07:00
|
|
|
gimp_tool_set_cursor (tool, display,
|
|
|
|
|
gimp_tool_control_get_cursor (tool->control),
|
|
|
|
|
tool_cursor,
|
|
|
|
|
modifier);
|
2001-03-02 07:24:12 -08:00
|
|
|
}
|
2004-07-26 07:50:51 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/* public functions */
|
|
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
|
gimp_selection_tool_start_edit (GimpSelectionTool *sel_tool,
|
2008-11-01 08:17:36 -07:00
|
|
|
const GimpCoords *coords)
|
2004-07-26 07:50:51 -07:00
|
|
|
{
|
|
|
|
|
GimpTool *tool;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_SELECTION_TOOL (sel_tool), FALSE);
|
|
|
|
|
g_return_val_if_fail (coords != NULL, FALSE);
|
|
|
|
|
|
|
|
|
|
tool = GIMP_TOOL (sel_tool);
|
|
|
|
|
|
2006-03-28 09:55:52 -08:00
|
|
|
g_return_val_if_fail (GIMP_IS_DISPLAY (tool->display), FALSE);
|
2004-07-26 07:50:51 -07:00
|
|
|
g_return_val_if_fail (gimp_tool_control_is_active (tool->control), FALSE);
|
|
|
|
|
|
Separate selection tool function (select, move, cut, ...) from selection
2006-10-18 Michael Natterer <mitch@gimp.org>
Separate selection tool function (select, move, cut, ...) from
selection mode (replace, add, ...). Fixes bug #313634 (that bug
wasn't triggered any more in HEAD, but was still there).
* app/tools/tools-enums.h: renamed enum SelectOp to SelectFunction
and replaced the values REPLACE, ADD, SUBTRACT and INTERSECT by a
single value SELECT.
* app/tools/gimpselectiontool.h (struct GimpSelectionTool):
renamed member "op" to "function". Changed "SelectOps saved_op" to
"GimpChannelOps saved_operation".
* app/tools/gimpselectiontool.c: we always have the right
GimpChannelOps in the tool options, so simply use it instead of
mixing up unrelated stuff in one enum. Results is some medium-ugly
nested switches, but is generally much cleaner than before.
* app/tools/gimpforegroundselecttool.c
* app/tools/gimpfreeselecttool.c
* app/tools/gimpiscissorstool.c
* app/tools/gimpregionselecttool.c: changed accordingly. Use the
operation from the tool options instead of selection_tool->op when
making the actual selection.
2006-10-18 01:04:55 -07:00
|
|
|
switch (sel_tool->function)
|
2004-07-26 07:50:51 -07:00
|
|
|
{
|
|
|
|
|
case SELECTION_MOVE_MASK:
|
2006-03-28 09:55:52 -08:00
|
|
|
gimp_edit_selection_tool_start (tool, tool->display, coords,
|
2004-10-06 14:04:13 -07:00
|
|
|
GIMP_TRANSLATE_MODE_MASK, FALSE);
|
2004-07-26 07:50:51 -07:00
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
|
|
case SELECTION_MOVE:
|
2006-03-28 09:55:52 -08:00
|
|
|
gimp_edit_selection_tool_start (tool, tool->display, coords,
|
2004-10-06 14:04:13 -07:00
|
|
|
GIMP_TRANSLATE_MODE_MASK_TO_LAYER, FALSE);
|
2004-07-26 07:50:51 -07:00
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
|
|
case SELECTION_MOVE_COPY:
|
2006-03-28 09:55:52 -08:00
|
|
|
gimp_edit_selection_tool_start (tool, tool->display, coords,
|
2004-10-06 14:04:13 -07:00
|
|
|
GIMP_TRANSLATE_MODE_MASK_COPY_TO_LAYER,
|
|
|
|
|
FALSE);
|
2004-07-26 07:50:51 -07:00
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|