2001-01-22 12:17:17 +08:00
|
|
|
/* The GIMP -- an image manipulation program
|
|
|
|
* Copyright (C) 1995-1999 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2001-05-21 21:58:46 +08:00
|
|
|
#include "libgimpbase/gimpbase.h"
|
2005-01-26 03:11:26 +08:00
|
|
|
#include "libgimpconfig/gimpconfig.h"
|
2001-01-25 06:36:18 +08:00
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
2001-01-22 12:17:17 +08:00
|
|
|
|
2001-05-10 06:34:59 +08:00
|
|
|
#include "tools-types.h"
|
|
|
|
|
2002-11-19 04:50:31 +08:00
|
|
|
#include "config/gimpguiconfig.h"
|
2001-01-22 12:17:17 +08:00
|
|
|
|
2002-11-19 04:50:31 +08:00
|
|
|
#include "core/gimp.h"
|
|
|
|
#include "core/gimptoolinfo.h"
|
2001-01-22 12:17:17 +08:00
|
|
|
|
2004-11-24 01:01:51 +08:00
|
|
|
#include "widgets/gimpwidgets-utils.h"
|
2003-01-07 00:25:04 +08:00
|
|
|
|
2005-07-29 10:07:49 +08:00
|
|
|
#include "gimpforegroundselecttool.h"
|
2006-06-11 05:34:12 +08:00
|
|
|
#include "gimprectangleselecttool.h"
|
2006-07-31 19:45:50 +08:00
|
|
|
#include "gimpregionselecttool.h"
|
2001-03-12 06:19:06 +08:00
|
|
|
#include "gimpiscissorstool.h"
|
2003-02-09 05:12:03 +08:00
|
|
|
#include "gimpselectionoptions.h"
|
2006-10-19 02:54:28 +08:00
|
|
|
#include "gimprectangleselectoptions.h"
|
2003-06-30 04:40:45 +08:00
|
|
|
#include "gimptooloptions-gui.h"
|
2001-01-22 12:17:17 +08:00
|
|
|
|
2003-03-26 00:38:19 +08:00
|
|
|
#include "gimp-intl.h"
|
2001-01-22 12:17:17 +08:00
|
|
|
|
|
|
|
|
2003-02-08 01:12:21 +08:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
|
|
|
PROP_OPERATION,
|
|
|
|
PROP_ANTIALIAS,
|
|
|
|
PROP_FEATHER,
|
|
|
|
PROP_FEATHER_RADIUS,
|
|
|
|
PROP_SELECT_TRANSPARENT,
|
|
|
|
PROP_SAMPLE_MERGED,
|
|
|
|
PROP_THRESHOLD,
|
Applied (modified and enhanced) patch from Chris Moller which allows tools
2006-08-05 Michael Natterer <mitch@gimp.org>
Applied (modified and enhanced) patch from Chris Moller which allows
tools to distinguish similar colors not only by composite, but also
by R, G, B, H, S and V. Fixes bug #348291.
* app/core/core-enums.[ch]: added new enum GimpSelectCriterion
which can be one of { COMPOSITE, R, G, B, H, S, V }.
* app/core/gimpimage-contiguous-region.[ch]: added
select_criterion params and create the region based on difference
by the selected criterion.
* app/core/gimpchannel-select.[ch]
* app/core/gimpdrawable-bucket-fill.[ch]: take criterion params and
pass them through to the contiguous region functions.
* app/tools/gimpbucketfilloptions.[ch]
* app/tools/gimpselectionoptions.[ch]: added criterion properties
and GUI to select it.
* app/tools/gimpbucketfilltool.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpfuzzyselecttool.c: pass the selected criterion to
the resp. core functions.
* app/widgets/gimpdrawabletreeview.c
* app/widgets/gimpselectioneditor.c
* app/display/gimpdisplayshell-dnd.c
* tools/pdbgen/pdb/edit.pdb
* tools/pdbgen/pdb/selection_tools.pdb: changed accordingly
(simply pass GIMP_SELECT_CRITERION_COMPOSITE in most cases).
* app/pdb/edit_cmds.c
* app/pdb/selection_tools_cmds.c: regenerated.
2006-08-05 21:02:47 +08:00
|
|
|
PROP_SELECT_CRITERION,
|
2003-02-08 01:12:21 +08:00
|
|
|
PROP_INTERACTIVE
|
|
|
|
};
|
|
|
|
|
2003-01-07 00:25:04 +08:00
|
|
|
|
2003-02-08 01:12:21 +08:00
|
|
|
static void gimp_selection_options_set_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec);
|
|
|
|
static void gimp_selection_options_get_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec);
|
|
|
|
|
2004-10-07 01:21:22 +08:00
|
|
|
static void gimp_selection_options_reset (GimpToolOptions *tool_options);
|
2003-02-08 01:12:21 +08:00
|
|
|
|
|
|
|
|
2005-12-13 17:13:50 +08:00
|
|
|
G_DEFINE_TYPE (GimpSelectionOptions, gimp_selection_options,
|
2006-05-15 17:46:31 +08:00
|
|
|
GIMP_TYPE_TOOL_OPTIONS)
|
2003-01-07 00:25:04 +08:00
|
|
|
|
2005-12-13 17:13:50 +08:00
|
|
|
#define parent_class gimp_selection_options_parent_class
|
2001-01-22 12:17:17 +08:00
|
|
|
|
|
|
|
|
2003-07-17 23:22:21 +08:00
|
|
|
static void
|
2003-02-05 22:39:40 +08:00
|
|
|
gimp_selection_options_class_init (GimpSelectionOptionsClass *klass)
|
|
|
|
{
|
2004-09-24 20:01:35 +08:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
GimpToolOptionsClass *options_class = GIMP_TOOL_OPTIONS_CLASS (klass);
|
2003-02-08 01:12:21 +08:00
|
|
|
|
|
|
|
object_class->set_property = gimp_selection_options_set_property;
|
|
|
|
object_class->get_property = gimp_selection_options_get_property;
|
|
|
|
|
|
|
|
options_class->reset = gimp_selection_options_reset;
|
|
|
|
|
|
|
|
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_OPERATION,
|
|
|
|
"operation", NULL,
|
|
|
|
GIMP_TYPE_CHANNEL_OPS,
|
|
|
|
GIMP_CHANNEL_OP_REPLACE,
|
2006-01-19 04:29:40 +08:00
|
|
|
GIMP_PARAM_STATIC_STRINGS);
|
2003-02-08 01:12:21 +08:00
|
|
|
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_ANTIALIAS,
|
|
|
|
"antialias",
|
2003-02-09 08:22:42 +08:00
|
|
|
N_("Smooth edges"),
|
2003-02-08 01:12:21 +08:00
|
|
|
TRUE,
|
2006-01-19 04:29:40 +08:00
|
|
|
GIMP_PARAM_STATIC_STRINGS);
|
2003-02-08 01:12:21 +08:00
|
|
|
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FEATHER,
|
|
|
|
"feather", NULL,
|
|
|
|
FALSE,
|
2006-01-19 04:29:40 +08:00
|
|
|
GIMP_PARAM_STATIC_STRINGS);
|
2003-02-08 01:12:21 +08:00
|
|
|
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_FEATHER_RADIUS,
|
|
|
|
"feather-radius", NULL,
|
|
|
|
0.0, 100.0, 10.0,
|
2006-01-19 04:29:40 +08:00
|
|
|
GIMP_PARAM_STATIC_STRINGS);
|
2003-02-08 01:12:21 +08:00
|
|
|
|
|
|
|
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SELECT_TRANSPARENT,
|
|
|
|
"select-transparent",
|
2003-02-09 08:22:42 +08:00
|
|
|
N_("Allow completely transparent regions "
|
2004-09-24 20:01:35 +08:00
|
|
|
"to be selected"),
|
2003-02-08 01:12:21 +08:00
|
|
|
TRUE,
|
2006-01-19 04:29:40 +08:00
|
|
|
GIMP_PARAM_STATIC_STRINGS);
|
2003-02-08 01:12:21 +08:00
|
|
|
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SAMPLE_MERGED,
|
|
|
|
"sample-merged",
|
2003-02-09 08:22:42 +08:00
|
|
|
N_("Base selection on all visible layers"),
|
2003-02-08 01:12:21 +08:00
|
|
|
FALSE,
|
2006-01-19 04:29:40 +08:00
|
|
|
GIMP_PARAM_STATIC_STRINGS);
|
2003-02-08 01:12:21 +08:00
|
|
|
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_THRESHOLD,
|
|
|
|
"threshold",
|
2003-02-09 08:22:42 +08:00
|
|
|
N_("Maximum color difference"),
|
2003-02-08 01:12:21 +08:00
|
|
|
0.0, 255.0, 15.0,
|
2006-01-19 04:29:40 +08:00
|
|
|
GIMP_PARAM_STATIC_STRINGS);
|
Applied (modified and enhanced) patch from Chris Moller which allows tools
2006-08-05 Michael Natterer <mitch@gimp.org>
Applied (modified and enhanced) patch from Chris Moller which allows
tools to distinguish similar colors not only by composite, but also
by R, G, B, H, S and V. Fixes bug #348291.
* app/core/core-enums.[ch]: added new enum GimpSelectCriterion
which can be one of { COMPOSITE, R, G, B, H, S, V }.
* app/core/gimpimage-contiguous-region.[ch]: added
select_criterion params and create the region based on difference
by the selected criterion.
* app/core/gimpchannel-select.[ch]
* app/core/gimpdrawable-bucket-fill.[ch]: take criterion params and
pass them through to the contiguous region functions.
* app/tools/gimpbucketfilloptions.[ch]
* app/tools/gimpselectionoptions.[ch]: added criterion properties
and GUI to select it.
* app/tools/gimpbucketfilltool.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpfuzzyselecttool.c: pass the selected criterion to
the resp. core functions.
* app/widgets/gimpdrawabletreeview.c
* app/widgets/gimpselectioneditor.c
* app/display/gimpdisplayshell-dnd.c
* tools/pdbgen/pdb/edit.pdb
* tools/pdbgen/pdb/selection_tools.pdb: changed accordingly
(simply pass GIMP_SELECT_CRITERION_COMPOSITE in most cases).
* app/pdb/edit_cmds.c
* app/pdb/selection_tools_cmds.c: regenerated.
2006-08-05 21:02:47 +08:00
|
|
|
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_SELECT_CRITERION,
|
|
|
|
"select-criterion", NULL,
|
|
|
|
GIMP_TYPE_SELECT_CRITERION,
|
|
|
|
GIMP_SELECT_CRITERION_COMPOSITE,
|
|
|
|
GIMP_PARAM_STATIC_STRINGS);
|
2003-02-08 01:12:21 +08:00
|
|
|
|
|
|
|
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_INTERACTIVE,
|
|
|
|
"interactive", NULL,
|
|
|
|
FALSE,
|
2006-01-19 04:29:40 +08:00
|
|
|
GIMP_PARAM_STATIC_STRINGS);
|
2003-02-05 22:39:40 +08:00
|
|
|
}
|
2001-01-22 12:17:17 +08:00
|
|
|
|
2005-12-13 17:13:50 +08:00
|
|
|
static void
|
|
|
|
gimp_selection_options_init (GimpSelectionOptions *options)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2003-02-08 01:12:21 +08:00
|
|
|
static void
|
|
|
|
gimp_selection_options_set_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
2003-02-05 22:39:40 +08:00
|
|
|
{
|
2004-09-24 20:01:35 +08:00
|
|
|
GimpSelectionOptions *options = GIMP_SELECTION_OPTIONS (object);
|
2003-02-05 22:39:40 +08:00
|
|
|
|
2003-02-08 01:12:21 +08:00
|
|
|
switch (property_id)
|
|
|
|
{
|
|
|
|
case PROP_OPERATION:
|
|
|
|
options->operation = g_value_get_enum (value);
|
|
|
|
break;
|
|
|
|
case PROP_ANTIALIAS:
|
|
|
|
options->antialias = g_value_get_boolean (value);
|
|
|
|
break;
|
|
|
|
case PROP_FEATHER:
|
|
|
|
options->feather = g_value_get_boolean (value);
|
|
|
|
break;
|
|
|
|
case PROP_FEATHER_RADIUS:
|
|
|
|
options->feather_radius = g_value_get_double (value);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PROP_SELECT_TRANSPARENT:
|
|
|
|
options->select_transparent = g_value_get_boolean (value);
|
|
|
|
break;
|
|
|
|
case PROP_SAMPLE_MERGED:
|
|
|
|
options->sample_merged = g_value_get_boolean (value);
|
|
|
|
break;
|
|
|
|
case PROP_THRESHOLD:
|
|
|
|
options->threshold = g_value_get_double (value);
|
|
|
|
break;
|
Applied (modified and enhanced) patch from Chris Moller which allows tools
2006-08-05 Michael Natterer <mitch@gimp.org>
Applied (modified and enhanced) patch from Chris Moller which allows
tools to distinguish similar colors not only by composite, but also
by R, G, B, H, S and V. Fixes bug #348291.
* app/core/core-enums.[ch]: added new enum GimpSelectCriterion
which can be one of { COMPOSITE, R, G, B, H, S, V }.
* app/core/gimpimage-contiguous-region.[ch]: added
select_criterion params and create the region based on difference
by the selected criterion.
* app/core/gimpchannel-select.[ch]
* app/core/gimpdrawable-bucket-fill.[ch]: take criterion params and
pass them through to the contiguous region functions.
* app/tools/gimpbucketfilloptions.[ch]
* app/tools/gimpselectionoptions.[ch]: added criterion properties
and GUI to select it.
* app/tools/gimpbucketfilltool.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpfuzzyselecttool.c: pass the selected criterion to
the resp. core functions.
* app/widgets/gimpdrawabletreeview.c
* app/widgets/gimpselectioneditor.c
* app/display/gimpdisplayshell-dnd.c
* tools/pdbgen/pdb/edit.pdb
* tools/pdbgen/pdb/selection_tools.pdb: changed accordingly
(simply pass GIMP_SELECT_CRITERION_COMPOSITE in most cases).
* app/pdb/edit_cmds.c
* app/pdb/selection_tools_cmds.c: regenerated.
2006-08-05 21:02:47 +08:00
|
|
|
case PROP_SELECT_CRITERION:
|
|
|
|
options->select_criterion = g_value_get_enum (value);
|
|
|
|
break;
|
2003-02-08 01:12:21 +08:00
|
|
|
|
|
|
|
case PROP_INTERACTIVE:
|
|
|
|
options->interactive = g_value_get_boolean (value);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2003-02-05 22:39:40 +08:00
|
|
|
|
2003-02-08 01:12:21 +08:00
|
|
|
static void
|
|
|
|
gimp_selection_options_get_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
2004-09-24 20:01:35 +08:00
|
|
|
GimpSelectionOptions *options = GIMP_SELECTION_OPTIONS (object);
|
2001-01-22 12:17:17 +08:00
|
|
|
|
2003-02-08 01:12:21 +08:00
|
|
|
switch (property_id)
|
2001-11-21 11:54:09 +08:00
|
|
|
{
|
2003-02-08 01:12:21 +08:00
|
|
|
case PROP_OPERATION:
|
|
|
|
g_value_set_enum (value, options->operation);
|
|
|
|
break;
|
|
|
|
case PROP_ANTIALIAS:
|
|
|
|
g_value_set_boolean (value, options->antialias);
|
|
|
|
break;
|
|
|
|
case PROP_FEATHER:
|
|
|
|
g_value_set_boolean (value, options->feather);
|
|
|
|
break;
|
|
|
|
case PROP_FEATHER_RADIUS:
|
|
|
|
g_value_set_double (value, options->feather_radius);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PROP_SELECT_TRANSPARENT:
|
|
|
|
g_value_set_boolean (value, options->select_transparent);
|
|
|
|
break;
|
|
|
|
case PROP_SAMPLE_MERGED:
|
|
|
|
g_value_set_boolean (value, options->sample_merged);
|
|
|
|
break;
|
|
|
|
case PROP_THRESHOLD:
|
|
|
|
g_value_set_double (value, options->threshold);
|
|
|
|
break;
|
Applied (modified and enhanced) patch from Chris Moller which allows tools
2006-08-05 Michael Natterer <mitch@gimp.org>
Applied (modified and enhanced) patch from Chris Moller which allows
tools to distinguish similar colors not only by composite, but also
by R, G, B, H, S and V. Fixes bug #348291.
* app/core/core-enums.[ch]: added new enum GimpSelectCriterion
which can be one of { COMPOSITE, R, G, B, H, S, V }.
* app/core/gimpimage-contiguous-region.[ch]: added
select_criterion params and create the region based on difference
by the selected criterion.
* app/core/gimpchannel-select.[ch]
* app/core/gimpdrawable-bucket-fill.[ch]: take criterion params and
pass them through to the contiguous region functions.
* app/tools/gimpbucketfilloptions.[ch]
* app/tools/gimpselectionoptions.[ch]: added criterion properties
and GUI to select it.
* app/tools/gimpbucketfilltool.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpfuzzyselecttool.c: pass the selected criterion to
the resp. core functions.
* app/widgets/gimpdrawabletreeview.c
* app/widgets/gimpselectioneditor.c
* app/display/gimpdisplayshell-dnd.c
* tools/pdbgen/pdb/edit.pdb
* tools/pdbgen/pdb/selection_tools.pdb: changed accordingly
(simply pass GIMP_SELECT_CRITERION_COMPOSITE in most cases).
* app/pdb/edit_cmds.c
* app/pdb/selection_tools_cmds.c: regenerated.
2006-08-05 21:02:47 +08:00
|
|
|
case PROP_SELECT_CRITERION:
|
|
|
|
g_value_set_enum (value, options->select_criterion);
|
|
|
|
break;
|
2003-02-08 01:12:21 +08:00
|
|
|
|
|
|
|
case PROP_INTERACTIVE:
|
|
|
|
g_value_set_boolean (value, options->interactive);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_selection_options_reset (GimpToolOptions *tool_options)
|
2003-07-17 23:22:21 +08:00
|
|
|
{
|
|
|
|
GParamSpec *pspec;
|
2003-02-08 01:12:21 +08:00
|
|
|
|
|
|
|
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (tool_options),
|
|
|
|
"antialias");
|
2001-11-24 00:25:01 +08:00
|
|
|
|
2003-02-08 01:12:21 +08:00
|
|
|
if (pspec)
|
2003-07-17 23:22:21 +08:00
|
|
|
G_PARAM_SPEC_BOOLEAN (pspec)->default_value =
|
2006-10-19 02:54:28 +08:00
|
|
|
(tool_options->tool_info->tool_type != GIMP_TYPE_FOREGROUND_SELECT_TOOL);
|
2003-02-08 01:12:21 +08:00
|
|
|
|
|
|
|
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (tool_options),
|
|
|
|
"threshold");
|
2001-11-24 00:25:01 +08:00
|
|
|
|
2003-02-08 01:12:21 +08:00
|
|
|
if (pspec)
|
2003-07-17 23:22:21 +08:00
|
|
|
G_PARAM_SPEC_DOUBLE (pspec)->default_value =
|
|
|
|
GIMP_GUI_CONFIG (tool_options->tool_info->gimp->config)->default_threshold;
|
2004-10-07 01:21:22 +08:00
|
|
|
|
|
|
|
GIMP_TOOL_OPTIONS_CLASS (parent_class)->reset (tool_options);
|
2003-02-08 01:12:21 +08:00
|
|
|
}
|
|
|
|
|
2005-05-07 18:16:01 +08:00
|
|
|
static const gchar *
|
|
|
|
gimp_selection_options_get_modifier (GimpChannelOps operation)
|
|
|
|
{
|
|
|
|
GdkModifierType mod = 0;
|
|
|
|
|
|
|
|
switch (operation)
|
|
|
|
{
|
|
|
|
case GIMP_CHANNEL_OP_ADD:
|
|
|
|
mod = GDK_SHIFT_MASK;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_CHANNEL_OP_SUBTRACT:
|
|
|
|
mod = GDK_CONTROL_MASK;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_CHANNEL_OP_REPLACE:
|
|
|
|
mod = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_CHANNEL_OP_INTERSECT:
|
|
|
|
mod = GDK_CONTROL_MASK | GDK_SHIFT_MASK;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return gimp_get_mod_string (mod);
|
|
|
|
}
|
|
|
|
|
2003-02-10 01:32:52 +08:00
|
|
|
GtkWidget *
|
2003-02-08 01:12:21 +08:00
|
|
|
gimp_selection_options_gui (GimpToolOptions *tool_options)
|
|
|
|
{
|
2004-09-24 20:01:35 +08:00
|
|
|
GObject *config = G_OBJECT (tool_options);
|
|
|
|
GimpSelectionOptions *options = GIMP_SELECTION_OPTIONS (tool_options);
|
2005-07-29 10:07:49 +08:00
|
|
|
GtkWidget *vbox = gimp_tool_options_gui (tool_options);
|
2003-02-08 01:12:21 +08:00
|
|
|
GtkWidget *button;
|
|
|
|
|
|
|
|
/* the selection operation radio buttons */
|
|
|
|
{
|
2001-11-21 11:54:09 +08:00
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *label;
|
2005-05-07 18:16:01 +08:00
|
|
|
GList *children;
|
2003-02-08 01:12:21 +08:00
|
|
|
GList *list;
|
2005-05-07 18:16:01 +08:00
|
|
|
gint i;
|
2001-11-21 11:54:09 +08:00
|
|
|
|
2003-02-08 01:12:21 +08:00
|
|
|
hbox = gimp_prop_enum_stock_box_new (config, "operation",
|
|
|
|
"gimp-selection", 0, 0);
|
2001-11-21 11:54:09 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (hbox);
|
|
|
|
|
2005-05-07 18:16:01 +08:00
|
|
|
children = gtk_container_get_children (GTK_CONTAINER (hbox));
|
|
|
|
|
|
|
|
/* add modifier keys to the tooltips */
|
|
|
|
for (list = children, i = 0; list; list = list->next, i++)
|
|
|
|
{
|
|
|
|
GtkWidget *button = list->data;
|
|
|
|
GtkTooltipsData *data = gtk_tooltips_data_get (button);
|
|
|
|
const gchar *modifier = gimp_selection_options_get_modifier (i);
|
|
|
|
|
|
|
|
if (! modifier)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (data && data->tip_text)
|
|
|
|
{
|
2005-09-14 06:17:05 +08:00
|
|
|
gchar *tip = g_strdup_printf ("%s (%s)", data->tip_text, modifier);
|
2005-05-07 18:16:01 +08:00
|
|
|
|
|
|
|
gimp_help_set_help_data (button, tip, NULL);
|
|
|
|
g_free (tip);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gimp_help_set_help_data (button, modifier, NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* move GIMP_CHANNEL_OP_REPLACE to the front */
|
|
|
|
gtk_box_reorder_child (GTK_BOX (hbox),
|
|
|
|
GTK_WIDGET (children->next->next->data), 0);
|
|
|
|
|
|
|
|
g_list_free (children);
|
2003-02-08 01:12:21 +08:00
|
|
|
|
2001-11-21 11:54:09 +08:00
|
|
|
label = gtk_label_new (_("Mode:"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
2003-02-08 01:12:21 +08:00
|
|
|
gtk_box_reorder_child (GTK_BOX (hbox), label, 0);
|
2003-05-31 07:52:24 +08:00
|
|
|
gtk_widget_show (label);
|
2001-11-21 11:54:09 +08:00
|
|
|
}
|
|
|
|
|
2001-01-22 12:17:17 +08:00
|
|
|
/* the antialias toggle button */
|
2005-08-22 05:43:34 +08:00
|
|
|
button = gimp_prop_check_button_new (config, "antialias",
|
|
|
|
_("Antialiasing"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (button);
|
|
|
|
|
2006-10-19 02:54:28 +08:00
|
|
|
if (tool_options->tool_info->tool_type == GIMP_TYPE_FOREGROUND_SELECT_TOOL)
|
|
|
|
gtk_widget_set_sensitive (button, FALSE);
|
|
|
|
|
|
|
|
options->antialias_toggle = button;
|
2001-01-22 12:17:17 +08:00
|
|
|
|
2001-11-24 00:25:01 +08:00
|
|
|
/* the feather frame */
|
|
|
|
{
|
|
|
|
GtkWidget *frame;
|
2002-03-09 02:30:40 +08:00
|
|
|
GtkWidget *table;
|
2001-11-24 00:25:01 +08:00
|
|
|
|
2004-05-05 05:11:06 +08:00
|
|
|
frame = gimp_frame_new (NULL);
|
2001-11-24 00:25:01 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
2003-02-08 01:12:21 +08:00
|
|
|
button = gimp_prop_check_button_new (config, "feather",
|
2004-06-24 04:29:46 +08:00
|
|
|
_("Feather edges"));
|
2003-02-08 01:12:21 +08:00
|
|
|
gtk_frame_set_label_widget (GTK_FRAME (frame), button);
|
|
|
|
gtk_widget_show (button);
|
|
|
|
|
2004-11-24 01:01:51 +08:00
|
|
|
table = gtk_table_new (1, 3, FALSE);
|
|
|
|
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), table);
|
|
|
|
if (options->feather)
|
|
|
|
gtk_widget_show (table);
|
|
|
|
|
|
|
|
g_signal_connect_object (button, "toggled",
|
|
|
|
G_CALLBACK (gimp_toggle_button_set_visible),
|
|
|
|
table, 0);
|
2003-07-17 23:22:21 +08:00
|
|
|
|
2003-02-08 01:12:21 +08:00
|
|
|
/* the feather radius scale */
|
|
|
|
gimp_prop_scale_entry_new (config, "feather-radius",
|
|
|
|
GTK_TABLE (table), 0, 0,
|
|
|
|
_("Radius:"),
|
|
|
|
1.0, 10.0, 1,
|
|
|
|
FALSE, 0.0, 0.0);
|
2001-11-24 00:25:01 +08:00
|
|
|
}
|
|
|
|
|
2001-01-22 12:17:17 +08:00
|
|
|
/* selection tool with an interactive boundary that can be toggled */
|
2003-02-05 22:39:40 +08:00
|
|
|
if (tool_options->tool_info->tool_type == GIMP_TYPE_ISCISSORS_TOOL)
|
2001-01-22 12:17:17 +08:00
|
|
|
{
|
2003-02-08 01:12:21 +08:00
|
|
|
button = gimp_prop_check_button_new (config, "interactive",
|
2004-06-24 04:29:46 +08:00
|
|
|
_("Show interactive boundary"));
|
2003-02-08 01:12:21 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (button);
|
2001-01-22 12:17:17 +08:00
|
|
|
}
|
|
|
|
|
2001-11-09 03:14:51 +08:00
|
|
|
/* selection tools which operate on colors or contiguous regions */
|
2006-07-31 19:45:50 +08:00
|
|
|
if (g_type_is_a (tool_options->tool_info->tool_type,
|
|
|
|
GIMP_TYPE_REGION_SELECT_TOOL))
|
2001-01-22 12:17:17 +08:00
|
|
|
{
|
2001-11-24 00:25:01 +08:00
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *vbox2;
|
2002-03-09 02:30:40 +08:00
|
|
|
GtkWidget *table;
|
Applied (modified and enhanced) patch from Chris Moller which allows tools
2006-08-05 Michael Natterer <mitch@gimp.org>
Applied (modified and enhanced) patch from Chris Moller which allows
tools to distinguish similar colors not only by composite, but also
by R, G, B, H, S and V. Fixes bug #348291.
* app/core/core-enums.[ch]: added new enum GimpSelectCriterion
which can be one of { COMPOSITE, R, G, B, H, S, V }.
* app/core/gimpimage-contiguous-region.[ch]: added
select_criterion params and create the region based on difference
by the selected criterion.
* app/core/gimpchannel-select.[ch]
* app/core/gimpdrawable-bucket-fill.[ch]: take criterion params and
pass them through to the contiguous region functions.
* app/tools/gimpbucketfilloptions.[ch]
* app/tools/gimpselectionoptions.[ch]: added criterion properties
and GUI to select it.
* app/tools/gimpbucketfilltool.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpfuzzyselecttool.c: pass the selected criterion to
the resp. core functions.
* app/widgets/gimpdrawabletreeview.c
* app/widgets/gimpselectioneditor.c
* app/display/gimpdisplayshell-dnd.c
* tools/pdbgen/pdb/edit.pdb
* tools/pdbgen/pdb/selection_tools.pdb: changed accordingly
(simply pass GIMP_SELECT_CRITERION_COMPOSITE in most cases).
* app/pdb/edit_cmds.c
* app/pdb/selection_tools_cmds.c: regenerated.
2006-08-05 21:02:47 +08:00
|
|
|
GtkWidget *combo;
|
2001-01-22 12:17:17 +08:00
|
|
|
|
2004-05-05 05:11:06 +08:00
|
|
|
frame = gimp_frame_new (_("Finding Similar Colors"));
|
2001-11-24 00:25:01 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
|
|
|
vbox2 = gtk_vbox_new (FALSE, 0);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), vbox2);
|
|
|
|
gtk_widget_show (vbox2);
|
|
|
|
|
2002-02-10 23:18:08 +08:00
|
|
|
/* the select transparent areas toggle */
|
2003-02-08 01:12:21 +08:00
|
|
|
button = gimp_prop_check_button_new (config, "select-transparent",
|
2004-06-24 04:29:46 +08:00
|
|
|
_("Select transparent areas"));
|
2003-02-08 01:12:21 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (button);
|
2002-02-10 23:18:08 +08:00
|
|
|
|
2001-01-22 12:17:17 +08:00
|
|
|
/* the sample merged toggle */
|
2003-02-08 01:12:21 +08:00
|
|
|
button = gimp_prop_check_button_new (config, "sample-merged",
|
2004-06-24 04:29:46 +08:00
|
|
|
_("Sample merged"));
|
2003-02-08 01:12:21 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (button);
|
2001-01-22 12:17:17 +08:00
|
|
|
|
|
|
|
/* the threshold scale */
|
Applied (modified and enhanced) patch from Chris Moller which allows tools
2006-08-05 Michael Natterer <mitch@gimp.org>
Applied (modified and enhanced) patch from Chris Moller which allows
tools to distinguish similar colors not only by composite, but also
by R, G, B, H, S and V. Fixes bug #348291.
* app/core/core-enums.[ch]: added new enum GimpSelectCriterion
which can be one of { COMPOSITE, R, G, B, H, S, V }.
* app/core/gimpimage-contiguous-region.[ch]: added
select_criterion params and create the region based on difference
by the selected criterion.
* app/core/gimpchannel-select.[ch]
* app/core/gimpdrawable-bucket-fill.[ch]: take criterion params and
pass them through to the contiguous region functions.
* app/tools/gimpbucketfilloptions.[ch]
* app/tools/gimpselectionoptions.[ch]: added criterion properties
and GUI to select it.
* app/tools/gimpbucketfilltool.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpfuzzyselecttool.c: pass the selected criterion to
the resp. core functions.
* app/widgets/gimpdrawabletreeview.c
* app/widgets/gimpselectioneditor.c
* app/display/gimpdisplayshell-dnd.c
* tools/pdbgen/pdb/edit.pdb
* tools/pdbgen/pdb/selection_tools.pdb: changed accordingly
(simply pass GIMP_SELECT_CRITERION_COMPOSITE in most cases).
* app/pdb/edit_cmds.c
* app/pdb/selection_tools_cmds.c: regenerated.
2006-08-05 21:02:47 +08:00
|
|
|
table = gtk_table_new (2, 3, FALSE);
|
2002-03-09 02:30:40 +08:00
|
|
|
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox2), table, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (table);
|
2001-01-22 12:17:17 +08:00
|
|
|
|
2003-02-08 01:12:21 +08:00
|
|
|
gimp_prop_scale_entry_new (config, "threshold",
|
|
|
|
GTK_TABLE (table), 0, 0,
|
|
|
|
_("Threshold:"),
|
|
|
|
1.0, 16.0, 1,
|
|
|
|
FALSE, 0.0, 0.0);
|
Applied (modified and enhanced) patch from Chris Moller which allows tools
2006-08-05 Michael Natterer <mitch@gimp.org>
Applied (modified and enhanced) patch from Chris Moller which allows
tools to distinguish similar colors not only by composite, but also
by R, G, B, H, S and V. Fixes bug #348291.
* app/core/core-enums.[ch]: added new enum GimpSelectCriterion
which can be one of { COMPOSITE, R, G, B, H, S, V }.
* app/core/gimpimage-contiguous-region.[ch]: added
select_criterion params and create the region based on difference
by the selected criterion.
* app/core/gimpchannel-select.[ch]
* app/core/gimpdrawable-bucket-fill.[ch]: take criterion params and
pass them through to the contiguous region functions.
* app/tools/gimpbucketfilloptions.[ch]
* app/tools/gimpselectionoptions.[ch]: added criterion properties
and GUI to select it.
* app/tools/gimpbucketfilltool.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpfuzzyselecttool.c: pass the selected criterion to
the resp. core functions.
* app/widgets/gimpdrawabletreeview.c
* app/widgets/gimpselectioneditor.c
* app/display/gimpdisplayshell-dnd.c
* tools/pdbgen/pdb/edit.pdb
* tools/pdbgen/pdb/selection_tools.pdb: changed accordingly
(simply pass GIMP_SELECT_CRITERION_COMPOSITE in most cases).
* app/pdb/edit_cmds.c
* app/pdb/selection_tools_cmds.c: regenerated.
2006-08-05 21:02:47 +08:00
|
|
|
|
|
|
|
/* the select criterion combo */
|
|
|
|
combo = gimp_prop_enum_combo_box_new (config, "select-criterion", 0, 0);
|
|
|
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
|
|
|
|
_("Select by:"), 0.0, 0.5,
|
|
|
|
combo, 2, FALSE);
|
2001-01-22 12:17:17 +08:00
|
|
|
}
|
|
|
|
|
2003-02-10 01:32:52 +08:00
|
|
|
return vbox;
|
2001-01-22 12:17:17 +08:00
|
|
|
}
|
2003-01-07 00:25:04 +08:00
|
|
|
|