gimp/app/tools/gimpbucketfilltool.c

961 lines
37 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
*
* 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>
#include <gtk/gtk.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 "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 "config/gimpguiconfig.h"
#include "core/gimp.h"
#include "core/gimpasync.h"
#include "core/gimpcancelable.h"
#include "core/gimpcontainer.h"
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
#include "core/gimpdrawable-bucket-fill.h"
#include "core/gimpdrawable-edit.h"
#include "core/gimpdrawablefilter.h"
#include "core/gimperror.h"
#include "core/gimpfilloptions.h"
#include "core/gimpimage.h"
#include "core/gimpitem.h"
#include "core/gimplineart.h"
#include "core/gimppickable.h"
#include "core/gimppickable-contiguous-region.h"
#include "core/gimpprogress.h"
#include "core/gimpprojection.h"
#include "core/gimptoolinfo.h"
#include "core/gimpwaitable.h"
#include "gegl/gimp-gegl-nodes.h"
#include "operations/layer-modes/gimp-layer-modes.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpwidgets-utils.h"
#include "display/gimpdisplay.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 "gimpbucketfilloptions.h"
#include "gimpbucketfilltool.h"
#include "gimpcoloroptions.h"
#include "gimptoolcontrol.h"
#include "gimptools-utils.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 "gimp-intl.h"
1997-11-25 06:05:25 +08:00
struct _GimpBucketFillToolPrivate
{
GimpLineArt *line_art;
GimpImage *line_art_image;
/* For preview */
GeglNode *graph;
GeglNode *fill_node;
GeglNode *offset_node;
GeglBuffer *fill_mask;
GimpDrawableFilter *filter;
/* Temp property save */
GimpBucketFillMode fill_mode;
app: do not make line art bucket fill a GimpSelectCriterion anymore. This was my initial choice, but the more I think about it, the less I am sure this was the right choice. There was some common code (as I was making a common composite bucket fill once the line art was generated), but there is also a lot of different code and the functions were filled of exception when we were doing a line art fill. Also though there is a bit of color works (the way we decide whether a pixel is part of a stroke or not, though currently this is basic grayscale threshold), this is really not the same as other criterions. In particular this was made obvious on the Select by Color tool where the line art criterion was completely meaningless and would have had to be opted-out! This commit split a bit the code. Instead of finding the line art in the criterion list, I add a third choice to the "Fill whole selection"/"Fill similar colors" radio. In turn I create a new GimpBucketFillArea type with the 3 choices, and remove line art value from GimpSelectCriterion. I am not fully happy yet of this code, as it creates a bit of duplicate code, and I would appreciate to move some code away from gimpdrawable-* and gimppickable-* files. This may happen later. I break the work in pieces to not get too messy. Also this removes access to the smart colorization from the API, but that's probably ok as I prefer to not freeze options too early in the process since API needs to be stable. Probably we should get a concept of experimental API.
2018-12-12 01:05:12 +08:00
GimpBucketFillArea fill_area;
};
/* local function prototypes */
static void gimp_bucket_fill_tool_constructed (GObject *object);
static void gimp_bucket_fill_tool_finalize (GObject *object);
static void gimp_bucket_fill_tool_button_press (GimpTool *tool,
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpButtonPressType press_type,
GimpDisplay *display);
static void gimp_bucket_fill_tool_motion (GimpTool *tool,
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *display);
static void gimp_bucket_fill_tool_button_release (GimpTool *tool,
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpButtonReleaseType release_type,
GimpDisplay *display);
static void gimp_bucket_fill_tool_modifier_key (GimpTool *tool,
GdkModifierType key,
gboolean press,
GdkModifierType state,
GimpDisplay *display);
static void gimp_bucket_fill_tool_cursor_update (GimpTool *tool,
const GimpCoords *coords,
GdkModifierType state,
GimpDisplay *display);
static void gimp_bucket_fill_tool_options_notify (GimpTool *tool,
GimpToolOptions *options,
const GParamSpec *pspec);
static void gimp_bucket_fill_tool_line_art_computing_start (GimpBucketFillTool *tool);
static void gimp_bucket_fill_tool_line_art_computing_end (GimpBucketFillTool *tool);
static void gimp_bucket_fill_tool_start (GimpBucketFillTool *tool,
const GimpCoords *coords,
GimpDisplay *display);
static void gimp_bucket_fill_tool_preview (GimpBucketFillTool *tool,
const GimpCoords *coords,
GimpDisplay *display,
GimpFillOptions *fill_options);
static void gimp_bucket_fill_tool_commit (GimpBucketFillTool *tool);
static void gimp_bucket_fill_tool_halt (GimpBucketFillTool *tool);
static void gimp_bucket_fill_tool_filter_flush (GimpDrawableFilter *filter,
GimpTool *tool);
static void gimp_bucket_fill_tool_create_graph (GimpBucketFillTool *tool);
static void gimp_bucket_fill_tool_reset_line_art (GimpBucketFillTool *tool);
G_DEFINE_TYPE_WITH_PRIVATE (GimpBucketFillTool, gimp_bucket_fill_tool,
GIMP_TYPE_COLOR_TOOL)
#define parent_class gimp_bucket_fill_tool_parent_class
1997-11-25 06:05:25 +08:00
void
2002-03-29 11:50:29 +08:00
gimp_bucket_fill_tool_register (GimpToolRegisterCallback callback,
gpointer data)
{
2002-03-29 11:50:29 +08:00
(* callback) (GIMP_TYPE_BUCKET_FILL_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_BUCKET_FILL_OPTIONS,
gimp_bucket_fill_options_gui,
GIMP_CONTEXT_PROP_MASK_FOREGROUND |
GIMP_CONTEXT_PROP_MASK_BACKGROUND |
GIMP_CONTEXT_PROP_MASK_OPACITY |
GIMP_CONTEXT_PROP_MASK_PAINT_MODE |
GIMP_CONTEXT_PROP_MASK_PATTERN,
./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-bucket-fill-tool",
_("Bucket Fill"),
2006-09-19 02:00:22 +08:00
_("Bucket Fill Tool: Fill selected area with a color or pattern"),
N_("_Bucket Fill"), "<shift>B",
NULL, GIMP_HELP_TOOL_BUCKET_FILL,
GIMP_ICON_TOOL_BUCKET_FILL,
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_bucket_fill_tool_class_init (GimpBucketFillToolClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
object_class->constructed = gimp_bucket_fill_tool_constructed;
object_class->finalize = gimp_bucket_fill_tool_finalize;
tool_class->button_press = gimp_bucket_fill_tool_button_press;
tool_class->motion = gimp_bucket_fill_tool_motion;
tool_class->button_release = gimp_bucket_fill_tool_button_release;
tool_class->modifier_key = gimp_bucket_fill_tool_modifier_key;
tool_class->cursor_update = gimp_bucket_fill_tool_cursor_update;
tool_class->options_notify = gimp_bucket_fill_tool_options_notify;
}
static void
gimp_bucket_fill_tool_init (GimpBucketFillTool *bucket_fill_tool)
{
GimpTool *tool = GIMP_TOOL (bucket_fill_tool);
gimp_tool_control_set_scroll_lock (tool->control, TRUE);
gimp_tool_control_set_wants_click (tool->control, TRUE);
gimp_tool_control_set_tool_cursor (tool->control,
GIMP_TOOL_CURSOR_BUCKET_FILL);
gimp_tool_control_set_action_opacity (tool->control,
"context/context-opacity-set");
gimp_tool_control_set_action_object_1 (tool->control,
"context/context-pattern-select-set");
bucket_fill_tool->priv =
gimp_bucket_fill_tool_get_instance_private (bucket_fill_tool);
}
static void
gimp_bucket_fill_tool_constructed (GObject *object)
{
GimpTool *tool = GIMP_TOOL (object);
GimpBucketFillTool *bucket_tool = GIMP_BUCKET_FILL_TOOL (object);
GimpBucketFillOptions *options = GIMP_BUCKET_FILL_TOOL_GET_OPTIONS (tool);
Gimp *gimp = GIMP_CONTEXT (options)->gimp;
GimpContext *context = gimp_get_user_context (gimp);
GimpLineArt *line_art;
G_OBJECT_CLASS (parent_class)->constructed (object);
gimp_tool_control_set_motion_mode (tool->control,
options->fill_area == GIMP_BUCKET_FILL_LINE_ART ?
GIMP_MOTION_MODE_EXACT : GIMP_MOTION_MODE_COMPRESS);
line_art = gimp_line_art_new ();
g_object_bind_property (options, "fill-transparent",
line_art, "select-transparent",
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
g_object_bind_property (options, "line-art-threshold",
line_art, "threshold",
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
g_object_bind_property (options, "line-art-max-grow",
line_art, "max-grow",
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
g_object_bind_property (options, "line-art-max-gap-length",
line_art, "spline-max-length",
G_BINDING_SYNC_CREATE | G_BINDING_DEFAULT);
g_object_bind_property (options, "line-art-max-gap-length",
line_art, "segment-max-length",
G_BINDING_SYNC_CREATE | G_BINDING_DEFAULT);
g_signal_connect_swapped (line_art, "computing-start",
G_CALLBACK (gimp_bucket_fill_tool_line_art_computing_start),
tool);
g_signal_connect_swapped (line_art, "computing-end",
G_CALLBACK (gimp_bucket_fill_tool_line_art_computing_end),
tool);
gimp_line_art_bind_gap_length (line_art, TRUE);
bucket_tool->priv->line_art = line_art;
gimp_bucket_fill_tool_reset_line_art (bucket_tool);
app: do not make line art bucket fill a GimpSelectCriterion anymore. This was my initial choice, but the more I think about it, the less I am sure this was the right choice. There was some common code (as I was making a common composite bucket fill once the line art was generated), but there is also a lot of different code and the functions were filled of exception when we were doing a line art fill. Also though there is a bit of color works (the way we decide whether a pixel is part of a stroke or not, though currently this is basic grayscale threshold), this is really not the same as other criterions. In particular this was made obvious on the Select by Color tool where the line art criterion was completely meaningless and would have had to be opted-out! This commit split a bit the code. Instead of finding the line art in the criterion list, I add a third choice to the "Fill whole selection"/"Fill similar colors" radio. In turn I create a new GimpBucketFillArea type with the 3 choices, and remove line art value from GimpSelectCriterion. I am not fully happy yet of this code, as it creates a bit of duplicate code, and I would appreciate to move some code away from gimpdrawable-* and gimppickable-* files. This may happen later. I break the work in pieces to not get too messy. Also this removes access to the smart colorization from the API, but that's probably ok as I prefer to not freeze options too early in the process since API needs to be stable. Probably we should get a concept of experimental API.
2018-12-12 01:05:12 +08:00
g_signal_connect_swapped (options, "notify::line-art-source",
G_CALLBACK (gimp_bucket_fill_tool_reset_line_art),
tool);
g_signal_connect_swapped (context, "image-changed",
G_CALLBACK (gimp_bucket_fill_tool_reset_line_art),
tool);
GIMP_COLOR_TOOL (tool)->pick_target =
(options->fill_mode == GIMP_BUCKET_FILL_BG) ?
GIMP_COLOR_PICK_TARGET_BACKGROUND : GIMP_COLOR_PICK_TARGET_FOREGROUND;
}
static void
gimp_bucket_fill_tool_finalize (GObject *object)
{
GimpBucketFillTool *tool = GIMP_BUCKET_FILL_TOOL (object);
GimpBucketFillOptions *options = GIMP_BUCKET_FILL_TOOL_GET_OPTIONS (tool);
Gimp *gimp = GIMP_CONTEXT (options)->gimp;
GimpContext *context = gimp_get_user_context (gimp);
if (tool->priv->line_art_image)
{
g_signal_handlers_disconnect_by_data (gimp_image_get_layers (tool->priv->line_art_image), tool);
g_signal_handlers_disconnect_by_data (tool->priv->line_art_image, tool);
tool->priv->line_art_image = NULL;
}
g_clear_object (&tool->priv->line_art);
g_signal_handlers_disconnect_by_data (options, tool);
g_signal_handlers_disconnect_by_data (context, tool);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
gimp_bucket_fill_tool_start (GimpBucketFillTool *tool,
const GimpCoords *coords,
GimpDisplay *display)
{
GimpBucketFillOptions *options = GIMP_BUCKET_FILL_TOOL_GET_OPTIONS (tool);
GimpContext *context = GIMP_CONTEXT (options);
GimpImage *image = gimp_display_get_image (display);
GimpDrawable *drawable = gimp_image_get_active_drawable (image);
g_return_if_fail (! tool->priv->filter);
gimp_line_art_freeze (tool->priv->line_art);
GIMP_TOOL (tool)->display = display;
GIMP_TOOL (tool)->drawable = drawable;
gimp_bucket_fill_tool_create_graph (tool);
tool->priv->filter = gimp_drawable_filter_new (drawable, _("Bucket fill"),
tool->priv->graph,
GIMP_ICON_TOOL_BUCKET_FILL);
gimp_drawable_filter_set_region (tool->priv->filter,
GIMP_FILTER_REGION_DRAWABLE);
/* We only set these here, and don't need to update it since we assume
* the settings can't change while the fill started.
*/
gimp_drawable_filter_set_mode (tool->priv->filter,
gimp_context_get_paint_mode (context),
GIMP_LAYER_COLOR_SPACE_AUTO,
GIMP_LAYER_COLOR_SPACE_AUTO,
gimp_layer_mode_get_paint_composite_mode (gimp_context_get_paint_mode (context)));
gimp_drawable_filter_set_opacity (tool->priv->filter,
gimp_context_get_opacity (context));
g_signal_connect (tool->priv->filter, "flush",
G_CALLBACK (gimp_bucket_fill_tool_filter_flush),
tool);
}
static void
gimp_bucket_fill_tool_preview (GimpBucketFillTool *tool,
const GimpCoords *coords,
GimpDisplay *display,
GimpFillOptions *fill_options)
{
GimpBucketFillOptions *options = GIMP_BUCKET_FILL_TOOL_GET_OPTIONS (tool);
GimpImage *image = gimp_display_get_image (display);
GimpDrawable *drawable = gimp_image_get_active_drawable (image);
if (tool->priv->filter)
{
GeglBuffer *fill = NULL;
gdouble x = coords->x;
gdouble y = coords->y;
if (options->fill_area == GIMP_BUCKET_FILL_SIMILAR_COLORS)
{
if (! options->sample_merged)
{
gint off_x, off_y;
gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
x -= (gdouble) off_x;
y -= (gdouble) off_y;
}
app: do not make line art bucket fill a GimpSelectCriterion anymore. This was my initial choice, but the more I think about it, the less I am sure this was the right choice. There was some common code (as I was making a common composite bucket fill once the line art was generated), but there is also a lot of different code and the functions were filled of exception when we were doing a line art fill. Also though there is a bit of color works (the way we decide whether a pixel is part of a stroke or not, though currently this is basic grayscale threshold), this is really not the same as other criterions. In particular this was made obvious on the Select by Color tool where the line art criterion was completely meaningless and would have had to be opted-out! This commit split a bit the code. Instead of finding the line art in the criterion list, I add a third choice to the "Fill whole selection"/"Fill similar colors" radio. In turn I create a new GimpBucketFillArea type with the 3 choices, and remove line art value from GimpSelectCriterion. I am not fully happy yet of this code, as it creates a bit of duplicate code, and I would appreciate to move some code away from gimpdrawable-* and gimppickable-* files. This may happen later. I break the work in pieces to not get too messy. Also this removes access to the smart colorization from the API, but that's probably ok as I prefer to not freeze options too early in the process since API needs to be stable. Probably we should get a concept of experimental API.
2018-12-12 01:05:12 +08:00
fill = gimp_drawable_get_bucket_fill_buffer (drawable,
fill_options,
options->fill_transparent,
options->fill_criterion,
options->threshold / 255.0,
options->sample_merged,
options->diagonal_neighbors,
x, y,
&tool->priv->fill_mask,
app: do not make line art bucket fill a GimpSelectCriterion anymore. This was my initial choice, but the more I think about it, the less I am sure this was the right choice. There was some common code (as I was making a common composite bucket fill once the line art was generated), but there is also a lot of different code and the functions were filled of exception when we were doing a line art fill. Also though there is a bit of color works (the way we decide whether a pixel is part of a stroke or not, though currently this is basic grayscale threshold), this is really not the same as other criterions. In particular this was made obvious on the Select by Color tool where the line art criterion was completely meaningless and would have had to be opted-out! This commit split a bit the code. Instead of finding the line art in the criterion list, I add a third choice to the "Fill whole selection"/"Fill similar colors" radio. In turn I create a new GimpBucketFillArea type with the 3 choices, and remove line art value from GimpSelectCriterion. I am not fully happy yet of this code, as it creates a bit of duplicate code, and I would appreciate to move some code away from gimpdrawable-* and gimppickable-* files. This may happen later. I break the work in pieces to not get too messy. Also this removes access to the smart colorization from the API, but that's probably ok as I prefer to not freeze options too early in the process since API needs to be stable. Probably we should get a concept of experimental API.
2018-12-12 01:05:12 +08:00
&x, &y, NULL, NULL);
}
else
{
if (options->line_art_source != GIMP_LINE_ART_SOURCE_SAMPLE_MERGED)
{
gint off_x, off_y;
gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
x -= (gdouble) off_x;
y -= (gdouble) off_y;
}
app: do not make line art bucket fill a GimpSelectCriterion anymore. This was my initial choice, but the more I think about it, the less I am sure this was the right choice. There was some common code (as I was making a common composite bucket fill once the line art was generated), but there is also a lot of different code and the functions were filled of exception when we were doing a line art fill. Also though there is a bit of color works (the way we decide whether a pixel is part of a stroke or not, though currently this is basic grayscale threshold), this is really not the same as other criterions. In particular this was made obvious on the Select by Color tool where the line art criterion was completely meaningless and would have had to be opted-out! This commit split a bit the code. Instead of finding the line art in the criterion list, I add a third choice to the "Fill whole selection"/"Fill similar colors" radio. In turn I create a new GimpBucketFillArea type with the 3 choices, and remove line art value from GimpSelectCriterion. I am not fully happy yet of this code, as it creates a bit of duplicate code, and I would appreciate to move some code away from gimpdrawable-* and gimppickable-* files. This may happen later. I break the work in pieces to not get too messy. Also this removes access to the smart colorization from the API, but that's probably ok as I prefer to not freeze options too early in the process since API needs to be stable. Probably we should get a concept of experimental API.
2018-12-12 01:05:12 +08:00
fill = gimp_drawable_get_line_art_fill_buffer (drawable,
tool->priv->line_art,
fill_options,
options->line_art_source ==
GIMP_LINE_ART_SOURCE_SAMPLE_MERGED,
x, y,
&tool->priv->fill_mask,
app: do not make line art bucket fill a GimpSelectCriterion anymore. This was my initial choice, but the more I think about it, the less I am sure this was the right choice. There was some common code (as I was making a common composite bucket fill once the line art was generated), but there is also a lot of different code and the functions were filled of exception when we were doing a line art fill. Also though there is a bit of color works (the way we decide whether a pixel is part of a stroke or not, though currently this is basic grayscale threshold), this is really not the same as other criterions. In particular this was made obvious on the Select by Color tool where the line art criterion was completely meaningless and would have had to be opted-out! This commit split a bit the code. Instead of finding the line art in the criterion list, I add a third choice to the "Fill whole selection"/"Fill similar colors" radio. In turn I create a new GimpBucketFillArea type with the 3 choices, and remove line art value from GimpSelectCriterion. I am not fully happy yet of this code, as it creates a bit of duplicate code, and I would appreciate to move some code away from gimpdrawable-* and gimppickable-* files. This may happen later. I break the work in pieces to not get too messy. Also this removes access to the smart colorization from the API, but that's probably ok as I prefer to not freeze options too early in the process since API needs to be stable. Probably we should get a concept of experimental API.
2018-12-12 01:05:12 +08:00
&x, &y, NULL, NULL);
}
if (fill)
{
gegl_node_set (tool->priv->fill_node,
"buffer", fill,
NULL);
gegl_node_set (tool->priv->offset_node,
"x", x,
"y", y,
NULL);
gimp_drawable_filter_apply (tool->priv->filter, NULL);
g_object_unref (fill);
}
}
}
static void
gimp_bucket_fill_tool_commit (GimpBucketFillTool *tool)
{
if (tool->priv->filter)
{
gimp_drawable_filter_commit (tool->priv->filter,
GIMP_PROGRESS (tool), FALSE);
gimp_image_flush (gimp_display_get_image (GIMP_TOOL (tool)->display));
}
}
static void
gimp_bucket_fill_tool_halt (GimpBucketFillTool *tool)
{
if (tool->priv->graph)
{
g_clear_object (&tool->priv->graph);
tool->priv->fill_node = NULL;
tool->priv->offset_node = NULL;
}
if (tool->priv->filter)
{
gimp_drawable_filter_abort (tool->priv->filter);
g_clear_object (&tool->priv->filter);
}
g_clear_object (&tool->priv->fill_mask);
gimp_line_art_thaw (tool->priv->line_art);
GIMP_TOOL (tool)->display = NULL;
GIMP_TOOL (tool)->drawable = NULL;
}
static void
gimp_bucket_fill_tool_filter_flush (GimpDrawableFilter *filter,
GimpTool *tool)
{
GimpImage *image = gimp_display_get_image (tool->display);
gimp_projection_flush (gimp_image_get_projection (image));
}
static void
gimp_bucket_fill_tool_create_graph (GimpBucketFillTool *tool)
{
GeglNode *graph;
GeglNode *output;
GeglNode *fill_node;
GeglNode *offset_node;
g_return_if_fail (! tool->priv->graph &&
! tool->priv->fill_node &&
! tool->priv->offset_node);
graph = gegl_node_new ();
fill_node = gegl_node_new_child (graph,
"operation", "gegl:buffer-source",
NULL);
offset_node = gegl_node_new_child (graph,
"operation", "gegl:translate",
NULL);
output = gegl_node_get_output_proxy (graph, "output");
gegl_node_link_many (fill_node, offset_node, output, NULL);
tool->priv->graph = graph;
tool->priv->fill_node = fill_node;
tool->priv->offset_node = offset_node;
}
static void
gimp_bucket_fill_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
{
GimpBucketFillTool *bucket_tool = GIMP_BUCKET_FILL_TOOL (tool);
GimpBucketFillOptions *options = GIMP_BUCKET_FILL_TOOL_GET_OPTIONS (tool);
GimpGuiConfig *config = GIMP_GUI_CONFIG (display->gimp->config);
GimpImage *image = gimp_display_get_image (display);
GimpDrawable *drawable = gimp_image_get_active_drawable (image);
gboolean sample_merged;
if (gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)))
{
GIMP_TOOL_CLASS (parent_class)->button_press (tool, coords, time, state,
press_type, display);
return;
}
if (gimp_viewable_get_children (GIMP_VIEWABLE (drawable)))
{
gimp_tool_message_literal (tool, display,
_("Cannot modify the pixels of layer groups."));
return;
}
if (! gimp_item_is_visible (GIMP_ITEM (drawable)) && ! config->edit_non_visible)
{
gimp_tool_message_literal (tool, display,
_("The active layer is not visible."));
return;
}
if (gimp_item_is_content_locked (GIMP_ITEM (drawable)))
{
gimp_tool_message_literal (tool, display,
_("The active layer's pixels are locked."));
gimp_tools_blink_lock_box (display->gimp, GIMP_ITEM (drawable));
return;
}
if (options->fill_area == GIMP_BUCKET_FILL_LINE_ART &&
! gimp_line_art_get_input (bucket_tool->priv->line_art))
{
gimp_tool_message_literal (tool, display,
_("No valid line art source selected."));
return;
}
sample_merged = (options->fill_area == GIMP_BUCKET_FILL_LINE_ART ?
options->line_art_source == GIMP_LINE_ART_SOURCE_SAMPLE_MERGED :
options->sample_merged);
if (press_type == GIMP_BUTTON_PRESS_NORMAL &&
gimp_image_coords_in_active_pickable (image, coords, sample_merged, TRUE))
1997-11-25 06:05:25 +08:00
{
GimpContext *context = GIMP_CONTEXT (options);
GimpFillOptions *fill_options;
GError *error = NULL;
fill_options = gimp_fill_options_new (image->gimp, NULL, FALSE);
if (gimp_fill_options_set_by_fill_mode (fill_options, context,
options->fill_mode,
&error))
{
gimp_fill_options_set_antialias (fill_options, options->antialias);
gimp_fill_options_set_feather (fill_options, options->feather,
options->feather_radius);
gimp_context_set_opacity (GIMP_CONTEXT (fill_options),
gimp_context_get_opacity (context));
gimp_context_set_paint_mode (GIMP_CONTEXT (fill_options),
gimp_context_get_paint_mode (context));
app: do not make line art bucket fill a GimpSelectCriterion anymore. This was my initial choice, but the more I think about it, the less I am sure this was the right choice. There was some common code (as I was making a common composite bucket fill once the line art was generated), but there is also a lot of different code and the functions were filled of exception when we were doing a line art fill. Also though there is a bit of color works (the way we decide whether a pixel is part of a stroke or not, though currently this is basic grayscale threshold), this is really not the same as other criterions. In particular this was made obvious on the Select by Color tool where the line art criterion was completely meaningless and would have had to be opted-out! This commit split a bit the code. Instead of finding the line art in the criterion list, I add a third choice to the "Fill whole selection"/"Fill similar colors" radio. In turn I create a new GimpBucketFillArea type with the 3 choices, and remove line art value from GimpSelectCriterion. I am not fully happy yet of this code, as it creates a bit of duplicate code, and I would appreciate to move some code away from gimpdrawable-* and gimppickable-* files. This may happen later. I break the work in pieces to not get too messy. Also this removes access to the smart colorization from the API, but that's probably ok as I prefer to not freeze options too early in the process since API needs to be stable. Probably we should get a concept of experimental API.
2018-12-12 01:05:12 +08:00
if (options->fill_area == GIMP_BUCKET_FILL_SELECTION)
{
gimp_drawable_edit_fill (drawable, fill_options, NULL);
gimp_image_flush (image);
}
else /* GIMP_BUCKET_FILL_SIMILAR_COLORS || GIMP_BUCKET_FILL_LINE_ART */
{
gimp_bucket_fill_tool_start (bucket_tool, coords, display);
gimp_bucket_fill_tool_preview (bucket_tool, coords, display,
fill_options);
}
}
else
{
gimp_message_literal (display->gimp, G_OBJECT (display),
GIMP_MESSAGE_WARNING, error->message);
g_clear_error (&error);
}
g_object_unref (fill_options);
}
GIMP_TOOL_CLASS (parent_class)->button_press (tool, coords, time, state,
press_type, display);
}
static void
gimp_bucket_fill_tool_motion (GimpTool *tool,
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *display)
{
GimpBucketFillTool *bucket_tool = GIMP_BUCKET_FILL_TOOL (tool);
GimpBucketFillOptions *options = GIMP_BUCKET_FILL_TOOL_GET_OPTIONS (tool);
GimpImage *image = gimp_display_get_image (display);
gboolean sample_merged;
GIMP_TOOL_CLASS (parent_class)->motion (tool, coords, time, state, display);
if (gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)))
return;
sample_merged = (options->fill_area == GIMP_BUCKET_FILL_LINE_ART ?
options->line_art_source == GIMP_LINE_ART_SOURCE_SAMPLE_MERGED :
options->sample_merged);
if (gimp_image_coords_in_active_pickable (image, coords, sample_merged, TRUE) &&
/* Fill selection only needs to happen once. */
app: do not make line art bucket fill a GimpSelectCriterion anymore. This was my initial choice, but the more I think about it, the less I am sure this was the right choice. There was some common code (as I was making a common composite bucket fill once the line art was generated), but there is also a lot of different code and the functions were filled of exception when we were doing a line art fill. Also though there is a bit of color works (the way we decide whether a pixel is part of a stroke or not, though currently this is basic grayscale threshold), this is really not the same as other criterions. In particular this was made obvious on the Select by Color tool where the line art criterion was completely meaningless and would have had to be opted-out! This commit split a bit the code. Instead of finding the line art in the criterion list, I add a third choice to the "Fill whole selection"/"Fill similar colors" radio. In turn I create a new GimpBucketFillArea type with the 3 choices, and remove line art value from GimpSelectCriterion. I am not fully happy yet of this code, as it creates a bit of duplicate code, and I would appreciate to move some code away from gimpdrawable-* and gimppickable-* files. This may happen later. I break the work in pieces to not get too messy. Also this removes access to the smart colorization from the API, but that's probably ok as I prefer to not freeze options too early in the process since API needs to be stable. Probably we should get a concept of experimental API.
2018-12-12 01:05:12 +08:00
options->fill_area != GIMP_BUCKET_FILL_SELECTION)
{
GimpContext *context = GIMP_CONTEXT (options);
GimpFillOptions *fill_options;
GError *error = NULL;
fill_options = gimp_fill_options_new (image->gimp, NULL, FALSE);
if (gimp_fill_options_set_by_fill_mode (fill_options, context,
options->fill_mode,
&error))
{
gimp_fill_options_set_antialias (fill_options, options->antialias);
gimp_fill_options_set_feather (fill_options, options->feather,
options->feather_radius);
gimp_context_set_opacity (GIMP_CONTEXT (fill_options),
gimp_context_get_opacity (context));
gimp_context_set_paint_mode (GIMP_CONTEXT (fill_options),
gimp_context_get_paint_mode (context));
gimp_bucket_fill_tool_preview (bucket_tool, coords, display,
fill_options);
}
else
{
gimp_message_literal (display->gimp, G_OBJECT (display),
GIMP_MESSAGE_WARNING, error->message);
g_clear_error (&error);
}
g_object_unref (fill_options);
1997-11-25 06:05:25 +08:00
}
}
static void
gimp_bucket_fill_tool_button_release (GimpTool *tool,
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpButtonReleaseType release_type,
GimpDisplay *display)
{
app: do not make line art bucket fill a GimpSelectCriterion anymore. This was my initial choice, but the more I think about it, the less I am sure this was the right choice. There was some common code (as I was making a common composite bucket fill once the line art was generated), but there is also a lot of different code and the functions were filled of exception when we were doing a line art fill. Also though there is a bit of color works (the way we decide whether a pixel is part of a stroke or not, though currently this is basic grayscale threshold), this is really not the same as other criterions. In particular this was made obvious on the Select by Color tool where the line art criterion was completely meaningless and would have had to be opted-out! This commit split a bit the code. Instead of finding the line art in the criterion list, I add a third choice to the "Fill whole selection"/"Fill similar colors" radio. In turn I create a new GimpBucketFillArea type with the 3 choices, and remove line art value from GimpSelectCriterion. I am not fully happy yet of this code, as it creates a bit of duplicate code, and I would appreciate to move some code away from gimpdrawable-* and gimppickable-* files. This may happen later. I break the work in pieces to not get too messy. Also this removes access to the smart colorization from the API, but that's probably ok as I prefer to not freeze options too early in the process since API needs to be stable. Probably we should get a concept of experimental API.
2018-12-12 01:05:12 +08:00
GimpBucketFillTool *bucket_tool = GIMP_BUCKET_FILL_TOOL (tool);
GimpBucketFillOptions *options = GIMP_BUCKET_FILL_TOOL_GET_OPTIONS (tool);
if (gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)))
{
GIMP_TOOL_CLASS (parent_class)->button_release (tool, coords, time,
state, release_type,
display);
return;
}
app: do not make line art bucket fill a GimpSelectCriterion anymore. This was my initial choice, but the more I think about it, the less I am sure this was the right choice. There was some common code (as I was making a common composite bucket fill once the line art was generated), but there is also a lot of different code and the functions were filled of exception when we were doing a line art fill. Also though there is a bit of color works (the way we decide whether a pixel is part of a stroke or not, though currently this is basic grayscale threshold), this is really not the same as other criterions. In particular this was made obvious on the Select by Color tool where the line art criterion was completely meaningless and would have had to be opted-out! This commit split a bit the code. Instead of finding the line art in the criterion list, I add a third choice to the "Fill whole selection"/"Fill similar colors" radio. In turn I create a new GimpBucketFillArea type with the 3 choices, and remove line art value from GimpSelectCriterion. I am not fully happy yet of this code, as it creates a bit of duplicate code, and I would appreciate to move some code away from gimpdrawable-* and gimppickable-* files. This may happen later. I break the work in pieces to not get too messy. Also this removes access to the smart colorization from the API, but that's probably ok as I prefer to not freeze options too early in the process since API needs to be stable. Probably we should get a concept of experimental API.
2018-12-12 01:05:12 +08:00
if (release_type != GIMP_BUTTON_RELEASE_CANCEL)
gimp_bucket_fill_tool_commit (bucket_tool);
app: do not make line art bucket fill a GimpSelectCriterion anymore. This was my initial choice, but the more I think about it, the less I am sure this was the right choice. There was some common code (as I was making a common composite bucket fill once the line art was generated), but there is also a lot of different code and the functions were filled of exception when we were doing a line art fill. Also though there is a bit of color works (the way we decide whether a pixel is part of a stroke or not, though currently this is basic grayscale threshold), this is really not the same as other criterions. In particular this was made obvious on the Select by Color tool where the line art criterion was completely meaningless and would have had to be opted-out! This commit split a bit the code. Instead of finding the line art in the criterion list, I add a third choice to the "Fill whole selection"/"Fill similar colors" radio. In turn I create a new GimpBucketFillArea type with the 3 choices, and remove line art value from GimpSelectCriterion. I am not fully happy yet of this code, as it creates a bit of duplicate code, and I would appreciate to move some code away from gimpdrawable-* and gimppickable-* files. This may happen later. I break the work in pieces to not get too messy. Also this removes access to the smart colorization from the API, but that's probably ok as I prefer to not freeze options too early in the process since API needs to be stable. Probably we should get a concept of experimental API.
2018-12-12 01:05:12 +08:00
if (options->fill_area != GIMP_BUCKET_FILL_SELECTION)
gimp_bucket_fill_tool_halt (bucket_tool);
1997-11-25 06:05:25 +08:00
GIMP_TOOL_CLASS (parent_class)->button_release (tool, coords, time, state,
release_type, display);
1997-11-25 06:05:25 +08:00
}
static void
build display/ before tools/. 2001-11-08 Michael Natterer <mitch@gimp.org> * app/Makefile.am: build display/ before tools/. * app/devices.c: devices_check_change(): added all events which have a GdkDevice pointer. * app/gimpprogress.c: include "display-types.h" instead of "core-types.h". * app/core/Makefile.am * app/core/gimpdrawable-bucket-fill.[ch]: new files: the bucket_fill stuff taken from tools/gimpbucketfilltool.[ch]. * app/core/core-types.h: added "BucketFillMode". * app/core/gimpimage-mask-select.[ch]: cleanup. * app/core/gimpmarshal.list: added more marshallers for GimpTool's new signal signatures. * app/core/gimpmarshal.[ch]: regenerated. * app/display/Makefile.am * app/display/gimpdisplayshell-dnd.[ch] * app/display/gimpdisplayshell-layer-select.[ch]: new files: the canvas drop callbacks from gimpdisplayshell-callbacks.[ch] and the stuff formerly knows as gui/layer-select.[ch]. * app/display/gimpdisplay.h: don't include "gui/gui-types.h". * app/display/gximage.c: include "display-types.h". * app/display/gimpdisplay-foreach.c * app/display/gimpdisplayshell.[ch]: call gdsplay_delete(), don't destroy the shell widget. * app/gui/Makefile.am * app/gui/layer-select.[ch]: removed. * app/gui/gradients-commands.c: fixed "Save as POV" fprintf()s. * app/gui/preferences-dialog.c: removed the layer_select stuff because it is useless with the new preview system. * app/gui/tool-options-dialog.c: send the correct data to the close_callback. * app/gui/tools-commands.c: changed to follow the new gimp_tool_initialize() semantics (see below). Tool & canvas event handling chainsawing: * app/tools/tools-types.h: new struct GimpCoords which contains x, y, pressure, tilt etc. * app/display/gimpdisplayshell-callbacks.[ch]: added utility functions which transparently retreive the current event's GimpCoords or take it from the device directly if the event has none. Pass GimpCoords _in_image_coordinates_ to all tool functions. Most important: don't pass GdkEvents and display coordinates to tools any more. * app/tools/gimptool.[ch]: changed virtual functions to take GimpCoords, time and state separately instead of GdkEvents. * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.[ch] * app/tools/gimpbycolorselecttool.c * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpconvolvetool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpcurvestool.c * app/tools/gimpdodgeburntool.c * app/tools/gimpdrawtool.c * app/tools/gimpeditselectiontool.[ch] * app/tools/gimperasertool.c * app/tools/gimpfliptool.c * app/tools/gimpfreeselecttool.[ch] * app/tools/gimpfuzzyselecttool.c * app/tools/gimpinktool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c * app/tools/gimppathtool.[ch] * app/tools/gimprectselecttool.c * app/tools/gimprotatetool.c * app/tools/gimpselectiontool.[ch] * app/tools/gimpsmudgetool.c * app/tools/gimptexttool.c * app/tools/gimptransformtool.[ch] * app/tools/path_tool.[ch] * app/tools/selection_options.c: tons and tons of changes: - changed to use the new virtual function parameters. - removed zillions of gdisplay_untransform_coords(). - get the active drawable's offsets manually in many cases. (questionable, but IMHO ok because it's obvious and not simply a "TRUE" passed to some function) - reordered some functions to be consistent across tools. - some tools had to be changed to work on image coords, not display ones (esp. crop). - fixed strange rotate tool behaviour which should be backported to stable. - some stuff i came across. - indentation and other paranoia. - rounding of coordinated may be broken in some tools. - new bugs guaranteed. * app/tools/tool_manager.[ch]: new semantic of tool_manager_initialize_active() (looked at the places where it was used from and put common code together). Should be a bit better now :) * app/tools/gimpblendtool.c * app/tools/transform_options.c: use the new GTK+ feature that a widget (toggle button) can be a frame's title for this tools' tool options. * app/widgets/widgets-types.h: stuff. * themes/Default/gtkrc: s/GtkDialog/GimpDialog/. * tools/pdbgen/Makefile.am: don't scan tools/gimpbucketfilltool.h any more. * tools/pdbgen/enums.pl: regenerated. * tools/pdbgen/pdb/tools.pdb: changed bucket_fill wrapper. * app/pdb/tools_cmds.c: regenerated.
2001-11-09 03:14:51 +08:00
gimp_bucket_fill_tool_modifier_key (GimpTool *tool,
GdkModifierType key,
gboolean press,
GdkModifierType state,
GimpDisplay *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
{
GimpBucketFillOptions *options = GIMP_BUCKET_FILL_TOOL_GET_OPTIONS (tool);
if (key == GDK_MOD1_MASK)
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
{
if (press)
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_BUCKET_FILL_TOOL (tool)->priv->fill_mode = options->fill_mode;
switch (options->fill_mode)
{
case GIMP_BUCKET_FILL_FG:
g_object_set (options, "fill-mode", GIMP_BUCKET_FILL_BG, NULL);
break;
Added object properties for almost all tool_options values and registered 2003-02-07 Michael Natterer <mitch@gimp.org> Added object properties for almost all tool_options values and registered lots of enums with the type system: Part I (enum and type cleanup): * app/core/core-enums.[ch] * app/core/core-types.h: removed InternalOrientaionType and register GimpOrientationType. Register GimpChannelOps. Removed GimpToolOptionsGUIFunc. * app/xcf/xcf-private.h: added XcfOrientationType with the same values as the old InternalOrientationType * app/xcf/xcf-load.c * app/xcf/xcf-save.c: translate between GimpOrientationType and XcfOrientationType. * app/core/gimpdrawable-transform-utils.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-crop.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-guides.c * app/core/gimpimage-resize.c * app/core/gimpimage-scale.c * app/core/gimpimage.h * app/display/gimpdisplayshell.c * tools/pdbgen/stddefs.pdb * tools/pdbgen/pdb/transform_tools.pdb: changed accordingly. * app/pdb/guides_cmds.c * app/pdb/transform_tools_cmds.c * libgimp/gimpenums.h * libgimpproxy/gimpproxytypes.h * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: regenerated. * libgimptool/gimptoolenums.[ch]: added GimpTransformGridType. * libgimptool/gimptooltypes.h: removed GimpToolOptionsResetFunc, added GimpToolOptionsGUIFunc. Part II (tool options changes): * app/config/gimpconfig-utils.c (gimp_config_reset_properties): don't reset object properties because they have NULL as default value. * app/widgets/gimppropwidgets.[ch]: added gimp_prop_[enum|boolean]_radio_frame_new(), gimp_prop_paint_mode_menu_new() and gimp_prop_scale_entry_new(), which are all needed by the new tool options GUI code. * app/tools/tool_options.[ch]: removed the "reset_func" since the virtual reset() method is used now. * app/paint/gimpairbrushoptions.[ch] * app/paint/gimpcloneoptions.[ch] * app/paint/gimpconvolveoptions.[ch] * app/paint/gimpdodgeburnoptions.[ch] * app/paint/gimperaseroptions.[ch] * app/paint/gimppaintoptions.[ch] * app/paint/gimpsmudgeoptions.[ch]: added properties all over the place and removed the widget and default_value members from the structs. Renamed some values (e.g. s/type/clone_type/). Don't #include <gtk/gtk.h>. * 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/gimppencil.c * app/paint/gimpsmudge.c * app/paint/paint-types.h * app/paint/paint.c: changed accordingly. Don't #include <gtk/gtk.h>. * tools/pdbgen/pdb/paint_tools.pdb: changed accordingly. * app/pdb/paint_tools_cmds.c: regenerated. * app/tools/gimpblendoptions.[ch] * app/tools/gimpbucketfilloptions.[ch] * app/tools/gimpcolorpickeroptions.[ch] * app/tools/gimpcropoptions.[ch] * app/tools/gimpflipoptions.[ch] * app/tools/gimpinkoptions.c * app/tools/gimpmagnifyoptions.[ch] * app/tools/gimpmeasureoptions.[ch] * app/tools/gimpmoveoptions.[ch] * app/tools/gimptextoptions.c * app/tools/paint_options.[ch] * app/tools/selection_options.[ch] * app/tools/transform_options.[ch]: ditto: added properties and removed widget and default_value stuff. Removed most reset functions. Use gimp_prop widgets all over the place, renamed some values as above. * app/tools/Makefile.am * app/tools/gimpairbrushtool.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpclonetool.c * app/tools/gimpconvolvetool.c * app/tools/gimpcroptool.c * app/tools/gimpdodgeburntool.c * app/tools/gimperasertool.c * app/tools/gimpfliptool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmovetool.c * app/tools/gimpselectiontool.c * app/tools/gimpsheartool.c * app/tools/gimpsmudgetool.c * app/tools/gimptransformtool.c * app/tools/gimpvectoroptions.c: changed accordingly. Ported the paint_options GUI constructors to gimp_prop widgets. * app/widgets/gimpselectioneditor.c * app/gui/tool-options-dialog.c: changed accordingly.
2003-02-08 01:12:21 +08:00
default:
/* GIMP_BUCKET_FILL_BG || GIMP_BUCKET_FILL_PATTERN */
g_object_set (options, "fill-mode", GIMP_BUCKET_FILL_FG, NULL);
break;
Added object properties for almost all tool_options values and registered 2003-02-07 Michael Natterer <mitch@gimp.org> Added object properties for almost all tool_options values and registered lots of enums with the type system: Part I (enum and type cleanup): * app/core/core-enums.[ch] * app/core/core-types.h: removed InternalOrientaionType and register GimpOrientationType. Register GimpChannelOps. Removed GimpToolOptionsGUIFunc. * app/xcf/xcf-private.h: added XcfOrientationType with the same values as the old InternalOrientationType * app/xcf/xcf-load.c * app/xcf/xcf-save.c: translate between GimpOrientationType and XcfOrientationType. * app/core/gimpdrawable-transform-utils.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-crop.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-guides.c * app/core/gimpimage-resize.c * app/core/gimpimage-scale.c * app/core/gimpimage.h * app/display/gimpdisplayshell.c * tools/pdbgen/stddefs.pdb * tools/pdbgen/pdb/transform_tools.pdb: changed accordingly. * app/pdb/guides_cmds.c * app/pdb/transform_tools_cmds.c * libgimp/gimpenums.h * libgimpproxy/gimpproxytypes.h * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: regenerated. * libgimptool/gimptoolenums.[ch]: added GimpTransformGridType. * libgimptool/gimptooltypes.h: removed GimpToolOptionsResetFunc, added GimpToolOptionsGUIFunc. Part II (tool options changes): * app/config/gimpconfig-utils.c (gimp_config_reset_properties): don't reset object properties because they have NULL as default value. * app/widgets/gimppropwidgets.[ch]: added gimp_prop_[enum|boolean]_radio_frame_new(), gimp_prop_paint_mode_menu_new() and gimp_prop_scale_entry_new(), which are all needed by the new tool options GUI code. * app/tools/tool_options.[ch]: removed the "reset_func" since the virtual reset() method is used now. * app/paint/gimpairbrushoptions.[ch] * app/paint/gimpcloneoptions.[ch] * app/paint/gimpconvolveoptions.[ch] * app/paint/gimpdodgeburnoptions.[ch] * app/paint/gimperaseroptions.[ch] * app/paint/gimppaintoptions.[ch] * app/paint/gimpsmudgeoptions.[ch]: added properties all over the place and removed the widget and default_value members from the structs. Renamed some values (e.g. s/type/clone_type/). Don't #include <gtk/gtk.h>. * 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/gimppencil.c * app/paint/gimpsmudge.c * app/paint/paint-types.h * app/paint/paint.c: changed accordingly. Don't #include <gtk/gtk.h>. * tools/pdbgen/pdb/paint_tools.pdb: changed accordingly. * app/pdb/paint_tools_cmds.c: regenerated. * app/tools/gimpblendoptions.[ch] * app/tools/gimpbucketfilloptions.[ch] * app/tools/gimpcolorpickeroptions.[ch] * app/tools/gimpcropoptions.[ch] * app/tools/gimpflipoptions.[ch] * app/tools/gimpinkoptions.c * app/tools/gimpmagnifyoptions.[ch] * app/tools/gimpmeasureoptions.[ch] * app/tools/gimpmoveoptions.[ch] * app/tools/gimptextoptions.c * app/tools/paint_options.[ch] * app/tools/selection_options.[ch] * app/tools/transform_options.[ch]: ditto: added properties and removed widget and default_value stuff. Removed most reset functions. Use gimp_prop widgets all over the place, renamed some values as above. * app/tools/Makefile.am * app/tools/gimpairbrushtool.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpclonetool.c * app/tools/gimpconvolvetool.c * app/tools/gimpcroptool.c * app/tools/gimpdodgeburntool.c * app/tools/gimperasertool.c * app/tools/gimpfliptool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmovetool.c * app/tools/gimpselectiontool.c * app/tools/gimpsheartool.c * app/tools/gimpsmudgetool.c * app/tools/gimptransformtool.c * app/tools/gimpvectoroptions.c: changed accordingly. Ported the paint_options GUI constructors to gimp_prop widgets. * app/widgets/gimpselectioneditor.c * app/gui/tool-options-dialog.c: changed accordingly.
2003-02-08 01:12:21 +08:00
break;
}
}
else /* release */
{
g_object_set (options, "fill-mode",
GIMP_BUCKET_FILL_TOOL (tool)->priv->fill_mode,
NULL);
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
}
}
else if (key == gimp_get_toggle_behavior_mask ())
{
GimpToolInfo *info = gimp_get_tool_info (display->gimp,
"gimp-color-picker-tool");
if (! gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)))
{
switch (GIMP_COLOR_TOOL (tool)->pick_target)
{
case GIMP_COLOR_PICK_TARGET_BACKGROUND:
gimp_tool_push_status (tool, display,
_("Click in any image to pick the "
"background color"));
break;
case GIMP_COLOR_PICK_TARGET_FOREGROUND:
default:
gimp_tool_push_status (tool, display,
_("Click in any image to pick the "
"foreground color"));
break;
}
GIMP_TOOL (tool)->display = display;
gimp_color_tool_enable (GIMP_COLOR_TOOL (tool),
GIMP_COLOR_OPTIONS (info->tool_options));
}
else
{
gimp_tool_pop_status (tool, display);
gimp_color_tool_disable (GIMP_COLOR_TOOL (tool));
GIMP_TOOL (tool)->display = NULL;
}
}
else if (key == gimp_get_extend_selection_mask ())
{
app: do not make line art bucket fill a GimpSelectCriterion anymore. This was my initial choice, but the more I think about it, the less I am sure this was the right choice. There was some common code (as I was making a common composite bucket fill once the line art was generated), but there is also a lot of different code and the functions were filled of exception when we were doing a line art fill. Also though there is a bit of color works (the way we decide whether a pixel is part of a stroke or not, though currently this is basic grayscale threshold), this is really not the same as other criterions. In particular this was made obvious on the Select by Color tool where the line art criterion was completely meaningless and would have had to be opted-out! This commit split a bit the code. Instead of finding the line art in the criterion list, I add a third choice to the "Fill whole selection"/"Fill similar colors" radio. In turn I create a new GimpBucketFillArea type with the 3 choices, and remove line art value from GimpSelectCriterion. I am not fully happy yet of this code, as it creates a bit of duplicate code, and I would appreciate to move some code away from gimpdrawable-* and gimppickable-* files. This may happen later. I break the work in pieces to not get too messy. Also this removes access to the smart colorization from the API, but that's probably ok as I prefer to not freeze options too early in the process since API needs to be stable. Probably we should get a concept of experimental API.
2018-12-12 01:05:12 +08:00
if (press)
{
GIMP_BUCKET_FILL_TOOL (tool)->priv->fill_area = options->fill_area;
app: do not make line art bucket fill a GimpSelectCriterion anymore. This was my initial choice, but the more I think about it, the less I am sure this was the right choice. There was some common code (as I was making a common composite bucket fill once the line art was generated), but there is also a lot of different code and the functions were filled of exception when we were doing a line art fill. Also though there is a bit of color works (the way we decide whether a pixel is part of a stroke or not, though currently this is basic grayscale threshold), this is really not the same as other criterions. In particular this was made obvious on the Select by Color tool where the line art criterion was completely meaningless and would have had to be opted-out! This commit split a bit the code. Instead of finding the line art in the criterion list, I add a third choice to the "Fill whole selection"/"Fill similar colors" radio. In turn I create a new GimpBucketFillArea type with the 3 choices, and remove line art value from GimpSelectCriterion. I am not fully happy yet of this code, as it creates a bit of duplicate code, and I would appreciate to move some code away from gimpdrawable-* and gimppickable-* files. This may happen later. I break the work in pieces to not get too messy. Also this removes access to the smart colorization from the API, but that's probably ok as I prefer to not freeze options too early in the process since API needs to be stable. Probably we should get a concept of experimental API.
2018-12-12 01:05:12 +08:00
switch (options->fill_area)
{
case GIMP_BUCKET_FILL_SIMILAR_COLORS:
g_object_set (options,
"fill-area", GIMP_BUCKET_FILL_SELECTION,
NULL);
app: do not make line art bucket fill a GimpSelectCriterion anymore. This was my initial choice, but the more I think about it, the less I am sure this was the right choice. There was some common code (as I was making a common composite bucket fill once the line art was generated), but there is also a lot of different code and the functions were filled of exception when we were doing a line art fill. Also though there is a bit of color works (the way we decide whether a pixel is part of a stroke or not, though currently this is basic grayscale threshold), this is really not the same as other criterions. In particular this was made obvious on the Select by Color tool where the line art criterion was completely meaningless and would have had to be opted-out! This commit split a bit the code. Instead of finding the line art in the criterion list, I add a third choice to the "Fill whole selection"/"Fill similar colors" radio. In turn I create a new GimpBucketFillArea type with the 3 choices, and remove line art value from GimpSelectCriterion. I am not fully happy yet of this code, as it creates a bit of duplicate code, and I would appreciate to move some code away from gimpdrawable-* and gimppickable-* files. This may happen later. I break the work in pieces to not get too messy. Also this removes access to the smart colorization from the API, but that's probably ok as I prefer to not freeze options too early in the process since API needs to be stable. Probably we should get a concept of experimental API.
2018-12-12 01:05:12 +08:00
break;
default:
/* GIMP_BUCKET_FILL_SELECTION || GIMP_BUCKET_FILL_LINE_ART */
g_object_set (options,
"fill-area", GIMP_BUCKET_FILL_SIMILAR_COLORS,
NULL);
app: do not make line art bucket fill a GimpSelectCriterion anymore. This was my initial choice, but the more I think about it, the less I am sure this was the right choice. There was some common code (as I was making a common composite bucket fill once the line art was generated), but there is also a lot of different code and the functions were filled of exception when we were doing a line art fill. Also though there is a bit of color works (the way we decide whether a pixel is part of a stroke or not, though currently this is basic grayscale threshold), this is really not the same as other criterions. In particular this was made obvious on the Select by Color tool where the line art criterion was completely meaningless and would have had to be opted-out! This commit split a bit the code. Instead of finding the line art in the criterion list, I add a third choice to the "Fill whole selection"/"Fill similar colors" radio. In turn I create a new GimpBucketFillArea type with the 3 choices, and remove line art value from GimpSelectCriterion. I am not fully happy yet of this code, as it creates a bit of duplicate code, and I would appreciate to move some code away from gimpdrawable-* and gimppickable-* files. This may happen later. I break the work in pieces to not get too messy. Also this removes access to the smart colorization from the API, but that's probably ok as I prefer to not freeze options too early in the process since API needs to be stable. Probably we should get a concept of experimental API.
2018-12-12 01:05:12 +08:00
break;
}
}
else /* release */
{
g_object_set (options, "fill-area",
GIMP_BUCKET_FILL_TOOL (tool)->priv->fill_area,
NULL);
}
}
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
}
static void
gimp_bucket_fill_tool_cursor_update (GimpTool *tool,
const GimpCoords *coords,
GdkModifierType state,
GimpDisplay *display)
1997-11-25 06:05:25 +08:00
{
GimpBucketFillOptions *options = GIMP_BUCKET_FILL_TOOL_GET_OPTIONS (tool);
GimpGuiConfig *config = GIMP_GUI_CONFIG (display->gimp->config);
GimpCursorModifier modifier = GIMP_CURSOR_MODIFIER_BAD;
GimpImage *image = gimp_display_get_image (display);
gboolean sample_merged;
1997-11-25 06:05:25 +08:00
sample_merged = (options->fill_area == GIMP_BUCKET_FILL_LINE_ART ?
options->line_art_source == GIMP_LINE_ART_SOURCE_SAMPLE_MERGED :
options->sample_merged);
if (gimp_image_coords_in_active_pickable (image, coords, sample_merged, TRUE))
{
GimpDrawable *drawable = gimp_image_get_active_drawable (image);
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_item_is_content_locked (GIMP_ITEM (drawable)) &&
(gimp_item_is_visible (GIMP_ITEM (drawable)) || config->edit_non_visible))
{
switch (options->fill_mode)
{
case GIMP_BUCKET_FILL_FG:
modifier = GIMP_CURSOR_MODIFIER_FOREGROUND;
break;
case GIMP_BUCKET_FILL_BG:
modifier = GIMP_CURSOR_MODIFIER_BACKGROUND;
break;
case GIMP_BUCKET_FILL_PATTERN:
modifier = GIMP_CURSOR_MODIFIER_PATTERN;
break;
}
removed gimp_drawable_offsets(). 2003-05-08 Michael Natterer <mitch@gimp.org> * app/core/gimpdrawable.[ch]: removed gimp_drawable_offsets(). * app/core/gimpitem.[ch]: added gimp_item_offsets(). * app/core/gimpdrawable-blend.c * app/core/gimpdrawable-bucket-fill.c * app/core/gimpdrawable-histogram.c * app/core/gimpedit.c * app/core/gimpimage-convert.c * app/core/gimpimage-crop.c * app/core/gimpimage-mask-select.c * app/core/gimpimage-mask.c * app/core/gimpimage-merge.c * app/core/gimpimage-pick-color.c * app/core/gimpimage-preview.c * app/core/gimpimage-projection.c * app/core/gimpimage-undo-push.c * app/core/gimpimage.c * app/core/gimplayer-floating-sel.c * app/core/gimplayer.c * app/display/gimpdisplay.c * app/display/gimpdisplayshell-transform.c * app/display/gimpdisplayshell.c * app/gui/channels-commands.c * app/gui/layers-commands.c * app/paint/gimppaintcore.c * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpfliptool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpinktool.c * app/tools/gimplevelstool.c * app/tools/gimppainttool.c * app/tools/gimprectselecttool.c * app/tools/gimptransformtool.c * app/widgets/gimpselectioneditor.c * app/widgets/gimptoolbox.c * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/drawable.pdb: changed accordingly. * app/pdb/color_cmds.c * app/pdb/drawable_cmds.c: regenerated.
2003-05-08 22:06:03 +08:00
}
}
gimp_tool_control_set_cursor_modifier (tool->control, modifier);
added fields for both the tool's toggled and untoggled GdkCursorType, 2002-02-04 Michael Natterer <mitch@gimp.org> * app/tools/gimptool.[ch]: added fields for both the tool's toggled and untoggled GdkCursorType, GimpToolCursorType and GimpCursorModifier. Added a default implementation of gimp_tool_cursor_update() which uses the new fields. Added gimp_tool_set_cursor() as simple wrapper around the resp. GimpDisplayShell functions so tools don't need to know them. Tool implementations can either set the new fields in their cursor_update() function and chain up or call the new wrapper. * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpconvolvetool.c * app/tools/gimpcroptool.c * app/tools/gimpdodgeburntool.c * app/tools/gimperasertool.c * app/tools/gimpfliptool.c * app/tools/gimpinktool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimpselectiontool.c * app/tools/gimpsmudgetool.c * app/tools/gimptexttool.c * app/tools/gimptransformtool.c: changed accordingly: - set default values in the tools' instance_init functions. - changed the cursor_update() stuff. - removed inclusion of subclasses in gimppainttool.c - the cursor_update() functions are better than before but still evil. - i probably broke some of them...
2002-02-05 01:43:01 +08:00
GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state, display);
1997-11-25 06:05:25 +08:00
}
static void
gimp_bucket_fill_tool_options_notify (GimpTool *tool,
GimpToolOptions *options,
const GParamSpec *pspec)
{
GimpBucketFillTool *bucket_tool = GIMP_BUCKET_FILL_TOOL (tool);
GimpBucketFillOptions *bucket_options = GIMP_BUCKET_FILL_OPTIONS (options);
GIMP_TOOL_CLASS (parent_class)->options_notify (tool, options, pspec);
if (! strcmp (pspec->name, "fill-area"))
{
/* We want more motion events when the tool is used in a paint tool
* fashion. Unfortunately we only set exact mode in line art fill,
* because we can't as easily remove events from the similar color
* mode just because a point has already been selected (unless
* threshold were 0, but that's an edge case).
*/
gimp_tool_control_set_motion_mode (tool->control,
bucket_options->fill_area == GIMP_BUCKET_FILL_LINE_ART ?
GIMP_MOTION_MODE_EXACT : GIMP_MOTION_MODE_COMPRESS);
gimp_bucket_fill_tool_reset_line_art (bucket_tool);
}
else if (! strcmp (pspec->name, "fill-mode"))
{
if (gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)))
gimp_tool_pop_status (tool, tool->display);
switch (bucket_options->fill_mode)
{
case GIMP_BUCKET_FILL_BG:
GIMP_COLOR_TOOL (tool)->pick_target = GIMP_COLOR_PICK_TARGET_BACKGROUND;
if (gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)))
gimp_tool_push_status (tool, tool->display,
_("Click in any image to pick the "
"background color"));
break;
case GIMP_BUCKET_FILL_FG:
default:
GIMP_COLOR_TOOL (tool)->pick_target = GIMP_COLOR_PICK_TARGET_FOREGROUND;
if (gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)))
gimp_tool_push_status (tool, tool->display,
_("Click in any image to pick the "
"foreground color"));
break;
}
}
}
static void
gimp_bucket_fill_tool_line_art_computing_start (GimpBucketFillTool *tool)
{
GimpBucketFillOptions *options = GIMP_BUCKET_FILL_TOOL_GET_OPTIONS (tool);
gtk_widget_show (options->line_art_busy_box);
}
static void
gimp_bucket_fill_tool_line_art_computing_end (GimpBucketFillTool *tool)
{
GimpBucketFillOptions *options = GIMP_BUCKET_FILL_TOOL_GET_OPTIONS (tool);
gtk_widget_hide (options->line_art_busy_box);
}
static void
gimp_bucket_fill_tool_reset_line_art (GimpBucketFillTool *tool)
{
GimpBucketFillOptions *options = GIMP_BUCKET_FILL_TOOL_GET_OPTIONS (tool);
GimpLineArt *line_art = tool->priv->line_art;
GimpImage *image = NULL;
if (options && options->fill_area == GIMP_BUCKET_FILL_LINE_ART)
{
GimpContext *context;
context = gimp_get_user_context (GIMP_CONTEXT (options)->gimp);
image = gimp_context_get_image (context);
}
if (image != tool->priv->line_art_image)
{
if (tool->priv->line_art_image)
{
g_signal_handlers_disconnect_by_data (gimp_image_get_layers (tool->priv->line_art_image), tool);
g_signal_handlers_disconnect_by_data (tool->priv->line_art_image, tool);
}
tool->priv->line_art_image = image;
if (image)
{
g_signal_connect_swapped (image, "active-layer-changed",
G_CALLBACK (gimp_bucket_fill_tool_reset_line_art),
tool);
g_signal_connect_swapped (image, "active-channel-changed",
G_CALLBACK (gimp_bucket_fill_tool_reset_line_art),
tool);
g_signal_connect_swapped (gimp_image_get_layers (image), "add",
G_CALLBACK (gimp_bucket_fill_tool_reset_line_art),
tool);
g_signal_connect_swapped (gimp_image_get_layers (image), "remove",
G_CALLBACK (gimp_bucket_fill_tool_reset_line_art),
tool);
g_signal_connect_swapped (gimp_image_get_layers (image), "reorder",
G_CALLBACK (gimp_bucket_fill_tool_reset_line_art),
tool);
}
}
if (image)
{
GimpDrawable *drawable = gimp_image_get_active_drawable (image);
if (gimp_viewable_get_children (GIMP_VIEWABLE (drawable)))
drawable = NULL;
if (options->line_art_source == GIMP_LINE_ART_SOURCE_SAMPLE_MERGED)
{
gimp_line_art_set_input (line_art, GIMP_PICKABLE (image));
}
else if (drawable)
{
GimpItem *parent;
GimpContainer *container;
GimpObject *neighbour = NULL;
GimpPickable *source = NULL;
gint index;
parent = gimp_item_get_parent (GIMP_ITEM (drawable));
if (parent)
container = gimp_viewable_get_children (GIMP_VIEWABLE (parent));
else
container = gimp_image_get_layers (image);
index = gimp_item_get_index (GIMP_ITEM (drawable));
if (options->line_art_source == GIMP_LINE_ART_SOURCE_ACTIVE_LAYER)
source = GIMP_PICKABLE (drawable);
else if (options->line_art_source == GIMP_LINE_ART_SOURCE_LOWER_LAYER)
neighbour = gimp_container_get_child_by_index (container, index + 1);
else if (options->line_art_source == GIMP_LINE_ART_SOURCE_UPPER_LAYER)
neighbour = gimp_container_get_child_by_index (container, index - 1);
source = neighbour ? GIMP_PICKABLE (neighbour) : source;
gimp_line_art_set_input (line_art, source);
}
else
{
gimp_line_art_set_input (line_art, NULL);
}
}
else
{
gimp_line_art_set_input (line_art, NULL);
}
}