2001-02-27 22:14:13 +08:00
|
|
|
/* The GIMP -- an image manipulation program
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2003-03-16 19:14:29 +08:00
|
|
|
* gimpdrawabletreeview.c
|
|
|
|
* Copyright (C) 2001-2003 Michael Natterer <mitch@gimp.org>
|
2001-04-22 08:38:56 +08:00
|
|
|
*
|
2001-02-27 22:14:13 +08:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2001-05-08 11:48:54 +08:00
|
|
|
#include "widgets-types.h"
|
2001-02-27 22:14:13 +08:00
|
|
|
|
2002-09-02 22:39:08 +08:00
|
|
|
#include "core/gimp.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "core/gimpcontainer.h"
|
2002-09-02 22:39:08 +08:00
|
|
|
#include "core/gimpcontext.h"
|
|
|
|
#include "core/gimpdrawable-bucket-fill.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "core/gimpimage.h"
|
2003-02-13 19:23:50 +08:00
|
|
|
#include "core/gimpimage-undo.h"
|
2002-09-02 22:39:08 +08:00
|
|
|
#include "core/gimppattern.h"
|
|
|
|
#include "core/gimptoolinfo.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
|
2004-05-11 07:22:39 +08:00
|
|
|
#include "gimpcontainerview.h"
|
2001-05-08 11:48:54 +08:00
|
|
|
#include "gimpdnd.h"
|
2004-04-19 08:08:53 +08:00
|
|
|
#include "gimpdrawabletreeview.h"
|
2001-05-03 20:26:05 +08:00
|
|
|
|
2003-03-26 00:38:19 +08:00
|
|
|
#include "gimp-intl.h"
|
2001-02-27 22:14:13 +08:00
|
|
|
|
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
static void gimp_drawable_tree_view_class_init (GimpDrawableTreeViewClass *klass);
|
|
|
|
static void gimp_drawable_tree_view_init (GimpDrawableTreeView *view);
|
2001-02-27 22:14:13 +08:00
|
|
|
|
2004-05-11 07:22:39 +08:00
|
|
|
static void gimp_drawable_tree_view_view_iface_init (GimpContainerViewInterface *view_iface);
|
|
|
|
|
2003-05-18 21:28:27 +08:00
|
|
|
static gboolean gimp_drawable_tree_view_select_item (GimpContainerView *view,
|
|
|
|
GimpViewable *item,
|
|
|
|
gpointer insert_data);
|
2003-03-16 19:14:29 +08:00
|
|
|
|
|
|
|
static void gimp_drawable_tree_view_set_image (GimpItemTreeView *view,
|
2002-02-26 01:58:50 +08:00
|
|
|
GimpImage *gimage);
|
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
static void gimp_drawable_tree_view_floating_selection_changed
|
2002-02-26 01:58:50 +08:00
|
|
|
(GimpImage *gimage,
|
2003-03-16 19:14:29 +08:00
|
|
|
GimpDrawableTreeView *view);
|
2001-02-27 22:14:13 +08:00
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
static void gimp_drawable_tree_view_new_pattern_dropped
|
2002-09-02 22:39:08 +08:00
|
|
|
(GtkWidget *widget,
|
|
|
|
GimpViewable *viewable,
|
|
|
|
gpointer data);
|
2003-03-16 19:14:29 +08:00
|
|
|
static void gimp_drawable_tree_view_new_color_dropped
|
2002-09-02 22:39:08 +08:00
|
|
|
(GtkWidget *widget,
|
|
|
|
const GimpRGB *color,
|
|
|
|
gpointer data);
|
|
|
|
|
2001-05-03 20:26:05 +08:00
|
|
|
|
2004-05-11 07:22:39 +08:00
|
|
|
static GimpItemTreeViewClass *parent_class = NULL;
|
|
|
|
static GimpContainerViewInterface *parent_view_iface = NULL;
|
2001-02-27 22:14:13 +08:00
|
|
|
|
|
|
|
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
GType
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_drawable_tree_view_get_type (void)
|
2001-02-27 22:14:13 +08:00
|
|
|
{
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
static GType view_type = 0;
|
2001-02-27 22:14:13 +08:00
|
|
|
|
|
|
|
if (! view_type)
|
|
|
|
{
|
2001-10-17 19:33:43 +08:00
|
|
|
static const GTypeInfo view_info =
|
2001-02-27 22:14:13 +08:00
|
|
|
{
|
2003-03-16 19:14:29 +08:00
|
|
|
sizeof (GimpDrawableTreeViewClass),
|
2001-10-17 19:33:43 +08:00
|
|
|
NULL, /* base_init */
|
|
|
|
NULL, /* base_finalize */
|
2003-03-16 19:14:29 +08:00
|
|
|
(GClassInitFunc) gimp_drawable_tree_view_class_init,
|
2001-10-17 19:33:43 +08:00
|
|
|
NULL, /* class_finalize */
|
|
|
|
NULL, /* class_data */
|
2003-03-16 19:14:29 +08:00
|
|
|
sizeof (GimpDrawableTreeView),
|
2001-10-17 19:33:43 +08:00
|
|
|
0, /* n_preallocs */
|
2003-03-16 19:14:29 +08:00
|
|
|
(GInstanceInitFunc) gimp_drawable_tree_view_init,
|
2001-02-27 22:14:13 +08:00
|
|
|
};
|
|
|
|
|
2004-05-11 07:22:39 +08:00
|
|
|
static const GInterfaceInfo view_iface_info =
|
|
|
|
{
|
|
|
|
(GInterfaceInitFunc) gimp_drawable_tree_view_view_iface_init,
|
|
|
|
NULL, /* iface_finalize */
|
|
|
|
NULL /* iface_data */
|
|
|
|
};
|
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
view_type = g_type_register_static (GIMP_TYPE_ITEM_TREE_VIEW,
|
|
|
|
"GimpDrawableTreeView",
|
2001-10-17 19:33:43 +08:00
|
|
|
&view_info, 0);
|
2004-05-11 07:22:39 +08:00
|
|
|
|
|
|
|
g_type_add_interface_static (view_type, GIMP_TYPE_CONTAINER_VIEW,
|
|
|
|
&view_iface_info);
|
2001-02-27 22:14:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return view_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_drawable_tree_view_class_init (GimpDrawableTreeViewClass *klass)
|
2001-02-27 22:14:13 +08:00
|
|
|
{
|
2004-05-11 07:22:39 +08:00
|
|
|
GimpItemTreeViewClass *item_view_class = GIMP_ITEM_TREE_VIEW_CLASS (klass);
|
2001-02-27 22:14:13 +08:00
|
|
|
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
2001-02-27 22:14:13 +08:00
|
|
|
|
2004-05-11 07:22:39 +08:00
|
|
|
item_view_class->set_image = gimp_drawable_tree_view_set_image;
|
2001-02-27 22:14:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_drawable_tree_view_init (GimpDrawableTreeView *view)
|
2001-02-27 22:14:13 +08:00
|
|
|
{
|
2004-05-11 07:22:39 +08:00
|
|
|
GimpItemTreeView *item_view = GIMP_ITEM_TREE_VIEW (view);
|
2003-03-16 19:14:29 +08:00
|
|
|
|
2002-09-02 22:39:08 +08:00
|
|
|
gimp_dnd_viewable_dest_add (item_view->new_button, GIMP_TYPE_PATTERN,
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_drawable_tree_view_new_pattern_dropped,
|
2002-09-02 22:39:08 +08:00
|
|
|
view);
|
|
|
|
gimp_dnd_color_dest_add (item_view->new_button,
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_drawable_tree_view_new_color_dropped,
|
2002-09-02 22:39:08 +08:00
|
|
|
view);
|
2001-02-27 22:14:13 +08:00
|
|
|
}
|
|
|
|
|
2004-05-11 07:22:39 +08:00
|
|
|
static void
|
|
|
|
gimp_drawable_tree_view_view_iface_init (GimpContainerViewInterface *view_iface)
|
|
|
|
{
|
|
|
|
parent_view_iface = g_type_interface_peek_parent (view_iface);
|
|
|
|
|
|
|
|
view_iface->select_item = gimp_drawable_tree_view_select_item;
|
|
|
|
}
|
|
|
|
|
2003-03-20 00:37:24 +08:00
|
|
|
|
|
|
|
/* GimpContainerView methods */
|
|
|
|
|
2003-05-18 21:28:27 +08:00
|
|
|
static gboolean
|
|
|
|
gimp_drawable_tree_view_select_item (GimpContainerView *view,
|
|
|
|
GimpViewable *item,
|
|
|
|
gpointer insert_data)
|
|
|
|
{
|
2004-05-11 07:22:39 +08:00
|
|
|
GimpItemTreeView *item_view = GIMP_ITEM_TREE_VIEW (view);
|
|
|
|
gboolean success = TRUE;
|
2003-05-18 21:28:27 +08:00
|
|
|
|
|
|
|
if (item_view->gimage)
|
|
|
|
{
|
|
|
|
GimpViewable *floating_sel;
|
|
|
|
|
|
|
|
floating_sel = (GimpViewable *)
|
|
|
|
gimp_image_floating_sel (item_view->gimage);
|
|
|
|
|
|
|
|
success = (item == NULL || floating_sel == NULL || item == floating_sel);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (success)
|
2004-05-11 07:22:39 +08:00
|
|
|
return parent_view_iface->select_item (view, item, insert_data);
|
2003-05-18 21:28:27 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
2003-03-20 00:37:24 +08:00
|
|
|
|
|
|
|
/* GimpItemTreeView methods */
|
|
|
|
|
2001-02-27 22:14:13 +08:00
|
|
|
static void
|
2003-09-07 05:17:16 +08:00
|
|
|
gimp_drawable_tree_view_set_image (GimpItemTreeView *view,
|
2002-02-26 01:58:50 +08:00
|
|
|
GimpImage *gimage)
|
2001-02-27 22:14:13 +08:00
|
|
|
{
|
2003-09-07 05:17:16 +08:00
|
|
|
if (view->gimage)
|
|
|
|
g_signal_handlers_disconnect_by_func (view->gimage,
|
|
|
|
gimp_drawable_tree_view_floating_selection_changed,
|
|
|
|
view);
|
|
|
|
|
|
|
|
GIMP_ITEM_TREE_VIEW_CLASS (parent_class)->set_image (view, gimage);
|
|
|
|
|
|
|
|
if (view->gimage)
|
|
|
|
g_signal_connect (view->gimage,
|
|
|
|
"floating_selection_changed",
|
|
|
|
G_CALLBACK (gimp_drawable_tree_view_floating_selection_changed),
|
|
|
|
view);
|
2001-03-06 21:28:39 +08:00
|
|
|
}
|
|
|
|
|
2003-03-20 00:37:24 +08:00
|
|
|
|
|
|
|
/* callbacks */
|
|
|
|
|
2001-05-08 09:32:25 +08:00
|
|
|
static void
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_drawable_tree_view_floating_selection_changed (GimpImage *gimage,
|
|
|
|
GimpDrawableTreeView *view)
|
2001-05-08 09:32:25 +08:00
|
|
|
{
|
2003-05-18 21:28:27 +08:00
|
|
|
GimpItem *item;
|
2001-05-08 09:32:25 +08:00
|
|
|
|
2003-05-18 21:28:27 +08:00
|
|
|
item = GIMP_ITEM_TREE_VIEW_GET_CLASS (view)->get_active_item (gimage);
|
2001-12-29 21:26:29 +08:00
|
|
|
|
2001-05-08 09:32:25 +08:00
|
|
|
/* update button states */
|
2003-05-18 21:28:27 +08:00
|
|
|
gimp_container_view_select_item (GIMP_CONTAINER_VIEW (view),
|
|
|
|
(GimpViewable *) item);
|
2001-05-08 09:32:25 +08:00
|
|
|
}
|
2002-09-02 22:39:08 +08:00
|
|
|
|
|
|
|
static void
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_drawable_tree_view_new_dropped (GimpItemTreeView *view,
|
2002-09-02 22:39:08 +08:00
|
|
|
GimpBucketFillMode fill_mode,
|
|
|
|
const GimpRGB *color,
|
|
|
|
GimpPattern *pattern)
|
|
|
|
{
|
|
|
|
GimpDrawable *drawable;
|
|
|
|
GimpToolInfo *tool_info;
|
|
|
|
GimpContext *context;
|
|
|
|
|
2003-02-13 19:23:50 +08:00
|
|
|
gimp_image_undo_group_start (view->gimage, GIMP_UNDO_GROUP_EDIT_PASTE,
|
|
|
|
_("New Layer"));
|
2002-09-02 22:39:08 +08:00
|
|
|
|
2004-05-25 22:37:02 +08:00
|
|
|
view->new_item_func (view->gimage, view->context,
|
|
|
|
NULL, FALSE, GTK_WIDGET (view));
|
2002-09-02 22:39:08 +08:00
|
|
|
|
|
|
|
drawable = gimp_image_active_drawable (view->gimage);
|
|
|
|
|
|
|
|
/* Get the bucket fill context */
|
|
|
|
tool_info = (GimpToolInfo *)
|
|
|
|
gimp_container_get_child_by_name (view->gimage->gimp->tool_info_list,
|
|
|
|
"gimp-bucket-fill-tool");
|
|
|
|
|
2003-02-05 22:39:40 +08:00
|
|
|
if (tool_info && tool_info->tool_options)
|
2004-05-23 18:04:41 +08:00
|
|
|
context = GIMP_CONTEXT (tool_info->tool_options);
|
2002-09-02 22:39:08 +08:00
|
|
|
else
|
2004-05-23 18:04:41 +08:00
|
|
|
context = view->context;
|
2002-09-02 22:39:08 +08:00
|
|
|
|
|
|
|
gimp_drawable_bucket_fill_full (drawable,
|
|
|
|
fill_mode,
|
|
|
|
gimp_context_get_paint_mode (context),
|
|
|
|
gimp_context_get_opacity (context),
|
|
|
|
FALSE /* no seed fill */,
|
2003-02-15 06:33:22 +08:00
|
|
|
FALSE, 0.0, FALSE, 0.0, 0.0 /* fill params */,
|
|
|
|
color, pattern);
|
2002-09-02 22:39:08 +08:00
|
|
|
|
2003-02-13 19:23:50 +08:00
|
|
|
gimp_image_undo_group_end (view->gimage);
|
2002-09-02 22:39:08 +08:00
|
|
|
|
|
|
|
gimp_image_flush (view->gimage);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_drawable_tree_view_new_pattern_dropped (GtkWidget *widget,
|
2002-09-02 22:39:08 +08:00
|
|
|
GimpViewable *viewable,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_drawable_tree_view_new_dropped (GIMP_ITEM_TREE_VIEW (data),
|
2002-09-02 22:39:08 +08:00
|
|
|
GIMP_PATTERN_BUCKET_FILL,
|
|
|
|
NULL,
|
|
|
|
GIMP_PATTERN (viewable));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_drawable_tree_view_new_color_dropped (GtkWidget *widget,
|
2002-09-02 22:39:08 +08:00
|
|
|
const GimpRGB *color,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_drawable_tree_view_new_dropped (GIMP_ITEM_TREE_VIEW (data),
|
2002-09-02 22:39:08 +08:00
|
|
|
GIMP_FG_BUCKET_FILL,
|
|
|
|
color,
|
|
|
|
NULL);
|
|
|
|
}
|