gimp/app/tools/gimpvectortool.c

1996 lines
65 KiB
C
Raw Normal View History

/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* Vector tool
* Copyright (C) 2003 Simon Budig <simon@gimp.org>
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <gegl.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpwidgets/gimpwidgets.h"
devel-docs/Makefile.am new file documenting the core's include policy. 2002-05-03 Michael Natterer <mitch@gimp.org> * devel-docs/Makefile.am * devel-docs/includes.txt: new file documenting the core's include policy. * HACKING: mention it here. * libgimptool/gimptooltypes.h: removed GimpToolOptions here. * app/core/core-types.h: and added it here. This is a temp hack needed because GimpToolInfo needs to know the GimpToolOptions type. * libgimpproxy/gimpproxytypes.h: regenerated. * libgimptool/gimptoolmodule.h: don't include gimptooltypes.h here... * libgimptool/gimptoolmodule.c: ...but here. * app/config/gimpconfig-params.c: include "libgimpbase/gimpbase.h" entirely, not single files from it. * app/core/gimp.c * app/core/gimpcontext.c * app/core/gimpcoreconfig.c * app/core/gimpdatafactory.c * app/core/gimpdocuments.c * app/core/gimpdrawable-blend.c * app/core/gimpdrawable-bucket-fill.c * app/core/gimpdrawable-offset.c * app/core/gimpdrawable-transform.c * app/core/gimpdrawable.c * app/core/gimpedit.c * app/core/gimpimage-convert.c * app/core/gimpimage-crop.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-guides.c * app/core/gimpimage-mask.c * app/core/gimpimage-merge.c * app/core/gimpimage-new.c * app/core/gimpimage-projection.c * app/core/gimpimage-qmask.c * app/core/gimpimage-resize.c * app/core/gimpimage-scale.c * app/core/gimpimage.c * app/core/gimpitem.c * app/core/gimpmodules.c * app/core/gimppaintinfo.c * app/core/gimpparasite.c * app/core/gimppreviewcache.c * app/core/gimptoolinfo.c * app/core/gimpunit.c: include "core-types.h" and no other types file. * app/display/gimpdisplay.c * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell.c: include "tools/tools-types.h" instead of "libgimptool/gimptooltypes.h", warn about inclusion on "gui/gui-types.h" * app/file/file-open.c * app/file/file-save.c: don't include "libgimptool/gimptooltypes.h". * app/gui/about-dialog.c * app/gui/brush-select.c * app/gui/brushes-commands.c * app/gui/color-select.c * app/gui/data-commands.c * app/gui/device-status-dialog.c * app/gui/dialogs.c * app/gui/gradients-commands.c * app/gui/help-commands.c * app/gui/info-window.c * app/gui/palettes-commands.c * app/gui/patterns-commands.c * app/gui/resize-dialog.c * app/gui/tips-dialog.c * app/gui/tool-options-dialog.c: include "gui-types.h" and no other types file. * app/paint/gimpairbrush.c * app/paint/gimpclone.c * app/paint/gimpconvolve.c * app/paint/gimpdodgeburn.c * app/paint/gimperaser.c * app/paint/gimppaintbrush.c * app/paint/gimppaintcore-stroke.c * app/paint/gimppaintcore.c * app/paint/gimppaintoptions.c * app/paint/gimppencil.c * app/paint/gimpsmudge.c * app/paint/paint.c: include "paint-types.h" and no other types file. * app/pdb/pdb-types.h: don't include "libgimptool/gimptooltypes.h". * app/plug-in/plug-in-progress.c: warn about inclusion of "display/display-types.h" * app/tools/tools-types.h: include "libgimptool/gimptooltypes.h". * 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/gimpdrawtool.c * app/tools/gimpeditselectiontool.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/gimplevelstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.c * app/tools/gimpmovetool.c * app/tools/gimppaintbrushtool.c * app/tools/gimppainttool.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/gimpselectiontool.c * app/tools/gimpsheartool.c * app/tools/gimpsmudgetool.c * app/tools/gimptexttool.c * app/tools/gimpthresholdtool.c * app/tools/gimptoolcontrol.c * app/tools/gimptoolcontrol.h * app/tools/gimptransformtool.c * app/tools/gimpvectortool.c * app/tools/tools.c: include "tools-types.h" and no other types file, warn about inclusion of "gui/gui-types.h". * app/widgets/gimpcolorpanel.c * app/widgets/gimptoolbox-color-area.c: warn about inclusion of "gui/gui-types.h". * app/xcf/xcf-load.c * app/xcf/xcf.c: don't include "libgimptool/gimptooltypes.h". Split tool-safe-mode up in two files, one including libgimpproxy, one libgimp. * plug-ins/tools/Makefile.am * plug-ins/tools/tool-safe-mode-plug-in.[ch]: new files including libgimp/ stuff only. * plug-ins/tools/tool-safe-mode.[ch]: include libgimpproxy/ and libgimptool/ but don't include libgimp/ because of conflicting declarations. Unrelated: * app/tools/gimpclonetool.c: create the clone core so we don't crash. * app/gui/file-open-dialog.c: changed the way we create previews so that only out-of-date previews are created on a click in the preview area. Unconditional creation can still be forced by <Ctrl>+click. Changed the tooltip to document this.
2002-05-03 20:45:22 +08:00
#include "tools-types.h"
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "core/gimpimage-undo.h"
#include "core/gimpimage-undo-push.h"
Started to get rid of the gdisplays_foo() functions in 2002-05-08 Michael Natterer <mitch@gimp.org> Started to get rid of the gdisplays_foo() functions in app/display/gimpdisplay-foreach.[ch]. Work in progress... * app/core/gimp.[ch]: added the display list to the Gimp object (as a GimpList of GimpObjects). This way we get more independent from whether there is GUI or not, as gimp->displays will simply be an empty list for the --no-interface case. * app/display/gimpdisplay.[ch]: Removed the global "display_list" and "display_num" variables. Use gimp->displays instead. * app/display/gimpdisplay-foreach.[ch]: renamed most functions from gdisplays_foo() to gimp_displays_foo() and pass them a Gimp pointer. * app/core/gimpimage.[ch]: added a "flush" signal. * app/display/gimpdisplay-handlers.c: connect to "flush" and call gimp_display_flush() in the callback. * tools/pdbgen/pdb/display.pdb: use gimp_displays_flush(gimp) here and only here. * app/pdb/display_cmds.c: regenerated. * app/app_procs.c * app/gui/gui.c * app/gui/preferences-dialog.c: s/gdislays_foo()/gimp_displays_foo(gimp)/ * app/image_map.c * app/undo_history.c * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-dnd.c * app/display/gimpdisplayshell-layer-select.c * app/display/gimpdisplayshell-scale.c * app/gui/channels-commands.c * app/gui/colormap-editor-commands.c * app/gui/convert-dialog.c * app/gui/drawable-commands.c * app/gui/edit-commands.c * app/gui/file-commands.c * app/gui/image-commands.c * app/gui/layers-commands.c * app/gui/offset-dialog.c * app/gui/qmask-commands.c * app/gui/select-commands.c * app/gui/vectors-commands.c * app/paint/gimpairbrush.c * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcurvestool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpinktool.c * app/tools/gimpiscissorstool.c * app/tools/gimplevelstool.c * app/tools/gimpmeasuretool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c * app/tools/gimpposterizetool.c * app/tools/gimprectselecttool.c * app/tools/gimptexttool.c * app/tools/gimpthresholdtool.c * app/tools/gimptransformtool.c * app/tools/gimpvectortool.c * app/widgets/gimpbufferview.c * app/widgets/gimpchannellistview.c * app/widgets/gimpcomponentlistitem.c * app/widgets/gimpdocumentview.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimpdrawablelistview.c * app/widgets/gimpimageview.c * app/widgets/gimpitemlistitem.c * app/widgets/gimpitemlistview.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplayerlistview.c * app/widgets/gimpvectorslistview.c: replaced gdisplays_flush() with calls to gimp_image_flush(gimage). Removed inclusion of "display/gimpdisplay-foreach.h" from most files.
2002-05-09 01:48:24 +08:00
#include "core/gimplist.h"
#include "core/gimpprogress.h"
#include "core/gimptoolinfo.h"
#include "core/gimpundostack.h"
#include "paint/gimppaintoptions.h" /* GIMP_PAINT_OPTIONS_CONTEXT_MASK */
#include "vectors/gimpanchor.h"
#include "vectors/gimpvectors.h"
#include "vectors/gimpbezierstroke.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpwidgets-utils.h"
#include "display/gimpcanvasitem.h"
#include "display/gimpdisplay.h"
#include "display/gimpdisplayshell.h"
#include "display/gimpdisplayshell-scale.h"
#include "gimptoolcontrol.h"
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
#include "gimpvectoroptions.h"
#include "gimpvectortool.h"
configure.in added new directory app/dialogs and link libappdialogs.c into 2004-09-13 Michael Natterer <mitch@gimp.org> * configure.in * app/Makefile.am: added new directory app/dialogs and link libappdialogs.c into the gimp binary. * app/gui/Makefile.am * app/gui/gui-types.h * app/gui/gui-vtable.c * app/gui/gui.c * app/gui/about-dialog.[ch] * app/gui/authors.h * app/gui/color-notebook.[ch] * app/gui/convert-dialog.[ch] * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.[ch] * app/gui/file-dialog-utils.[ch] * app/gui/file-new-dialog.[ch] * app/gui/file-open-dialog.[ch] * app/gui/file-open-location-dialog.[ch] * app/gui/file-save-dialog.[ch] * app/gui/grid-dialog.[ch] * app/gui/info-dialog.[ch] * app/gui/info-window.[ch] * app/gui/module-browser.[ch] * app/gui/offset-dialog.[ch] * app/gui/palette-import-dialog.[ch] * app/gui/preferences-dialog.[ch] * app/gui/quit-dialog.[ch] * app/gui/resize-dialog.[ch] * app/gui/resolution-calibrate-dialog.[ch] * app/gui/stroke-dialog.[ch] * app/gui/tips-dialog.[ch] * app/gui/tips-parser.[ch] * app/gui/user-install-dialog.[ch]: removed these files... * app/dialogs/Makefile.am * app/dialogs/dialogs-types.h * app/dialogs/*.[ch]: ...and added them here. Changed some filenames like module-browser -> module-dialog. * app/app_procs.c * app/actions/actions-types.h * app/actions/actions.c * app/actions/dialogs-actions.c * app/actions/dialogs-commands.c * app/actions/dockable-commands.c * app/actions/drawable-commands.c * app/actions/edit-commands.c * app/actions/file-commands.c * app/actions/gradient-editor-commands.c * app/actions/image-commands.c * app/actions/layers-commands.c * app/actions/palettes-commands.c * app/actions/select-commands.c * app/actions/templates-commands.c * app/actions/templates-commands.h * app/actions/vectors-commands.c * app/actions/view-commands.c * app/display/gimpdisplayshell-cursor.c * app/display/gimpdisplayshell-title.c * app/display/gimpdisplayshell.[ch] * app/tools/gimpcroptool.c * app/tools/gimpperspectivetool.c * app/tools/gimprotatetool.c * app/tools/gimpscaletool.c * app/tools/gimpsheartool.c * app/tools/gimptransformtool.[ch] * app/tools/gimpvectortool.c * app/widgets/gimpcolormapeditor.[ch] * app/widgets/gimpcolorpanel.c * app/widgets/gimpgradienteditor.[ch] * app/widgets/gimppaletteeditor.[ch] * app/widgets/gimptoolbox-color-area.c * menus/toolbox-menu.xml.in * tools/authorsgen/authorsgen.pl: changed accordingly.
2004-09-13 23:15:23 +08:00
#include "dialogs/stroke-dialog.h"
#include "gimp-intl.h"
#define TARGET 13
#define TOGGLE_MASK GDK_SHIFT_MASK
#define MOVE_MASK GDK_MOD1_MASK
#define INSDEL_MASK GDK_CONTROL_MASK
/* local function prototypes */
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
static void gimp_vector_tool_control (GimpTool *tool,
GimpToolAction action,
GimpDisplay *display);
static void gimp_vector_tool_button_press (GimpTool *tool,
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpButtonPressType press_type,
GimpDisplay *display);
static void gimp_vector_tool_button_release (GimpTool *tool,
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpButtonReleaseType release_type,
GimpDisplay *display);
static void gimp_vector_tool_motion (GimpTool *tool,
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *display);
static gboolean gimp_vector_tool_key_press (GimpTool *tool,
GdkEventKey *kevent,
GimpDisplay *display);
static void gimp_vector_tool_modifier_key (GimpTool *tool,
GdkModifierType key,
gboolean press,
GdkModifierType state,
GimpDisplay *display);
static void gimp_vector_tool_oper_update (GimpTool *tool,
const GimpCoords *coords,
GdkModifierType state,
gboolean proximity,
GimpDisplay *display);
static void gimp_vector_tool_status_update (GimpTool *tool,
GimpDisplay *display,
GdkModifierType state,
gboolean proximity);
static void gimp_vector_tool_cursor_update (GimpTool *tool,
const GimpCoords *coords,
GdkModifierType state,
GimpDisplay *display);
static void gimp_vector_tool_draw (GimpDrawTool *draw_tool);
static void gimp_vector_tool_vectors_changed (GimpImage *image,
GimpVectorTool *vector_tool);
static void gimp_vector_tool_vectors_removed (GimpVectors *vectors,
GimpVectorTool *vector_tool);
static void gimp_vector_tool_vectors_visible (GimpVectors *vectors,
GimpVectorTool *vector_tool);
static void gimp_vector_tool_vectors_freeze (GimpVectors *vectors,
GimpVectorTool *vector_tool);
static void gimp_vector_tool_vectors_thaw (GimpVectors *vectors,
GimpVectorTool *vector_tool);
static void gimp_vector_tool_move_selected_anchors
(GimpVectorTool *vector_tool,
gdouble x,
gdouble y);
static void gimp_vector_tool_delete_selected_anchors
(GimpVectorTool *vector_tool);
static void gimp_vector_tool_verify_state (GimpVectorTool *vector_tool);
static void gimp_vector_tool_undo_push (GimpVectorTool *vector_tool,
const gchar *desc);
static void gimp_vector_tool_to_selection (GimpVectorTool *vector_tool);
static void gimp_vector_tool_to_selection_extended
(GimpVectorTool *vector_tool,
gint state);
static void gimp_vector_tool_stroke_vectors (GimpVectorTool *vector_tool,
GtkWidget *button);
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
G_DEFINE_TYPE (GimpVectorTool, gimp_vector_tool, GIMP_TYPE_DRAW_TOOL)
#define parent_class gimp_vector_tool_parent_class
void
gimp_vector_tool_register (GimpToolRegisterCallback callback,
gpointer data)
{
2002-03-29 11:50:29 +08:00
(* callback) (GIMP_TYPE_VECTOR_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_VECTOR_OPTIONS,
gimp_vector_options_gui,
GIMP_PAINT_OPTIONS_CONTEXT_MASK |
GIMP_CONTEXT_GRADIENT_MASK, /* for stroking */
"gimp-vector-tool",
_("Paths"),
2006-09-19 02:00:22 +08:00
_("Paths Tool: Create and edit paths"),
N_("Pat_hs"), "b",
NULL, GIMP_HELP_TOOL_PATH,
2002-03-29 11:50:29 +08:00
GIMP_STOCK_TOOL_PATH,
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);
}
static void
gimp_vector_tool_class_init (GimpVectorToolClass *klass)
{
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass);
tool_class->control = gimp_vector_tool_control;
tool_class->button_press = gimp_vector_tool_button_press;
tool_class->button_release = gimp_vector_tool_button_release;
tool_class->motion = gimp_vector_tool_motion;
tool_class->key_press = gimp_vector_tool_key_press;
tool_class->modifier_key = gimp_vector_tool_modifier_key;
tool_class->oper_update = gimp_vector_tool_oper_update;
tool_class->cursor_update = gimp_vector_tool_cursor_update;
draw_tool_class->draw = gimp_vector_tool_draw;
}
static void
gimp_vector_tool_init (GimpVectorTool *vector_tool)
{
GimpTool *tool = GIMP_TOOL (vector_tool);
gimp_tool_control_set_scroll_lock (tool->control, FALSE);
gimp_tool_control_set_handle_empty_image (tool->control, TRUE);
gimp_tool_control_set_motion_mode (tool->control,
GIMP_MOTION_MODE_COMPRESS);
Bug 496772 – Position shown in the statusbar needs more precision (for 2008-08-20 Michael Natterer <mitch@gimp.org> Bug 496772 – Position shown in the statusbar needs more precision (for some tools) * app/display/display-enums.[ch]: add enum GimpCursorPrecision which can be one of { PIXEL_CENTER, PIXEL_BORDER, SUBPIXEL }. * app/display/gimpdisplayshell-cursor.[ch]: add "precision" parameter to gimp_display_shell_update_cursor() and pass it on to the statusbar. * app/display/gimpstatusbar.[ch]: add "precision" parameters to the cursor coordinates APIs, offset the passed coords accordingly and display them with one decimal point if SUBPIXEL is requested and the display's unit is PIXEL. Keep a second floating-point format string around at any time. * app/tools/gimptoolcontrol.[ch]: add a "precision" member and API so tools can configure the precision they need. Defalt to PIXEL_CENTER since that's right for almost all tools. * app/display/gimpdisplayshell-callbacks.c: pass the tool's precision to gimp_display_shell_update_cursor(). * app/tools/gimptool.[ch]: add "precision" parameter to gimp_tool_push_status_coords() and pass it on to the statusbar. * app/tools/gimpaligntool.c * app/tools/gimpblendtool.c * app/tools/gimpcolortool.c * app/tools/gimpcroptool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpfliptool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c * app/tools/gimpperspectiveclonetool.c * app/tools/gimprectangleselecttool.c * app/tools/gimprectangletool.c * app/tools/gimptransformtool.c * app/tools/gimpvectortool.c: set precision in init() where needed. Adjust the precision in the fly when needed, e.g. while moving guides or when toggling hard-edge on paint tools. Also pass an appropriate precision to gimp_tool_push_status_coords(), which is not always the tool's precision as used for cursor display. svn path=/trunk/; revision=26681
2008-08-21 00:22:09 +08:00
gimp_tool_control_set_precision (tool->control,
GIMP_CURSOR_PRECISION_SUBPIXEL);
gimp_tool_control_set_cursor (tool->control, GIMP_CURSOR_MOUSE);
gimp_tool_control_set_tool_cursor (tool->control,
GIMP_TOOL_CURSOR_PATHS);
vector_tool->function = VECTORS_CREATE_VECTOR;
vector_tool->restriction = GIMP_ANCHOR_FEATURE_NONE;
vector_tool->modifier_lock = FALSE;
vector_tool->last_x = 0.0;
vector_tool->last_y = 0.0;
vector_tool->undo_motion = FALSE;
vector_tool->have_undo = FALSE;
vector_tool->cur_anchor = NULL;
vector_tool->cur_anchor2 = NULL;
vector_tool->cur_stroke = NULL;
vector_tool->cur_position = 0.0;
vector_tool->cur_vectors = NULL;
vector_tool->vectors = NULL;
vector_tool->sel_count = 0;
vector_tool->sel_anchor = NULL;
vector_tool->sel_stroke = NULL;
vector_tool->saved_mode = GIMP_VECTOR_MODE_DESIGN;
}
static void
gimp_vector_tool_control (GimpTool *tool,
GimpToolAction action,
GimpDisplay *display)
{
GimpVectorTool *vector_tool = GIMP_VECTOR_TOOL (tool);
switch (action)
{
case GIMP_TOOL_ACTION_PAUSE:
case GIMP_TOOL_ACTION_RESUME:
break;
case GIMP_TOOL_ACTION_HALT:
gimp_vector_tool_set_vectors (vector_tool, NULL);
break;
}
GIMP_TOOL_CLASS (parent_class)->control (tool, action, display);
}
static gboolean
gimp_vector_tool_check_writable (GimpVectorTool *vector_tool)
{
if (gimp_item_is_content_locked (GIMP_ITEM (vector_tool->vectors)))
{
gimp_tool_message_literal (GIMP_TOOL (vector_tool),
GIMP_TOOL (vector_tool)->display,
_("The active path is locked."));
vector_tool->function = VECTORS_FINISHED;
return FALSE;
}
return TRUE;
}
static void
gimp_vector_tool_button_press (GimpTool *tool,
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpButtonPressType press_type,
GimpDisplay *display)
{
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
GimpVectorTool *vector_tool = GIMP_VECTOR_TOOL (tool);
GimpVectorOptions *options = GIMP_VECTOR_TOOL_GET_OPTIONS (tool);
GimpImage *image = gimp_display_get_image (display);
GimpVectors *vectors;
/* do nothing if we are an FINISHED state */
if (vector_tool->function == VECTORS_FINISHED)
return;
g_return_if_fail (vector_tool->vectors != NULL ||
vector_tool->function == VECTORS_SELECT_VECTOR ||
vector_tool->function == VECTORS_CREATE_VECTOR);
vector_tool->undo_motion = FALSE;
/* save the current modifier state */
vector_tool->saved_state = state;
gimp_draw_tool_pause (draw_tool);
if (gimp_draw_tool_is_active (draw_tool) && draw_tool->display != display)
{
gimp_draw_tool_stop (draw_tool);
}
gimp_tool_control_activate (tool->control);
tool->display = display;
/* select a vectors object */
if (vector_tool->function == VECTORS_SELECT_VECTOR)
{
if (gimp_draw_tool_on_vectors (draw_tool, display, coords, TARGET, TARGET,
NULL, NULL, NULL, NULL, NULL, &vectors))
{
gimp_vector_tool_set_vectors (vector_tool, vectors);
gimp_image_set_active_vectors (image, vectors);
}
vector_tool->function = VECTORS_FINISHED;
}
/* create a new vector from scratch */
if (vector_tool->function == VECTORS_CREATE_VECTOR)
{
vectors = gimp_vectors_new (image, _("Unnamed"));
/* Undo step gets added implicitely */
vector_tool->have_undo = TRUE;
vector_tool->undo_motion = TRUE;
gimp_image_add_vectors (image, vectors,
GIMP_IMAGE_ACTIVE_PARENT, -1, TRUE);
gimp_image_flush (image);
gimp_vector_tool_set_vectors (vector_tool, vectors);
vector_tool->function = VECTORS_CREATE_STROKE;
}
gimp_vectors_freeze (vector_tool->vectors);
/* create a new stroke */
if (vector_tool->function == VECTORS_CREATE_STROKE &&
gimp_vector_tool_check_writable (vector_tool))
{
gimp_vector_tool_undo_push (vector_tool, _("Add Stroke"));
vector_tool->cur_stroke = gimp_bezier_stroke_new ();
gimp_vectors_stroke_add (vector_tool->vectors, vector_tool->cur_stroke);
vector_tool->undo_motion = TRUE;
vector_tool->sel_stroke = vector_tool->cur_stroke;
vector_tool->cur_anchor = NULL;
vector_tool->sel_anchor = NULL;
vector_tool->function = VECTORS_ADD_ANCHOR;
}
/* add an anchor to an existing stroke */
if (vector_tool->function == VECTORS_ADD_ANCHOR &&
gimp_vector_tool_check_writable (vector_tool))
{
GimpCoords position = GIMP_COORDS_DEFAULT_VALUES;
position.x = coords->x;
position.y = coords->y;
gimp_vector_tool_undo_push (vector_tool, _("Add Anchor"));
vector_tool->undo_motion = TRUE;
vector_tool->cur_anchor =
gimp_bezier_stroke_extend (vector_tool->sel_stroke,
&position,
vector_tool->sel_anchor,
EXTEND_EDITABLE);
vector_tool->restriction = GIMP_ANCHOR_FEATURE_SYMMETRIC;
if (! options->polygonal)
vector_tool->function = VECTORS_MOVE_HANDLE;
else
vector_tool->function = VECTORS_MOVE_ANCHOR;
vector_tool->cur_stroke = vector_tool->sel_stroke;
}
/* insertion of an anchor in a curve segment */
if (vector_tool->function == VECTORS_INSERT_ANCHOR &&
gimp_vector_tool_check_writable (vector_tool))
{
gimp_vector_tool_undo_push (vector_tool, _("Insert Anchor"));
vector_tool->undo_motion = TRUE;
vector_tool->cur_anchor =
gimp_stroke_anchor_insert (vector_tool->cur_stroke,
vector_tool->cur_anchor,
vector_tool->cur_position);
if (vector_tool->cur_anchor)
{
if (options->polygonal)
{
gimp_stroke_anchor_convert (vector_tool->cur_stroke,
vector_tool->cur_anchor,
GIMP_ANCHOR_FEATURE_EDGE);
}
vector_tool->function = VECTORS_MOVE_ANCHOR;
}
else
{
vector_tool->function = VECTORS_FINISHED;
}
}
/* move a handle */
if (vector_tool->function == VECTORS_MOVE_HANDLE &&
gimp_vector_tool_check_writable (vector_tool))
{
gimp_vector_tool_undo_push (vector_tool, _("Drag Handle"));
if (vector_tool->cur_anchor->type == GIMP_ANCHOR_ANCHOR)
{
if (! vector_tool->cur_anchor->selected)
{
gimp_vectors_anchor_select (vector_tool->vectors,
vector_tool->cur_stroke,
vector_tool->cur_anchor,
TRUE, TRUE);
vector_tool->undo_motion = TRUE;
}
gimp_draw_tool_on_vectors_handle (GIMP_DRAW_TOOL (tool), display,
vector_tool->vectors, coords,
TARGET, TARGET,
GIMP_ANCHOR_CONTROL, TRUE,
&vector_tool->cur_anchor,
&vector_tool->cur_stroke);
if (! vector_tool->cur_anchor)
vector_tool->function = VECTORS_FINISHED;
}
}
/* move an anchor */
if (vector_tool->function == VECTORS_MOVE_ANCHOR &&
gimp_vector_tool_check_writable (vector_tool))
{
gimp_vector_tool_undo_push (vector_tool, _("Drag Anchor"));
if (! vector_tool->cur_anchor->selected)
{
gimp_vectors_anchor_select (vector_tool->vectors,
vector_tool->cur_stroke,
vector_tool->cur_anchor,
TRUE, TRUE);
vector_tool->undo_motion = TRUE;
}
}
/* move multiple anchors */
if (vector_tool->function == VECTORS_MOVE_ANCHORSET &&
gimp_vector_tool_check_writable (vector_tool))
{
gimp_vector_tool_undo_push (vector_tool, _("Drag Anchors"));
if (state & TOGGLE_MASK)
{
gimp_vectors_anchor_select (vector_tool->vectors,
vector_tool->cur_stroke,
vector_tool->cur_anchor,
!vector_tool->cur_anchor->selected,
FALSE);
vector_tool->undo_motion = TRUE;
if (vector_tool->cur_anchor->selected == FALSE)
vector_tool->function = VECTORS_FINISHED;
}
}
/* move a curve segment directly */
if (vector_tool->function == VECTORS_MOVE_CURVE &&
gimp_vector_tool_check_writable (vector_tool))
{
gimp_vector_tool_undo_push (vector_tool, _("Drag Curve"));
/* the magic numbers are taken from the "feel good" parameter
* from gimp_bezier_stroke_point_move_relative in gimpbezierstroke.c. */
if (vector_tool->cur_position < 5.0 / 6.0)
{
gimp_vectors_anchor_select (vector_tool->vectors,
vector_tool->cur_stroke,
vector_tool->cur_anchor, TRUE, TRUE);
vector_tool->undo_motion = TRUE;
}
if (vector_tool->cur_position > 1.0 / 6.0)
{
gimp_vectors_anchor_select (vector_tool->vectors,
vector_tool->cur_stroke,
vector_tool->cur_anchor2, TRUE,
(vector_tool->cur_position >= 5.0 / 6.0));
vector_tool->undo_motion = TRUE;
}
}
/* connect two strokes */
if (vector_tool->function == VECTORS_CONNECT_STROKES &&
gimp_vector_tool_check_writable (vector_tool))
{
gimp_vector_tool_undo_push (vector_tool, _("Connect Strokes"));
gimp_stroke_connect_stroke (vector_tool->sel_stroke,
vector_tool->sel_anchor,
vector_tool->cur_stroke,
vector_tool->cur_anchor);
vector_tool->undo_motion = TRUE;
if (vector_tool->cur_stroke != vector_tool->sel_stroke &&
gimp_stroke_is_empty (vector_tool->cur_stroke))
{
gimp_vectors_stroke_remove (vector_tool->vectors,
vector_tool->cur_stroke);
}
vector_tool->sel_anchor = vector_tool->cur_anchor;
vector_tool->cur_stroke = vector_tool->sel_stroke;
gimp_vectors_anchor_select (vector_tool->vectors,
vector_tool->sel_stroke,
vector_tool->sel_anchor, TRUE, TRUE);
vector_tool->function = VECTORS_FINISHED;
}
/* move a stroke or all strokes of a vectors object */
if ((vector_tool->function == VECTORS_MOVE_STROKE ||
vector_tool->function == VECTORS_MOVE_VECTORS) &&
gimp_vector_tool_check_writable (vector_tool))
{
gimp_vector_tool_undo_push (vector_tool, _("Drag Path"));
/* Work is being done in gimp_vector_tool_motion ()... */
}
/* convert an anchor to something that looks like an edge */
if (vector_tool->function == VECTORS_CONVERT_EDGE &&
gimp_vector_tool_check_writable (vector_tool))
{
gimp_vector_tool_undo_push (vector_tool, _("Convert Edge"));
gimp_stroke_anchor_convert (vector_tool->cur_stroke,
vector_tool->cur_anchor,
GIMP_ANCHOR_FEATURE_EDGE);
vector_tool->undo_motion = TRUE;
if (vector_tool->cur_anchor->type == GIMP_ANCHOR_ANCHOR)
{
gimp_vectors_anchor_select (vector_tool->vectors,
vector_tool->cur_stroke,
vector_tool->cur_anchor, TRUE, TRUE);
vector_tool->function = VECTORS_MOVE_ANCHOR;
}
else
{
vector_tool->cur_stroke = NULL;
vector_tool->cur_anchor = NULL;
/* avoid doing anything stupid */
vector_tool->function = VECTORS_FINISHED;
}
}
/* removal of a node in a stroke */
if (vector_tool->function == VECTORS_DELETE_ANCHOR &&
gimp_vector_tool_check_writable (vector_tool))
{
gimp_vector_tool_undo_push (vector_tool, _("Delete Anchor"));
gimp_stroke_anchor_delete (vector_tool->cur_stroke,
vector_tool->cur_anchor);
vector_tool->undo_motion = TRUE;
if (gimp_stroke_is_empty (vector_tool->cur_stroke))
gimp_vectors_stroke_remove (vector_tool->vectors,
vector_tool->cur_stroke);
vector_tool->cur_stroke = NULL;
vector_tool->cur_anchor = NULL;
vector_tool->function = VECTORS_FINISHED;
}
/* deleting a segment (opening up a stroke) */
if (vector_tool->function == VECTORS_DELETE_SEGMENT &&
gimp_vector_tool_check_writable (vector_tool))
{
GimpStroke *new_stroke;
gimp_vector_tool_undo_push (vector_tool, _("Delete Segment"));
new_stroke = gimp_stroke_open (vector_tool->cur_stroke,
vector_tool->cur_anchor);
if (new_stroke)
gimp_vectors_stroke_add (vector_tool->vectors, new_stroke);
vector_tool->undo_motion = TRUE;
vector_tool->cur_stroke = NULL;
vector_tool->cur_anchor = NULL;
vector_tool->function = VECTORS_FINISHED;
}
vector_tool->last_x = coords->x;
vector_tool->last_y = coords->y;
gimp_vectors_thaw (vector_tool->vectors);
if (! gimp_draw_tool_is_active (draw_tool))
{
gimp_draw_tool_start (draw_tool, display);
}
gimp_draw_tool_resume (draw_tool);
}
static void
gimp_vector_tool_button_release (GimpTool *tool,
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpButtonReleaseType release_type,
GimpDisplay *display)
{
GimpVectorTool *vector_tool = GIMP_VECTOR_TOOL (tool);
GimpImage *image = gimp_display_get_image (display);
vector_tool->function = VECTORS_FINISHED;
if (vector_tool->have_undo &&
(! vector_tool->undo_motion ||
(release_type == GIMP_BUTTON_RELEASE_CANCEL)))
{
GimpUndo *undo;
GimpUndoAccumulator accum = { 0, };
undo = gimp_undo_stack_pop_undo (gimp_image_get_undo_stack (image),
GIMP_UNDO_MODE_UNDO, &accum);
gimp_image_undo_event (image, GIMP_UNDO_EVENT_UNDO_EXPIRED, undo);
gimp_undo_free (undo, GIMP_UNDO_MODE_UNDO);
g_object_unref (undo);
}
vector_tool->have_undo = FALSE;
vector_tool->undo_motion = FALSE;
gimp_tool_control_halt (tool->control);
gimp_image_flush (image);
}
static void
gimp_vector_tool_motion (GimpTool *tool,
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *display)
{
GimpVectorTool *vector_tool = GIMP_VECTOR_TOOL (tool);
GimpVectorOptions *options = GIMP_VECTOR_TOOL_GET_OPTIONS (tool);
GimpCoords position = GIMP_COORDS_DEFAULT_VALUES;
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
GimpAnchor *anchor;
if (vector_tool->function == VECTORS_FINISHED)
return;
position.x = coords->x;
position.y = coords->y;
gimp_vectors_freeze (vector_tool->vectors);
if ((vector_tool->saved_state & TOGGLE_MASK) != (state & TOGGLE_MASK))
vector_tool->modifier_lock = FALSE;
if (!vector_tool->modifier_lock)
{
if (state & TOGGLE_MASK)
{
vector_tool->restriction = GIMP_ANCHOR_FEATURE_SYMMETRIC;
}
else
{
vector_tool->restriction = GIMP_ANCHOR_FEATURE_NONE;
}
}
switch (vector_tool->function)
{
case VECTORS_MOVE_ANCHOR:
case VECTORS_MOVE_HANDLE:
anchor = vector_tool->cur_anchor;
if (anchor)
{
gimp_stroke_anchor_move_absolute (vector_tool->cur_stroke,
vector_tool->cur_anchor,
&position,
vector_tool->restriction);
vector_tool->undo_motion = TRUE;
}
break;
case VECTORS_MOVE_CURVE:
if (options->polygonal)
{
gimp_vector_tool_move_selected_anchors (vector_tool,
coords->x - vector_tool->last_x,
coords->y - vector_tool->last_y);
vector_tool->undo_motion = TRUE;
}
else
{
gimp_stroke_point_move_absolute (vector_tool->cur_stroke,
vector_tool->cur_anchor,
vector_tool->cur_position,
&position,
vector_tool->restriction);
vector_tool->undo_motion = TRUE;
}
break;
case VECTORS_MOVE_ANCHORSET:
gimp_vector_tool_move_selected_anchors (vector_tool,
coords->x - vector_tool->last_x,
coords->y - vector_tool->last_y);
vector_tool->undo_motion = TRUE;
break;
case VECTORS_MOVE_STROKE:
if (vector_tool->cur_stroke)
{
gimp_stroke_translate (vector_tool->cur_stroke,
coords->x - vector_tool->last_x,
coords->y - vector_tool->last_y);
vector_tool->undo_motion = TRUE;
}
else if (vector_tool->sel_stroke)
{
gimp_stroke_translate (vector_tool->sel_stroke,
coords->x - vector_tool->last_x,
coords->y - vector_tool->last_y);
vector_tool->undo_motion = TRUE;
}
break;
case VECTORS_MOVE_VECTORS:
gimp_item_translate (GIMP_ITEM (vector_tool->vectors),
coords->x - vector_tool->last_x,
coords->y - vector_tool->last_y, FALSE);
vector_tool->undo_motion = TRUE;
break;
default:
break;
}
vector_tool->last_x = coords->x;
vector_tool->last_y = coords->y;
gimp_vectors_thaw (vector_tool->vectors);
}
static gboolean
gimp_vector_tool_key_press (GimpTool *tool,
GdkEventKey *kevent,
GimpDisplay *display)
{
GimpVectorTool *vector_tool = GIMP_VECTOR_TOOL (tool);
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
GimpVectorOptions *options = GIMP_VECTOR_TOOL_GET_OPTIONS (tool);
GimpDisplayShell *shell;
gdouble xdist, ydist;
gdouble pixels = 1.0;
if (! vector_tool->vectors)
return FALSE;
if (display != draw_tool->display)
return FALSE;
shell = gimp_display_get_shell (draw_tool->display);
if (kevent->state & GDK_SHIFT_MASK)
pixels = 10.0;
if (kevent->state & GDK_CONTROL_MASK)
pixels = 50.0;
switch (kevent->keyval)
{
case GDK_Return:
case GDK_KP_Enter:
case GDK_ISO_Enter:
gimp_vector_tool_to_selection_extended (vector_tool, kevent->state);
break;
case GDK_BackSpace:
case GDK_Delete:
gimp_vector_tool_delete_selected_anchors (vector_tool);
break;
case GDK_Left:
case GDK_Right:
case GDK_Up:
case GDK_Down:
xdist = FUNSCALEX (shell, pixels);
ydist = FUNSCALEY (shell, pixels);
gimp_vector_tool_undo_push (vector_tool, _("Move Anchors"));
gimp_vectors_freeze (vector_tool->vectors);
switch (kevent->keyval)
{
case GDK_Left:
gimp_vector_tool_move_selected_anchors (vector_tool, -xdist, 0);
break;
case GDK_Right:
gimp_vector_tool_move_selected_anchors (vector_tool, xdist, 0);
break;
case GDK_Up:
gimp_vector_tool_move_selected_anchors (vector_tool, 0, -ydist);
break;
case GDK_Down:
gimp_vector_tool_move_selected_anchors (vector_tool, 0, ydist);
break;
default:
break;
}
gimp_vectors_thaw (vector_tool->vectors);
vector_tool->have_undo = FALSE;
break;
case GDK_Escape:
if (options->edit_mode != GIMP_VECTOR_MODE_DESIGN)
g_object_set (options, "vectors-edit-mode",
GIMP_VECTOR_MODE_DESIGN, NULL);
break;
default:
return FALSE;
}
gimp_image_flush (gimp_display_get_image (display));
return TRUE;
}
static void
gimp_vector_tool_modifier_key (GimpTool *tool,
GdkModifierType key,
gboolean press,
GdkModifierType state,
GimpDisplay *display)
{
GimpVectorTool *vector_tool = GIMP_VECTOR_TOOL (tool);
GimpVectorOptions *options = GIMP_VECTOR_TOOL_GET_OPTIONS (tool);
if (key == TOGGLE_MASK)
return;
if (key == INSDEL_MASK || key == MOVE_MASK)
{
GimpVectorMode button_mode = options->edit_mode;
if (press)
{
if (key == (state & (INSDEL_MASK | MOVE_MASK)))
{
/* first modifier pressed */
vector_tool->saved_mode = options->edit_mode;
}
}
else
{
if (! (state & (INSDEL_MASK | MOVE_MASK)))
{
/* last modifier released */
button_mode = vector_tool->saved_mode;
}
}
if (state & MOVE_MASK)
{
button_mode = GIMP_VECTOR_MODE_MOVE;
}
else if (state & INSDEL_MASK)
{
button_mode = GIMP_VECTOR_MODE_EDIT;
}
if (button_mode != options->edit_mode)
{
g_object_set (options, "vectors-edit-mode", button_mode, NULL);
}
}
}
static void
gimp_vector_tool_oper_update (GimpTool *tool,
const GimpCoords *coords,
GdkModifierType state,
gboolean proximity,
GimpDisplay *display)
{
GimpVectorTool *vector_tool = GIMP_VECTOR_TOOL (tool);
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
GimpVectorOptions *options = GIMP_VECTOR_TOOL_GET_OPTIONS (tool);
GimpAnchor *anchor = NULL;
GimpAnchor *anchor2 = NULL;
GimpStroke *stroke = NULL;
gdouble position = -1;
gboolean on_handle = FALSE;
gboolean on_curve = FALSE;
gboolean on_vectors = FALSE;
vector_tool->modifier_lock = FALSE;
/* are we hovering the current vectors on the current display? */
if (vector_tool->vectors && GIMP_DRAW_TOOL (tool)->display == display)
{
on_handle = gimp_draw_tool_on_vectors_handle (GIMP_DRAW_TOOL (tool),
display,
vector_tool->vectors,
coords,
TARGET, TARGET,
GIMP_ANCHOR_ANCHOR,
vector_tool->sel_count > 2,
&anchor, &stroke);
if (! on_handle)
on_curve = gimp_draw_tool_on_vectors_curve (GIMP_DRAW_TOOL (tool),
display,
vector_tool->vectors,
coords,
TARGET, TARGET,
NULL,
&position, &anchor,
&anchor2, &stroke);
}
if (on_handle || on_curve)
{
vector_tool->cur_vectors = NULL;
}
else
{
on_vectors = gimp_draw_tool_on_vectors (draw_tool, display, coords,
TARGET, TARGET,
NULL, NULL, NULL, NULL, NULL,
&(vector_tool->cur_vectors));
}
vector_tool->cur_position = position;
vector_tool->cur_anchor = anchor;
vector_tool->cur_anchor2 = anchor2;
vector_tool->cur_stroke = stroke;
switch (options->edit_mode)
{
case GIMP_VECTOR_MODE_DESIGN:
if (! vector_tool->vectors || GIMP_DRAW_TOOL (tool)->display != display)
{
if (on_vectors)
{
vector_tool->function = VECTORS_SELECT_VECTOR;
}
else
{
vector_tool->function = VECTORS_CREATE_VECTOR;
vector_tool->restriction = GIMP_ANCHOR_FEATURE_SYMMETRIC;
vector_tool->modifier_lock = TRUE;
}
}
else if (on_handle)
{
if (anchor->type == GIMP_ANCHOR_ANCHOR)
{
if (state & TOGGLE_MASK)
{
vector_tool->function = VECTORS_MOVE_ANCHORSET;
}
else
{
if (vector_tool->sel_count >= 2 && anchor->selected)
vector_tool->function = VECTORS_MOVE_ANCHORSET;
else
vector_tool->function = VECTORS_MOVE_ANCHOR;
}
}
else
{
vector_tool->function = VECTORS_MOVE_HANDLE;
if (state & TOGGLE_MASK)
vector_tool->restriction = GIMP_ANCHOR_FEATURE_SYMMETRIC;
else
vector_tool->restriction = GIMP_ANCHOR_FEATURE_NONE;
}
}
else if (on_curve)
{
if (gimp_stroke_point_is_movable (stroke, anchor, position))
{
vector_tool->function = VECTORS_MOVE_CURVE;
if (state & TOGGLE_MASK)
vector_tool->restriction = GIMP_ANCHOR_FEATURE_SYMMETRIC;
else
vector_tool->restriction = GIMP_ANCHOR_FEATURE_NONE;
}
else
{
vector_tool->function = VECTORS_FINISHED;
}
}
else
{
if (vector_tool->sel_stroke && vector_tool->sel_anchor &&
gimp_stroke_is_extendable (vector_tool->sel_stroke,
vector_tool->sel_anchor) &&
!(state & TOGGLE_MASK))
vector_tool->function = VECTORS_ADD_ANCHOR;
else
vector_tool->function = VECTORS_CREATE_STROKE;
vector_tool->restriction = GIMP_ANCHOR_FEATURE_SYMMETRIC;
vector_tool->modifier_lock = TRUE;
}
break;
case GIMP_VECTOR_MODE_EDIT:
if (! vector_tool->vectors || GIMP_DRAW_TOOL (tool)->display != display)
{
if (on_vectors)
{
vector_tool->function = VECTORS_SELECT_VECTOR;
}
else
{
vector_tool->function = VECTORS_FINISHED;
}
}
else if (on_handle)
{
if (anchor->type == GIMP_ANCHOR_ANCHOR)
{
if (!(state & TOGGLE_MASK) && vector_tool->sel_anchor &&
vector_tool->sel_anchor != anchor &&
gimp_stroke_is_extendable (vector_tool->sel_stroke,
vector_tool->sel_anchor) &&
gimp_stroke_is_extendable (stroke, anchor))
{
vector_tool->function = VECTORS_CONNECT_STROKES;
}
else
{
if (state & TOGGLE_MASK)
{
vector_tool->function = VECTORS_DELETE_ANCHOR;
}
else
{
if (options->polygonal)
vector_tool->function = VECTORS_MOVE_ANCHOR;
else
vector_tool->function = VECTORS_MOVE_HANDLE;
}
}
}
else
{
if (state & TOGGLE_MASK)
vector_tool->function = VECTORS_CONVERT_EDGE;
else
vector_tool->function = VECTORS_MOVE_HANDLE;
}
}
else if (on_curve)
{
if (state & TOGGLE_MASK)
{
vector_tool->function = VECTORS_DELETE_SEGMENT;
}
else if (gimp_stroke_anchor_is_insertable (stroke, anchor, position))
{
vector_tool->function = VECTORS_INSERT_ANCHOR;
}
else
{
vector_tool->function = VECTORS_FINISHED;
}
}
else
{
vector_tool->function = VECTORS_FINISHED;
}
break;
case GIMP_VECTOR_MODE_MOVE:
if (! vector_tool->vectors || GIMP_DRAW_TOOL (tool)->display != display)
{
if (on_vectors)
{
vector_tool->function = VECTORS_SELECT_VECTOR;
}
else
{
vector_tool->function = VECTORS_FINISHED;
}
}
else if (on_handle || on_curve)
{
if (state & TOGGLE_MASK)
{
vector_tool->function = VECTORS_MOVE_VECTORS;
}
else
{
vector_tool->function = VECTORS_MOVE_STROKE;
}
}
else
{
if (on_vectors)
{
vector_tool->function = VECTORS_SELECT_VECTOR;
}
else
{
vector_tool->function = VECTORS_MOVE_VECTORS;
}
}
break;
}
gimp_vector_tool_status_update (tool, display, state, proximity);
}
static void
gimp_vector_tool_status_update (GimpTool *tool,
GimpDisplay *display,
GdkModifierType state,
gboolean proximity)
{
GimpVectorTool *vector_tool = GIMP_VECTOR_TOOL (tool);
GimpVectorOptions *options = GIMP_VECTOR_TOOL_GET_OPTIONS (tool);
gimp_tool_pop_status (tool, display);
if (proximity)
{
const gchar *status = NULL;
gboolean free_status = FALSE;
switch (vector_tool->function)
{
case VECTORS_SELECT_VECTOR:
status = _("Click to pick path to edit");
break;
case VECTORS_CREATE_VECTOR:
status = _("Click to create a new path");
break;
case VECTORS_CREATE_STROKE:
status = _("Click to create a new component of the path");
break;
case VECTORS_ADD_ANCHOR:
status = gimp_suggest_modifiers (_("Click or Click-Drag to create "
"a new anchor"),
GDK_SHIFT_MASK & ~state,
NULL, NULL, NULL);
free_status = TRUE;
break;
case VECTORS_MOVE_ANCHOR:
if (options->edit_mode != GIMP_VECTOR_MODE_EDIT)
{
status = gimp_suggest_modifiers (_("Click-Drag to move the "
"anchor around"),
GDK_CONTROL_MASK & ~state,
NULL, NULL, NULL);
free_status = TRUE;
}
else
status = _("Click-Drag to move the anchor around");
break;
case VECTORS_MOVE_ANCHORSET:
status = _("Click-Drag to move the anchors around");
break;
case VECTORS_MOVE_HANDLE:
if (vector_tool->restriction != GIMP_ANCHOR_FEATURE_SYMMETRIC)
{
status = gimp_suggest_modifiers (_("Click-Drag to move the "
"handle around"),
GDK_SHIFT_MASK & ~state,
NULL, NULL, NULL);
}
else
{
status = gimp_suggest_modifiers (_("Click-Drag to move the "
"handles around symmetrically"),
GDK_SHIFT_MASK & ~state,
NULL, NULL, NULL);
}
free_status = TRUE;
break;
case VECTORS_MOVE_CURVE:
if (GIMP_VECTOR_TOOL_GET_OPTIONS (tool)->polygonal)
status = gimp_suggest_modifiers (_("Click-Drag to move the "
"anchors around"),
GDK_SHIFT_MASK & ~state,
NULL, NULL, NULL);
else
status = gimp_suggest_modifiers (_("Click-Drag to change the "
"shape of the curve"),
GDK_SHIFT_MASK & ~state,
_("%s: symmetrical"), NULL, NULL);
free_status = TRUE;
break;
case VECTORS_MOVE_STROKE:
status = gimp_suggest_modifiers (_("Click-Drag to move the "
"component around"),
GDK_SHIFT_MASK & ~state,
NULL, NULL, NULL);
free_status = TRUE;
break;
case VECTORS_MOVE_VECTORS:
status = _("Click-Drag to move the path around");
break;
case VECTORS_INSERT_ANCHOR:
status = gimp_suggest_modifiers (_("Click-Drag to insert an anchor "
"on the path"),
GDK_SHIFT_MASK & ~state,
NULL, NULL, NULL);
free_status = TRUE;
break;
case VECTORS_DELETE_ANCHOR:
status = _("Click to delete this anchor");
break;
case VECTORS_CONNECT_STROKES:
status = _("Click to connect this anchor "
"with the selected endpoint");
break;
case VECTORS_DELETE_SEGMENT:
status = _("Click to open up the path");
break;
case VECTORS_CONVERT_EDGE:
status = _("Click to make this node angular");
break;
case VECTORS_FINISHED:
status = NULL;
break;
}
if (status)
bumped minimum required version of GLib to 2.18.0. 2008-11-04 Sven Neumann <sven@sven> * configure.in: bumped minimum required version of GLib to 2.18.0. * INSTALL: document the updated dependency. * app/core/gimp.[ch]: introduced gimp_message_literal(), a variant of gimp_message() that takes a literal string. * app/errors.[ch]: removed format arguments from gimp_fatal_error() and gimp_terminate() and let them take a literal string instead. * app/tools/gimptool.[ch]: introduced gimp_tool_message_literal(), a variant of gimp_tool_message() that takes a literal string. * app/actions/documents-commands.c * app/actions/drawable-commands.c * app/actions/edit-commands.c * app/actions/error-console-commands.c * app/actions/file-commands.c * app/actions/gradients-commands.c * app/actions/image-commands.c * app/actions/layers-commands.c * app/actions/palettes-commands.c * app/actions/plug-in-commands.c * app/actions/select-commands.c * app/actions/vectors-commands.c * app/config/gimprc.c * app/core/gimp-modules.c * app/core/gimp-parasites.c * app/core/gimp-templates.c * app/core/gimp-units.c * app/core/gimpchannel.c * app/core/gimpcontainer-filter.c * app/core/gimpdrawable-bucket-fill.c * app/core/gimpimage-convert.c * app/core/gimpimage-merge.c * app/core/gimpimage.c * app/core/gimpimagefile.c * app/core/gimplayer-floating-sel.c * app/core/gimplayer.c * app/core/gimpselection.c * app/dialogs/convert-dialog.c * app/dialogs/dialogs.c * app/dialogs/palette-import-dialog.c * app/dialogs/preferences-dialog.c * app/dialogs/quit-dialog.c * app/dialogs/stroke-dialog.c * app/display/gimpdisplayshell-dnd.c * app/file/file-open.c * app/file/file-procedure.c * app/file/file-save.c * app/file/file-utils.c * app/gegl/gimpcurvesconfig.c * app/gegl/gimplevelsconfig.c * app/gui/gui-message.c * app/gui/gui.c * app/gui/session.c * app/paint/gimpbrushcore.c * app/paint/gimpclone.c * app/paint/gimpheal.c * app/paint/gimpperspectiveclone.c * app/paint/gimpsourcecore.c * app/pdb/gimppdb-utils.c * app/pdb/gimpprocedure.c * app/plug-in/gimpplugin-message.c * app/plug-in/gimpplugin.c * app/plug-in/gimppluginmanager-restore.c * app/plug-in/gimppluginprocedure.c * app/text/gimptextlayer.c * app/tools/gimp-tools.c * app/tools/gimpaligntool.c * app/tools/gimpblendtool.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcurvestool.c * app/tools/gimpdesaturatetool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpforegroundselecttool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpgegltool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpimagemaptool-settings.c * app/tools/gimpiscissorstool.c * app/tools/gimplevelstool.c * app/tools/gimpmeasuretool.c * app/tools/gimppainttool.c * app/tools/gimpposterizetool.c * app/tools/gimpselectiontool.c * app/tools/gimpsourcetool.c * app/tools/gimpthresholdtool.c * app/tools/gimptransformtool.c * app/tools/gimpvectortool.c * app/widgets/gimpactionview.c * app/widgets/gimpcontrollerlist.c * app/widgets/gimpcontrollers.c * app/widgets/gimpdataeditor.c * app/widgets/gimpdevices.c * app/widgets/gimpdnd-xds.c * app/widgets/gimperrordialog.c * app/widgets/gimphelp.c * app/widgets/gimpitemtreeview.c * app/widgets/gimppdbdialog.c * app/widgets/gimpsettingsbox.c * app/widgets/gimpvectorstreeview.c * app/widgets/gimpwidgets-utils.c * app/xcf/xcf-load.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/floating_sel.pdb * tools/pdbgen/pdb/image.pdb: use the _literal variants for g_set_error(), gimp_message() and gimp_tool_message(). * app/pdb/convert-cmds.c * app/pdb/edit-cmds.c * app/pdb/floating-sel-cmds.c * app/pdb/image-cmds.c: regenerated. svn path=/trunk/; revision=27548
2008-11-04 20:33:09 +08:00
gimp_tool_push_status (tool, display, "%s", status);
if (free_status)
g_free ((gchar *) status);
}
}
static void
gimp_vector_tool_cursor_update (GimpTool *tool,
const GimpCoords *coords,
GdkModifierType state,
GimpDisplay *display)
{
GimpVectorTool *vector_tool = GIMP_VECTOR_TOOL (tool);
GimpToolCursorType tool_cursor = GIMP_TOOL_CURSOR_PATHS;
GimpCursorModifier modifier = GIMP_CURSOR_MODIFIER_NONE;
switch (vector_tool->function)
{
case VECTORS_SELECT_VECTOR:
tool_cursor = GIMP_TOOL_CURSOR_HAND;
break;
case VECTORS_CREATE_VECTOR:
case VECTORS_CREATE_STROKE:
modifier = GIMP_CURSOR_MODIFIER_CONTROL;
break;
case VECTORS_ADD_ANCHOR:
case VECTORS_INSERT_ANCHOR:
tool_cursor = GIMP_TOOL_CURSOR_PATHS_ANCHOR;
modifier = GIMP_CURSOR_MODIFIER_PLUS;
break;
case VECTORS_DELETE_ANCHOR:
tool_cursor = GIMP_TOOL_CURSOR_PATHS_ANCHOR;
modifier = GIMP_CURSOR_MODIFIER_MINUS;
break;
case VECTORS_DELETE_SEGMENT:
tool_cursor = GIMP_TOOL_CURSOR_PATHS_SEGMENT;
modifier = GIMP_CURSOR_MODIFIER_MINUS;
break;
case VECTORS_MOVE_HANDLE:
tool_cursor = GIMP_TOOL_CURSOR_PATHS_CONTROL;
modifier = GIMP_CURSOR_MODIFIER_MOVE;
break;
case VECTORS_CONVERT_EDGE:
tool_cursor = GIMP_TOOL_CURSOR_PATHS_CONTROL;
modifier = GIMP_CURSOR_MODIFIER_MINUS;
break;
case VECTORS_MOVE_ANCHOR:
tool_cursor = GIMP_TOOL_CURSOR_PATHS_ANCHOR;
modifier = GIMP_CURSOR_MODIFIER_MOVE;
break;
case VECTORS_MOVE_CURVE:
tool_cursor = GIMP_TOOL_CURSOR_PATHS_SEGMENT;
modifier = GIMP_CURSOR_MODIFIER_MOVE;
break;
case VECTORS_MOVE_STROKE:
case VECTORS_MOVE_VECTORS:
modifier = GIMP_CURSOR_MODIFIER_MOVE;
break;
case VECTORS_MOVE_ANCHORSET:
tool_cursor = GIMP_TOOL_CURSOR_PATHS_ANCHOR;
modifier = GIMP_CURSOR_MODIFIER_MOVE;
break;
case VECTORS_CONNECT_STROKES:
tool_cursor = GIMP_TOOL_CURSOR_PATHS_SEGMENT;
modifier = GIMP_CURSOR_MODIFIER_JOIN;
break;
default:
modifier = GIMP_CURSOR_MODIFIER_BAD;
break;
}
gimp_tool_control_set_tool_cursor (tool->control, tool_cursor);
gimp_tool_control_set_cursor_modifier (tool->control, modifier);
GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state, display);
}
static void
gimp_vector_tool_draw (GimpDrawTool *draw_tool)
{
GimpVectorTool *vector_tool = GIMP_VECTOR_TOOL (draw_tool);
GimpAnchor *cur_anchor = NULL;
GimpStroke *cur_stroke = NULL;
GimpVectors *vectors;
GArray *coords;
gboolean closed;
GList *draw_anchors;
GList *list;
vectors = vector_tool->vectors;
if (!vectors)
return;
while ((cur_stroke = gimp_vectors_stroke_get_next (vectors, cur_stroke)))
{
/* the stroke itself */
if (! gimp_item_get_visible (GIMP_ITEM (vectors)))
{
coords = gimp_stroke_interpolate (cur_stroke, 1.0, &closed);
if (coords)
{
if (coords->len)
gimp_draw_tool_add_strokes (draw_tool,
&g_array_index (coords,
GimpCoords, 0),
coords->len, FALSE);
g_array_free (coords, TRUE);
}
}
/* anchor handles */
draw_anchors = gimp_stroke_get_draw_anchors (cur_stroke);
for (list = draw_anchors; list; list = g_list_next (list))
{
cur_anchor = GIMP_ANCHOR (list->data);
if (cur_anchor->type == GIMP_ANCHOR_ANCHOR)
{
gimp_draw_tool_add_handle (draw_tool,
cur_anchor->selected ?
GIMP_HANDLE_CIRCLE :
GIMP_HANDLE_FILLED_CIRCLE,
cur_anchor->position.x,
cur_anchor->position.y,
TARGET,
TARGET,
GTK_ANCHOR_CENTER);
}
}
g_list_free (draw_anchors);
if (vector_tool->sel_count <= 2)
{
/* the lines to the control handles */
coords = gimp_stroke_get_draw_lines (cur_stroke);
if (coords)
{
if (coords->len % 2 == 0)
{
gint i;
for (i = 0; i < coords->len; i += 2)
{
GimpCanvasItem *item;
item = gimp_draw_tool_add_line
(draw_tool,
g_array_index (coords, GimpCoords, i).x,
g_array_index (coords, GimpCoords, i).y,
g_array_index (coords, GimpCoords, i + 1).x,
g_array_index (coords, GimpCoords, i + 1).y);
gimp_canvas_item_set_highlight (item, TRUE);
}
}
g_array_free (coords, TRUE);
}
/* control handles */
draw_anchors = gimp_stroke_get_draw_controls (cur_stroke);
for (list = draw_anchors; list; list = g_list_next (list))
{
cur_anchor = GIMP_ANCHOR (list->data);
gimp_draw_tool_add_handle (draw_tool,
GIMP_HANDLE_SQUARE,
cur_anchor->position.x,
cur_anchor->position.y,
TARGET - 3,
TARGET - 3,
GTK_ANCHOR_CENTER);
}
g_list_free (draw_anchors);
}
}
}
static void
gimp_vector_tool_vectors_changed (GimpImage *image,
GimpVectorTool *vector_tool)
{
gimp_vector_tool_set_vectors (vector_tool,
gimp_image_get_active_vectors (image));
}
static void
gimp_vector_tool_vectors_removed (GimpVectors *vectors,
GimpVectorTool *vector_tool)
{
gimp_vector_tool_set_vectors (vector_tool, NULL);
}
static void
gimp_vector_tool_vectors_visible (GimpVectors *vectors,
GimpVectorTool *vector_tool)
{
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (vector_tool);
if (gimp_draw_tool_is_active (draw_tool) && draw_tool->paused_count == 0)
{
GimpStroke *stroke = NULL;
while ((stroke = gimp_vectors_stroke_get_next (vectors, stroke)))
{
GArray *coords;
gboolean closed;
coords = gimp_stroke_interpolate (stroke, 1.0, &closed);
if (coords)
{
if (coords->len)
gimp_draw_tool_add_strokes (draw_tool,
&g_array_index (coords,
GimpCoords, 0),
coords->len, FALSE);
g_array_free (coords, TRUE);
}
}
}
}
static void
gimp_vector_tool_vectors_freeze (GimpVectors *vectors,
GimpVectorTool *vector_tool)
{
gimp_draw_tool_pause (GIMP_DRAW_TOOL (vector_tool));
}
static void
gimp_vector_tool_vectors_thaw (GimpVectors *vectors,
GimpVectorTool *vector_tool)
{
/* Ok, the vector might have changed externally (e.g. Undo)
* we need to validate our internal state. */
gimp_vector_tool_verify_state (vector_tool);
gimp_draw_tool_resume (GIMP_DRAW_TOOL (vector_tool));
}
void
gimp_vector_tool_set_vectors (GimpVectorTool *vector_tool,
GimpVectors *vectors)
{
GimpDrawTool *draw_tool;
GimpTool *tool;
GimpItem *item = NULL;
GimpVectorOptions *options;
g_return_if_fail (GIMP_IS_VECTOR_TOOL (vector_tool));
g_return_if_fail (vectors == NULL || GIMP_IS_VECTORS (vectors));
draw_tool = GIMP_DRAW_TOOL (vector_tool);
tool = GIMP_TOOL (vector_tool);
options = GIMP_VECTOR_TOOL_GET_OPTIONS (vector_tool);
if (vectors)
item = GIMP_ITEM (vectors);
if (vectors == vector_tool->vectors)
return;
gimp_draw_tool_pause (draw_tool);
if (gimp_draw_tool_is_active (draw_tool) &&
(! vectors ||
gimp_display_get_image (draw_tool->display) != gimp_item_get_image (item)))
{
gimp_draw_tool_stop (draw_tool);
}
if (vector_tool->vectors)
{
GimpImage *old_image;
old_image = gimp_item_get_image (GIMP_ITEM (vector_tool->vectors));
g_signal_handlers_disconnect_by_func (old_image,
gimp_vector_tool_vectors_changed,
vector_tool);
g_signal_handlers_disconnect_by_func (vector_tool->vectors,
gimp_vector_tool_vectors_removed,
vector_tool);
g_signal_handlers_disconnect_by_func (vector_tool->vectors,
gimp_vector_tool_vectors_visible,
vector_tool);
g_signal_handlers_disconnect_by_func (vector_tool->vectors,
gimp_vector_tool_vectors_freeze,
vector_tool);
g_signal_handlers_disconnect_by_func (vector_tool->vectors,
gimp_vector_tool_vectors_thaw,
vector_tool);
g_object_unref (vector_tool->vectors);
if (options->to_selection_button)
{
gtk_widget_set_sensitive (options->to_selection_button, FALSE);
g_signal_handlers_disconnect_by_func (options->to_selection_button,
gimp_vector_tool_to_selection,
tool);
g_signal_handlers_disconnect_by_func (options->to_selection_button,
gimp_vector_tool_to_selection_extended,
tool);
}
if (options->stroke_button)
{
gtk_widget_set_sensitive (options->stroke_button, FALSE);
g_signal_handlers_disconnect_by_func (options->stroke_button,
gimp_vector_tool_stroke_vectors,
tool);
}
}
vector_tool->vectors = vectors;
vector_tool->function = VECTORS_FINISHED;
gimp_vector_tool_verify_state (vector_tool);
if (! vector_tool->vectors)
{
tool->display = NULL;
/* leave draw_tool->paused_count in a consistent state */
gimp_draw_tool_resume (draw_tool);
vector_tool->function = VECTORS_CREATE_VECTOR;
return;
}
g_object_ref (vectors);
g_signal_connect_object (gimp_item_get_image (item), "active-vectors-changed",
G_CALLBACK (gimp_vector_tool_vectors_changed),
vector_tool, 0);
g_signal_connect_object (vectors, "removed",
G_CALLBACK (gimp_vector_tool_vectors_removed),
vector_tool, 0);
g_signal_connect_object (vectors, "visibility-changed",
G_CALLBACK (gimp_vector_tool_vectors_visible),
vector_tool, 0);
g_signal_connect_object (vectors, "freeze",
G_CALLBACK (gimp_vector_tool_vectors_freeze),
vector_tool, 0);
g_signal_connect_object (vectors, "thaw",
G_CALLBACK (gimp_vector_tool_vectors_thaw),
vector_tool, 0);
if (options->to_selection_button)
{
g_signal_connect_swapped (options->to_selection_button, "clicked",
G_CALLBACK (gimp_vector_tool_to_selection),
tool);
g_signal_connect_swapped (options->to_selection_button, "extended-clicked",
G_CALLBACK (gimp_vector_tool_to_selection_extended),
tool);
gtk_widget_set_sensitive (options->to_selection_button, TRUE);
}
if (options->stroke_button)
{
g_signal_connect_swapped (options->stroke_button, "clicked",
G_CALLBACK (gimp_vector_tool_stroke_vectors),
tool);
gtk_widget_set_sensitive (options->stroke_button, TRUE);
}
if (! gimp_draw_tool_is_active (draw_tool))
{
if (tool->display &&
gimp_display_get_image (tool->display) == gimp_item_get_image (item))
{
gimp_draw_tool_start (draw_tool, tool->display);
}
else
{
GimpContext *context;
GimpDisplay *display;
context = gimp_get_user_context (tool->tool_info->gimp);
display = gimp_context_get_display (context);
if (! display ||
gimp_display_get_image (display) != gimp_item_get_image (item))
{
GList *list;
display = NULL;
for (list = gimp_get_display_iter (gimp_item_get_image (item)->gimp);
list;
list = g_list_next (list))
{
display = list->data;
if (gimp_display_get_image (display) == gimp_item_get_image (item))
{
gimp_context_set_display (context, display);
break;
}
display = NULL;
}
}
tool->display = display;
if (tool->display)
gimp_draw_tool_start (draw_tool, tool->display);
}
}
gimp_draw_tool_resume (draw_tool);
if (options->edit_mode != GIMP_VECTOR_MODE_DESIGN)
g_object_set (options, "vectors-edit-mode",
GIMP_VECTOR_MODE_DESIGN, NULL);
}
static void
gimp_vector_tool_move_selected_anchors (GimpVectorTool *vector_tool,
gdouble x,
gdouble y)
{
GimpAnchor *cur_anchor;
GimpStroke *cur_stroke = NULL;
GList *anchors;
GList *list;
GimpCoords offset = { 0.0, };
offset.x = x;
offset.y = y;
while ((cur_stroke = gimp_vectors_stroke_get_next (vector_tool->vectors,
cur_stroke)))
{
/* anchors */
anchors = gimp_stroke_get_draw_anchors (cur_stroke);
for (list = anchors; list; list = g_list_next (list))
{
cur_anchor = GIMP_ANCHOR (list->data);
if (cur_anchor->selected)
gimp_stroke_anchor_move_relative (cur_stroke,
cur_anchor,
&offset,
GIMP_ANCHOR_FEATURE_NONE);
}
g_list_free (anchors);
}
}
static void
gimp_vector_tool_delete_selected_anchors (GimpVectorTool *vector_tool)
{
GimpAnchor *cur_anchor;
GimpStroke *cur_stroke = NULL;
GList *anchors;
GList *list;
gboolean have_undo = FALSE;
gimp_draw_tool_pause (GIMP_DRAW_TOOL (vector_tool));
gimp_vectors_freeze (vector_tool->vectors);
while ((cur_stroke = gimp_vectors_stroke_get_next (vector_tool->vectors,
cur_stroke)))
{
/* anchors */
anchors = gimp_stroke_get_draw_anchors (cur_stroke);
for (list = anchors; list; list = g_list_next (list))
{
cur_anchor = GIMP_ANCHOR (list->data);
if (cur_anchor->selected)
{
if (! have_undo)
{
gimp_vector_tool_undo_push (vector_tool, _("Delete Anchors"));
have_undo = TRUE;
}
gimp_stroke_anchor_delete (cur_stroke, cur_anchor);
if (gimp_stroke_is_empty (cur_stroke))
{
gimp_vectors_stroke_remove (vector_tool->vectors, cur_stroke);
cur_stroke = NULL;
}
}
}
g_list_free (anchors);
}
gimp_vectors_thaw (vector_tool->vectors);
gimp_draw_tool_resume (GIMP_DRAW_TOOL (vector_tool));
}
static void
gimp_vector_tool_verify_state (GimpVectorTool *vector_tool)
{
GimpStroke *cur_stroke = NULL;
GimpAnchor *cur_anchor;
GList *anchors;
GList *list;
gboolean cur_anchor_valid;
gboolean cur_stroke_valid;
cur_anchor_valid = FALSE;
cur_stroke_valid = FALSE;
vector_tool->sel_count = 0;
vector_tool->sel_anchor = NULL;
vector_tool->sel_stroke = NULL;
if (! vector_tool->vectors)
{
vector_tool->cur_position = -1;
vector_tool->cur_anchor = NULL;
vector_tool->cur_stroke = NULL;
return;
}
while ((cur_stroke = gimp_vectors_stroke_get_next (vector_tool->vectors,
cur_stroke)))
{
/* anchor handles */
anchors = gimp_stroke_get_draw_anchors (cur_stroke);
if (cur_stroke == vector_tool->cur_stroke)
cur_stroke_valid = TRUE;
for (list = anchors; list; list = g_list_next (list))
{
cur_anchor = GIMP_ANCHOR (list->data);
if (cur_anchor == vector_tool->cur_anchor)
cur_anchor_valid = TRUE;
if (cur_anchor->type == GIMP_ANCHOR_ANCHOR &&
cur_anchor->selected)
{
vector_tool->sel_count++;
if (vector_tool->sel_count == 1)
{
vector_tool->sel_anchor = cur_anchor;
vector_tool->sel_stroke = cur_stroke;
}
else
{
vector_tool->sel_anchor = NULL;
vector_tool->sel_stroke = NULL;
}
}
}
anchors = gimp_stroke_get_draw_controls (cur_stroke);
for (list = anchors; list; list = g_list_next (list))
{
cur_anchor = GIMP_ANCHOR (list->data);
if (cur_anchor == vector_tool->cur_anchor)
cur_anchor_valid = TRUE;
}
}
if (! cur_stroke_valid)
vector_tool->cur_stroke = NULL;
if (! cur_anchor_valid)
vector_tool->cur_anchor = NULL;
}
static void
gimp_vector_tool_undo_push (GimpVectorTool *vector_tool,
const gchar *desc)
{
g_return_if_fail (vector_tool->vectors != NULL);
/* don't push two undos */
if (vector_tool->have_undo)
return;
gimp_image_undo_push_vectors_mod (gimp_item_get_image (GIMP_ITEM (vector_tool->vectors)),
desc, vector_tool->vectors);
vector_tool->have_undo = TRUE;
}
static void
gimp_vector_tool_to_selection (GimpVectorTool *vector_tool)
{
gimp_vector_tool_to_selection_extended (vector_tool, 0);
}
static void
gimp_vector_tool_to_selection_extended (GimpVectorTool *vector_tool,
gint state)
{
GimpImage *image;
GimpChannelOps operation = GIMP_CHANNEL_OP_REPLACE;
if (! vector_tool->vectors)
return;
image = gimp_item_get_image (GIMP_ITEM (vector_tool->vectors));
if (state & GDK_SHIFT_MASK)
{
if (state & GDK_CONTROL_MASK)
operation = GIMP_CHANNEL_OP_INTERSECT;
else
operation = GIMP_CHANNEL_OP_ADD;
}
else if (state & GDK_CONTROL_MASK)
{
operation = GIMP_CHANNEL_OP_SUBTRACT;
}
gimp_item_to_selection (GIMP_ITEM (vector_tool->vectors),
operation,
TRUE, FALSE, 0, 0);
gimp_image_flush (image);
}
static void
gimp_vector_tool_stroke_vectors (GimpVectorTool *vector_tool,
GtkWidget *button)
{
GimpImage *image;
GimpDrawable *active_drawable;
GtkWidget *dialog;
if (! vector_tool->vectors)
return;
image = gimp_item_get_image (GIMP_ITEM (vector_tool->vectors));
active_drawable = gimp_image_get_active_drawable (image);
if (! active_drawable)
{
Added message severities and make sure all messages are routed through a 2006-10-09 Michael Natterer <mitch@gimp.org> Added message severities and make sure all messages are routed through a central function, so redirecting to the error console or stderr work again: * app/core/core-enums.[ch]: added enum GimpMessageSeverity { INFO, WARNING, ERROR }. * app/core/gimp.[ch] (gimp_message) (gimp_message_valist): added severity parameter. Changed "GimpProgress *progress" parameter to "GObject *handler", where "handler" can be either a GimpProgress, a GtkWidget or NULL. * app/core/gimp-gui.[ch] (gimp_show_message): ditto. Honor --console-messages again. Always dispatch to the GUI message handler first if it exists. * app/gui/gui-message.[ch]: pass severity parameters around. (gui_message_error_dialog): if "handler" is a progress, dispatch the message to it first. If it is a widget (and *not* a progress), use a GtkMessageDialog on top of that widget's toplevel. Fall back to the usual GimpErrorDialog otherwise. * app/core/gimpprogress.[ch] (gimp_progress_message): added severity parameter. Also added boolean return value to the virtual function so it can decide to fail if it can't handle the message. * app/display/gimpdisplay.c: implement GimpProgress::message() and redirect the message to GimpDisplayShell. * app/display/gimpdisplayshell-progress.c: implement GimpProgress::message() and redirect the message to GimpStatusbar if it is not an error and if the status bar is visible. * app/display/gimpstatusbar.[ch]: implement GimpProgress::message(), but fail on messages that contain a newline. Show the right icons for the message severities (work in progress). * app/display/gimpdisplayshell.[ch]: removed gimp_display_shell_message() and its _valist() variant. * app/widgets/gimperrorconsole.[ch]: show the right icons for the message severities. * app/widgets/gimpthumbbox.c (gimp_thumb_box_progress_message): return TRUE to swallow all messages. * app/widgets/gimpwidgets-utils.[ch]: removed gimp_show_message_dialog(). Added gimp_get_message_stock_id(). * app/errors.c * app/actions/edit-commands.c * app/actions/error-console-commands.c * app/actions/file-commands.c * app/actions/select-commands.c * app/actions/text-editor-commands.c * app/actions/vectors-commands.c * app/core/gimpimage-convert.c * app/core/gimpimagefile.c * app/dialogs/convert-dialog.c * app/dialogs/file-open-dialog.c * app/dialogs/file-open-location-dialog.c * app/dialogs/file-save-dialog.c * app/dialogs/palette-import-dialog.c * app/dialogs/stroke-dialog.c * app/display/gimpdisplayshell-dnd.c * app/pdb/gimppdb.c * app/plug-in/gimpplugin.c * app/tools/gimpimagemaptool.c * app/tools/gimptool.c * app/tools/gimpvectortool.c * app/widgets/gimpactionview.c * app/widgets/gimpcontrollerlist.c * app/widgets/gimppdbdialog.c * app/widgets/gimpvectorstreeview.c * app/xcf/xcf-load.c * app/xcf/xcf-save.c * app/xcf/xcf.c * tools/pdbgen/pdb/brush.pdb * tools/pdbgen/pdb/gradient.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/message.pdb * tools/pdbgen/pdb/palette.pdb: added severity parameter to gimp_message() calls. Convert all calls to gimp_show_message_dialog() and gimp_display_shell_message() to gimp_message(). Also converted some more g_message() calls. * app/pdb/brush_cmds.c * app/pdb/gradient_cmds.c * app/pdb/image_cmds.c * app/pdb/message_cmds.c * app/pdb/palette_cmds.c: regenerated.
2006-10-09 16:17:22 +08:00
gimp_tool_message (GIMP_TOOL (vector_tool),
GIMP_TOOL (vector_tool)->display,
_("There is no active layer or channel to stroke to"));
return;
}
dialog = stroke_dialog_new (GIMP_ITEM (vector_tool->vectors),
GIMP_CONTEXT (GIMP_TOOL_GET_OPTIONS (vector_tool)),
_("Stroke Path"),
GIMP_STOCK_PATH_STROKE,
GIMP_HELP_PATH_STROKE,
button);
gtk_widget_show (dialog);
}