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
|
|
|
|
*
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
* Major improvement to support polygonal segments
|
|
|
|
* Copyright (C) 2008 Martin Nordholts
|
|
|
|
*
|
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
|
2009-01-18 06:28:01 +08:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
1997-11-25 06:05:25 +08:00
|
|
|
*/
|
2000-07-30 00:12:40 +08:00
|
|
|
|
2000-12-17 05:37:03 +08:00
|
|
|
#include "config.h"
|
|
|
|
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
#include <string.h>
|
|
|
|
|
2008-10-10 04:24:04 +08:00
|
|
|
#include <gegl.h>
|
2000-12-29 23:22:01 +08:00
|
|
|
#include <gtk/gtk.h>
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
#include <gdk/gdkkeysyms.h>
|
2000-12-17 05:37:03 +08:00
|
|
|
|
2007-03-09 21:00:01 +08:00
|
|
|
#include "libgimpmath/gimpmath.h"
|
2001-08-06 00:08:19 +08:00
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
|
|
|
|
2001-05-10 06:34:59 +08:00
|
|
|
#include "tools-types.h"
|
2000-12-17 05:37:03 +08:00
|
|
|
|
2009-04-23 03:08:42 +08:00
|
|
|
#include "core/gimp-utils.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "core/gimpchannel.h"
|
2003-10-06 20:17:11 +08:00
|
|
|
#include "core/gimpchannel-select.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "core/gimpimage.h"
|
2002-02-22 06:19:45 +08:00
|
|
|
#include "core/gimplayer-floating-sel.h"
|
2001-01-25 06:36:18 +08:00
|
|
|
|
2003-08-22 09:42:57 +08:00
|
|
|
#include "widgets/gimphelp-ids.h"
|
|
|
|
|
2001-09-26 07:23:09 +08:00
|
|
|
#include "display/gimpdisplay.h"
|
|
|
|
|
2001-03-10 01:39:18 +08:00
|
|
|
#include "gimpfreeselecttool.h"
|
2003-02-09 05:12:03 +08:00
|
|
|
#include "gimpselectionoptions.h"
|
2003-04-16 00:05:52 +08:00
|
|
|
#include "gimptoolcontrol.h"
|
2001-03-10 01:39:18 +08:00
|
|
|
|
2003-03-26 00:38:19 +08:00
|
|
|
#include "gimp-intl.h"
|
2001-03-10 01:39:18 +08:00
|
|
|
|
2000-07-30 00:12:40 +08:00
|
|
|
|
2008-05-21 03:09:41 +08:00
|
|
|
#define HANDLE_SIZE 12
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
#define POINT_GRAB_THRESHOLD_SQ SQR(HANDLE_SIZE / 2)
|
2008-05-24 05:46:13 +08:00
|
|
|
#define POINT_SHOW_THRESHOLD_SQ SQR(HANDLE_SIZE * 7)
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
#define N_ITEMS_PER_ALLOC 1024
|
|
|
|
#define INVALID_INDEX (-1)
|
2008-05-25 21:44:11 +08:00
|
|
|
#define NO_CLICK_TIME_AVAILABLE 0
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
|
2008-05-22 03:36:16 +08:00
|
|
|
#define GET_PRIVATE(fst) \
|
2008-08-16 18:07:43 +08:00
|
|
|
(G_TYPE_INSTANCE_GET_PRIVATE ((fst), \
|
|
|
|
GIMP_TYPE_FREE_SELECT_TOOL, GimpFreeSelectToolPrivate))
|
2008-05-22 03:36:16 +08:00
|
|
|
|
|
|
|
|
2008-08-16 18:07:43 +08:00
|
|
|
typedef struct
|
2008-05-22 03:36:16 +08:00
|
|
|
{
|
|
|
|
/* Index of grabbed segment index. */
|
|
|
|
gint grabbed_segment_index;
|
|
|
|
|
2008-05-25 23:16:46 +08:00
|
|
|
/* Wether or not button 1 is down. */
|
2008-05-22 03:36:16 +08:00
|
|
|
gboolean button1_down;
|
|
|
|
|
|
|
|
/* We need to keep track of a number of points when we move a
|
|
|
|
* segment vertex
|
|
|
|
*/
|
|
|
|
GimpVector2 *saved_points_lower_segment;
|
|
|
|
GimpVector2 *saved_points_higher_segment;
|
2008-06-20 20:22:46 +08:00
|
|
|
gint max_n_saved_points_lower_segment;
|
|
|
|
gint max_n_saved_points_higher_segment;
|
2008-05-22 03:36:16 +08:00
|
|
|
|
|
|
|
/* Keeps track wether or not a modification of the polygon has been
|
|
|
|
* made between _button_press and _button_release
|
|
|
|
*/
|
|
|
|
gboolean polygon_modified;
|
|
|
|
|
|
|
|
/* Point which is used to draw the polygon but which is not part of
|
|
|
|
* it yet
|
|
|
|
*/
|
|
|
|
GimpVector2 pending_point;
|
|
|
|
gboolean show_pending_point;
|
|
|
|
|
|
|
|
/* The points of the polygon */
|
|
|
|
GimpVector2 *points;
|
|
|
|
gint max_n_points;
|
|
|
|
|
|
|
|
/* The number of points actually in use */
|
|
|
|
gint n_points;
|
|
|
|
|
|
|
|
|
|
|
|
/* Any int array containing the indices for the points in the
|
|
|
|
* polygon that connects different segments together
|
|
|
|
*/
|
|
|
|
gint *segment_indices;
|
|
|
|
gint max_n_segment_indices;
|
|
|
|
|
|
|
|
/* The number of segment indices actually in use */
|
|
|
|
gint n_segment_indices;
|
2008-05-22 23:40:18 +08:00
|
|
|
|
|
|
|
/* The selection operation active when the tool was started */
|
|
|
|
GimpChannelOps operation_at_start;
|
|
|
|
|
2008-05-25 23:16:46 +08:00
|
|
|
/* Wether or not to constrain the angle for newly created polygonal
|
|
|
|
* segments.
|
|
|
|
*/
|
2008-05-23 02:05:10 +08:00
|
|
|
gboolean constrain_angle;
|
|
|
|
|
2008-05-25 22:31:33 +08:00
|
|
|
/* Wether or not to supress handles (so that new segments can be
|
|
|
|
* created immediately after an existing segment vertex.
|
|
|
|
*/
|
|
|
|
gboolean supress_handles;
|
|
|
|
|
2008-06-20 20:34:37 +08:00
|
|
|
/* Last _oper_update or _motion coords */
|
2008-05-24 05:46:13 +08:00
|
|
|
GimpVector2 last_coords;
|
|
|
|
|
2008-05-25 21:44:11 +08:00
|
|
|
/* A double-click commits the selection, keep track of last
|
|
|
|
* click-time and click-position.
|
|
|
|
*/
|
|
|
|
guint32 last_click_time;
|
|
|
|
GimpCoords last_click_coord;
|
|
|
|
|
2008-08-16 18:07:43 +08:00
|
|
|
} GimpFreeSelectToolPrivate;
|
2008-05-22 03:36:16 +08:00
|
|
|
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
|
2008-06-20 20:34:37 +08:00
|
|
|
static void gimp_free_select_tool_finalize (GObject *object);
|
|
|
|
static void gimp_free_select_tool_control (GimpTool *tool,
|
|
|
|
GimpToolAction action,
|
|
|
|
GimpDisplay *display);
|
|
|
|
static void gimp_free_select_tool_oper_update (GimpTool *tool,
|
2008-11-01 23:17:36 +08:00
|
|
|
const GimpCoords *coords,
|
2008-06-20 20:34:37 +08:00
|
|
|
GdkModifierType state,
|
|
|
|
gboolean proximity,
|
|
|
|
GimpDisplay *display);
|
|
|
|
static void gimp_free_select_tool_cursor_update (GimpTool *tool,
|
2008-11-01 23:17:36 +08:00
|
|
|
const GimpCoords *coords,
|
2008-06-20 20:34:37 +08:00
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *display);
|
|
|
|
static void gimp_free_select_tool_button_press (GimpTool *tool,
|
2008-11-01 23:17:36 +08:00
|
|
|
const GimpCoords *coords,
|
2008-06-20 20:34:37 +08:00
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
2009-06-20 23:37:31 +08:00
|
|
|
GimpButtonPressType press_type,
|
2008-06-20 20:34:37 +08:00
|
|
|
GimpDisplay *display);
|
|
|
|
static void gimp_free_select_tool_button_release (GimpTool *tool,
|
2008-11-01 23:17:36 +08:00
|
|
|
const GimpCoords *coords,
|
2008-06-20 20:34:37 +08:00
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpButtonReleaseType release_type,
|
|
|
|
GimpDisplay *display);
|
|
|
|
static void gimp_free_select_tool_motion (GimpTool *tool,
|
2008-11-01 23:17:36 +08:00
|
|
|
const GimpCoords *coords,
|
2008-06-20 20:34:37 +08:00
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *display);
|
|
|
|
static gboolean gimp_free_select_tool_key_press (GimpTool *tool,
|
|
|
|
GdkEventKey *kevent,
|
|
|
|
GimpDisplay *display);
|
|
|
|
static void gimp_free_select_tool_modifier_key (GimpTool *tool,
|
|
|
|
GdkModifierType key,
|
|
|
|
gboolean press,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *display);
|
|
|
|
static void gimp_free_select_tool_active_modifier_key (GimpTool *tool,
|
|
|
|
GdkModifierType key,
|
|
|
|
gboolean press,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *display);
|
|
|
|
static void gimp_free_select_tool_draw (GimpDrawTool *draw_tool);
|
|
|
|
static void gimp_free_select_tool_real_select (GimpFreeSelectTool *fst,
|
|
|
|
GimpDisplay *display);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-12-31 12:07:42 +08:00
|
|
|
|
2005-12-13 17:13:50 +08:00
|
|
|
G_DEFINE_TYPE (GimpFreeSelectTool, gimp_free_select_tool,
|
|
|
|
GIMP_TYPE_SELECTION_TOOL);
|
1999-04-13 01:55:06 +08:00
|
|
|
|
2005-12-13 17:13:50 +08:00
|
|
|
#define parent_class gimp_free_select_tool_parent_class
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-04-09 06:25:54 +08:00
|
|
|
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
static const GimpVector2 vector2_zero = { 0.0, 0.0 };
|
|
|
|
|
|
|
|
|
2001-03-10 01:39:18 +08:00
|
|
|
void
|
2002-03-29 11:50:29 +08:00
|
|
|
gimp_free_select_tool_register (GimpToolRegisterCallback callback,
|
2002-05-03 19:31:08 +08:00
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2002-03-29 11:50:29 +08:00
|
|
|
(* callback) (GIMP_TYPE_FREE_SELECT_TOOL,
|
2003-02-05 22:39:40 +08:00
|
|
|
GIMP_TYPE_SELECTION_OPTIONS,
|
|
|
|
gimp_selection_options_gui,
|
2003-06-28 19:20:37 +08:00
|
|
|
0,
|
2002-03-21 20:17:17 +08:00
|
|
|
"gimp-free-select-tool",
|
2001-11-21 07:00:47 +08:00
|
|
|
_("Free Select"),
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
_("Free Select Tool: Select a hand-drawn region with free and polygonal segments"),
|
2004-04-29 21:19:28 +08:00
|
|
|
N_("_Free Select"), "F",
|
2003-08-22 09:42:57 +08:00
|
|
|
NULL, GIMP_HELP_TOOL_FREE_SELECT,
|
2002-03-29 11:50:29 +08:00
|
|
|
GIMP_STOCK_TOOL_FREE_SELECT,
|
2002-05-03 19:31:08 +08:00
|
|
|
data);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2001-03-10 01:39:18 +08:00
|
|
|
static void
|
|
|
|
gimp_free_select_tool_class_init (GimpFreeSelectToolClass *klass)
|
|
|
|
{
|
2004-06-05 07:08:29 +08:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
|
|
|
|
GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass);
|
2001-03-10 01:39:18 +08:00
|
|
|
|
2008-06-20 20:34:37 +08:00
|
|
|
object_class->finalize = gimp_free_select_tool_finalize;
|
2001-03-10 01:39:18 +08:00
|
|
|
|
2008-06-20 20:34:37 +08:00
|
|
|
tool_class->control = gimp_free_select_tool_control;
|
|
|
|
tool_class->oper_update = gimp_free_select_tool_oper_update;
|
|
|
|
tool_class->cursor_update = gimp_free_select_tool_cursor_update;
|
|
|
|
tool_class->button_press = gimp_free_select_tool_button_press;
|
|
|
|
tool_class->button_release = gimp_free_select_tool_button_release;
|
|
|
|
tool_class->motion = gimp_free_select_tool_motion;
|
|
|
|
tool_class->key_press = gimp_free_select_tool_key_press;
|
|
|
|
tool_class->modifier_key = gimp_free_select_tool_modifier_key;
|
|
|
|
tool_class->active_modifier_key = gimp_free_select_tool_active_modifier_key;
|
2001-03-10 01:39:18 +08:00
|
|
|
|
2008-06-20 20:34:37 +08:00
|
|
|
draw_tool_class->draw = gimp_free_select_tool_draw;
|
2005-07-29 09:48:56 +08:00
|
|
|
|
2008-06-20 20:34:37 +08:00
|
|
|
klass->select = gimp_free_select_tool_real_select;
|
2008-05-22 03:36:16 +08:00
|
|
|
|
2008-08-16 18:07:43 +08:00
|
|
|
g_type_class_add_private (klass, sizeof (GimpFreeSelectToolPrivate));
|
2001-03-10 01:39:18 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
gimp_free_select_tool_init (GimpFreeSelectTool *fst)
|
2001-03-10 01:39:18 +08:00
|
|
|
{
|
2008-08-16 18:07:43 +08:00
|
|
|
GimpTool *tool = GIMP_TOOL (fst);
|
|
|
|
GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
|
2001-03-10 01:39:18 +08:00
|
|
|
|
2006-10-04 23:42:33 +08:00
|
|
|
gimp_tool_control_set_scroll_lock (tool->control, FALSE);
|
2007-03-10 23:07:56 +08:00
|
|
|
gimp_tool_control_set_wants_click (tool->control, TRUE);
|
2008-08-21 00:22:09 +08:00
|
|
|
gimp_tool_control_set_precision (tool->control,
|
|
|
|
GIMP_CURSOR_PRECISION_SUBPIXEL);
|
2004-06-05 07:08:29 +08:00
|
|
|
gimp_tool_control_set_tool_cursor (tool->control,
|
|
|
|
GIMP_TOOL_CURSOR_FREE_SELECT);
|
2002-03-29 11:50:29 +08:00
|
|
|
|
2008-06-20 20:22:46 +08:00
|
|
|
priv->grabbed_segment_index = INVALID_INDEX;
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
|
2008-06-20 20:22:46 +08:00
|
|
|
priv->button1_down = FALSE;
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
|
2008-06-20 20:22:46 +08:00
|
|
|
priv->saved_points_lower_segment = NULL;
|
|
|
|
priv->saved_points_higher_segment = NULL;
|
|
|
|
priv->max_n_saved_points_lower_segment = 0;
|
|
|
|
priv->max_n_saved_points_higher_segment = 0;
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
|
2008-06-20 20:22:46 +08:00
|
|
|
priv->polygon_modified = FALSE;
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
|
2008-06-20 20:22:46 +08:00
|
|
|
priv->show_pending_point = FALSE;
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
|
2008-06-20 20:22:46 +08:00
|
|
|
priv->points = NULL;
|
|
|
|
priv->n_points = 0;
|
|
|
|
priv->max_n_points = 0;
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
|
2008-06-20 20:22:46 +08:00
|
|
|
priv->segment_indices = NULL;
|
|
|
|
priv->n_segment_indices = 0;
|
|
|
|
priv->max_n_segment_indices = 0;
|
2008-05-23 02:05:10 +08:00
|
|
|
|
2008-06-20 20:22:46 +08:00
|
|
|
priv->constrain_angle = FALSE;
|
|
|
|
priv->supress_handles = FALSE;
|
2008-05-25 21:44:11 +08:00
|
|
|
|
2008-06-20 20:22:46 +08:00
|
|
|
priv->last_click_time = NO_CLICK_TIME_AVAILABLE;
|
2001-03-10 01:39:18 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-08-14 22:53:55 +08:00
|
|
|
gimp_free_select_tool_finalize (GObject *object)
|
2001-03-10 01:39:18 +08:00
|
|
|
{
|
2008-08-16 18:07:43 +08:00
|
|
|
GimpFreeSelectTool *fst = GIMP_FREE_SELECT_TOOL (object);
|
|
|
|
GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
|
2008-05-22 03:36:16 +08:00
|
|
|
g_free (priv->points);
|
2008-06-20 19:23:09 +08:00
|
|
|
g_free (priv->segment_indices);
|
2008-06-20 20:22:46 +08:00
|
|
|
g_free (priv->saved_points_lower_segment);
|
|
|
|
g_free (priv->saved_points_higher_segment);
|
2008-05-22 18:53:20 +08:00
|
|
|
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-05-23 00:58:21 +08:00
|
|
|
gimp_free_select_tool_get_segment (GimpFreeSelectTool *fst,
|
|
|
|
GimpVector2 **points,
|
|
|
|
gint *n_points,
|
|
|
|
gint segment_start,
|
|
|
|
gint segment_end)
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
{
|
2008-08-16 18:07:43 +08:00
|
|
|
GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
|
2008-05-22 03:36:16 +08:00
|
|
|
|
|
|
|
*points = &priv->points[priv->segment_indices[segment_start]];
|
|
|
|
*n_points = priv->segment_indices[segment_end] -
|
|
|
|
priv->segment_indices[segment_start] +
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
1;
|
|
|
|
}
|
|
|
|
|
2008-06-20 20:34:37 +08:00
|
|
|
static void
|
|
|
|
gimp_free_select_tool_get_segment_point (GimpFreeSelectTool *fst,
|
|
|
|
gdouble *start_point_x,
|
|
|
|
gdouble *start_point_y,
|
|
|
|
gint segment_index)
|
|
|
|
{
|
2008-08-16 18:07:43 +08:00
|
|
|
GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
|
2008-06-20 20:34:37 +08:00
|
|
|
|
|
|
|
*start_point_x = priv->points[priv->segment_indices[segment_index]].x;
|
|
|
|
*start_point_y = priv->points[priv->segment_indices[segment_index]].y;
|
|
|
|
}
|
|
|
|
|
2008-05-23 02:05:10 +08:00
|
|
|
static void
|
|
|
|
gimp_free_select_tool_get_last_point (GimpFreeSelectTool *fst,
|
|
|
|
gdouble *start_point_x,
|
|
|
|
gdouble *start_point_y)
|
|
|
|
{
|
2008-08-16 18:07:43 +08:00
|
|
|
GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
|
2008-05-23 02:05:10 +08:00
|
|
|
|
2008-06-20 20:34:37 +08:00
|
|
|
gimp_free_select_tool_get_segment_point (fst,
|
|
|
|
start_point_x,
|
|
|
|
start_point_y,
|
|
|
|
priv->n_segment_indices - 1);
|
2008-05-23 02:05:10 +08:00
|
|
|
}
|
|
|
|
|
2008-05-25 21:44:11 +08:00
|
|
|
static void
|
|
|
|
gimp_free_select_tool_get_double_click_settings (gint *double_click_time,
|
|
|
|
gint *double_click_distance)
|
|
|
|
{
|
|
|
|
GdkScreen *screen = gdk_screen_get_default ();
|
|
|
|
|
|
|
|
if (screen != NULL)
|
|
|
|
{
|
|
|
|
GtkSettings *settings = gtk_settings_get_for_screen (screen);
|
|
|
|
|
|
|
|
g_object_get (settings,
|
|
|
|
"gtk-double-click-time", double_click_time,
|
|
|
|
"gtk-double-click-distance", double_click_distance,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
}
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gimp_free_select_tool_should_close (GimpFreeSelectTool *fst,
|
|
|
|
GimpDisplay *display,
|
2008-05-25 21:44:11 +08:00
|
|
|
guint32 time,
|
2008-11-01 23:17:36 +08:00
|
|
|
const GimpCoords *coords)
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
{
|
2008-08-16 18:07:43 +08:00
|
|
|
GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
|
|
|
|
gboolean double_click = FALSE;
|
|
|
|
gdouble dist = G_MAXDOUBLE;
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
|
2008-05-22 03:36:16 +08:00
|
|
|
if (priv->polygon_modified ||
|
2009-12-22 05:24:26 +08:00
|
|
|
priv->n_segment_indices <= 0 ||
|
2008-05-21 01:06:19 +08:00
|
|
|
GIMP_TOOL (fst)->display == NULL)
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
dist = gimp_draw_tool_calc_distance_square (GIMP_DRAW_TOOL (fst),
|
|
|
|
display,
|
|
|
|
coords->x,
|
|
|
|
coords->y,
|
2008-05-22 03:36:16 +08:00
|
|
|
priv->points[0].x,
|
|
|
|
priv->points[0].y);
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
|
2008-05-25 21:44:11 +08:00
|
|
|
/* Handle double-click. It must be within GTK+ global double-click
|
|
|
|
* time since last click, and it must be within GTK+ global
|
|
|
|
* double-click distance away from the last point
|
|
|
|
*/
|
|
|
|
if (time != NO_CLICK_TIME_AVAILABLE)
|
|
|
|
{
|
|
|
|
gint double_click_time;
|
|
|
|
gint double_click_distance;
|
|
|
|
gint click_time_passed;
|
|
|
|
gdouble dist_from_last_point;
|
|
|
|
|
|
|
|
click_time_passed = time - priv->last_click_time;
|
|
|
|
|
|
|
|
dist_from_last_point =
|
|
|
|
gimp_draw_tool_calc_distance_square (GIMP_DRAW_TOOL (fst),
|
|
|
|
display,
|
|
|
|
coords->x,
|
|
|
|
coords->y,
|
|
|
|
priv->last_click_coord.x,
|
|
|
|
priv->last_click_coord.y);
|
|
|
|
|
|
|
|
gimp_free_select_tool_get_double_click_settings (&double_click_time,
|
|
|
|
&double_click_distance);
|
|
|
|
|
|
|
|
double_click = click_time_passed < double_click_time &&
|
|
|
|
dist_from_last_point < double_click_distance;
|
|
|
|
}
|
|
|
|
|
2008-08-16 18:07:43 +08:00
|
|
|
return ((! priv->supress_handles && dist < POINT_GRAB_THRESHOLD_SQ) ||
|
|
|
|
double_click);
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-05-25 22:31:33 +08:00
|
|
|
gimp_free_select_tool_handle_segment_selection (GimpFreeSelectTool *fst,
|
|
|
|
GimpDisplay *display,
|
2008-11-01 23:17:36 +08:00
|
|
|
const GimpCoords *coords)
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
{
|
2008-08-16 18:07:43 +08:00
|
|
|
GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
|
|
|
|
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (fst);
|
|
|
|
gdouble shortest_dist = POINT_GRAB_THRESHOLD_SQ;
|
|
|
|
gint grabbed_segment_index = INVALID_INDEX;
|
|
|
|
gint i;
|
2001-03-10 01:39:18 +08:00
|
|
|
|
2008-05-25 22:31:33 +08:00
|
|
|
if (GIMP_TOOL (fst)->display != NULL &&
|
|
|
|
! priv->supress_handles)
|
2001-08-14 22:53:55 +08:00
|
|
|
{
|
2008-05-22 03:36:16 +08:00
|
|
|
for (i = 0; i < priv->n_segment_indices; i++)
|
2008-05-21 01:06:19 +08:00
|
|
|
{
|
|
|
|
gdouble dist;
|
|
|
|
GimpVector2 *point;
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
|
2008-05-22 03:36:16 +08:00
|
|
|
point = &priv->points[priv->segment_indices[i]];
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
|
2008-05-21 01:06:19 +08:00
|
|
|
dist = gimp_draw_tool_calc_distance_square (draw_tool,
|
|
|
|
display,
|
|
|
|
coords->x,
|
|
|
|
coords->y,
|
|
|
|
point->x,
|
|
|
|
point->y);
|
|
|
|
|
|
|
|
if (dist < shortest_dist)
|
|
|
|
{
|
|
|
|
grabbed_segment_index = i;
|
|
|
|
}
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
}
|
2001-08-14 22:53:55 +08:00
|
|
|
}
|
2001-03-10 01:39:18 +08:00
|
|
|
|
2008-05-22 03:36:16 +08:00
|
|
|
if (grabbed_segment_index != priv->grabbed_segment_index)
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
{
|
|
|
|
gimp_draw_tool_pause(draw_tool);
|
|
|
|
|
2008-05-22 03:36:16 +08:00
|
|
|
priv->grabbed_segment_index = grabbed_segment_index;
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
|
|
|
|
gimp_draw_tool_resume(draw_tool);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_free_select_tool_halt (GimpFreeSelectTool *fst)
|
|
|
|
{
|
2008-08-16 18:07:43 +08:00
|
|
|
GimpTool *tool = GIMP_TOOL (fst);
|
|
|
|
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (fst);
|
|
|
|
GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
|
|
|
|
if (gimp_draw_tool_is_active (draw_tool))
|
|
|
|
gimp_draw_tool_stop (draw_tool);
|
|
|
|
|
|
|
|
if (gimp_tool_control_is_active (tool->control))
|
|
|
|
gimp_tool_control_halt (tool->control);
|
|
|
|
|
2008-05-22 03:36:16 +08:00
|
|
|
priv->grabbed_segment_index = INVALID_INDEX;
|
|
|
|
priv->show_pending_point = FALSE;
|
|
|
|
priv->n_points = 0;
|
|
|
|
priv->n_segment_indices = 0;
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
|
|
|
|
tool->display = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_free_select_tool_revert_to_last_segment (GimpFreeSelectTool *fst)
|
|
|
|
{
|
2008-08-16 18:07:43 +08:00
|
|
|
GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
|
2008-05-22 03:36:16 +08:00
|
|
|
|
|
|
|
priv->n_points = priv->segment_indices[priv->n_segment_indices - 1] + 1;
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_free_select_tool_update_button_state (GimpFreeSelectTool *fst,
|
|
|
|
GdkModifierType state)
|
|
|
|
{
|
2008-08-16 18:07:43 +08:00
|
|
|
GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
|
2008-05-22 03:36:16 +08:00
|
|
|
|
|
|
|
priv->button1_down = state & GDK_BUTTON1_MASK ? TRUE : FALSE;
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_free_select_tool_remove_last_segment (GimpFreeSelectTool *fst)
|
|
|
|
{
|
2008-08-16 18:07:43 +08:00
|
|
|
GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
|
|
|
|
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (fst);
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
|
|
|
|
gimp_draw_tool_pause (draw_tool);
|
|
|
|
|
2009-12-09 05:27:32 +08:00
|
|
|
if (priv->n_segment_indices > 0)
|
|
|
|
priv->n_segment_indices--;
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
|
2009-12-09 05:27:32 +08:00
|
|
|
if (priv->n_segment_indices <= 0)
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
{
|
|
|
|
gimp_free_select_tool_halt (fst);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gimp_free_select_tool_revert_to_last_segment (fst);
|
|
|
|
}
|
|
|
|
|
|
|
|
gimp_draw_tool_resume (draw_tool);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_free_select_tool_add_point (GimpFreeSelectTool *fst,
|
|
|
|
gdouble x,
|
|
|
|
gdouble y)
|
|
|
|
{
|
2008-08-16 18:07:43 +08:00
|
|
|
GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
|
2008-05-22 03:36:16 +08:00
|
|
|
|
|
|
|
if (priv->n_points >= priv->max_n_points)
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
{
|
2008-05-22 03:36:16 +08:00
|
|
|
priv->max_n_points += N_ITEMS_PER_ALLOC;
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
|
2008-05-22 03:36:16 +08:00
|
|
|
priv->points = g_realloc (priv->points,
|
|
|
|
sizeof (GimpVector2) * priv->max_n_points);
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
}
|
|
|
|
|
2008-05-22 03:36:16 +08:00
|
|
|
priv->points[priv->n_points].x = x;
|
|
|
|
priv->points[priv->n_points].y = y;
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
|
2008-05-22 03:36:16 +08:00
|
|
|
priv->n_points++;
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_free_select_tool_add_segment_index (GimpFreeSelectTool *fst,
|
|
|
|
gint index)
|
|
|
|
{
|
2008-08-16 18:07:43 +08:00
|
|
|
GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
|
2008-05-22 03:36:16 +08:00
|
|
|
|
|
|
|
if (priv->n_segment_indices >= priv->max_n_segment_indices)
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
{
|
2008-05-22 03:36:16 +08:00
|
|
|
priv->max_n_segment_indices += N_ITEMS_PER_ALLOC;
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
|
2008-05-22 03:36:16 +08:00
|
|
|
priv->segment_indices = g_realloc (priv->segment_indices,
|
2008-08-16 18:07:43 +08:00
|
|
|
sizeof (GimpVector2) *
|
|
|
|
priv->max_n_segment_indices);
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
}
|
|
|
|
|
2008-05-22 03:36:16 +08:00
|
|
|
priv->segment_indices[priv->n_segment_indices] = index;
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
|
2008-05-22 03:36:16 +08:00
|
|
|
priv->n_segment_indices++;
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gimp_free_select_tool_is_point_grabbed (GimpFreeSelectTool *fst)
|
|
|
|
{
|
2008-08-16 18:07:43 +08:00
|
|
|
GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
|
2008-05-22 03:36:16 +08:00
|
|
|
|
|
|
|
return priv->grabbed_segment_index != INVALID_INDEX;
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_free_select_tool_start (GimpFreeSelectTool *fst,
|
2008-11-01 23:17:36 +08:00
|
|
|
const GimpCoords *coords,
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
GimpDisplay *display)
|
|
|
|
{
|
2008-08-16 18:07:43 +08:00
|
|
|
GimpTool *tool = GIMP_TOOL (fst);
|
|
|
|
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
|
|
|
|
GimpSelectionOptions *options = GIMP_SELECTION_TOOL_GET_OPTIONS (fst);
|
|
|
|
GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
|
|
|
|
gimp_free_select_tool_halt (fst);
|
|
|
|
|
|
|
|
gimp_tool_control_activate (tool->control);
|
|
|
|
|
|
|
|
tool->display = display;
|
|
|
|
|
|
|
|
gimp_draw_tool_start (draw_tool, display);
|
|
|
|
|
2008-05-22 23:40:18 +08:00
|
|
|
/* We want to apply the selection operation that was current when
|
|
|
|
* the tool was started, so we save this information */
|
|
|
|
priv->operation_at_start = options->operation;
|
|
|
|
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
gimp_selection_tool_start_edit (GIMP_SELECTION_TOOL (fst),
|
|
|
|
coords);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_free_select_tool_fit_segment (GimpFreeSelectTool *fst,
|
|
|
|
GimpVector2 *dest_points,
|
|
|
|
GimpVector2 dest_start_target,
|
|
|
|
GimpVector2 dest_end_target,
|
|
|
|
const GimpVector2 *source_points,
|
|
|
|
gint n_points)
|
|
|
|
{
|
|
|
|
GimpVector2 origo_translation_offset;
|
|
|
|
GimpVector2 untranslation_offset;
|
|
|
|
gdouble rotation;
|
|
|
|
gdouble scale;
|
|
|
|
|
|
|
|
/* Handle some quick special cases */
|
|
|
|
if (n_points <= 0)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if (n_points == 1)
|
|
|
|
{
|
|
|
|
dest_points[0] = dest_end_target;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if (n_points == 2)
|
|
|
|
{
|
|
|
|
dest_points[0] = dest_start_target;
|
|
|
|
dest_points[1] = dest_end_target;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Copy from source to dest; we work on the dest data */
|
|
|
|
memcpy (dest_points, source_points, sizeof (GimpVector2) * n_points);
|
|
|
|
|
|
|
|
/* Transform the destination end point */
|
|
|
|
{
|
|
|
|
GimpVector2 *dest_end;
|
|
|
|
GimpVector2 origo_translated_end_target;
|
|
|
|
gdouble target_rotation;
|
|
|
|
gdouble current_rotation;
|
|
|
|
gdouble target_length;
|
|
|
|
gdouble current_length;
|
|
|
|
|
|
|
|
dest_end = &dest_points[n_points - 1];
|
|
|
|
|
|
|
|
/* Transate to origin */
|
|
|
|
gimp_vector2_sub (&origo_translation_offset,
|
|
|
|
&vector2_zero,
|
|
|
|
&dest_points[0]);
|
|
|
|
gimp_vector2_add (dest_end,
|
|
|
|
dest_end,
|
|
|
|
&origo_translation_offset);
|
|
|
|
|
|
|
|
/* Calculate origo_translated_end_target */
|
|
|
|
gimp_vector2_sub (&origo_translated_end_target,
|
|
|
|
&dest_end_target,
|
|
|
|
&dest_start_target);
|
|
|
|
|
|
|
|
/* Rotate */
|
|
|
|
target_rotation = atan2 (vector2_zero.y - origo_translated_end_target.y,
|
|
|
|
vector2_zero.x - origo_translated_end_target.x);
|
|
|
|
current_rotation = atan2 (vector2_zero.y - dest_end->y,
|
|
|
|
vector2_zero.x - dest_end->x);
|
|
|
|
rotation = current_rotation - target_rotation;
|
|
|
|
|
|
|
|
gimp_vector2_rotate (dest_end, rotation);
|
|
|
|
|
|
|
|
|
|
|
|
/* Scale */
|
|
|
|
target_length = gimp_vector2_length (&origo_translated_end_target);
|
|
|
|
current_length = gimp_vector2_length (dest_end);
|
|
|
|
scale = target_length / current_length;
|
|
|
|
|
|
|
|
gimp_vector2_mul (dest_end, scale);
|
|
|
|
|
|
|
|
|
|
|
|
/* Untranslate */
|
|
|
|
gimp_vector2_sub (&untranslation_offset,
|
|
|
|
&dest_end_target,
|
|
|
|
dest_end);
|
|
|
|
gimp_vector2_add (dest_end,
|
|
|
|
dest_end,
|
|
|
|
&untranslation_offset);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Do the same transformation for the rest of the points */
|
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
for (i = 0; i < n_points - 1; i++)
|
|
|
|
{
|
|
|
|
/* Translate */
|
|
|
|
gimp_vector2_add (&dest_points[i],
|
|
|
|
&origo_translation_offset,
|
|
|
|
&dest_points[i]);
|
|
|
|
|
|
|
|
/* Rotate */
|
|
|
|
gimp_vector2_rotate (&dest_points[i],
|
|
|
|
rotation);
|
|
|
|
|
|
|
|
/* Scale */
|
|
|
|
gimp_vector2_mul (&dest_points[i],
|
|
|
|
scale);
|
|
|
|
|
|
|
|
/* Untranslate */
|
|
|
|
gimp_vector2_add (&dest_points[i],
|
|
|
|
&dest_points[i],
|
|
|
|
&untranslation_offset);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_free_select_tool_move_segment_vertex_to (GimpFreeSelectTool *fst,
|
|
|
|
gint segment_index,
|
|
|
|
gdouble new_x,
|
|
|
|
gdouble new_y)
|
|
|
|
{
|
2008-08-16 18:07:43 +08:00
|
|
|
GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
|
|
|
|
GimpVector2 cursor_point = { new_x, new_y };
|
|
|
|
GimpVector2 *dest;
|
|
|
|
GimpVector2 *dest_start_target;
|
|
|
|
GimpVector2 *dest_end_target;
|
|
|
|
gint n_points;
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
|
|
|
|
/* Handle the segment before the grabbed point */
|
|
|
|
if (segment_index > 0)
|
|
|
|
{
|
2008-05-23 00:58:21 +08:00
|
|
|
gimp_free_select_tool_get_segment (fst,
|
|
|
|
&dest,
|
|
|
|
&n_points,
|
|
|
|
priv->grabbed_segment_index - 1,
|
|
|
|
priv->grabbed_segment_index);
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
|
|
|
|
dest_start_target = &dest[0];
|
|
|
|
dest_end_target = &cursor_point;
|
|
|
|
|
|
|
|
gimp_free_select_tool_fit_segment (fst,
|
|
|
|
dest,
|
|
|
|
*dest_start_target,
|
|
|
|
*dest_end_target,
|
2008-05-22 03:36:16 +08:00
|
|
|
priv->saved_points_lower_segment,
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
n_points);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle the segment after the grabbed point */
|
2008-05-22 03:36:16 +08:00
|
|
|
if (segment_index < priv->n_segment_indices - 1)
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
{
|
2008-05-23 00:58:21 +08:00
|
|
|
gimp_free_select_tool_get_segment (fst,
|
|
|
|
&dest,
|
|
|
|
&n_points,
|
|
|
|
priv->grabbed_segment_index,
|
|
|
|
priv->grabbed_segment_index + 1);
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
|
|
|
|
dest_start_target = &cursor_point;
|
|
|
|
dest_end_target = &dest[n_points - 1];
|
|
|
|
|
|
|
|
gimp_free_select_tool_fit_segment (fst,
|
|
|
|
dest,
|
|
|
|
*dest_start_target,
|
|
|
|
*dest_end_target,
|
2008-05-22 03:36:16 +08:00
|
|
|
priv->saved_points_higher_segment,
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
n_points);
|
|
|
|
}
|
2008-05-26 01:35:52 +08:00
|
|
|
|
|
|
|
/* Handle when there only is one point */
|
|
|
|
if (segment_index == 0 &&
|
|
|
|
priv->n_segment_indices == 1)
|
|
|
|
{
|
|
|
|
priv->points[0].x = new_x;
|
|
|
|
priv->points[0].y = new_y;
|
|
|
|
}
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_free_select_tool_finish_line_segment:
|
|
|
|
* @free_ploy_sel_tool:
|
|
|
|
* @end_x:
|
|
|
|
* @end_y:
|
|
|
|
*
|
|
|
|
* Adds a line segment. Also cancels a pending free segment if any.
|
|
|
|
**/
|
|
|
|
static void
|
|
|
|
gimp_free_select_tool_finish_line_segment (GimpFreeSelectTool *fst)
|
|
|
|
{
|
|
|
|
/* Revert any free segment points that might have been added */
|
|
|
|
gimp_free_select_tool_revert_to_last_segment (fst);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_free_select_tool_finish_free_segment:
|
|
|
|
* @fst:
|
|
|
|
*
|
|
|
|
* Finnishes off the creation of a free segment.
|
|
|
|
**/
|
|
|
|
static void
|
|
|
|
gimp_free_select_tool_finish_free_segment (GimpFreeSelectTool *fst)
|
|
|
|
{
|
2008-08-16 18:07:43 +08:00
|
|
|
GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
|
2008-05-22 03:36:16 +08:00
|
|
|
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
/* The points are all setup, just make a segment */
|
|
|
|
gimp_free_select_tool_add_segment_index (fst,
|
2008-05-22 03:36:16 +08:00
|
|
|
priv->n_points - 1);
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_free_select_tool_commit (GimpFreeSelectTool *fst,
|
|
|
|
GimpDisplay *display)
|
|
|
|
{
|
2008-08-16 18:07:43 +08:00
|
|
|
GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
|
2008-05-22 03:36:16 +08:00
|
|
|
|
|
|
|
if (priv->n_points >= 3)
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
{
|
|
|
|
gimp_free_select_tool_select (fst, display);
|
|
|
|
}
|
|
|
|
|
2009-10-08 01:00:42 +08:00
|
|
|
gimp_image_flush (gimp_display_get_image (display));
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
}
|
|
|
|
|
2008-05-25 19:48:37 +08:00
|
|
|
static void
|
|
|
|
gimp_free_select_tool_revert_to_saved_state (GimpFreeSelectTool *fst)
|
|
|
|
{
|
2008-08-16 18:07:43 +08:00
|
|
|
GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
|
|
|
|
GimpVector2 *dest;
|
|
|
|
gint n_points;
|
2008-05-25 19:48:37 +08:00
|
|
|
|
2008-05-25 21:44:11 +08:00
|
|
|
/* Without a point grab we have no sensible information to fall back
|
|
|
|
* on, bail out
|
|
|
|
*/
|
|
|
|
if (! gimp_free_select_tool_is_point_grabbed (fst))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-05-25 19:48:37 +08:00
|
|
|
if (priv->grabbed_segment_index > 0)
|
|
|
|
{
|
|
|
|
gimp_free_select_tool_get_segment (fst,
|
2008-05-26 01:37:26 +08:00
|
|
|
&dest,
|
2008-05-25 19:48:37 +08:00
|
|
|
&n_points,
|
|
|
|
priv->grabbed_segment_index - 1,
|
|
|
|
priv->grabbed_segment_index);
|
|
|
|
|
2008-05-26 01:37:26 +08:00
|
|
|
memcpy (dest,
|
2008-05-25 19:48:37 +08:00
|
|
|
priv->saved_points_lower_segment,
|
|
|
|
sizeof (GimpVector2) * n_points);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (priv->grabbed_segment_index < priv->n_segment_indices - 1)
|
|
|
|
{
|
|
|
|
gimp_free_select_tool_get_segment (fst,
|
2008-05-26 01:37:26 +08:00
|
|
|
&dest,
|
2008-05-25 19:48:37 +08:00
|
|
|
&n_points,
|
|
|
|
priv->grabbed_segment_index,
|
|
|
|
priv->grabbed_segment_index + 1);
|
|
|
|
|
2008-05-26 01:37:26 +08:00
|
|
|
memcpy (dest,
|
2008-05-25 19:48:37 +08:00
|
|
|
priv->saved_points_higher_segment,
|
|
|
|
sizeof (GimpVector2) * n_points);
|
|
|
|
}
|
2008-05-26 01:35:52 +08:00
|
|
|
|
|
|
|
if (priv->grabbed_segment_index == 0 &&
|
|
|
|
priv->n_segment_indices == 1)
|
|
|
|
{
|
|
|
|
priv->points[0] = *priv->saved_points_lower_segment;
|
|
|
|
}
|
2008-05-25 19:48:37 +08:00
|
|
|
}
|
|
|
|
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
static void
|
|
|
|
gimp_free_select_tool_handle_click (GimpFreeSelectTool *fst,
|
2008-11-01 23:17:36 +08:00
|
|
|
const GimpCoords *coords,
|
2008-05-25 21:44:11 +08:00
|
|
|
guint32 time,
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
GimpDisplay *display)
|
|
|
|
{
|
2009-10-08 01:00:42 +08:00
|
|
|
GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
|
|
|
|
GimpImage *image = gimp_display_get_image (display);
|
2008-05-25 21:44:11 +08:00
|
|
|
|
2008-05-25 19:25:56 +08:00
|
|
|
/* If there is a floating selection, anchor it */
|
2009-10-08 01:00:42 +08:00
|
|
|
if (gimp_image_get_floating_selection (image))
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
{
|
2009-10-08 01:00:42 +08:00
|
|
|
floating_sel_anchor (gimp_image_get_floating_selection (image));
|
2008-05-25 19:25:56 +08:00
|
|
|
gimp_free_select_tool_halt (fst);
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
}
|
2008-05-25 19:25:56 +08:00
|
|
|
else
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
{
|
2008-05-25 19:25:56 +08:00
|
|
|
/* First finish of the line segment if no point was grabbed */
|
|
|
|
if (! gimp_free_select_tool_is_point_grabbed (fst))
|
|
|
|
{
|
|
|
|
gimp_free_select_tool_finish_line_segment (fst);
|
|
|
|
}
|
|
|
|
|
2008-05-25 21:44:11 +08:00
|
|
|
/* After the segments are up to date and we have handled
|
|
|
|
* double-click, see if it's commiting time
|
|
|
|
*/
|
2008-05-25 19:25:56 +08:00
|
|
|
if (gimp_free_select_tool_should_close (fst,
|
|
|
|
display,
|
2008-05-25 21:44:11 +08:00
|
|
|
time,
|
2008-05-25 19:25:56 +08:00
|
|
|
coords))
|
|
|
|
{
|
2008-05-25 19:48:37 +08:00
|
|
|
/* We can get a click notification even though the end point
|
|
|
|
* has been moved a few pixels. Since a move will change the
|
|
|
|
* free selection, revert it before doing the commit.
|
|
|
|
*/
|
|
|
|
gimp_free_select_tool_revert_to_saved_state (fst);
|
2008-08-16 18:07:43 +08:00
|
|
|
|
2008-05-25 19:25:56 +08:00
|
|
|
gimp_free_select_tool_commit (fst, display);
|
|
|
|
}
|
2008-05-25 21:44:11 +08:00
|
|
|
|
|
|
|
priv->last_click_time = time;
|
|
|
|
priv->last_click_coord = *coords;
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_free_select_tool_handle_normal_release (GimpFreeSelectTool *fst,
|
2008-11-01 23:17:36 +08:00
|
|
|
const GimpCoords *coords,
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
GimpDisplay *display)
|
|
|
|
{
|
|
|
|
/* First finish of the free segment if no point was grabbed */
|
|
|
|
if (! gimp_free_select_tool_is_point_grabbed (fst))
|
|
|
|
{
|
|
|
|
gimp_free_select_tool_finish_free_segment (fst);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* After the segments are up to date, see if it's commiting time */
|
|
|
|
if (gimp_free_select_tool_should_close (fst,
|
|
|
|
display,
|
2008-05-25 21:44:11 +08:00
|
|
|
NO_CLICK_TIME_AVAILABLE,
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
coords))
|
|
|
|
{
|
|
|
|
gimp_free_select_tool_commit (fst, display);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_free_select_tool_handle_cancel (GimpFreeSelectTool *fst)
|
|
|
|
{
|
|
|
|
if (gimp_free_select_tool_is_point_grabbed (fst))
|
|
|
|
{
|
2008-05-22 18:53:20 +08:00
|
|
|
gimp_free_select_tool_revert_to_saved_state (fst);
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-05-22 18:53:20 +08:00
|
|
|
gimp_free_select_tool_remove_last_segment (fst);
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_free_select_tool_select (GimpFreeSelectTool *fst,
|
|
|
|
GimpDisplay *display)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_FREE_SELECT_TOOL (fst));
|
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY (display));
|
|
|
|
|
|
|
|
GIMP_FREE_SELECT_TOOL_GET_CLASS (fst)->select (fst,
|
|
|
|
display);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_free_select_tool_prepare_for_move (GimpFreeSelectTool *fst)
|
|
|
|
{
|
2008-08-16 18:07:43 +08:00
|
|
|
GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
|
|
|
|
GimpVector2 *source;
|
|
|
|
gint n_points;
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
|
2008-05-22 03:36:16 +08:00
|
|
|
if (priv->grabbed_segment_index > 0)
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
{
|
2008-05-23 00:58:21 +08:00
|
|
|
gimp_free_select_tool_get_segment (fst,
|
|
|
|
&source,
|
|
|
|
&n_points,
|
|
|
|
priv->grabbed_segment_index - 1,
|
|
|
|
priv->grabbed_segment_index);
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
|
2008-06-20 20:22:46 +08:00
|
|
|
if (n_points > priv->max_n_saved_points_lower_segment)
|
|
|
|
{
|
|
|
|
priv->max_n_saved_points_lower_segment = n_points;
|
|
|
|
|
|
|
|
priv->saved_points_lower_segment = g_realloc (priv->saved_points_lower_segment,
|
2008-08-16 18:07:43 +08:00
|
|
|
sizeof (GimpVector2) *
|
|
|
|
n_points);
|
2008-06-20 20:22:46 +08:00
|
|
|
}
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
|
2008-05-22 03:36:16 +08:00
|
|
|
memcpy (priv->saved_points_lower_segment,
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
source,
|
|
|
|
sizeof (GimpVector2) * n_points);
|
|
|
|
}
|
|
|
|
|
2008-05-22 03:36:16 +08:00
|
|
|
if (priv->grabbed_segment_index < priv->n_segment_indices - 1)
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
{
|
2008-05-23 00:58:21 +08:00
|
|
|
gimp_free_select_tool_get_segment (fst,
|
|
|
|
&source,
|
|
|
|
&n_points,
|
|
|
|
priv->grabbed_segment_index,
|
|
|
|
priv->grabbed_segment_index + 1);
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
|
2008-06-20 20:22:46 +08:00
|
|
|
if (n_points > priv->max_n_saved_points_higher_segment)
|
|
|
|
{
|
|
|
|
priv->max_n_saved_points_higher_segment = n_points;
|
|
|
|
|
|
|
|
priv->saved_points_higher_segment = g_realloc (priv->saved_points_higher_segment,
|
|
|
|
sizeof (GimpVector2) * n_points);
|
|
|
|
}
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
|
2008-05-22 03:36:16 +08:00
|
|
|
memcpy (priv->saved_points_higher_segment,
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
source,
|
|
|
|
sizeof (GimpVector2) * n_points);
|
|
|
|
}
|
2008-05-26 01:35:52 +08:00
|
|
|
|
|
|
|
/* A special-case when there only is one point */
|
|
|
|
if (priv->grabbed_segment_index == 0 &&
|
|
|
|
priv->n_segment_indices == 1)
|
|
|
|
{
|
2008-06-20 20:22:46 +08:00
|
|
|
if (priv->max_n_saved_points_lower_segment == 0)
|
|
|
|
{
|
|
|
|
priv->max_n_saved_points_lower_segment = 1;
|
2008-08-16 18:07:43 +08:00
|
|
|
|
2008-06-20 20:22:46 +08:00
|
|
|
priv->saved_points_lower_segment = g_new0 (GimpVector2, 1);
|
|
|
|
}
|
|
|
|
|
2008-05-26 01:35:52 +08:00
|
|
|
*priv->saved_points_lower_segment = priv->points[0];
|
|
|
|
}
|
2001-03-10 01:39:18 +08:00
|
|
|
}
|
|
|
|
|
2008-05-25 19:25:56 +08:00
|
|
|
static gboolean
|
|
|
|
gimp_free_select_tool_delegate_button_press (GimpFreeSelectTool *fst,
|
2008-11-01 23:17:36 +08:00
|
|
|
const GimpCoords *coords,
|
2008-05-25 19:25:56 +08:00
|
|
|
GimpDisplay *display)
|
|
|
|
{
|
|
|
|
GimpTool *tool = GIMP_TOOL (fst);
|
|
|
|
gboolean button_press_delegated = FALSE;
|
|
|
|
|
|
|
|
/* Only consider delegating if the tool is not active */
|
|
|
|
if (tool->display == NULL)
|
|
|
|
{
|
|
|
|
tool->display = display;
|
|
|
|
gimp_tool_control_activate (tool->control);
|
|
|
|
|
|
|
|
button_press_delegated =
|
|
|
|
gimp_selection_tool_start_edit (GIMP_SELECTION_TOOL (fst), coords);
|
|
|
|
|
|
|
|
if (! button_press_delegated)
|
|
|
|
{
|
|
|
|
/* Nope, the selection mask edit stuff was not interested, reset
|
|
|
|
* the situation
|
|
|
|
*/
|
|
|
|
gimp_tool_control_halt (tool->control);
|
|
|
|
tool->display = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return button_press_delegated;
|
|
|
|
}
|
|
|
|
|
2008-06-20 20:34:37 +08:00
|
|
|
static void
|
|
|
|
gimp_free_select_tool_update_motion (GimpFreeSelectTool *fst,
|
|
|
|
gdouble new_x,
|
|
|
|
gdouble new_y)
|
|
|
|
{
|
2008-08-16 18:07:43 +08:00
|
|
|
GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
|
2008-06-20 20:34:37 +08:00
|
|
|
|
|
|
|
if (gimp_free_select_tool_is_point_grabbed (fst))
|
|
|
|
{
|
|
|
|
priv->polygon_modified = TRUE;
|
|
|
|
|
2008-06-21 17:39:49 +08:00
|
|
|
if (priv->constrain_angle &&
|
|
|
|
priv->n_segment_indices > 1 )
|
2008-06-20 20:34:37 +08:00
|
|
|
{
|
|
|
|
gdouble start_point_x;
|
|
|
|
gdouble start_point_y;
|
2008-06-21 17:39:49 +08:00
|
|
|
gint segment_index;
|
|
|
|
|
|
|
|
/* Base constraints on the last segment vertex if we move
|
|
|
|
* the first one, otherwise base on the previous segment
|
|
|
|
* vertex
|
|
|
|
*/
|
|
|
|
if (priv->grabbed_segment_index == 0)
|
|
|
|
{
|
|
|
|
segment_index = priv->n_segment_indices - 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
segment_index = priv->grabbed_segment_index - 1;
|
|
|
|
}
|
2008-06-20 20:34:37 +08:00
|
|
|
|
|
|
|
gimp_free_select_tool_get_segment_point (fst,
|
|
|
|
&start_point_x,
|
|
|
|
&start_point_y,
|
2008-06-21 17:39:49 +08:00
|
|
|
segment_index);
|
2008-08-16 18:07:43 +08:00
|
|
|
|
2009-04-23 03:08:42 +08:00
|
|
|
gimp_constrain_line (start_point_x,
|
|
|
|
start_point_y,
|
|
|
|
&new_x,
|
|
|
|
&new_y,
|
|
|
|
GIMP_CONSTRAIN_LINE_15_DEGREES);
|
2008-06-20 20:34:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gimp_free_select_tool_move_segment_vertex_to (fst,
|
|
|
|
priv->grabbed_segment_index,
|
|
|
|
new_x,
|
|
|
|
new_y);
|
|
|
|
|
|
|
|
/* We also must update the pending point if we are moving the
|
|
|
|
* first point
|
|
|
|
*/
|
|
|
|
if (priv->grabbed_segment_index == 0)
|
|
|
|
{
|
|
|
|
priv->pending_point.x = new_x;
|
|
|
|
priv->pending_point.y = new_y;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Don't show the pending point while we are adding points */
|
|
|
|
priv->show_pending_point = FALSE;
|
|
|
|
|
|
|
|
gimp_free_select_tool_add_point (fst,
|
|
|
|
new_x,
|
|
|
|
new_y);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-21 01:06:19 +08:00
|
|
|
static void
|
|
|
|
gimp_free_select_tool_status_update (GimpFreeSelectTool *fst,
|
|
|
|
GimpDisplay *display,
|
2008-11-01 23:17:36 +08:00
|
|
|
const GimpCoords *coords,
|
2008-05-21 01:06:19 +08:00
|
|
|
gboolean proximity)
|
|
|
|
{
|
2008-08-16 18:07:43 +08:00
|
|
|
GimpTool *tool = GIMP_TOOL (fst);
|
|
|
|
GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
|
2008-05-21 01:06:19 +08:00
|
|
|
|
|
|
|
gimp_tool_pop_status (tool, display);
|
|
|
|
|
|
|
|
if (proximity)
|
|
|
|
{
|
|
|
|
const gchar *status_text = NULL;
|
|
|
|
|
|
|
|
if (gimp_free_select_tool_is_point_grabbed (fst))
|
|
|
|
{
|
2008-05-25 21:44:11 +08:00
|
|
|
if (gimp_free_select_tool_should_close (fst,
|
|
|
|
display,
|
|
|
|
NO_CLICK_TIME_AVAILABLE,
|
|
|
|
coords))
|
2008-05-21 01:06:19 +08:00
|
|
|
{
|
|
|
|
status_text = _("Click to complete selection");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
status_text = _("Click-Drag to move segment vertex");
|
|
|
|
}
|
|
|
|
}
|
2008-05-25 19:25:56 +08:00
|
|
|
else if (priv->n_segment_indices >= 3)
|
2008-05-21 01:06:19 +08:00
|
|
|
{
|
|
|
|
status_text = _("Return commits, Escape cancels, Backspace removes last segment");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-05-21 23:39:52 +08:00
|
|
|
status_text = _("Click-Drag adds a free segment, Click adds a polygonal segment");
|
2008-05-21 01:06:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (status_text)
|
|
|
|
{
|
2008-11-04 20:33:09 +08:00
|
|
|
gimp_tool_push_status (tool, display, "%s", status_text);
|
2008-05-21 01:06:19 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-08-01 02:29:10 +08:00
|
|
|
static void
|
|
|
|
gimp_free_select_tool_control (GimpTool *tool,
|
|
|
|
GimpToolAction action,
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpDisplay *display)
|
2005-08-01 02:29:10 +08:00
|
|
|
{
|
|
|
|
switch (action)
|
|
|
|
{
|
2006-05-22 05:12:01 +08:00
|
|
|
case GIMP_TOOL_ACTION_PAUSE:
|
|
|
|
case GIMP_TOOL_ACTION_RESUME:
|
2005-08-01 02:29:10 +08:00
|
|
|
break;
|
|
|
|
|
2006-05-22 05:12:01 +08:00
|
|
|
case GIMP_TOOL_ACTION_HALT:
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
gimp_free_select_tool_halt (GIMP_FREE_SELECT_TOOL (tool));
|
2005-08-01 02:29:10 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2006-03-29 01:55:52 +08:00
|
|
|
GIMP_TOOL_CLASS (parent_class)->control (tool, action, display);
|
2005-08-01 02:29:10 +08:00
|
|
|
}
|
|
|
|
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
static void
|
2008-11-01 23:17:36 +08:00
|
|
|
gimp_free_select_tool_oper_update (GimpTool *tool,
|
|
|
|
const GimpCoords *coords,
|
|
|
|
GdkModifierType state,
|
|
|
|
gboolean proximity,
|
|
|
|
GimpDisplay *display)
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
{
|
2008-08-16 18:07:43 +08:00
|
|
|
GimpFreeSelectTool *fst = GIMP_FREE_SELECT_TOOL (tool);
|
|
|
|
GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
|
|
|
|
gboolean hovering_first_point;
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
|
2008-05-25 22:31:33 +08:00
|
|
|
gimp_free_select_tool_handle_segment_selection (fst,
|
|
|
|
display,
|
|
|
|
coords);
|
2008-05-22 18:53:20 +08:00
|
|
|
hovering_first_point =
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
gimp_free_select_tool_should_close (fst,
|
|
|
|
display,
|
2008-05-25 21:44:11 +08:00
|
|
|
NO_CLICK_TIME_AVAILABLE,
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
coords);
|
|
|
|
|
|
|
|
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
|
|
|
|
|
2008-05-24 05:46:13 +08:00
|
|
|
priv->last_coords.x = coords->x;
|
|
|
|
priv->last_coords.y = coords->y;
|
|
|
|
|
2008-05-22 03:36:16 +08:00
|
|
|
if (priv->n_points == 0 ||
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
(gimp_free_select_tool_is_point_grabbed (fst) &&
|
|
|
|
! hovering_first_point))
|
|
|
|
{
|
2008-05-22 03:36:16 +08:00
|
|
|
priv->show_pending_point = FALSE;
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-05-22 03:36:16 +08:00
|
|
|
priv->show_pending_point = TRUE;
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
|
|
|
|
if (hovering_first_point)
|
|
|
|
{
|
2008-05-22 03:36:16 +08:00
|
|
|
priv->pending_point = priv->points[0];
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-05-22 03:36:16 +08:00
|
|
|
priv->pending_point.x = coords->x;
|
|
|
|
priv->pending_point.y = coords->y;
|
2008-05-23 02:05:10 +08:00
|
|
|
|
|
|
|
if (priv->constrain_angle && priv->n_points > 0)
|
|
|
|
{
|
|
|
|
gdouble start_point_x;
|
|
|
|
gdouble start_point_y;
|
|
|
|
|
|
|
|
gimp_free_select_tool_get_last_point (fst,
|
|
|
|
&start_point_x,
|
|
|
|
&start_point_y);
|
2008-08-16 18:07:43 +08:00
|
|
|
|
2009-04-23 03:08:42 +08:00
|
|
|
gimp_constrain_line (start_point_x, start_point_y,
|
|
|
|
&priv->pending_point.x,
|
|
|
|
&priv->pending_point.y,
|
|
|
|
GIMP_CONSTRAIN_LINE_15_DEGREES);
|
2008-05-23 02:05:10 +08:00
|
|
|
}
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
|
2008-05-21 01:06:19 +08:00
|
|
|
|
2008-05-25 19:25:56 +08:00
|
|
|
if (tool->display == NULL)
|
|
|
|
{
|
|
|
|
GIMP_TOOL_CLASS (parent_class)->oper_update (tool,
|
|
|
|
coords,
|
|
|
|
state,
|
|
|
|
proximity,
|
|
|
|
display);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gimp_free_select_tool_status_update (fst, display, coords, proximity);
|
|
|
|
}
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-11-01 23:17:36 +08:00
|
|
|
gimp_free_select_tool_cursor_update (GimpTool *tool,
|
|
|
|
const GimpCoords *coords,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *display)
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
{
|
|
|
|
GimpFreeSelectTool *fst = GIMP_FREE_SELECT_TOOL (tool);
|
|
|
|
|
2008-05-25 23:08:50 +08:00
|
|
|
if (tool->display == NULL)
|
2008-05-22 13:44:28 +08:00
|
|
|
{
|
|
|
|
GIMP_TOOL_CLASS (parent_class)->cursor_update (tool,
|
|
|
|
coords,
|
|
|
|
state,
|
|
|
|
display);
|
|
|
|
}
|
2008-05-25 23:08:50 +08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
GimpCursorModifier modifier;
|
|
|
|
|
|
|
|
if (gimp_free_select_tool_is_point_grabbed (fst) &&
|
|
|
|
! gimp_free_select_tool_should_close (fst,
|
|
|
|
display,
|
|
|
|
NO_CLICK_TIME_AVAILABLE,
|
|
|
|
coords))
|
|
|
|
{
|
|
|
|
modifier = GIMP_CURSOR_MODIFIER_MOVE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
modifier = GIMP_CURSOR_MODIFIER_NONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
gimp_tool_set_cursor (tool, display,
|
|
|
|
gimp_tool_control_get_cursor (tool->control),
|
|
|
|
gimp_tool_control_get_tool_cursor (tool->control),
|
|
|
|
modifier);
|
|
|
|
}
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
}
|
|
|
|
|
2000-12-31 12:07:42 +08:00
|
|
|
static void
|
2009-06-20 23:37:31 +08:00
|
|
|
gimp_free_select_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
|
|
|
{
|
2008-08-16 18:07:43 +08:00
|
|
|
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
|
|
|
|
GimpFreeSelectTool *fst = GIMP_FREE_SELECT_TOOL (tool);
|
|
|
|
GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2008-05-25 19:25:56 +08:00
|
|
|
/* First of all handle delegation to the selection mask edit logic
|
|
|
|
* if appropriate
|
|
|
|
*/
|
|
|
|
if (gimp_free_select_tool_delegate_button_press (fst,
|
|
|
|
coords,
|
|
|
|
display))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
gimp_draw_tool_pause (draw_tool);
|
2001-11-09 03:14:51 +08:00
|
|
|
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
gimp_free_select_tool_update_button_state (fst, state);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
if (display != tool->display)
|
|
|
|
{
|
|
|
|
gimp_free_select_tool_start (fst,
|
|
|
|
coords,
|
|
|
|
display);
|
|
|
|
}
|
2001-03-10 01:39:18 +08:00
|
|
|
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
if (gimp_free_select_tool_is_point_grabbed (fst))
|
|
|
|
{
|
|
|
|
gimp_free_select_tool_prepare_for_move (fst);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-05-23 02:05:10 +08:00
|
|
|
GimpVector2 point_to_add;
|
|
|
|
|
|
|
|
/* Note that we add the pending point (unless it is the first
|
|
|
|
* point we add) because the pending point is setup correctly
|
|
|
|
* with regards to angle constraints.
|
|
|
|
*/
|
|
|
|
if (priv->n_points > 0)
|
|
|
|
{
|
|
|
|
point_to_add = priv->pending_point;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
point_to_add.x = coords->x;
|
|
|
|
point_to_add.y = coords->y;
|
|
|
|
}
|
|
|
|
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
/* No point was grabbed, add a new point and mark this as a
|
|
|
|
* segment divider. For a line segment, this will be the only
|
|
|
|
* new point. For a free segment, this will be the first point
|
|
|
|
* of the free segment.
|
|
|
|
*/
|
|
|
|
gimp_free_select_tool_add_point (fst,
|
2008-05-23 02:05:10 +08:00
|
|
|
point_to_add.x,
|
|
|
|
point_to_add.y);
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
gimp_free_select_tool_add_segment_index (fst,
|
2008-05-22 03:36:16 +08:00
|
|
|
priv->n_points - 1);
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
gimp_draw_tool_resume (draw_tool);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2000-12-31 12:07:42 +08:00
|
|
|
static void
|
2007-02-28 02:55:12 +08:00
|
|
|
gimp_free_select_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
|
|
|
{
|
2008-08-16 18:07:43 +08:00
|
|
|
GimpFreeSelectTool *fst = GIMP_FREE_SELECT_TOOL (tool);
|
|
|
|
GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
|
2001-11-20 21:53:21 +08:00
|
|
|
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
if (tool->display != display)
|
|
|
|
return;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
gimp_draw_tool_pause (GIMP_DRAW_TOOL (fst));
|
|
|
|
|
|
|
|
gimp_free_select_tool_update_button_state (fst, state);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2007-03-10 23:07:56 +08:00
|
|
|
switch (release_type)
|
2005-07-29 08:16:45 +08:00
|
|
|
{
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
case GIMP_BUTTON_RELEASE_CLICK:
|
|
|
|
case GIMP_BUTTON_RELEASE_NO_MOTION:
|
|
|
|
/* If a click was made, we don't consider the polygon modified */
|
2008-05-22 03:36:16 +08:00
|
|
|
priv->polygon_modified = FALSE;
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
|
|
|
|
gimp_free_select_tool_handle_click (fst,
|
|
|
|
coords,
|
2008-05-25 21:44:11 +08:00
|
|
|
time,
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
display);
|
2007-03-10 23:07:56 +08:00
|
|
|
break;
|
|
|
|
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
case GIMP_BUTTON_RELEASE_NORMAL:
|
|
|
|
gimp_free_select_tool_handle_normal_release (fst,
|
|
|
|
coords,
|
|
|
|
display);
|
2007-03-10 23:07:56 +08:00
|
|
|
break;
|
2008-05-22 18:53:20 +08:00
|
|
|
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
case GIMP_BUTTON_RELEASE_CANCEL:
|
|
|
|
gimp_free_select_tool_handle_cancel (fst);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2005-07-29 08:16:45 +08:00
|
|
|
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
/* Reset */
|
2008-05-22 03:36:16 +08:00
|
|
|
priv->polygon_modified = FALSE;
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
|
|
|
|
gimp_draw_tool_resume (GIMP_DRAW_TOOL (fst));
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2000-12-31 12:07:42 +08:00
|
|
|
static void
|
2008-11-01 23:17:36 +08:00
|
|
|
gimp_free_select_tool_motion (GimpTool *tool,
|
|
|
|
const GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *display)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2008-08-16 18:07:43 +08:00
|
|
|
GimpFreeSelectTool *fst = GIMP_FREE_SELECT_TOOL (tool);
|
|
|
|
GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
|
|
|
|
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
|
|
|
|
if (tool->display != display)
|
|
|
|
return;
|
|
|
|
|
|
|
|
gimp_draw_tool_pause (draw_tool);
|
|
|
|
|
2008-06-20 20:34:37 +08:00
|
|
|
priv->last_coords.x = coords->x;
|
|
|
|
priv->last_coords.y = coords->y;
|
2000-07-30 00:12:40 +08:00
|
|
|
|
2008-06-20 20:34:37 +08:00
|
|
|
gimp_free_select_tool_update_motion (fst,
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
coords->x,
|
|
|
|
coords->y);
|
2000-07-30 00:12:40 +08:00
|
|
|
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
gimp_draw_tool_resume (draw_tool);
|
|
|
|
}
|
2001-11-09 03:14:51 +08:00
|
|
|
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
static gboolean
|
|
|
|
gimp_free_select_tool_key_press (GimpTool *tool,
|
|
|
|
GdkEventKey *kevent,
|
|
|
|
GimpDisplay *display)
|
|
|
|
{
|
|
|
|
GimpFreeSelectTool *fst = GIMP_FREE_SELECT_TOOL (tool);
|
2003-05-27 19:52:03 +08:00
|
|
|
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
switch (kevent->keyval)
|
2003-05-27 19:52:03 +08:00
|
|
|
{
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
case GDK_BackSpace:
|
|
|
|
gimp_free_select_tool_remove_last_segment (fst);
|
|
|
|
return TRUE;
|
2003-05-27 19:52:03 +08:00
|
|
|
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
case GDK_Return:
|
|
|
|
case GDK_KP_Enter:
|
|
|
|
case GDK_ISO_Enter:
|
|
|
|
gimp_free_select_tool_commit (fst, display);
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
case GDK_Escape:
|
|
|
|
gimp_free_select_tool_halt (fst);
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
2003-05-27 19:52:03 +08:00
|
|
|
}
|
|
|
|
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
return FALSE;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2008-05-23 02:05:10 +08:00
|
|
|
static void
|
|
|
|
gimp_free_select_tool_modifier_key (GimpTool *tool,
|
|
|
|
GdkModifierType key,
|
|
|
|
gboolean press,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *display)
|
|
|
|
{
|
2008-08-16 18:07:43 +08:00
|
|
|
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
|
|
|
|
GimpFreeSelectToolPrivate *priv = GET_PRIVATE (tool);
|
2008-05-25 22:31:33 +08:00
|
|
|
|
2008-06-24 02:41:53 +08:00
|
|
|
if (tool->display == display)
|
|
|
|
{
|
|
|
|
gimp_draw_tool_pause (draw_tool);
|
2008-05-23 02:05:10 +08:00
|
|
|
|
2008-06-24 02:41:53 +08:00
|
|
|
priv->constrain_angle = state & GDK_CONTROL_MASK ? TRUE : FALSE;
|
2008-05-23 02:05:10 +08:00
|
|
|
|
2008-06-24 02:41:53 +08:00
|
|
|
priv->supress_handles = state & GDK_SHIFT_MASK ? TRUE : FALSE;
|
2008-05-25 22:31:33 +08:00
|
|
|
|
2008-06-24 02:41:53 +08:00
|
|
|
gimp_draw_tool_resume (draw_tool);
|
|
|
|
}
|
2008-05-25 22:31:33 +08:00
|
|
|
|
2008-05-23 02:05:10 +08:00
|
|
|
GIMP_TOOL_CLASS (parent_class)->modifier_key (tool,
|
|
|
|
key,
|
|
|
|
press,
|
|
|
|
state,
|
|
|
|
display);
|
|
|
|
}
|
|
|
|
|
2008-06-20 20:34:37 +08:00
|
|
|
static void
|
|
|
|
gimp_free_select_tool_active_modifier_key (GimpTool *tool,
|
|
|
|
GdkModifierType key,
|
|
|
|
gboolean press,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *display)
|
|
|
|
{
|
2008-08-16 18:07:43 +08:00
|
|
|
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
|
|
|
|
GimpFreeSelectToolPrivate *priv = GET_PRIVATE (tool);
|
2008-06-20 20:34:37 +08:00
|
|
|
|
|
|
|
if (tool->display != display)
|
|
|
|
return;
|
|
|
|
|
|
|
|
gimp_draw_tool_pause (draw_tool);
|
|
|
|
|
|
|
|
priv->constrain_angle = state & GDK_CONTROL_MASK ? TRUE : FALSE;
|
|
|
|
|
|
|
|
/* If we didn't came here due to a mouse release, immediately update
|
|
|
|
* the position of the thing we move.
|
|
|
|
*/
|
|
|
|
if (state & GDK_BUTTON1_MASK)
|
|
|
|
{
|
|
|
|
gimp_free_select_tool_update_motion (GIMP_FREE_SELECT_TOOL (tool),
|
|
|
|
priv->last_coords.x,
|
|
|
|
priv->last_coords.y);
|
|
|
|
}
|
|
|
|
|
|
|
|
gimp_draw_tool_resume (draw_tool);
|
|
|
|
|
|
|
|
GIMP_TOOL_CLASS (parent_class)->active_modifier_key (tool,
|
|
|
|
key,
|
|
|
|
press,
|
|
|
|
state,
|
|
|
|
display);
|
|
|
|
}
|
|
|
|
|
2009-12-22 05:24:26 +08:00
|
|
|
/**
|
|
|
|
* gimp_free_select_tool_draw:
|
|
|
|
* @draw_tool:
|
|
|
|
*
|
|
|
|
* Draw the line segments and handles around segment vertices, the
|
|
|
|
* latter if the they are in proximity to cursor.
|
|
|
|
**/
|
1997-11-25 06:05:25 +08:00
|
|
|
static void
|
2001-03-10 01:39:18 +08:00
|
|
|
gimp_free_select_tool_draw (GimpDrawTool *draw_tool)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2009-12-22 05:24:26 +08:00
|
|
|
GimpFreeSelectTool *fst = GIMP_FREE_SELECT_TOOL (draw_tool);
|
|
|
|
GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
|
|
|
|
GimpTool *tool = GIMP_TOOL (draw_tool);
|
|
|
|
gboolean hovering_first_point = FALSE;
|
|
|
|
gboolean handles_wants_to_show = FALSE;
|
|
|
|
GimpCoords coords = { priv->last_coords.x,
|
|
|
|
priv->last_coords.y,
|
|
|
|
/* pad with 0 */ };
|
2008-05-24 05:46:13 +08:00
|
|
|
if (! tool->display)
|
|
|
|
return;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2009-12-22 05:24:26 +08:00
|
|
|
hovering_first_point =
|
|
|
|
gimp_free_select_tool_should_close (fst,
|
|
|
|
tool->display,
|
|
|
|
NO_CLICK_TIME_AVAILABLE,
|
|
|
|
&coords);
|
2006-08-09 07:25:44 +08:00
|
|
|
gimp_draw_tool_draw_lines (draw_tool,
|
2008-05-22 03:36:16 +08:00
|
|
|
priv->points, priv->n_points,
|
2006-08-09 07:25:44 +08:00
|
|
|
FALSE, FALSE);
|
2005-12-13 17:13:50 +08:00
|
|
|
|
2009-12-22 05:24:26 +08:00
|
|
|
/* We always show the handle for the first point, even with button1
|
|
|
|
* down, since releasing the button on the first point will close
|
|
|
|
* the polygon, so it's a significant state which we must give
|
|
|
|
* feedback for
|
|
|
|
*/
|
|
|
|
handles_wants_to_show = (hovering_first_point ||
|
|
|
|
! priv->button1_down);
|
|
|
|
|
|
|
|
if (handles_wants_to_show &&
|
2008-05-25 22:31:33 +08:00
|
|
|
! priv->supress_handles)
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
{
|
2009-12-22 05:24:26 +08:00
|
|
|
gint i = 0;
|
|
|
|
gint n = 0;
|
2005-12-13 17:13:50 +08:00
|
|
|
|
2009-12-22 05:24:26 +08:00
|
|
|
/* If the first point is hovered while button1 is held down,
|
|
|
|
* only draw the first handle, the other handles are not
|
|
|
|
* relevant (see comment a few lines up)
|
|
|
|
*/
|
|
|
|
if (priv->button1_down && hovering_first_point)
|
|
|
|
n = MIN (priv->n_segment_indices, 1);
|
|
|
|
else
|
|
|
|
n = priv->n_segment_indices;
|
|
|
|
|
|
|
|
for (i = 0; i < n; i++)
|
2008-05-24 05:46:13 +08:00
|
|
|
{
|
2009-12-22 04:27:54 +08:00
|
|
|
GimpVector2 *point = NULL;
|
|
|
|
gdouble dist = 0.0;
|
|
|
|
GimpHandleType handle_type = -1;
|
2008-05-24 05:46:13 +08:00
|
|
|
|
|
|
|
point = &priv->points[priv->segment_indices[i]];
|
2005-12-13 17:13:50 +08:00
|
|
|
|
2008-05-24 05:46:13 +08:00
|
|
|
dist = gimp_draw_tool_calc_distance_square (draw_tool,
|
|
|
|
tool->display,
|
|
|
|
priv->last_coords.x,
|
|
|
|
priv->last_coords.y,
|
|
|
|
point->x,
|
|
|
|
point->y);
|
|
|
|
|
2009-12-22 04:27:54 +08:00
|
|
|
/* If the cursor is over the point, fill, if it's just
|
|
|
|
* close, draw an outline
|
|
|
|
*/
|
|
|
|
if (dist < POINT_GRAB_THRESHOLD_SQ)
|
|
|
|
handle_type = GIMP_HANDLE_FILLED_CIRCLE;
|
|
|
|
else if (dist < POINT_SHOW_THRESHOLD_SQ)
|
|
|
|
handle_type = GIMP_HANDLE_CIRCLE;
|
|
|
|
|
|
|
|
if (handle_type != -1)
|
|
|
|
gimp_draw_tool_draw_handle (draw_tool, handle_type,
|
|
|
|
point->x,
|
|
|
|
point->y,
|
|
|
|
HANDLE_SIZE, HANDLE_SIZE,
|
|
|
|
GTK_ANCHOR_CENTER, FALSE);
|
2008-05-24 05:46:13 +08:00
|
|
|
}
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
}
|
2005-12-13 17:13:50 +08:00
|
|
|
|
2008-05-22 03:36:16 +08:00
|
|
|
if (priv->show_pending_point)
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
{
|
2008-05-22 03:36:16 +08:00
|
|
|
GimpVector2 last = priv->points[priv->n_points - 1];
|
2005-12-13 17:13:50 +08:00
|
|
|
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
gimp_draw_tool_draw_line (draw_tool,
|
|
|
|
last.x,
|
|
|
|
last.y,
|
2008-05-22 03:36:16 +08:00
|
|
|
priv->pending_point.x,
|
|
|
|
priv->pending_point.y,
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
FALSE);
|
|
|
|
}
|
|
|
|
}
|
2005-12-13 17:13:50 +08:00
|
|
|
|
2005-07-29 09:48:56 +08:00
|
|
|
static void
|
Merged the Polygon Select Tool capabilities with the Free Select Tool.
2008-05-18 Martin Nordholts <martinn@svn.gnome.org>
Merged the Polygon Select Tool capabilities with the Free Select
Tool. Among the things still to do is improved help texts, more
suitable graphics, and cursor mangement, but the core
functionality is in place. Thanks to Alexia Death for initial
testing. It will also be neccesary to do some work to adapt the
Foreground Select Tool to the new Free Select Tool implementation.
Quick instructions on how the tool works:
o A click adds a polygonal segment, a drag adds a free-hand
segment
o Return-key commits, Escape-key cancels, Backspace-key removes
last segment
o You can grab and move segment vertices
o You can cancel both a move, and the creation of a segment
* app/tools/gimpfreeselecttool.[ch]: More or less
reimplemented. We keep a sequential array of all the points in the
polygon (including the free segments), and we have another array
with point indices that we use to represent the segments. On top
of this we have a few helper functions that tries to abstract away
the pretty raw nature of the implementation.
* app/tools/gimpforegroundselecttool.[ch]: Keep track on its own
last_coord, and adjust to the new implementation of the Free
Select Tool. Still needs some work, for example handling that the
Free Select Tool now resets GimpTool::display.
(gimp_foreground_select_tool_key_press): Pass on key event to
parent class when appropriate. (Bails out too early though...)
svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
|
|
|
gimp_free_select_tool_real_select (GimpFreeSelectTool *fst,
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpDisplay *display)
|
2005-07-29 09:48:56 +08:00
|
|
|
{
|
2008-08-16 18:07:43 +08:00
|
|
|
GimpSelectionOptions *options = GIMP_SELECTION_TOOL_GET_OPTIONS (fst);
|
|
|
|
GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
|
2009-10-08 01:00:42 +08:00
|
|
|
GimpImage *image = gimp_display_get_image (display);
|
2005-07-29 09:48:56 +08:00
|
|
|
|
2009-10-08 01:00:42 +08:00
|
|
|
gimp_channel_select_polygon (gimp_image_get_mask (image),
|
2008-05-23 22:09:55 +08:00
|
|
|
C_("command", "Free Select"),
|
2008-05-22 03:36:16 +08:00
|
|
|
priv->n_points,
|
|
|
|
priv->points,
|
2008-05-22 23:40:18 +08:00
|
|
|
priv->operation_at_start,
|
2005-07-29 09:48:56 +08:00
|
|
|
options->antialias,
|
|
|
|
options->feather,
|
|
|
|
options->feather_radius,
|
2006-08-26 01:19:36 +08:00
|
|
|
options->feather_radius,
|
|
|
|
TRUE);
|
2008-05-22 02:23:23 +08:00
|
|
|
|
|
|
|
gimp_free_select_tool_halt (fst);
|
2005-07-29 09:48:56 +08:00
|
|
|
}
|
|
|
|
|
2008-05-22 03:36:16 +08:00
|
|
|
void
|
2008-05-23 00:58:21 +08:00
|
|
|
gimp_free_select_tool_get_points (GimpFreeSelectTool *fst,
|
|
|
|
const GimpVector2 **points,
|
|
|
|
gint *n_points)
|
2008-05-22 03:36:16 +08:00
|
|
|
{
|
2008-08-16 18:07:43 +08:00
|
|
|
GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
|
2008-05-22 03:36:16 +08:00
|
|
|
|
|
|
|
g_return_if_fail (points != NULL && n_points != NULL);
|
|
|
|
|
|
|
|
*points = priv->points;
|
|
|
|
*n_points = priv->n_points;
|
|
|
|
}
|