2001-05-03 20:26:05 +08:00
|
|
|
/* The GIMP -- an image manipulation program
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2003-03-16 19:14:29 +08:00
|
|
|
* gimpchanneltreeview.c
|
|
|
|
* Copyright (C) 2001-2003 Michael Natterer <mitch@gimp.org>
|
2001-05-03 20:26:05 +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>
|
|
|
|
|
|
|
|
#include "libgimpmath/gimpmath.h"
|
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
|
|
|
|
2001-05-08 11:48:54 +08:00
|
|
|
#include "widgets-types.h"
|
|
|
|
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "core/gimpchannel.h"
|
2003-10-06 20:17:11 +08:00
|
|
|
#include "core/gimpchannel-select.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "core/gimpcontainer.h"
|
|
|
|
#include "core/gimpimage.h"
|
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
#include "gimpchanneltreeview.h"
|
2003-03-13 01:12:01 +08:00
|
|
|
#include "gimpcomponenteditor.h"
|
2001-05-08 11:48:54 +08:00
|
|
|
#include "gimpdnd.h"
|
2003-08-24 21:52:51 +08:00
|
|
|
#include "gimphelp-ids.h"
|
2002-12-20 00:33:29 +08:00
|
|
|
#include "gimpwidgets-utils.h"
|
2001-05-03 20:26:05 +08:00
|
|
|
|
2003-03-26 00:38:19 +08:00
|
|
|
#include "gimp-intl.h"
|
2001-05-03 20:26:05 +08:00
|
|
|
|
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
static void gimp_channel_tree_view_class_init (GimpChannelTreeViewClass *klass);
|
|
|
|
static void gimp_channel_tree_view_init (GimpChannelTreeView *view);
|
2001-05-03 20:26:05 +08:00
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
static void gimp_channel_tree_view_set_image (GimpItemTreeView *item_view,
|
2001-05-03 20:26:05 +08:00
|
|
|
GimpImage *gimage);
|
|
|
|
|
2003-05-18 21:28:27 +08:00
|
|
|
static gboolean gimp_channel_tree_view_select_item (GimpContainerView *view,
|
2001-05-07 01:56:10 +08:00
|
|
|
GimpViewable *item,
|
|
|
|
gpointer insert_data);
|
2003-03-16 19:14:29 +08:00
|
|
|
static void gimp_channel_tree_view_set_preview_size (GimpContainerView *view);
|
2001-05-03 20:26:05 +08:00
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
static void gimp_channel_tree_view_toselection_clicked
|
2001-05-03 20:26:05 +08:00
|
|
|
(GtkWidget *widget,
|
2003-03-16 19:14:29 +08:00
|
|
|
GimpChannelTreeView *view);
|
|
|
|
static void gimp_channel_tree_view_toselection_extended_clicked
|
2001-05-07 06:29:48 +08:00
|
|
|
(GtkWidget *widget,
|
|
|
|
guint state,
|
2003-03-16 19:14:29 +08:00
|
|
|
GimpChannelTreeView *view);
|
2001-05-03 20:26:05 +08:00
|
|
|
|
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
static GimpDrawableTreeViewClass *parent_class = NULL;
|
2001-05-03 20:26:05 +08:00
|
|
|
|
|
|
|
|
2001-10-17 19:33:43 +08:00
|
|
|
GType
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_channel_tree_view_get_type (void)
|
2001-05-03 20:26:05 +08:00
|
|
|
{
|
2001-10-17 19:33:43 +08:00
|
|
|
static GType view_type = 0;
|
2001-05-03 20:26:05 +08:00
|
|
|
|
|
|
|
if (! view_type)
|
|
|
|
{
|
2001-10-17 19:33:43 +08:00
|
|
|
static const GTypeInfo view_info =
|
2001-05-03 20:26:05 +08:00
|
|
|
{
|
2003-03-16 19:14:29 +08:00
|
|
|
sizeof (GimpChannelTreeViewClass),
|
2001-10-17 19:33:43 +08:00
|
|
|
NULL, /* base_init */
|
|
|
|
NULL, /* base_finalize */
|
2003-03-16 19:14:29 +08:00
|
|
|
(GClassInitFunc) gimp_channel_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 (GimpChannelTreeView),
|
2001-10-17 19:33:43 +08:00
|
|
|
0, /* n_preallocs */
|
2003-03-16 19:14:29 +08:00
|
|
|
(GInstanceInitFunc) gimp_channel_tree_view_init,
|
2001-05-03 20:26:05 +08:00
|
|
|
};
|
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
view_type = g_type_register_static (GIMP_TYPE_DRAWABLE_TREE_VIEW,
|
|
|
|
"GimpChannelTreeView",
|
2001-10-17 19:33:43 +08:00
|
|
|
&view_info, 0);
|
2001-05-03 20:26:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return view_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_channel_tree_view_class_init (GimpChannelTreeViewClass *klass)
|
2001-05-03 20:26:05 +08:00
|
|
|
{
|
2002-02-26 01:58:50 +08:00
|
|
|
GimpContainerViewClass *container_view_class;
|
2003-03-16 19:14:29 +08:00
|
|
|
GimpItemTreeViewClass *item_view_class;
|
2001-05-03 20:26:05 +08:00
|
|
|
|
2001-10-17 19:33:43 +08:00
|
|
|
container_view_class = GIMP_CONTAINER_VIEW_CLASS (klass);
|
2003-03-16 19:14:29 +08:00
|
|
|
item_view_class = GIMP_ITEM_TREE_VIEW_CLASS (klass);
|
2001-05-03 20:26:05 +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-05-03 20:26:05 +08:00
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
container_view_class->select_item = gimp_channel_tree_view_select_item;
|
|
|
|
container_view_class->set_preview_size = gimp_channel_tree_view_set_preview_size;
|
2001-05-03 20:26:05 +08:00
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
item_view_class->set_image = gimp_channel_tree_view_set_image;
|
2003-02-17 21:33:29 +08:00
|
|
|
|
|
|
|
item_view_class->get_container = gimp_image_get_channels;
|
|
|
|
item_view_class->get_active_item = (GimpGetItemFunc) gimp_image_get_active_channel;
|
|
|
|
item_view_class->set_active_item = (GimpSetItemFunc) gimp_image_set_active_channel;
|
|
|
|
item_view_class->reorder_item = (GimpReorderItemFunc) gimp_image_position_channel;
|
|
|
|
item_view_class->add_item = (GimpAddItemFunc) gimp_image_add_channel;
|
|
|
|
item_view_class->remove_item = (GimpRemoveItemFunc) gimp_image_remove_channel;
|
|
|
|
|
2003-09-18 06:54:48 +08:00
|
|
|
item_view_class->edit_desc = _("Edit Channel Attributes");
|
|
|
|
item_view_class->edit_help_id = GIMP_HELP_CHANNEL_EDIT;
|
2004-03-18 00:12:21 +08:00
|
|
|
item_view_class->new_desc = _("New Channel\n%s New Channel Dialog");
|
2003-08-24 21:52:51 +08:00
|
|
|
item_view_class->new_help_id = GIMP_HELP_CHANNEL_NEW;
|
|
|
|
item_view_class->duplicate_desc = _("Duplicate Channel");
|
|
|
|
item_view_class->duplicate_help_id = GIMP_HELP_CHANNEL_DUPLICATE;
|
|
|
|
item_view_class->delete_desc = _("Delete Channel");
|
|
|
|
item_view_class->delete_help_id = GIMP_HELP_CHANNEL_DELETE;
|
|
|
|
item_view_class->raise_desc = _("Raise Channel");
|
|
|
|
item_view_class->raise_help_id = GIMP_HELP_CHANNEL_RAISE;
|
|
|
|
item_view_class->raise_to_top_desc = _("Raise Channel to Top");
|
|
|
|
item_view_class->raise_to_top_help_id = GIMP_HELP_CHANNEL_RAISE_TO_TOP;
|
|
|
|
item_view_class->lower_desc = _("Lower Channel");
|
|
|
|
item_view_class->lower_help_id = GIMP_HELP_CHANNEL_LOWER;
|
|
|
|
item_view_class->lower_to_bottom_desc = _("Lower Channel to Bottom");
|
|
|
|
item_view_class->lower_to_bottom_help_id = GIMP_HELP_CHANNEL_LOWER_TO_BOTTOM;
|
|
|
|
item_view_class->reorder_desc = _("Reorder Channel");
|
2001-05-03 20:26:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_channel_tree_view_init (GimpChannelTreeView *view)
|
2001-05-03 20:26:05 +08:00
|
|
|
{
|
2003-03-13 01:12:01 +08:00
|
|
|
gchar *str;
|
2001-05-03 20:26:05 +08:00
|
|
|
|
2002-12-20 00:33:29 +08:00
|
|
|
str = g_strdup_printf (_("Channel to Selection\n"
|
|
|
|
"%s Add\n"
|
|
|
|
"%s Subtract\n"
|
|
|
|
"%s%s%s Intersect"),
|
|
|
|
gimp_get_mod_name_shift (),
|
|
|
|
gimp_get_mod_name_control (),
|
|
|
|
gimp_get_mod_name_shift (),
|
|
|
|
gimp_get_mod_separator (),
|
|
|
|
gimp_get_mod_name_control ());
|
|
|
|
|
2001-05-03 20:26:05 +08:00
|
|
|
/* To Selection button */
|
2001-08-05 04:38:54 +08:00
|
|
|
view->toselection_button =
|
2003-03-13 01:12:01 +08:00
|
|
|
gimp_editor_add_button (GIMP_EDITOR (view),
|
2003-08-24 21:52:51 +08:00
|
|
|
GIMP_STOCK_SELECTION_REPLACE, str,
|
|
|
|
GIMP_HELP_CHANNEL_SELECTION_REPLACE,
|
2003-03-16 19:14:29 +08:00
|
|
|
G_CALLBACK (gimp_channel_tree_view_toselection_clicked),
|
|
|
|
G_CALLBACK (gimp_channel_tree_view_toselection_extended_clicked),
|
2002-03-08 08:27:45 +08:00
|
|
|
view);
|
|
|
|
|
2002-12-20 00:33:29 +08:00
|
|
|
g_free (str);
|
|
|
|
|
2003-03-13 01:12:01 +08:00
|
|
|
gtk_box_reorder_child (GTK_BOX (GIMP_EDITOR (view)->button_box),
|
2002-02-26 22:40:30 +08:00
|
|
|
view->toselection_button, 5);
|
|
|
|
|
2003-03-13 01:12:01 +08:00
|
|
|
gimp_container_view_enable_dnd (GIMP_CONTAINER_VIEW (view),
|
2001-08-05 04:38:54 +08:00
|
|
|
GTK_BUTTON (view->toselection_button),
|
|
|
|
GIMP_TYPE_CHANNEL);
|
2001-05-03 20:26:05 +08:00
|
|
|
|
|
|
|
gtk_widget_set_sensitive (view->toselection_button, FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
/* GimpItemTreeView methods */
|
2001-05-03 20:26:05 +08:00
|
|
|
|
|
|
|
static void
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_channel_tree_view_set_image (GimpItemTreeView *item_view,
|
2002-02-26 01:58:50 +08:00
|
|
|
GimpImage *gimage)
|
2001-05-03 20:26:05 +08:00
|
|
|
{
|
2003-03-16 19:14:29 +08:00
|
|
|
GimpChannelTreeView *channel_view;
|
2001-05-03 20:26:05 +08:00
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
channel_view = GIMP_CHANNEL_TREE_VIEW (item_view);
|
2001-05-03 20:26:05 +08:00
|
|
|
|
2003-03-13 01:12:01 +08:00
|
|
|
if (! channel_view->component_editor)
|
2001-05-03 20:26:05 +08:00
|
|
|
{
|
2003-03-13 01:12:01 +08:00
|
|
|
channel_view->component_editor =
|
|
|
|
gimp_component_editor_new (GIMP_CONTAINER_VIEW (item_view)->preview_size,
|
2003-03-21 19:47:37 +08:00
|
|
|
GIMP_EDITOR (item_view)->menu_factory);
|
2003-03-13 01:12:01 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (item_view), channel_view->component_editor,
|
|
|
|
FALSE, FALSE, 0);
|
|
|
|
gtk_box_reorder_child (GTK_BOX (item_view),
|
|
|
|
channel_view->component_editor, 0);
|
|
|
|
}
|
2001-05-03 20:26:05 +08:00
|
|
|
|
2003-03-13 01:12:01 +08:00
|
|
|
if (! gimage)
|
|
|
|
gtk_widget_hide (channel_view->component_editor);
|
2001-05-07 00:14:34 +08:00
|
|
|
|
2003-03-13 01:12:01 +08:00
|
|
|
gimp_image_editor_set_image (GIMP_IMAGE_EDITOR (channel_view->component_editor),
|
|
|
|
gimage);
|
2001-05-03 20:26:05 +08:00
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
GIMP_ITEM_TREE_VIEW_CLASS (parent_class)->set_image (item_view, gimage);
|
2001-05-03 20:26:05 +08:00
|
|
|
|
2002-02-26 01:58:50 +08:00
|
|
|
if (item_view->gimage)
|
2003-03-13 01:12:01 +08:00
|
|
|
gtk_widget_show (channel_view->component_editor);
|
2001-05-03 20:26:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* GimpContainerView methods */
|
|
|
|
|
2003-05-18 21:28:27 +08:00
|
|
|
static gboolean
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_channel_tree_view_select_item (GimpContainerView *view,
|
2001-05-03 20:26:05 +08:00
|
|
|
GimpViewable *item,
|
|
|
|
gpointer insert_data)
|
|
|
|
{
|
2003-03-16 19:14:29 +08:00
|
|
|
GimpItemTreeView *item_view;
|
|
|
|
GimpChannelTreeView *tree_view;
|
2003-05-18 21:28:27 +08:00
|
|
|
gboolean success;
|
2001-05-03 20:26:05 +08:00
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
item_view = GIMP_ITEM_TREE_VIEW (view);
|
|
|
|
tree_view = GIMP_CHANNEL_TREE_VIEW (view);
|
2001-05-03 20:26:05 +08:00
|
|
|
|
2003-05-18 21:28:27 +08:00
|
|
|
success = GIMP_CONTAINER_VIEW_CLASS (parent_class)->select_item (view, item,
|
|
|
|
insert_data);
|
2001-05-03 20:26:05 +08:00
|
|
|
|
2002-02-26 01:58:50 +08:00
|
|
|
if (item_view->gimage)
|
2001-05-08 09:32:25 +08:00
|
|
|
{
|
2001-05-11 01:25:01 +08:00
|
|
|
gboolean floating_sel;
|
2001-05-08 09:32:25 +08:00
|
|
|
|
2002-02-26 01:58:50 +08:00
|
|
|
floating_sel = (gimp_image_floating_sel (item_view->gimage) != NULL);
|
2001-05-08 09:32:25 +08:00
|
|
|
|
2002-03-08 08:27:45 +08:00
|
|
|
gtk_widget_set_sensitive (GIMP_EDITOR (view)->button_box, ! floating_sel);
|
2001-05-03 20:26:05 +08:00
|
|
|
}
|
|
|
|
|
2003-05-18 21:28:27 +08:00
|
|
|
gtk_widget_set_sensitive (tree_view->toselection_button,
|
|
|
|
success && item != NULL);
|
|
|
|
|
|
|
|
return success;
|
2001-05-03 20:26:05 +08:00
|
|
|
}
|
|
|
|
|
2001-05-07 01:56:10 +08:00
|
|
|
static void
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_channel_tree_view_set_preview_size (GimpContainerView *view)
|
2001-05-07 01:56:10 +08:00
|
|
|
{
|
2003-03-16 19:14:29 +08:00
|
|
|
GimpChannelTreeView *channel_view;
|
2001-05-07 01:56:10 +08:00
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
channel_view = GIMP_CHANNEL_TREE_VIEW (view);
|
2001-05-07 01:56:10 +08:00
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
GIMP_CONTAINER_VIEW_CLASS (parent_class)->set_preview_size (view);
|
2001-05-07 01:56:10 +08:00
|
|
|
|
2003-03-27 01:49:42 +08:00
|
|
|
if (channel_view->component_editor)
|
|
|
|
gimp_component_editor_set_preview_size (GIMP_COMPONENT_EDITOR (channel_view->component_editor),
|
|
|
|
view->preview_size);
|
2001-05-07 01:56:10 +08:00
|
|
|
}
|
|
|
|
|
2001-05-03 20:26:05 +08:00
|
|
|
static void
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_channel_tree_view_toselection_clicked (GtkWidget *widget,
|
|
|
|
GimpChannelTreeView *view)
|
2001-05-03 20:26:05 +08:00
|
|
|
{
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_channel_tree_view_toselection_extended_clicked (widget, 0, view);
|
2001-05-07 06:29:48 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_channel_tree_view_toselection_extended_clicked (GtkWidget *widget,
|
2001-05-07 06:29:48 +08:00
|
|
|
guint state,
|
2003-03-16 19:14:29 +08:00
|
|
|
GimpChannelTreeView *view)
|
2001-05-07 06:29:48 +08:00
|
|
|
{
|
2003-02-17 21:33:29 +08:00
|
|
|
GimpImage *gimage;
|
|
|
|
GimpItem *item;
|
2001-05-07 06:29:48 +08:00
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
gimage = GIMP_ITEM_TREE_VIEW (view)->gimage;
|
2001-05-07 06:29:48 +08:00
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
item = GIMP_ITEM_TREE_VIEW_GET_CLASS (view)->get_active_item (gimage);
|
2001-05-07 06:29:48 +08:00
|
|
|
|
2003-02-17 21:33:29 +08:00
|
|
|
if (item)
|
2001-05-07 06:29:48 +08:00
|
|
|
{
|
2003-02-17 21:33:29 +08:00
|
|
|
GimpChannelOps operation = GIMP_CHANNEL_OP_REPLACE;
|
2001-05-07 06:29:48 +08:00
|
|
|
|
|
|
|
if (state & GDK_SHIFT_MASK)
|
|
|
|
{
|
|
|
|
if (state & GDK_CONTROL_MASK)
|
2002-03-19 00:22:14 +08:00
|
|
|
operation = GIMP_CHANNEL_OP_INTERSECT;
|
2001-05-07 06:29:48 +08:00
|
|
|
else
|
2002-03-19 00:22:14 +08:00
|
|
|
operation = GIMP_CHANNEL_OP_ADD;
|
2001-05-07 06:29:48 +08:00
|
|
|
}
|
|
|
|
else if (state & GDK_CONTROL_MASK)
|
|
|
|
{
|
2002-03-19 00:22:14 +08:00
|
|
|
operation = GIMP_CHANNEL_OP_SUBTRACT;
|
2001-05-07 06:29:48 +08:00
|
|
|
}
|
|
|
|
|
2003-10-06 20:17:11 +08:00
|
|
|
gimp_channel_select_channel (gimp_image_get_mask (gimage),
|
|
|
|
_("Channel to Selection"),
|
|
|
|
GIMP_CHANNEL (item),
|
|
|
|
0, 0,
|
|
|
|
operation,
|
|
|
|
FALSE, 0.0, 0.0);
|
2002-05-09 01:48:24 +08:00
|
|
|
gimp_image_flush (gimage);
|
2001-05-07 06:29:48 +08:00
|
|
|
}
|
2001-05-03 20:26:05 +08:00
|
|
|
}
|