2006-12-09 21:33:38 +00:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2003-02-05 14:39:40 +00:00
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2005-01-25 19:11:26 +00:00
|
|
|
#include "libgimpconfig/gimpconfig.h"
|
2003-02-05 14:39:40 +00:00
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
|
|
|
|
|
|
|
#include "tools-types.h"
|
|
|
|
|
|
|
|
#include "config/gimpguiconfig.h"
|
|
|
|
|
|
|
|
#include "core/gimp.h"
|
2003-03-25 21:14:48 +00:00
|
|
|
#include "core/gimpdatafactory.h"
|
2003-02-05 14:39:40 +00:00
|
|
|
#include "core/gimptoolinfo.h"
|
|
|
|
|
|
|
|
#include "display/gimpdisplay.h"
|
|
|
|
|
2004-10-12 12:06:50 +00:00
|
|
|
#include "widgets/gimpviewablebox.h"
|
2003-02-05 14:39:40 +00:00
|
|
|
#include "widgets/gimpwidgets-utils.h"
|
|
|
|
|
|
|
|
#include "gimpbucketfilloptions.h"
|
2003-06-29 20:40:45 +00:00
|
|
|
#include "gimppaintoptions-gui.h"
|
2003-02-05 14:39:40 +00:00
|
|
|
|
2003-03-25 16:38:19 +00:00
|
|
|
#include "gimp-intl.h"
|
2003-02-05 14:39:40 +00:00
|
|
|
|
|
|
|
|
2003-02-07 17:12:21 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
2004-01-27 15:26:11 +00:00
|
|
|
PROP_FILL_MODE,
|
|
|
|
PROP_FILL_SELECTION,
|
2003-02-07 17:12:21 +00:00
|
|
|
PROP_FILL_TRANSPARENT,
|
|
|
|
PROP_SAMPLE_MERGED,
|
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 13:02:47 +00:00
|
|
|
PROP_THRESHOLD,
|
|
|
|
PROP_FILL_CRITERION
|
2003-02-07 17:12:21 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2003-07-17 15:22:21 +00:00
|
|
|
static void gimp_bucket_fill_options_set_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec);
|
|
|
|
static void gimp_bucket_fill_options_get_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec);
|
2003-02-07 17:12:21 +00:00
|
|
|
|
2003-07-17 15:22:21 +00:00
|
|
|
static void gimp_bucket_fill_options_reset (GimpToolOptions *tool_options);
|
2004-01-27 15:26:11 +00:00
|
|
|
static void gimp_bucket_fill_options_notify (GimpBucketFillOptions *options,
|
|
|
|
GParamSpec *pspec,
|
|
|
|
GtkWidget *widget);
|
2003-03-25 21:14:48 +00:00
|
|
|
|
2003-02-07 17:12:21 +00:00
|
|
|
|
2005-12-13 09:13:50 +00:00
|
|
|
G_DEFINE_TYPE (GimpBucketFillOptions, gimp_bucket_fill_options,
|
2006-05-15 09:46:31 +00:00
|
|
|
GIMP_TYPE_PAINT_OPTIONS)
|
2003-02-05 14:39:40 +00:00
|
|
|
|
2005-12-13 09:13:50 +00:00
|
|
|
#define parent_class gimp_bucket_fill_options_parent_class
|
2003-02-05 14:39:40 +00:00
|
|
|
|
|
|
|
|
2003-07-17 15:22:21 +00:00
|
|
|
static void
|
2003-02-05 14:39:40 +00:00
|
|
|
gimp_bucket_fill_options_class_init (GimpBucketFillOptionsClass *klass)
|
|
|
|
{
|
2004-09-24 12:01:35 +00:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
GimpToolOptionsClass *options_class = GIMP_TOOL_OPTIONS_CLASS (klass);
|
2003-02-07 17:12:21 +00:00
|
|
|
|
|
|
|
object_class->set_property = gimp_bucket_fill_options_set_property;
|
|
|
|
object_class->get_property = gimp_bucket_fill_options_get_property;
|
|
|
|
|
|
|
|
options_class->reset = gimp_bucket_fill_options_reset;
|
|
|
|
|
2004-01-27 15:26:11 +00:00
|
|
|
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_FILL_MODE,
|
|
|
|
"fill-mode", NULL,
|
|
|
|
GIMP_TYPE_BUCKET_FILL_MODE,
|
|
|
|
GIMP_FG_BUCKET_FILL,
|
2006-01-18 20:29:40 +00:00
|
|
|
GIMP_PARAM_STATIC_STRINGS);
|
2004-01-27 15:26:11 +00:00
|
|
|
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FILL_SELECTION,
|
|
|
|
"fill-selection", NULL,
|
|
|
|
FALSE,
|
2006-01-18 20:29:40 +00:00
|
|
|
GIMP_PARAM_STATIC_STRINGS);
|
2003-02-07 17:12:21 +00:00
|
|
|
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FILL_TRANSPARENT,
|
|
|
|
"fill-transparent",
|
2003-02-09 00:22:42 +00:00
|
|
|
N_("Allow completely transparent regions "
|
2004-09-24 12:01:35 +00:00
|
|
|
"to be filled"),
|
2003-02-07 17:12:21 +00:00
|
|
|
TRUE,
|
2006-01-18 20:29:40 +00:00
|
|
|
GIMP_PARAM_STATIC_STRINGS);
|
2003-02-07 17:12:21 +00:00
|
|
|
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SAMPLE_MERGED,
|
|
|
|
"sample-merged",
|
2003-02-09 00:22:42 +00:00
|
|
|
N_("Base filled area on all visible "
|
2004-09-24 12:01:35 +00:00
|
|
|
"layers"),
|
2003-02-07 17:12:21 +00:00
|
|
|
FALSE,
|
2006-01-18 20:29:40 +00:00
|
|
|
GIMP_PARAM_STATIC_STRINGS);
|
2003-02-07 17:12:21 +00:00
|
|
|
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_THRESHOLD,
|
|
|
|
"threshold",
|
2003-02-09 00:22:42 +00:00
|
|
|
N_("Maximum color difference"),
|
2003-02-07 17:12:21 +00:00
|
|
|
0.0, 255.0, 15.0,
|
2006-01-18 20:29:40 +00: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 13:02:47 +00:00
|
|
|
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_FILL_CRITERION,
|
|
|
|
"fill-criterion", NULL,
|
|
|
|
GIMP_TYPE_SELECT_CRITERION,
|
|
|
|
GIMP_SELECT_CRITERION_COMPOSITE,
|
|
|
|
GIMP_PARAM_STATIC_STRINGS);
|
2003-02-05 14:39:40 +00:00
|
|
|
}
|
|
|
|
|
2005-12-13 09:13:50 +00:00
|
|
|
static void
|
|
|
|
gimp_bucket_fill_options_init (GimpBucketFillOptions *options)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2003-02-07 17:12:21 +00:00
|
|
|
static void
|
|
|
|
gimp_bucket_fill_options_set_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
2003-02-05 14:39:40 +00:00
|
|
|
{
|
2004-09-24 12:01:35 +00:00
|
|
|
GimpBucketFillOptions *options = GIMP_BUCKET_FILL_OPTIONS (object);
|
2003-02-05 14:39:40 +00:00
|
|
|
|
2003-02-07 17:12:21 +00:00
|
|
|
switch (property_id)
|
|
|
|
{
|
2004-01-27 15:26:11 +00:00
|
|
|
case PROP_FILL_MODE:
|
|
|
|
options->fill_mode = g_value_get_enum (value);
|
|
|
|
break;
|
|
|
|
case PROP_FILL_SELECTION:
|
|
|
|
options->fill_selection = g_value_get_boolean (value);
|
|
|
|
break;
|
2003-02-07 17:12:21 +00:00
|
|
|
case PROP_FILL_TRANSPARENT:
|
|
|
|
options->fill_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 13:02:47 +00:00
|
|
|
case PROP_FILL_CRITERION:
|
|
|
|
options->fill_criterion = g_value_get_enum (value);
|
|
|
|
break;
|
|
|
|
|
2003-02-07 17:12:21 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2003-02-05 14:39:40 +00:00
|
|
|
|
2003-02-07 17:12:21 +00:00
|
|
|
static void
|
|
|
|
gimp_bucket_fill_options_get_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
2004-09-24 12:01:35 +00:00
|
|
|
GimpBucketFillOptions *options = GIMP_BUCKET_FILL_OPTIONS (object);
|
2003-02-05 14:39:40 +00:00
|
|
|
|
2003-02-07 17:12:21 +00:00
|
|
|
switch (property_id)
|
|
|
|
{
|
2004-01-27 15:26:11 +00:00
|
|
|
case PROP_FILL_MODE:
|
|
|
|
g_value_set_enum (value, options->fill_mode);
|
|
|
|
break;
|
|
|
|
case PROP_FILL_SELECTION:
|
|
|
|
g_value_set_boolean (value, options->fill_selection);
|
|
|
|
break;
|
2003-02-07 17:12:21 +00:00
|
|
|
case PROP_FILL_TRANSPARENT:
|
|
|
|
g_value_set_boolean (value, options->fill_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 13:02:47 +00:00
|
|
|
case PROP_FILL_CRITERION:
|
|
|
|
g_value_set_enum (value, options->fill_criterion);
|
|
|
|
break;
|
|
|
|
|
2003-02-07 17:12:21 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2003-02-05 14:39:40 +00:00
|
|
|
|
2003-02-07 17:12:21 +00:00
|
|
|
static void
|
|
|
|
gimp_bucket_fill_options_reset (GimpToolOptions *tool_options)
|
|
|
|
{
|
|
|
|
GParamSpec *pspec;
|
|
|
|
|
|
|
|
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (tool_options),
|
|
|
|
"threshold");
|
|
|
|
|
|
|
|
if (pspec)
|
|
|
|
G_PARAM_SPEC_DOUBLE (pspec)->default_value =
|
|
|
|
GIMP_GUI_CONFIG (tool_options->tool_info->gimp->config)->default_threshold;
|
2004-10-06 17:21:22 +00:00
|
|
|
|
|
|
|
GIMP_TOOL_OPTIONS_CLASS (parent_class)->reset (tool_options);
|
2003-02-07 17:12:21 +00:00
|
|
|
}
|
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
GtkWidget *
|
2003-02-07 17:12:21 +00:00
|
|
|
gimp_bucket_fill_options_gui (GimpToolOptions *tool_options)
|
|
|
|
{
|
2004-09-24 12:01:35 +00:00
|
|
|
GObject *config = G_OBJECT (tool_options);
|
2006-08-27 22:19:35 +00:00
|
|
|
GtkWidget *vbox = gimp_paint_options_gui (tool_options);
|
2003-03-25 21:14:48 +00:00
|
|
|
GtkWidget *vbox2;
|
2003-04-08 20:08:37 +00:00
|
|
|
GtkWidget *table;
|
2003-03-25 21:14:48 +00:00
|
|
|
GtkWidget *frame;
|
2004-10-11 13:27:42 +00:00
|
|
|
GtkWidget *hbox;
|
2003-04-08 20:08:37 +00:00
|
|
|
GtkWidget *button;
|
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 13:02:47 +00:00
|
|
|
GtkWidget *combo;
|
2003-03-25 21:14:48 +00:00
|
|
|
gchar *str;
|
2003-02-07 17:12:21 +00:00
|
|
|
|
2003-02-05 14:39:40 +00:00
|
|
|
/* fill type */
|
2005-09-13 22:17:05 +00:00
|
|
|
str = g_strdup_printf (_("Fill Type (%s)"),
|
2004-06-28 23:30:57 +00:00
|
|
|
gimp_get_mod_string (GDK_CONTROL_MASK)),
|
2003-03-25 21:14:48 +00:00
|
|
|
frame = gimp_prop_enum_radio_frame_new (config, "fill-mode", str, 0, 0);
|
|
|
|
g_free (str);
|
2003-02-07 17:12:21 +00:00
|
|
|
|
2003-02-05 14:39:40 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
2006-01-14 00:09:22 +00:00
|
|
|
hbox = gimp_prop_pattern_box_new (NULL, GIMP_CONTEXT (tool_options), 2,
|
|
|
|
"pattern-view-type", "pattern-view-size");
|
2004-10-12 12:06:50 +00:00
|
|
|
gimp_enum_radio_frame_add (GTK_FRAME (frame), hbox, GIMP_PATTERN_BUCKET_FILL);
|
2004-10-11 13:27:42 +00:00
|
|
|
|
2004-01-27 15:26:11 +00:00
|
|
|
/* fill selection */
|
2005-09-13 22:17:05 +00:00
|
|
|
str = g_strdup_printf (_("Affected Area (%s)"),
|
2004-06-28 23:30:57 +00:00
|
|
|
gimp_get_mod_string (GDK_SHIFT_MASK));
|
2004-01-27 15:26:11 +00:00
|
|
|
frame = gimp_prop_boolean_radio_frame_new (config, "fill-selection",
|
|
|
|
str,
|
2004-06-23 20:29:46 +00:00
|
|
|
_("Fill whole selection"),
|
|
|
|
_("Fill similar colors"));
|
2004-01-27 15:26:11 +00:00
|
|
|
g_free (str);
|
2005-09-13 12:39:37 +00:00
|
|
|
gtk_box_reorder_child (GTK_BOX (gtk_bin_get_child (GTK_BIN (frame))),
|
|
|
|
g_object_get_data (G_OBJECT (frame), "radio-button"),
|
|
|
|
1);
|
2004-01-27 15:26:11 +00:00
|
|
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
2004-05-04 21:11:06 +00:00
|
|
|
frame = gimp_frame_new (_("Finding Similar Colors"));
|
2003-02-05 14:39:40 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
2004-10-14 15:44:13 +00:00
|
|
|
gtk_widget_set_sensitive (frame,
|
|
|
|
! GIMP_BUCKET_FILL_OPTIONS (config)->fill_selection);
|
2004-01-27 15:26:11 +00:00
|
|
|
g_signal_connect_object (config, "notify::fill-selection",
|
|
|
|
G_CALLBACK (gimp_bucket_fill_options_notify),
|
|
|
|
G_OBJECT (frame), 0);
|
|
|
|
|
2003-02-05 14:39:40 +00:00
|
|
|
vbox2 = gtk_vbox_new (FALSE, 0);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), vbox2);
|
|
|
|
gtk_widget_show (vbox2);
|
|
|
|
|
|
|
|
/* the fill transparent areas toggle */
|
2003-02-07 17:12:21 +00:00
|
|
|
button = gimp_prop_check_button_new (config, "fill-transparent",
|
2004-06-23 20:29:46 +00:00
|
|
|
_("Fill transparent areas"));
|
2003-02-07 17:12:21 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (button);
|
2003-02-05 14:39:40 +00:00
|
|
|
|
|
|
|
/* the sample merged toggle */
|
2003-02-07 17:12:21 +00:00
|
|
|
button = gimp_prop_check_button_new (config, "sample-merged",
|
2004-06-23 20:29:46 +00:00
|
|
|
_("Sample merged"));
|
2003-02-07 17:12:21 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (button);
|
2003-02-05 14:39:40 +00: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 13:02:47 +00:00
|
|
|
table = gtk_table_new (2, 3, FALSE);
|
2003-02-05 14:39:40 +00: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);
|
|
|
|
|
2003-02-07 17:12:21 +00:00
|
|
|
gimp_prop_scale_entry_new (config, "threshold",
|
|
|
|
GTK_TABLE (table), 0, 0,
|
|
|
|
_("Threshold:"),
|
|
|
|
1.0, 16.0, 1,
|
|
|
|
FALSE, 0.0, 0.0);
|
2003-02-05 14:39:40 +00:00
|
|
|
|
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 13:02:47 +00:00
|
|
|
/* the fill criterion combo */
|
|
|
|
combo = gimp_prop_enum_combo_box_new (config, "fill-criterion", 0, 0);
|
|
|
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
|
|
|
|
_("Fill by:"), 0.0, 0.5,
|
|
|
|
combo, 2, FALSE);
|
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
return vbox;
|
2003-02-05 14:39:40 +00:00
|
|
|
}
|
2004-01-27 15:26:11 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_bucket_fill_options_notify (GimpBucketFillOptions *options,
|
|
|
|
GParamSpec *pspec,
|
|
|
|
GtkWidget *widget)
|
|
|
|
{
|
|
|
|
gtk_widget_set_sensitive (widget, ! options->fill_selection);
|
|
|
|
}
|