gimp/app/core/gimp-edit.c

665 lines
20 KiB
C
Raw Normal View History

1997-11-25 06:05:25 +08:00
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1997-11-25 06:05:25 +08:00
*/
#include "config.h"
1997-11-25 06:05:25 +08:00
#include <stdlib.h>
an evil temp_hack which lets GimpContext managing the active display 2001-08-14 Michael Natterer <mitch@gimp.org> * app/gdisplay.h: an evil temp_hack which lets GimpContext managing the active display withoug including "gdisplay.h". Will go away as soon ad context properties are registered dynamically. * app/module_db.c: cleaned up the object code in preparation of moving it to core/. * app/path.c: connect to GimpImage's * app/core/gimpobject.[ch]: derive it from GObject, not from GtkObject any more (yeah :-) * app/core/*.c: #include <glib-object.h> instead of <gtk/gtk.h>, removed some remaining GtkObject-isms. (left in a few #include <gtk/gtk.h> where bigger changes are needed to get rid of the UI dependency). * app/core/core-types.h: #include <gdk-pixbuf/gdk-pixbuf.h> here temporarily. * app/core/gimp.c (gimp_create_display): unref the image after creating it's first display. * app/core/gimpbrush.[ch]: disabled the parts of the code which depend on GimpPaintTool. * app/core/gimpbrushgenerated.c * app/core/gimpbrushpipe.c: changed accordingly. * app/core/gimpcontext.[ch]: evil hack (see above) to manage the active display without including "gdisplay.h" * app/core/gimpimage-mask.[ch]: pass a context to gimage_mask_stroke() and get the current tool's PDB string from there. * app/core/gimpedit.c: changed accordingly. * app/core/gimpimage.c: use gimp_image_update() instead of gdisplays_update_full(). * app/gui/color-area.c * app/gui/colormap-dialog.c * app/gui/dialogs-constructors.c * app/gui/edit-commands.c * app/gui/image-commands.c * app/gui/toolbox.c: changed accordingly (don't use Gtk methods on GObjects). * app/gui/menus.c: fix some const warnings by explicit casting. * app/tools/*.[ch]: ported all tools to GObject, some minor cleanup while i was on it. * app/widgets/gimpdialogfactory.[ch]: ported to GObject. * app/widgets/gimplayerlistview.h: added FOO_GET_CLASS() macro. * tools/pdbgen/app.pl: added a "widgets_eek" hack like "tools_eek" which inserts #include "widgets/widgets-types.h" before ordinary includes. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/edit.pdb * app/pdb/brush_select_cmds.c * app/pdb/edit_cmds.c: changed according to the stuff above.
2001-08-14 22:53:55 +08:00
#include <glib-object.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
app/core/Makefile.am app/core/core-types.h added an "application object" 2001-07-04 Michael Natterer <mitch@gimp.org> * app/core/Makefile.am * app/core/core-types.h * app/core/gimp.[ch]: added an "application object" called Gimp. Currently, it contains the image list, the clipboard, the data factories, the procedural hashtable and the tool info list. It's the toplevel object of the core object system. Finally, creating a Gimp object will return a standalone gimp core engine instance with no other global states/variables involved. * app/app_procs.[ch]: allocate a "Gimp" instance called "the_gimp" :) Removed stuff which is now done by the "Gimp" object. Merged gimp_init() into app_init() because gimp_init() is taken now. * app/context_manager.[ch]: removed stuff done by "Gimp". * app/batch.[ch] * app/gimage.[ch] * app/xcf/xcf-load.[ch] * app/xcf/xcf.[ch] * app/core/gimpedit.[ch] * app/tools/tool_manager.[ch]: pass around an additional "Gimp" argument. * app/pdb/procedural_db.[ch]: pass a "Gimp" pointer as first parameter to all internal procedures and to all procedural_db_* functions. * app/core/gimpcontext.[ch] * app/core/gimpimage.[ch]: added a "Gimp" pointer to the structs. * app/devices.c * app/errors.c * app/file-open.c * app/file-save.c * app/gimphelp.c * app/gimpunit.c * app/image_new.c * app/main.c * app/nav_window.c * app/plug_in.c * app/base/base.c * app/core/gimpdatafactory.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-mask.c * app/core/gimptoolinfo.[ch] * app/gui/brush-select.c * app/gui/convert-dialog.c * app/gui/dialogs-constructors.c * app/gui/edit-commands.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/gradient-select.c * app/gui/gui.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/menus.c * app/gui/palette-editor.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/paths-dialog.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/test-commands.c * app/gui/toolbox.c * app/gui/tools-commands.c * app/tools/gimpbezierselecttool.c * app/tools/gimpbucketfilltool.c * app/tools/gimppainttool.h * app/tools/gimptexttool.c * app/tools/gimptransformtool.h * app/widgets/gimpbufferview.c * app/widgets/gimpcontainerview-utils.c * app/widgets/gimpcursor.c * app/widgets/gimpdnd.c * app/widgets/gimpimagedock.c: changed accordingly. Cleaned up lots of includes. Many files still access the global "the_gimp" variable exported by app_procs.h. * tools/pdbgen/app.pl * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/fileops.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/palette.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb * tools/pdbgen/pdb/procedural_db.pdb: changed accordingly. Don't use "the_gimp" here because all procedures get passed a "Gimp" pointer now. * app/pdb/*: regenerated.
2001-07-05 03:31:35 +08:00
#include "core-types.h"
new directory app/base/ 2001-05-15 Michael Natterer <mitch@gimp.org> * configure.in: new directory app/base/ * app/Makefile.am * app/boundary.[ch] * app/brush_scale.[ch] * app/gimpchecks.h * app/gimplut.[ch] * app/pixel_processor.[ch] * app/pixel_region.[ch] * app/pixel_surround.[ch] * app/temp_buf.[ch] * app/tile.[ch] * app/tile_cache.[ch] * app/tile_manager.[ch] * app/tile_manager_pvt.h * app/tile_pvt.h * app/tile_swap.[ch]: moved to base/ * app/base/Makefile.am * app/base/base-types.h * app/base/*: new directory for the sub-object pixel maniplation and storage stuff. Does not include Gtk+ or anything outside base/. Did some cleanup in all files. * app/appenums.h * app/apptypes.h * app/core/gimpimage.h: removed types which are now in base/base-types.h. * app/base/base-config.[ch] * app/gimprc.[ch]: put the config variables for base/ to their own file so base/ doesn not have to include gimprc.h (does not yet work, i.e. the variables are un-configurable right now) * app/main.c: set a log handler for "Gimp-Base". * app/paint-funcs/Makefile.am * app/paint-funcs/paint-funcs.[ch]: removed the color hash which maps RGB to color indices because it's a totally standalone system which has nothing to do with the paint-funcs and introduced a GimpImage dependency. paint-funcs/ should be considered on the same sub-object (glib-only) level as base/, only in a different directory. * app/core/Makefile.am * app/core/gimpimage-colorhash.[ch]: put the color hash here. * app/gimage.c: don't invalidate the color hash here... * app/core/gimpimage.c: ... but in the colormap_changed() default inplementation. Initialize the hash in class_init(). * tools/pdbgen/Makefile.am: scan app/base/base-types.h for enums. * tools/pdbgen/enums.pl: regenerated. * app/[lots] * app/core/[of] * app/gui/[files] * app/pdb/[all] * app/tools/[over] * app/widgets/[the] * tools/pdbgen/pdb/[place]: changed #includes accordingly. And use base_config->value instead of the stuff from gimprc.h.
2001-05-15 19:25:25 +08:00
#include "base/pixel-region.h"
Enabled skipping enum values for either the PDB or GType registration 2004-01-06 Michael Natterer <mitch@gimp.org> Enabled skipping enum values for either the PDB or GType registration (don't always skip both targets): * tools/gimp-mkenums: skip enum values only if there is a literal "skip" (don't match "pdb-skip"). * tools/pdbgen/enumgen.pl: skip only "pdb-skip" values, not "skip" ones. * app/base/base-enums.h * app/core/core-enums.h * app/paint/paint-enums.h * libgimpbase/gimpbaseenums.h: use the right "pdb-skip"/"skip" combination to skip enum values. Changed comments accordingly. Cleaned up the fill functions: * app/core/core-enums.[ch]: added GIMP_PATTERN_FILL enum value to the GimpFillType enum. Don't export GIMP_NO_FILL to the PDB because it's completely useless to export a NOP. * app/core/gimp-edit.c (gimp_edit_fill, gimp_edit_fill_internal): handle pattern fill requests. * app/core/gimpdrawable.[ch] (gimp_drawable_fill): added GimpPattern parameter and fill with it if it's non-NULL. (gimp_drawable_fill_by_type): handle pattern fill and pass the current pattern to gimp_drawable_fill(). * app/text/gimptextlayer.c: changed accordingly. * app/gui/edit-commands.c * app/gui/image-menu.c: use gimp_edit_fill() instead of gimp_drawable_bucket_fill() for FG, BG and pattern filling. * libgimp/gimpcompat.h * plug-ins/script-fu/siod-wrapper.c: removed NO_IMAGE_FILL compat enum value. It should have never been exported to the PDB. * app/pdb/drawable_cmds.c * app/pdb/edit_cmds.c * libgimp/gimpenums.h * plug-ins/pygimp/gimpenums.py * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: regenerated.
2004-01-06 22:02:08 +08:00
#include "base/temp-buf.h"
new directory app/base/ 2001-05-15 Michael Natterer <mitch@gimp.org> * configure.in: new directory app/base/ * app/Makefile.am * app/boundary.[ch] * app/brush_scale.[ch] * app/gimpchecks.h * app/gimplut.[ch] * app/pixel_processor.[ch] * app/pixel_region.[ch] * app/pixel_surround.[ch] * app/temp_buf.[ch] * app/tile.[ch] * app/tile_cache.[ch] * app/tile_manager.[ch] * app/tile_manager_pvt.h * app/tile_pvt.h * app/tile_swap.[ch]: moved to base/ * app/base/Makefile.am * app/base/base-types.h * app/base/*: new directory for the sub-object pixel maniplation and storage stuff. Does not include Gtk+ or anything outside base/. Did some cleanup in all files. * app/appenums.h * app/apptypes.h * app/core/gimpimage.h: removed types which are now in base/base-types.h. * app/base/base-config.[ch] * app/gimprc.[ch]: put the config variables for base/ to their own file so base/ doesn not have to include gimprc.h (does not yet work, i.e. the variables are un-configurable right now) * app/main.c: set a log handler for "Gimp-Base". * app/paint-funcs/Makefile.am * app/paint-funcs/paint-funcs.[ch]: removed the color hash which maps RGB to color indices because it's a totally standalone system which has nothing to do with the paint-funcs and introduced a GimpImage dependency. paint-funcs/ should be considered on the same sub-object (glib-only) level as base/, only in a different directory. * app/core/Makefile.am * app/core/gimpimage-colorhash.[ch]: put the color hash here. * app/gimage.c: don't invalidate the color hash here... * app/core/gimpimage.c: ... but in the colormap_changed() default inplementation. Initialize the hash in class_init(). * tools/pdbgen/Makefile.am: scan app/base/base-types.h for enums. * tools/pdbgen/enums.pl: regenerated. * app/[lots] * app/core/[of] * app/gui/[files] * app/pdb/[all] * app/tools/[over] * app/widgets/[the] * tools/pdbgen/pdb/[place]: changed #includes accordingly. And use base_config->value instead of the stuff from gimprc.h.
2001-05-15 19:25:25 +08:00
#include "base/tile-manager.h"
app/Makefile.am removed. 2001-06-26 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/color_transfer.[ch]: removed. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.[ch]: added. * app/tools/gimpcolorbalancetool.c: changed accordingly. * app/base/Makefile.am * app/base/tile-manager-crop.[ch]: formerly known as crop_buffer(). * app/tools/gimptexttool.c: changed accordingly. * app/context_manager.[ch]: added the global clipboard and the named buffer list here. * app/app_procs.c: don't call color_transfer_init() and don't free the buffer stuff (done by the context manager now). * app/errorconsole.c: don't #include "gui/commands.h" * app/global_edit.[ch]: removed lots of stuff which is now done by gui/edit-commands.* or the new GimpBuffer object. The "paste named" dialog will go away and this file will be moved to core/ soon. * app/image_new.c: no need to declare the global_buffer extern any more. * app/qmask.c: don't #include "global_edit.h" * app/core/Makefile.am * app/core/core-types.h * app/core/gimpbuffer.[ch]: new object (aka named buffer) * app/core/gimpcontext.[ch]: added a GimpBuffer attribute. * app/core/gimpimage.[ch]: one s/int/gboolean/. * app/core/gimppattern.c: hmm... * app/gui/commands.[ch]: split up in small files: * app/gui/Makefile.am * app/gui/edit-commands.[ch] * app/gui/file-commands.[ch] * app/gui/image-commands.[ch] * app/gui/select-commands.[ch] * app/gui/view-commands.[ch]: new files. * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.c: added the named buffer list & grid. * app/gui/file-new-dialog.[ch] * app/gui/menus.c * app/gui/palette-editor.c * app/gui/test-commands.c: changed accordingly. * app/pdb/edit_cmds.c * tools/pdbgen/pdb/edit.pdb: changed for the global_edit stuff. * app/widgets/Makefile.am * app/widgets/gimpbufferpreview.[ch] * app/widgets/gimpbufferview.[ch] * app/widgets/gimpcontainereditor.[ch]: new widgets. * app/widgets/gimpcontainerview-utils.c * app/widgets/gimpdatafactoryview.[ch] * app/widgets/gimpdnd.[ch] * app/widgets/gimpdrawablepreview.c * app/widgets/gimplayerlistview.c * app/widgets/gimppreview.c * app/widgets/widgets-types.h: changed accordingly for the new GimpBuffer object and it's views, misc. cleanups. * pixmaps/Makefile.am * pixmaps/paste-as-new.xpm * pixmaps/paste-into.xpm * pixmaps/paste.xpm: new pixmaps (they all look the same... Tigert? ;-) * po/POTFILES.in: added the new files.
2001-06-26 20:09:43 +08:00
#include "base/tile-manager-crop.h"
new directory app/base/ 2001-05-15 Michael Natterer <mitch@gimp.org> * configure.in: new directory app/base/ * app/Makefile.am * app/boundary.[ch] * app/brush_scale.[ch] * app/gimpchecks.h * app/gimplut.[ch] * app/pixel_processor.[ch] * app/pixel_region.[ch] * app/pixel_surround.[ch] * app/temp_buf.[ch] * app/tile.[ch] * app/tile_cache.[ch] * app/tile_manager.[ch] * app/tile_manager_pvt.h * app/tile_pvt.h * app/tile_swap.[ch]: moved to base/ * app/base/Makefile.am * app/base/base-types.h * app/base/*: new directory for the sub-object pixel maniplation and storage stuff. Does not include Gtk+ or anything outside base/. Did some cleanup in all files. * app/appenums.h * app/apptypes.h * app/core/gimpimage.h: removed types which are now in base/base-types.h. * app/base/base-config.[ch] * app/gimprc.[ch]: put the config variables for base/ to their own file so base/ doesn not have to include gimprc.h (does not yet work, i.e. the variables are un-configurable right now) * app/main.c: set a log handler for "Gimp-Base". * app/paint-funcs/Makefile.am * app/paint-funcs/paint-funcs.[ch]: removed the color hash which maps RGB to color indices because it's a totally standalone system which has nothing to do with the paint-funcs and introduced a GimpImage dependency. paint-funcs/ should be considered on the same sub-object (glib-only) level as base/, only in a different directory. * app/core/Makefile.am * app/core/gimpimage-colorhash.[ch]: put the color hash here. * app/gimage.c: don't invalidate the color hash here... * app/core/gimpimage.c: ... but in the colormap_changed() default inplementation. Initialize the hash in class_init(). * tools/pdbgen/Makefile.am: scan app/base/base-types.h for enums. * tools/pdbgen/enums.pl: regenerated. * app/[lots] * app/core/[of] * app/gui/[files] * app/pdb/[all] * app/tools/[over] * app/widgets/[the] * tools/pdbgen/pdb/[place]: changed #includes accordingly. And use base_config->value instead of the stuff from gimprc.h.
2001-05-15 19:25:25 +08:00
#include "paint-funcs/paint-funcs.h"
app/core/Makefile.am app/core/core-types.h added an "application object" 2001-07-04 Michael Natterer <mitch@gimp.org> * app/core/Makefile.am * app/core/core-types.h * app/core/gimp.[ch]: added an "application object" called Gimp. Currently, it contains the image list, the clipboard, the data factories, the procedural hashtable and the tool info list. It's the toplevel object of the core object system. Finally, creating a Gimp object will return a standalone gimp core engine instance with no other global states/variables involved. * app/app_procs.[ch]: allocate a "Gimp" instance called "the_gimp" :) Removed stuff which is now done by the "Gimp" object. Merged gimp_init() into app_init() because gimp_init() is taken now. * app/context_manager.[ch]: removed stuff done by "Gimp". * app/batch.[ch] * app/gimage.[ch] * app/xcf/xcf-load.[ch] * app/xcf/xcf.[ch] * app/core/gimpedit.[ch] * app/tools/tool_manager.[ch]: pass around an additional "Gimp" argument. * app/pdb/procedural_db.[ch]: pass a "Gimp" pointer as first parameter to all internal procedures and to all procedural_db_* functions. * app/core/gimpcontext.[ch] * app/core/gimpimage.[ch]: added a "Gimp" pointer to the structs. * app/devices.c * app/errors.c * app/file-open.c * app/file-save.c * app/gimphelp.c * app/gimpunit.c * app/image_new.c * app/main.c * app/nav_window.c * app/plug_in.c * app/base/base.c * app/core/gimpdatafactory.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-mask.c * app/core/gimptoolinfo.[ch] * app/gui/brush-select.c * app/gui/convert-dialog.c * app/gui/dialogs-constructors.c * app/gui/edit-commands.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/gradient-select.c * app/gui/gui.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/menus.c * app/gui/palette-editor.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/paths-dialog.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/test-commands.c * app/gui/toolbox.c * app/gui/tools-commands.c * app/tools/gimpbezierselecttool.c * app/tools/gimpbucketfilltool.c * app/tools/gimppainttool.h * app/tools/gimptexttool.c * app/tools/gimptransformtool.h * app/widgets/gimpbufferview.c * app/widgets/gimpcontainerview-utils.c * app/widgets/gimpcursor.c * app/widgets/gimpdnd.c * app/widgets/gimpimagedock.c: changed accordingly. Cleaned up lots of includes. Many files still access the global "the_gimp" variable exported by app_procs.h. * tools/pdbgen/app.pl * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/fileops.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/palette.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb * tools/pdbgen/pdb/procedural_db.pdb: changed accordingly. Don't use "the_gimp" here because all procedures get passed a "Gimp" pointer now. * app/pdb/*: regenerated.
2001-07-05 03:31:35 +08:00
#include "gimp.h"
#include "gimp-edit.h"
Fixed bug #78732 (don't paste off screen): 2004-01-15 Michael Natterer <mitch@gimp.org> Fixed bug #78732 (don't paste off screen): * app/display/gimpdisplayshell-transform.[ch]: added new function gimp_display_shell_untransform_viewport() which returns the visible rectangle of the image in image coordinates. * app/core/gimp-edit.[ch] (gimp_edit_paste): added viewport parameters and changed positioning of the pasted layer as follows: - if there is a selection, center on the selection (just as before). - if there is no viewport, center on the active drawable. - if the viewport intersects with the active drawable, center on the intersection. - if the viewport does *not* intersect with the active drawable, center on the active drawable (off-screen, but better than pasting something that will be invisible due to floating selection clipping). - if there is no active drawable, center on the viewport. - if there is no active drawable and no viewport, center on the image. * app/widgets/gimpbufferview.c (gimp_buffer_view_paste_clicked) (gimp_buffer_view_paste_into_clicked) * app/display/gimpdisplayshell-dnd.c (gimp_display_shell_drop_buffer) * app/gui/edit-commands.c (edit_paste_cmd_callback) (edit_paste_into_cmd_callback): ask the shell for the viewport and pass it to gimp_edit_paste(). * app/display/gimpdisplayshell-dnd.c (gimp_display_shell_drop_drawable): center the created layer on the viewport. * app/tools/gimpmovetool.c (gimp_move_tool_button_release): use gimp_display_shell_untransform_viewport() (its code was taken from here). * tools/pdbgen/pdb/edit.pdb: pass "no viewport" to gimp_edit_paste(). * app/pdb/edit_cmds.c: regenerated.
2004-01-15 22:36:43 +08:00
#include "gimp-utils.h"
#include "gimpbuffer.h"
#include "gimpchannel.h"
#include "gimpcontext.h"
#include "gimpimage.h"
#include "gimpimage-undo.h"
#include "gimplayer.h"
#include "gimplayer-floating-sel.h"
#include "gimplist.h"
Enabled skipping enum values for either the PDB or GType registration 2004-01-06 Michael Natterer <mitch@gimp.org> Enabled skipping enum values for either the PDB or GType registration (don't always skip both targets): * tools/gimp-mkenums: skip enum values only if there is a literal "skip" (don't match "pdb-skip"). * tools/pdbgen/enumgen.pl: skip only "pdb-skip" values, not "skip" ones. * app/base/base-enums.h * app/core/core-enums.h * app/paint/paint-enums.h * libgimpbase/gimpbaseenums.h: use the right "pdb-skip"/"skip" combination to skip enum values. Changed comments accordingly. Cleaned up the fill functions: * app/core/core-enums.[ch]: added GIMP_PATTERN_FILL enum value to the GimpFillType enum. Don't export GIMP_NO_FILL to the PDB because it's completely useless to export a NOP. * app/core/gimp-edit.c (gimp_edit_fill, gimp_edit_fill_internal): handle pattern fill requests. * app/core/gimpdrawable.[ch] (gimp_drawable_fill): added GimpPattern parameter and fill with it if it's non-NULL. (gimp_drawable_fill_by_type): handle pattern fill and pass the current pattern to gimp_drawable_fill(). * app/text/gimptextlayer.c: changed accordingly. * app/gui/edit-commands.c * app/gui/image-menu.c: use gimp_edit_fill() instead of gimp_drawable_bucket_fill() for FG, BG and pattern filling. * libgimp/gimpcompat.h * plug-ins/script-fu/siod-wrapper.c: removed NO_IMAGE_FILL compat enum value. It should have never been exported to the PDB. * app/pdb/drawable_cmds.c * app/pdb/edit_cmds.c * libgimp/gimpenums.h * plug-ins/pygimp/gimpenums.py * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: regenerated.
2004-01-06 22:02:08 +08:00
#include "gimppattern.h"
#include "gimppickable.h"
Treat changes to the selection like changes to any other drawable: 2003-10-06 Michael Natterer <mitch@gimp.org> Treat changes to the selection like changes to any other drawable: * app/core/gimpchannel.c * app/core/gimpchannel-combine.c: call gimp_drawable_update() after changing the channel. * app/core/gimpimage.[ch]: added struct GimpImageFlushAccumulator with one member "gboolean mask_changed". Connect to "update" of the selection and set accum.mask_changed to TRUE in the callback. Added default implementation for GimpImage::flush() and emit "mask_changed" there. Unrelated: * app/core/gimpimage.h: removed GimpGuide struct... * app/core/gimpimage-guides.h: ...and added it here. * app/core/gimpimage-undo-push.c (undo_pop_mask) (undo_pop_channel_mod): don't distinguish between selection and non-selection channels and just call gimp_drawable_update(). * app/core/gimpundo.h * app/core/gimpimage-undo.c: removed "gboolean mask_changed" from the GimpUndoAccumulator struct since we don't have to care about that signal explicitly any more. * app/display/gimpdisplay-foreach.[ch]: removed gimp_displays_flush(). * tools/pdbgen/pdb/display.pdb (displays_flush_invoker): call gimp_image_flush() on all images so the flush accumulator is honored. This generalization enables the removal of more special purpose code which was needed to treat the selection different: * app/core/gimpimage-mask-select.[ch]: removed... * app/core/gimpchannel-select.[ch]: ...and added under a new name because it's not selection specific any more. * app/core/gimpimage-mask.[ch]: removed... * app/core/gimpselection.[ch]: ...added the two remaining functions here. Removed all calls to gimp_image_mask_changed(). * app/core/Makefile.am * app/core/gimp-edit.c * app/core/gimpdrawable-transform.c * app/core/gimpimage-scale.c * app/core/gimpimage-snap.c * app/display/gimpdisplayshell.c * app/gui/channels-commands.c * app/gui/layers-commands.c * app/gui/select-commands.c * app/gui/vectors-commands.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpellipseselecttool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimprectselecttool.c * app/tools/gimptransformtool.c * app/widgets/gimpchanneltreeview.c * app/widgets/gimpselectioneditor.c * app/widgets/gimpvectorstreeview.c * app/xcf/xcf-save.c * tools/pdbgen/pdb/paths.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/selection_tools.pdb: changed accordingly. * app/core/gimpdrawable-bucket-fill.c * app/core/gimpimage-colormap.c * app/core/gimplayer-floating-sel.c * app/core/gimplayer.c * app/gui/image-menu.c * app/paint/gimppaintcore.c * app/tools/gimpcroptool.c * app/tools/gimpinkoptions.c * app/tools/gimpvectortool.c: removed useless and/or obsolete #includes. * app/pdb/display_cmds.c * app/pdb/paths_cmds.c * app/pdb/selection_cmds.c * app/pdb/selection_tools_cmds.c: regenerated.
2003-10-06 20:17:11 +08:00
#include "gimpselection.h"
#include "gimp-intl.h"
/* local function protypes */
static GimpBuffer * gimp_edit_extract (GimpImage *image,
GimpDrawable *drawable,
GimpContext *context,
gboolean cut_pixels);
static GimpBuffer * gimp_edit_extract_visible (GimpImage *image,
GimpContext *context);
static GimpBuffer * gimp_edit_make_buffer (Gimp *gimp,
TileManager *tiles,
gboolean mask_empty);
static gboolean gimp_edit_fill_internal (GimpImage *image,
GimpDrawable *drawable,
GimpContext *context,
GimpFillType fill_type,
gdouble opacity,
GimpLayerModeEffects paint_mode,
const gchar *undo_desc);
/* public functions */
const GimpBuffer *
gimp_edit_cut (GimpImage *image,
GimpDrawable *drawable,
Get rid of the "current_context" which was in fact just a bunch of global 2004-04-15 Michael Natterer <mitch@gimp.org> Get rid of the "current_context" which was in fact just a bunch of global variables. Instead, pass the needed context all the way from the GUI and the PDB to the core. This is a prerequisite for macro recording and generally helps separating the various subsystems from each other. Work in progress... * app/core/gimp.[ch]: removed member "current_context" and gimp_[get|set]_current_context(). * app/core/gimp-edit.[ch] * app/core/gimpdrawable-blend.[ch] * app/core/gimpdrawable-bucket-fill.[ch] * app/core/gimpdrawable-offset.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-crop.[ch] * app/core/gimpimage-flip.[ch] * app/core/gimpimage-merge.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-rotate.[ch] * app/core/gimpimage.[ch] * app/core/gimpimagefile.[ch] * app/core/gimpitem-linked.[ch] * app/core/gimpitem.[ch] * app/core/gimplayer.[ch] * app/core/gimpselection.[ch] * app/core/gimptemplate.[ch] * app/file/file-open.[ch] * app/file/file-save.[ch] * app/pdb/procedural_db.[ch] * app/text/gimptext-compat.[ch] * app/text/gimptextlayer-transform.[ch] * app/gui/brush-select.[ch] * app/gui/font-select.[ch] * app/gui/gradient-select.[ch] * app/gui/palette-select.[ch] * app/gui/pattern-select.[ch]: added tons of "GimpContext *context" parameters and use the passed context instead of gimp_get_current_context(). * app/app_procs.c * app/batch.c * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/paint/gimperaser.c * app/paint/gimppaintbrush.c * app/plug-in/plug-in-message.c * app/plug-in/plug-ins.c * app/text/gimptextlayer.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpcroptool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpfliptool.c * app/tools/gimpinktool.c * app/tools/gimptransformtool.c * app/vectors/gimpvectors.c * app/gui/convert-dialog.c * app/gui/drawable-commands.c * app/gui/edit-commands.c * app/gui/file-commands.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/image-commands.c * app/gui/layers-commands.c * app/gui/offset-dialog.c * app/gui/select-commands.c * app/gui/vectors-commands.c * app/widgets/gimpdnd.c * app/widgets/gimpdocumentview.c * app/widgets/gimphelp.c * app/widgets/gimpthumbbox.c: pass gimp_get_user_context() or GIMP_CONTEXT(tool_options) or whatever is the right context to the changed core functions. * tools/pdbgen/app.pl: pass "GimpContext *context" to all generated PDB invokers. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/font_select.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/paint_tools.pdb * tools/pdbgen/pdb/palette.pdb * tools/pdbgen/pdb/palette_select.pdb * tools/pdbgen/pdb/palettes.pdb * tools/pdbgen/pdb/paths.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/text_tool.pdb * tools/pdbgen/pdb/transform_tools.pdb: pass the new context parameter to the changed core functions. * app/pdb/*_cmds.c: regenerated.
2004-04-15 07:37:34 +08:00
GimpContext *context)
1997-11-25 06:05:25 +08:00
{
GimpBuffer *buffer;
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
app/Makefile.am removed. 2001-06-26 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/color_transfer.[ch]: removed. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.[ch]: added. * app/tools/gimpcolorbalancetool.c: changed accordingly. * app/base/Makefile.am * app/base/tile-manager-crop.[ch]: formerly known as crop_buffer(). * app/tools/gimptexttool.c: changed accordingly. * app/context_manager.[ch]: added the global clipboard and the named buffer list here. * app/app_procs.c: don't call color_transfer_init() and don't free the buffer stuff (done by the context manager now). * app/errorconsole.c: don't #include "gui/commands.h" * app/global_edit.[ch]: removed lots of stuff which is now done by gui/edit-commands.* or the new GimpBuffer object. The "paste named" dialog will go away and this file will be moved to core/ soon. * app/image_new.c: no need to declare the global_buffer extern any more. * app/qmask.c: don't #include "global_edit.h" * app/core/Makefile.am * app/core/core-types.h * app/core/gimpbuffer.[ch]: new object (aka named buffer) * app/core/gimpcontext.[ch]: added a GimpBuffer attribute. * app/core/gimpimage.[ch]: one s/int/gboolean/. * app/core/gimppattern.c: hmm... * app/gui/commands.[ch]: split up in small files: * app/gui/Makefile.am * app/gui/edit-commands.[ch] * app/gui/file-commands.[ch] * app/gui/image-commands.[ch] * app/gui/select-commands.[ch] * app/gui/view-commands.[ch]: new files. * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.c: added the named buffer list & grid. * app/gui/file-new-dialog.[ch] * app/gui/menus.c * app/gui/palette-editor.c * app/gui/test-commands.c: changed accordingly. * app/pdb/edit_cmds.c * tools/pdbgen/pdb/edit.pdb: changed for the global_edit stuff. * app/widgets/Makefile.am * app/widgets/gimpbufferpreview.[ch] * app/widgets/gimpbufferview.[ch] * app/widgets/gimpcontainereditor.[ch]: new widgets. * app/widgets/gimpcontainerview-utils.c * app/widgets/gimpdatafactoryview.[ch] * app/widgets/gimpdnd.[ch] * app/widgets/gimpdrawablepreview.c * app/widgets/gimplayerlistview.c * app/widgets/gimppreview.c * app/widgets/widgets-types.h: changed accordingly for the new GimpBuffer object and it's views, misc. cleanups. * pixmaps/Makefile.am * pixmaps/paste-as-new.xpm * pixmaps/paste-into.xpm * pixmaps/paste.xpm: new pixmaps (they all look the same... Tigert? ;-) * po/POTFILES.in: added the new files.
2001-06-26 20:09:43 +08:00
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), NULL);
Get rid of the "current_context" which was in fact just a bunch of global 2004-04-15 Michael Natterer <mitch@gimp.org> Get rid of the "current_context" which was in fact just a bunch of global variables. Instead, pass the needed context all the way from the GUI and the PDB to the core. This is a prerequisite for macro recording and generally helps separating the various subsystems from each other. Work in progress... * app/core/gimp.[ch]: removed member "current_context" and gimp_[get|set]_current_context(). * app/core/gimp-edit.[ch] * app/core/gimpdrawable-blend.[ch] * app/core/gimpdrawable-bucket-fill.[ch] * app/core/gimpdrawable-offset.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-crop.[ch] * app/core/gimpimage-flip.[ch] * app/core/gimpimage-merge.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-rotate.[ch] * app/core/gimpimage.[ch] * app/core/gimpimagefile.[ch] * app/core/gimpitem-linked.[ch] * app/core/gimpitem.[ch] * app/core/gimplayer.[ch] * app/core/gimpselection.[ch] * app/core/gimptemplate.[ch] * app/file/file-open.[ch] * app/file/file-save.[ch] * app/pdb/procedural_db.[ch] * app/text/gimptext-compat.[ch] * app/text/gimptextlayer-transform.[ch] * app/gui/brush-select.[ch] * app/gui/font-select.[ch] * app/gui/gradient-select.[ch] * app/gui/palette-select.[ch] * app/gui/pattern-select.[ch]: added tons of "GimpContext *context" parameters and use the passed context instead of gimp_get_current_context(). * app/app_procs.c * app/batch.c * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/paint/gimperaser.c * app/paint/gimppaintbrush.c * app/plug-in/plug-in-message.c * app/plug-in/plug-ins.c * app/text/gimptextlayer.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpcroptool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpfliptool.c * app/tools/gimpinktool.c * app/tools/gimptransformtool.c * app/vectors/gimpvectors.c * app/gui/convert-dialog.c * app/gui/drawable-commands.c * app/gui/edit-commands.c * app/gui/file-commands.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/image-commands.c * app/gui/layers-commands.c * app/gui/offset-dialog.c * app/gui/select-commands.c * app/gui/vectors-commands.c * app/widgets/gimpdnd.c * app/widgets/gimpdocumentview.c * app/widgets/gimphelp.c * app/widgets/gimpthumbbox.c: pass gimp_get_user_context() or GIMP_CONTEXT(tool_options) or whatever is the right context to the changed core functions. * tools/pdbgen/app.pl: pass "GimpContext *context" to all generated PDB invokers. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/font_select.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/paint_tools.pdb * tools/pdbgen/pdb/palette.pdb * tools/pdbgen/pdb/palette_select.pdb * tools/pdbgen/pdb/palettes.pdb * tools/pdbgen/pdb/paths.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/text_tool.pdb * tools/pdbgen/pdb/transform_tools.pdb: pass the new context parameter to the changed core functions. * app/pdb/*_cmds.c: regenerated.
2004-04-15 07:37:34 +08:00
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
1997-11-25 06:05:25 +08:00
buffer = gimp_edit_extract (image, drawable, context, TRUE);
if (buffer)
{
gimp_set_global_buffer (image->gimp, buffer);
g_object_unref (buffer);
return image->gimp->global_buffer;
}
return NULL;
1997-11-25 06:05:25 +08:00
}
const GimpBuffer *
gimp_edit_copy (GimpImage *image,
GimpDrawable *drawable,
Get rid of the "current_context" which was in fact just a bunch of global 2004-04-15 Michael Natterer <mitch@gimp.org> Get rid of the "current_context" which was in fact just a bunch of global variables. Instead, pass the needed context all the way from the GUI and the PDB to the core. This is a prerequisite for macro recording and generally helps separating the various subsystems from each other. Work in progress... * app/core/gimp.[ch]: removed member "current_context" and gimp_[get|set]_current_context(). * app/core/gimp-edit.[ch] * app/core/gimpdrawable-blend.[ch] * app/core/gimpdrawable-bucket-fill.[ch] * app/core/gimpdrawable-offset.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-crop.[ch] * app/core/gimpimage-flip.[ch] * app/core/gimpimage-merge.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-rotate.[ch] * app/core/gimpimage.[ch] * app/core/gimpimagefile.[ch] * app/core/gimpitem-linked.[ch] * app/core/gimpitem.[ch] * app/core/gimplayer.[ch] * app/core/gimpselection.[ch] * app/core/gimptemplate.[ch] * app/file/file-open.[ch] * app/file/file-save.[ch] * app/pdb/procedural_db.[ch] * app/text/gimptext-compat.[ch] * app/text/gimptextlayer-transform.[ch] * app/gui/brush-select.[ch] * app/gui/font-select.[ch] * app/gui/gradient-select.[ch] * app/gui/palette-select.[ch] * app/gui/pattern-select.[ch]: added tons of "GimpContext *context" parameters and use the passed context instead of gimp_get_current_context(). * app/app_procs.c * app/batch.c * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/paint/gimperaser.c * app/paint/gimppaintbrush.c * app/plug-in/plug-in-message.c * app/plug-in/plug-ins.c * app/text/gimptextlayer.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpcroptool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpfliptool.c * app/tools/gimpinktool.c * app/tools/gimptransformtool.c * app/vectors/gimpvectors.c * app/gui/convert-dialog.c * app/gui/drawable-commands.c * app/gui/edit-commands.c * app/gui/file-commands.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/image-commands.c * app/gui/layers-commands.c * app/gui/offset-dialog.c * app/gui/select-commands.c * app/gui/vectors-commands.c * app/widgets/gimpdnd.c * app/widgets/gimpdocumentview.c * app/widgets/gimphelp.c * app/widgets/gimpthumbbox.c: pass gimp_get_user_context() or GIMP_CONTEXT(tool_options) or whatever is the right context to the changed core functions. * tools/pdbgen/app.pl: pass "GimpContext *context" to all generated PDB invokers. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/font_select.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/paint_tools.pdb * tools/pdbgen/pdb/palette.pdb * tools/pdbgen/pdb/palette_select.pdb * tools/pdbgen/pdb/palettes.pdb * tools/pdbgen/pdb/paths.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/text_tool.pdb * tools/pdbgen/pdb/transform_tools.pdb: pass the new context parameter to the changed core functions. * app/pdb/*_cmds.c: regenerated.
2004-04-15 07:37:34 +08:00
GimpContext *context)
1997-11-25 06:05:25 +08:00
{
GimpBuffer *buffer;
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
app/Makefile.am removed. 2001-06-26 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/color_transfer.[ch]: removed. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.[ch]: added. * app/tools/gimpcolorbalancetool.c: changed accordingly. * app/base/Makefile.am * app/base/tile-manager-crop.[ch]: formerly known as crop_buffer(). * app/tools/gimptexttool.c: changed accordingly. * app/context_manager.[ch]: added the global clipboard and the named buffer list here. * app/app_procs.c: don't call color_transfer_init() and don't free the buffer stuff (done by the context manager now). * app/errorconsole.c: don't #include "gui/commands.h" * app/global_edit.[ch]: removed lots of stuff which is now done by gui/edit-commands.* or the new GimpBuffer object. The "paste named" dialog will go away and this file will be moved to core/ soon. * app/image_new.c: no need to declare the global_buffer extern any more. * app/qmask.c: don't #include "global_edit.h" * app/core/Makefile.am * app/core/core-types.h * app/core/gimpbuffer.[ch]: new object (aka named buffer) * app/core/gimpcontext.[ch]: added a GimpBuffer attribute. * app/core/gimpimage.[ch]: one s/int/gboolean/. * app/core/gimppattern.c: hmm... * app/gui/commands.[ch]: split up in small files: * app/gui/Makefile.am * app/gui/edit-commands.[ch] * app/gui/file-commands.[ch] * app/gui/image-commands.[ch] * app/gui/select-commands.[ch] * app/gui/view-commands.[ch]: new files. * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.c: added the named buffer list & grid. * app/gui/file-new-dialog.[ch] * app/gui/menus.c * app/gui/palette-editor.c * app/gui/test-commands.c: changed accordingly. * app/pdb/edit_cmds.c * tools/pdbgen/pdb/edit.pdb: changed for the global_edit stuff. * app/widgets/Makefile.am * app/widgets/gimpbufferpreview.[ch] * app/widgets/gimpbufferview.[ch] * app/widgets/gimpcontainereditor.[ch]: new widgets. * app/widgets/gimpcontainerview-utils.c * app/widgets/gimpdatafactoryview.[ch] * app/widgets/gimpdnd.[ch] * app/widgets/gimpdrawablepreview.c * app/widgets/gimplayerlistview.c * app/widgets/gimppreview.c * app/widgets/widgets-types.h: changed accordingly for the new GimpBuffer object and it's views, misc. cleanups. * pixmaps/Makefile.am * pixmaps/paste-as-new.xpm * pixmaps/paste-into.xpm * pixmaps/paste.xpm: new pixmaps (they all look the same... Tigert? ;-) * po/POTFILES.in: added the new files.
2001-06-26 20:09:43 +08:00
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), NULL);
Get rid of the "current_context" which was in fact just a bunch of global 2004-04-15 Michael Natterer <mitch@gimp.org> Get rid of the "current_context" which was in fact just a bunch of global variables. Instead, pass the needed context all the way from the GUI and the PDB to the core. This is a prerequisite for macro recording and generally helps separating the various subsystems from each other. Work in progress... * app/core/gimp.[ch]: removed member "current_context" and gimp_[get|set]_current_context(). * app/core/gimp-edit.[ch] * app/core/gimpdrawable-blend.[ch] * app/core/gimpdrawable-bucket-fill.[ch] * app/core/gimpdrawable-offset.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-crop.[ch] * app/core/gimpimage-flip.[ch] * app/core/gimpimage-merge.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-rotate.[ch] * app/core/gimpimage.[ch] * app/core/gimpimagefile.[ch] * app/core/gimpitem-linked.[ch] * app/core/gimpitem.[ch] * app/core/gimplayer.[ch] * app/core/gimpselection.[ch] * app/core/gimptemplate.[ch] * app/file/file-open.[ch] * app/file/file-save.[ch] * app/pdb/procedural_db.[ch] * app/text/gimptext-compat.[ch] * app/text/gimptextlayer-transform.[ch] * app/gui/brush-select.[ch] * app/gui/font-select.[ch] * app/gui/gradient-select.[ch] * app/gui/palette-select.[ch] * app/gui/pattern-select.[ch]: added tons of "GimpContext *context" parameters and use the passed context instead of gimp_get_current_context(). * app/app_procs.c * app/batch.c * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/paint/gimperaser.c * app/paint/gimppaintbrush.c * app/plug-in/plug-in-message.c * app/plug-in/plug-ins.c * app/text/gimptextlayer.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpcroptool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpfliptool.c * app/tools/gimpinktool.c * app/tools/gimptransformtool.c * app/vectors/gimpvectors.c * app/gui/convert-dialog.c * app/gui/drawable-commands.c * app/gui/edit-commands.c * app/gui/file-commands.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/image-commands.c * app/gui/layers-commands.c * app/gui/offset-dialog.c * app/gui/select-commands.c * app/gui/vectors-commands.c * app/widgets/gimpdnd.c * app/widgets/gimpdocumentview.c * app/widgets/gimphelp.c * app/widgets/gimpthumbbox.c: pass gimp_get_user_context() or GIMP_CONTEXT(tool_options) or whatever is the right context to the changed core functions. * tools/pdbgen/app.pl: pass "GimpContext *context" to all generated PDB invokers. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/font_select.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/paint_tools.pdb * tools/pdbgen/pdb/palette.pdb * tools/pdbgen/pdb/palette_select.pdb * tools/pdbgen/pdb/palettes.pdb * tools/pdbgen/pdb/paths.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/text_tool.pdb * tools/pdbgen/pdb/transform_tools.pdb: pass the new context parameter to the changed core functions. * app/pdb/*_cmds.c: regenerated.
2004-04-15 07:37:34 +08:00
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
1997-11-25 06:05:25 +08:00
buffer = gimp_edit_extract (image, drawable, context, FALSE);
if (buffer)
{
gimp_set_global_buffer (image->gimp, buffer);
g_object_unref (buffer);
return image->gimp->global_buffer;
}
return NULL;
1997-11-25 06:05:25 +08:00
}
const GimpBuffer *
gimp_edit_copy_visible (GimpImage *image,
GimpContext *context)
{
GimpBuffer *buffer;
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
buffer = gimp_edit_extract_visible (image, context);
if (buffer)
{
gimp_set_global_buffer (image->gimp, buffer);
g_object_unref (buffer);
return image->gimp->global_buffer;
}
return NULL;
}
GimpLayer *
gimp_edit_paste (GimpImage *image,
GimpDrawable *drawable,
GimpBuffer *paste,
gboolean paste_into,
Fixed bug #78732 (don't paste off screen): 2004-01-15 Michael Natterer <mitch@gimp.org> Fixed bug #78732 (don't paste off screen): * app/display/gimpdisplayshell-transform.[ch]: added new function gimp_display_shell_untransform_viewport() which returns the visible rectangle of the image in image coordinates. * app/core/gimp-edit.[ch] (gimp_edit_paste): added viewport parameters and changed positioning of the pasted layer as follows: - if there is a selection, center on the selection (just as before). - if there is no viewport, center on the active drawable. - if the viewport intersects with the active drawable, center on the intersection. - if the viewport does *not* intersect with the active drawable, center on the active drawable (off-screen, but better than pasting something that will be invisible due to floating selection clipping). - if there is no active drawable, center on the viewport. - if there is no active drawable and no viewport, center on the image. * app/widgets/gimpbufferview.c (gimp_buffer_view_paste_clicked) (gimp_buffer_view_paste_into_clicked) * app/display/gimpdisplayshell-dnd.c (gimp_display_shell_drop_buffer) * app/gui/edit-commands.c (edit_paste_cmd_callback) (edit_paste_into_cmd_callback): ask the shell for the viewport and pass it to gimp_edit_paste(). * app/display/gimpdisplayshell-dnd.c (gimp_display_shell_drop_drawable): center the created layer on the viewport. * app/tools/gimpmovetool.c (gimp_move_tool_button_release): use gimp_display_shell_untransform_viewport() (its code was taken from here). * tools/pdbgen/pdb/edit.pdb: pass "no viewport" to gimp_edit_paste(). * app/pdb/edit_cmds.c: regenerated.
2004-01-15 22:36:43 +08:00
gint viewport_x,
gint viewport_y,
gint viewport_width,
gint viewport_height)
1997-11-25 06:05:25 +08:00
{
GimpLayer *layer;
GimpImageType type;
Fixed bug #78732 (don't paste off screen): 2004-01-15 Michael Natterer <mitch@gimp.org> Fixed bug #78732 (don't paste off screen): * app/display/gimpdisplayshell-transform.[ch]: added new function gimp_display_shell_untransform_viewport() which returns the visible rectangle of the image in image coordinates. * app/core/gimp-edit.[ch] (gimp_edit_paste): added viewport parameters and changed positioning of the pasted layer as follows: - if there is a selection, center on the selection (just as before). - if there is no viewport, center on the active drawable. - if the viewport intersects with the active drawable, center on the intersection. - if the viewport does *not* intersect with the active drawable, center on the active drawable (off-screen, but better than pasting something that will be invisible due to floating selection clipping). - if there is no active drawable, center on the viewport. - if there is no active drawable and no viewport, center on the image. * app/widgets/gimpbufferview.c (gimp_buffer_view_paste_clicked) (gimp_buffer_view_paste_into_clicked) * app/display/gimpdisplayshell-dnd.c (gimp_display_shell_drop_buffer) * app/gui/edit-commands.c (edit_paste_cmd_callback) (edit_paste_into_cmd_callback): ask the shell for the viewport and pass it to gimp_edit_paste(). * app/display/gimpdisplayshell-dnd.c (gimp_display_shell_drop_drawable): center the created layer on the viewport. * app/tools/gimpmovetool.c (gimp_move_tool_button_release): use gimp_display_shell_untransform_viewport() (its code was taken from here). * tools/pdbgen/pdb/edit.pdb: pass "no viewport" to gimp_edit_paste(). * app/pdb/edit_cmds.c: regenerated.
2004-01-15 22:36:43 +08:00
gint center_x;
gint center_y;
gint offset_x;
gint offset_y;
gint width;
gint height;
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
g_return_val_if_fail (drawable == NULL || GIMP_IS_DRAWABLE (drawable), NULL);
add the layer to the image before pasting to it. Fixes bug #132504. 2004-01-26 Michael Natterer <mitch@gimp.org> * plug-ins/script-fu/scripts/unsharp-mask.scm: add the layer to the image before pasting to it. Fixes bug #132504. Fixed the underlying problem: make it impossible to attach floating selections to drawables which are not currently part of the image's layer or channel stacks. Also cleaned up image <-> floating_sel interaction: * app/core/gimplayer-floating-sel.[ch] (floating_sel_attach): added assertion that the drawable is part of the image (see below). Don't call gimp_image_floating_selection_changed(), it's emitted by gimp_image_add_layer() now. (floating_sel_remove) (floating_sel_anchor): don't emit "floating_selection_changed", it's emitted by gimp_image_remove_layer() now. (floating_sel_anchor): removed the fix for bug #132162 because gimp_image_remove_layer() behaves correctly now (see below). Renamed floating_sel_reset() to floating_sel_activate_drawable(). Added g_return_if_fail() all over the place. * app/core/gimpimage.[ch]: added new function gimp_image_owns_item() which return TRUE if the passed item is part of the image. (gimp_image_add_layer): emit "floating_selection_changed" here if needed. (gimp_image_remove_layer): emit "floating_selection_changed" if needed, don't try to activate a layer if we called floating_sel_activate_drawable(). This is the real fix for bug #132162. * app/core/gimpimage-undo-push.c (undo_pop_layer): apply the same fixes as to gimp_image_add,remove_layer(). Don't call gimp_drawable_invalidate_preview() on the previously active layer because that's done by gimp_image_set_active_layer() now. * app/xcf/xcf-load.c: remember the "floating_sel_drawable" in the XcfInfo struct and attach it *after* all layers and channels are loaded to avoid attaching the floating selection to an out-of-image drawable. * app/core/gimp-edit.c (gimp_edit_paste) * app/core/gimpdrawable-transform.c (gimp_drawable_transform_affine, gimp_drawable_transform_flip, gimp_drawable_transform_rotate) * app/core/gimpselection.c (gimp_selection_float) * app/text/gimptext-compat.c (text_render): added checks for gimp_image_owns_item() in all functions which can produce floating selections. * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/floating_sel.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/text_tool.pdb * tools/pdbgen/pdb/transform_tools.pdb: added checks for gimp_item_owns_image() and return an execution error if invoked with a drawable which is not part of the image. * app/pdb/edit_cmds.c * app/pdb/floating_sel_cmds.c * app/pdb/selection_cmds.c * app/pdb/text_tool_cmds.c * app/pdb/transform_tools_cmds.c: regenerated.
2004-01-26 23:34:47 +08:00
g_return_val_if_fail (drawable == NULL ||
gimp_item_is_attached (GIMP_ITEM (drawable)), NULL);
g_return_val_if_fail (GIMP_IS_BUFFER (paste), NULL);
app/Makefile.am removed. 2001-06-26 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/color_transfer.[ch]: removed. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.[ch]: added. * app/tools/gimpcolorbalancetool.c: changed accordingly. * app/base/Makefile.am * app/base/tile-manager-crop.[ch]: formerly known as crop_buffer(). * app/tools/gimptexttool.c: changed accordingly. * app/context_manager.[ch]: added the global clipboard and the named buffer list here. * app/app_procs.c: don't call color_transfer_init() and don't free the buffer stuff (done by the context manager now). * app/errorconsole.c: don't #include "gui/commands.h" * app/global_edit.[ch]: removed lots of stuff which is now done by gui/edit-commands.* or the new GimpBuffer object. The "paste named" dialog will go away and this file will be moved to core/ soon. * app/image_new.c: no need to declare the global_buffer extern any more. * app/qmask.c: don't #include "global_edit.h" * app/core/Makefile.am * app/core/core-types.h * app/core/gimpbuffer.[ch]: new object (aka named buffer) * app/core/gimpcontext.[ch]: added a GimpBuffer attribute. * app/core/gimpimage.[ch]: one s/int/gboolean/. * app/core/gimppattern.c: hmm... * app/gui/commands.[ch]: split up in small files: * app/gui/Makefile.am * app/gui/edit-commands.[ch] * app/gui/file-commands.[ch] * app/gui/image-commands.[ch] * app/gui/select-commands.[ch] * app/gui/view-commands.[ch]: new files. * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.c: added the named buffer list & grid. * app/gui/file-new-dialog.[ch] * app/gui/menus.c * app/gui/palette-editor.c * app/gui/test-commands.c: changed accordingly. * app/pdb/edit_cmds.c * tools/pdbgen/pdb/edit.pdb: changed for the global_edit stuff. * app/widgets/Makefile.am * app/widgets/gimpbufferpreview.[ch] * app/widgets/gimpbufferview.[ch] * app/widgets/gimpcontainereditor.[ch]: new widgets. * app/widgets/gimpcontainerview-utils.c * app/widgets/gimpdatafactoryview.[ch] * app/widgets/gimpdnd.[ch] * app/widgets/gimpdrawablepreview.c * app/widgets/gimplayerlistview.c * app/widgets/gimppreview.c * app/widgets/widgets-types.h: changed accordingly for the new GimpBuffer object and it's views, misc. cleanups. * pixmaps/Makefile.am * pixmaps/paste-as-new.xpm * pixmaps/paste-into.xpm * pixmaps/paste.xpm: new pixmaps (they all look the same... Tigert? ;-) * po/POTFILES.in: added the new files.
2001-06-26 20:09:43 +08:00
/* Make a new layer: if drawable == NULL,
* user is pasting into an empty image.
*/
if (drawable)
type = gimp_drawable_type_with_alpha (drawable);
else
type = gimp_image_base_type_with_alpha (image);
layer = gimp_layer_new_from_tiles (paste->tiles, image, type,
_("Pasted Layer"),
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE);
app/Makefile.am removed. 2001-06-26 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/color_transfer.[ch]: removed. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.[ch]: added. * app/tools/gimpcolorbalancetool.c: changed accordingly. * app/base/Makefile.am * app/base/tile-manager-crop.[ch]: formerly known as crop_buffer(). * app/tools/gimptexttool.c: changed accordingly. * app/context_manager.[ch]: added the global clipboard and the named buffer list here. * app/app_procs.c: don't call color_transfer_init() and don't free the buffer stuff (done by the context manager now). * app/errorconsole.c: don't #include "gui/commands.h" * app/global_edit.[ch]: removed lots of stuff which is now done by gui/edit-commands.* or the new GimpBuffer object. The "paste named" dialog will go away and this file will be moved to core/ soon. * app/image_new.c: no need to declare the global_buffer extern any more. * app/qmask.c: don't #include "global_edit.h" * app/core/Makefile.am * app/core/core-types.h * app/core/gimpbuffer.[ch]: new object (aka named buffer) * app/core/gimpcontext.[ch]: added a GimpBuffer attribute. * app/core/gimpimage.[ch]: one s/int/gboolean/. * app/core/gimppattern.c: hmm... * app/gui/commands.[ch]: split up in small files: * app/gui/Makefile.am * app/gui/edit-commands.[ch] * app/gui/file-commands.[ch] * app/gui/image-commands.[ch] * app/gui/select-commands.[ch] * app/gui/view-commands.[ch]: new files. * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.c: added the named buffer list & grid. * app/gui/file-new-dialog.[ch] * app/gui/menus.c * app/gui/palette-editor.c * app/gui/test-commands.c: changed accordingly. * app/pdb/edit_cmds.c * tools/pdbgen/pdb/edit.pdb: changed for the global_edit stuff. * app/widgets/Makefile.am * app/widgets/gimpbufferpreview.[ch] * app/widgets/gimpbufferview.[ch] * app/widgets/gimpcontainereditor.[ch]: new widgets. * app/widgets/gimpcontainerview-utils.c * app/widgets/gimpdatafactoryview.[ch] * app/widgets/gimpdnd.[ch] * app/widgets/gimpdrawablepreview.c * app/widgets/gimplayerlistview.c * app/widgets/gimppreview.c * app/widgets/widgets-types.h: changed accordingly for the new GimpBuffer object and it's views, misc. cleanups. * pixmaps/Makefile.am * pixmaps/paste-as-new.xpm * pixmaps/paste-into.xpm * pixmaps/paste.xpm: new pixmaps (they all look the same... Tigert? ;-) * po/POTFILES.in: added the new files.
2001-06-26 20:09:43 +08:00
if (! layer)
return NULL;
1997-11-25 06:05:25 +08:00
made gimp->global_buffer a GimpBuffer, not TileManager. 2001-12-13 Michael Natterer <mitch@gimp.org> * app/core/gimp.[ch]: made gimp->global_buffer a GimpBuffer, not TileManager. * app/core/gimpbuffer.[ch]: added a "gboolean copy_pixels" to gimp_buffer_new(). * app/core/gimpimage-new.c * app/core/gimpedit.[ch] * app/core/gimpimage-qmask.c * app/widgets/gimpbufferpreview.c * app/widgets/gimpbufferview.c * app/widgets/gimpcontainerview-utils.c: chaned accordingly, don't include "base/tile-manager.h". * app/core/gimpdrawable.[ch]: added gimp_drawable_copy(). * app/core/gimpchannel.[ch] * app/core/gimplayer.[ch] * app/core/gimplayermask.[ch]: use it in gimp_[channel|layer|layer_mask]_copy(), added "GType new_type" as paramater to all of them. * app/core/gimpimage-duplicate.c * app/gui/channels-commands.c * app/gui/edit-commands.c * app/gui/layers-commands.c * app/widgets/gimpchannellistview.c * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/selection.pdb: changed accordingly. * app/pdb/channel_cmds.c * app/pdb/layer_cmds.c * app/pdb/selection_cmds.c: regenerated. * app/core/gimplayer.[ch]: removed the "layer_type" parameter from gimp_layer_new_from_tiles() because it always needed to be equal to gimp_image_base_type_with_alpha() of the passed image. * app/core/gimpdrawable-transform.c * app/core/gimpedit.c * app/core/gimpimage-mask.c: cahanged accordingly. * app/core/gimpimage.[ch]: added some new GIMP_IMAGE_TYPE_FOO() marcos to get rid of magic values like "pixels = 3" all over the place. * app/core/gimplayer.[ch]: added gimp_layer_new_from_drawable() which creates a layer from an other image's drawable. * app/core/gimpimage-convert.[ch]: made the RGB and GRAY converters public to use them above, use the new GIMP_IMAGE_TYPE() macros. * app/display/gimpdisplayshell-dnd.c * app/gui/toolbox.c: removed tile manager stuff and use the new functions. * app/widgets/gimpdrawablelistview.[ch]: added a "convert_drawable_func" which is used to handle drops from other images. * app/widgets/gimpdrawablelistitem.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplistitem.[ch]: implemented DND of layers between images using gimp_layer_new_from_drawable(). * app/gui/dialogs-constructors.c: changed accordingly.
2001-12-13 07:48:18 +08:00
if (drawable)
app/Makefile.am removed. 2001-06-26 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/color_transfer.[ch]: removed. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.[ch]: added. * app/tools/gimpcolorbalancetool.c: changed accordingly. * app/base/Makefile.am * app/base/tile-manager-crop.[ch]: formerly known as crop_buffer(). * app/tools/gimptexttool.c: changed accordingly. * app/context_manager.[ch]: added the global clipboard and the named buffer list here. * app/app_procs.c: don't call color_transfer_init() and don't free the buffer stuff (done by the context manager now). * app/errorconsole.c: don't #include "gui/commands.h" * app/global_edit.[ch]: removed lots of stuff which is now done by gui/edit-commands.* or the new GimpBuffer object. The "paste named" dialog will go away and this file will be moved to core/ soon. * app/image_new.c: no need to declare the global_buffer extern any more. * app/qmask.c: don't #include "global_edit.h" * app/core/Makefile.am * app/core/core-types.h * app/core/gimpbuffer.[ch]: new object (aka named buffer) * app/core/gimpcontext.[ch]: added a GimpBuffer attribute. * app/core/gimpimage.[ch]: one s/int/gboolean/. * app/core/gimppattern.c: hmm... * app/gui/commands.[ch]: split up in small files: * app/gui/Makefile.am * app/gui/edit-commands.[ch] * app/gui/file-commands.[ch] * app/gui/image-commands.[ch] * app/gui/select-commands.[ch] * app/gui/view-commands.[ch]: new files. * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.c: added the named buffer list & grid. * app/gui/file-new-dialog.[ch] * app/gui/menus.c * app/gui/palette-editor.c * app/gui/test-commands.c: changed accordingly. * app/pdb/edit_cmds.c * tools/pdbgen/pdb/edit.pdb: changed for the global_edit stuff. * app/widgets/Makefile.am * app/widgets/gimpbufferpreview.[ch] * app/widgets/gimpbufferview.[ch] * app/widgets/gimpcontainereditor.[ch]: new widgets. * app/widgets/gimpcontainerview-utils.c * app/widgets/gimpdatafactoryview.[ch] * app/widgets/gimpdnd.[ch] * app/widgets/gimpdrawablepreview.c * app/widgets/gimplayerlistview.c * app/widgets/gimppreview.c * app/widgets/widgets-types.h: changed accordingly for the new GimpBuffer object and it's views, misc. cleanups. * pixmaps/Makefile.am * pixmaps/paste-as-new.xpm * pixmaps/paste-into.xpm * pixmaps/paste.xpm: new pixmaps (they all look the same... Tigert? ;-) * po/POTFILES.in: added the new files.
2001-06-26 20:09:43 +08:00
{
Fixed bug #78732 (don't paste off screen): 2004-01-15 Michael Natterer <mitch@gimp.org> Fixed bug #78732 (don't paste off screen): * app/display/gimpdisplayshell-transform.[ch]: added new function gimp_display_shell_untransform_viewport() which returns the visible rectangle of the image in image coordinates. * app/core/gimp-edit.[ch] (gimp_edit_paste): added viewport parameters and changed positioning of the pasted layer as follows: - if there is a selection, center on the selection (just as before). - if there is no viewport, center on the active drawable. - if the viewport intersects with the active drawable, center on the intersection. - if the viewport does *not* intersect with the active drawable, center on the active drawable (off-screen, but better than pasting something that will be invisible due to floating selection clipping). - if there is no active drawable, center on the viewport. - if there is no active drawable and no viewport, center on the image. * app/widgets/gimpbufferview.c (gimp_buffer_view_paste_clicked) (gimp_buffer_view_paste_into_clicked) * app/display/gimpdisplayshell-dnd.c (gimp_display_shell_drop_buffer) * app/gui/edit-commands.c (edit_paste_cmd_callback) (edit_paste_into_cmd_callback): ask the shell for the viewport and pass it to gimp_edit_paste(). * app/display/gimpdisplayshell-dnd.c (gimp_display_shell_drop_drawable): center the created layer on the viewport. * app/tools/gimpmovetool.c (gimp_move_tool_button_release): use gimp_display_shell_untransform_viewport() (its code was taken from here). * tools/pdbgen/pdb/edit.pdb: pass "no viewport" to gimp_edit_paste(). * app/pdb/edit_cmds.c: regenerated.
2004-01-15 22:36:43 +08:00
/* if pasting to a drawable */
gint off_x, off_y;
gint x1, y1, x2, y2;
gint paste_x, paste_y;
gint paste_width, paste_height;
gboolean have_mask;
gimp_item_offsets (GIMP_ITEM (drawable), &off_x, &off_y);
have_mask = gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
if (! have_mask &&
viewport_width > 0 &&
viewport_height > 0 &&
gimp_rectangle_intersect (viewport_x, viewport_y,
viewport_width, viewport_height,
off_x, off_y,
x2 - x1, y2 - y1,
&paste_x, &paste_y,
&paste_width, &paste_height))
{
center_x = paste_x + paste_width / 2;
center_y = paste_y + paste_height / 2;
}
else
{
center_x = off_x + (x1 + x2) / 2;
center_y = off_y + (y1 + y2) / 2;
}
}
else if (viewport_width > 0 && viewport_height > 0)
{
/* if we got a viewport set the offsets to the center of the viewport */
center_x = viewport_x + viewport_width / 2;
center_y = viewport_y + viewport_height / 2;
app/Makefile.am removed. 2001-06-26 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/color_transfer.[ch]: removed. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.[ch]: added. * app/tools/gimpcolorbalancetool.c: changed accordingly. * app/base/Makefile.am * app/base/tile-manager-crop.[ch]: formerly known as crop_buffer(). * app/tools/gimptexttool.c: changed accordingly. * app/context_manager.[ch]: added the global clipboard and the named buffer list here. * app/app_procs.c: don't call color_transfer_init() and don't free the buffer stuff (done by the context manager now). * app/errorconsole.c: don't #include "gui/commands.h" * app/global_edit.[ch]: removed lots of stuff which is now done by gui/edit-commands.* or the new GimpBuffer object. The "paste named" dialog will go away and this file will be moved to core/ soon. * app/image_new.c: no need to declare the global_buffer extern any more. * app/qmask.c: don't #include "global_edit.h" * app/core/Makefile.am * app/core/core-types.h * app/core/gimpbuffer.[ch]: new object (aka named buffer) * app/core/gimpcontext.[ch]: added a GimpBuffer attribute. * app/core/gimpimage.[ch]: one s/int/gboolean/. * app/core/gimppattern.c: hmm... * app/gui/commands.[ch]: split up in small files: * app/gui/Makefile.am * app/gui/edit-commands.[ch] * app/gui/file-commands.[ch] * app/gui/image-commands.[ch] * app/gui/select-commands.[ch] * app/gui/view-commands.[ch]: new files. * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.c: added the named buffer list & grid. * app/gui/file-new-dialog.[ch] * app/gui/menus.c * app/gui/palette-editor.c * app/gui/test-commands.c: changed accordingly. * app/pdb/edit_cmds.c * tools/pdbgen/pdb/edit.pdb: changed for the global_edit stuff. * app/widgets/Makefile.am * app/widgets/gimpbufferpreview.[ch] * app/widgets/gimpbufferview.[ch] * app/widgets/gimpcontainereditor.[ch]: new widgets. * app/widgets/gimpcontainerview-utils.c * app/widgets/gimpdatafactoryview.[ch] * app/widgets/gimpdnd.[ch] * app/widgets/gimpdrawablepreview.c * app/widgets/gimplayerlistview.c * app/widgets/gimppreview.c * app/widgets/widgets-types.h: changed accordingly for the new GimpBuffer object and it's views, misc. cleanups. * pixmaps/Makefile.am * pixmaps/paste-as-new.xpm * pixmaps/paste-into.xpm * pixmaps/paste.xpm: new pixmaps (they all look the same... Tigert? ;-) * po/POTFILES.in: added the new files.
2001-06-26 20:09:43 +08:00
}
else
{
Fixed bug #78732 (don't paste off screen): 2004-01-15 Michael Natterer <mitch@gimp.org> Fixed bug #78732 (don't paste off screen): * app/display/gimpdisplayshell-transform.[ch]: added new function gimp_display_shell_untransform_viewport() which returns the visible rectangle of the image in image coordinates. * app/core/gimp-edit.[ch] (gimp_edit_paste): added viewport parameters and changed positioning of the pasted layer as follows: - if there is a selection, center on the selection (just as before). - if there is no viewport, center on the active drawable. - if the viewport intersects with the active drawable, center on the intersection. - if the viewport does *not* intersect with the active drawable, center on the active drawable (off-screen, but better than pasting something that will be invisible due to floating selection clipping). - if there is no active drawable, center on the viewport. - if there is no active drawable and no viewport, center on the image. * app/widgets/gimpbufferview.c (gimp_buffer_view_paste_clicked) (gimp_buffer_view_paste_into_clicked) * app/display/gimpdisplayshell-dnd.c (gimp_display_shell_drop_buffer) * app/gui/edit-commands.c (edit_paste_cmd_callback) (edit_paste_into_cmd_callback): ask the shell for the viewport and pass it to gimp_edit_paste(). * app/display/gimpdisplayshell-dnd.c (gimp_display_shell_drop_drawable): center the created layer on the viewport. * app/tools/gimpmovetool.c (gimp_move_tool_button_release): use gimp_display_shell_untransform_viewport() (its code was taken from here). * tools/pdbgen/pdb/edit.pdb: pass "no viewport" to gimp_edit_paste(). * app/pdb/edit_cmds.c: regenerated.
2004-01-15 22:36:43 +08:00
/* otherwise the offsets to the center of the image */
center_x = image->width / 2;
center_y = image->height / 2;
app/Makefile.am removed. 2001-06-26 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/color_transfer.[ch]: removed. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.[ch]: added. * app/tools/gimpcolorbalancetool.c: changed accordingly. * app/base/Makefile.am * app/base/tile-manager-crop.[ch]: formerly known as crop_buffer(). * app/tools/gimptexttool.c: changed accordingly. * app/context_manager.[ch]: added the global clipboard and the named buffer list here. * app/app_procs.c: don't call color_transfer_init() and don't free the buffer stuff (done by the context manager now). * app/errorconsole.c: don't #include "gui/commands.h" * app/global_edit.[ch]: removed lots of stuff which is now done by gui/edit-commands.* or the new GimpBuffer object. The "paste named" dialog will go away and this file will be moved to core/ soon. * app/image_new.c: no need to declare the global_buffer extern any more. * app/qmask.c: don't #include "global_edit.h" * app/core/Makefile.am * app/core/core-types.h * app/core/gimpbuffer.[ch]: new object (aka named buffer) * app/core/gimpcontext.[ch]: added a GimpBuffer attribute. * app/core/gimpimage.[ch]: one s/int/gboolean/. * app/core/gimppattern.c: hmm... * app/gui/commands.[ch]: split up in small files: * app/gui/Makefile.am * app/gui/edit-commands.[ch] * app/gui/file-commands.[ch] * app/gui/image-commands.[ch] * app/gui/select-commands.[ch] * app/gui/view-commands.[ch]: new files. * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.c: added the named buffer list & grid. * app/gui/file-new-dialog.[ch] * app/gui/menus.c * app/gui/palette-editor.c * app/gui/test-commands.c: changed accordingly. * app/pdb/edit_cmds.c * tools/pdbgen/pdb/edit.pdb: changed for the global_edit stuff. * app/widgets/Makefile.am * app/widgets/gimpbufferpreview.[ch] * app/widgets/gimpbufferview.[ch] * app/widgets/gimpcontainereditor.[ch]: new widgets. * app/widgets/gimpcontainerview-utils.c * app/widgets/gimpdatafactoryview.[ch] * app/widgets/gimpdnd.[ch] * app/widgets/gimpdrawablepreview.c * app/widgets/gimplayerlistview.c * app/widgets/gimppreview.c * app/widgets/widgets-types.h: changed accordingly for the new GimpBuffer object and it's views, misc. cleanups. * pixmaps/Makefile.am * pixmaps/paste-as-new.xpm * pixmaps/paste-into.xpm * pixmaps/paste.xpm: new pixmaps (they all look the same... Tigert? ;-) * po/POTFILES.in: added the new files.
2001-06-26 20:09:43 +08:00
}
1997-11-25 06:05:25 +08:00
width = gimp_item_width (GIMP_ITEM (layer));
height = gimp_item_height (GIMP_ITEM (layer));
offset_x = center_x - width / 2;
offset_y = center_y - height / 2;
/* Ensure that the pasted layer is always within the image, if it
* fits and aligned at top left if it doesn't. (See bug #142944).
*/
offset_x = MIN (offset_x, image->width - width);
offset_y = MIN (offset_y, image->height - height);
offset_x = MAX (offset_x, 0);
offset_y = MAX (offset_y, 0);
GIMP_ITEM (layer)->offset_x = offset_x;
GIMP_ITEM (layer)->offset_y = offset_y;
/* Start a group undo */
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_EDIT_PASTE,
_("Paste"));
app/Makefile.am removed. 2001-06-26 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/color_transfer.[ch]: removed. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.[ch]: added. * app/tools/gimpcolorbalancetool.c: changed accordingly. * app/base/Makefile.am * app/base/tile-manager-crop.[ch]: formerly known as crop_buffer(). * app/tools/gimptexttool.c: changed accordingly. * app/context_manager.[ch]: added the global clipboard and the named buffer list here. * app/app_procs.c: don't call color_transfer_init() and don't free the buffer stuff (done by the context manager now). * app/errorconsole.c: don't #include "gui/commands.h" * app/global_edit.[ch]: removed lots of stuff which is now done by gui/edit-commands.* or the new GimpBuffer object. The "paste named" dialog will go away and this file will be moved to core/ soon. * app/image_new.c: no need to declare the global_buffer extern any more. * app/qmask.c: don't #include "global_edit.h" * app/core/Makefile.am * app/core/core-types.h * app/core/gimpbuffer.[ch]: new object (aka named buffer) * app/core/gimpcontext.[ch]: added a GimpBuffer attribute. * app/core/gimpimage.[ch]: one s/int/gboolean/. * app/core/gimppattern.c: hmm... * app/gui/commands.[ch]: split up in small files: * app/gui/Makefile.am * app/gui/edit-commands.[ch] * app/gui/file-commands.[ch] * app/gui/image-commands.[ch] * app/gui/select-commands.[ch] * app/gui/view-commands.[ch]: new files. * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.c: added the named buffer list & grid. * app/gui/file-new-dialog.[ch] * app/gui/menus.c * app/gui/palette-editor.c * app/gui/test-commands.c: changed accordingly. * app/pdb/edit_cmds.c * tools/pdbgen/pdb/edit.pdb: changed for the global_edit stuff. * app/widgets/Makefile.am * app/widgets/gimpbufferpreview.[ch] * app/widgets/gimpbufferview.[ch] * app/widgets/gimpcontainereditor.[ch]: new widgets. * app/widgets/gimpcontainerview-utils.c * app/widgets/gimpdatafactoryview.[ch] * app/widgets/gimpdnd.[ch] * app/widgets/gimpdrawablepreview.c * app/widgets/gimplayerlistview.c * app/widgets/gimppreview.c * app/widgets/widgets-types.h: changed accordingly for the new GimpBuffer object and it's views, misc. cleanups. * pixmaps/Makefile.am * pixmaps/paste-as-new.xpm * pixmaps/paste-into.xpm * pixmaps/paste.xpm: new pixmaps (they all look the same... Tigert? ;-) * po/POTFILES.in: added the new files.
2001-06-26 20:09:43 +08:00
/* If there is a selection mask clear it--
* this might not always be desired, but in general,
* it seems like the correct behavior.
*/
if (! gimp_channel_is_empty (gimp_image_get_mask (image)) && ! paste_into)
gimp_channel_clear (gimp_image_get_mask (image), NULL, TRUE);
1997-11-25 06:05:25 +08:00
app/Makefile.am removed. 2001-06-26 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/color_transfer.[ch]: removed. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.[ch]: added. * app/tools/gimpcolorbalancetool.c: changed accordingly. * app/base/Makefile.am * app/base/tile-manager-crop.[ch]: formerly known as crop_buffer(). * app/tools/gimptexttool.c: changed accordingly. * app/context_manager.[ch]: added the global clipboard and the named buffer list here. * app/app_procs.c: don't call color_transfer_init() and don't free the buffer stuff (done by the context manager now). * app/errorconsole.c: don't #include "gui/commands.h" * app/global_edit.[ch]: removed lots of stuff which is now done by gui/edit-commands.* or the new GimpBuffer object. The "paste named" dialog will go away and this file will be moved to core/ soon. * app/image_new.c: no need to declare the global_buffer extern any more. * app/qmask.c: don't #include "global_edit.h" * app/core/Makefile.am * app/core/core-types.h * app/core/gimpbuffer.[ch]: new object (aka named buffer) * app/core/gimpcontext.[ch]: added a GimpBuffer attribute. * app/core/gimpimage.[ch]: one s/int/gboolean/. * app/core/gimppattern.c: hmm... * app/gui/commands.[ch]: split up in small files: * app/gui/Makefile.am * app/gui/edit-commands.[ch] * app/gui/file-commands.[ch] * app/gui/image-commands.[ch] * app/gui/select-commands.[ch] * app/gui/view-commands.[ch]: new files. * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.c: added the named buffer list & grid. * app/gui/file-new-dialog.[ch] * app/gui/menus.c * app/gui/palette-editor.c * app/gui/test-commands.c: changed accordingly. * app/pdb/edit_cmds.c * tools/pdbgen/pdb/edit.pdb: changed for the global_edit stuff. * app/widgets/Makefile.am * app/widgets/gimpbufferpreview.[ch] * app/widgets/gimpbufferview.[ch] * app/widgets/gimpcontainereditor.[ch]: new widgets. * app/widgets/gimpcontainerview-utils.c * app/widgets/gimpdatafactoryview.[ch] * app/widgets/gimpdnd.[ch] * app/widgets/gimpdrawablepreview.c * app/widgets/gimplayerlistview.c * app/widgets/gimppreview.c * app/widgets/widgets-types.h: changed accordingly for the new GimpBuffer object and it's views, misc. cleanups. * pixmaps/Makefile.am * pixmaps/paste-as-new.xpm * pixmaps/paste-into.xpm * pixmaps/paste.xpm: new pixmaps (they all look the same... Tigert? ;-) * po/POTFILES.in: added the new files.
2001-06-26 20:09:43 +08:00
/* if there's a drawable, add a new floating selection */
if (drawable)
floating_sel_attach (layer, drawable);
app/Makefile.am removed. 2001-06-26 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/color_transfer.[ch]: removed. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.[ch]: added. * app/tools/gimpcolorbalancetool.c: changed accordingly. * app/base/Makefile.am * app/base/tile-manager-crop.[ch]: formerly known as crop_buffer(). * app/tools/gimptexttool.c: changed accordingly. * app/context_manager.[ch]: added the global clipboard and the named buffer list here. * app/app_procs.c: don't call color_transfer_init() and don't free the buffer stuff (done by the context manager now). * app/errorconsole.c: don't #include "gui/commands.h" * app/global_edit.[ch]: removed lots of stuff which is now done by gui/edit-commands.* or the new GimpBuffer object. The "paste named" dialog will go away and this file will be moved to core/ soon. * app/image_new.c: no need to declare the global_buffer extern any more. * app/qmask.c: don't #include "global_edit.h" * app/core/Makefile.am * app/core/core-types.h * app/core/gimpbuffer.[ch]: new object (aka named buffer) * app/core/gimpcontext.[ch]: added a GimpBuffer attribute. * app/core/gimpimage.[ch]: one s/int/gboolean/. * app/core/gimppattern.c: hmm... * app/gui/commands.[ch]: split up in small files: * app/gui/Makefile.am * app/gui/edit-commands.[ch] * app/gui/file-commands.[ch] * app/gui/image-commands.[ch] * app/gui/select-commands.[ch] * app/gui/view-commands.[ch]: new files. * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.c: added the named buffer list & grid. * app/gui/file-new-dialog.[ch] * app/gui/menus.c * app/gui/palette-editor.c * app/gui/test-commands.c: changed accordingly. * app/pdb/edit_cmds.c * tools/pdbgen/pdb/edit.pdb: changed for the global_edit stuff. * app/widgets/Makefile.am * app/widgets/gimpbufferpreview.[ch] * app/widgets/gimpbufferview.[ch] * app/widgets/gimpcontainereditor.[ch]: new widgets. * app/widgets/gimpcontainerview-utils.c * app/widgets/gimpdatafactoryview.[ch] * app/widgets/gimpdnd.[ch] * app/widgets/gimpdrawablepreview.c * app/widgets/gimplayerlistview.c * app/widgets/gimppreview.c * app/widgets/widgets-types.h: changed accordingly for the new GimpBuffer object and it's views, misc. cleanups. * pixmaps/Makefile.am * pixmaps/paste-as-new.xpm * pixmaps/paste-into.xpm * pixmaps/paste.xpm: new pixmaps (they all look the same... Tigert? ;-) * po/POTFILES.in: added the new files.
2001-06-26 20:09:43 +08:00
else
gimp_image_add_layer (image, layer, 0);
app/Makefile.am removed. 2001-06-26 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/color_transfer.[ch]: removed. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.[ch]: added. * app/tools/gimpcolorbalancetool.c: changed accordingly. * app/base/Makefile.am * app/base/tile-manager-crop.[ch]: formerly known as crop_buffer(). * app/tools/gimptexttool.c: changed accordingly. * app/context_manager.[ch]: added the global clipboard and the named buffer list here. * app/app_procs.c: don't call color_transfer_init() and don't free the buffer stuff (done by the context manager now). * app/errorconsole.c: don't #include "gui/commands.h" * app/global_edit.[ch]: removed lots of stuff which is now done by gui/edit-commands.* or the new GimpBuffer object. The "paste named" dialog will go away and this file will be moved to core/ soon. * app/image_new.c: no need to declare the global_buffer extern any more. * app/qmask.c: don't #include "global_edit.h" * app/core/Makefile.am * app/core/core-types.h * app/core/gimpbuffer.[ch]: new object (aka named buffer) * app/core/gimpcontext.[ch]: added a GimpBuffer attribute. * app/core/gimpimage.[ch]: one s/int/gboolean/. * app/core/gimppattern.c: hmm... * app/gui/commands.[ch]: split up in small files: * app/gui/Makefile.am * app/gui/edit-commands.[ch] * app/gui/file-commands.[ch] * app/gui/image-commands.[ch] * app/gui/select-commands.[ch] * app/gui/view-commands.[ch]: new files. * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.c: added the named buffer list & grid. * app/gui/file-new-dialog.[ch] * app/gui/menus.c * app/gui/palette-editor.c * app/gui/test-commands.c: changed accordingly. * app/pdb/edit_cmds.c * tools/pdbgen/pdb/edit.pdb: changed for the global_edit stuff. * app/widgets/Makefile.am * app/widgets/gimpbufferpreview.[ch] * app/widgets/gimpbufferview.[ch] * app/widgets/gimpcontainereditor.[ch]: new widgets. * app/widgets/gimpcontainerview-utils.c * app/widgets/gimpdatafactoryview.[ch] * app/widgets/gimpdnd.[ch] * app/widgets/gimpdrawablepreview.c * app/widgets/gimplayerlistview.c * app/widgets/gimppreview.c * app/widgets/widgets-types.h: changed accordingly for the new GimpBuffer object and it's views, misc. cleanups. * pixmaps/Makefile.am * pixmaps/paste-as-new.xpm * pixmaps/paste-into.xpm * pixmaps/paste.xpm: new pixmaps (they all look the same... Tigert? ;-) * po/POTFILES.in: added the new files.
2001-06-26 20:09:43 +08:00
/* end the group undo */
gimp_image_undo_group_end (image);
app/Makefile.am removed. 2001-06-26 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/color_transfer.[ch]: removed. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.[ch]: added. * app/tools/gimpcolorbalancetool.c: changed accordingly. * app/base/Makefile.am * app/base/tile-manager-crop.[ch]: formerly known as crop_buffer(). * app/tools/gimptexttool.c: changed accordingly. * app/context_manager.[ch]: added the global clipboard and the named buffer list here. * app/app_procs.c: don't call color_transfer_init() and don't free the buffer stuff (done by the context manager now). * app/errorconsole.c: don't #include "gui/commands.h" * app/global_edit.[ch]: removed lots of stuff which is now done by gui/edit-commands.* or the new GimpBuffer object. The "paste named" dialog will go away and this file will be moved to core/ soon. * app/image_new.c: no need to declare the global_buffer extern any more. * app/qmask.c: don't #include "global_edit.h" * app/core/Makefile.am * app/core/core-types.h * app/core/gimpbuffer.[ch]: new object (aka named buffer) * app/core/gimpcontext.[ch]: added a GimpBuffer attribute. * app/core/gimpimage.[ch]: one s/int/gboolean/. * app/core/gimppattern.c: hmm... * app/gui/commands.[ch]: split up in small files: * app/gui/Makefile.am * app/gui/edit-commands.[ch] * app/gui/file-commands.[ch] * app/gui/image-commands.[ch] * app/gui/select-commands.[ch] * app/gui/view-commands.[ch]: new files. * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.c: added the named buffer list & grid. * app/gui/file-new-dialog.[ch] * app/gui/menus.c * app/gui/palette-editor.c * app/gui/test-commands.c: changed accordingly. * app/pdb/edit_cmds.c * tools/pdbgen/pdb/edit.pdb: changed for the global_edit stuff. * app/widgets/Makefile.am * app/widgets/gimpbufferpreview.[ch] * app/widgets/gimpbufferview.[ch] * app/widgets/gimpcontainereditor.[ch]: new widgets. * app/widgets/gimpcontainerview-utils.c * app/widgets/gimpdatafactoryview.[ch] * app/widgets/gimpdnd.[ch] * app/widgets/gimpdrawablepreview.c * app/widgets/gimplayerlistview.c * app/widgets/gimppreview.c * app/widgets/widgets-types.h: changed accordingly for the new GimpBuffer object and it's views, misc. cleanups. * pixmaps/Makefile.am * pixmaps/paste-as-new.xpm * pixmaps/paste-into.xpm * pixmaps/paste.xpm: new pixmaps (they all look the same... Tigert? ;-) * po/POTFILES.in: added the new files.
2001-06-26 20:09:43 +08:00
return layer;
1997-11-25 06:05:25 +08:00
}
app/Makefile.am removed. 2001-06-26 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/color_transfer.[ch]: removed. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.[ch]: added. * app/tools/gimpcolorbalancetool.c: changed accordingly. * app/base/Makefile.am * app/base/tile-manager-crop.[ch]: formerly known as crop_buffer(). * app/tools/gimptexttool.c: changed accordingly. * app/context_manager.[ch]: added the global clipboard and the named buffer list here. * app/app_procs.c: don't call color_transfer_init() and don't free the buffer stuff (done by the context manager now). * app/errorconsole.c: don't #include "gui/commands.h" * app/global_edit.[ch]: removed lots of stuff which is now done by gui/edit-commands.* or the new GimpBuffer object. The "paste named" dialog will go away and this file will be moved to core/ soon. * app/image_new.c: no need to declare the global_buffer extern any more. * app/qmask.c: don't #include "global_edit.h" * app/core/Makefile.am * app/core/core-types.h * app/core/gimpbuffer.[ch]: new object (aka named buffer) * app/core/gimpcontext.[ch]: added a GimpBuffer attribute. * app/core/gimpimage.[ch]: one s/int/gboolean/. * app/core/gimppattern.c: hmm... * app/gui/commands.[ch]: split up in small files: * app/gui/Makefile.am * app/gui/edit-commands.[ch] * app/gui/file-commands.[ch] * app/gui/image-commands.[ch] * app/gui/select-commands.[ch] * app/gui/view-commands.[ch]: new files. * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.c: added the named buffer list & grid. * app/gui/file-new-dialog.[ch] * app/gui/menus.c * app/gui/palette-editor.c * app/gui/test-commands.c: changed accordingly. * app/pdb/edit_cmds.c * tools/pdbgen/pdb/edit.pdb: changed for the global_edit stuff. * app/widgets/Makefile.am * app/widgets/gimpbufferpreview.[ch] * app/widgets/gimpbufferview.[ch] * app/widgets/gimpcontainereditor.[ch]: new widgets. * app/widgets/gimpcontainerview-utils.c * app/widgets/gimpdatafactoryview.[ch] * app/widgets/gimpdnd.[ch] * app/widgets/gimpdrawablepreview.c * app/widgets/gimplayerlistview.c * app/widgets/gimppreview.c * app/widgets/widgets-types.h: changed accordingly for the new GimpBuffer object and it's views, misc. cleanups. * pixmaps/Makefile.am * pixmaps/paste-as-new.xpm * pixmaps/paste-into.xpm * pixmaps/paste.xpm: new pixmaps (they all look the same... Tigert? ;-) * po/POTFILES.in: added the new files.
2001-06-26 20:09:43 +08:00
GimpImage *
made gimp->global_buffer a GimpBuffer, not TileManager. 2001-12-13 Michael Natterer <mitch@gimp.org> * app/core/gimp.[ch]: made gimp->global_buffer a GimpBuffer, not TileManager. * app/core/gimpbuffer.[ch]: added a "gboolean copy_pixels" to gimp_buffer_new(). * app/core/gimpimage-new.c * app/core/gimpedit.[ch] * app/core/gimpimage-qmask.c * app/widgets/gimpbufferpreview.c * app/widgets/gimpbufferview.c * app/widgets/gimpcontainerview-utils.c: chaned accordingly, don't include "base/tile-manager.h". * app/core/gimpdrawable.[ch]: added gimp_drawable_copy(). * app/core/gimpchannel.[ch] * app/core/gimplayer.[ch] * app/core/gimplayermask.[ch]: use it in gimp_[channel|layer|layer_mask]_copy(), added "GType new_type" as paramater to all of them. * app/core/gimpimage-duplicate.c * app/gui/channels-commands.c * app/gui/edit-commands.c * app/gui/layers-commands.c * app/widgets/gimpchannellistview.c * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/selection.pdb: changed accordingly. * app/pdb/channel_cmds.c * app/pdb/layer_cmds.c * app/pdb/selection_cmds.c: regenerated. * app/core/gimplayer.[ch]: removed the "layer_type" parameter from gimp_layer_new_from_tiles() because it always needed to be equal to gimp_image_base_type_with_alpha() of the passed image. * app/core/gimpdrawable-transform.c * app/core/gimpedit.c * app/core/gimpimage-mask.c: cahanged accordingly. * app/core/gimpimage.[ch]: added some new GIMP_IMAGE_TYPE_FOO() marcos to get rid of magic values like "pixels = 3" all over the place. * app/core/gimplayer.[ch]: added gimp_layer_new_from_drawable() which creates a layer from an other image's drawable. * app/core/gimpimage-convert.[ch]: made the RGB and GRAY converters public to use them above, use the new GIMP_IMAGE_TYPE() macros. * app/display/gimpdisplayshell-dnd.c * app/gui/toolbox.c: removed tile manager stuff and use the new functions. * app/widgets/gimpdrawablelistview.[ch]: added a "convert_drawable_func" which is used to handle drops from other images. * app/widgets/gimpdrawablelistitem.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplistitem.[ch]: implemented DND of layers between images using gimp_layer_new_from_drawable(). * app/gui/dialogs-constructors.c: changed accordingly.
2001-12-13 07:48:18 +08:00
gimp_edit_paste_as_new (Gimp *gimp,
GimpImage *invoke,
GimpBuffer *paste)
{
GimpImage *image;
GimpLayer *layer;
GimpImageType type;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (invoke == NULL || GIMP_IS_IMAGE (invoke), NULL);
g_return_val_if_fail (GIMP_IS_BUFFER (paste), NULL);
switch (tile_manager_bpp (paste->tiles))
{
case 1: type = GIMP_GRAY_IMAGE; break;
case 2: type = GIMP_GRAYA_IMAGE; break;
case 3: type = GIMP_RGB_IMAGE; break;
case 4: type = GIMP_RGBA_IMAGE; break;
default:
g_return_val_if_reached (NULL);
break;
}
2001-12-11 23:58:07 +08:00
/* create a new image (always of type GIMP_RGB) */
image = gimp_create_image (gimp,
gimp_buffer_get_width (paste),
2003-09-06 01:44:39 +08:00
gimp_buffer_get_height (paste),
GIMP_IMAGE_TYPE_BASE_TYPE (type),
TRUE);
gimp_image_undo_disable (image);
if (invoke)
{
gimp_image_set_resolution (image,
invoke->xresolution, invoke->yresolution);
gimp_image_set_unit (image,
gimp_image_get_unit (invoke));
}
app/Makefile.am removed. 2001-06-26 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/color_transfer.[ch]: removed. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.[ch]: added. * app/tools/gimpcolorbalancetool.c: changed accordingly. * app/base/Makefile.am * app/base/tile-manager-crop.[ch]: formerly known as crop_buffer(). * app/tools/gimptexttool.c: changed accordingly. * app/context_manager.[ch]: added the global clipboard and the named buffer list here. * app/app_procs.c: don't call color_transfer_init() and don't free the buffer stuff (done by the context manager now). * app/errorconsole.c: don't #include "gui/commands.h" * app/global_edit.[ch]: removed lots of stuff which is now done by gui/edit-commands.* or the new GimpBuffer object. The "paste named" dialog will go away and this file will be moved to core/ soon. * app/image_new.c: no need to declare the global_buffer extern any more. * app/qmask.c: don't #include "global_edit.h" * app/core/Makefile.am * app/core/core-types.h * app/core/gimpbuffer.[ch]: new object (aka named buffer) * app/core/gimpcontext.[ch]: added a GimpBuffer attribute. * app/core/gimpimage.[ch]: one s/int/gboolean/. * app/core/gimppattern.c: hmm... * app/gui/commands.[ch]: split up in small files: * app/gui/Makefile.am * app/gui/edit-commands.[ch] * app/gui/file-commands.[ch] * app/gui/image-commands.[ch] * app/gui/select-commands.[ch] * app/gui/view-commands.[ch]: new files. * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.c: added the named buffer list & grid. * app/gui/file-new-dialog.[ch] * app/gui/menus.c * app/gui/palette-editor.c * app/gui/test-commands.c: changed accordingly. * app/pdb/edit_cmds.c * tools/pdbgen/pdb/edit.pdb: changed for the global_edit stuff. * app/widgets/Makefile.am * app/widgets/gimpbufferpreview.[ch] * app/widgets/gimpbufferview.[ch] * app/widgets/gimpcontainereditor.[ch]: new widgets. * app/widgets/gimpcontainerview-utils.c * app/widgets/gimpdatafactoryview.[ch] * app/widgets/gimpdnd.[ch] * app/widgets/gimpdrawablepreview.c * app/widgets/gimplayerlistview.c * app/widgets/gimppreview.c * app/widgets/widgets-types.h: changed accordingly for the new GimpBuffer object and it's views, misc. cleanups. * pixmaps/Makefile.am * pixmaps/paste-as-new.xpm * pixmaps/paste-into.xpm * pixmaps/paste.xpm: new pixmaps (they all look the same... Tigert? ;-) * po/POTFILES.in: added the new files.
2001-06-26 20:09:43 +08:00
layer = gimp_layer_new_from_tiles (paste->tiles, image, type,
_("Pasted Layer"),
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE);
if (! layer)
{
g_object_unref (image);
return NULL;
}
gimp_image_add_layer (image, layer, 0);
gimp_image_undo_enable (image);
return image;
}
1997-11-25 06:05:25 +08:00
const gchar *
gimp_edit_named_cut (GimpImage *image,
const gchar *name,
GimpDrawable *drawable,
GimpContext *context)
{
GimpBuffer *buffer;
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
g_return_val_if_fail (name != NULL, NULL);
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
buffer = gimp_edit_extract (image, drawable, context, TRUE);
if (buffer)
{
gimp_object_set_name (GIMP_OBJECT (buffer), name);
gimp_container_add (image->gimp->named_buffers, GIMP_OBJECT (buffer));
g_object_unref (buffer);
return gimp_object_get_name (GIMP_OBJECT (buffer));
}
return NULL;
}
const gchar *
gimp_edit_named_copy (GimpImage *image,
const gchar *name,
GimpDrawable *drawable,
GimpContext *context)
{
GimpBuffer *buffer;
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
g_return_val_if_fail (name != NULL, NULL);
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
buffer = gimp_edit_extract (image, drawable, context, FALSE);
if (buffer)
{
gimp_object_set_name (GIMP_OBJECT (buffer), name);
gimp_container_add (image->gimp->named_buffers, GIMP_OBJECT (buffer));
g_object_unref (buffer);
return gimp_object_get_name (GIMP_OBJECT (buffer));
}
return NULL;
}
const gchar *
gimp_edit_named_copy_visible (GimpImage *image,
const gchar *name,
GimpContext *context)
{
GimpBuffer *buffer;
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
g_return_val_if_fail (name != NULL, NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
buffer = gimp_edit_extract_visible (image, context);
if (buffer)
{
gimp_object_set_name (GIMP_OBJECT (buffer), name);
gimp_container_add (image->gimp->named_buffers, GIMP_OBJECT (buffer));
g_object_unref (buffer);
return gimp_object_get_name (GIMP_OBJECT (buffer));
}
return NULL;
}
gboolean
gimp_edit_clear (GimpImage *image,
GimpDrawable *drawable,
Get rid of the "current_context" which was in fact just a bunch of global 2004-04-15 Michael Natterer <mitch@gimp.org> Get rid of the "current_context" which was in fact just a bunch of global variables. Instead, pass the needed context all the way from the GUI and the PDB to the core. This is a prerequisite for macro recording and generally helps separating the various subsystems from each other. Work in progress... * app/core/gimp.[ch]: removed member "current_context" and gimp_[get|set]_current_context(). * app/core/gimp-edit.[ch] * app/core/gimpdrawable-blend.[ch] * app/core/gimpdrawable-bucket-fill.[ch] * app/core/gimpdrawable-offset.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-crop.[ch] * app/core/gimpimage-flip.[ch] * app/core/gimpimage-merge.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-rotate.[ch] * app/core/gimpimage.[ch] * app/core/gimpimagefile.[ch] * app/core/gimpitem-linked.[ch] * app/core/gimpitem.[ch] * app/core/gimplayer.[ch] * app/core/gimpselection.[ch] * app/core/gimptemplate.[ch] * app/file/file-open.[ch] * app/file/file-save.[ch] * app/pdb/procedural_db.[ch] * app/text/gimptext-compat.[ch] * app/text/gimptextlayer-transform.[ch] * app/gui/brush-select.[ch] * app/gui/font-select.[ch] * app/gui/gradient-select.[ch] * app/gui/palette-select.[ch] * app/gui/pattern-select.[ch]: added tons of "GimpContext *context" parameters and use the passed context instead of gimp_get_current_context(). * app/app_procs.c * app/batch.c * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/paint/gimperaser.c * app/paint/gimppaintbrush.c * app/plug-in/plug-in-message.c * app/plug-in/plug-ins.c * app/text/gimptextlayer.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpcroptool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpfliptool.c * app/tools/gimpinktool.c * app/tools/gimptransformtool.c * app/vectors/gimpvectors.c * app/gui/convert-dialog.c * app/gui/drawable-commands.c * app/gui/edit-commands.c * app/gui/file-commands.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/image-commands.c * app/gui/layers-commands.c * app/gui/offset-dialog.c * app/gui/select-commands.c * app/gui/vectors-commands.c * app/widgets/gimpdnd.c * app/widgets/gimpdocumentview.c * app/widgets/gimphelp.c * app/widgets/gimpthumbbox.c: pass gimp_get_user_context() or GIMP_CONTEXT(tool_options) or whatever is the right context to the changed core functions. * tools/pdbgen/app.pl: pass "GimpContext *context" to all generated PDB invokers. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/font_select.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/paint_tools.pdb * tools/pdbgen/pdb/palette.pdb * tools/pdbgen/pdb/palette_select.pdb * tools/pdbgen/pdb/palettes.pdb * tools/pdbgen/pdb/paths.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/text_tool.pdb * tools/pdbgen/pdb/transform_tools.pdb: pass the new context parameter to the changed core functions. * app/pdb/*_cmds.c: regenerated.
2004-04-15 07:37:34 +08:00
GimpContext *context)
1997-11-25 06:05:25 +08:00
{
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
app/Makefile.am removed. 2001-06-26 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/color_transfer.[ch]: removed. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.[ch]: added. * app/tools/gimpcolorbalancetool.c: changed accordingly. * app/base/Makefile.am * app/base/tile-manager-crop.[ch]: formerly known as crop_buffer(). * app/tools/gimptexttool.c: changed accordingly. * app/context_manager.[ch]: added the global clipboard and the named buffer list here. * app/app_procs.c: don't call color_transfer_init() and don't free the buffer stuff (done by the context manager now). * app/errorconsole.c: don't #include "gui/commands.h" * app/global_edit.[ch]: removed lots of stuff which is now done by gui/edit-commands.* or the new GimpBuffer object. The "paste named" dialog will go away and this file will be moved to core/ soon. * app/image_new.c: no need to declare the global_buffer extern any more. * app/qmask.c: don't #include "global_edit.h" * app/core/Makefile.am * app/core/core-types.h * app/core/gimpbuffer.[ch]: new object (aka named buffer) * app/core/gimpcontext.[ch]: added a GimpBuffer attribute. * app/core/gimpimage.[ch]: one s/int/gboolean/. * app/core/gimppattern.c: hmm... * app/gui/commands.[ch]: split up in small files: * app/gui/Makefile.am * app/gui/edit-commands.[ch] * app/gui/file-commands.[ch] * app/gui/image-commands.[ch] * app/gui/select-commands.[ch] * app/gui/view-commands.[ch]: new files. * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.c: added the named buffer list & grid. * app/gui/file-new-dialog.[ch] * app/gui/menus.c * app/gui/palette-editor.c * app/gui/test-commands.c: changed accordingly. * app/pdb/edit_cmds.c * tools/pdbgen/pdb/edit.pdb: changed for the global_edit stuff. * app/widgets/Makefile.am * app/widgets/gimpbufferpreview.[ch] * app/widgets/gimpbufferview.[ch] * app/widgets/gimpcontainereditor.[ch]: new widgets. * app/widgets/gimpcontainerview-utils.c * app/widgets/gimpdatafactoryview.[ch] * app/widgets/gimpdnd.[ch] * app/widgets/gimpdrawablepreview.c * app/widgets/gimplayerlistview.c * app/widgets/gimppreview.c * app/widgets/widgets-types.h: changed accordingly for the new GimpBuffer object and it's views, misc. cleanups. * pixmaps/Makefile.am * pixmaps/paste-as-new.xpm * pixmaps/paste-into.xpm * pixmaps/paste.xpm: new pixmaps (they all look the same... Tigert? ;-) * po/POTFILES.in: added the new files.
2001-06-26 20:09:43 +08:00
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), FALSE);
Get rid of the "current_context" which was in fact just a bunch of global 2004-04-15 Michael Natterer <mitch@gimp.org> Get rid of the "current_context" which was in fact just a bunch of global variables. Instead, pass the needed context all the way from the GUI and the PDB to the core. This is a prerequisite for macro recording and generally helps separating the various subsystems from each other. Work in progress... * app/core/gimp.[ch]: removed member "current_context" and gimp_[get|set]_current_context(). * app/core/gimp-edit.[ch] * app/core/gimpdrawable-blend.[ch] * app/core/gimpdrawable-bucket-fill.[ch] * app/core/gimpdrawable-offset.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-crop.[ch] * app/core/gimpimage-flip.[ch] * app/core/gimpimage-merge.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-rotate.[ch] * app/core/gimpimage.[ch] * app/core/gimpimagefile.[ch] * app/core/gimpitem-linked.[ch] * app/core/gimpitem.[ch] * app/core/gimplayer.[ch] * app/core/gimpselection.[ch] * app/core/gimptemplate.[ch] * app/file/file-open.[ch] * app/file/file-save.[ch] * app/pdb/procedural_db.[ch] * app/text/gimptext-compat.[ch] * app/text/gimptextlayer-transform.[ch] * app/gui/brush-select.[ch] * app/gui/font-select.[ch] * app/gui/gradient-select.[ch] * app/gui/palette-select.[ch] * app/gui/pattern-select.[ch]: added tons of "GimpContext *context" parameters and use the passed context instead of gimp_get_current_context(). * app/app_procs.c * app/batch.c * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/paint/gimperaser.c * app/paint/gimppaintbrush.c * app/plug-in/plug-in-message.c * app/plug-in/plug-ins.c * app/text/gimptextlayer.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpcroptool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpfliptool.c * app/tools/gimpinktool.c * app/tools/gimptransformtool.c * app/vectors/gimpvectors.c * app/gui/convert-dialog.c * app/gui/drawable-commands.c * app/gui/edit-commands.c * app/gui/file-commands.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/image-commands.c * app/gui/layers-commands.c * app/gui/offset-dialog.c * app/gui/select-commands.c * app/gui/vectors-commands.c * app/widgets/gimpdnd.c * app/widgets/gimpdocumentview.c * app/widgets/gimphelp.c * app/widgets/gimpthumbbox.c: pass gimp_get_user_context() or GIMP_CONTEXT(tool_options) or whatever is the right context to the changed core functions. * tools/pdbgen/app.pl: pass "GimpContext *context" to all generated PDB invokers. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/font_select.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/paint_tools.pdb * tools/pdbgen/pdb/palette.pdb * tools/pdbgen/pdb/palette_select.pdb * tools/pdbgen/pdb/palettes.pdb * tools/pdbgen/pdb/paths.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/text_tool.pdb * tools/pdbgen/pdb/transform_tools.pdb: pass the new context parameter to the changed core functions. * app/pdb/*_cmds.c: regenerated.
2004-04-15 07:37:34 +08:00
g_return_val_if_fail (GIMP_IS_CONTEXT (context), FALSE);
1997-11-25 06:05:25 +08:00
return gimp_edit_fill_internal (image, drawable, context,
GIMP_TRANSPARENT_FILL,
GIMP_OPACITY_OPAQUE, GIMP_ERASE_MODE,
_("Clear"));
1997-11-25 06:05:25 +08:00
}
gboolean
gimp_edit_fill (GimpImage *image,
GimpDrawable *drawable,
Get rid of the "current_context" which was in fact just a bunch of global 2004-04-15 Michael Natterer <mitch@gimp.org> Get rid of the "current_context" which was in fact just a bunch of global variables. Instead, pass the needed context all the way from the GUI and the PDB to the core. This is a prerequisite for macro recording and generally helps separating the various subsystems from each other. Work in progress... * app/core/gimp.[ch]: removed member "current_context" and gimp_[get|set]_current_context(). * app/core/gimp-edit.[ch] * app/core/gimpdrawable-blend.[ch] * app/core/gimpdrawable-bucket-fill.[ch] * app/core/gimpdrawable-offset.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-crop.[ch] * app/core/gimpimage-flip.[ch] * app/core/gimpimage-merge.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-rotate.[ch] * app/core/gimpimage.[ch] * app/core/gimpimagefile.[ch] * app/core/gimpitem-linked.[ch] * app/core/gimpitem.[ch] * app/core/gimplayer.[ch] * app/core/gimpselection.[ch] * app/core/gimptemplate.[ch] * app/file/file-open.[ch] * app/file/file-save.[ch] * app/pdb/procedural_db.[ch] * app/text/gimptext-compat.[ch] * app/text/gimptextlayer-transform.[ch] * app/gui/brush-select.[ch] * app/gui/font-select.[ch] * app/gui/gradient-select.[ch] * app/gui/palette-select.[ch] * app/gui/pattern-select.[ch]: added tons of "GimpContext *context" parameters and use the passed context instead of gimp_get_current_context(). * app/app_procs.c * app/batch.c * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/paint/gimperaser.c * app/paint/gimppaintbrush.c * app/plug-in/plug-in-message.c * app/plug-in/plug-ins.c * app/text/gimptextlayer.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpcroptool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpfliptool.c * app/tools/gimpinktool.c * app/tools/gimptransformtool.c * app/vectors/gimpvectors.c * app/gui/convert-dialog.c * app/gui/drawable-commands.c * app/gui/edit-commands.c * app/gui/file-commands.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/image-commands.c * app/gui/layers-commands.c * app/gui/offset-dialog.c * app/gui/select-commands.c * app/gui/vectors-commands.c * app/widgets/gimpdnd.c * app/widgets/gimpdocumentview.c * app/widgets/gimphelp.c * app/widgets/gimpthumbbox.c: pass gimp_get_user_context() or GIMP_CONTEXT(tool_options) or whatever is the right context to the changed core functions. * tools/pdbgen/app.pl: pass "GimpContext *context" to all generated PDB invokers. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/font_select.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/paint_tools.pdb * tools/pdbgen/pdb/palette.pdb * tools/pdbgen/pdb/palette_select.pdb * tools/pdbgen/pdb/palettes.pdb * tools/pdbgen/pdb/paths.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/text_tool.pdb * tools/pdbgen/pdb/transform_tools.pdb: pass the new context parameter to the changed core functions. * app/pdb/*_cmds.c: regenerated.
2004-04-15 07:37:34 +08:00
GimpContext *context,
GimpFillType fill_type)
1997-11-25 06:05:25 +08:00
{
const gchar *undo_desc;
1997-11-25 06:05:25 +08:00
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
app/Makefile.am removed. 2001-06-26 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/color_transfer.[ch]: removed. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.[ch]: added. * app/tools/gimpcolorbalancetool.c: changed accordingly. * app/base/Makefile.am * app/base/tile-manager-crop.[ch]: formerly known as crop_buffer(). * app/tools/gimptexttool.c: changed accordingly. * app/context_manager.[ch]: added the global clipboard and the named buffer list here. * app/app_procs.c: don't call color_transfer_init() and don't free the buffer stuff (done by the context manager now). * app/errorconsole.c: don't #include "gui/commands.h" * app/global_edit.[ch]: removed lots of stuff which is now done by gui/edit-commands.* or the new GimpBuffer object. The "paste named" dialog will go away and this file will be moved to core/ soon. * app/image_new.c: no need to declare the global_buffer extern any more. * app/qmask.c: don't #include "global_edit.h" * app/core/Makefile.am * app/core/core-types.h * app/core/gimpbuffer.[ch]: new object (aka named buffer) * app/core/gimpcontext.[ch]: added a GimpBuffer attribute. * app/core/gimpimage.[ch]: one s/int/gboolean/. * app/core/gimppattern.c: hmm... * app/gui/commands.[ch]: split up in small files: * app/gui/Makefile.am * app/gui/edit-commands.[ch] * app/gui/file-commands.[ch] * app/gui/image-commands.[ch] * app/gui/select-commands.[ch] * app/gui/view-commands.[ch]: new files. * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.c: added the named buffer list & grid. * app/gui/file-new-dialog.[ch] * app/gui/menus.c * app/gui/palette-editor.c * app/gui/test-commands.c: changed accordingly. * app/pdb/edit_cmds.c * tools/pdbgen/pdb/edit.pdb: changed for the global_edit stuff. * app/widgets/Makefile.am * app/widgets/gimpbufferpreview.[ch] * app/widgets/gimpbufferview.[ch] * app/widgets/gimpcontainereditor.[ch]: new widgets. * app/widgets/gimpcontainerview-utils.c * app/widgets/gimpdatafactoryview.[ch] * app/widgets/gimpdnd.[ch] * app/widgets/gimpdrawablepreview.c * app/widgets/gimplayerlistview.c * app/widgets/gimppreview.c * app/widgets/widgets-types.h: changed accordingly for the new GimpBuffer object and it's views, misc. cleanups. * pixmaps/Makefile.am * pixmaps/paste-as-new.xpm * pixmaps/paste-into.xpm * pixmaps/paste.xpm: new pixmaps (they all look the same... Tigert? ;-) * po/POTFILES.in: added the new files.
2001-06-26 20:09:43 +08:00
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), FALSE);
Get rid of the "current_context" which was in fact just a bunch of global 2004-04-15 Michael Natterer <mitch@gimp.org> Get rid of the "current_context" which was in fact just a bunch of global variables. Instead, pass the needed context all the way from the GUI and the PDB to the core. This is a prerequisite for macro recording and generally helps separating the various subsystems from each other. Work in progress... * app/core/gimp.[ch]: removed member "current_context" and gimp_[get|set]_current_context(). * app/core/gimp-edit.[ch] * app/core/gimpdrawable-blend.[ch] * app/core/gimpdrawable-bucket-fill.[ch] * app/core/gimpdrawable-offset.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-crop.[ch] * app/core/gimpimage-flip.[ch] * app/core/gimpimage-merge.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-rotate.[ch] * app/core/gimpimage.[ch] * app/core/gimpimagefile.[ch] * app/core/gimpitem-linked.[ch] * app/core/gimpitem.[ch] * app/core/gimplayer.[ch] * app/core/gimpselection.[ch] * app/core/gimptemplate.[ch] * app/file/file-open.[ch] * app/file/file-save.[ch] * app/pdb/procedural_db.[ch] * app/text/gimptext-compat.[ch] * app/text/gimptextlayer-transform.[ch] * app/gui/brush-select.[ch] * app/gui/font-select.[ch] * app/gui/gradient-select.[ch] * app/gui/palette-select.[ch] * app/gui/pattern-select.[ch]: added tons of "GimpContext *context" parameters and use the passed context instead of gimp_get_current_context(). * app/app_procs.c * app/batch.c * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/paint/gimperaser.c * app/paint/gimppaintbrush.c * app/plug-in/plug-in-message.c * app/plug-in/plug-ins.c * app/text/gimptextlayer.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpcroptool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpfliptool.c * app/tools/gimpinktool.c * app/tools/gimptransformtool.c * app/vectors/gimpvectors.c * app/gui/convert-dialog.c * app/gui/drawable-commands.c * app/gui/edit-commands.c * app/gui/file-commands.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/image-commands.c * app/gui/layers-commands.c * app/gui/offset-dialog.c * app/gui/select-commands.c * app/gui/vectors-commands.c * app/widgets/gimpdnd.c * app/widgets/gimpdocumentview.c * app/widgets/gimphelp.c * app/widgets/gimpthumbbox.c: pass gimp_get_user_context() or GIMP_CONTEXT(tool_options) or whatever is the right context to the changed core functions. * tools/pdbgen/app.pl: pass "GimpContext *context" to all generated PDB invokers. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/font_select.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/paint_tools.pdb * tools/pdbgen/pdb/palette.pdb * tools/pdbgen/pdb/palette_select.pdb * tools/pdbgen/pdb/palettes.pdb * tools/pdbgen/pdb/paths.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/text_tool.pdb * tools/pdbgen/pdb/transform_tools.pdb: pass the new context parameter to the changed core functions. * app/pdb/*_cmds.c: regenerated.
2004-04-15 07:37:34 +08:00
g_return_val_if_fail (GIMP_IS_CONTEXT (context), FALSE);
1997-11-25 06:05:25 +08:00
switch (fill_type)
{
case GIMP_FOREGROUND_FILL:
undo_desc = _("Fill with Foreground Color");
break;
case GIMP_BACKGROUND_FILL:
undo_desc = _("Fill with Background Color");
break;
case GIMP_WHITE_FILL:
undo_desc = _("Fill with White");
break;
case GIMP_TRANSPARENT_FILL:
undo_desc = _("Fill with Transparency");
break;
Enabled skipping enum values for either the PDB or GType registration 2004-01-06 Michael Natterer <mitch@gimp.org> Enabled skipping enum values for either the PDB or GType registration (don't always skip both targets): * tools/gimp-mkenums: skip enum values only if there is a literal "skip" (don't match "pdb-skip"). * tools/pdbgen/enumgen.pl: skip only "pdb-skip" values, not "skip" ones. * app/base/base-enums.h * app/core/core-enums.h * app/paint/paint-enums.h * libgimpbase/gimpbaseenums.h: use the right "pdb-skip"/"skip" combination to skip enum values. Changed comments accordingly. Cleaned up the fill functions: * app/core/core-enums.[ch]: added GIMP_PATTERN_FILL enum value to the GimpFillType enum. Don't export GIMP_NO_FILL to the PDB because it's completely useless to export a NOP. * app/core/gimp-edit.c (gimp_edit_fill, gimp_edit_fill_internal): handle pattern fill requests. * app/core/gimpdrawable.[ch] (gimp_drawable_fill): added GimpPattern parameter and fill with it if it's non-NULL. (gimp_drawable_fill_by_type): handle pattern fill and pass the current pattern to gimp_drawable_fill(). * app/text/gimptextlayer.c: changed accordingly. * app/gui/edit-commands.c * app/gui/image-menu.c: use gimp_edit_fill() instead of gimp_drawable_bucket_fill() for FG, BG and pattern filling. * libgimp/gimpcompat.h * plug-ins/script-fu/siod-wrapper.c: removed NO_IMAGE_FILL compat enum value. It should have never been exported to the PDB. * app/pdb/drawable_cmds.c * app/pdb/edit_cmds.c * libgimp/gimpenums.h * plug-ins/pygimp/gimpenums.py * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: regenerated.
2004-01-06 22:02:08 +08:00
case GIMP_PATTERN_FILL:
undo_desc = _("Fill with Pattern");
break;
case GIMP_NO_FILL:
return TRUE; /* nothing to do, but the fill succeded */
default:
g_warning ("%s: unknown fill type", G_STRFUNC);
return gimp_edit_fill (image, drawable, context, GIMP_BACKGROUND_FILL);
}
return gimp_edit_fill_internal (image, drawable, context,
fill_type,
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE,
undo_desc);
}
/* private functions */
static GimpBuffer *
gimp_edit_extract (GimpImage *image,
GimpDrawable *drawable,
Get rid of the "current_context" which was in fact just a bunch of global 2004-04-15 Michael Natterer <mitch@gimp.org> Get rid of the "current_context" which was in fact just a bunch of global variables. Instead, pass the needed context all the way from the GUI and the PDB to the core. This is a prerequisite for macro recording and generally helps separating the various subsystems from each other. Work in progress... * app/core/gimp.[ch]: removed member "current_context" and gimp_[get|set]_current_context(). * app/core/gimp-edit.[ch] * app/core/gimpdrawable-blend.[ch] * app/core/gimpdrawable-bucket-fill.[ch] * app/core/gimpdrawable-offset.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-crop.[ch] * app/core/gimpimage-flip.[ch] * app/core/gimpimage-merge.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-rotate.[ch] * app/core/gimpimage.[ch] * app/core/gimpimagefile.[ch] * app/core/gimpitem-linked.[ch] * app/core/gimpitem.[ch] * app/core/gimplayer.[ch] * app/core/gimpselection.[ch] * app/core/gimptemplate.[ch] * app/file/file-open.[ch] * app/file/file-save.[ch] * app/pdb/procedural_db.[ch] * app/text/gimptext-compat.[ch] * app/text/gimptextlayer-transform.[ch] * app/gui/brush-select.[ch] * app/gui/font-select.[ch] * app/gui/gradient-select.[ch] * app/gui/palette-select.[ch] * app/gui/pattern-select.[ch]: added tons of "GimpContext *context" parameters and use the passed context instead of gimp_get_current_context(). * app/app_procs.c * app/batch.c * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/paint/gimperaser.c * app/paint/gimppaintbrush.c * app/plug-in/plug-in-message.c * app/plug-in/plug-ins.c * app/text/gimptextlayer.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpcroptool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpfliptool.c * app/tools/gimpinktool.c * app/tools/gimptransformtool.c * app/vectors/gimpvectors.c * app/gui/convert-dialog.c * app/gui/drawable-commands.c * app/gui/edit-commands.c * app/gui/file-commands.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/image-commands.c * app/gui/layers-commands.c * app/gui/offset-dialog.c * app/gui/select-commands.c * app/gui/vectors-commands.c * app/widgets/gimpdnd.c * app/widgets/gimpdocumentview.c * app/widgets/gimphelp.c * app/widgets/gimpthumbbox.c: pass gimp_get_user_context() or GIMP_CONTEXT(tool_options) or whatever is the right context to the changed core functions. * tools/pdbgen/app.pl: pass "GimpContext *context" to all generated PDB invokers. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/font_select.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/paint_tools.pdb * tools/pdbgen/pdb/palette.pdb * tools/pdbgen/pdb/palette_select.pdb * tools/pdbgen/pdb/palettes.pdb * tools/pdbgen/pdb/paths.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/text_tool.pdb * tools/pdbgen/pdb/transform_tools.pdb: pass the new context parameter to the changed core functions. * app/pdb/*_cmds.c: regenerated.
2004-04-15 07:37:34 +08:00
GimpContext *context,
gboolean cut_pixels)
{
TileManager *tiles;
gboolean empty;
/* See if the image mask is empty */
empty = gimp_channel_is_empty (gimp_image_get_mask (image));
if (cut_pixels)
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_EDIT_CUT, _("Cut"));
/* Cut/copy the mask portion from the image */
tiles = gimp_selection_extract (gimp_image_get_mask (image),
drawable, context, cut_pixels, FALSE, FALSE);
if (cut_pixels)
gimp_image_undo_group_end (image);
return gimp_edit_make_buffer (image->gimp, tiles, empty);
}
static GimpBuffer *
gimp_edit_extract_visible (GimpImage *image,
GimpContext *context)
{
GimpPickable *pickable;
TileManager *tiles;
PixelRegion srcPR, destPR;
gboolean non_empty;
gint x1, y1, x2, y2;
non_empty = gimp_channel_bounds (gimp_image_get_mask (image),
&x1, &y1, &x2, &y2);
if ((x1 == x2) || (y1 == y2))
{
g_message (_("Unable to cut or copy because the "
"selected region is empty."));
return NULL;
}
pickable = GIMP_PICKABLE (image->projection);
gimp_pickable_flush (pickable);
tiles = tile_manager_new (x2 - x1, y2 - y1,
gimp_pickable_get_bytes (pickable));
tile_manager_set_offsets (tiles, x1, y1);
pixel_region_init (&srcPR, gimp_pickable_get_tiles (pickable),
x1, y1,
x2 - x1, y2 - y1,
FALSE);
pixel_region_init (&destPR, tiles,
0, 0,
x2 - x1, y2 - y1,
TRUE);
/* use EEKy no-COW copying because sharing tiles with the projection
* is buggy as hell, probably because tile_invalidate() doesn't
* do what it should --mitch
*/
copy_region_nocow (&srcPR, &destPR);
return gimp_edit_make_buffer (image->gimp, tiles, ! non_empty);
}
static GimpBuffer *
gimp_edit_make_buffer (Gimp *gimp,
TileManager *tiles,
gboolean mask_empty)
{
/* Only crop if the image mask wasn't empty */
if (tiles && ! mask_empty)
{
TileManager *crop = tile_manager_crop (tiles, 0);
if (crop != tiles)
{
tile_manager_unref (tiles);
tiles = crop;
}
}
if (tiles)
return gimp_buffer_new (tiles, _("Global Buffer"), FALSE);
return NULL;
}
static gboolean
gimp_edit_fill_internal (GimpImage *image,
GimpDrawable *drawable,
GimpContext *context,
GimpFillType fill_type,
gdouble opacity,
GimpLayerModeEffects paint_mode,
const gchar *undo_desc)
{
TileManager *buf_tiles;
PixelRegion bufPR;
gint x, y, width, height;
Enabled skipping enum values for either the PDB or GType registration 2004-01-06 Michael Natterer <mitch@gimp.org> Enabled skipping enum values for either the PDB or GType registration (don't always skip both targets): * tools/gimp-mkenums: skip enum values only if there is a literal "skip" (don't match "pdb-skip"). * tools/pdbgen/enumgen.pl: skip only "pdb-skip" values, not "skip" ones. * app/base/base-enums.h * app/core/core-enums.h * app/paint/paint-enums.h * libgimpbase/gimpbaseenums.h: use the right "pdb-skip"/"skip" combination to skip enum values. Changed comments accordingly. Cleaned up the fill functions: * app/core/core-enums.[ch]: added GIMP_PATTERN_FILL enum value to the GimpFillType enum. Don't export GIMP_NO_FILL to the PDB because it's completely useless to export a NOP. * app/core/gimp-edit.c (gimp_edit_fill, gimp_edit_fill_internal): handle pattern fill requests. * app/core/gimpdrawable.[ch] (gimp_drawable_fill): added GimpPattern parameter and fill with it if it's non-NULL. (gimp_drawable_fill_by_type): handle pattern fill and pass the current pattern to gimp_drawable_fill(). * app/text/gimptextlayer.c: changed accordingly. * app/gui/edit-commands.c * app/gui/image-menu.c: use gimp_edit_fill() instead of gimp_drawable_bucket_fill() for FG, BG and pattern filling. * libgimp/gimpcompat.h * plug-ins/script-fu/siod-wrapper.c: removed NO_IMAGE_FILL compat enum value. It should have never been exported to the PDB. * app/pdb/drawable_cmds.c * app/pdb/edit_cmds.c * libgimp/gimpenums.h * plug-ins/pygimp/gimpenums.py * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: regenerated.
2004-01-06 22:02:08 +08:00
gint tiles_bytes;
guchar col[MAX_CHANNELS];
Enabled skipping enum values for either the PDB or GType registration 2004-01-06 Michael Natterer <mitch@gimp.org> Enabled skipping enum values for either the PDB or GType registration (don't always skip both targets): * tools/gimp-mkenums: skip enum values only if there is a literal "skip" (don't match "pdb-skip"). * tools/pdbgen/enumgen.pl: skip only "pdb-skip" values, not "skip" ones. * app/base/base-enums.h * app/core/core-enums.h * app/paint/paint-enums.h * libgimpbase/gimpbaseenums.h: use the right "pdb-skip"/"skip" combination to skip enum values. Changed comments accordingly. Cleaned up the fill functions: * app/core/core-enums.[ch]: added GIMP_PATTERN_FILL enum value to the GimpFillType enum. Don't export GIMP_NO_FILL to the PDB because it's completely useless to export a NOP. * app/core/gimp-edit.c (gimp_edit_fill, gimp_edit_fill_internal): handle pattern fill requests. * app/core/gimpdrawable.[ch] (gimp_drawable_fill): added GimpPattern parameter and fill with it if it's non-NULL. (gimp_drawable_fill_by_type): handle pattern fill and pass the current pattern to gimp_drawable_fill(). * app/text/gimptextlayer.c: changed accordingly. * app/gui/edit-commands.c * app/gui/image-menu.c: use gimp_edit_fill() instead of gimp_drawable_bucket_fill() for FG, BG and pattern filling. * libgimp/gimpcompat.h * plug-ins/script-fu/siod-wrapper.c: removed NO_IMAGE_FILL compat enum value. It should have never been exported to the PDB. * app/pdb/drawable_cmds.c * app/pdb/edit_cmds.c * libgimp/gimpenums.h * plug-ins/pygimp/gimpenums.py * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: regenerated.
2004-01-06 22:02:08 +08:00
TempBuf *pat_buf = NULL;
gboolean new_buf;
if (! gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
Enabled skipping enum values for either the PDB or GType registration 2004-01-06 Michael Natterer <mitch@gimp.org> Enabled skipping enum values for either the PDB or GType registration (don't always skip both targets): * tools/gimp-mkenums: skip enum values only if there is a literal "skip" (don't match "pdb-skip"). * tools/pdbgen/enumgen.pl: skip only "pdb-skip" values, not "skip" ones. * app/base/base-enums.h * app/core/core-enums.h * app/paint/paint-enums.h * libgimpbase/gimpbaseenums.h: use the right "pdb-skip"/"skip" combination to skip enum values. Changed comments accordingly. Cleaned up the fill functions: * app/core/core-enums.[ch]: added GIMP_PATTERN_FILL enum value to the GimpFillType enum. Don't export GIMP_NO_FILL to the PDB because it's completely useless to export a NOP. * app/core/gimp-edit.c (gimp_edit_fill, gimp_edit_fill_internal): handle pattern fill requests. * app/core/gimpdrawable.[ch] (gimp_drawable_fill): added GimpPattern parameter and fill with it if it's non-NULL. (gimp_drawable_fill_by_type): handle pattern fill and pass the current pattern to gimp_drawable_fill(). * app/text/gimptextlayer.c: changed accordingly. * app/gui/edit-commands.c * app/gui/image-menu.c: use gimp_edit_fill() instead of gimp_drawable_bucket_fill() for FG, BG and pattern filling. * libgimp/gimpcompat.h * plug-ins/script-fu/siod-wrapper.c: removed NO_IMAGE_FILL compat enum value. It should have never been exported to the PDB. * app/pdb/drawable_cmds.c * app/pdb/edit_cmds.c * libgimp/gimpenums.h * plug-ins/pygimp/gimpenums.py * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: regenerated.
2004-01-06 22:02:08 +08:00
return TRUE; /* nothing to do, but the fill succeded */
tiles_bytes = gimp_drawable_bytes (drawable);
switch (fill_type)
{
case GIMP_FOREGROUND_FILL:
gimp_image_get_foreground (image, drawable, context, col);
break;
case GIMP_BACKGROUND_FILL:
case GIMP_TRANSPARENT_FILL:
gimp_image_get_background (image, drawable, context, col);
break;
case GIMP_WHITE_FILL:
Enabled skipping enum values for either the PDB or GType registration 2004-01-06 Michael Natterer <mitch@gimp.org> Enabled skipping enum values for either the PDB or GType registration (don't always skip both targets): * tools/gimp-mkenums: skip enum values only if there is a literal "skip" (don't match "pdb-skip"). * tools/pdbgen/enumgen.pl: skip only "pdb-skip" values, not "skip" ones. * app/base/base-enums.h * app/core/core-enums.h * app/paint/paint-enums.h * libgimpbase/gimpbaseenums.h: use the right "pdb-skip"/"skip" combination to skip enum values. Changed comments accordingly. Cleaned up the fill functions: * app/core/core-enums.[ch]: added GIMP_PATTERN_FILL enum value to the GimpFillType enum. Don't export GIMP_NO_FILL to the PDB because it's completely useless to export a NOP. * app/core/gimp-edit.c (gimp_edit_fill, gimp_edit_fill_internal): handle pattern fill requests. * app/core/gimpdrawable.[ch] (gimp_drawable_fill): added GimpPattern parameter and fill with it if it's non-NULL. (gimp_drawable_fill_by_type): handle pattern fill and pass the current pattern to gimp_drawable_fill(). * app/text/gimptextlayer.c: changed accordingly. * app/gui/edit-commands.c * app/gui/image-menu.c: use gimp_edit_fill() instead of gimp_drawable_bucket_fill() for FG, BG and pattern filling. * libgimp/gimpcompat.h * plug-ins/script-fu/siod-wrapper.c: removed NO_IMAGE_FILL compat enum value. It should have never been exported to the PDB. * app/pdb/drawable_cmds.c * app/pdb/edit_cmds.c * libgimp/gimpenums.h * plug-ins/pygimp/gimpenums.py * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: regenerated.
2004-01-06 22:02:08 +08:00
{
guchar tmp_col[MAX_CHANNELS];
tmp_col[RED_PIX] = 255;
tmp_col[GREEN_PIX] = 255;
tmp_col[BLUE_PIX] = 255;
gimp_image_transform_color (image, drawable, col, GIMP_RGB, tmp_col);
Enabled skipping enum values for either the PDB or GType registration 2004-01-06 Michael Natterer <mitch@gimp.org> Enabled skipping enum values for either the PDB or GType registration (don't always skip both targets): * tools/gimp-mkenums: skip enum values only if there is a literal "skip" (don't match "pdb-skip"). * tools/pdbgen/enumgen.pl: skip only "pdb-skip" values, not "skip" ones. * app/base/base-enums.h * app/core/core-enums.h * app/paint/paint-enums.h * libgimpbase/gimpbaseenums.h: use the right "pdb-skip"/"skip" combination to skip enum values. Changed comments accordingly. Cleaned up the fill functions: * app/core/core-enums.[ch]: added GIMP_PATTERN_FILL enum value to the GimpFillType enum. Don't export GIMP_NO_FILL to the PDB because it's completely useless to export a NOP. * app/core/gimp-edit.c (gimp_edit_fill, gimp_edit_fill_internal): handle pattern fill requests. * app/core/gimpdrawable.[ch] (gimp_drawable_fill): added GimpPattern parameter and fill with it if it's non-NULL. (gimp_drawable_fill_by_type): handle pattern fill and pass the current pattern to gimp_drawable_fill(). * app/text/gimptextlayer.c: changed accordingly. * app/gui/edit-commands.c * app/gui/image-menu.c: use gimp_edit_fill() instead of gimp_drawable_bucket_fill() for FG, BG and pattern filling. * libgimp/gimpcompat.h * plug-ins/script-fu/siod-wrapper.c: removed NO_IMAGE_FILL compat enum value. It should have never been exported to the PDB. * app/pdb/drawable_cmds.c * app/pdb/edit_cmds.c * libgimp/gimpenums.h * plug-ins/pygimp/gimpenums.py * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: regenerated.
2004-01-06 22:02:08 +08:00
}
break;
case GIMP_PATTERN_FILL:
{
GimpPattern *pattern = gimp_context_get_pattern (context);
pat_buf = gimp_image_transform_temp_buf (image, drawable,
Enabled skipping enum values for either the PDB or GType registration 2004-01-06 Michael Natterer <mitch@gimp.org> Enabled skipping enum values for either the PDB or GType registration (don't always skip both targets): * tools/gimp-mkenums: skip enum values only if there is a literal "skip" (don't match "pdb-skip"). * tools/pdbgen/enumgen.pl: skip only "pdb-skip" values, not "skip" ones. * app/base/base-enums.h * app/core/core-enums.h * app/paint/paint-enums.h * libgimpbase/gimpbaseenums.h: use the right "pdb-skip"/"skip" combination to skip enum values. Changed comments accordingly. Cleaned up the fill functions: * app/core/core-enums.[ch]: added GIMP_PATTERN_FILL enum value to the GimpFillType enum. Don't export GIMP_NO_FILL to the PDB because it's completely useless to export a NOP. * app/core/gimp-edit.c (gimp_edit_fill, gimp_edit_fill_internal): handle pattern fill requests. * app/core/gimpdrawable.[ch] (gimp_drawable_fill): added GimpPattern parameter and fill with it if it's non-NULL. (gimp_drawable_fill_by_type): handle pattern fill and pass the current pattern to gimp_drawable_fill(). * app/text/gimptextlayer.c: changed accordingly. * app/gui/edit-commands.c * app/gui/image-menu.c: use gimp_edit_fill() instead of gimp_drawable_bucket_fill() for FG, BG and pattern filling. * libgimp/gimpcompat.h * plug-ins/script-fu/siod-wrapper.c: removed NO_IMAGE_FILL compat enum value. It should have never been exported to the PDB. * app/pdb/drawable_cmds.c * app/pdb/edit_cmds.c * libgimp/gimpenums.h * plug-ins/pygimp/gimpenums.py * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: regenerated.
2004-01-06 22:02:08 +08:00
pattern->mask, &new_buf);
if (! gimp_drawable_has_alpha (drawable) &&
(pat_buf->bytes == 2 || pat_buf->bytes == 4))
tiles_bytes++;
}
break;
case GIMP_NO_FILL:
return TRUE; /* nothing to do, but the fill succeded */
}
buf_tiles = tile_manager_new (width, height, tiles_bytes);
pixel_region_init (&bufPR, buf_tiles, 0, 0, width, height, TRUE);
1997-11-25 06:05:25 +08:00
Enabled skipping enum values for either the PDB or GType registration 2004-01-06 Michael Natterer <mitch@gimp.org> Enabled skipping enum values for either the PDB or GType registration (don't always skip both targets): * tools/gimp-mkenums: skip enum values only if there is a literal "skip" (don't match "pdb-skip"). * tools/pdbgen/enumgen.pl: skip only "pdb-skip" values, not "skip" ones. * app/base/base-enums.h * app/core/core-enums.h * app/paint/paint-enums.h * libgimpbase/gimpbaseenums.h: use the right "pdb-skip"/"skip" combination to skip enum values. Changed comments accordingly. Cleaned up the fill functions: * app/core/core-enums.[ch]: added GIMP_PATTERN_FILL enum value to the GimpFillType enum. Don't export GIMP_NO_FILL to the PDB because it's completely useless to export a NOP. * app/core/gimp-edit.c (gimp_edit_fill, gimp_edit_fill_internal): handle pattern fill requests. * app/core/gimpdrawable.[ch] (gimp_drawable_fill): added GimpPattern parameter and fill with it if it's non-NULL. (gimp_drawable_fill_by_type): handle pattern fill and pass the current pattern to gimp_drawable_fill(). * app/text/gimptextlayer.c: changed accordingly. * app/gui/edit-commands.c * app/gui/image-menu.c: use gimp_edit_fill() instead of gimp_drawable_bucket_fill() for FG, BG and pattern filling. * libgimp/gimpcompat.h * plug-ins/script-fu/siod-wrapper.c: removed NO_IMAGE_FILL compat enum value. It should have never been exported to the PDB. * app/pdb/drawable_cmds.c * app/pdb/edit_cmds.c * libgimp/gimpenums.h * plug-ins/pygimp/gimpenums.py * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: regenerated.
2004-01-06 22:02:08 +08:00
if (pat_buf)
{
pattern_region (&bufPR, NULL, pat_buf, 0, 0);
Enabled skipping enum values for either the PDB or GType registration 2004-01-06 Michael Natterer <mitch@gimp.org> Enabled skipping enum values for either the PDB or GType registration (don't always skip both targets): * tools/gimp-mkenums: skip enum values only if there is a literal "skip" (don't match "pdb-skip"). * tools/pdbgen/enumgen.pl: skip only "pdb-skip" values, not "skip" ones. * app/base/base-enums.h * app/core/core-enums.h * app/paint/paint-enums.h * libgimpbase/gimpbaseenums.h: use the right "pdb-skip"/"skip" combination to skip enum values. Changed comments accordingly. Cleaned up the fill functions: * app/core/core-enums.[ch]: added GIMP_PATTERN_FILL enum value to the GimpFillType enum. Don't export GIMP_NO_FILL to the PDB because it's completely useless to export a NOP. * app/core/gimp-edit.c (gimp_edit_fill, gimp_edit_fill_internal): handle pattern fill requests. * app/core/gimpdrawable.[ch] (gimp_drawable_fill): added GimpPattern parameter and fill with it if it's non-NULL. (gimp_drawable_fill_by_type): handle pattern fill and pass the current pattern to gimp_drawable_fill(). * app/text/gimptextlayer.c: changed accordingly. * app/gui/edit-commands.c * app/gui/image-menu.c: use gimp_edit_fill() instead of gimp_drawable_bucket_fill() for FG, BG and pattern filling. * libgimp/gimpcompat.h * plug-ins/script-fu/siod-wrapper.c: removed NO_IMAGE_FILL compat enum value. It should have never been exported to the PDB. * app/pdb/drawable_cmds.c * app/pdb/edit_cmds.c * libgimp/gimpenums.h * plug-ins/pygimp/gimpenums.py * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: regenerated.
2004-01-06 22:02:08 +08:00
if (new_buf)
temp_buf_free (pat_buf);
}
else
{
if (gimp_drawable_has_alpha (drawable))
col[gimp_drawable_bytes (drawable) - 1] = OPAQUE_OPACITY;
Enabled skipping enum values for either the PDB or GType registration 2004-01-06 Michael Natterer <mitch@gimp.org> Enabled skipping enum values for either the PDB or GType registration (don't always skip both targets): * tools/gimp-mkenums: skip enum values only if there is a literal "skip" (don't match "pdb-skip"). * tools/pdbgen/enumgen.pl: skip only "pdb-skip" values, not "skip" ones. * app/base/base-enums.h * app/core/core-enums.h * app/paint/paint-enums.h * libgimpbase/gimpbaseenums.h: use the right "pdb-skip"/"skip" combination to skip enum values. Changed comments accordingly. Cleaned up the fill functions: * app/core/core-enums.[ch]: added GIMP_PATTERN_FILL enum value to the GimpFillType enum. Don't export GIMP_NO_FILL to the PDB because it's completely useless to export a NOP. * app/core/gimp-edit.c (gimp_edit_fill, gimp_edit_fill_internal): handle pattern fill requests. * app/core/gimpdrawable.[ch] (gimp_drawable_fill): added GimpPattern parameter and fill with it if it's non-NULL. (gimp_drawable_fill_by_type): handle pattern fill and pass the current pattern to gimp_drawable_fill(). * app/text/gimptextlayer.c: changed accordingly. * app/gui/edit-commands.c * app/gui/image-menu.c: use gimp_edit_fill() instead of gimp_drawable_bucket_fill() for FG, BG and pattern filling. * libgimp/gimpcompat.h * plug-ins/script-fu/siod-wrapper.c: removed NO_IMAGE_FILL compat enum value. It should have never been exported to the PDB. * app/pdb/drawable_cmds.c * app/pdb/edit_cmds.c * libgimp/gimpenums.h * plug-ins/pygimp/gimpenums.py * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: regenerated.
2004-01-06 22:02:08 +08:00
color_region (&bufPR, col);
}
1997-11-25 06:05:25 +08:00
pixel_region_init (&bufPR, buf_tiles, 0, 0, width, height, FALSE);
gimp_drawable_apply_region (drawable, &bufPR,
TRUE, undo_desc,
opacity, paint_mode,
NULL, x, y);
1997-11-25 06:05:25 +08:00
2003-05-27 01:02:06 +08:00
tile_manager_unref (buf_tiles);
1997-11-25 06:05:25 +08:00
gimp_drawable_update (drawable, x, y, width, height);
1997-11-25 06:05:25 +08:00
return TRUE;
}