gimp/app/tools/gimpfreeselecttool.c

1099 lines
34 KiB
C
Raw Normal View History

/* 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
*
1997-11-25 06:05:25 +08:00
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1997-11-25 06:05:25 +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>
app/Makefile.am app/channel_pvt.h app/drawable_pvt.h app/gdisplayF.h 2000-12-29 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/channel_pvt.h * app/drawable_pvt.h * app/gdisplayF.h * app/gimpdrawableP.h * app/gimpimageP.h * app/layer_pvt.h * app/toolsF.h: removed these files. * app/apptypes.h * tools/pdbgen/enums.pl: added tons of opaque typedefs and enums. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/display.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/fileops.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/help.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/tools.pdb * app/*: chainsaw #include cleanup: - Never (never!!) include stuff in header files except where we need access to structures' contents (like derived objects). - Added prototypes and proper formating in many files. - The #include order in *all* *.c files is as follows: #include "config.h" #include <system stuff> #include <gtk/gtk.h> #include "apptypes.h" #include "gimp stuff" #include "libgimp stuff" #include "libgimp/gimpintl.h" By following this scheme we can easily see a file's dependencies from it's #include's and can grep for the inclusion to find out where a file is used. * tools/pdbgen/app.pl: changed to follow the include scheme above. * libgimp/Makefile.am * libgimp/gimpuitypes.h: new file, included from libgimp/gimpui.h and from app/apptypes.h. * libgimp/gimpcolorbutton.[ch] * libgimp/gimpdialog.[ch] * libgimp/gimphelpui.[ch] * libgimp/gimpparasite.[ch] * libgimp/gimppatheditor.[ch] * libgimp/gimpprotocol.c * libgimp/gimpquerybox.[ch] * libgimp/gimpsizeentry.[ch] * libgimp/gimptypes.h * libgimp/gimpui.h * libgimp/gimpunit.h * libgimp/gimpunitmenu.[ch] * libgimp/gimpwidgets.[ch]: changed accordingly. * plug-ins/FractalExplorer/Dialogs.c * plug-ins/gdyntext/message_window.c * plug-ins/imagemap/imap_default_dialog.c * plug-ins/imagemap/imap_file.c: these files used to include "libgimp/gimpui.h" without including "libgimp/gimp.h". This is no longer possible because the libgimpui headers don't inlcude "libgimp/gimpunit.h" any more.
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>
#include "libgimpmath/gimpmath.h"
2001-08-06 00:08:19 +08:00
#include "libgimpwidgets/gimpwidgets.h"
#include "tools-types.h"
#include "core/gimpchannel.h"
Treat changes to the selection like changes to any other drawable: 2003-10-06 Michael Natterer <mitch@gimp.org> Treat changes to the selection like changes to any other drawable: * app/core/gimpchannel.c * app/core/gimpchannel-combine.c: call gimp_drawable_update() after changing the channel. * app/core/gimpimage.[ch]: added struct GimpImageFlushAccumulator with one member "gboolean mask_changed". Connect to "update" of the selection and set accum.mask_changed to TRUE in the callback. Added default implementation for GimpImage::flush() and emit "mask_changed" there. Unrelated: * app/core/gimpimage.h: removed GimpGuide struct... * app/core/gimpimage-guides.h: ...and added it here. * app/core/gimpimage-undo-push.c (undo_pop_mask) (undo_pop_channel_mod): don't distinguish between selection and non-selection channels and just call gimp_drawable_update(). * app/core/gimpundo.h * app/core/gimpimage-undo.c: removed "gboolean mask_changed" from the GimpUndoAccumulator struct since we don't have to care about that signal explicitly any more. * app/display/gimpdisplay-foreach.[ch]: removed gimp_displays_flush(). * tools/pdbgen/pdb/display.pdb (displays_flush_invoker): call gimp_image_flush() on all images so the flush accumulator is honored. This generalization enables the removal of more special purpose code which was needed to treat the selection different: * app/core/gimpimage-mask-select.[ch]: removed... * app/core/gimpchannel-select.[ch]: ...and added under a new name because it's not selection specific any more. * app/core/gimpimage-mask.[ch]: removed... * app/core/gimpselection.[ch]: ...added the two remaining functions here. Removed all calls to gimp_image_mask_changed(). * app/core/Makefile.am * app/core/gimp-edit.c * app/core/gimpdrawable-transform.c * app/core/gimpimage-scale.c * app/core/gimpimage-snap.c * app/display/gimpdisplayshell.c * app/gui/channels-commands.c * app/gui/layers-commands.c * app/gui/select-commands.c * app/gui/vectors-commands.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpellipseselecttool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimprectselecttool.c * app/tools/gimptransformtool.c * app/widgets/gimpchanneltreeview.c * app/widgets/gimpselectioneditor.c * app/widgets/gimpvectorstreeview.c * app/xcf/xcf-save.c * tools/pdbgen/pdb/paths.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/selection_tools.pdb: changed accordingly. * app/core/gimpdrawable-bucket-fill.c * app/core/gimpimage-colormap.c * app/core/gimplayer-floating-sel.c * app/core/gimplayer.c * app/gui/image-menu.c * app/paint/gimppaintcore.c * app/tools/gimpcroptool.c * app/tools/gimpinkoptions.c * app/tools/gimpvectortool.c: removed useless and/or obsolete #includes. * app/pdb/display_cmds.c * app/pdb/paths_cmds.c * app/pdb/selection_cmds.c * app/pdb/selection_tools_cmds.c: regenerated.
2003-10-06 20:17:11 +08:00
#include "core/gimpchannel-select.h"
#include "core/gimpimage.h"
#include "core/gimplayer-floating-sel.h"
Makefile.am configure.in added the new library below. 2001-01-24 Michael Natterer <mitch@gimp.org> * Makefile.am * configure.in * gimptool.in: added the new library below. * libgimpwidgets/Makefile.am * libgimpwidgets/gimpchainbutton.[ch] * libgimpwidgets/gimpcolorarea.[ch] * libgimpwidgets/gimpcolorbutton.[ch] * libgimpwidgets/gimpdialog.[ch] * libgimpwidgets/gimpfileselection.[ch] * libgimpwidgets/gimphelpui.[ch] * libgimpwidgets/gimppatheditor.[ch] * libgimpwidgets/gimppixmap.[ch] * libgimpwidgets/gimpquerybox.[ch] * libgimpwidgets/gimpsizeentry.[ch] * libgimpwidgets/gimpunitmenu.[ch] * libgimpwidgets/gimpwidgets.[ch] * libgimpwidgets/gimpwidgets.def * libgimpwidgets/gimpwidgetstypes.h: new shared library. Currently there are some ugly dependencies into libgimp. These will be removed and go to a "libgimpglue" library which will be a library for functions which share a common interface between plug-ins and the app but have different implementations. Include "libgimp/gimpunit.h" from "libgimpwidgets/gimpwidgetstypes.h" to simulate this upcoming separation. * libgimp/Makefile.am * libgimp/gimpchainbutton.[ch] * libgimp/gimpcolorarea.[ch] * libgimp/gimpcolorbutton.[ch] * libgimp/gimpdialog.[ch] * libgimp/gimpfileselection.[ch] * libgimp/gimphelpui.[ch] * libgimp/gimppatheditor.[ch] * libgimp/gimppixmap.[ch] * libgimp/gimpquerybox.[ch] * libgimp/gimpsizeentry.[ch] * libgimp/gimpunitmenu.[ch] * libgimp/gimpwidgets.[ch]: removed from here. * libgimp/gimpui.h * libgimp/gimpuitypes.h * libgimp/makefile.mingw.in * libgimp/makefile.msc: changed accordingly. * app/[all ui files] * app/pdb/palette_cmds.c * app/pdb/tools_cmds.c * tools/pdbgen/pdb/palette.pdb * tools/pdbgen/pdb/tools.pdb: #include "libgimpwidgets/gimpwidgets.h" and removed useless includes. * app/apptypes.h: #include "libgimpwidgets/gimpwidgetstypes.h" * app/Makefile.am * plug-ins/[all makefiles which link against libgimpui]: link against libgimpwidgets.la * po-libgimp/POTFILES.in: changed file locations.
2001-01-25 06:36:18 +08:00
#include "widgets/gimphelp-ids.h"
#include "display/gimpdisplay.h"
#include "gimpfreeselecttool.h"
#include "gimpselectionoptions.h"
#include "gimptoolcontrol.h"
#include "gimp-intl.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
#define HANDLE_SIZE 10
#define POINT_GRAB_THRESHOLD_SQ SQR(HANDLE_SIZE / 2)
#define N_ITEMS_PER_ALLOC 1024
#define INVALID_INDEX (-1)
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,
GimpCoords *coords,
GdkModifierType state,
gboolean proximity,
GimpDisplay *display);
static void gimp_free_select_tool_cursor_update (GimpTool *tool,
GimpCoords *coords,
GdkModifierType state,
GimpDisplay *display);
static void gimp_free_select_tool_button_press (GimpTool *tool,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *display);
static void gimp_free_select_tool_button_release (GimpTool *tool,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpButtonReleaseType release_type,
GimpDisplay *display);
static void gimp_free_select_tool_motion (GimpTool *tool,
GimpCoords *coords,
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_draw (GimpDrawTool *draw_tool);
static void gimp_free_select_tool_real_select (GimpFreeSelectTool *fst,
GimpDisplay *display);
1997-11-25 06:05:25 +08:00
G_DEFINE_TYPE (GimpFreeSelectTool, gimp_free_select_tool,
GIMP_TYPE_SELECTION_TOOL);
app/airbrush.c app/bezier_select.c app/blend.c app/brightness_contrast.c 1999-04-12 Michael Natterer <mitschel@cs.tu-berlin.de> * app/airbrush.c * app/bezier_select.c * app/blend.c * app/brightness_contrast.c * app/bucket_fill.c * app/by_color_select.c * app/clone.c * app/color_balance.c * app/color_picker.c * app/convolve.c * app/crop.c * app/curves.c * app/ellipse_select.c * app/eraser.c * app/flip_tool.c * app/free_select.c * app/fuzzy_select.c * app/histogram_tool.c * app/hue_saturation.c * app/ink.c * app/iscissors.c * app/levels.c * app/magnify.c * app/move.c * app/paintbrush.c * app/pencil.c * app/posterize.c * app/rect_select.[ch] * app/text_tool.c * app/threshold.c * app/transform_tool.c * app/tools.[ch] * app/toolsF.h: again: all tools :( * app/Makefile.am * app/tool_options.[ch] * app/selection_options.h * app/tool_options_ui.h: new files. Ok, this time it's general enough for future extensions: - The tool options structures are organized like the gtk object system to allow derived tool options. - Renamed all create and reset functions to *_options_new() and *_options_reset() to reflect this. - Changed tools_register() again. Now it takes just a pointer to a ToolOptions structure. - Moved almost the entire tool options gui code to tool_options.c. - Visually separated the common selection options from the tool-specific ones. I'd like to do the same with opacity/paint mode in all paint tool options but I think this needs some more discussion. * app/histogram_tool.c: changed packing boxes, label alignments. * app/paintbrush.c: some more sensitive settings. The gradient feature can now be toggled with a button. Hopefully didn't break anything.
1999-04-13 01:55:06 +08:00
#define parent_class gimp_free_select_tool_parent_class
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
static const GimpVector2 vector2_zero = { 0.0, 0.0 };
void
2002-03-29 11:50:29 +08:00
gimp_free_select_tool_register (GimpToolRegisterCallback callback,
app/tools/gimpairbrushtool.[ch] app/tools/gimpbezierselecttool.[ch] 2002-05-03 Sven Neumann <sven@gimp.org> * app/tools/gimpairbrushtool.[ch] * app/tools/gimpbezierselecttool.[ch] * app/tools/gimpblendtool.[ch] * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpbucketfilltool[.ch] * app/tools/gimpbycolorselecttool[.ch] * app/tools/gimpclonetool[.ch] * app/tools/gimpcolorbalancetool[.ch] * app/tools/gimpcolorpickertool[.ch] * app/tools/gimpconvolvetool[.ch] * app/tools/gimpcroptool[.ch] * app/tools/gimpcurvestool[.ch] * app/tools/gimpdodgeburntool[.ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpellipseselecttool[.ch] * app/tools/gimperasertool[.ch] * app/tools/gimpfliptool[.ch] * app/tools/gimpfreeselecttool[.ch] * app/tools/gimpfuzzyselecttool[.ch] * app/tools/gimphistogramtool[.ch] * app/tools/gimphuesaturationtool[.ch] * app/tools/gimpinktool[.ch] * app/tools/gimpiscissorstool[.ch] * app/tools/gimplevelstool[.ch] * app/tools/gimpmagnifytool[.ch] * app/tools/gimpmeasuretool[.ch] * app/tools/gimpmovetool[.ch] * app/tools/gimppaintbrushtool[.ch] * app/tools/gimppainttool.c * app/tools/gimppathtool[.ch] * app/tools/gimppenciltool[.ch] * app/tools/gimpperspectivetool[.ch] * app/tools/gimpposterizetool[.ch] * app/tools/gimprectselecttool[.ch] * app/tools/gimprotatetool[.ch] * app/tools/gimpscaletool[.ch] * app/tools/gimpselectiontool.c * app/tools/gimpsheartool[.ch] * app/tools/gimpsmudgetool[.ch] * app/tools/gimptexttool[.ch] * app/tools/gimpthresholdtool[.ch] * app/tools/gimptool.c * app/tools/gimptoolcontrol.h * app/tools/gimptoolmodule[.ch] * app/tools/gimptransformtool.c * app/tools/gimpvectortool[.ch] * app/tools/path_tool.c * app/tools/tool_manager[.ch] * app/tools/tools.c * libgimptool/gimptool.c * libgimptool/gimptoolcontrol.h * libgimptool/gimptoolmodule.h: removed tons of warnings. Do we need to add -Werror to the CFLAGS to avoid such a mess in the future ?! Also had to enforce the GIMP coding style in lots of places :-( * libgimp/gimppixelrgn.c: got sick and tired of debugging plug-ins, so I've added checks for most parameters passed to the GimpPixelRgn functions. This will slow down plug-in execution a little bit but should help to find bugs early.
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,
Made GimpToolOptions a GimpContext subclass and objectified all tool 2003-02-05 Michael Natterer <mitch@gimp.org> Made GimpToolOptions a GimpContext subclass and objectified all tool options types. * app/core/core-types.h: replaced GimpToolOptionsNewFunc by GimpToolOptionsGUIFunc. * libgimpproxy/gimpproxytypes.h: regenerated. * app/core/gimppaintinfo.[ch]: added "GType paint_options_type". * app/core/gimptoolinfo.[ch]: added "GType tool_options_type", removed tool_info->context since GimpToolOptions are a GimpContext now. Added "gboolean use_context" as a temp_hack. * libgimptool/gimptooltypes.h: added the tool_options_type to the tool registering callback. * app/tools/tool_options.[ch]: is a real GimpContext subclass now. * app/paint/paint-types.h * app/paint/paint.c: added the paint_options_type to the paint registering stuff. * app/paint/gimppaintoptions.[ch]: is a real GimpToolOptions subclass now. * app/paint/Makefile.am * app/paint/gimpairbrushoptions.[ch] * app/paint/gimpcloneoptions.[ch] * app/paint/gimpconvolveoptions.[ch] * app/paint/gimpdodgeburnoptions.[ch] * app/paint/gimperaseroptions.[ch] * app/paint/gimpsmudgeoptions.[ch]: new files holding GimpPaintOptions subclasses. * app/paint/gimpairbrush.[ch] * app/paint/gimpclone.[ch] * app/paint/gimpconvolve.[ch] * app/paint/gimpdodgeburn.[ch] * app/paint/gimperaser.[ch] * app/paint/gimppaintbrush.c * app/paint/gimppaintcore.c * app/paint/gimppencil.[ch] * app/paint/gimpsmudge.[ch]: removed paint options stuff, lots of related changed & cleanups. * tools/pdbgen/pdb/paint_tools.pdb: changed accordingly. * app/pdb/paint_tools_cmds.c: regenerated. * app/tools/Makefile.am * app/tools/gimpblendoptions.[ch] * app/tools/gimpbucketfilloptions.[ch] * app/tools/gimpcolorpickeroptions.[ch] * app/tools/gimpcropoptions.[ch] * app/tools/gimpflipoptions.[ch] * app/tools/gimpinkoptions.[ch] * app/tools/gimpmagnifyoptions.[ch] * app/tools/gimpmeasureoptions.[ch] * app/tools/gimpmoveoptions.[ch] * app/tools/gimptextoptions.[ch] * app/tools/gimpvectoroptions.[ch]: new files holding the various tool options classes. * app/tools/selection_options.[ch] * app/tools/transform_options.[ch]: made them objects. * app/tools/paint_options.[ch]: contains only the paint_options GUI and reset stuff. * app/tools/tools-types.h: removed SelectionOptions typedef for now. * app/tools/[all tools]: removed the tool options stuff except some GUI constructors. Tons of related changes. * app/tools/tool_manager.[ch]: changed tool registration / restore / switching accordingly. * app/widgets/gimpdrawablelistview.c * app/widgets/gimpselectioneditor.c: changed accordingly.
2003-02-05 22:39:40 +08:00
GIMP_TYPE_SELECTION_OPTIONS,
gimp_selection_options_gui,
0,
./mitch --sanitize-identifier-namespace 2002-03-20 Michael Natterer <mitch@gimp.org> ./mitch --sanitize-identifier-namespace * app/core/gimpcontext.c * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-dnd.c * app/gui/dialogs-commands.c * app/gui/dialogs-constructors.c * app/gui/dialogs.c * app/gui/edit-commands.c * app/gui/gui.c * app/gui/menus.c * app/gui/vectors-commands.c * app/gui/view-commands.c * app/tools/gimpairbrushtool.c * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpclonetool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpconvolvetool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimpdodgeburntool.c * app/tools/gimpellipseselecttool.c * app/tools/gimperasertool.c * app/tools/gimpfliptool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimphistogramtool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpinktool.c * app/tools/gimpiscissorstool.c * app/tools/gimplevelstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.c * app/tools/gimpmovetool.c * app/tools/gimppaintbrushtool.c * app/tools/gimppathtool.c * app/tools/gimppenciltool.c * app/tools/gimpperspectivetool.c * app/tools/gimpposterizetool.c * app/tools/gimprectselecttool.c * app/tools/gimprotatetool.c * app/tools/gimpscaletool.c * app/tools/gimpsheartool.c * app/tools/gimpsmudgetool.c * app/tools/gimptexttool.c * app/tools/gimpthresholdtool.c * app/tools/gimpvectortool.c * app/widgets/gimpdnd.c * app/widgets/gimptoolbox-indicator-area.c * app/widgets/gimptoolbox.c: s/gimp:/gimp-/g and s/_/-/g for all identifier strings (e.g. gimp:eraser_tool -> gimp-eraser-tool, gimp:layer-list -> gimp-layer-list, ...) * plug-ins/tools/common/gimpbrushselecttool.c: s/gimp:brush_select_tool/gimp-brush-select-tool-module/ Don't quite remember why I introduced the "gimp:" prefix in the first place, but we can always add it back if we need it (for whatever reason) You may want to edit your ~/.gimp-1.3/sessionrc and devicerc or all session settings will be lost due to parse errors.
2002-03-21 20:17:17 +08:00
"gimp-free-select-tool",
_("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"),
N_("_Free Select"), "F",
NULL, GIMP_HELP_TOOL_FREE_SELECT,
2002-03-29 11:50:29 +08:00
GIMP_STOCK_TOOL_FREE_SELECT,
app/tools/gimpairbrushtool.[ch] app/tools/gimpbezierselecttool.[ch] 2002-05-03 Sven Neumann <sven@gimp.org> * app/tools/gimpairbrushtool.[ch] * app/tools/gimpbezierselecttool.[ch] * app/tools/gimpblendtool.[ch] * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpbucketfilltool[.ch] * app/tools/gimpbycolorselecttool[.ch] * app/tools/gimpclonetool[.ch] * app/tools/gimpcolorbalancetool[.ch] * app/tools/gimpcolorpickertool[.ch] * app/tools/gimpconvolvetool[.ch] * app/tools/gimpcroptool[.ch] * app/tools/gimpcurvestool[.ch] * app/tools/gimpdodgeburntool[.ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpellipseselecttool[.ch] * app/tools/gimperasertool[.ch] * app/tools/gimpfliptool[.ch] * app/tools/gimpfreeselecttool[.ch] * app/tools/gimpfuzzyselecttool[.ch] * app/tools/gimphistogramtool[.ch] * app/tools/gimphuesaturationtool[.ch] * app/tools/gimpinktool[.ch] * app/tools/gimpiscissorstool[.ch] * app/tools/gimplevelstool[.ch] * app/tools/gimpmagnifytool[.ch] * app/tools/gimpmeasuretool[.ch] * app/tools/gimpmovetool[.ch] * app/tools/gimppaintbrushtool[.ch] * app/tools/gimppainttool.c * app/tools/gimppathtool[.ch] * app/tools/gimppenciltool[.ch] * app/tools/gimpperspectivetool[.ch] * app/tools/gimpposterizetool[.ch] * app/tools/gimprectselecttool[.ch] * app/tools/gimprotatetool[.ch] * app/tools/gimpscaletool[.ch] * app/tools/gimpselectiontool.c * app/tools/gimpsheartool[.ch] * app/tools/gimpsmudgetool[.ch] * app/tools/gimptexttool[.ch] * app/tools/gimpthresholdtool[.ch] * app/tools/gimptool.c * app/tools/gimptoolcontrol.h * app/tools/gimptoolmodule[.ch] * app/tools/gimptransformtool.c * app/tools/gimpvectortool[.ch] * app/tools/path_tool.c * app/tools/tool_manager[.ch] * app/tools/tools.c * libgimptool/gimptool.c * libgimptool/gimptoolcontrol.h * libgimptool/gimptoolmodule.h: removed tons of warnings. Do we need to add -Werror to the CFLAGS to avoid such a mess in the future ?! Also had to enforce the GIMP coding style in lots of places :-( * libgimp/gimppixelrgn.c: got sick and tired of debugging plug-ins, so I've added checks for most parameters passed to the GimpPixelRgn functions. This will slow down plug-in execution a little bit but should help to find bugs early.
2002-05-03 19:31:08 +08:00
data);
1997-11-25 06:05:25 +08:00
}
static void
gimp_free_select_tool_class_init (GimpFreeSelectToolClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass);
an evil temp_hack which lets GimpContext managing the active display 2001-08-14 Michael Natterer <mitch@gimp.org> * app/gdisplay.h: an evil temp_hack which lets GimpContext managing the active display withoug including "gdisplay.h". Will go away as soon ad context properties are registered dynamically. * app/module_db.c: cleaned up the object code in preparation of moving it to core/. * app/path.c: connect to GimpImage's * app/core/gimpobject.[ch]: derive it from GObject, not from GtkObject any more (yeah :-) * app/core/*.c: #include <glib-object.h> instead of <gtk/gtk.h>, removed some remaining GtkObject-isms. (left in a few #include <gtk/gtk.h> where bigger changes are needed to get rid of the UI dependency). * app/core/core-types.h: #include <gdk-pixbuf/gdk-pixbuf.h> here temporarily. * app/core/gimp.c (gimp_create_display): unref the image after creating it's first display. * app/core/gimpbrush.[ch]: disabled the parts of the code which depend on GimpPaintTool. * app/core/gimpbrushgenerated.c * app/core/gimpbrushpipe.c: changed accordingly. * app/core/gimpcontext.[ch]: evil hack (see above) to manage the active display without including "gdisplay.h" * app/core/gimpimage-mask.[ch]: pass a context to gimage_mask_stroke() and get the current tool's PDB string from there. * app/core/gimpedit.c: changed accordingly. * app/core/gimpimage.c: use gimp_image_update() instead of gdisplays_update_full(). * app/gui/color-area.c * app/gui/colormap-dialog.c * app/gui/dialogs-constructors.c * app/gui/edit-commands.c * app/gui/image-commands.c * app/gui/toolbox.c: changed accordingly (don't use Gtk methods on GObjects). * app/gui/menus.c: fix some const warnings by explicit casting. * app/tools/*.[ch]: ported all tools to GObject, some minor cleanup while i was on it. * app/widgets/gimpdialogfactory.[ch]: ported to GObject. * app/widgets/gimplayerlistview.h: added FOO_GET_CLASS() macro. * tools/pdbgen/app.pl: added a "widgets_eek" hack like "tools_eek" which inserts #include "widgets/widgets-types.h" before ordinary includes. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/edit.pdb * app/pdb/brush_select_cmds.c * app/pdb/edit_cmds.c: changed according to the stuff above.
2001-08-14 22:53:55 +08:00
object_class->finalize = gimp_free_select_tool_finalize;
tool_class->control = gimp_free_select_tool_control;
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_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;
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_class->key_press = gimp_free_select_tool_key_press;
draw_tool_class->draw = gimp_free_select_tool_draw;
klass->select = gimp_free_select_tool_real_select;
}
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)
{
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
GimpTool *tool = GIMP_TOOL (fst);
gimp_tool_control_set_scroll_lock (tool->control, FALSE);
gimp_tool_control_set_wants_click (tool->control, TRUE);
gimp_tool_control_set_tool_cursor (tool->control,
GIMP_TOOL_CURSOR_FREE_SELECT);
2002-03-29 11:50:29 +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
fst->grabbed_segment_index = INVALID_INDEX;
fst->button1_down = FALSE;
fst->saved_points_lower_segment = NULL;
fst->saved_points_higher_segment = NULL;
fst->n_saved_points_lower_segment = 0;
fst->n_saved_points_higher_segment = 0;
fst->polygon_modified = FALSE;
fst->show_pending_point = FALSE;
fst->points = NULL;
fst->n_points = 0;
fst->max_n_points = 0;
fst->segment_indices = NULL;
fst->n_segment_indices = 0;
fst->max_n_segment_indices = 0;
}
static void
an evil temp_hack which lets GimpContext managing the active display 2001-08-14 Michael Natterer <mitch@gimp.org> * app/gdisplay.h: an evil temp_hack which lets GimpContext managing the active display withoug including "gdisplay.h". Will go away as soon ad context properties are registered dynamically. * app/module_db.c: cleaned up the object code in preparation of moving it to core/. * app/path.c: connect to GimpImage's * app/core/gimpobject.[ch]: derive it from GObject, not from GtkObject any more (yeah :-) * app/core/*.c: #include <glib-object.h> instead of <gtk/gtk.h>, removed some remaining GtkObject-isms. (left in a few #include <gtk/gtk.h> where bigger changes are needed to get rid of the UI dependency). * app/core/core-types.h: #include <gdk-pixbuf/gdk-pixbuf.h> here temporarily. * app/core/gimp.c (gimp_create_display): unref the image after creating it's first display. * app/core/gimpbrush.[ch]: disabled the parts of the code which depend on GimpPaintTool. * app/core/gimpbrushgenerated.c * app/core/gimpbrushpipe.c: changed accordingly. * app/core/gimpcontext.[ch]: evil hack (see above) to manage the active display without including "gdisplay.h" * app/core/gimpimage-mask.[ch]: pass a context to gimage_mask_stroke() and get the current tool's PDB string from there. * app/core/gimpedit.c: changed accordingly. * app/core/gimpimage.c: use gimp_image_update() instead of gdisplays_update_full(). * app/gui/color-area.c * app/gui/colormap-dialog.c * app/gui/dialogs-constructors.c * app/gui/edit-commands.c * app/gui/image-commands.c * app/gui/toolbox.c: changed accordingly (don't use Gtk methods on GObjects). * app/gui/menus.c: fix some const warnings by explicit casting. * app/tools/*.[ch]: ported all tools to GObject, some minor cleanup while i was on it. * app/widgets/gimpdialogfactory.[ch]: ported to GObject. * app/widgets/gimplayerlistview.h: added FOO_GET_CLASS() macro. * tools/pdbgen/app.pl: added a "widgets_eek" hack like "tools_eek" which inserts #include "widgets/widgets-types.h" before ordinary includes. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/edit.pdb * app/pdb/brush_select_cmds.c * app/pdb/edit_cmds.c: changed according to the stuff above.
2001-08-14 22:53:55 +08:00
gimp_free_select_tool_finalize (GObject *object)
{
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 (object);
g_free (fst->points);
fst->points = NULL;
fst->n_points = 0;
fst->max_n_points = 0;
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
gimp_free_select_get_segment (GimpFreeSelectTool *fst,
GimpVector2 **points,
gint *n_points,
gint segment_start,
gint segment_end)
{
*points = &fst->points[fst->segment_indices[segment_start]];
*n_points = fst->segment_indices[segment_end] -
fst->segment_indices[segment_start] +
1;
}
static GimpVector2
gimp_free_select_tool_get_grabbed_point (GimpFreeSelectTool *fst)
{
return fst->points[fst->segment_indices[fst->grabbed_segment_index]];
}
static void
gimp_free_select_tool_cleanup_after_move (GimpFreeSelectTool *fst)
{
g_free (fst->saved_points_lower_segment);
fst->saved_points_lower_segment = NULL;
g_free (fst->saved_points_higher_segment);
fst->saved_points_higher_segment = NULL;
}
static gboolean
gimp_free_select_tool_should_close (GimpFreeSelectTool *fst,
GimpDisplay *display,
GimpCoords *coords)
{
gdouble dist;
if (fst->polygon_modified ||
fst->n_segment_indices <= 1 ||
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,
fst->points[0].x,
fst->points[0].y);
return dist < POINT_GRAB_THRESHOLD_SQ;
}
static void
gimp_free_select_tool_select_closest_segment_point (GimpFreeSelectTool *fst,
GimpDisplay *display,
GimpCoords *coords)
{
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (fst);
gdouble shortest_dist = POINT_GRAB_THRESHOLD_SQ;
gint grabbed_segment_index = INVALID_INDEX;
gint i;
if (GIMP_TOOL (fst)->display != NULL)
an evil temp_hack which lets GimpContext managing the active display 2001-08-14 Michael Natterer <mitch@gimp.org> * app/gdisplay.h: an evil temp_hack which lets GimpContext managing the active display withoug including "gdisplay.h". Will go away as soon ad context properties are registered dynamically. * app/module_db.c: cleaned up the object code in preparation of moving it to core/. * app/path.c: connect to GimpImage's * app/core/gimpobject.[ch]: derive it from GObject, not from GtkObject any more (yeah :-) * app/core/*.c: #include <glib-object.h> instead of <gtk/gtk.h>, removed some remaining GtkObject-isms. (left in a few #include <gtk/gtk.h> where bigger changes are needed to get rid of the UI dependency). * app/core/core-types.h: #include <gdk-pixbuf/gdk-pixbuf.h> here temporarily. * app/core/gimp.c (gimp_create_display): unref the image after creating it's first display. * app/core/gimpbrush.[ch]: disabled the parts of the code which depend on GimpPaintTool. * app/core/gimpbrushgenerated.c * app/core/gimpbrushpipe.c: changed accordingly. * app/core/gimpcontext.[ch]: evil hack (see above) to manage the active display without including "gdisplay.h" * app/core/gimpimage-mask.[ch]: pass a context to gimage_mask_stroke() and get the current tool's PDB string from there. * app/core/gimpedit.c: changed accordingly. * app/core/gimpimage.c: use gimp_image_update() instead of gdisplays_update_full(). * app/gui/color-area.c * app/gui/colormap-dialog.c * app/gui/dialogs-constructors.c * app/gui/edit-commands.c * app/gui/image-commands.c * app/gui/toolbox.c: changed accordingly (don't use Gtk methods on GObjects). * app/gui/menus.c: fix some const warnings by explicit casting. * app/tools/*.[ch]: ported all tools to GObject, some minor cleanup while i was on it. * app/widgets/gimpdialogfactory.[ch]: ported to GObject. * app/widgets/gimplayerlistview.h: added FOO_GET_CLASS() macro. * tools/pdbgen/app.pl: added a "widgets_eek" hack like "tools_eek" which inserts #include "widgets/widgets-types.h" before ordinary includes. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/edit.pdb * app/pdb/brush_select_cmds.c * app/pdb/edit_cmds.c: changed according to the stuff above.
2001-08-14 22:53:55 +08:00
{
for (i = 0; i < fst->n_segment_indices; i++)
{
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
point = &fst->points[fst->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
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
}
an evil temp_hack which lets GimpContext managing the active display 2001-08-14 Michael Natterer <mitch@gimp.org> * app/gdisplay.h: an evil temp_hack which lets GimpContext managing the active display withoug including "gdisplay.h". Will go away as soon ad context properties are registered dynamically. * app/module_db.c: cleaned up the object code in preparation of moving it to core/. * app/path.c: connect to GimpImage's * app/core/gimpobject.[ch]: derive it from GObject, not from GtkObject any more (yeah :-) * app/core/*.c: #include <glib-object.h> instead of <gtk/gtk.h>, removed some remaining GtkObject-isms. (left in a few #include <gtk/gtk.h> where bigger changes are needed to get rid of the UI dependency). * app/core/core-types.h: #include <gdk-pixbuf/gdk-pixbuf.h> here temporarily. * app/core/gimp.c (gimp_create_display): unref the image after creating it's first display. * app/core/gimpbrush.[ch]: disabled the parts of the code which depend on GimpPaintTool. * app/core/gimpbrushgenerated.c * app/core/gimpbrushpipe.c: changed accordingly. * app/core/gimpcontext.[ch]: evil hack (see above) to manage the active display without including "gdisplay.h" * app/core/gimpimage-mask.[ch]: pass a context to gimage_mask_stroke() and get the current tool's PDB string from there. * app/core/gimpedit.c: changed accordingly. * app/core/gimpimage.c: use gimp_image_update() instead of gdisplays_update_full(). * app/gui/color-area.c * app/gui/colormap-dialog.c * app/gui/dialogs-constructors.c * app/gui/edit-commands.c * app/gui/image-commands.c * app/gui/toolbox.c: changed accordingly (don't use Gtk methods on GObjects). * app/gui/menus.c: fix some const warnings by explicit casting. * app/tools/*.[ch]: ported all tools to GObject, some minor cleanup while i was on it. * app/widgets/gimpdialogfactory.[ch]: ported to GObject. * app/widgets/gimplayerlistview.h: added FOO_GET_CLASS() macro. * tools/pdbgen/app.pl: added a "widgets_eek" hack like "tools_eek" which inserts #include "widgets/widgets-types.h" before ordinary includes. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/edit.pdb * app/pdb/brush_select_cmds.c * app/pdb/edit_cmds.c: changed according to the stuff above.
2001-08-14 22:53:55 +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 (grabbed_segment_index != fst->grabbed_segment_index)
{
gimp_draw_tool_pause(draw_tool);
fst->grabbed_segment_index = grabbed_segment_index;
gimp_draw_tool_resume(draw_tool);
}
}
static void
gimp_free_select_tool_halt (GimpFreeSelectTool *fst)
{
GimpTool *tool = GIMP_TOOL (fst);
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (fst);
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);
fst->grabbed_segment_index = INVALID_INDEX;
fst->show_pending_point = FALSE;
fst->n_points = 0;
fst->n_segment_indices = 0;
tool->display = NULL;
}
static void
gimp_free_select_tool_revert_to_last_segment (GimpFreeSelectTool *fst)
{
fst->n_points = fst->segment_indices[fst->n_segment_indices - 1] + 1;
}
static void
gimp_free_select_tool_update_button_state (GimpFreeSelectTool *fst,
GdkModifierType state)
{
fst->button1_down = state & GDK_BUTTON1_MASK ? TRUE : FALSE;
}
static void
gimp_free_select_tool_remove_last_segment (GimpFreeSelectTool *fst)
{
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (fst);
gimp_draw_tool_pause (draw_tool);
fst->n_segment_indices--;
if (fst->n_segment_indices == 0)
{
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)
{
if (fst->n_points >= fst->max_n_points)
{
fst->max_n_points += N_ITEMS_PER_ALLOC;
fst->points = g_realloc (fst->points,
sizeof (GimpVector2) * fst->max_n_points);
}
fst->points[fst->n_points].x = x;
fst->points[fst->n_points].y = y;
fst->n_points++;
}
static void
gimp_free_select_tool_add_segment_index (GimpFreeSelectTool *fst,
gint index)
{
if (fst->n_segment_indices >= fst->max_n_segment_indices)
{
fst->max_n_segment_indices += N_ITEMS_PER_ALLOC;
fst->segment_indices = g_realloc (fst->segment_indices,
sizeof (GimpVector2) * fst->max_n_segment_indices);
}
fst->segment_indices[fst->n_segment_indices] = index;
fst->n_segment_indices++;
}
static gboolean
gimp_free_select_tool_is_point_grabbed (GimpFreeSelectTool *fst)
{
return fst->grabbed_segment_index != INVALID_INDEX;
}
static void
gimp_free_select_tool_start (GimpFreeSelectTool *fst,
GimpCoords *coords,
GimpDisplay *display)
{
GimpTool *tool = GIMP_TOOL (fst);
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
gimp_free_select_tool_halt (fst);
gimp_tool_control_activate (tool->control);
tool->display = display;
gimp_draw_tool_start (draw_tool, display);
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)
{
GimpVector2 cursor_point = { new_x, new_y };
GimpVector2 *dest;
GimpVector2 *dest_start_target;
GimpVector2 *dest_end_target;
gint n_points;
/* Handle the segment before the grabbed point */
if (segment_index > 0)
{
gimp_free_select_get_segment (fst,
&dest,
&n_points,
fst->grabbed_segment_index - 1,
fst->grabbed_segment_index);
dest_start_target = &dest[0];
dest_end_target = &cursor_point;
gimp_free_select_tool_fit_segment (fst,
dest,
*dest_start_target,
*dest_end_target,
fst->saved_points_lower_segment,
n_points);
}
/* Handle the segment after the grabbed point */
if (segment_index < fst->n_segment_indices - 1)
{
gimp_free_select_get_segment (fst,
&dest,
&n_points,
fst->grabbed_segment_index,
fst->grabbed_segment_index + 1);
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,
fst->saved_points_higher_segment,
n_points);
}
}
/**
* 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)
{
/* The points are all setup, just make a segment */
gimp_free_select_tool_add_segment_index (fst,
fst->n_points - 1);
}
static void
gimp_free_select_tool_commit (GimpFreeSelectTool *fst,
GimpDisplay *display)
{
if (fst->n_points >= 3)
{
gimp_free_select_tool_select (fst, display);
}
gimp_free_select_tool_halt (fst);
gimp_image_flush (display->image);
}
static void
gimp_free_select_tool_handle_click (GimpFreeSelectTool *fst,
GimpCoords *coords,
GimpDisplay *display)
{
/* 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);
}
/* After the segments are up to date, see if it's commiting time */
if (gimp_free_select_tool_should_close (fst,
display,
coords))
{
gimp_free_select_tool_commit (fst, display);
}
}
static void
gimp_free_select_tool_handle_normal_release (GimpFreeSelectTool *fst,
GimpCoords *coords,
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,
coords))
{
gimp_free_select_tool_commit (fst, display);
}
}
static void
gimp_free_select_tool_revert_to_saved_state (GimpFreeSelectTool *fst)
{
GimpVector2 *source;
gint n_points;
if (fst->grabbed_segment_index > 0)
{
gimp_free_select_get_segment (fst,
&source,
&n_points,
fst->grabbed_segment_index - 1,
fst->grabbed_segment_index);
memcpy (source,
fst->saved_points_lower_segment,
sizeof (GimpVector2) * n_points);
}
if (fst->grabbed_segment_index < fst->n_segment_indices - 1)
{
gimp_free_select_get_segment (fst,
&source,
&n_points,
fst->grabbed_segment_index,
fst->grabbed_segment_index + 1);
memcpy (source,
fst->saved_points_higher_segment,
sizeof (GimpVector2) * n_points);
}
}
static void
gimp_free_select_tool_handle_cancel (GimpFreeSelectTool *fst)
{
if (gimp_free_select_tool_is_point_grabbed (fst))
{
gimp_free_select_tool_revert_to_saved_state (fst);
}
else
{
gimp_free_select_tool_remove_last_segment (fst);
}
}
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)
{
GimpVector2 *source;
gint n_points;
if (fst->grabbed_segment_index > 0)
{
gimp_free_select_get_segment (fst,
&source,
&n_points,
fst->grabbed_segment_index - 1,
fst->grabbed_segment_index);
fst->saved_points_lower_segment = g_new0 (GimpVector2, n_points);
memcpy (fst->saved_points_lower_segment,
source,
sizeof (GimpVector2) * n_points);
}
if (fst->grabbed_segment_index < fst->n_segment_indices - 1)
{
gimp_free_select_get_segment (fst,
&source,
&n_points,
fst->grabbed_segment_index,
fst->grabbed_segment_index + 1);
fst->saved_points_higher_segment = g_new0 (GimpVector2, n_points);
memcpy (fst->saved_points_higher_segment,
source,
sizeof (GimpVector2) * n_points);
}
}
static void
gimp_free_select_tool_status_update (GimpFreeSelectTool *fst,
GimpDisplay *display,
GimpCoords *coords,
gboolean proximity)
{
GimpTool *tool = GIMP_TOOL (fst);
gimp_tool_pop_status (tool, display);
if (proximity)
{
const gchar *status_text = NULL;
if (gimp_free_select_tool_is_point_grabbed (fst))
{
if (gimp_free_select_tool_should_close (fst, display, coords))
{
status_text = _("Click to complete selection");
}
else
{
status_text = _("Click-Drag to move segment vertex");
}
}
else if (fst->n_points >= 3)
{
status_text = _("Return commits, Escape cancels, Backspace removes last segment");
}
else
{
status_text = _("Click-Drag creates free segment, Click creates polygonal segment");
}
if (status_text)
{
gimp_tool_push_status (tool, display, status_text);
}
}
}
static void
gimp_free_select_tool_control (GimpTool *tool,
GimpToolAction action,
GimpDisplay *display)
{
switch (action)
{
case GIMP_TOOL_ACTION_PAUSE:
case GIMP_TOOL_ACTION_RESUME:
break;
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));
break;
}
GIMP_TOOL_CLASS (parent_class)->control (tool, action, 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
static void
gimp_free_select_tool_oper_update (GimpTool *tool,
GimpCoords *coords,
GdkModifierType state,
gboolean proximity,
GimpDisplay *display)
{
GimpFreeSelectTool *fst;
gboolean hovering_first_point;
fst = GIMP_FREE_SELECT_TOOL (tool);
gimp_free_select_tool_select_closest_segment_point (fst,
display,
coords);
hovering_first_point =
gimp_free_select_tool_should_close (fst,
display,
coords);
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
if (fst->n_points == 0 ||
(gimp_free_select_tool_is_point_grabbed (fst) &&
! hovering_first_point))
{
fst->show_pending_point = FALSE;
}
else
{
fst->show_pending_point = TRUE;
if (hovering_first_point)
{
fst->pending_point = fst->points[0];
}
else
{
fst->pending_point.x = coords->x;
fst->pending_point.y = coords->y;
}
}
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
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
gimp_free_select_tool_cursor_update (GimpTool *tool,
GimpCoords *coords,
GdkModifierType state,
GimpDisplay *display)
{
GimpFreeSelectTool *fst = GIMP_FREE_SELECT_TOOL (tool);
if (gimp_free_select_tool_is_point_grabbed (fst) &&
! gimp_free_select_tool_should_close (fst, display, coords))
{
gimp_tool_set_cursor (tool, display,
gimp_tool_control_get_cursor (tool->control),
gimp_tool_control_get_tool_cursor (tool->control),
GIMP_CURSOR_MODIFIER_MOVE);
return;
}
GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state, display);
}
static void
build display/ before tools/. 2001-11-08 Michael Natterer <mitch@gimp.org> * app/Makefile.am: build display/ before tools/. * app/devices.c: devices_check_change(): added all events which have a GdkDevice pointer. * app/gimpprogress.c: include "display-types.h" instead of "core-types.h". * app/core/Makefile.am * app/core/gimpdrawable-bucket-fill.[ch]: new files: the bucket_fill stuff taken from tools/gimpbucketfilltool.[ch]. * app/core/core-types.h: added "BucketFillMode". * app/core/gimpimage-mask-select.[ch]: cleanup. * app/core/gimpmarshal.list: added more marshallers for GimpTool's new signal signatures. * app/core/gimpmarshal.[ch]: regenerated. * app/display/Makefile.am * app/display/gimpdisplayshell-dnd.[ch] * app/display/gimpdisplayshell-layer-select.[ch]: new files: the canvas drop callbacks from gimpdisplayshell-callbacks.[ch] and the stuff formerly knows as gui/layer-select.[ch]. * app/display/gimpdisplay.h: don't include "gui/gui-types.h". * app/display/gximage.c: include "display-types.h". * app/display/gimpdisplay-foreach.c * app/display/gimpdisplayshell.[ch]: call gdsplay_delete(), don't destroy the shell widget. * app/gui/Makefile.am * app/gui/layer-select.[ch]: removed. * app/gui/gradients-commands.c: fixed "Save as POV" fprintf()s. * app/gui/preferences-dialog.c: removed the layer_select stuff because it is useless with the new preview system. * app/gui/tool-options-dialog.c: send the correct data to the close_callback. * app/gui/tools-commands.c: changed to follow the new gimp_tool_initialize() semantics (see below). Tool & canvas event handling chainsawing: * app/tools/tools-types.h: new struct GimpCoords which contains x, y, pressure, tilt etc. * app/display/gimpdisplayshell-callbacks.[ch]: added utility functions which transparently retreive the current event's GimpCoords or take it from the device directly if the event has none. Pass GimpCoords _in_image_coordinates_ to all tool functions. Most important: don't pass GdkEvents and display coordinates to tools any more. * app/tools/gimptool.[ch]: changed virtual functions to take GimpCoords, time and state separately instead of GdkEvents. * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.[ch] * app/tools/gimpbycolorselecttool.c * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpconvolvetool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpcurvestool.c * app/tools/gimpdodgeburntool.c * app/tools/gimpdrawtool.c * app/tools/gimpeditselectiontool.[ch] * app/tools/gimperasertool.c * app/tools/gimpfliptool.c * app/tools/gimpfreeselecttool.[ch] * app/tools/gimpfuzzyselecttool.c * app/tools/gimpinktool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c * app/tools/gimppathtool.[ch] * app/tools/gimprectselecttool.c * app/tools/gimprotatetool.c * app/tools/gimpselectiontool.[ch] * app/tools/gimpsmudgetool.c * app/tools/gimptexttool.c * app/tools/gimptransformtool.[ch] * app/tools/path_tool.[ch] * app/tools/selection_options.c: tons and tons of changes: - changed to use the new virtual function parameters. - removed zillions of gdisplay_untransform_coords(). - get the active drawable's offsets manually in many cases. (questionable, but IMHO ok because it's obvious and not simply a "TRUE" passed to some function) - reordered some functions to be consistent across tools. - some tools had to be changed to work on image coords, not display ones (esp. crop). - fixed strange rotate tool behaviour which should be backported to stable. - some stuff i came across. - indentation and other paranoia. - rounding of coordinated may be broken in some tools. - new bugs guaranteed. * app/tools/tool_manager.[ch]: new semantic of tool_manager_initialize_active() (looked at the places where it was used from and put common code together). Should be a bit better now :) * app/tools/gimpblendtool.c * app/tools/transform_options.c: use the new GTK+ feature that a widget (toggle button) can be a frame's title for this tools' tool options. * app/widgets/widgets-types.h: stuff. * themes/Default/gtkrc: s/GtkDialog/GimpDialog/. * tools/pdbgen/Makefile.am: don't scan tools/gimpbucketfilltool.h any more. * tools/pdbgen/enums.pl: regenerated. * tools/pdbgen/pdb/tools.pdb: changed bucket_fill wrapper. * app/pdb/tools_cmds.c: regenerated.
2001-11-09 03:14:51 +08:00
gimp_free_select_tool_button_press (GimpTool *tool,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *display)
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
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
GimpFreeSelectTool *fst = GIMP_FREE_SELECT_TOOL (tool);
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 (draw_tool);
build display/ before tools/. 2001-11-08 Michael Natterer <mitch@gimp.org> * app/Makefile.am: build display/ before tools/. * app/devices.c: devices_check_change(): added all events which have a GdkDevice pointer. * app/gimpprogress.c: include "display-types.h" instead of "core-types.h". * app/core/Makefile.am * app/core/gimpdrawable-bucket-fill.[ch]: new files: the bucket_fill stuff taken from tools/gimpbucketfilltool.[ch]. * app/core/core-types.h: added "BucketFillMode". * app/core/gimpimage-mask-select.[ch]: cleanup. * app/core/gimpmarshal.list: added more marshallers for GimpTool's new signal signatures. * app/core/gimpmarshal.[ch]: regenerated. * app/display/Makefile.am * app/display/gimpdisplayshell-dnd.[ch] * app/display/gimpdisplayshell-layer-select.[ch]: new files: the canvas drop callbacks from gimpdisplayshell-callbacks.[ch] and the stuff formerly knows as gui/layer-select.[ch]. * app/display/gimpdisplay.h: don't include "gui/gui-types.h". * app/display/gximage.c: include "display-types.h". * app/display/gimpdisplay-foreach.c * app/display/gimpdisplayshell.[ch]: call gdsplay_delete(), don't destroy the shell widget. * app/gui/Makefile.am * app/gui/layer-select.[ch]: removed. * app/gui/gradients-commands.c: fixed "Save as POV" fprintf()s. * app/gui/preferences-dialog.c: removed the layer_select stuff because it is useless with the new preview system. * app/gui/tool-options-dialog.c: send the correct data to the close_callback. * app/gui/tools-commands.c: changed to follow the new gimp_tool_initialize() semantics (see below). Tool & canvas event handling chainsawing: * app/tools/tools-types.h: new struct GimpCoords which contains x, y, pressure, tilt etc. * app/display/gimpdisplayshell-callbacks.[ch]: added utility functions which transparently retreive the current event's GimpCoords or take it from the device directly if the event has none. Pass GimpCoords _in_image_coordinates_ to all tool functions. Most important: don't pass GdkEvents and display coordinates to tools any more. * app/tools/gimptool.[ch]: changed virtual functions to take GimpCoords, time and state separately instead of GdkEvents. * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.[ch] * app/tools/gimpbycolorselecttool.c * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpconvolvetool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpcurvestool.c * app/tools/gimpdodgeburntool.c * app/tools/gimpdrawtool.c * app/tools/gimpeditselectiontool.[ch] * app/tools/gimperasertool.c * app/tools/gimpfliptool.c * app/tools/gimpfreeselecttool.[ch] * app/tools/gimpfuzzyselecttool.c * app/tools/gimpinktool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c * app/tools/gimppathtool.[ch] * app/tools/gimprectselecttool.c * app/tools/gimprotatetool.c * app/tools/gimpselectiontool.[ch] * app/tools/gimpsmudgetool.c * app/tools/gimptexttool.c * app/tools/gimptransformtool.[ch] * app/tools/path_tool.[ch] * app/tools/selection_options.c: tons and tons of changes: - changed to use the new virtual function parameters. - removed zillions of gdisplay_untransform_coords(). - get the active drawable's offsets manually in many cases. (questionable, but IMHO ok because it's obvious and not simply a "TRUE" passed to some function) - reordered some functions to be consistent across tools. - some tools had to be changed to work on image coords, not display ones (esp. crop). - fixed strange rotate tool behaviour which should be backported to stable. - some stuff i came across. - indentation and other paranoia. - rounding of coordinated may be broken in some tools. - new bugs guaranteed. * app/tools/tool_manager.[ch]: new semantic of tool_manager_initialize_active() (looked at the places where it was used from and put common code together). Should be a bit better now :) * app/tools/gimpblendtool.c * app/tools/transform_options.c: use the new GTK+ feature that a widget (toggle button) can be a frame's title for this tools' tool options. * app/widgets/widgets-types.h: stuff. * themes/Default/gtkrc: s/GtkDialog/GimpDialog/. * tools/pdbgen/Makefile.am: don't scan tools/gimpbucketfilltool.h any more. * tools/pdbgen/enums.pl: regenerated. * tools/pdbgen/pdb/tools.pdb: changed bucket_fill wrapper. * app/pdb/tools_cmds.c: regenerated.
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);
}
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
{
/* 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,
coords->x,
coords->y);
gimp_free_select_tool_add_segment_index (fst,
fst->n_points - 1);
}
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
}
static void
gimp_free_select_tool_button_release (GimpTool *tool,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpButtonReleaseType release_type,
GimpDisplay *display)
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
GimpFreeSelectTool *fst = GIMP_FREE_SELECT_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;
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
switch (release_type)
{
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 */
fst->polygon_modified = FALSE;
gimp_free_select_tool_handle_click (fst,
coords,
display);
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);
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 need to be clever, we can cleanup even if no move was done */
if (fst->polygon_modified)
{
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_cleanup_after_move (fst);
}
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_CANCEL:
gimp_free_select_tool_handle_cancel (fst);
break;
default:
break;
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
/* Reset */
fst->polygon_modified = FALSE;
gimp_draw_tool_resume (GIMP_DRAW_TOOL (fst));
1997-11-25 06:05:25 +08:00
}
static void
build display/ before tools/. 2001-11-08 Michael Natterer <mitch@gimp.org> * app/Makefile.am: build display/ before tools/. * app/devices.c: devices_check_change(): added all events which have a GdkDevice pointer. * app/gimpprogress.c: include "display-types.h" instead of "core-types.h". * app/core/Makefile.am * app/core/gimpdrawable-bucket-fill.[ch]: new files: the bucket_fill stuff taken from tools/gimpbucketfilltool.[ch]. * app/core/core-types.h: added "BucketFillMode". * app/core/gimpimage-mask-select.[ch]: cleanup. * app/core/gimpmarshal.list: added more marshallers for GimpTool's new signal signatures. * app/core/gimpmarshal.[ch]: regenerated. * app/display/Makefile.am * app/display/gimpdisplayshell-dnd.[ch] * app/display/gimpdisplayshell-layer-select.[ch]: new files: the canvas drop callbacks from gimpdisplayshell-callbacks.[ch] and the stuff formerly knows as gui/layer-select.[ch]. * app/display/gimpdisplay.h: don't include "gui/gui-types.h". * app/display/gximage.c: include "display-types.h". * app/display/gimpdisplay-foreach.c * app/display/gimpdisplayshell.[ch]: call gdsplay_delete(), don't destroy the shell widget. * app/gui/Makefile.am * app/gui/layer-select.[ch]: removed. * app/gui/gradients-commands.c: fixed "Save as POV" fprintf()s. * app/gui/preferences-dialog.c: removed the layer_select stuff because it is useless with the new preview system. * app/gui/tool-options-dialog.c: send the correct data to the close_callback. * app/gui/tools-commands.c: changed to follow the new gimp_tool_initialize() semantics (see below). Tool & canvas event handling chainsawing: * app/tools/tools-types.h: new struct GimpCoords which contains x, y, pressure, tilt etc. * app/display/gimpdisplayshell-callbacks.[ch]: added utility functions which transparently retreive the current event's GimpCoords or take it from the device directly if the event has none. Pass GimpCoords _in_image_coordinates_ to all tool functions. Most important: don't pass GdkEvents and display coordinates to tools any more. * app/tools/gimptool.[ch]: changed virtual functions to take GimpCoords, time and state separately instead of GdkEvents. * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.[ch] * app/tools/gimpbycolorselecttool.c * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpconvolvetool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpcurvestool.c * app/tools/gimpdodgeburntool.c * app/tools/gimpdrawtool.c * app/tools/gimpeditselectiontool.[ch] * app/tools/gimperasertool.c * app/tools/gimpfliptool.c * app/tools/gimpfreeselecttool.[ch] * app/tools/gimpfuzzyselecttool.c * app/tools/gimpinktool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c * app/tools/gimppathtool.[ch] * app/tools/gimprectselecttool.c * app/tools/gimprotatetool.c * app/tools/gimpselectiontool.[ch] * app/tools/gimpsmudgetool.c * app/tools/gimptexttool.c * app/tools/gimptransformtool.[ch] * app/tools/path_tool.[ch] * app/tools/selection_options.c: tons and tons of changes: - changed to use the new virtual function parameters. - removed zillions of gdisplay_untransform_coords(). - get the active drawable's offsets manually in many cases. (questionable, but IMHO ok because it's obvious and not simply a "TRUE" passed to some function) - reordered some functions to be consistent across tools. - some tools had to be changed to work on image coords, not display ones (esp. crop). - fixed strange rotate tool behaviour which should be backported to stable. - some stuff i came across. - indentation and other paranoia. - rounding of coordinated may be broken in some tools. - new bugs guaranteed. * app/tools/tool_manager.[ch]: new semantic of tool_manager_initialize_active() (looked at the places where it was used from and put common code together). Should be a bit better now :) * app/tools/gimpblendtool.c * app/tools/transform_options.c: use the new GTK+ feature that a widget (toggle button) can be a frame's title for this tools' tool options. * app/widgets/widgets-types.h: stuff. * themes/Default/gtkrc: s/GtkDialog/GimpDialog/. * tools/pdbgen/Makefile.am: don't scan tools/gimpbucketfilltool.h any more. * tools/pdbgen/enums.pl: regenerated. * tools/pdbgen/pdb/tools.pdb: changed bucket_fill wrapper. * app/pdb/tools_cmds.c: regenerated.
2001-11-09 03:14:51 +08:00
gimp_free_select_tool_motion (GimpTool *tool,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *display)
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
GimpFreeSelectTool *fst;
GimpDrawTool *draw_tool;
if (tool->display != display)
return;
fst = GIMP_FREE_SELECT_TOOL (tool);
draw_tool = GIMP_DRAW_TOOL (tool);
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 (draw_tool);
if (gimp_free_select_tool_is_point_grabbed (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
fst->polygon_modified = TRUE;
gimp_free_select_tool_move_segment_vertex_to (fst,
fst->grabbed_segment_index,
coords->x,
coords->y);
/* We also must update the pending point if we are moving the
* first point
*/
if (fst->grabbed_segment_index == 0)
{
fst->pending_point.x = coords->x;
fst->pending_point.y = coords->y;
}
}
else
{
/* Don't show the pending point while we are adding points */
fst->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
gimp_free_select_tool_add_point (fst,
coords->x,
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
gimp_draw_tool_resume (draw_tool);
}
build display/ before tools/. 2001-11-08 Michael Natterer <mitch@gimp.org> * app/Makefile.am: build display/ before tools/. * app/devices.c: devices_check_change(): added all events which have a GdkDevice pointer. * app/gimpprogress.c: include "display-types.h" instead of "core-types.h". * app/core/Makefile.am * app/core/gimpdrawable-bucket-fill.[ch]: new files: the bucket_fill stuff taken from tools/gimpbucketfilltool.[ch]. * app/core/core-types.h: added "BucketFillMode". * app/core/gimpimage-mask-select.[ch]: cleanup. * app/core/gimpmarshal.list: added more marshallers for GimpTool's new signal signatures. * app/core/gimpmarshal.[ch]: regenerated. * app/display/Makefile.am * app/display/gimpdisplayshell-dnd.[ch] * app/display/gimpdisplayshell-layer-select.[ch]: new files: the canvas drop callbacks from gimpdisplayshell-callbacks.[ch] and the stuff formerly knows as gui/layer-select.[ch]. * app/display/gimpdisplay.h: don't include "gui/gui-types.h". * app/display/gximage.c: include "display-types.h". * app/display/gimpdisplay-foreach.c * app/display/gimpdisplayshell.[ch]: call gdsplay_delete(), don't destroy the shell widget. * app/gui/Makefile.am * app/gui/layer-select.[ch]: removed. * app/gui/gradients-commands.c: fixed "Save as POV" fprintf()s. * app/gui/preferences-dialog.c: removed the layer_select stuff because it is useless with the new preview system. * app/gui/tool-options-dialog.c: send the correct data to the close_callback. * app/gui/tools-commands.c: changed to follow the new gimp_tool_initialize() semantics (see below). Tool & canvas event handling chainsawing: * app/tools/tools-types.h: new struct GimpCoords which contains x, y, pressure, tilt etc. * app/display/gimpdisplayshell-callbacks.[ch]: added utility functions which transparently retreive the current event's GimpCoords or take it from the device directly if the event has none. Pass GimpCoords _in_image_coordinates_ to all tool functions. Most important: don't pass GdkEvents and display coordinates to tools any more. * app/tools/gimptool.[ch]: changed virtual functions to take GimpCoords, time and state separately instead of GdkEvents. * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.[ch] * app/tools/gimpbycolorselecttool.c * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpconvolvetool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpcurvestool.c * app/tools/gimpdodgeburntool.c * app/tools/gimpdrawtool.c * app/tools/gimpeditselectiontool.[ch] * app/tools/gimperasertool.c * app/tools/gimpfliptool.c * app/tools/gimpfreeselecttool.[ch] * app/tools/gimpfuzzyselecttool.c * app/tools/gimpinktool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c * app/tools/gimppathtool.[ch] * app/tools/gimprectselecttool.c * app/tools/gimprotatetool.c * app/tools/gimpselectiontool.[ch] * app/tools/gimpsmudgetool.c * app/tools/gimptexttool.c * app/tools/gimptransformtool.[ch] * app/tools/path_tool.[ch] * app/tools/selection_options.c: tons and tons of changes: - changed to use the new virtual function parameters. - removed zillions of gdisplay_untransform_coords(). - get the active drawable's offsets manually in many cases. (questionable, but IMHO ok because it's obvious and not simply a "TRUE" passed to some function) - reordered some functions to be consistent across tools. - some tools had to be changed to work on image coords, not display ones (esp. crop). - fixed strange rotate tool behaviour which should be backported to stable. - some stuff i came across. - indentation and other paranoia. - rounding of coordinated may be broken in some tools. - new bugs guaranteed. * app/tools/tool_manager.[ch]: new semantic of tool_manager_initialize_active() (looked at the places where it was used from and put common code together). Should be a bit better now :) * app/tools/gimpblendtool.c * app/tools/transform_options.c: use the new GTK+ feature that a widget (toggle button) can be a frame's title for this tools' tool options. * app/widgets/widgets-types.h: stuff. * themes/Default/gtkrc: s/GtkDialog/GimpDialog/. * tools/pdbgen/Makefile.am: don't scan tools/gimpbucketfilltool.h any more. * tools/pdbgen/enums.pl: regenerated. * tools/pdbgen/pdb/tools.pdb: changed bucket_fill wrapper. * app/pdb/tools_cmds.c: regenerated.
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);
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)
{
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;
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;
}
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
}
static void
gimp_free_select_tool_draw (GimpDrawTool *draw_tool)
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
GimpFreeSelectTool *fst = GIMP_FREE_SELECT_TOOL (draw_tool);
1997-11-25 06:05:25 +08:00
gimp_draw_tool_draw_lines (draw_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
fst->points, fst->n_points,
FALSE, 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
if (gimp_free_select_tool_is_point_grabbed (fst) &&
! fst->button1_down)
{
GimpVector2 grabbed_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
grabbed_point = gimp_free_select_tool_get_grabbed_point (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_draw_handle (draw_tool, GIMP_HANDLE_CIRCLE,
grabbed_point.x,
grabbed_point.y,
HANDLE_SIZE, HANDLE_SIZE,
GTK_ANCHOR_CENTER, 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
if (fst->show_pending_point)
{
GimpVector2 last = fst->points[fst->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
gimp_draw_tool_draw_line (draw_tool,
last.x,
last.y,
fst->pending_point.x,
fst->pending_point.y,
FALSE);
}
}
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,
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
GimpSelectionOptions *options = GIMP_SELECTION_TOOL_GET_OPTIONS (fst);
gimp_channel_select_polygon (gimp_image_get_mask (display->image),
Q_("command|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
fst->n_points,
fst->points,
options->operation,
options->antialias,
options->feather,
options->feather_radius,
options->feather_radius,
TRUE);
}