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"
|
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"
|
|
|
|
|
|
|
|
#include "core/gimptoolinfo.h"
|
2001-01-22 12:17:17 +08:00
|
|
|
|
|
|
|
#include "gimprc.h"
|
|
|
|
|
2001-03-08 12:15:32 +08:00
|
|
|
#include "gimpellipseselecttool.h"
|
2001-03-10 01:39:18 +08:00
|
|
|
#include "gimpfuzzyselecttool.h"
|
2001-03-12 06:19:06 +08:00
|
|
|
#include "gimpiscissorstool.h"
|
2001-03-08 12:15:32 +08:00
|
|
|
#include "gimprectselecttool.h"
|
2001-05-10 16:10:25 +08:00
|
|
|
#include "gimpbycolorselecttool.h"
|
2001-03-08 09:07:03 +08:00
|
|
|
#include "gimptool.h"
|
2001-01-25 06:36:18 +08:00
|
|
|
#include "selection_options.h"
|
2001-02-24 05:32:47 +08:00
|
|
|
#include "tool_manager.h"
|
2001-01-22 12:17:17 +08:00
|
|
|
|
|
|
|
#include "libgimp/gimpintl.h"
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
selection_options_init (SelectionOptions *options,
|
2001-08-14 22:53:55 +08:00
|
|
|
GType tool_type,
|
2001-01-22 12:17:17 +08:00
|
|
|
ToolOptionsResetFunc reset_func)
|
|
|
|
{
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *abox;
|
|
|
|
GtkWidget *table;
|
|
|
|
GtkWidget *label;
|
|
|
|
GtkWidget *scale;
|
|
|
|
|
|
|
|
/* initialize the tool options structure */
|
2001-07-18 04:50:01 +08:00
|
|
|
tool_options_init ((GimpToolOptions *) options,
|
2001-01-22 12:17:17 +08:00
|
|
|
reset_func);
|
|
|
|
|
|
|
|
/* the main vbox */
|
|
|
|
vbox = options->tool_options.main_vbox;
|
|
|
|
|
|
|
|
/* initialize the selection options structure */
|
|
|
|
options->feather = options->feather_d = FALSE;
|
|
|
|
options->feather_radius = options->feather_radius_d = 10.0;
|
|
|
|
options->antialias = options->antialias_d = TRUE;
|
|
|
|
options->sample_merged = options->sample_merged_d = FALSE;
|
2001-06-04 04:40:50 +08:00
|
|
|
options->threshold = gimprc.default_threshold;
|
2001-11-10 22:17:01 +08:00
|
|
|
options->auto_shrink = options->auto_shrink_d = FALSE;
|
|
|
|
options->shrink_merged = options->shrink_merged_d = FALSE;
|
2001-01-22 12:17:17 +08:00
|
|
|
options->fixed_size = options->fixed_size_d = FALSE;
|
|
|
|
options->fixed_height = options->fixed_height_d = 1;
|
|
|
|
options->fixed_width = options->fixed_width_d = 1;
|
|
|
|
options->fixed_unit = options->fixed_unit_d = GIMP_UNIT_PIXEL;
|
|
|
|
options->interactive = options->interactive_d = FALSE;
|
|
|
|
|
|
|
|
options->feather_w = NULL;
|
|
|
|
options->feather_radius_w = NULL;
|
|
|
|
options->antialias_w = NULL;
|
|
|
|
options->sample_merged_w = NULL;
|
|
|
|
options->threshold_w = NULL;
|
2001-11-10 22:17:01 +08:00
|
|
|
options->auto_shrink_w = NULL;
|
|
|
|
options->shrink_merged_w = NULL;
|
2001-01-22 12:17:17 +08:00
|
|
|
options->fixed_size_w = NULL;
|
|
|
|
options->fixed_height_w = NULL;
|
|
|
|
options->fixed_width_w = NULL;
|
|
|
|
options->fixed_unit_w = NULL;
|
|
|
|
options->interactive_w = NULL;
|
|
|
|
|
|
|
|
/* the feather toggle button */
|
|
|
|
table = gtk_table_new (2, 2, FALSE);
|
|
|
|
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
options->feather_w = gtk_check_button_new_with_label (_("Feather"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->feather_w),
|
|
|
|
options->feather_d);
|
2001-11-09 03:14:51 +08:00
|
|
|
gtk_table_attach (GTK_TABLE (table), options->feather_w, 0, 1, 0, 1,
|
|
|
|
GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
|
|
|
|
gtk_widget_show (options->feather_w);
|
|
|
|
|
2001-08-01 10:57:58 +08:00
|
|
|
g_signal_connect (G_OBJECT (options->feather_w), "toggled",
|
|
|
|
G_CALLBACK (gimp_toggle_button_update),
|
|
|
|
&options->feather);
|
2001-01-22 12:17:17 +08:00
|
|
|
|
|
|
|
/* the feather radius scale */
|
|
|
|
label = gtk_label_new (_("Radius:"));
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 1.0);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
|
|
|
|
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
abox = gtk_alignment_new (0.5, 1.0, 1.0, 0.0);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), abox, 1, 2, 0, 2,
|
|
|
|
GTK_EXPAND | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
|
|
|
gtk_widget_show (abox);
|
|
|
|
|
|
|
|
options->feather_radius_w =
|
|
|
|
gtk_adjustment_new (options->feather_radius_d, 0.0, 100.0, 1.0, 1.0, 1.0);
|
|
|
|
scale = gtk_hscale_new (GTK_ADJUSTMENT (options->feather_radius_w));
|
|
|
|
gtk_container_add (GTK_CONTAINER (abox), scale);
|
|
|
|
gtk_scale_set_value_pos (GTK_SCALE (scale), GTK_POS_TOP);
|
|
|
|
gtk_range_set_update_policy (GTK_RANGE (scale), GTK_UPDATE_DELAYED);
|
2001-11-09 03:14:51 +08:00
|
|
|
gtk_widget_show (scale);
|
|
|
|
|
2001-08-01 10:57:58 +08:00
|
|
|
g_signal_connect (G_OBJECT (options->feather_radius_w), "value_changed",
|
|
|
|
G_CALLBACK (gimp_double_adjustment_update),
|
|
|
|
&options->feather_radius);
|
2001-01-22 12:17:17 +08:00
|
|
|
|
|
|
|
/* grey out label & scale if feather is off */
|
|
|
|
gtk_widget_set_sensitive (scale, options->feather_d);
|
|
|
|
gtk_widget_set_sensitive (label, options->feather_d);
|
2001-07-25 08:27:41 +08:00
|
|
|
g_object_set_data (G_OBJECT (options->feather_w), "set_sensitive", scale);
|
|
|
|
g_object_set_data (G_OBJECT (scale), "set_sensitive", label);
|
2001-01-22 12:17:17 +08:00
|
|
|
|
|
|
|
gtk_widget_show (table);
|
|
|
|
|
|
|
|
/* the antialias toggle button */
|
2001-02-24 05:32:47 +08:00
|
|
|
if (tool_type != GIMP_TYPE_RECT_SELECT_TOOL)
|
2001-01-22 12:17:17 +08:00
|
|
|
{
|
|
|
|
options->antialias_w = gtk_check_button_new_with_label (_("Antialiasing"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->antialias_w),
|
|
|
|
options->antialias_d);
|
2001-11-09 03:14:51 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), options->antialias_w, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (options->antialias_w);
|
|
|
|
|
2001-08-01 10:57:58 +08:00
|
|
|
g_signal_connect (G_OBJECT (options->antialias_w), "toggled",
|
|
|
|
G_CALLBACK (gimp_toggle_button_update),
|
|
|
|
&options->antialias);
|
2001-01-22 12:17:17 +08:00
|
|
|
}
|
|
|
|
|
2001-11-10 22:17:01 +08:00
|
|
|
#if 0
|
2001-01-22 12:17:17 +08:00
|
|
|
/* a separator between the common and tool-specific selection options */
|
2001-02-24 05:32:47 +08:00
|
|
|
if (tool_type == GIMP_TYPE_ISCISSORS_TOOL ||
|
|
|
|
tool_type == GIMP_TYPE_RECT_SELECT_TOOL ||
|
|
|
|
tool_type == GIMP_TYPE_ELLIPSE_SELECT_TOOL ||
|
|
|
|
tool_type == GIMP_TYPE_FUZZY_SELECT_TOOL ||
|
|
|
|
tool_type == GIMP_TYPE_BY_COLOR_SELECT_TOOL)
|
2001-01-22 12:17:17 +08:00
|
|
|
{
|
2001-11-10 22:17:01 +08:00
|
|
|
GtkWidget *separator;
|
|
|
|
|
2001-01-22 12:17:17 +08:00
|
|
|
separator = gtk_hseparator_new ();
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (separator);
|
|
|
|
}
|
2001-11-10 22:17:01 +08:00
|
|
|
#endif
|
2001-01-22 12:17:17 +08:00
|
|
|
|
|
|
|
/* selection tool with an interactive boundary that can be toggled */
|
2001-02-24 05:32:47 +08:00
|
|
|
if (tool_type == GIMP_TYPE_ISCISSORS_TOOL)
|
2001-01-22 12:17:17 +08:00
|
|
|
{
|
|
|
|
options->interactive_w =
|
|
|
|
gtk_check_button_new_with_label (_("Show Interactive Boundary"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->interactive_w),
|
|
|
|
options->interactive_d);
|
2001-11-09 03:14:51 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), options->interactive_w,
|
|
|
|
FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (options->interactive_w);
|
|
|
|
|
2001-08-01 10:57:58 +08:00
|
|
|
g_signal_connect (G_OBJECT (options->interactive_w), "toggled",
|
|
|
|
G_CALLBACK (gimp_toggle_button_update),
|
|
|
|
&options->interactive);
|
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 */
|
|
|
|
if (tool_type == GIMP_TYPE_FUZZY_SELECT_TOOL ||
|
|
|
|
tool_type == GIMP_TYPE_BY_COLOR_SELECT_TOOL)
|
2001-01-22 12:17:17 +08:00
|
|
|
{
|
|
|
|
GtkWidget *hbox;
|
|
|
|
|
|
|
|
/* the sample merged toggle */
|
|
|
|
options->sample_merged_w =
|
|
|
|
gtk_check_button_new_with_label (_("Sample Merged"));
|
2001-11-09 03:14:51 +08:00
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->sample_merged_w),
|
|
|
|
options->sample_merged_d);
|
2001-01-22 12:17:17 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), options->sample_merged_w,
|
|
|
|
FALSE, FALSE, 0);
|
2001-11-09 03:14:51 +08:00
|
|
|
gtk_widget_show (options->sample_merged_w);
|
|
|
|
|
2001-08-01 10:57:58 +08:00
|
|
|
g_signal_connect (G_OBJECT (options->sample_merged_w), "toggled",
|
|
|
|
G_CALLBACK (gimp_toggle_button_update),
|
|
|
|
&options->sample_merged);
|
2001-01-22 12:17:17 +08:00
|
|
|
|
|
|
|
/* the threshold scale */
|
|
|
|
hbox = gtk_hbox_new (FALSE, 1);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (hbox);
|
|
|
|
|
|
|
|
label = gtk_label_new (_("Threshold:"));
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 1.0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 1);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
options->threshold_w =
|
2001-06-04 04:40:50 +08:00
|
|
|
gtk_adjustment_new (gimprc.default_threshold, 0.0, 255.0, 1.0, 1.0, 0.0);
|
2001-01-22 12:17:17 +08:00
|
|
|
scale = gtk_hscale_new (GTK_ADJUSTMENT (options->threshold_w));
|
|
|
|
gtk_scale_set_value_pos (GTK_SCALE (scale), GTK_POS_TOP);
|
|
|
|
gtk_range_set_update_policy (GTK_RANGE (scale), GTK_UPDATE_DELAYED);
|
2001-11-09 03:14:51 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), scale, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (scale);
|
|
|
|
|
2001-08-01 10:57:58 +08:00
|
|
|
g_signal_connect (G_OBJECT (options->threshold_w), "value_changed",
|
|
|
|
G_CALLBACK (gimp_double_adjustment_update),
|
|
|
|
&options->threshold);
|
2001-01-22 12:17:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* widgets for fixed size select */
|
2001-02-24 05:32:47 +08:00
|
|
|
if (tool_type == GIMP_TYPE_RECT_SELECT_TOOL ||
|
|
|
|
tool_type == GIMP_TYPE_ELLIPSE_SELECT_TOOL)
|
2001-01-22 12:17:17 +08:00
|
|
|
{
|
2001-11-10 22:17:01 +08:00
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *vbox2;
|
2001-01-22 12:17:17 +08:00
|
|
|
GtkWidget *alignment;
|
|
|
|
GtkWidget *table;
|
|
|
|
GtkWidget *width_spinbutton;
|
|
|
|
GtkWidget *height_spinbutton;
|
|
|
|
|
2001-11-10 22:17:01 +08:00
|
|
|
frame = gtk_frame_new (NULL);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
|
|
|
vbox2 = gtk_vbox_new (FALSE, 0);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (vbox2), 2);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), vbox2);
|
|
|
|
gtk_widget_show (vbox2);
|
|
|
|
|
|
|
|
options->auto_shrink_w =
|
|
|
|
gtk_check_button_new_with_label (_("Auto Shrink Selection"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->auto_shrink_w),
|
|
|
|
options->auto_shrink_d);
|
|
|
|
gtk_frame_set_label_widget (GTK_FRAME (frame), options->auto_shrink_w);
|
|
|
|
gtk_widget_show (options->auto_shrink_w);
|
|
|
|
|
|
|
|
g_signal_connect (G_OBJECT (options->auto_shrink_w), "toggled",
|
|
|
|
G_CALLBACK (gimp_toggle_button_update),
|
|
|
|
&options->auto_shrink);
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive (vbox2, options->auto_shrink);
|
|
|
|
g_object_set_data (G_OBJECT (options->auto_shrink_w), "set_sensitive",
|
|
|
|
vbox2);
|
|
|
|
|
|
|
|
options->shrink_merged_w =
|
|
|
|
gtk_check_button_new_with_label (_("Sample Merged"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->shrink_merged_w),
|
|
|
|
options->shrink_merged_d);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox2), options->shrink_merged_w,
|
|
|
|
FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (options->shrink_merged_w);
|
|
|
|
|
|
|
|
g_signal_connect (G_OBJECT (options->shrink_merged_w), "toggled",
|
|
|
|
G_CALLBACK (gimp_toggle_button_update),
|
|
|
|
&options->shrink_merged);
|
|
|
|
|
|
|
|
frame = gtk_frame_new (NULL);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
|
|
|
alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (alignment), 2);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), alignment);
|
|
|
|
gtk_widget_show (alignment);
|
|
|
|
|
2001-01-22 12:17:17 +08:00
|
|
|
options->fixed_size_w =
|
|
|
|
gtk_check_button_new_with_label (_("Fixed Size / Aspect Ratio"));
|
2001-11-09 03:14:51 +08:00
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->fixed_size_w),
|
|
|
|
options->fixed_size_d);
|
2001-11-10 22:17:01 +08:00
|
|
|
gtk_frame_set_label_widget (GTK_FRAME (frame), options->fixed_size_w);
|
2001-11-09 03:14:51 +08:00
|
|
|
gtk_widget_show (options->fixed_size_w);
|
|
|
|
|
2001-08-01 10:57:58 +08:00
|
|
|
g_signal_connect (G_OBJECT (options->fixed_size_w), "toggled",
|
|
|
|
G_CALLBACK (gimp_toggle_button_update),
|
|
|
|
&options->fixed_size);
|
2001-01-22 12:17:17 +08:00
|
|
|
|
2001-11-10 22:17:01 +08:00
|
|
|
gtk_widget_set_sensitive (alignment, options->fixed_size_d);
|
|
|
|
g_object_set_data (G_OBJECT (options->fixed_size_w), "set_sensitive",
|
|
|
|
alignment);
|
2001-01-22 12:17:17 +08:00
|
|
|
|
|
|
|
table = gtk_table_new (3, 2, FALSE);
|
|
|
|
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
|
|
|
gtk_table_set_row_spacings (GTK_TABLE (table), 1);
|
|
|
|
gtk_container_add (GTK_CONTAINER (alignment), table);
|
|
|
|
|
|
|
|
options->fixed_width_w =
|
|
|
|
gtk_adjustment_new (options->fixed_width_d, 1e-5, 32767.0,
|
|
|
|
1.0, 50.0, 0.0);
|
|
|
|
width_spinbutton =
|
|
|
|
gtk_spin_button_new (GTK_ADJUSTMENT (options->fixed_width_w), 1.0, 0.0);
|
|
|
|
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (width_spinbutton), TRUE);
|
|
|
|
gtk_widget_set_usize (width_spinbutton, 75, 0);
|
|
|
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
|
|
|
|
_("Width:"), 1.0, 0.5,
|
|
|
|
width_spinbutton, 1, FALSE);
|
|
|
|
|
2001-11-09 03:14:51 +08:00
|
|
|
g_signal_connect (G_OBJECT (options->fixed_width_w), "value_changed",
|
|
|
|
G_CALLBACK (gimp_double_adjustment_update),
|
|
|
|
&options->fixed_width);
|
|
|
|
|
2001-01-22 12:17:17 +08:00
|
|
|
options->fixed_height_w =
|
|
|
|
gtk_adjustment_new (options->fixed_height_d, 1e-5, 32767.0,
|
|
|
|
1.0, 50.0, 0.0);
|
|
|
|
height_spinbutton =
|
|
|
|
gtk_spin_button_new (GTK_ADJUSTMENT (options->fixed_height_w), 1.0, 0.0);
|
|
|
|
gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(height_spinbutton), TRUE);
|
|
|
|
gtk_widget_set_usize (height_spinbutton, 75, 0);
|
|
|
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
|
|
|
|
_("Height:"), 1.0, 0.5,
|
|
|
|
height_spinbutton, 1, FALSE);
|
|
|
|
|
2001-11-09 03:14:51 +08:00
|
|
|
g_signal_connect (G_OBJECT (options->fixed_height_w), "value_changed",
|
|
|
|
G_CALLBACK (gimp_double_adjustment_update),
|
|
|
|
&options->fixed_height);
|
|
|
|
|
2001-01-22 12:17:17 +08:00
|
|
|
options->fixed_unit_w =
|
|
|
|
gimp_unit_menu_new ("%a", options->fixed_unit_d, TRUE, TRUE, TRUE);
|
2001-07-25 08:27:41 +08:00
|
|
|
g_object_set_data (G_OBJECT (options->fixed_unit_w), "set_digits",
|
2001-01-22 12:17:17 +08:00
|
|
|
width_spinbutton);
|
2001-07-25 08:27:41 +08:00
|
|
|
g_object_set_data (G_OBJECT (width_spinbutton), "set_digits",
|
2001-01-22 12:17:17 +08:00
|
|
|
height_spinbutton);
|
|
|
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, 2,
|
|
|
|
_("Unit:"), 1.0, 0.5,
|
|
|
|
options->fixed_unit_w, 1, FALSE);
|
|
|
|
|
2001-11-09 03:14:51 +08:00
|
|
|
g_signal_connect (G_OBJECT (options->fixed_unit_w), "unit_changed",
|
|
|
|
G_CALLBACK (gimp_unit_menu_update),
|
|
|
|
&options->fixed_unit);
|
|
|
|
|
2001-01-22 12:17:17 +08:00
|
|
|
gtk_widget_show (table);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SelectionOptions *
|
2001-08-14 22:53:55 +08:00
|
|
|
selection_options_new (GType tool_type,
|
2001-01-22 12:17:17 +08:00
|
|
|
ToolOptionsResetFunc reset_func)
|
|
|
|
{
|
|
|
|
SelectionOptions *options;
|
|
|
|
|
|
|
|
options = g_new (SelectionOptions, 1);
|
|
|
|
selection_options_init (options, tool_type, reset_func);
|
|
|
|
|
|
|
|
return options;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2001-07-18 04:50:01 +08:00
|
|
|
selection_options_reset (GimpToolOptions *tool_options)
|
2001-01-22 12:17:17 +08:00
|
|
|
{
|
2001-04-01 04:41:39 +08:00
|
|
|
SelectionOptions *options;
|
|
|
|
|
|
|
|
options = (SelectionOptions *) tool_options;
|
|
|
|
|
2001-01-22 12:17:17 +08:00
|
|
|
if (options->feather_w)
|
|
|
|
{
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->feather_w),
|
|
|
|
options->feather_d);
|
|
|
|
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->feather_radius_w),
|
|
|
|
options->feather_radius_d);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (options->antialias_w)
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->antialias_w),
|
|
|
|
options->antialias_d);
|
|
|
|
|
|
|
|
if (options->sample_merged_w)
|
|
|
|
{
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->sample_merged_w),
|
|
|
|
options->sample_merged_d);
|
|
|
|
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->threshold_w),
|
2001-06-04 04:40:50 +08:00
|
|
|
gimprc.default_threshold);
|
2001-01-22 12:17:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (options->fixed_size_w)
|
|
|
|
{
|
|
|
|
GtkWidget *spinbutton;
|
|
|
|
gint digits;
|
|
|
|
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(options->fixed_size_w),
|
|
|
|
options->fixed_size_d);
|
|
|
|
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->fixed_width_w),
|
|
|
|
options->fixed_width_d);
|
|
|
|
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->fixed_height_w),
|
|
|
|
options->fixed_height_d);
|
|
|
|
|
|
|
|
options->fixed_unit = options->fixed_unit_d;
|
|
|
|
gimp_unit_menu_set_unit (GIMP_UNIT_MENU (options->fixed_unit_w),
|
|
|
|
options->fixed_unit_d);
|
|
|
|
|
|
|
|
digits =
|
|
|
|
((options->fixed_unit_d == GIMP_UNIT_PIXEL) ? 0 :
|
|
|
|
((options->fixed_unit_d == GIMP_UNIT_PERCENT) ? 2 :
|
|
|
|
(MIN (6, MAX (3, gimp_unit_get_digits (options->fixed_unit_d))))));
|
|
|
|
|
|
|
|
spinbutton =
|
2001-07-25 08:27:41 +08:00
|
|
|
g_object_get_data (G_OBJECT (options->fixed_unit_w), "set_digits");
|
2001-01-22 12:17:17 +08:00
|
|
|
while (spinbutton)
|
|
|
|
{
|
|
|
|
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (spinbutton), digits);
|
|
|
|
spinbutton =
|
2001-07-25 08:27:41 +08:00
|
|
|
g_object_get_data (G_OBJECT (spinbutton), "set_digits");
|
2001-01-22 12:17:17 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (options->interactive_w)
|
|
|
|
{
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->interactive_w),
|
|
|
|
options->interactive_d);
|
|
|
|
}
|
|
|
|
}
|