gimp/app/tools/gimpfreeselecttool.c

550 lines
21 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
*
* This program is free software: you can redistribute it and/or modify
1997-11-25 06:05:25 +08:00
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
1997-11-25 06:05:25 +08:00
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
1997-11-25 06:05:25 +08:00
*/
#include "config.h"
#include <gegl.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>
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-selection.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 "display/gimptoolpolygon.h"
#include "gimpfreeselecttool.h"
#include "gimpselectionoptions.h"
#include "gimptoolcontrol.h"
#include "gimp-intl.h"
struct _GimpFreeSelectToolPrivate
{
/* The selection operation active when the tool was started */
GimpChannelOps operation_at_start;
GimpToolWidget *widget;
GimpToolWidget *grab_widget;
};
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_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,
const GimpCoords *coords,
GdkModifierType state,
gboolean proximity,
GimpDisplay *display);
static void gimp_free_select_tool_cursor_update (GimpTool *tool,
const GimpCoords *coords,
GdkModifierType state,
GimpDisplay *display);
static void gimp_free_select_tool_button_press (GimpTool *tool,
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpButtonPressType press_type,
GimpDisplay *display);
static void gimp_free_select_tool_button_release (GimpTool *tool,
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpButtonReleaseType release_type,
GimpDisplay *display);
static void gimp_free_select_tool_motion (GimpTool *tool,
const 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_modifier_key (GimpTool *tool,
GdkModifierType key,
gboolean press,
GdkModifierType state,
GimpDisplay *display);
static void gimp_free_select_tool_active_modifier_key (GimpTool *tool,
GdkModifierType key,
gboolean press,
GdkModifierType state,
GimpDisplay *display);
static void gimp_free_select_tool_real_select (GimpFreeSelectTool *fst,
GimpDisplay *display,
const GimpVector2 *points,
gint n_points);
static void gimp_free_select_tool_polygon_changed (GimpToolWidget *polygon,
GimpFreeSelectTool *fst);
static void gimp_free_select_tool_polygon_response (GimpToolWidget *polygon,
gint response_id,
GimpFreeSelectTool *fst);
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
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"),
_("Free Select Tool: Select a hand-drawn region with free "
"and polygonal segments"),
N_("_Free Select"), "F",
NULL, GIMP_HELP_TOOL_FREE_SELECT,
GIMP_ICON_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
}
gint
gimp_free_select_tool_get_n_points (GimpFreeSelectTool *tool)
{
GimpFreeSelectToolPrivate *private = tool->private;
const GimpVector2 *points;
gint n_points = 0;
if (private->widget)
gimp_tool_polygon_get_points (GIMP_TOOL_POLYGON (private->widget),
&points, &n_points);
return n_points;
}
static void
gimp_free_select_tool_class_init (GimpFreeSelectToolClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
object_class->finalize = gimp_free_select_tool_finalize;
tool_class->control = gimp_free_select_tool_control;
tool_class->oper_update = gimp_free_select_tool_oper_update;
tool_class->cursor_update = gimp_free_select_tool_cursor_update;
tool_class->button_press = gimp_free_select_tool_button_press;
tool_class->button_release = gimp_free_select_tool_button_release;
tool_class->motion = gimp_free_select_tool_motion;
tool_class->key_press = gimp_free_select_tool_key_press;
tool_class->modifier_key = gimp_free_select_tool_modifier_key;
tool_class->active_modifier_key = gimp_free_select_tool_active_modifier_key;
klass->select = gimp_free_select_tool_real_select;
g_type_class_add_private (klass, sizeof (GimpFreeSelectToolPrivate));
}
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)
{
GimpTool *tool = GIMP_TOOL (fst);
fst->private = G_TYPE_INSTANCE_GET_PRIVATE (fst,
GIMP_TYPE_FREE_SELECT_TOOL,
GimpFreeSelectToolPrivate);
gimp_tool_control_set_motion_mode (tool->control,
GIMP_MOTION_MODE_EXACT);
gimp_tool_control_set_wants_click (tool->control, TRUE);
gimp_tool_control_set_wants_double_click (tool->control, TRUE);
gimp_tool_control_set_active_modifiers (tool->control,
GIMP_TOOL_ACTIVE_MODIFIERS_SEPARATE);
gimp_tool_control_set_precision (tool->control,
GIMP_CURSOR_PRECISION_SUBPIXEL);
gimp_tool_control_set_tool_cursor (tool->control,
GIMP_TOOL_CURSOR_FREE_SELECT);
}
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)
{
GimpFreeSelectTool *fst = GIMP_FREE_SELECT_TOOL (object);
GimpFreeSelectToolPrivate *priv = fst->private;
Merged the Polygon Select Tool capabilities with the Free Select Tool. 2008-05-18 Martin Nordholts <martinn@svn.gnome.org> Merged the Polygon Select Tool capabilities with the Free Select Tool. Among the things still to do is improved help texts, more suitable graphics, and cursor mangement, but the core functionality is in place. Thanks to Alexia Death for initial testing. It will also be neccesary to do some work to adapt the Foreground Select Tool to the new Free Select Tool implementation. Quick instructions on how the tool works: o A click adds a polygonal segment, a drag adds a free-hand segment o Return-key commits, Escape-key cancels, Backspace-key removes last segment o You can grab and move segment vertices o You can cancel both a move, and the creation of a segment * app/tools/gimpfreeselecttool.[ch]: More or less reimplemented. We keep a sequential array of all the points in the polygon (including the free segments), and we have another array with point indices that we use to represent the segments. On top of this we have a few helper functions that tries to abstract away the pretty raw nature of the implementation. * app/tools/gimpforegroundselecttool.[ch]: Keep track on its own last_coord, and adjust to the new implementation of the Free Select Tool. Still needs some work, for example handling that the Free Select Tool now resets GimpTool::display. (gimp_foreground_select_tool_key_press): Pass on key event to parent class when appropriate. (Bails out too early though...) svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
g_clear_object (&priv->widget);
Merged the Polygon Select Tool capabilities with the Free Select Tool. 2008-05-18 Martin Nordholts <martinn@svn.gnome.org> Merged the Polygon Select Tool capabilities with the Free Select Tool. Among the things still to do is improved help texts, more suitable graphics, and cursor mangement, but the core functionality is in place. Thanks to Alexia Death for initial testing. It will also be neccesary to do some work to adapt the Foreground Select Tool to the new Free Select Tool implementation. Quick instructions on how the tool works: o A click adds a polygonal segment, a drag adds a free-hand segment o Return-key commits, Escape-key cancels, Backspace-key removes last segment o You can grab and move segment vertices o You can cancel both a move, and the creation of a segment * app/tools/gimpfreeselecttool.[ch]: More or less reimplemented. We keep a sequential array of all the points in the polygon (including the free segments), and we have another array with point indices that we use to represent the segments. On top of this we have a few helper functions that tries to abstract away the pretty raw nature of the implementation. * app/tools/gimpforegroundselecttool.[ch]: Keep track on its own last_coord, and adjust to the new implementation of the Free Select Tool. Still needs some work, for example handling that the Free Select Tool now resets GimpTool::display. (gimp_foreground_select_tool_key_press): Pass on key event to parent class when appropriate. (Bails out too early though...) svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
gimp_free_select_tool_start (GimpFreeSelectTool *fst,
GimpDisplay *display)
{
GimpTool *tool = GIMP_TOOL (fst);
GimpFreeSelectToolPrivate *private = fst->private;
GimpSelectionOptions *options = GIMP_SELECTION_TOOL_GET_OPTIONS (tool);
GimpDisplayShell *shell = gimp_display_get_shell (display);
tool->display = display;
/* We want to apply the selection operation that was current when
* the tool was started, so we save this information
*/
private->operation_at_start = options->operation;
private->widget = gimp_tool_polygon_new (shell);
gimp_draw_tool_set_widget (GIMP_DRAW_TOOL (tool), private->widget);
g_signal_connect (private->widget, "changed",
G_CALLBACK (gimp_free_select_tool_polygon_changed),
fst);
g_signal_connect (private->widget, "response",
G_CALLBACK (gimp_free_select_tool_polygon_response),
fst);
gimp_draw_tool_start (GIMP_DRAW_TOOL (tool), display);
}
void
gimp_free_select_tool_halt (GimpFreeSelectTool *fst)
{
GimpFreeSelectToolPrivate *private = fst->private;
gimp_draw_tool_set_widget (GIMP_DRAW_TOOL (fst), NULL);
g_clear_object (&private->widget);
}
Merged the Polygon Select Tool capabilities with the Free Select Tool. 2008-05-18 Martin Nordholts <martinn@svn.gnome.org> Merged the Polygon Select Tool capabilities with the Free Select Tool. Among the things still to do is improved help texts, more suitable graphics, and cursor mangement, but the core functionality is in place. Thanks to Alexia Death for initial testing. It will also be neccesary to do some work to adapt the Foreground Select Tool to the new Free Select Tool implementation. Quick instructions on how the tool works: o A click adds a polygonal segment, a drag adds a free-hand segment o Return-key commits, Escape-key cancels, Backspace-key removes last segment o You can grab and move segment vertices o You can cancel both a move, and the creation of a segment * app/tools/gimpfreeselecttool.[ch]: More or less reimplemented. We keep a sequential array of all the points in the polygon (including the free segments), and we have another array with point indices that we use to represent the segments. On top of this we have a few helper functions that tries to abstract away the pretty raw nature of the implementation. * app/tools/gimpforegroundselecttool.[ch]: Keep track on its own last_coord, and adjust to the new implementation of the Free Select Tool. Still needs some work, for example handling that the Free Select Tool now resets GimpTool::display. (gimp_foreground_select_tool_key_press): Pass on key event to parent class when appropriate. (Bails out too early though...) svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
static void
gimp_free_select_tool_commit (GimpFreeSelectTool *fst,
GimpDisplay *display)
{
GimpFreeSelectToolPrivate *private = fst->private;
if (private->widget)
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
{
const GimpVector2 *points;
gint n_points;
Merged the Polygon Select Tool capabilities with the Free Select Tool. 2008-05-18 Martin Nordholts <martinn@svn.gnome.org> Merged the Polygon Select Tool capabilities with the Free Select Tool. Among the things still to do is improved help texts, more suitable graphics, and cursor mangement, but the core functionality is in place. Thanks to Alexia Death for initial testing. It will also be neccesary to do some work to adapt the Foreground Select Tool to the new Free Select Tool implementation. Quick instructions on how the tool works: o A click adds a polygonal segment, a drag adds a free-hand segment o Return-key commits, Escape-key cancels, Backspace-key removes last segment o You can grab and move segment vertices o You can cancel both a move, and the creation of a segment * app/tools/gimpfreeselecttool.[ch]: More or less reimplemented. We keep a sequential array of all the points in the polygon (including the free segments), and we have another array with point indices that we use to represent the segments. On top of this we have a few helper functions that tries to abstract away the pretty raw nature of the implementation. * app/tools/gimpforegroundselecttool.[ch]: Keep track on its own last_coord, and adjust to the new implementation of the Free Select Tool. Still needs some work, for example handling that the Free Select Tool now resets GimpTool::display. (gimp_foreground_select_tool_key_press): Pass on key event to parent class when appropriate. (Bails out too early though...) svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
gimp_tool_polygon_get_points (GIMP_TOOL_POLYGON (private->widget),
&points, &n_points);
Merged the Polygon Select Tool capabilities with the Free Select Tool. 2008-05-18 Martin Nordholts <martinn@svn.gnome.org> Merged the Polygon Select Tool capabilities with the Free Select Tool. Among the things still to do is improved help texts, more suitable graphics, and cursor mangement, but the core functionality is in place. Thanks to Alexia Death for initial testing. It will also be neccesary to do some work to adapt the Foreground Select Tool to the new Free Select Tool implementation. Quick instructions on how the tool works: o A click adds a polygonal segment, a drag adds a free-hand segment o Return-key commits, Escape-key cancels, Backspace-key removes last segment o You can grab and move segment vertices o You can cancel both a move, and the creation of a segment * app/tools/gimpfreeselecttool.[ch]: More or less reimplemented. We keep a sequential array of all the points in the polygon (including the free segments), and we have another array with point indices that we use to represent the segments. On top of this we have a few helper functions that tries to abstract away the pretty raw nature of the implementation. * app/tools/gimpforegroundselecttool.[ch]: Keep track on its own last_coord, and adjust to the new implementation of the Free Select Tool. Still needs some work, for example handling that the Free Select Tool now resets GimpTool::display. (gimp_foreground_select_tool_key_press): Pass on key event to parent class when appropriate. (Bails out too early though...) svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
if (n_points >= 3)
{
GIMP_FREE_SELECT_TOOL_GET_CLASS (fst)->select (fst, display,
points, n_points);
}
Merged the Polygon Select Tool capabilities with the Free Select Tool. 2008-05-18 Martin Nordholts <martinn@svn.gnome.org> Merged the Polygon Select Tool capabilities with the Free Select Tool. Among the things still to do is improved help texts, more suitable graphics, and cursor mangement, but the core functionality is in place. Thanks to Alexia Death for initial testing. It will also be neccesary to do some work to adapt the Foreground Select Tool to the new Free Select Tool implementation. Quick instructions on how the tool works: o A click adds a polygonal segment, a drag adds a free-hand segment o Return-key commits, Escape-key cancels, Backspace-key removes last segment o You can grab and move segment vertices o You can cancel both a move, and the creation of a segment * app/tools/gimpfreeselecttool.[ch]: More or less reimplemented. We keep a sequential array of all the points in the polygon (including the free segments), and we have another array with point indices that we use to represent the segments. On top of this we have a few helper functions that tries to abstract away the pretty raw nature of the implementation. * app/tools/gimpforegroundselecttool.[ch]: Keep track on its own last_coord, and adjust to the new implementation of the Free Select Tool. Still needs some work, for example handling that the Free Select Tool now resets GimpTool::display. (gimp_foreground_select_tool_key_press): Pass on key event to parent class when appropriate. (Bails out too early though...) svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
}
gimp_image_flush (gimp_display_get_image (display));
}
static void
gimp_free_select_tool_control (GimpTool *tool,
GimpToolAction action,
GimpDisplay *display)
{
GimpFreeSelectTool *fst = GIMP_FREE_SELECT_TOOL (tool);
switch (action)
{
case GIMP_TOOL_ACTION_PAUSE:
case GIMP_TOOL_ACTION_RESUME:
break;
case GIMP_TOOL_ACTION_HALT:
gimp_free_select_tool_halt (fst);
break;
case GIMP_TOOL_ACTION_COMMIT:
gimp_free_select_tool_commit (fst, display);
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,
const GimpCoords *coords,
GdkModifierType state,
gboolean proximity,
GimpDisplay *display)
Merged the Polygon Select Tool capabilities with the Free Select Tool. 2008-05-18 Martin Nordholts <martinn@svn.gnome.org> Merged the Polygon Select Tool capabilities with the Free Select Tool. Among the things still to do is improved help texts, more suitable graphics, and cursor mangement, but the core functionality is in place. Thanks to Alexia Death for initial testing. It will also be neccesary to do some work to adapt the Foreground Select Tool to the new Free Select Tool implementation. Quick instructions on how the tool works: o A click adds a polygonal segment, a drag adds a free-hand segment o Return-key commits, Escape-key cancels, Backspace-key removes last segment o You can grab and move segment vertices o You can cancel both a move, and the creation of a segment * app/tools/gimpfreeselecttool.[ch]: More or less reimplemented. We keep a sequential array of all the points in the polygon (including the free segments), and we have another array with point indices that we use to represent the segments. On top of this we have a few helper functions that tries to abstract away the pretty raw nature of the implementation. * app/tools/gimpforegroundselecttool.[ch]: Keep track on its own last_coord, and adjust to the new implementation of the Free Select Tool. Still needs some work, for example handling that the Free Select Tool now resets GimpTool::display. (gimp_foreground_select_tool_key_press): Pass on key event to parent class when appropriate. (Bails out too early though...) svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
{
GimpFreeSelectTool *fst = GIMP_FREE_SELECT_TOOL (tool);
GimpFreeSelectToolPrivate *priv = fst->private;
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_TOOL_CLASS (parent_class)->oper_update (tool, coords, state,
proximity, display);
return;
}
if (priv->widget)
{
gimp_tool_widget_hover (priv->widget, coords, state, 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,
const GimpCoords *coords,
GdkModifierType state,
GimpDisplay *display)
Merged the Polygon Select Tool capabilities with the Free Select Tool. 2008-05-18 Martin Nordholts <martinn@svn.gnome.org> Merged the Polygon Select Tool capabilities with the Free Select Tool. Among the things still to do is improved help texts, more suitable graphics, and cursor mangement, but the core functionality is in place. Thanks to Alexia Death for initial testing. It will also be neccesary to do some work to adapt the Foreground Select Tool to the new Free Select Tool implementation. Quick instructions on how the tool works: o A click adds a polygonal segment, a drag adds a free-hand segment o Return-key commits, Escape-key cancels, Backspace-key removes last segment o You can grab and move segment vertices o You can cancel both a move, and the creation of a segment * app/tools/gimpfreeselecttool.[ch]: More or less reimplemented. We keep a sequential array of all the points in the polygon (including the free segments), and we have another array with point indices that we use to represent the segments. On top of this we have a few helper functions that tries to abstract away the pretty raw nature of the implementation. * app/tools/gimpforegroundselecttool.[ch]: Keep track on its own last_coord, and adjust to the new implementation of the Free Select Tool. Still needs some work, for example handling that the Free Select Tool now resets GimpTool::display. (gimp_foreground_select_tool_key_press): Pass on key event to parent class when appropriate. (Bails out too early though...) svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
{
GimpFreeSelectTool *fst = GIMP_FREE_SELECT_TOOL (tool);
GimpFreeSelectToolPrivate *priv = fst->private;
GimpCursorModifier modifier = GIMP_CURSOR_MODIFIER_NONE;
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 == NULL)
{
GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state,
display);
return;
}
if (priv->widget && display == tool->display)
{
gimp_tool_widget_get_cursor (priv->widget, coords, state,
NULL, NULL, &modifier);
}
gimp_tool_set_cursor (tool, display,
gimp_tool_control_get_cursor (tool->control),
gimp_tool_control_get_tool_cursor (tool->control),
modifier);
Merged the Polygon Select Tool capabilities with the Free Select Tool. 2008-05-18 Martin Nordholts <martinn@svn.gnome.org> Merged the Polygon Select Tool capabilities with the Free Select Tool. Among the things still to do is improved help texts, more suitable graphics, and cursor mangement, but the core functionality is in place. Thanks to Alexia Death for initial testing. It will also be neccesary to do some work to adapt the Foreground Select Tool to the new Free Select Tool implementation. Quick instructions on how the tool works: o A click adds a polygonal segment, a drag adds a free-hand segment o Return-key commits, Escape-key cancels, Backspace-key removes last segment o You can grab and move segment vertices o You can cancel both a move, and the creation of a segment * app/tools/gimpfreeselecttool.[ch]: More or less reimplemented. We keep a sequential array of all the points in the polygon (including the free segments), and we have another array with point indices that we use to represent the segments. On top of this we have a few helper functions that tries to abstract away the pretty raw nature of the implementation. * app/tools/gimpforegroundselecttool.[ch]: Keep track on its own last_coord, and adjust to the new implementation of the Free Select Tool. Still needs some work, for example handling that the Free Select Tool now resets GimpTool::display. (gimp_foreground_select_tool_key_press): Pass on key event to parent class when appropriate. (Bails out too early though...) svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
}
static void
gimp_free_select_tool_button_press (GimpTool *tool,
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpButtonPressType press_type,
GimpDisplay *display)
1997-11-25 06:05:25 +08:00
{
GimpFreeSelectTool *fst = GIMP_FREE_SELECT_TOOL (tool);
GimpFreeSelectToolPrivate *private = fst->private;
1997-11-25 06:05:25 +08:00
if (tool->display && tool->display != display)
gimp_tool_control (tool, GIMP_TOOL_ACTION_COMMIT, tool->display);
if (! private->widget) /* not tool->display, we have a subclass */
{
/* First of all handle delegation to the selection mask edit logic
* if appropriate.
*/
if (gimp_selection_tool_start_edit (GIMP_SELECTION_TOOL (fst),
display, coords))
{
return;
}
gimp_free_select_tool_start (fst, display);
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_tool_widget_hover (private->widget, coords, state, TRUE);
Merged the Polygon Select Tool capabilities with the Free Select Tool. 2008-05-18 Martin Nordholts <martinn@svn.gnome.org> Merged the Polygon Select Tool capabilities with the Free Select Tool. Among the things still to do is improved help texts, more suitable graphics, and cursor mangement, but the core functionality is in place. Thanks to Alexia Death for initial testing. It will also be neccesary to do some work to adapt the Foreground Select Tool to the new Free Select Tool implementation. Quick instructions on how the tool works: o A click adds a polygonal segment, a drag adds a free-hand segment o Return-key commits, Escape-key cancels, Backspace-key removes last segment o You can grab and move segment vertices o You can cancel both a move, and the creation of a segment * app/tools/gimpfreeselecttool.[ch]: More or less reimplemented. We keep a sequential array of all the points in the polygon (including the free segments), and we have another array with point indices that we use to represent the segments. On top of this we have a few helper functions that tries to abstract away the pretty raw nature of the implementation. * app/tools/gimpforegroundselecttool.[ch]: Keep track on its own last_coord, and adjust to the new implementation of the Free Select Tool. Still needs some work, for example handling that the Free Select Tool now resets GimpTool::display. (gimp_foreground_select_tool_key_press): Pass on key event to parent class when appropriate. (Bails out too early though...) svn path=/trunk/; revision=25693
2008-05-18 19:39:17 +08:00
}
if (gimp_tool_widget_button_press (private->widget, coords, time, state,
press_type))
{
private->grab_widget = private->widget;
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 (press_type == GIMP_BUTTON_PRESS_NORMAL)
gimp_tool_control_activate (tool->control);
1997-11-25 06:05:25 +08:00
}
static void
gimp_free_select_tool_button_release (GimpTool *tool,
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpButtonReleaseType release_type,
GimpDisplay *display)
1997-11-25 06:05:25 +08:00
{
GimpFreeSelectTool *fst = GIMP_FREE_SELECT_TOOL (tool);
GimpFreeSelectToolPrivate *priv = fst->private;
GimpImage *image = gimp_display_get_image (display);
gimp_tool_control_halt (tool->control);
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 there is a floating selection, anchor it */
if (gimp_image_get_floating_selection (image))
{
floating_sel_anchor (gimp_image_get_floating_selection (image));
gimp_tool_control (tool, GIMP_TOOL_ACTION_HALT, display);
return;
}
/* fallthru */
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
default:
if (priv->grab_widget)
{
gimp_tool_widget_button_release (priv->grab_widget,
coords, time, state, release_type);
priv->grab_widget = NULL;
}
1997-11-25 06:05:25 +08:00
}
}
static void
gimp_free_select_tool_motion (GimpTool *tool,
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *display)
1997-11-25 06:05:25 +08:00
{
GimpFreeSelectTool *fst = GIMP_FREE_SELECT_TOOL (tool);
GimpFreeSelectToolPrivate *priv = fst->private;
if (priv->grab_widget)
{
gimp_tool_widget_motion (priv->grab_widget, coords, time, state);
}
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
}
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);
GimpFreeSelectToolPrivate *priv = fst->private;
if (priv->widget && display == tool->display)
{
return gimp_tool_widget_key_press (priv->widget, kevent);
}
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_modifier_key (GimpTool *tool,
GdkModifierType key,
gboolean press,
GdkModifierType state,
GimpDisplay *display)
{
GimpFreeSelectTool *fst = GIMP_FREE_SELECT_TOOL (tool);
GimpFreeSelectToolPrivate *priv = fst->private;
if (priv->widget && display == tool->display)
{
gimp_tool_widget_hover_modifier (priv->widget, key, press, state);
}
GIMP_TOOL_CLASS (parent_class)->modifier_key (tool, key, press, state,
display);
}
static void
gimp_free_select_tool_active_modifier_key (GimpTool *tool,
GdkModifierType key,
gboolean press,
GdkModifierType state,
GimpDisplay *display)
{
GimpFreeSelectTool *fst = GIMP_FREE_SELECT_TOOL (tool);
GimpFreeSelectToolPrivate *priv = fst->private;
if (priv->widget)
{
gimp_tool_widget_motion_modifier (priv->widget, key, press, state);
GIMP_TOOL_CLASS (parent_class)->active_modifier_key (tool,
key, press, state,
display);
}
}
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,
const GimpVector2 *points,
gint n_points)
{
GimpSelectionOptions *options = GIMP_SELECTION_TOOL_GET_OPTIONS (fst);
GimpFreeSelectToolPrivate *priv = fst->private;
GimpImage *image = gimp_display_get_image (display);
gimp_channel_select_polygon (gimp_image_get_mask (image),
C_("command", "Free Select"),
n_points,
points,
priv->operation_at_start,
options->antialias,
options->feather,
options->feather_radius,
options->feather_radius,
TRUE);
gimp_tool_control (GIMP_TOOL (fst), GIMP_TOOL_ACTION_HALT, display);
}
static void
gimp_free_select_tool_polygon_changed (GimpToolWidget *polygon,
GimpFreeSelectTool *fst)
{
}
static void
gimp_free_select_tool_polygon_response (GimpToolWidget *polygon,
gint response_id,
GimpFreeSelectTool *fst)
{
GimpTool *tool = GIMP_TOOL (fst);
switch (response_id)
{
case GIMP_TOOL_WIDGET_RESPONSE_CONFIRM:
/* don't gimp_tool_control(COMMIT) here because we don't always
* want to HALT the tool after committing because we have a
* subclass, we do that in the default implementation of
* select().
*/
gimp_free_select_tool_commit (fst, tool->display);
break;
case GIMP_TOOL_WIDGET_RESPONSE_CANCEL:
gimp_tool_control (tool, GIMP_TOOL_ACTION_HALT, tool->display);
break;
}
}