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"
|
2001-01-22 12:17:17 +08:00
|
|
|
|
2001-07-07 20:17:23 +08:00
|
|
|
#include "core/gimp.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "core/gimpcontext.h"
|
2001-05-10 06:34:59 +08:00
|
|
|
#include "core/gimptoolinfo.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
|
2002-02-22 00:02:30 +08:00
|
|
|
#include "paint/gimppaintoptions.h"
|
|
|
|
|
2002-06-17 18:34:28 +08:00
|
|
|
#include "widgets/gimpdialogfactory.h"
|
|
|
|
#include "widgets/gimpdock.h"
|
2002-03-20 22:10:45 +08:00
|
|
|
#include "widgets/gimpenummenu.h"
|
2002-06-17 18:34:28 +08:00
|
|
|
#include "widgets/gimppreview.h"
|
2001-05-26 00:04:54 +08:00
|
|
|
#include "widgets/gimpwidgets-constructors.h"
|
2001-04-11 09:13:53 +08:00
|
|
|
#include "widgets/gtkhwrapbox.h"
|
|
|
|
|
2001-01-25 06:36:18 +08:00
|
|
|
#include "paint_options.h"
|
2001-02-24 05:32:47 +08:00
|
|
|
#include "tool_manager.h"
|
2001-01-22 12:17:17 +08:00
|
|
|
|
2001-04-01 07:04:29 +08:00
|
|
|
#include "gimpairbrushtool.h"
|
2001-03-12 04:01:14 +08:00
|
|
|
#include "gimpblendtool.h"
|
2001-03-08 09:07:03 +08:00
|
|
|
#include "gimpbucketfilltool.h"
|
2001-03-24 10:27:16 +08:00
|
|
|
#include "gimpdodgeburntool.h"
|
2001-03-12 12:40:17 +08:00
|
|
|
#include "gimperasertool.h"
|
2001-03-08 09:07:03 +08:00
|
|
|
#include "gimpinktool.h"
|
2001-02-27 13:21:12 +08:00
|
|
|
#include "gimppaintbrushtool.h"
|
2001-03-12 07:28:16 +08:00
|
|
|
#include "gimppenciltool.h"
|
2001-04-12 01:20:34 +08:00
|
|
|
#include "gimpdodgeburntool.h"
|
|
|
|
#include "gimpsmudgetool.h"
|
2001-04-19 21:01:44 +08:00
|
|
|
#include "gimpclonetool.h"
|
|
|
|
#include "gimpconvolvetool.h"
|
2001-02-27 13:21:12 +08:00
|
|
|
|
2001-01-22 12:17:17 +08:00
|
|
|
#include "libgimp/gimpintl.h"
|
|
|
|
|
|
|
|
|
2002-02-22 00:02:30 +08:00
|
|
|
static void pressure_options_init (GimpPressureOptions *pressure,
|
|
|
|
GimpPaintOptions *paint_options,
|
|
|
|
GType tool_type);
|
|
|
|
static void pressure_options_reset (GimpPressureOptions *pressure);
|
|
|
|
|
|
|
|
static void gradient_options_init (GimpGradientOptions *gradient,
|
|
|
|
GimpPaintOptions *paint_options,
|
|
|
|
GType tool_type);
|
|
|
|
static void gradient_options_reset (GimpGradientOptions *gradient);
|
|
|
|
|
|
|
|
static void paint_options_opacity_adjustment_update (GtkAdjustment *adjustment,
|
|
|
|
gpointer data);
|
|
|
|
static void paint_options_opacity_changed (GimpContext *context,
|
|
|
|
gdouble opacity,
|
|
|
|
gpointer data);
|
|
|
|
static void paint_options_paint_mode_update (GtkWidget *widget,
|
|
|
|
gpointer data);
|
|
|
|
static void paint_options_paint_mode_changed (GimpContext *context,
|
2001-12-09 07:12:59 +08:00
|
|
|
GimpLayerModeEffects paint_mode,
|
2002-02-22 00:02:30 +08:00
|
|
|
gpointer data);
|
2002-06-17 18:34:28 +08:00
|
|
|
static void paint_options_brush_clicked (GtkWidget *widget,
|
|
|
|
gpointer data);
|
2002-02-22 00:02:30 +08:00
|
|
|
static void paint_options_gradient_toggle_callback (GtkWidget *widget,
|
|
|
|
GimpPaintOptions *options);
|
2001-01-22 12:17:17 +08:00
|
|
|
|
2001-02-28 07:20:51 +08:00
|
|
|
|
2002-02-22 00:02:30 +08:00
|
|
|
GimpToolOptions *
|
|
|
|
paint_options_new (GimpToolInfo *tool_info)
|
2001-02-28 07:20:51 +08:00
|
|
|
{
|
2002-02-22 00:02:30 +08:00
|
|
|
GimpPaintOptions *options;
|
2001-02-28 07:20:51 +08:00
|
|
|
|
2002-11-28 06:55:03 +08:00
|
|
|
options = gimp_paint_options_new (tool_info->context);
|
2001-02-28 07:20:51 +08:00
|
|
|
|
2002-02-22 00:02:30 +08:00
|
|
|
paint_options_init (options, tool_info);
|
2001-01-22 12:17:17 +08:00
|
|
|
|
2002-02-22 00:02:30 +08:00
|
|
|
return (GimpToolOptions *) options;
|
|
|
|
}
|
2001-01-22 12:17:17 +08:00
|
|
|
|
|
|
|
void
|
2002-02-22 00:02:30 +08:00
|
|
|
paint_options_init (GimpPaintOptions *options,
|
|
|
|
GimpToolInfo *tool_info)
|
2001-01-22 12:17:17 +08:00
|
|
|
{
|
2001-11-21 07:00:47 +08:00
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *table;
|
2002-03-10 23:05:58 +08:00
|
|
|
GtkWidget *mode_label;
|
2001-01-22 12:17:17 +08:00
|
|
|
|
|
|
|
/* initialize the tool options structure */
|
2001-11-21 07:00:47 +08:00
|
|
|
tool_options_init ((GimpToolOptions *) options, tool_info);
|
|
|
|
|
|
|
|
((GimpToolOptions *) options)->reset_func = paint_options_reset;
|
2001-01-22 12:17:17 +08:00
|
|
|
|
|
|
|
/* the main vbox */
|
2002-03-13 05:02:10 +08:00
|
|
|
vbox = options->tool_options.main_vbox;
|
2001-01-22 12:17:17 +08:00
|
|
|
|
|
|
|
/* the main table */
|
2002-06-17 18:34:28 +08:00
|
|
|
table = gtk_table_new (3, 3, FALSE);
|
2002-03-09 02:30:40 +08:00
|
|
|
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
|
2002-03-10 23:05:58 +08:00
|
|
|
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
2002-03-09 02:30:40 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
2002-03-10 23:05:58 +08:00
|
|
|
gtk_widget_show (table);
|
2001-01-22 12:17:17 +08:00
|
|
|
|
|
|
|
/* the opacity scale */
|
|
|
|
options->opacity_w =
|
2002-03-09 02:30:40 +08:00
|
|
|
gimp_scale_entry_new (GTK_TABLE (table), 0, 0,
|
2002-09-07 04:44:47 +08:00
|
|
|
_("Opacity:"), -1, -1,
|
2002-03-09 02:30:40 +08:00
|
|
|
gimp_context_get_opacity (tool_info->context) * 100,
|
|
|
|
0.0, 100.0, 1.0, 10.0, 1,
|
|
|
|
TRUE, 0.0, 0.0,
|
|
|
|
NULL, NULL);
|
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_connect (options->opacity_w, "value_changed",
|
2001-08-01 10:57:58 +08:00
|
|
|
G_CALLBACK (paint_options_opacity_adjustment_update),
|
|
|
|
tool_info->context);
|
2001-01-22 12:17:17 +08:00
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_connect (tool_info->context, "opacity_changed",
|
2001-08-01 10:57:58 +08:00
|
|
|
G_CALLBACK (paint_options_opacity_changed),
|
|
|
|
options->opacity_w);
|
2001-01-22 12:17:17 +08:00
|
|
|
|
|
|
|
/* the paint mode menu */
|
2002-03-10 23:05:58 +08:00
|
|
|
options->paint_mode_w =
|
|
|
|
gimp_paint_mode_menu_new (G_CALLBACK (paint_options_paint_mode_update),
|
|
|
|
options,
|
|
|
|
TRUE,
|
|
|
|
gimp_context_get_paint_mode (tool_info->context));
|
|
|
|
mode_label = gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
|
|
|
|
_("Mode:"), 1.0, 0.5,
|
|
|
|
options->paint_mode_w, 2, TRUE);
|
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_connect (tool_info->context, "paint_mode_changed",
|
2002-03-10 23:05:58 +08:00
|
|
|
G_CALLBACK (paint_options_paint_mode_changed),
|
|
|
|
options->paint_mode_w);
|
|
|
|
|
|
|
|
if (tool_info->tool_type == GIMP_TYPE_ERASER_TOOL ||
|
|
|
|
tool_info->tool_type == GIMP_TYPE_CONVOLVE_TOOL ||
|
|
|
|
tool_info->tool_type == GIMP_TYPE_DODGEBURN_TOOL ||
|
|
|
|
tool_info->tool_type == GIMP_TYPE_SMUDGE_TOOL)
|
2001-01-22 12:17:17 +08:00
|
|
|
{
|
2002-03-10 23:05:58 +08:00
|
|
|
gtk_widget_set_sensitive (options->paint_mode_w, FALSE);
|
|
|
|
gtk_widget_set_sensitive (mode_label, FALSE);
|
2001-01-22 12:17:17 +08:00
|
|
|
}
|
|
|
|
|
2002-06-17 18:34:28 +08:00
|
|
|
/* the brush preview */
|
|
|
|
if (tool_info->tool_type != GIMP_TYPE_BUCKET_FILL_TOOL &&
|
|
|
|
tool_info->tool_type != GIMP_TYPE_BLEND_TOOL &&
|
|
|
|
tool_info->tool_type != GIMP_TYPE_INK_TOOL)
|
|
|
|
{
|
|
|
|
GimpBrush *brush;
|
|
|
|
GtkWidget *button;
|
|
|
|
GtkWidget *preview;
|
|
|
|
|
|
|
|
brush = gimp_context_get_brush (options->context);
|
|
|
|
|
|
|
|
button = gtk_button_new ();
|
|
|
|
preview = gimp_preview_new_full (GIMP_VIEWABLE (brush),
|
|
|
|
24, 24, 0,
|
|
|
|
FALSE, TRUE, TRUE);
|
|
|
|
gtk_container_add (GTK_CONTAINER (button), preview);
|
|
|
|
gtk_widget_show (preview);
|
|
|
|
|
|
|
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, 2,
|
|
|
|
_("Brush:"), 1.0, 0.5,
|
|
|
|
button, 2, TRUE);
|
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_connect_object (options->context, "brush_changed",
|
2002-06-17 18:34:28 +08:00
|
|
|
G_CALLBACK (gimp_preview_set_viewable),
|
2003-01-06 06:07:10 +08:00
|
|
|
preview,
|
2002-06-17 18:34:28 +08:00
|
|
|
G_CONNECT_SWAPPED);
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_connect (button, "clicked",
|
2002-06-17 18:34:28 +08:00
|
|
|
G_CALLBACK (paint_options_brush_clicked),
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
2002-03-13 05:02:10 +08:00
|
|
|
/* a separator after the common paint options */
|
2002-02-10 23:18:08 +08:00
|
|
|
if (tool_info->tool_type == GIMP_TYPE_BLEND_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);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* the "incremental" toggle */
|
2001-11-21 07:00:47 +08:00
|
|
|
if (tool_info->tool_type == GIMP_TYPE_AIRBRUSH_TOOL ||
|
|
|
|
tool_info->tool_type == GIMP_TYPE_ERASER_TOOL ||
|
|
|
|
tool_info->tool_type == GIMP_TYPE_PAINTBRUSH_TOOL ||
|
|
|
|
tool_info->tool_type == GIMP_TYPE_PENCIL_TOOL)
|
2001-01-22 12:17:17 +08:00
|
|
|
{
|
|
|
|
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_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->incremental_w),
|
2002-04-28 22:35:01 +08:00
|
|
|
options->incremental);
|
2001-01-22 12:17:17 +08:00
|
|
|
gtk_widget_show (options->incremental_w);
|
2001-11-23 01:11:52 +08:00
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_connect (options->incremental_w, "toggled",
|
2001-11-23 01:11:52 +08:00
|
|
|
G_CALLBACK (gimp_toggle_button_update),
|
|
|
|
&options->incremental);
|
2001-01-22 12:17:17 +08:00
|
|
|
}
|
|
|
|
|
2002-02-22 00:02:30 +08:00
|
|
|
pressure_options_init (options->pressure_options,
|
|
|
|
options,
|
|
|
|
tool_info->tool_type);
|
2001-01-22 12:17:17 +08:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2002-02-22 00:02:30 +08:00
|
|
|
gradient_options_init (options->gradient_options,
|
|
|
|
options,
|
|
|
|
tool_info->tool_type);
|
2001-02-28 07:20:51 +08:00
|
|
|
|
2002-03-19 03:34:06 +08:00
|
|
|
if (options->gradient_options->fade_frame)
|
2001-02-28 07:20:51 +08:00
|
|
|
{
|
|
|
|
gtk_box_pack_start (GTK_BOX (options->tool_options.main_vbox),
|
2002-03-19 03:34:06 +08:00
|
|
|
options->gradient_options->fade_frame,
|
|
|
|
FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (options->gradient_options->fade_frame);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (options->gradient_options->gradient_frame)
|
|
|
|
{
|
|
|
|
gtk_box_pack_start (GTK_BOX (options->tool_options.main_vbox),
|
|
|
|
options->gradient_options->gradient_frame,
|
|
|
|
FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (options->gradient_options->gradient_frame);
|
2001-02-28 07:20:51 +08:00
|
|
|
}
|
2001-01-22 12:17:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2001-07-18 04:50:01 +08:00
|
|
|
paint_options_reset (GimpToolOptions *tool_options)
|
2001-01-22 12:17:17 +08:00
|
|
|
{
|
2002-02-22 00:02:30 +08:00
|
|
|
GimpPaintOptions *options;
|
|
|
|
GimpContext *default_context;
|
2001-04-01 04:41:39 +08:00
|
|
|
|
2002-02-22 00:02:30 +08:00
|
|
|
options = (GimpPaintOptions *) tool_options;
|
2001-01-22 12:17:17 +08:00
|
|
|
|
2001-12-04 01:59:48 +08:00
|
|
|
default_context = gimp_get_default_context (tool_options->tool_info->gimp);
|
2001-01-22 12:17:17 +08:00
|
|
|
|
|
|
|
if (options->opacity_w)
|
|
|
|
{
|
|
|
|
gimp_context_set_opacity (GIMP_CONTEXT (options->context),
|
|
|
|
gimp_context_get_opacity (default_context));
|
|
|
|
}
|
|
|
|
if (options->paint_mode_w)
|
|
|
|
{
|
|
|
|
gimp_context_set_paint_mode (GIMP_CONTEXT (options->context),
|
|
|
|
gimp_context_get_paint_mode (default_context));
|
|
|
|
}
|
|
|
|
if (options->incremental_w)
|
|
|
|
{
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->incremental_w),
|
|
|
|
options->incremental_d);
|
|
|
|
}
|
|
|
|
|
2002-02-22 00:02:30 +08:00
|
|
|
pressure_options_reset (options->pressure_options);
|
|
|
|
gradient_options_reset (options->gradient_options);
|
2001-01-22 12:17:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* private functions */
|
|
|
|
|
2002-02-22 00:02:30 +08:00
|
|
|
static void
|
|
|
|
pressure_options_init (GimpPressureOptions *pressure,
|
|
|
|
GimpPaintOptions *paint_options,
|
|
|
|
GType tool_type)
|
2001-01-22 12:17:17 +08:00
|
|
|
{
|
2002-03-10 23:05:58 +08:00
|
|
|
GtkWidget *wbox = NULL;
|
2001-01-22 12:17:17 +08:00
|
|
|
|
2001-02-24 05:32:47 +08:00
|
|
|
if (tool_type == GIMP_TYPE_AIRBRUSH_TOOL ||
|
|
|
|
tool_type == GIMP_TYPE_CLONE_TOOL ||
|
|
|
|
tool_type == GIMP_TYPE_CONVOLVE_TOOL ||
|
2001-03-26 12:39:15 +08:00
|
|
|
tool_type == GIMP_TYPE_DODGEBURN_TOOL ||
|
2001-02-24 05:32:47 +08:00
|
|
|
tool_type == GIMP_TYPE_ERASER_TOOL ||
|
|
|
|
tool_type == GIMP_TYPE_PAINTBRUSH_TOOL ||
|
|
|
|
tool_type == GIMP_TYPE_PENCIL_TOOL ||
|
|
|
|
tool_type == GIMP_TYPE_SMUDGE_TOOL)
|
2001-01-22 12:17:17 +08:00
|
|
|
{
|
2002-03-10 23:05:58 +08:00
|
|
|
pressure->frame = gtk_frame_new (_("Pressure Sensitivity"));
|
|
|
|
|
2001-01-22 12:17:17 +08:00
|
|
|
wbox = gtk_hwrap_box_new (FALSE);
|
|
|
|
gtk_wrap_box_set_aspect_ratio (GTK_WRAP_BOX (wbox), 6);
|
2002-03-10 23:05:58 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (pressure->frame), wbox);
|
2001-01-22 12:17:17 +08:00
|
|
|
gtk_widget_show (wbox);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* the opacity toggle */
|
2001-02-24 05:32:47 +08:00
|
|
|
if (tool_type == GIMP_TYPE_CLONE_TOOL ||
|
|
|
|
tool_type == GIMP_TYPE_DODGEBURN_TOOL ||
|
|
|
|
tool_type == GIMP_TYPE_ERASER_TOOL ||
|
|
|
|
tool_type == GIMP_TYPE_PAINTBRUSH_TOOL ||
|
|
|
|
tool_type == GIMP_TYPE_PENCIL_TOOL)
|
2001-01-22 12:17:17 +08:00
|
|
|
{
|
|
|
|
pressure->opacity_w =
|
|
|
|
gtk_check_button_new_with_label (_("Opacity"));
|
|
|
|
gtk_container_add (GTK_CONTAINER (wbox), pressure->opacity_w);
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pressure->opacity_w),
|
2002-04-28 22:35:01 +08:00
|
|
|
pressure->opacity);
|
2001-01-22 12:17:17 +08:00
|
|
|
gtk_widget_show (pressure->opacity_w);
|
2001-11-23 01:11:52 +08:00
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_connect (pressure->opacity_w, "toggled",
|
2001-11-23 01:11:52 +08:00
|
|
|
G_CALLBACK (gimp_toggle_button_update),
|
|
|
|
&pressure->opacity);
|
2001-01-22 12:17:17 +08:00
|
|
|
}
|
|
|
|
|
2001-02-24 05:32:47 +08:00
|
|
|
/* the pressure toggle */
|
|
|
|
if (tool_type == GIMP_TYPE_AIRBRUSH_TOOL ||
|
|
|
|
tool_type == GIMP_TYPE_CLONE_TOOL ||
|
|
|
|
tool_type == GIMP_TYPE_CONVOLVE_TOOL ||
|
|
|
|
tool_type == GIMP_TYPE_DODGEBURN_TOOL ||
|
|
|
|
tool_type == GIMP_TYPE_PAINTBRUSH_TOOL ||
|
|
|
|
tool_type == GIMP_TYPE_SMUDGE_TOOL)
|
2001-01-22 12:17:17 +08:00
|
|
|
{
|
|
|
|
pressure->pressure_w = gtk_check_button_new_with_label (_("Hardness"));
|
|
|
|
gtk_container_add (GTK_CONTAINER (wbox), pressure->pressure_w);
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pressure->pressure_w),
|
2002-04-28 22:35:01 +08:00
|
|
|
pressure->pressure);
|
2001-01-22 12:17:17 +08:00
|
|
|
gtk_widget_show (pressure->pressure_w);
|
2001-11-23 01:11:52 +08:00
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_connect (pressure->pressure_w, "toggled",
|
2001-11-23 01:11:52 +08:00
|
|
|
G_CALLBACK (gimp_toggle_button_update),
|
|
|
|
&pressure->pressure);
|
2001-01-22 12:17:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* the rate toggle */
|
2001-02-24 05:32:47 +08:00
|
|
|
if (tool_type == GIMP_TYPE_AIRBRUSH_TOOL ||
|
|
|
|
tool_type == GIMP_TYPE_CONVOLVE_TOOL ||
|
|
|
|
tool_type == GIMP_TYPE_SMUDGE_TOOL)
|
2001-01-22 12:17:17 +08:00
|
|
|
{
|
|
|
|
pressure->rate_w =
|
|
|
|
gtk_check_button_new_with_label (_("Rate"));
|
|
|
|
gtk_container_add (GTK_CONTAINER (wbox), pressure->rate_w);
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pressure->rate_w),
|
2002-04-28 22:35:01 +08:00
|
|
|
pressure->rate);
|
2001-01-22 12:17:17 +08:00
|
|
|
gtk_widget_show (pressure->rate_w);
|
2001-11-23 01:11:52 +08:00
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_connect (pressure->rate_w, "toggled",
|
2001-11-23 01:11:52 +08:00
|
|
|
G_CALLBACK (gimp_toggle_button_update),
|
|
|
|
&pressure->rate);
|
2001-01-22 12:17:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* the size toggle */
|
2001-02-24 05:32:47 +08:00
|
|
|
if (tool_type == GIMP_TYPE_AIRBRUSH_TOOL ||
|
|
|
|
tool_type == GIMP_TYPE_CLONE_TOOL ||
|
|
|
|
tool_type == GIMP_TYPE_CONVOLVE_TOOL ||
|
|
|
|
tool_type == GIMP_TYPE_DODGEBURN_TOOL ||
|
|
|
|
tool_type == GIMP_TYPE_ERASER_TOOL ||
|
|
|
|
tool_type == GIMP_TYPE_PAINTBRUSH_TOOL ||
|
|
|
|
tool_type == GIMP_TYPE_PENCIL_TOOL)
|
2001-01-22 12:17:17 +08:00
|
|
|
{
|
|
|
|
pressure->size_w =
|
|
|
|
gtk_check_button_new_with_label (_("Size"));
|
|
|
|
gtk_container_add (GTK_CONTAINER (wbox), pressure->size_w);
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pressure->size_w),
|
2002-04-28 22:35:01 +08:00
|
|
|
pressure->size);
|
2001-01-22 12:17:17 +08:00
|
|
|
gtk_widget_show (pressure->size_w);
|
2001-11-23 01:11:52 +08:00
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_connect (pressure->size_w, "toggled",
|
2001-11-23 01:11:52 +08:00
|
|
|
G_CALLBACK (gimp_toggle_button_update),
|
|
|
|
&pressure->size);
|
2001-01-22 12:17:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* the color toggle */
|
2001-02-24 05:32:47 +08:00
|
|
|
if (tool_type == GIMP_TYPE_AIRBRUSH_TOOL ||
|
|
|
|
tool_type == GIMP_TYPE_PAINTBRUSH_TOOL ||
|
|
|
|
tool_type == GIMP_TYPE_PENCIL_TOOL)
|
2001-01-22 12:17:17 +08:00
|
|
|
{
|
|
|
|
pressure->color_w =
|
|
|
|
gtk_check_button_new_with_label (_("Color"));
|
|
|
|
gtk_container_add (GTK_CONTAINER (wbox), pressure->color_w);
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pressure->color_w),
|
2002-04-28 22:35:01 +08:00
|
|
|
pressure->color);
|
2001-01-22 12:17:17 +08:00
|
|
|
gtk_widget_show (pressure->color_w);
|
2001-11-23 01:11:52 +08:00
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_connect (pressure->color_w, "toggled",
|
2001-11-23 01:11:52 +08:00
|
|
|
G_CALLBACK (gimp_toggle_button_update),
|
|
|
|
&pressure->color);
|
2001-01-22 12:17:17 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2002-02-22 00:02:30 +08:00
|
|
|
pressure_options_reset (GimpPressureOptions *pressure)
|
2001-01-22 12:17:17 +08:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
if (pressure->rate_w)
|
|
|
|
{
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pressure->rate_w),
|
|
|
|
pressure->rate_d);
|
|
|
|
}
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-02-22 00:02:30 +08:00
|
|
|
static void
|
|
|
|
gradient_options_init (GimpGradientOptions *gradient,
|
|
|
|
GimpPaintOptions *paint_options,
|
|
|
|
GType tool_type)
|
2001-02-28 07:20:51 +08:00
|
|
|
{
|
2002-02-22 00:02:30 +08:00
|
|
|
GtkWidget *table = NULL;
|
|
|
|
GtkWidget *spinbutton = NULL;
|
2001-02-28 07:20:51 +08:00
|
|
|
|
|
|
|
if (tool_type == GIMP_TYPE_PAINTBRUSH_TOOL)
|
|
|
|
{
|
2002-03-19 03:34:06 +08:00
|
|
|
gradient->fade_frame = gtk_frame_new (NULL);
|
2002-03-10 23:05:58 +08:00
|
|
|
|
2002-03-19 03:34:06 +08:00
|
|
|
table = gtk_table_new (1, 3, FALSE);
|
2002-03-10 23:05:58 +08:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (table), 2);
|
2002-03-09 02:30:40 +08:00
|
|
|
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
|
2002-03-19 03:34:06 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (gradient->fade_frame), table);
|
2001-02-28 07:20:51 +08:00
|
|
|
gtk_widget_show (table);
|
|
|
|
|
|
|
|
gradient->use_fade_w =
|
|
|
|
gtk_check_button_new_with_label (_("Fade Out"));
|
2002-03-19 03:34:06 +08:00
|
|
|
gtk_frame_set_label_widget (GTK_FRAME (gradient->fade_frame),
|
|
|
|
gradient->use_fade_w);
|
2002-03-10 23:05:58 +08:00
|
|
|
gtk_widget_show (gradient->use_fade_w);
|
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_connect (gradient->use_fade_w, "toggled",
|
2001-08-01 10:57:58 +08:00
|
|
|
G_CALLBACK (gimp_toggle_button_update),
|
|
|
|
&gradient->use_fade);
|
2001-02-28 07:20:51 +08:00
|
|
|
|
2002-04-28 22:35:01 +08:00
|
|
|
gtk_widget_set_sensitive (table, gradient->use_fade);
|
2002-03-19 03:34:06 +08:00
|
|
|
g_object_set_data (G_OBJECT (gradient->use_fade_w),
|
2003-01-06 06:07:10 +08:00
|
|
|
"set_sensitive", table);
|
2002-03-19 03:34:06 +08:00
|
|
|
|
2002-09-07 04:44:47 +08:00
|
|
|
/* the fade-out sizeentry */
|
|
|
|
spinbutton = gimp_spin_button_new (&gradient->fade_out_w,
|
|
|
|
gradient->fade_out,
|
|
|
|
1e-5, 32767.0, 1.0, 50.0, 0.0,
|
|
|
|
1.0, 0.0);
|
|
|
|
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), 6);
|
2002-03-19 03:34:06 +08:00
|
|
|
|
|
|
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
|
|
|
|
_("Length:"), 1.0, 0.5,
|
|
|
|
spinbutton, 1, FALSE);
|
2002-03-10 23:05:58 +08:00
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_connect (gradient->fade_out_w, "value_changed",
|
2001-08-01 10:57:58 +08:00
|
|
|
G_CALLBACK (gimp_double_adjustment_update),
|
|
|
|
&gradient->fade_out);
|
2001-02-28 07:20:51 +08:00
|
|
|
|
|
|
|
/* the fade-out unitmenu */
|
|
|
|
gradient->fade_unit_w =
|
2002-04-28 22:35:01 +08:00
|
|
|
gimp_unit_menu_new ("%a", gradient->fade_unit, TRUE, TRUE, TRUE);
|
2001-02-28 07:20:51 +08:00
|
|
|
gtk_table_attach (GTK_TABLE (table), gradient->fade_unit_w, 2, 3, 0, 1,
|
|
|
|
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
|
|
|
gtk_widget_show (gradient->fade_unit_w);
|
|
|
|
|
2002-03-10 23:05:58 +08:00
|
|
|
g_object_set_data (G_OBJECT (gradient->fade_unit_w), "set_digits",
|
2002-03-19 03:34:06 +08:00
|
|
|
spinbutton);
|
2002-03-10 23:05:58 +08:00
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_connect (gradient->fade_unit_w, "unit_changed",
|
2002-03-10 23:05:58 +08:00
|
|
|
G_CALLBACK (gimp_unit_menu_update),
|
|
|
|
&gradient->fade_unit);
|
2002-03-19 03:34:06 +08:00
|
|
|
}
|
2002-03-10 23:05:58 +08:00
|
|
|
|
2002-03-19 03:34:06 +08:00
|
|
|
if (tool_type == GIMP_TYPE_PAINTBRUSH_TOOL)
|
|
|
|
{
|
|
|
|
gradient->gradient_frame = gtk_frame_new (NULL);
|
2001-02-28 07:20:51 +08:00
|
|
|
|
2002-03-19 03:34:06 +08:00
|
|
|
table = gtk_table_new (2, 3, FALSE);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (table), 2);
|
|
|
|
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
|
|
|
|
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
|
|
|
gtk_container_add (GTK_CONTAINER (gradient->gradient_frame), table);
|
|
|
|
gtk_widget_show (table);
|
2001-02-28 07:20:51 +08:00
|
|
|
|
|
|
|
gradient->use_gradient_w =
|
2002-03-19 03:34:06 +08:00
|
|
|
gtk_check_button_new_with_label (_("Use Color from Gradient"));
|
|
|
|
gtk_frame_set_label_widget (GTK_FRAME (gradient->gradient_frame),
|
|
|
|
gradient->use_gradient_w);
|
2002-03-10 23:05:58 +08:00
|
|
|
gtk_widget_show (gradient->use_gradient_w);
|
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_connect (gradient->use_gradient_w, "toggled",
|
2002-02-22 00:02:30 +08:00
|
|
|
G_CALLBACK (paint_options_gradient_toggle_callback),
|
2001-08-01 10:57:58 +08:00
|
|
|
paint_options);
|
2001-02-28 07:20:51 +08:00
|
|
|
|
2002-04-28 22:35:01 +08:00
|
|
|
gtk_widget_set_sensitive (table, gradient->use_gradient);
|
2002-03-19 03:34:06 +08:00
|
|
|
g_object_set_data (G_OBJECT (gradient->use_gradient_w), "set_sensitive",
|
|
|
|
table);
|
|
|
|
g_object_set_data (G_OBJECT (gradient->use_gradient_w),
|
|
|
|
"inverse_sensitive",
|
|
|
|
paint_options->incremental_w);
|
|
|
|
|
2001-02-28 07:20:51 +08:00
|
|
|
/* the gradient length scale */
|
2002-09-07 04:44:47 +08:00
|
|
|
spinbutton = gimp_spin_button_new (&gradient->gradient_length_w,
|
|
|
|
gradient->gradient_length,
|
|
|
|
1e-5, 32767.0, 1.0, 50.0, 0.0,
|
|
|
|
1.0, 0.0);
|
|
|
|
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), 6);
|
2002-03-19 03:34:06 +08:00
|
|
|
|
|
|
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
|
|
|
|
_("Length:"), 1.0, 0.5,
|
|
|
|
spinbutton, 1, FALSE);
|
2002-03-10 23:05:58 +08:00
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_connect (gradient->gradient_length_w, "value_changed",
|
2001-08-01 10:57:58 +08:00
|
|
|
G_CALLBACK (gimp_double_adjustment_update),
|
|
|
|
&gradient->gradient_length);
|
2001-02-28 07:20:51 +08:00
|
|
|
|
|
|
|
/* the gradient unitmenu */
|
|
|
|
gradient->gradient_unit_w =
|
2002-04-28 22:35:01 +08:00
|
|
|
gimp_unit_menu_new ("%a", gradient->gradient_unit, TRUE, TRUE, TRUE);
|
2002-03-19 03:34:06 +08:00
|
|
|
gtk_table_attach (GTK_TABLE (table), gradient->gradient_unit_w, 2, 3, 0, 1,
|
2001-02-28 07:20:51 +08:00
|
|
|
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
|
|
|
gtk_widget_show (gradient->gradient_unit_w);
|
|
|
|
|
2002-03-10 23:05:58 +08:00
|
|
|
g_object_set_data (G_OBJECT (gradient->gradient_unit_w), "set_digits",
|
|
|
|
spinbutton);
|
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_connect (gradient->gradient_unit_w, "unit_changed",
|
2002-03-10 23:05:58 +08:00
|
|
|
G_CALLBACK (gimp_unit_menu_update),
|
|
|
|
&gradient->gradient_unit);
|
|
|
|
|
2001-02-28 07:20:51 +08:00
|
|
|
/* the gradient type */
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
gradient->gradient_type_w =
|
2002-03-20 03:17:31 +08:00
|
|
|
gimp_enum_option_menu_new (GIMP_TYPE_GRADIENT_PAINT_MODE,
|
|
|
|
G_CALLBACK (gimp_menu_item_update),
|
|
|
|
&gradient->gradient_type);
|
|
|
|
gimp_option_menu_set_history (GTK_OPTION_MENU (gradient->gradient_type_w),
|
2002-04-28 22:35:01 +08:00
|
|
|
GINT_TO_POINTER (gradient->gradient_type));
|
2001-02-28 07:20:51 +08:00
|
|
|
|
2002-03-19 03:34:06 +08:00
|
|
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
|
|
|
|
_("Type:"), 1.0, 0.5,
|
|
|
|
gradient->gradient_type_w, 2,
|
|
|
|
TRUE);
|
2001-02-28 07:20:51 +08:00
|
|
|
|
|
|
|
gtk_widget_show (table);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2002-02-22 00:02:30 +08:00
|
|
|
gradient_options_reset (GimpGradientOptions *gradient)
|
2001-02-28 07:20:51 +08:00
|
|
|
{
|
|
|
|
GtkWidget *spinbutton;
|
|
|
|
gint digits;
|
|
|
|
|
|
|
|
if (gradient->use_fade_w)
|
|
|
|
{
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gradient->use_fade_w),
|
|
|
|
gradient->use_fade_d);
|
|
|
|
gtk_adjustment_set_value (GTK_ADJUSTMENT (gradient->fade_out_w),
|
|
|
|
gradient->fade_out_d);
|
|
|
|
gimp_unit_menu_set_unit (GIMP_UNIT_MENU (gradient->fade_unit_w),
|
|
|
|
gradient->fade_unit_d);
|
|
|
|
digits = ((gradient->fade_unit_d == GIMP_UNIT_PIXEL) ? 0 :
|
|
|
|
((gradient->fade_unit_d == GIMP_UNIT_PERCENT) ? 2 :
|
|
|
|
(MIN (6, MAX (3, gimp_unit_get_digits (gradient->fade_unit_d))))));
|
2001-07-25 08:27:41 +08:00
|
|
|
spinbutton = g_object_get_data (G_OBJECT (gradient->fade_unit_w),
|
2002-09-07 04:44:47 +08:00
|
|
|
"set_digits");
|
2001-02-28 07:20:51 +08:00
|
|
|
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (spinbutton), digits);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gradient->use_gradient_w)
|
|
|
|
{
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gradient->use_gradient_w),
|
|
|
|
gradient->use_gradient_d);
|
|
|
|
gtk_adjustment_set_value (GTK_ADJUSTMENT (gradient->gradient_length_w),
|
|
|
|
gradient->gradient_length_d);
|
|
|
|
gimp_unit_menu_set_unit (GIMP_UNIT_MENU (gradient->gradient_unit_w),
|
|
|
|
gradient->gradient_unit_d);
|
|
|
|
digits = ((gradient->gradient_unit_d == GIMP_UNIT_PIXEL) ? 0 :
|
|
|
|
((gradient->gradient_unit_d == GIMP_UNIT_PERCENT) ? 2 :
|
|
|
|
(MIN (6, MAX (3, gimp_unit_get_digits (gradient->gradient_unit_d))))));
|
2001-07-25 08:27:41 +08:00
|
|
|
spinbutton = g_object_get_data (G_OBJECT (gradient->gradient_unit_w),
|
2002-09-07 04:44:47 +08:00
|
|
|
"set_digits");
|
2001-02-28 07:20:51 +08:00
|
|
|
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (spinbutton), digits);
|
|
|
|
|
|
|
|
gradient->gradient_type = gradient->gradient_type_d;
|
|
|
|
|
|
|
|
gtk_option_menu_set_history (GTK_OPTION_MENU (gradient->gradient_type_w),
|
|
|
|
gradient->gradient_type_d);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-01-22 12:17:17 +08:00
|
|
|
static void
|
|
|
|
paint_options_opacity_adjustment_update (GtkAdjustment *adjustment,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_handlers_block_by_func (data,
|
2001-08-01 10:57:58 +08:00
|
|
|
paint_options_opacity_changed,
|
|
|
|
adjustment);
|
2002-03-10 23:05:58 +08:00
|
|
|
|
2001-01-22 12:17:17 +08:00
|
|
|
gimp_context_set_opacity (GIMP_CONTEXT (data),
|
|
|
|
adjustment->value / 100);
|
2002-03-10 23:05:58 +08:00
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_handlers_unblock_by_func (data,
|
2001-08-01 10:57:58 +08:00
|
|
|
paint_options_opacity_changed,
|
|
|
|
adjustment);
|
2001-01-22 12:17:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
paint_options_opacity_changed (GimpContext *context,
|
|
|
|
gdouble opacity,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_handlers_block_by_func (data,
|
2001-08-01 10:57:58 +08:00
|
|
|
paint_options_opacity_adjustment_update,
|
|
|
|
context);
|
2002-03-10 23:05:58 +08:00
|
|
|
|
2001-01-22 12:17:17 +08:00
|
|
|
gtk_adjustment_set_value (GTK_ADJUSTMENT (data), opacity * 100);
|
2002-03-10 23:05:58 +08:00
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_handlers_unblock_by_func (data,
|
2001-08-01 10:57:58 +08:00
|
|
|
paint_options_opacity_adjustment_update,
|
|
|
|
context);
|
2001-01-22 12:17:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
paint_options_paint_mode_update (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2001-12-09 07:12:59 +08:00
|
|
|
GimpLayerModeEffects paint_mode;
|
2002-02-22 00:02:30 +08:00
|
|
|
GimpPaintOptions *options;
|
2001-01-22 12:17:17 +08:00
|
|
|
|
2002-03-10 23:05:58 +08:00
|
|
|
paint_mode = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget),
|
|
|
|
"gimp-item-data"));
|
2001-08-01 10:57:58 +08:00
|
|
|
|
2002-02-22 00:02:30 +08:00
|
|
|
options = (GimpPaintOptions *) data;
|
2001-01-22 12:17:17 +08:00
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_handlers_block_by_func (options->context,
|
2001-08-15 00:33:28 +08:00
|
|
|
paint_options_paint_mode_changed,
|
|
|
|
options->paint_mode_w);
|
|
|
|
|
2001-01-22 12:17:17 +08:00
|
|
|
gimp_context_set_paint_mode (GIMP_CONTEXT (options->context), paint_mode);
|
2001-08-15 00:33:28 +08:00
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_handlers_unblock_by_func (options->context,
|
2001-08-15 00:33:28 +08:00
|
|
|
paint_options_paint_mode_changed,
|
|
|
|
options->paint_mode_w);
|
2001-01-22 12:17:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-12-09 07:12:59 +08:00
|
|
|
paint_options_paint_mode_changed (GimpContext *context,
|
|
|
|
GimpLayerModeEffects paint_mode,
|
|
|
|
gpointer data)
|
2001-01-22 12:17:17 +08:00
|
|
|
{
|
2002-03-10 23:05:58 +08:00
|
|
|
gimp_option_menu_set_history (GTK_OPTION_MENU (data),
|
|
|
|
GINT_TO_POINTER (paint_mode));
|
2001-01-22 12:17:17 +08:00
|
|
|
}
|
2001-02-28 07:20:51 +08:00
|
|
|
|
2002-06-17 18:34:28 +08:00
|
|
|
static void
|
|
|
|
paint_options_brush_clicked (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GtkWidget *toplevel;
|
|
|
|
|
|
|
|
toplevel = gtk_widget_get_toplevel (widget);
|
|
|
|
|
|
|
|
if (GIMP_IS_DOCK (toplevel))
|
|
|
|
gimp_dialog_factory_dialog_raise (GIMP_DOCK (toplevel)->dialog_factory,
|
|
|
|
"gimp-brush-grid", -1);
|
|
|
|
}
|
|
|
|
|
2001-02-28 07:20:51 +08:00
|
|
|
static void
|
2002-02-22 00:02:30 +08:00
|
|
|
paint_options_gradient_toggle_callback (GtkWidget *widget,
|
|
|
|
GimpPaintOptions *options)
|
2001-02-28 07:20:51 +08:00
|
|
|
{
|
|
|
|
gimp_toggle_button_update (widget, &options->gradient_options->use_gradient);
|
|
|
|
|
|
|
|
if (options->gradient_options->use_gradient)
|
|
|
|
{
|
2001-04-01 04:41:39 +08:00
|
|
|
options->incremental_save = options->incremental;
|
|
|
|
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->incremental_w),
|
|
|
|
TRUE);
|
2001-02-28 07:20:51 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-04-01 04:41:39 +08:00
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->incremental_w),
|
|
|
|
options->incremental_save);
|
2001-02-28 07:20:51 +08:00
|
|
|
}
|
|
|
|
}
|