1999-04-13 01:55:06 +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.
|
|
|
|
*/
|
1999-06-07 03:44:36 +08:00
|
|
|
#include "config.h"
|
2000-01-14 20:41:00 +08:00
|
|
|
|
1999-04-22 22:34:00 +08:00
|
|
|
#include "brush_select.h"
|
|
|
|
#include "gimprc.h"
|
1999-10-27 02:27:27 +08:00
|
|
|
#include "gimpui.h"
|
1999-04-22 22:34:00 +08:00
|
|
|
#include "paint_funcs.h"
|
|
|
|
#include "paint_options.h"
|
1999-04-13 01:55:06 +08:00
|
|
|
#include "selection_options.h"
|
|
|
|
|
|
|
|
#include "libgimp/gimpunitmenu.h"
|
1999-04-22 22:34:00 +08:00
|
|
|
#include "libgimp/gimpintl.h"
|
|
|
|
|
|
|
|
|
2000-01-10 01:31:00 +08:00
|
|
|
/* declared extern in paint_options.h */
|
|
|
|
PaintPressureOptions non_gui_pressure_options =
|
|
|
|
{
|
|
|
|
NULL,
|
|
|
|
FALSE, FALSE, NULL,
|
|
|
|
FALSE, FALSE, NULL,
|
|
|
|
FALSE, FALSE, NULL,
|
|
|
|
FALSE, FALSE, NULL,
|
|
|
|
FALSE, FALSE, NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
|
1999-04-22 22:34:00 +08:00
|
|
|
/* a list of all PaintOptions */
|
|
|
|
static GSList *paint_options_list = NULL;
|
1999-04-13 01:55:06 +08:00
|
|
|
|
1999-09-09 09:47:54 +08:00
|
|
|
static PaintPressureOptions * paint_pressure_options_new (ToolType);
|
|
|
|
static void paint_pressure_options_reset (PaintPressureOptions *);
|
|
|
|
|
1999-04-13 01:55:06 +08:00
|
|
|
|
1999-04-22 22:34:00 +08:00
|
|
|
/* ui helper functions ******************************************************/
|
1999-04-13 01:55:06 +08:00
|
|
|
|
2000-01-14 20:41:00 +08:00
|
|
|
static void
|
1999-04-22 22:34:00 +08:00
|
|
|
tool_options_opacity_adjustment_update (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
1999-07-06 23:18:25 +08:00
|
|
|
gimp_context_set_opacity (GIMP_CONTEXT (data),
|
|
|
|
GTK_ADJUSTMENT (widget)->value / 100);
|
|
|
|
}
|
1999-04-22 22:34:00 +08:00
|
|
|
|
1999-07-06 23:18:25 +08:00
|
|
|
static void
|
|
|
|
tool_options_paint_mode_update (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GimpContext *context;
|
|
|
|
|
|
|
|
context = (GimpContext *) gtk_object_get_user_data (GTK_OBJECT (widget));
|
|
|
|
|
|
|
|
gimp_context_set_paint_mode (GIMP_CONTEXT (context),
|
1999-10-19 23:52:32 +08:00
|
|
|
(LayerModeEffects) data);
|
1999-04-22 22:34:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* tool options functions ***************************************************/
|
1999-04-13 01:55:06 +08:00
|
|
|
|
|
|
|
void
|
|
|
|
tool_options_init (ToolOptions *options,
|
|
|
|
gchar *title,
|
|
|
|
ToolOptionsResetFunc reset_func)
|
|
|
|
{
|
|
|
|
options->main_vbox = gtk_vbox_new (FALSE, 2);
|
1999-08-20 03:53:30 +08:00
|
|
|
options->title = title;
|
1999-04-13 01:55:06 +08:00
|
|
|
options->reset_func = reset_func;
|
|
|
|
}
|
|
|
|
|
|
|
|
ToolOptions *
|
|
|
|
tool_options_new (gchar *title)
|
|
|
|
{
|
|
|
|
ToolOptions *options;
|
|
|
|
|
|
|
|
GtkWidget *label;
|
|
|
|
|
1999-07-06 23:18:25 +08:00
|
|
|
options = g_new (ToolOptions, 1);
|
1999-04-13 01:55:06 +08:00
|
|
|
tool_options_init (options, title, NULL);
|
|
|
|
|
|
|
|
label = gtk_label_new (_("This tool has no options."));
|
|
|
|
gtk_box_pack_start (GTK_BOX (options->main_vbox), label, FALSE, FALSE, 6);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
return options;
|
|
|
|
}
|
|
|
|
|
1999-04-22 22:34:00 +08:00
|
|
|
/* selection tool options functions *****************************************/
|
1999-04-13 01:55:06 +08:00
|
|
|
|
|
|
|
void
|
|
|
|
selection_options_init (SelectionOptions *options,
|
|
|
|
ToolType tool_type,
|
|
|
|
ToolOptionsResetFunc reset_func)
|
|
|
|
{
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *abox;
|
|
|
|
GtkWidget *table;
|
|
|
|
GtkWidget *label;
|
|
|
|
GtkWidget *scale;
|
|
|
|
GtkWidget *separator;
|
|
|
|
|
|
|
|
/* initialize the tool options structure */
|
|
|
|
tool_options_init ((ToolOptions *) options,
|
|
|
|
((tool_type == RECT_SELECT) ?
|
1999-07-06 23:18:25 +08:00
|
|
|
_("Rectangular Select Options") :
|
1999-04-13 01:55:06 +08:00
|
|
|
((tool_type == ELLIPSE_SELECT) ?
|
1999-07-06 23:18:25 +08:00
|
|
|
_("Elliptical Selection Options") :
|
1999-04-13 01:55:06 +08:00
|
|
|
((tool_type == FREE_SELECT) ?
|
1999-07-06 23:18:25 +08:00
|
|
|
_("Free-hand Selection Options") :
|
1999-04-13 01:55:06 +08:00
|
|
|
((tool_type == FUZZY_SELECT) ?
|
1999-07-06 23:18:25 +08:00
|
|
|
_("Fuzzy Selection Options") :
|
1999-04-13 01:55:06 +08:00
|
|
|
((tool_type == BEZIER_SELECT) ?
|
1999-07-06 23:18:25 +08:00
|
|
|
_("Bezier Selection Options") :
|
1999-04-13 01:55:06 +08:00
|
|
|
((tool_type == ISCISSORS) ?
|
1999-07-06 23:18:25 +08:00
|
|
|
_("Intelligent Scissors Options") :
|
1999-04-13 01:55:06 +08:00
|
|
|
((tool_type == BY_COLOR_SELECT) ?
|
1999-07-06 23:18:25 +08:00
|
|
|
_("By-Color Select Options") :
|
1999-11-25 19:35:48 +08:00
|
|
|
"ERROR: Unknown Selection Type"))))))),
|
1999-04-13 01:55:06 +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;
|
|
|
|
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 = UNIT_PIXEL;
|
|
|
|
|
|
|
|
options->feather_w = NULL;
|
|
|
|
options->feather_radius_w = NULL;
|
|
|
|
options->antialias_w = NULL;
|
|
|
|
options->sample_merged_w = NULL;
|
|
|
|
options->fixed_size_w = NULL;
|
|
|
|
options->fixed_height_w = NULL;
|
|
|
|
options->fixed_width_w = NULL;
|
|
|
|
options->fixed_unit_w = NULL;
|
|
|
|
|
|
|
|
/* the feather toggle button */
|
|
|
|
table = gtk_table_new (2, 2, FALSE);
|
1999-04-22 22:34:00 +08:00
|
|
|
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
1999-04-13 01:55:06 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
options->feather_w = gtk_check_button_new_with_label (_("Feather"));
|
|
|
|
gtk_table_attach (GTK_TABLE (table), options->feather_w, 0, 1, 0, 1,
|
|
|
|
GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->feather_w),
|
|
|
|
options->feather_d);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (options->feather_w), "toggled",
|
2000-01-14 20:41:00 +08:00
|
|
|
GTK_SIGNAL_FUNC (gimp_toggle_button_update),
|
1999-04-13 01:55:06 +08:00
|
|
|
&options->feather);
|
|
|
|
gtk_widget_show (options->feather_w);
|
|
|
|
|
|
|
|
/* 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 =
|
1999-11-24 03:11:29 +08:00
|
|
|
gtk_adjustment_new (options->feather_radius_d, 0.0, 100.0, 1.0, 1.0, 1.0);
|
1999-04-13 01:55:06 +08:00
|
|
|
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);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (options->feather_radius_w), "value_changed",
|
2000-01-14 20:41:00 +08:00
|
|
|
GTK_SIGNAL_FUNC (gimp_double_adjustment_update),
|
1999-04-13 01:55:06 +08:00
|
|
|
&options->feather_radius);
|
|
|
|
gtk_widget_show (scale);
|
|
|
|
|
|
|
|
/* grey out label & scale if feather is off */
|
|
|
|
gtk_widget_set_sensitive (scale, options->feather_d);
|
|
|
|
gtk_widget_set_sensitive (label, options->feather_d);
|
|
|
|
gtk_object_set_data (GTK_OBJECT (options->feather_w), "set_sensitive", scale);
|
|
|
|
gtk_object_set_data (GTK_OBJECT (scale), "set_sensitive", label);
|
|
|
|
|
|
|
|
gtk_widget_show (table);
|
|
|
|
|
|
|
|
/* the antialias toggle button */
|
|
|
|
if (tool_type != RECT_SELECT)
|
|
|
|
{
|
|
|
|
options->antialias_w = gtk_check_button_new_with_label (_("Antialiasing"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), options->antialias_w, FALSE, FALSE, 0);
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->antialias_w),
|
|
|
|
options->antialias_d);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (options->antialias_w), "toggled",
|
2000-01-14 20:41:00 +08:00
|
|
|
GTK_SIGNAL_FUNC (gimp_toggle_button_update),
|
1999-04-13 01:55:06 +08:00
|
|
|
&options->antialias);
|
|
|
|
gtk_widget_show (options->antialias_w);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* a separator between the common and tool-specific selection options */
|
|
|
|
switch (tool_type)
|
|
|
|
{
|
|
|
|
case FREE_SELECT:
|
|
|
|
case BEZIER_SELECT:
|
1999-10-06 02:05:34 +08:00
|
|
|
case ISCISSORS:
|
1999-04-13 01:55:06 +08:00
|
|
|
break;
|
|
|
|
case RECT_SELECT:
|
|
|
|
case ELLIPSE_SELECT:
|
|
|
|
case FUZZY_SELECT:
|
|
|
|
case BY_COLOR_SELECT:
|
|
|
|
separator = gtk_hseparator_new ();
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (separator);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* the sample merged option */
|
|
|
|
switch (tool_type)
|
|
|
|
{
|
|
|
|
case RECT_SELECT:
|
|
|
|
case ELLIPSE_SELECT:
|
|
|
|
case FREE_SELECT:
|
|
|
|
case BEZIER_SELECT:
|
|
|
|
case ISCISSORS:
|
|
|
|
break;
|
|
|
|
case FUZZY_SELECT:
|
|
|
|
case BY_COLOR_SELECT:
|
|
|
|
options->sample_merged_w =
|
|
|
|
gtk_check_button_new_with_label (_("Sample Merged"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), options->sample_merged_w,
|
|
|
|
FALSE, FALSE, 0);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (options->sample_merged_w), "toggled",
|
2000-01-14 20:41:00 +08:00
|
|
|
GTK_SIGNAL_FUNC (gimp_toggle_button_update),
|
1999-04-13 01:55:06 +08:00
|
|
|
&options->sample_merged);
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->sample_merged_w),
|
|
|
|
options->sample_merged_d);
|
|
|
|
gtk_widget_show (options->sample_merged_w);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* widgets for fixed size select */
|
1999-11-24 03:11:29 +08:00
|
|
|
if (tool_type == RECT_SELECT || tool_type == ELLIPSE_SELECT)
|
1999-04-13 01:55:06 +08:00
|
|
|
{
|
|
|
|
GtkWidget *alignment;
|
|
|
|
GtkWidget *table;
|
|
|
|
GtkWidget *width_spinbutton;
|
|
|
|
GtkWidget *height_spinbutton;
|
|
|
|
|
|
|
|
options->fixed_size_w =
|
1999-12-14 22:10:34 +08:00
|
|
|
gtk_check_button_new_with_label (_("Fixed Size / Aspect Ratio"));
|
1999-04-13 01:55:06 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), options->fixed_size_w,
|
|
|
|
FALSE, FALSE, 0);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (options->fixed_size_w), "toggled",
|
2000-01-14 20:41:00 +08:00
|
|
|
GTK_SIGNAL_FUNC (gimp_toggle_button_update),
|
1999-04-13 01:55:06 +08:00
|
|
|
&options->fixed_size);
|
1999-11-24 03:11:29 +08:00
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->fixed_size_w),
|
|
|
|
options->fixed_size_d);
|
|
|
|
gtk_widget_show (options->fixed_size_w);
|
1999-04-13 01:55:06 +08:00
|
|
|
|
|
|
|
alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), alignment, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (alignment);
|
|
|
|
|
|
|
|
table = gtk_table_new (3, 2, FALSE);
|
1999-04-22 22:34:00 +08:00
|
|
|
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
1999-04-13 01:55:06 +08:00
|
|
|
gtk_table_set_row_spacings (GTK_TABLE (table), 1);
|
|
|
|
gtk_container_add (GTK_CONTAINER (alignment), table);
|
|
|
|
|
|
|
|
/* grey out the table if fixed size is off */
|
|
|
|
gtk_widget_set_sensitive (table, options->fixed_size_d);
|
|
|
|
gtk_object_set_data (GTK_OBJECT (options->fixed_size_w), "set_sensitive",
|
|
|
|
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_shadow_type (GTK_SPIN_BUTTON(width_spinbutton),
|
|
|
|
GTK_SHADOW_NONE);
|
|
|
|
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (width_spinbutton), TRUE);
|
|
|
|
gtk_widget_set_usize (width_spinbutton, 75, 0);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (options->fixed_width_w), "value_changed",
|
2000-01-14 20:41:00 +08:00
|
|
|
GTK_SIGNAL_FUNC (gimp_double_adjustment_update),
|
1999-04-13 01:55:06 +08:00
|
|
|
&options->fixed_width);
|
2000-01-31 11:13:02 +08:00
|
|
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
|
1999-10-27 02:27:27 +08:00
|
|
|
_("Width:"), 1.0, 0.5,
|
2000-01-31 11:13:02 +08:00
|
|
|
width_spinbutton, 1, FALSE);
|
1999-04-13 01:55:06 +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_shadow_type (GTK_SPIN_BUTTON(height_spinbutton),
|
|
|
|
GTK_SHADOW_NONE);
|
|
|
|
gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(height_spinbutton), TRUE);
|
|
|
|
gtk_widget_set_usize (height_spinbutton, 75, 0);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (options->fixed_height_w), "value_changed",
|
2000-01-14 20:41:00 +08:00
|
|
|
GTK_SIGNAL_FUNC (gimp_double_adjustment_update),
|
1999-04-13 01:55:06 +08:00
|
|
|
&options->fixed_height);
|
2000-01-31 11:13:02 +08:00
|
|
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
|
1999-10-27 02:27:27 +08:00
|
|
|
_("Height:"), 1.0, 0.5,
|
2000-01-31 11:13:02 +08:00
|
|
|
height_spinbutton, 1, FALSE);
|
1999-10-27 02:27:27 +08:00
|
|
|
|
1999-04-13 01:55:06 +08:00
|
|
|
options->fixed_unit_w =
|
|
|
|
gimp_unit_menu_new ("%a", options->fixed_unit_d, TRUE, TRUE, TRUE);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (options->fixed_unit_w), "unit_changed",
|
2000-01-14 20:41:00 +08:00
|
|
|
GTK_SIGNAL_FUNC (gimp_unit_menu_update),
|
1999-04-13 01:55:06 +08:00
|
|
|
&options->fixed_unit);
|
|
|
|
gtk_object_set_data (GTK_OBJECT (options->fixed_unit_w), "set_digits",
|
|
|
|
width_spinbutton);
|
|
|
|
gtk_object_set_data (GTK_OBJECT (width_spinbutton), "set_digits",
|
|
|
|
height_spinbutton);
|
2000-01-31 11:13:02 +08:00
|
|
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, 2,
|
1999-10-27 02:27:27 +08:00
|
|
|
_("Unit:"), 1.0, 0.5,
|
2000-01-31 11:13:02 +08:00
|
|
|
options->fixed_unit_w, 1, FALSE);
|
1999-04-13 01:55:06 +08:00
|
|
|
|
|
|
|
gtk_widget_show (table);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SelectionOptions *
|
|
|
|
selection_options_new (ToolType tool_type,
|
|
|
|
ToolOptionsResetFunc reset_func)
|
|
|
|
{
|
|
|
|
SelectionOptions *options;
|
|
|
|
|
1999-07-06 23:18:25 +08:00
|
|
|
options = g_new (SelectionOptions, 1);
|
1999-04-13 01:55:06 +08:00
|
|
|
selection_options_init (options, tool_type, reset_func);
|
|
|
|
|
|
|
|
return options;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
selection_options_reset (SelectionOptions *options)
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
if (options->fixed_size_w)
|
|
|
|
{
|
|
|
|
GtkWidget *spinbutton;
|
1999-11-24 03:11:29 +08:00
|
|
|
gint digits;
|
1999-04-13 01:55:06 +08:00
|
|
|
|
|
|
|
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 == UNIT_PIXEL) ? 0 :
|
|
|
|
((options->fixed_unit_d == UNIT_PERCENT) ? 2 :
|
|
|
|
(MIN (6, MAX (3, gimp_unit_get_digits (options->fixed_unit_d))))));
|
|
|
|
|
|
|
|
spinbutton =
|
|
|
|
gtk_object_get_data (GTK_OBJECT (options->fixed_unit_w), "set_digits");
|
|
|
|
while (spinbutton)
|
|
|
|
{
|
|
|
|
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (spinbutton), digits);
|
|
|
|
spinbutton =
|
|
|
|
gtk_object_get_data (GTK_OBJECT (spinbutton), "set_digits");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1999-04-22 22:34:00 +08:00
|
|
|
|
|
|
|
|
|
|
|
/* paint tool options functions *********************************************/
|
|
|
|
|
|
|
|
void
|
|
|
|
paint_options_init (PaintOptions *options,
|
|
|
|
ToolType tool_type,
|
|
|
|
ToolOptionsResetFunc reset_func)
|
|
|
|
{
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *table;
|
|
|
|
GtkWidget *scale;
|
|
|
|
GtkWidget *menu;
|
|
|
|
GtkWidget *separator;
|
|
|
|
|
1999-07-06 23:18:25 +08:00
|
|
|
GimpContext *tool_context = tool_info[tool_type].tool_context;
|
|
|
|
|
1999-04-22 22:34:00 +08:00
|
|
|
/* initialize the tool options structure */
|
|
|
|
tool_options_init ((ToolOptions *) options,
|
|
|
|
((tool_type == BUCKET_FILL) ?
|
1999-07-06 23:18:25 +08:00
|
|
|
_("Bucket Fill Options") :
|
1999-04-22 22:34:00 +08:00
|
|
|
((tool_type == BLEND) ?
|
1999-07-06 23:18:25 +08:00
|
|
|
_("Blend Options") :
|
1999-04-22 22:34:00 +08:00
|
|
|
((tool_type == PENCIL) ?
|
1999-07-06 23:18:25 +08:00
|
|
|
_("Pencil Options") :
|
1999-04-22 22:34:00 +08:00
|
|
|
((tool_type == PAINTBRUSH) ?
|
1999-07-06 23:18:25 +08:00
|
|
|
_("Paintbrush Options") :
|
1999-04-22 22:34:00 +08:00
|
|
|
((tool_type == ERASER) ?
|
1999-10-04 10:00:33 +08:00
|
|
|
_("Eraser Options") :
|
1999-04-22 22:34:00 +08:00
|
|
|
((tool_type == AIRBRUSH) ?
|
1999-07-06 23:18:25 +08:00
|
|
|
_("Airbrush Options") :
|
1999-04-22 22:34:00 +08:00
|
|
|
((tool_type == CLONE) ?
|
1999-07-06 23:18:25 +08:00
|
|
|
_("Clone Tool Options") :
|
1999-04-22 22:34:00 +08:00
|
|
|
((tool_type == CONVOLVE) ?
|
1999-07-06 23:18:25 +08:00
|
|
|
_("Convolver Options") :
|
1999-04-22 22:34:00 +08:00
|
|
|
((tool_type == INK) ?
|
1999-07-06 23:18:25 +08:00
|
|
|
_("Ink Options") :
|
|
|
|
((tool_type == DODGEBURN) ?
|
|
|
|
_("Dodge or Burn Options") :
|
|
|
|
((tool_type == SMUDGE) ?
|
|
|
|
_("Smudge Options") :
|
1999-09-07 09:24:50 +08:00
|
|
|
((tool_type == XINPUT_AIRBRUSH) ?
|
|
|
|
_("Xinput Airbrush Options") :
|
1999-11-25 19:35:48 +08:00
|
|
|
"ERROR: Unknown Paint Type")))))))))))),
|
1999-04-22 22:34:00 +08:00
|
|
|
reset_func);
|
|
|
|
|
|
|
|
/* initialize the paint options structure */
|
1999-08-20 03:53:30 +08:00
|
|
|
options->global = NULL;
|
|
|
|
options->opacity_w = NULL;
|
|
|
|
options->paint_mode_w = NULL;
|
|
|
|
options->incremental_w = NULL;
|
1999-09-09 09:47:54 +08:00
|
|
|
options->incremental = options->incremental_d = FALSE;
|
|
|
|
|
|
|
|
options->pressure_options = paint_pressure_options_new (tool_type);
|
1999-04-22 22:34:00 +08:00
|
|
|
|
|
|
|
/* the main vbox */
|
|
|
|
vbox = gtk_vbox_new (FALSE, 2);
|
|
|
|
gtk_box_pack_start (GTK_BOX (options->tool_options.main_vbox), vbox,
|
|
|
|
FALSE, FALSE, 0);
|
|
|
|
options->paint_vbox = vbox;
|
|
|
|
|
|
|
|
/* the main table */
|
|
|
|
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, TRUE, TRUE, 0);
|
|
|
|
|
|
|
|
/* the opacity scale */
|
|
|
|
options->opacity_w =
|
1999-07-06 23:18:25 +08:00
|
|
|
gtk_adjustment_new (gimp_context_get_opacity (tool_context) * 100,
|
|
|
|
0.0, 100.0, 1.0, 1.0, 0.0);
|
1999-04-22 22:34:00 +08:00
|
|
|
scale = gtk_hscale_new (GTK_ADJUSTMENT (options->opacity_w));
|
|
|
|
gtk_scale_set_value_pos (GTK_SCALE (scale), GTK_POS_TOP);
|
|
|
|
gtk_range_set_update_policy (GTK_RANGE (scale), GTK_UPDATE_DELAYED);
|
1999-10-27 02:27:27 +08:00
|
|
|
gtk_signal_connect (GTK_OBJECT (options->opacity_w), "value_changed",
|
1999-11-24 03:11:29 +08:00
|
|
|
GTK_SIGNAL_FUNC (tool_options_opacity_adjustment_update),
|
1999-10-27 02:27:27 +08:00
|
|
|
tool_context);
|
2000-01-31 11:13:02 +08:00
|
|
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
|
1999-10-27 02:27:27 +08:00
|
|
|
_("Opacity:"), 1.0, 1.0,
|
2000-01-31 11:13:02 +08:00
|
|
|
scale, 1, FALSE);
|
1999-04-22 22:34:00 +08:00
|
|
|
|
|
|
|
/* the paint mode menu */
|
|
|
|
switch (tool_type)
|
|
|
|
{
|
|
|
|
case BUCKET_FILL:
|
|
|
|
case BLEND:
|
|
|
|
case PENCIL:
|
|
|
|
case PAINTBRUSH:
|
|
|
|
case AIRBRUSH:
|
|
|
|
case CLONE:
|
|
|
|
case INK:
|
1999-11-24 03:11:29 +08:00
|
|
|
case XINPUT_AIRBRUSH:
|
1999-04-22 22:34:00 +08:00
|
|
|
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 2);
|
|
|
|
|
|
|
|
options->paint_mode_w = gtk_option_menu_new ();
|
|
|
|
menu =
|
1999-07-06 23:18:25 +08:00
|
|
|
paint_mode_menu_new (tool_options_paint_mode_update, tool_context);
|
1999-04-22 22:34:00 +08:00
|
|
|
gtk_option_menu_set_menu (GTK_OPTION_MENU (options->paint_mode_w), menu);
|
1999-07-06 23:18:25 +08:00
|
|
|
gtk_option_menu_set_history (GTK_OPTION_MENU (options->paint_mode_w),
|
|
|
|
gimp_context_get_paint_mode (tool_context));
|
2000-01-31 11:13:02 +08:00
|
|
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
|
1999-10-27 02:27:27 +08:00
|
|
|
_("Mode:"), 1.0, 0.5,
|
2000-01-31 11:13:02 +08:00
|
|
|
options->paint_mode_w, 1, TRUE);
|
1999-10-27 02:27:27 +08:00
|
|
|
|
|
|
|
/* eek */
|
|
|
|
gtk_object_set_data (GTK_OBJECT (options->paint_mode_w), "tool_context",
|
|
|
|
tool_info[tool_type].tool_context);
|
1999-04-22 22:34:00 +08:00
|
|
|
break;
|
|
|
|
case CONVOLVE:
|
|
|
|
case ERASER:
|
1999-07-06 23:18:25 +08:00
|
|
|
case DODGEBURN:
|
|
|
|
case SMUDGE:
|
1999-04-22 22:34:00 +08:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* show the main table */
|
|
|
|
gtk_widget_show (table);
|
|
|
|
|
1999-08-20 03:53:30 +08:00
|
|
|
/* a separator after the common paint options which can be global */
|
|
|
|
switch (tool_type)
|
1999-04-22 22:34:00 +08:00
|
|
|
{
|
1999-08-20 03:53:30 +08:00
|
|
|
case BUCKET_FILL:
|
|
|
|
case BLEND:
|
|
|
|
case CLONE:
|
|
|
|
case CONVOLVE:
|
|
|
|
case INK:
|
|
|
|
case DODGEBURN:
|
|
|
|
case SMUDGE:
|
1999-11-24 03:11:29 +08:00
|
|
|
case XINPUT_AIRBRUSH:
|
1999-04-22 22:34:00 +08:00
|
|
|
separator = gtk_hseparator_new ();
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (separator);
|
1999-08-20 03:53:30 +08:00
|
|
|
break;
|
|
|
|
case AIRBRUSH:
|
|
|
|
case ERASER:
|
|
|
|
case PAINTBRUSH:
|
|
|
|
case PENCIL:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
1999-04-22 22:34:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (! global_paint_options)
|
|
|
|
gtk_widget_show (vbox);
|
|
|
|
|
1999-08-20 03:53:30 +08:00
|
|
|
/* the "incremental" toggle */
|
|
|
|
switch (tool_type)
|
|
|
|
{
|
|
|
|
case AIRBRUSH:
|
|
|
|
case ERASER:
|
|
|
|
case PAINTBRUSH:
|
|
|
|
case PENCIL:
|
|
|
|
options->incremental_w =
|
|
|
|
gtk_check_button_new_with_label (_("Incremental"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (options->tool_options.main_vbox),
|
|
|
|
options->incremental_w, FALSE, FALSE, 0);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (options->incremental_w), "toggled",
|
2000-01-14 20:41:00 +08:00
|
|
|
GTK_SIGNAL_FUNC (gimp_toggle_button_update),
|
1999-08-20 03:53:30 +08:00
|
|
|
&options->incremental);
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->incremental_w),
|
|
|
|
options->incremental_d);
|
|
|
|
gtk_widget_show (options->incremental_w);
|
|
|
|
|
|
|
|
case BUCKET_FILL:
|
|
|
|
case BLEND:
|
|
|
|
case CLONE:
|
|
|
|
case CONVOLVE:
|
|
|
|
case DODGEBURN:
|
|
|
|
case SMUDGE:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
1999-09-09 09:47:54 +08:00
|
|
|
options->pressure_options = paint_pressure_options_new (tool_type);
|
|
|
|
if (options->pressure_options->frame)
|
|
|
|
{
|
|
|
|
gtk_box_pack_start (GTK_BOX (options->tool_options.main_vbox),
|
|
|
|
options->pressure_options->frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (options->pressure_options->frame);
|
|
|
|
}
|
|
|
|
|
1999-04-22 22:34:00 +08:00
|
|
|
/* register this Paintoptions structure */
|
|
|
|
paint_options_list = g_slist_prepend (paint_options_list, options);
|
|
|
|
}
|
|
|
|
|
|
|
|
PaintOptions *
|
|
|
|
paint_options_new (ToolType tool_type,
|
|
|
|
ToolOptionsResetFunc reset_func)
|
|
|
|
{
|
|
|
|
PaintOptions *options;
|
|
|
|
|
1999-07-06 23:18:25 +08:00
|
|
|
options = g_new (PaintOptions, 1);
|
1999-04-22 22:34:00 +08:00
|
|
|
paint_options_init (options, tool_type, reset_func);
|
|
|
|
|
|
|
|
if (global_paint_options && options->global)
|
|
|
|
gtk_widget_show (options->global);
|
|
|
|
|
|
|
|
return options;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
paint_options_reset (PaintOptions *options)
|
|
|
|
{
|
1999-07-06 23:18:25 +08:00
|
|
|
GimpContext *default_context;
|
|
|
|
|
|
|
|
default_context = gimp_context_get_default ();
|
|
|
|
|
1999-04-22 22:34:00 +08:00
|
|
|
if (options->opacity_w)
|
|
|
|
{
|
|
|
|
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->opacity_w),
|
1999-07-06 23:18:25 +08:00
|
|
|
gimp_context_get_opacity (default_context) * 100);
|
1999-04-22 22:34:00 +08:00
|
|
|
}
|
|
|
|
if (options->paint_mode_w)
|
|
|
|
{
|
1999-07-06 23:18:25 +08:00
|
|
|
GimpContext *context;
|
|
|
|
|
|
|
|
context = (GimpContext *) gtk_object_get_data (GTK_OBJECT (options->paint_mode_w), "tool_context");
|
|
|
|
|
|
|
|
gimp_context_set_paint_mode (GIMP_CONTEXT (context),
|
|
|
|
gimp_context_get_paint_mode (default_context));
|
1999-04-22 22:34:00 +08:00
|
|
|
gtk_option_menu_set_history (GTK_OPTION_MENU (options->paint_mode_w),
|
1999-07-06 23:18:25 +08:00
|
|
|
gimp_context_get_paint_mode (default_context));
|
1999-04-22 22:34:00 +08:00
|
|
|
}
|
1999-08-20 03:53:30 +08:00
|
|
|
if (options->incremental_w)
|
|
|
|
{
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(options->incremental_w),
|
|
|
|
options->incremental_d);
|
|
|
|
}
|
1999-09-09 09:47:54 +08:00
|
|
|
|
|
|
|
paint_pressure_options_reset (options->pressure_options);
|
1999-04-22 22:34:00 +08:00
|
|
|
}
|
|
|
|
|
1999-09-09 09:47:54 +08:00
|
|
|
static PaintPressureOptions *
|
|
|
|
paint_pressure_options_new (ToolType tool_type)
|
|
|
|
{
|
|
|
|
PaintPressureOptions *pressure;
|
|
|
|
GtkWidget *frame = NULL;
|
|
|
|
GtkWidget *hbox = NULL;
|
|
|
|
|
|
|
|
pressure = g_new (PaintPressureOptions, 1);
|
|
|
|
|
1999-11-24 03:11:29 +08:00
|
|
|
pressure->opacity = pressure->opacity_d = TRUE;
|
1999-09-09 09:47:54 +08:00
|
|
|
pressure->pressure = pressure->pressure_d = TRUE;
|
1999-11-24 03:11:29 +08:00
|
|
|
pressure->rate = pressure->rate_d = FALSE;
|
|
|
|
pressure->size = pressure->size_d = FALSE;
|
|
|
|
pressure->color = pressure->color_d = FALSE;
|
|
|
|
|
|
|
|
pressure->opacity_w = NULL;
|
|
|
|
pressure->pressure_w = NULL;
|
|
|
|
pressure->rate_w = NULL;
|
|
|
|
pressure->size_w = NULL;
|
|
|
|
pressure->color_w = NULL;
|
1999-09-09 09:47:54 +08:00
|
|
|
|
|
|
|
switch (tool_type)
|
|
|
|
{
|
1999-11-13 09:02:27 +08:00
|
|
|
case AIRBRUSH:
|
1999-09-09 09:47:54 +08:00
|
|
|
case CLONE:
|
|
|
|
case CONVOLVE:
|
|
|
|
case DODGEBURN:
|
|
|
|
case ERASER:
|
|
|
|
case PAINTBRUSH:
|
|
|
|
case PENCIL:
|
1999-11-13 09:02:27 +08:00
|
|
|
case SMUDGE:
|
1999-12-14 22:10:34 +08:00
|
|
|
frame = gtk_frame_new (_("Pressure Sensitivity"));
|
1999-09-09 09:47:54 +08:00
|
|
|
hbox = gtk_hbox_new (FALSE, 2);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), hbox);
|
|
|
|
gtk_widget_show (hbox);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* the opacity toggle */
|
|
|
|
switch (tool_type)
|
|
|
|
{
|
|
|
|
case CLONE:
|
1999-11-13 09:02:27 +08:00
|
|
|
case DODGEBURN:
|
1999-09-09 09:47:54 +08:00
|
|
|
case ERASER:
|
|
|
|
case PAINTBRUSH:
|
|
|
|
case PENCIL:
|
|
|
|
pressure->opacity_w =
|
|
|
|
gtk_check_button_new_with_label (_("Opacity"));
|
|
|
|
gtk_container_add (GTK_CONTAINER (hbox), pressure->opacity_w);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (pressure->opacity_w), "toggled",
|
2000-01-14 20:41:00 +08:00
|
|
|
GTK_SIGNAL_FUNC (gimp_toggle_button_update),
|
1999-09-09 09:47:54 +08:00
|
|
|
&pressure->opacity);
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pressure->opacity_w),
|
|
|
|
pressure->opacity_d);
|
|
|
|
gtk_widget_show (pressure->opacity_w);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
1999-11-13 09:02:27 +08:00
|
|
|
/* the pressure toggle */
|
1999-09-09 09:47:54 +08:00
|
|
|
switch (tool_type)
|
|
|
|
{
|
1999-11-13 09:02:27 +08:00
|
|
|
case AIRBRUSH:
|
1999-09-09 09:47:54 +08:00
|
|
|
case CLONE:
|
1999-11-13 09:02:27 +08:00
|
|
|
case CONVOLVE:
|
1999-09-09 09:47:54 +08:00
|
|
|
case DODGEBURN:
|
|
|
|
case ERASER:
|
1999-10-04 07:48:33 +08:00
|
|
|
case PAINTBRUSH:
|
1999-11-13 09:02:27 +08:00
|
|
|
case SMUDGE:
|
|
|
|
pressure->pressure_w = gtk_check_button_new_with_label (_("Pressure"));
|
1999-09-09 09:47:54 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (hbox), pressure->pressure_w);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (pressure->pressure_w), "toggled",
|
2000-01-14 20:41:00 +08:00
|
|
|
GTK_SIGNAL_FUNC (gimp_toggle_button_update),
|
1999-09-09 09:47:54 +08:00
|
|
|
&pressure->pressure);
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pressure->pressure_w),
|
|
|
|
pressure->pressure_d);
|
|
|
|
gtk_widget_show (pressure->pressure_w);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
1999-11-13 09:02:27 +08:00
|
|
|
/* the rate toggle */
|
|
|
|
switch (tool_type)
|
|
|
|
{
|
|
|
|
case AIRBRUSH:
|
|
|
|
case CONVOLVE:
|
|
|
|
case SMUDGE:
|
|
|
|
pressure->rate_w =
|
|
|
|
gtk_check_button_new_with_label (_("Rate"));
|
|
|
|
gtk_container_add (GTK_CONTAINER (hbox), pressure->rate_w);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (pressure->rate_w), "toggled",
|
2000-01-14 20:41:00 +08:00
|
|
|
GTK_SIGNAL_FUNC (gimp_toggle_button_update),
|
1999-11-13 09:02:27 +08:00
|
|
|
&pressure->rate);
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pressure->rate_w),
|
|
|
|
pressure->rate_d);
|
|
|
|
gtk_widget_show (pressure->rate_w);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
1999-09-09 09:47:54 +08:00
|
|
|
/* the size toggle */
|
|
|
|
switch (tool_type)
|
|
|
|
{
|
|
|
|
case AIRBRUSH:
|
|
|
|
case CLONE:
|
|
|
|
case CONVOLVE:
|
|
|
|
case DODGEBURN:
|
|
|
|
case ERASER:
|
|
|
|
case PAINTBRUSH:
|
|
|
|
case PENCIL:
|
|
|
|
pressure->size_w =
|
|
|
|
gtk_check_button_new_with_label (_("Size"));
|
|
|
|
gtk_container_add (GTK_CONTAINER (hbox), pressure->size_w);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (pressure->size_w), "toggled",
|
2000-01-14 20:41:00 +08:00
|
|
|
GTK_SIGNAL_FUNC (gimp_toggle_button_update),
|
1999-09-09 09:47:54 +08:00
|
|
|
&pressure->size);
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pressure->size_w),
|
|
|
|
pressure->size_d);
|
|
|
|
gtk_widget_show (pressure->size_w);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* the color toggle */
|
|
|
|
switch (tool_type)
|
|
|
|
{
|
|
|
|
case AIRBRUSH:
|
|
|
|
case PAINTBRUSH:
|
|
|
|
case PENCIL:
|
|
|
|
pressure->color_w =
|
|
|
|
gtk_check_button_new_with_label (_("Color"));
|
|
|
|
gtk_container_add (GTK_CONTAINER (hbox), pressure->color_w);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (pressure->color_w), "toggled",
|
2000-01-14 20:41:00 +08:00
|
|
|
GTK_SIGNAL_FUNC (gimp_toggle_button_update),
|
1999-09-09 09:47:54 +08:00
|
|
|
&pressure->color);
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pressure->color_w),
|
|
|
|
pressure->color_d);
|
|
|
|
gtk_widget_show (pressure->color_w);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
1999-11-13 09:02:27 +08:00
|
|
|
|
1999-09-09 09:47:54 +08:00
|
|
|
pressure->frame = frame;
|
|
|
|
|
1999-11-24 03:11:29 +08:00
|
|
|
return pressure;
|
1999-09-09 09:47:54 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
paint_pressure_options_reset (PaintPressureOptions *pressure)
|
|
|
|
{
|
|
|
|
if (pressure->opacity_w)
|
|
|
|
{
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pressure->opacity_w),
|
|
|
|
pressure->opacity_d);
|
|
|
|
}
|
|
|
|
if (pressure->pressure_w)
|
|
|
|
{
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pressure->pressure_w),
|
|
|
|
pressure->pressure_d);
|
|
|
|
}
|
1999-11-13 09:02:27 +08:00
|
|
|
if (pressure->rate_w)
|
|
|
|
{
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pressure->rate_w),
|
|
|
|
pressure->rate_d);
|
|
|
|
}
|
1999-09-09 09:47:54 +08:00
|
|
|
if (pressure->size_w)
|
|
|
|
{
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pressure->size_w),
|
|
|
|
pressure->size_d);
|
|
|
|
}
|
|
|
|
if (pressure->color_w)
|
|
|
|
{
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pressure->color_w),
|
|
|
|
pressure->color_d);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-04-22 22:34:00 +08:00
|
|
|
/* global paint options functions *******************************************/
|
|
|
|
|
|
|
|
void
|
|
|
|
paint_options_set_global (gboolean global)
|
|
|
|
{
|
|
|
|
PaintOptions *options;
|
|
|
|
GSList *list;
|
|
|
|
|
|
|
|
global = global ? TRUE : FALSE;
|
|
|
|
|
|
|
|
if (global_paint_options == global)
|
|
|
|
return;
|
|
|
|
|
|
|
|
global_paint_options = global;
|
|
|
|
|
|
|
|
for (list = paint_options_list; list; list = list->next)
|
|
|
|
{
|
|
|
|
options = (PaintOptions *) list->data;
|
|
|
|
|
|
|
|
if (global)
|
|
|
|
{
|
|
|
|
if (options->paint_vbox && GTK_WIDGET_VISIBLE (options->paint_vbox))
|
|
|
|
gtk_widget_hide (options->paint_vbox);
|
|
|
|
if (options->global && ! GTK_WIDGET_VISIBLE (options->global))
|
|
|
|
gtk_widget_show (options->global);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (options->paint_vbox && ! GTK_WIDGET_VISIBLE (options->paint_vbox))
|
|
|
|
gtk_widget_show (options->paint_vbox);
|
|
|
|
if (options->global && GTK_WIDGET_VISIBLE (options->global))
|
|
|
|
gtk_widget_hide (options->global);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* NULL means the main brush selection */
|
|
|
|
brush_select_show_paint_options (NULL, global);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* create a paint mode menu *************************************************/
|
|
|
|
|
|
|
|
GtkWidget *
|
|
|
|
paint_mode_menu_new (MenuItemCallback callback,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
GtkWidget *menu;
|
1999-11-24 03:11:29 +08:00
|
|
|
gint i;
|
1999-04-22 22:34:00 +08:00
|
|
|
|
|
|
|
static MenuItem option_items[] =
|
|
|
|
{
|
|
|
|
{ N_("Normal"), 0, 0, NULL, (gpointer) NORMAL_MODE, NULL, NULL },
|
|
|
|
{ N_("Dissolve"), 0, 0, NULL, (gpointer) DISSOLVE_MODE, NULL, NULL },
|
|
|
|
{ N_("Behind"), 0, 0, NULL, (gpointer) BEHIND_MODE, NULL, NULL },
|
|
|
|
{ N_("Multiply (Burn)"), 0, 0, NULL, (gpointer) MULTIPLY_MODE, NULL, NULL },
|
|
|
|
{ N_("Divide (Dodge)"), 0, 0, NULL, (gpointer) DIVIDE_MODE, NULL, NULL },
|
|
|
|
{ N_("Screen"), 0, 0, NULL, (gpointer) SCREEN_MODE, NULL, NULL },
|
|
|
|
{ N_("Overlay"), 0, 0, NULL, (gpointer) OVERLAY_MODE, NULL, NULL },
|
|
|
|
{ N_("Difference"), 0, 0, NULL, (gpointer) DIFFERENCE_MODE, NULL, NULL },
|
|
|
|
{ N_("Addition"), 0, 0, NULL, (gpointer) ADDITION_MODE, NULL, NULL },
|
|
|
|
{ N_("Subtract"), 0, 0, NULL, (gpointer) SUBTRACT_MODE, NULL, NULL },
|
|
|
|
{ N_("Darken Only"), 0, 0, NULL, (gpointer) DARKEN_ONLY_MODE, NULL, NULL },
|
|
|
|
{ N_("Lighten Only"), 0, 0, NULL, (gpointer) LIGHTEN_ONLY_MODE, NULL, NULL },
|
|
|
|
{ N_("Hue"), 0, 0, NULL, (gpointer) HUE_MODE, NULL, NULL },
|
|
|
|
{ N_("Saturation"), 0, 0, NULL, (gpointer) SATURATION_MODE, NULL, NULL },
|
|
|
|
{ N_("Color"), 0, 0, NULL, (gpointer) COLOR_MODE, NULL, NULL },
|
|
|
|
{ N_("Value"), 0, 0, NULL, (gpointer) VALUE_MODE, NULL, NULL },
|
|
|
|
{ NULL, 0, 0, NULL, NULL, NULL, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
for (i = 0; i <= VALUE_MODE; i++)
|
|
|
|
option_items[i].callback = callback;
|
|
|
|
|
|
|
|
menu = build_menu (option_items, NULL);
|
|
|
|
|
|
|
|
for (i = 0; i <= VALUE_MODE; i++)
|
|
|
|
gtk_object_set_user_data (GTK_OBJECT (option_items[i].widget), user_data);
|
|
|
|
|
|
|
|
return menu;
|
|
|
|
}
|