mirror of https://github.com/GNOME/gimp.git
First version of per-tool paint options. No PDB interface yet. The tool
1999-04-22 Michael Natterer <mitschel@cs.tu-berlin.de> First version of per-tool paint options. No PDB interface yet. The tool options dialog got rather big when in per-tool mode, so it will probably have to become a notebook. It's not yet 100% consistent. If switched off, everything should behave exactly like before. * app/Makefile.am * app/paint_options.h: new file * app/tool_options.c: PaintOptions gui. Maintain a list of all paint tools' ToolOptions to enable switching between global and per-tool paint options. * app/brush_select.[ch]: changed packing boxes, tables, ... The paint options in the brush selection can be hidden now. Moved create_paint_mode_menu() to paint_options.h and tool_options.c and renamed it to paint_mode_menu_new(). * app/gimage_mask.c * app/gimpbrush.[ch] * app/gimpbrushlist.[ch] * app/paint_core.c: moved gimp_brush_[set|get]_spacing() from gimpbrushlist.[ch] to gimpbrush.[ch]. Moved gimp_brush_[get|set]_[opacity|paint_mode]() to paint_options.h and tool_options.c and renamed them to paint_options_*_*(). They are "global paint options" now. * app/airbrush.c * app/blend.c * app/bucket_fill.c * app/clone.c * app/convolve.c * app/eraser.c * app/ink.c * app/paintbrush.c * app/pencil.c: all paint tools' options are derived from "PaintOptions" now. Opacity and paint mode are obtained through macros which take into account the current paint options mode. * app/buildmenu.h: #include <gtk/gtk.h> * app/color_picker.c * app/text_tool.c: changed spacings. * app/gimprc.[ch]: new gimprc option "global-paint-options" * app/preferences_dialog.c: Added a "Tool Options" page. Code cleanup. Some work on the convenience constructors test site. * app/tools.c: fixed "unused variable" warning.
This commit is contained in:
parent
db3c6bdb2d
commit
ca2cbd3257
54
ChangeLog
54
ChangeLog
|
@ -1,3 +1,57 @@
|
|||
1999-04-22 Michael Natterer <mitschel@cs.tu-berlin.de>
|
||||
|
||||
First version of per-tool paint options. No PDB interface yet.
|
||||
The tool options dialog got rather big when in per-tool mode, so
|
||||
it will probably have to become a notebook.
|
||||
|
||||
It's not yet 100% consistent. If switched off, everything should
|
||||
behave exactly like before.
|
||||
|
||||
* app/Makefile.am
|
||||
* app/paint_options.h: new file
|
||||
|
||||
* app/tool_options.c: PaintOptions gui. Maintain a list of all
|
||||
paint tools' ToolOptions to enable switching between global and
|
||||
per-tool paint options.
|
||||
|
||||
* app/brush_select.[ch]: changed packing boxes, tables, ...
|
||||
The paint options in the brush selection can be hidden now.
|
||||
Moved create_paint_mode_menu() to paint_options.h and
|
||||
tool_options.c and renamed it to paint_mode_menu_new().
|
||||
|
||||
* app/gimage_mask.c
|
||||
* app/gimpbrush.[ch]
|
||||
* app/gimpbrushlist.[ch]
|
||||
* app/paint_core.c: moved gimp_brush_[set|get]_spacing() from
|
||||
gimpbrushlist.[ch] to gimpbrush.[ch].
|
||||
Moved gimp_brush_[get|set]_[opacity|paint_mode]() to
|
||||
paint_options.h and tool_options.c and renamed them to
|
||||
paint_options_*_*(). They are "global paint options" now.
|
||||
|
||||
* app/airbrush.c
|
||||
* app/blend.c
|
||||
* app/bucket_fill.c
|
||||
* app/clone.c
|
||||
* app/convolve.c
|
||||
* app/eraser.c
|
||||
* app/ink.c
|
||||
* app/paintbrush.c
|
||||
* app/pencil.c: all paint tools' options are derived from
|
||||
"PaintOptions" now. Opacity and paint mode are obtained through
|
||||
macros which take into account the current paint options mode.
|
||||
|
||||
* app/buildmenu.h: #include <gtk/gtk.h>
|
||||
|
||||
* app/color_picker.c
|
||||
* app/text_tool.c: changed spacings.
|
||||
|
||||
* app/gimprc.[ch]: new gimprc option "global-paint-options"
|
||||
|
||||
* app/preferences_dialog.c: Added a "Tool Options" page. Code
|
||||
cleanup. Some work on the convenience constructors test site.
|
||||
|
||||
* app/tools.c: fixed "unused variable" warning.
|
||||
|
||||
Thu Apr 22 16:05:10 1999 ape@lrdpf.spacetec.no (Asbjorn Pettersen)
|
||||
|
||||
* plug-ins/CEL/CEL.c:
|
||||
|
|
|
@ -273,6 +273,7 @@ gimp_SOURCES = \
|
|||
paint_core.h \
|
||||
paint_funcs.c \
|
||||
paint_funcs.h \
|
||||
paint_options.h \
|
||||
paintbrush.c \
|
||||
paintbrush.h \
|
||||
parasite_cmds.c \
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "gdisplay.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "paint_core.h"
|
||||
#include "paint_options.h"
|
||||
#include "palette.h"
|
||||
#include "airbrush.h"
|
||||
#include "selection.h"
|
||||
|
@ -50,7 +51,7 @@ struct _AirbrushTimeout
|
|||
typedef struct _AirbrushOptions AirbrushOptions;
|
||||
struct _AirbrushOptions
|
||||
{
|
||||
ToolOptions tool_options;
|
||||
PaintOptions paint_options;
|
||||
|
||||
double rate;
|
||||
double rate_d;
|
||||
|
@ -85,6 +86,8 @@ airbrush_options_reset (void)
|
|||
{
|
||||
AirbrushOptions *options = airbrush_options;
|
||||
|
||||
paint_options_reset ((PaintOptions *) options);
|
||||
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->rate_w),
|
||||
options->rate_d);
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->pressure_w),
|
||||
|
@ -103,18 +106,18 @@ airbrush_options_new (void)
|
|||
|
||||
/* the new airbrush tool options structure */
|
||||
options = (AirbrushOptions *) g_malloc (sizeof (AirbrushOptions));
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
_("Airbrush Options"),
|
||||
airbrush_options_reset);
|
||||
paint_options_init ((PaintOptions *) options,
|
||||
AIRBRUSH,
|
||||
airbrush_options_reset);
|
||||
options->rate = options->rate_d = 80.0;
|
||||
options->pressure = options->pressure_d = 10.0;
|
||||
|
||||
/* the main vbox */
|
||||
vbox = options->tool_options.main_vbox;
|
||||
vbox = ((ToolOptions *) options)->main_vbox;
|
||||
|
||||
/* the rate scale */
|
||||
table = gtk_table_new (2, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 6);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 1);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
||||
|
||||
|
@ -296,8 +299,8 @@ airbrush_motion (PaintCore *paint_core,
|
|||
/* paste the newly painted area to the image */
|
||||
paint_core_paste_canvas (paint_core, drawable,
|
||||
opacity,
|
||||
(int) (gimp_brush_get_opacity () * 255),
|
||||
gimp_brush_get_paint_mode (),
|
||||
(int) (PAINT_OPTIONS_GET_OPACITY (airbrush_options) * 255),
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (airbrush_options),
|
||||
SOFT, CONSTANT);
|
||||
}
|
||||
|
||||
|
|
98
app/blend.c
98
app/blend.c
|
@ -33,6 +33,7 @@
|
|||
#include "gradient.h"
|
||||
#include "interface.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "paint_options.h"
|
||||
#include "palette.h"
|
||||
#include "selection.h"
|
||||
#include "tool_options_ui.h"
|
||||
|
@ -75,15 +76,7 @@ struct _BlendTool
|
|||
typedef struct _BlendOptions BlendOptions;
|
||||
struct _BlendOptions
|
||||
{
|
||||
ToolOptions tool_options;
|
||||
|
||||
double opacity;
|
||||
double opacity_d;
|
||||
GtkObject *opacity_w;
|
||||
|
||||
int paint_mode;
|
||||
int paint_mode_d;
|
||||
GtkWidget *paint_mode_w;
|
||||
PaintOptions paint_options;
|
||||
|
||||
double offset;
|
||||
double offset_d;
|
||||
|
@ -152,7 +145,6 @@ static PixelRegion distR =
|
|||
/* local function prototypes */
|
||||
static void gradient_type_callback (GtkWidget *, gpointer);
|
||||
static void blend_mode_callback (GtkWidget *, gpointer);
|
||||
static void paint_mode_callback (GtkWidget *, gpointer);
|
||||
static void repeat_type_callback (GtkWidget *, gpointer);
|
||||
|
||||
static void blend_button_press (Tool *, GdkEventButton *, gpointer);
|
||||
|
@ -203,13 +195,6 @@ static void calc_hsv_to_rgb(double *h, double *s, double *v);
|
|||
|
||||
/* functions */
|
||||
|
||||
static void
|
||||
paint_mode_callback (GtkWidget *w,
|
||||
gpointer client_data)
|
||||
{
|
||||
blend_options->paint_mode = (long) client_data;
|
||||
}
|
||||
|
||||
static void
|
||||
blend_mode_callback (GtkWidget *w,
|
||||
gpointer client_data)
|
||||
|
@ -238,10 +223,7 @@ blend_options_reset ()
|
|||
{
|
||||
BlendOptions *options = blend_options;
|
||||
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (blend_options->opacity_w),
|
||||
blend_options->opacity_d);
|
||||
options->paint_mode = options->paint_mode_d;
|
||||
gtk_option_menu_set_history (GTK_OPTION_MENU (options->paint_mode_w), 0);
|
||||
paint_options_reset ((PaintOptions *) options);
|
||||
|
||||
options->blend_mode = options->blend_mode_d;
|
||||
options->gradient_type = options->gradient_type_d;
|
||||
|
@ -272,7 +254,6 @@ blend_options_new ()
|
|||
GtkWidget *menu;
|
||||
GtkWidget *table;
|
||||
GtkWidget *scale;
|
||||
GtkWidget *separator;
|
||||
GtkWidget *frame;
|
||||
|
||||
static MenuItem blend_option_items[] =
|
||||
|
@ -326,11 +307,9 @@ blend_options_new ()
|
|||
|
||||
/* the new blend tool options structure */
|
||||
options = (BlendOptions *) g_malloc (sizeof (BlendOptions));
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
_("Blend Options"),
|
||||
blend_options_reset);
|
||||
options->opacity = options->opacity_d = 100.0;
|
||||
options->paint_mode = options->paint_mode_d = NORMAL;
|
||||
paint_options_init ((PaintOptions *) options,
|
||||
BLEND,
|
||||
blend_options_reset);
|
||||
options->offset = options->offset_d = 0.0;
|
||||
options->blend_mode = options->blend_mode_d = FG_BG_RGB_MODE;
|
||||
options->gradient_type = options->gradient_type_d = LINEAR;
|
||||
|
@ -340,62 +319,13 @@ blend_options_new ()
|
|||
options->threshold = options->threshold_d = 0.2;
|
||||
|
||||
/* the main vbox */
|
||||
vbox = options->tool_options.main_vbox;
|
||||
|
||||
/* the opacity scale */
|
||||
table = gtk_table_new (2, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 6);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0);
|
||||
|
||||
label = gtk_label_new (_("Opacity:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 1.0);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
options->opacity_w =
|
||||
gtk_adjustment_new (options->opacity_d, 0.0, 100.0, 1.0, 1.0, 0.0);
|
||||
gtk_signal_connect (GTK_OBJECT (options->opacity_w), "value_changed",
|
||||
(GtkSignalFunc) tool_options_double_adjustment_update,
|
||||
&options->opacity);
|
||||
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);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), scale, 1, 2, 0, 1);
|
||||
gtk_widget_show (scale);
|
||||
|
||||
/* the paint mode menu */
|
||||
label = gtk_label_new (_("Mode:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
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.0, 0.5, 0.0, 0.0);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), abox, 1, 2, 1, 2);
|
||||
gtk_widget_show (abox);
|
||||
|
||||
options->paint_mode_w = gtk_option_menu_new ();
|
||||
gtk_container_add (GTK_CONTAINER (abox), options->paint_mode_w);
|
||||
gtk_widget_show (options->paint_mode_w);
|
||||
|
||||
menu = create_paint_mode_menu (paint_mode_callback, NULL);
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (options->paint_mode_w), menu);
|
||||
|
||||
/* show the table */
|
||||
gtk_widget_show (table);
|
||||
|
||||
/* a separator after the paint mode options */
|
||||
separator = gtk_hseparator_new ();
|
||||
gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, FALSE, 0);
|
||||
gtk_widget_show (separator);
|
||||
vbox = ((ToolOptions *) options)->main_vbox;
|
||||
|
||||
/* the offset scale */
|
||||
table = gtk_table_new (4, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 6);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 1);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 3);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0);
|
||||
|
||||
label = gtk_label_new (_("Offset:"));
|
||||
|
@ -497,7 +427,7 @@ blend_options_new ()
|
|||
/* table for supersampling options */
|
||||
table = gtk_table_new (2, 2, FALSE);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (table), 2);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 6);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 1);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
||||
|
||||
|
@ -633,9 +563,9 @@ blend_button_release (Tool *tool,
|
|||
&nreturn_vals,
|
||||
PDB_DRAWABLE, drawable_ID (gimage_active_drawable (gimage)),
|
||||
PDB_INT32, (gint32) blend_options->blend_mode,
|
||||
PDB_INT32, (gint32) blend_options->paint_mode,
|
||||
PDB_INT32, (gint32) PAINT_OPTIONS_GET_PAINT_MODE (blend_options),
|
||||
PDB_INT32, (gint32) blend_options->gradient_type,
|
||||
PDB_FLOAT, (gdouble) blend_options->opacity,
|
||||
PDB_FLOAT, (gdouble) PAINT_OPTIONS_GET_OPACITY (blend_options) * 100,
|
||||
PDB_FLOAT, (gdouble) blend_options->offset,
|
||||
PDB_INT32, (gint32) blend_options->repeat,
|
||||
PDB_INT32, (gint32) blend_options->supersample,
|
||||
|
@ -661,9 +591,9 @@ blend_button_release (Tool *tool,
|
|||
blend (gimage,
|
||||
gimage_active_drawable (gimage),
|
||||
blend_options->blend_mode,
|
||||
blend_options->paint_mode,
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (blend_options),
|
||||
blend_options->gradient_type,
|
||||
blend_options->opacity,
|
||||
PAINT_OPTIONS_GET_OPACITY (blend_options) * 100,
|
||||
blend_options->offset,
|
||||
blend_options->repeat,
|
||||
blend_options->supersample,
|
||||
|
|
|
@ -27,11 +27,10 @@
|
|||
#include "brush_edit.h"
|
||||
#include "brush_select.h"
|
||||
#include "brush_select.h"
|
||||
#include "buildmenu.h"
|
||||
#include "colormaps.h"
|
||||
#include "disp_callbacks.h"
|
||||
#include "errors.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "paint_options.h"
|
||||
#include "session.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
@ -85,92 +84,60 @@ static gint brush_select_events (GtkWidget *, GdkEvent *, BrushSelectP)
|
|||
static gint brush_select_resize (GtkWidget *, GdkEvent *, BrushSelectP);
|
||||
|
||||
static gint brush_select_delete_callback (GtkWidget *, GdkEvent *, gpointer);
|
||||
static void preview_scroll_update (GtkAdjustment *, gpointer);
|
||||
static void opacity_scale_update (GtkAdjustment *, gpointer);
|
||||
static void spacing_scale_update (GtkAdjustment *, gpointer);
|
||||
static void preview_scroll_update (GtkAdjustment *, gpointer);
|
||||
static void opacity_scale_update (GtkAdjustment *, gpointer);
|
||||
static void spacing_scale_update (GtkAdjustment *, gpointer);
|
||||
/* static void paint_options_toggle_callback (GtkWidget *, gpointer); */
|
||||
|
||||
/* the option menu items -- the paint modes */
|
||||
static MenuItem option_items[] =
|
||||
{
|
||||
{ N_("Normal"), 0, 0, paint_mode_menu_callback, (gpointer) NORMAL_MODE, NULL, NULL },
|
||||
{ N_("Dissolve"), 0, 0, paint_mode_menu_callback, (gpointer) DISSOLVE_MODE, NULL, NULL },
|
||||
{ N_("Behind"), 0, 0, paint_mode_menu_callback, (gpointer) BEHIND_MODE, NULL, NULL },
|
||||
{ N_("Multiply (Burn)"), 0, 0, paint_mode_menu_callback, (gpointer) MULTIPLY_MODE, NULL, NULL },
|
||||
{ N_("Divide (Dodge)"), 0, 0, paint_mode_menu_callback, (gpointer) DIVIDE_MODE, NULL, NULL },
|
||||
{ N_("Screen"), 0, 0, paint_mode_menu_callback, (gpointer) SCREEN_MODE, NULL, NULL },
|
||||
{ N_("Overlay"), 0, 0, paint_mode_menu_callback, (gpointer) OVERLAY_MODE, NULL, NULL },
|
||||
{ N_("Difference"), 0, 0, paint_mode_menu_callback, (gpointer) DIFFERENCE_MODE, NULL, NULL },
|
||||
{ N_("Addition"), 0, 0, paint_mode_menu_callback, (gpointer) ADDITION_MODE, NULL, NULL },
|
||||
{ N_("Subtract"), 0, 0, paint_mode_menu_callback, (gpointer) SUBTRACT_MODE, NULL, NULL },
|
||||
{ N_("Darken Only"), 0, 0, paint_mode_menu_callback, (gpointer) DARKEN_ONLY_MODE, NULL, NULL },
|
||||
{ N_("Lighten Only"), 0, 0, paint_mode_menu_callback, (gpointer) LIGHTEN_ONLY_MODE, NULL, NULL },
|
||||
{ N_("Hue"), 0, 0, paint_mode_menu_callback, (gpointer) HUE_MODE, NULL, NULL },
|
||||
{ N_("Saturation"), 0, 0, paint_mode_menu_callback, (gpointer) SATURATION_MODE, NULL, NULL },
|
||||
{ N_("Color"), 0, 0, paint_mode_menu_callback, (gpointer) COLOR_MODE, NULL, NULL },
|
||||
{ N_("Value"), 0, 0, paint_mode_menu_callback, (gpointer) VALUE_MODE, NULL, NULL },
|
||||
{ NULL, 0, 0, NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/* the action area structure */
|
||||
static ActionAreaItem action_items[] =
|
||||
{
|
||||
{ N_("Refresh"), brush_select_refresh_callback, NULL, NULL },
|
||||
{ N_("Close"), brush_select_close_callback, NULL, NULL }
|
||||
};
|
||||
/* local variables */
|
||||
|
||||
/* Brush editor dialog (main brush dialog only) */
|
||||
static BrushEditGeneratedWindow *brush_edit_generated_dialog;
|
||||
|
||||
/* PDB interface data */
|
||||
static int success;
|
||||
/* PDB interface data */
|
||||
static int success;
|
||||
|
||||
static GSList *active_dialogs = NULL; /* List of active dialogs */
|
||||
/* List of active dialogs */
|
||||
static GSList *active_dialogs = NULL;
|
||||
|
||||
/* The main brush dialog */
|
||||
extern BrushSelectP brush_select_dialog;
|
||||
|
||||
|
||||
extern BrushSelectP brush_select_dialog; /* The main brush dialog */
|
||||
|
||||
|
||||
GtkWidget *
|
||||
create_paint_mode_menu (MenuItemCallback callback, gpointer udata)
|
||||
{
|
||||
GtkWidget *menu;
|
||||
int i;
|
||||
|
||||
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),udata);
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
|
||||
/* If title is null then it is the main brush dialog */
|
||||
|
||||
/* If title is null then it is the main brush dialog */
|
||||
BrushSelectP
|
||||
brush_select_new (gchar * title,
|
||||
gchar *init_name, /* These are the required initial vals*/
|
||||
gdouble init_opacity, /* If init_name == NULL then
|
||||
* use current brush
|
||||
*/
|
||||
gint init_spacing,
|
||||
gint init_mode)
|
||||
brush_select_new (gchar *title,
|
||||
/* These are the required initial vals
|
||||
* If init_name == NULL then use current brush
|
||||
*/
|
||||
gchar *init_name,
|
||||
gdouble init_opacity,
|
||||
gint init_spacing,
|
||||
gint init_mode)
|
||||
{
|
||||
BrushSelectP bsp;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *sbar;
|
||||
GtkWidget *label;
|
||||
GtkWidget *menu;
|
||||
GtkWidget *sep;
|
||||
GtkWidget *table;
|
||||
GtkWidget *abox;
|
||||
GtkWidget *util_box;
|
||||
GtkWidget *option_menu;
|
||||
GtkWidget *menu;
|
||||
GtkWidget *slider;
|
||||
GimpBrushP active = NULL;
|
||||
GtkWidget *button2;
|
||||
gint gotinitbrush = FALSE;
|
||||
|
||||
static ActionAreaItem action_items[] =
|
||||
{
|
||||
{ N_("Refresh"), brush_select_refresh_callback, NULL, NULL },
|
||||
{ N_("Close"), brush_select_close_callback, NULL, NULL }
|
||||
};
|
||||
|
||||
bsp = g_malloc (sizeof (_BrushSelect));
|
||||
bsp->redraw = TRUE;
|
||||
bsp->scroll_offset = 0;
|
||||
|
@ -188,7 +155,8 @@ brush_select_new (gchar * title,
|
|||
if(!title)
|
||||
{
|
||||
gtk_window_set_title (GTK_WINDOW (bsp->shell), _("Brush Selection"));
|
||||
session_set_window_geometry (bsp->shell, &brush_select_session_info, TRUE);
|
||||
session_set_window_geometry (bsp->shell, &brush_select_session_info,
|
||||
FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -199,27 +167,37 @@ brush_select_new (gchar * title,
|
|||
gotinitbrush = TRUE;
|
||||
}
|
||||
|
||||
gtk_window_set_policy(GTK_WINDOW(bsp->shell), FALSE, TRUE, FALSE);
|
||||
vbox = gtk_vbox_new (FALSE, 1);
|
||||
gtk_container_border_width (GTK_CONTAINER (vbox), 2);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (bsp->shell)->vbox), vbox, TRUE, TRUE, 0);
|
||||
gtk_window_set_policy(GTK_WINDOW(bsp->shell), FALSE, TRUE, TRUE);
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (bsp->shell)->vbox), vbox);
|
||||
|
||||
/* handle the wm close signal */
|
||||
gtk_signal_connect (GTK_OBJECT (bsp->shell), "delete_event",
|
||||
GTK_SIGNAL_FUNC (brush_select_delete_callback),
|
||||
bsp);
|
||||
|
||||
/* The horizontal box containing preview & scrollbar & options box */
|
||||
/* The horizontal box containing the brush list & options box */
|
||||
hbox = gtk_hbox_new (FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (vbox), hbox);
|
||||
|
||||
/* A place holder for paint mode switching */
|
||||
bsp->left_box = gtk_hbox_new (FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), bsp->left_box, TRUE, TRUE, 0);
|
||||
|
||||
/* The hbox for the brush list */
|
||||
bsp->brush_selection_box = gtk_hbox_new (FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (bsp->left_box), bsp->brush_selection_box);
|
||||
|
||||
bsp->frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (bsp->frame), GTK_SHADOW_IN);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), bsp->frame, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (bsp->brush_selection_box), bsp->frame,
|
||||
TRUE, TRUE, 0);
|
||||
bsp->sbar_data = GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, MAX_WIN_HEIGHT(bsp), 1, 1, MAX_WIN_HEIGHT(bsp)));
|
||||
sbar = gtk_vscrollbar_new (bsp->sbar_data);
|
||||
gtk_signal_connect (GTK_OBJECT (bsp->sbar_data), "value_changed",
|
||||
(GtkSignalFunc) preview_scroll_update, bsp);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), sbar, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (bsp->brush_selection_box), sbar, FALSE, FALSE, 0);
|
||||
|
||||
|
||||
/* Create the brush preview window and the underlying image */
|
||||
|
@ -246,101 +224,134 @@ brush_select_new (gchar * title,
|
|||
|
||||
gtk_widget_show (sbar);
|
||||
gtk_widget_show (bsp->frame);
|
||||
gtk_widget_show (bsp->brush_selection_box);
|
||||
gtk_widget_show (bsp->left_box);
|
||||
|
||||
/* options box */
|
||||
bsp->options_box = gtk_vbox_new (TRUE, 4);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), bsp->options_box, TRUE, TRUE, 0);
|
||||
bsp->options_box = gtk_vbox_new (FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), bsp->options_box, FALSE, FALSE, 0);
|
||||
|
||||
/* Create the active brush label */
|
||||
util_box = gtk_hbox_new (FALSE, 5);
|
||||
gtk_box_pack_start (GTK_BOX (bsp->options_box), util_box, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (bsp->options_box), util_box, FALSE, FALSE, 2);
|
||||
|
||||
bsp->brush_name = gtk_label_new (_("Active"));
|
||||
gtk_box_pack_start (GTK_BOX (util_box), bsp->brush_name, FALSE, FALSE, 2);
|
||||
bsp->brush_size = gtk_label_new ("(0x0)");
|
||||
bsp->brush_size = gtk_label_new ("(0 X 0)");
|
||||
gtk_box_pack_start (GTK_BOX (util_box), bsp->brush_size, FALSE, FALSE, 2);
|
||||
|
||||
gtk_widget_show (bsp->brush_name);
|
||||
gtk_widget_show (bsp->brush_size);
|
||||
gtk_widget_show (util_box);
|
||||
|
||||
/* Create the paint mode option menu */
|
||||
util_box = gtk_hbox_new (FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (bsp->options_box), util_box, FALSE, FALSE, 0);
|
||||
label = gtk_label_new (_("Mode:"));
|
||||
gtk_box_pack_start (GTK_BOX (util_box), label, FALSE, FALSE, 2);
|
||||
menu = create_paint_mode_menu (paint_mode_menu_callback,(gpointer)bsp);
|
||||
bsp->option_menu =
|
||||
option_menu = gtk_option_menu_new ();
|
||||
gtk_box_pack_start (GTK_BOX (util_box), option_menu, FALSE, FALSE, 2);
|
||||
/* A place holder for paint mode switching */
|
||||
bsp->right_box = gtk_vbox_new (FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (bsp->options_box), bsp->right_box, TRUE, TRUE, 0);
|
||||
|
||||
gtk_widget_show (label);
|
||||
gtk_widget_show (option_menu);
|
||||
gtk_widget_show (util_box);
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu);
|
||||
/* The vbox for the paint options */
|
||||
bsp->paint_options_box = gtk_vbox_new (FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (bsp->right_box), bsp->paint_options_box,
|
||||
FALSE, FALSE, 0);
|
||||
|
||||
/* a separator before the paint options */
|
||||
sep = gtk_hseparator_new ();
|
||||
gtk_box_pack_start (GTK_BOX (bsp->paint_options_box), sep, FALSE, FALSE, 0);
|
||||
gtk_widget_show (sep);
|
||||
|
||||
/* Create the frame and the table for the options */
|
||||
table = gtk_table_new (2, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
||||
gtk_box_pack_start (GTK_BOX (bsp->paint_options_box), table, FALSE, FALSE, 2);
|
||||
|
||||
/* Create the opacity scale widget */
|
||||
util_box = gtk_hbox_new (FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (bsp->options_box), util_box, FALSE, FALSE, 0);
|
||||
label = gtk_label_new (_("Opacity:"));
|
||||
gtk_box_pack_start (GTK_BOX (util_box), label, FALSE, FALSE, 2);
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 1.0);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
bsp->opacity_data =
|
||||
GTK_ADJUSTMENT (gtk_adjustment_new ((active)?(init_opacity*100.0):100.0, 0.0, 100.0, 1.0, 1.0, 0.0));
|
||||
GTK_ADJUSTMENT (gtk_adjustment_new ((active)?(init_opacity*100.0):100.0,
|
||||
0.0, 100.0, 1.0, 1.0, 0.0));
|
||||
slider = gtk_hscale_new (bsp->opacity_data);
|
||||
gtk_box_pack_start (GTK_BOX (util_box), slider, TRUE, TRUE, 0);
|
||||
gtk_scale_set_value_pos (GTK_SCALE (slider), GTK_POS_TOP);
|
||||
gtk_range_set_update_policy (GTK_RANGE (slider), GTK_UPDATE_DELAYED);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), slider, 1, 2, 0, 1);
|
||||
gtk_signal_connect (GTK_OBJECT (bsp->opacity_data), "value_changed",
|
||||
(GtkSignalFunc) opacity_scale_update, bsp);
|
||||
|
||||
gtk_widget_show (label);
|
||||
gtk_widget_show (slider);
|
||||
gtk_widget_show (util_box);
|
||||
|
||||
util_box = gtk_hbox_new (FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (bsp->options_box), util_box, FALSE, FALSE, 0);
|
||||
label = gtk_label_new (_("Spacing:"));
|
||||
gtk_box_pack_start (GTK_BOX (util_box), label, FALSE, FALSE, 2);
|
||||
bsp->spacing_data = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 1.0, 1000.0, 1.0, 1.0, 0.0));
|
||||
slider = gtk_hscale_new (bsp->spacing_data);
|
||||
gtk_box_pack_start (GTK_BOX (util_box), slider, TRUE, TRUE, 0);
|
||||
gtk_scale_set_value_pos (GTK_SCALE (slider), GTK_POS_TOP);
|
||||
gtk_range_set_update_policy (GTK_RANGE (slider), GTK_UPDATE_DELAYED);
|
||||
gtk_signal_connect (GTK_OBJECT (bsp->spacing_data), "value_changed",
|
||||
(GtkSignalFunc) spacing_scale_update, bsp);
|
||||
|
||||
/* Create the paint mode option menu */
|
||||
label = gtk_label_new (_("Mode:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
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);
|
||||
gtk_widget_show (slider);
|
||||
gtk_widget_show (util_box);
|
||||
|
||||
abox = gtk_alignment_new (0.0, 0.5, 0.0, 0.0);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), abox, 1, 2, 1, 2);
|
||||
gtk_widget_show (abox);
|
||||
|
||||
menu = paint_mode_menu_new (paint_mode_menu_callback, (gpointer) bsp);
|
||||
bsp->option_menu = option_menu = gtk_option_menu_new ();
|
||||
gtk_container_add (GTK_CONTAINER (abox), option_menu);
|
||||
gtk_widget_show (option_menu);
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu);
|
||||
|
||||
gtk_widget_show (table);
|
||||
gtk_widget_show (bsp->paint_options_box);
|
||||
gtk_widget_show (bsp->right_box);
|
||||
|
||||
/* Create the edit/new buttons */
|
||||
util_box = gtk_hbox_new (FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (bsp->options_box), util_box, FALSE, FALSE, 0);
|
||||
util_box = gtk_hbox_new (FALSE, 0);
|
||||
gtk_box_pack_end (GTK_BOX (bsp->options_box), util_box, FALSE, FALSE, 4);
|
||||
bsp->edit_button = gtk_button_new_with_label (_("Edit Brush"));
|
||||
gtk_signal_connect (GTK_OBJECT (bsp->edit_button), "clicked",
|
||||
(GtkSignalFunc) edit_brush_callback,
|
||||
NULL);
|
||||
|
||||
/* We can only edit in the main window! (for now)*/
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (util_box), bsp->edit_button, TRUE, TRUE, 5);
|
||||
|
||||
button2 = gtk_button_new_with_label (_("New Brush"));
|
||||
gtk_signal_connect (GTK_OBJECT (button2), "clicked",
|
||||
(GtkSignalFunc) new_brush_callback,
|
||||
NULL);
|
||||
gtk_box_pack_start (GTK_BOX (util_box), button2, TRUE, TRUE, 5);
|
||||
gtk_box_pack_start (GTK_BOX (util_box), button2, TRUE, TRUE, 6);
|
||||
|
||||
gtk_widget_show (bsp->edit_button);
|
||||
gtk_widget_show (button2);
|
||||
gtk_widget_show (util_box);
|
||||
|
||||
if(title)
|
||||
/* We can only edit in the main window! (for now) */
|
||||
if (title)
|
||||
{
|
||||
gtk_widget_set_sensitive(bsp->edit_button,FALSE);
|
||||
gtk_widget_set_sensitive(button2,FALSE);
|
||||
gtk_widget_set_sensitive (bsp->edit_button, FALSE);
|
||||
gtk_widget_set_sensitive (button2, FALSE);
|
||||
}
|
||||
|
||||
/* Create the spacing scale widget */
|
||||
table = gtk_table_new (1, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_box_pack_end (GTK_BOX (bsp->options_box), table, FALSE, FALSE, 2);
|
||||
|
||||
label = gtk_label_new (_("Spacing:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 1.0);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
bsp->spacing_data =
|
||||
GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 1.0, 1000.0, 1.0, 1.0, 0.0));
|
||||
slider = gtk_hscale_new (bsp->spacing_data);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), slider, 1, 2, 0, 1);
|
||||
gtk_scale_set_value_pos (GTK_SCALE (slider), GTK_POS_TOP);
|
||||
gtk_range_set_update_policy (GTK_RANGE (slider), GTK_UPDATE_DELAYED);
|
||||
gtk_signal_connect (GTK_OBJECT (bsp->spacing_data), "value_changed",
|
||||
(GtkSignalFunc) spacing_scale_update, bsp);
|
||||
gtk_widget_show (slider);
|
||||
|
||||
gtk_widget_show (table);
|
||||
|
||||
/* The action area */
|
||||
action_items[0].user_data = bsp;
|
||||
action_items[1].user_data = bsp;
|
||||
|
@ -361,11 +372,10 @@ brush_select_new (gchar * title,
|
|||
/* render the brushes into the newly created image structure */
|
||||
display_brushes (bsp);
|
||||
|
||||
/* add callbacks to keep the display area current */
|
||||
/* Only for main dialog */
|
||||
|
||||
if(!title)
|
||||
{
|
||||
/* add callbacks to keep the display area current */
|
||||
gimp_list_foreach(GIMP_LIST(brush_list), (GFunc)connect_signals_to_brush,
|
||||
bsp);
|
||||
gtk_signal_connect (GTK_OBJECT (brush_list), "add",
|
||||
|
@ -374,6 +384,36 @@ brush_select_new (gchar * title,
|
|||
gtk_signal_connect (GTK_OBJECT (brush_list), "remove",
|
||||
(GtkSignalFunc) brush_removed_callback,
|
||||
bsp);
|
||||
|
||||
/* if we are in per-toop paint options mode, hide the paint options */
|
||||
brush_select_show_paint_options (bsp, global_paint_options);
|
||||
|
||||
/* add a toggle button which switches from global to per-tool
|
||||
* paint options mode
|
||||
*
|
||||
* FIXME: a shortcut like this would be nice but must look different
|
||||
*/
|
||||
|
||||
/*
|
||||
abox = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (bsp->shell)->action_area),
|
||||
abox, FALSE, FALSE, 0);
|
||||
|
||||
button2 = gtk_check_button_new_with_label (_("Global Paint Options"));
|
||||
gtk_container_add (GTK_CONTAINER (abox), button2);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button2),
|
||||
global_paint_options);
|
||||
gtk_signal_connect (GTK_OBJECT (button2), "toggled",
|
||||
(GtkSignalFunc) paint_options_toggle_callback, bsp);
|
||||
|
||||
gtk_widget_show (button2);
|
||||
gtk_widget_show (abox);
|
||||
|
||||
sep = gtk_vseparator_new ();
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (bsp->shell)->action_area), sep,
|
||||
FALSE, FALSE, 0);
|
||||
gtk_widget_show (sep);
|
||||
*/
|
||||
}
|
||||
|
||||
/* update the active selection */
|
||||
|
@ -391,9 +431,9 @@ brush_select_new (gchar * title,
|
|||
bsp->redraw = FALSE;
|
||||
if(!gotinitbrush)
|
||||
{
|
||||
bsp->opacity_value = gimp_brush_get_opacity();
|
||||
bsp->spacing_value = gimp_brush_get_spacing();
|
||||
bsp->paint_mode = gimp_brush_get_paint_mode();
|
||||
bsp->opacity_value = paint_options_get_opacity ();
|
||||
bsp->spacing_value = gimp_brush_get_spacing (active);
|
||||
bsp->paint_mode = paint_options_get_paint_mode ();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -416,7 +456,6 @@ brush_select_new (gchar * title,
|
|||
gtk_widget_set_sensitive (bsp->edit_button, 0);
|
||||
}
|
||||
|
||||
|
||||
return bsp;
|
||||
}
|
||||
|
||||
|
@ -459,7 +498,7 @@ brush_select_free (BrushSelectP bsp)
|
|||
}
|
||||
|
||||
void
|
||||
brush_change_callbacks(BrushSelectP bsp, gint closing)
|
||||
brush_change_callbacks (BrushSelectP bsp, gint closing)
|
||||
{
|
||||
gchar * name;
|
||||
ProcRecord *prec = NULL;
|
||||
|
@ -503,6 +542,43 @@ brush_change_callbacks(BrushSelectP bsp, gint closing)
|
|||
busy = 0;
|
||||
}
|
||||
|
||||
void
|
||||
brush_select_show_paint_options (BrushSelectP bsp,
|
||||
gboolean show)
|
||||
{
|
||||
show = show ? TRUE : FALSE;
|
||||
|
||||
if ((bsp == NULL) && ((bsp = brush_select_dialog) == NULL))
|
||||
return;
|
||||
|
||||
if (show)
|
||||
{
|
||||
if (! GTK_WIDGET_VISIBLE (bsp->paint_options_box))
|
||||
gtk_widget_show (bsp->paint_options_box);
|
||||
if (bsp->brush_selection_box->parent != bsp->left_box)
|
||||
gtk_widget_reparent (bsp->brush_selection_box, bsp->left_box);
|
||||
gtk_box_set_child_packing (GTK_BOX (bsp->options_box->parent),
|
||||
bsp->options_box,
|
||||
FALSE, FALSE, 0, GTK_PACK_START);
|
||||
gtk_box_set_child_packing (GTK_BOX (bsp->left_box->parent),
|
||||
bsp->left_box, TRUE, TRUE, 0, GTK_PACK_START);
|
||||
gtk_box_set_spacing (GTK_BOX (bsp->left_box->parent), 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GTK_WIDGET_VISIBLE (bsp->paint_options_box))
|
||||
gtk_widget_hide (bsp->paint_options_box);
|
||||
if (bsp->brush_selection_box->parent != bsp->right_box)
|
||||
gtk_widget_reparent (bsp->brush_selection_box, bsp->right_box);
|
||||
gtk_box_set_child_packing (GTK_BOX (bsp->options_box->parent),
|
||||
bsp->options_box,
|
||||
TRUE, TRUE, 0, GTK_PACK_START);
|
||||
gtk_box_set_child_packing (GTK_BOX (bsp->left_box->parent),
|
||||
bsp->left_box, FALSE, FALSE, 0, GTK_PACK_START);
|
||||
gtk_box_set_spacing (GTK_BOX (bsp->left_box->parent), 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
brush_select_brush_changed(BrushSelectP bsp, GimpBrushP brush)
|
||||
{
|
||||
|
@ -866,7 +942,7 @@ brush_select_resize (GtkWidget *widget,
|
|||
|
||||
/* update the display */
|
||||
if (bsp->redraw)
|
||||
gtk_widget_draw (bsp->preview, NULL);
|
||||
gtk_widget_draw (bsp->preview, NULL);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -894,7 +970,7 @@ update_active_brush_field (BrushSelectP bsp)
|
|||
|
||||
/* Set brush spacing */
|
||||
if(bsp == brush_select_dialog)
|
||||
bsp->spacing_data->value = gimp_brush_get_spacing ();
|
||||
bsp->spacing_data->value = gimp_brush_get_spacing (brush);
|
||||
else
|
||||
bsp->spacing_data->value = bsp->spacing_value = brush->spacing;
|
||||
|
||||
|
@ -1141,7 +1217,7 @@ paint_mode_menu_callback (GtkWidget *w,
|
|||
BrushSelectP bsp = (BrushSelectP)gtk_object_get_user_data(GTK_OBJECT(w));
|
||||
|
||||
if(bsp == brush_select_dialog)
|
||||
gimp_brush_set_paint_mode ((int) client_data);
|
||||
paint_options_set_paint_mode ((int) client_data);
|
||||
else
|
||||
{
|
||||
bsp->paint_mode = (int) client_data;
|
||||
|
@ -1157,7 +1233,7 @@ opacity_scale_update (GtkAdjustment *adjustment,
|
|||
BrushSelectP bsp = (BrushSelectP)data;
|
||||
|
||||
if(bsp == brush_select_dialog)
|
||||
gimp_brush_set_opacity (adjustment->value / 100.0);
|
||||
paint_options_set_opacity (adjustment->value / 100.0);
|
||||
else
|
||||
{
|
||||
bsp->opacity_value = (adjustment->value / 100.0);
|
||||
|
@ -1173,7 +1249,7 @@ spacing_scale_update (GtkAdjustment *adjustment,
|
|||
BrushSelectP bsp = (BrushSelectP)data;
|
||||
|
||||
if(bsp == brush_select_dialog)
|
||||
gimp_brush_set_spacing ((int) adjustment->value);
|
||||
gimp_brush_set_spacing (get_active_brush(), (int) adjustment->value);
|
||||
else
|
||||
{
|
||||
if(bsp->spacing_value != adjustment->value)
|
||||
|
@ -1184,6 +1260,15 @@ spacing_scale_update (GtkAdjustment *adjustment,
|
|||
}
|
||||
}
|
||||
|
||||
/* not used
|
||||
static void
|
||||
paint_options_toggle_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
paint_options_set_global (GTK_TOGGLE_BUTTON (widget)->active);
|
||||
}
|
||||
*/
|
||||
|
||||
/* Close active dialogs that no longer have PDB registered for them */
|
||||
|
||||
void
|
||||
|
|
|
@ -18,60 +18,81 @@
|
|||
#ifndef __BRUSH_SELECT_H__
|
||||
#define __BRUSH_SELECT_H__
|
||||
|
||||
#include "procedural_db.h"
|
||||
#include "buildmenu.h"
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "gimpbrush.h"
|
||||
#include "procedural_db.h"
|
||||
|
||||
typedef struct _BrushSelect _BrushSelect, *BrushSelectP;
|
||||
|
||||
struct _BrushSelect {
|
||||
GtkWidget *shell;
|
||||
|
||||
/* Place holders which enable global<->per-tool paint options switching */
|
||||
GtkWidget *left_box;
|
||||
GtkWidget *right_box;
|
||||
GtkWidget *brush_selection_box;
|
||||
GtkWidget *paint_options_box;
|
||||
|
||||
GtkWidget *frame;
|
||||
GtkWidget *preview;
|
||||
GtkWidget *brush_name;
|
||||
GtkWidget *brush_size;
|
||||
GtkWidget *options_box;
|
||||
|
||||
GtkAdjustment *opacity_data;
|
||||
GtkAdjustment *spacing_data;
|
||||
GtkAdjustment *sbar_data;
|
||||
GtkWidget *edit_button;
|
||||
GtkWidget *option_menu;
|
||||
int width, height;
|
||||
int cell_width, cell_height;
|
||||
int scroll_offset;
|
||||
int redraw;
|
||||
/* Brush preview */
|
||||
|
||||
/* Brush preview */
|
||||
GtkWidget *brush_popup;
|
||||
GtkWidget *brush_preview;
|
||||
|
||||
/* Call back function name */
|
||||
gchar * callback_name;
|
||||
/* current brush */
|
||||
gchar *callback_name;
|
||||
|
||||
/* Current brush */
|
||||
GimpBrushP brush;
|
||||
/* Stuff for current selection */
|
||||
int old_row;
|
||||
int old_col;
|
||||
gint spacing_value;
|
||||
|
||||
/* Current paint options */
|
||||
gdouble opacity_value;
|
||||
gint spacing_value;
|
||||
gint paint_mode;
|
||||
/* To calc column pos. */
|
||||
gint paint_mode;
|
||||
|
||||
/* Some variables to keep the GUI consistent */
|
||||
int width, height;
|
||||
int cell_width, cell_height;
|
||||
int scroll_offset;
|
||||
int redraw;
|
||||
int old_row;
|
||||
int old_col;
|
||||
gint NUM_BRUSH_COLUMNS;
|
||||
gint NUM_BRUSH_ROWS;
|
||||
};
|
||||
|
||||
BrushSelectP brush_select_new (gchar *,
|
||||
gchar *, /* These are the required initial vals*/
|
||||
gdouble, /* If init_name == NULL then
|
||||
* use current brush
|
||||
*/
|
||||
gint,
|
||||
gint);
|
||||
void brush_select_select (BrushSelectP, int);
|
||||
void brush_select_free (BrushSelectP);
|
||||
void brush_change_callbacks (BrushSelectP,gint);
|
||||
void brushes_check_dialogs(void);
|
||||
BrushSelectP brush_select_new (gchar *title,
|
||||
/* These are the required initial vals
|
||||
* If init_name == NULL then use current brush
|
||||
*/
|
||||
gchar *init_name,
|
||||
gdouble init_opacity,
|
||||
gint init_spacing,
|
||||
gint init_mode);
|
||||
|
||||
/* An interface to other dialogs which need to create a paint mode menu */
|
||||
GtkWidget * create_paint_mode_menu (MenuItemCallback, gpointer);
|
||||
void brush_select_free (BrushSelectP bsp);
|
||||
|
||||
void brush_select_select (BrushSelectP bsp,
|
||||
int index);
|
||||
|
||||
void brush_change_callbacks (BrushSelectP bsp,
|
||||
gint closing);
|
||||
void brushes_check_dialogs (void);
|
||||
|
||||
/* show/hide paint options (main brush dialog if bsp == NULL) */
|
||||
void brush_select_show_paint_options (BrushSelectP bsp,
|
||||
gboolean show);
|
||||
|
||||
/* PDB entry */
|
||||
extern ProcRecord brushes_popup_proc;
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "gimage_mask.h"
|
||||
#include "interface.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "paint_options.h"
|
||||
#include "palette.h"
|
||||
#include "patterns.h"
|
||||
#include "selection.h"
|
||||
|
@ -47,15 +48,7 @@ struct _BucketTool
|
|||
typedef struct _BucketOptions BucketOptions;
|
||||
struct _BucketOptions
|
||||
{
|
||||
ToolOptions tool_options;
|
||||
|
||||
double opacity;
|
||||
double opacity_d;
|
||||
GtkObject *opacity_w;
|
||||
|
||||
int paint_mode;
|
||||
int paint_mode_d;
|
||||
GtkWidget *paint_mode_w;
|
||||
PaintOptions paint_options;
|
||||
|
||||
double threshold;
|
||||
double threshold_d;
|
||||
|
@ -100,23 +93,12 @@ bucket_fill_mode_callback (GtkWidget *widget,
|
|||
bucket_options->fill_mode = (BucketFillMode) client_data;
|
||||
}
|
||||
|
||||
static void
|
||||
bucket_fill_paint_mode_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
bucket_options->paint_mode = (long) client_data;
|
||||
}
|
||||
|
||||
static void
|
||||
bucket_options_reset (void)
|
||||
{
|
||||
BucketOptions *options = bucket_options;
|
||||
|
||||
options->paint_mode = options->paint_mode_d;
|
||||
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->opacity_w),
|
||||
options->opacity_d);
|
||||
gtk_option_menu_set_history (GTK_OPTION_MENU (options->paint_mode_w), 0);
|
||||
paint_options_reset ((PaintOptions *) options);
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->sample_merged_w),
|
||||
options->sample_merged_d);
|
||||
|
@ -134,17 +116,13 @@ bucket_options_new (void)
|
|||
BucketOptions *options;
|
||||
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *table;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *abox;
|
||||
GtkWidget *label;
|
||||
GtkWidget *scale;
|
||||
GtkWidget *menu;
|
||||
GSList *group = NULL;
|
||||
GtkWidget *radio_frame;
|
||||
GtkWidget *radio_box;
|
||||
GtkWidget *radio_button;
|
||||
GtkWidget *separator;
|
||||
|
||||
int i;
|
||||
char *button_names[2] =
|
||||
|
@ -155,69 +133,18 @@ bucket_options_new (void)
|
|||
|
||||
/* the new bucket fill tool options structure */
|
||||
options = (BucketOptions *) g_malloc (sizeof (BucketOptions));
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
_("Bucket Fill Options"),
|
||||
bucket_options_reset);
|
||||
options->opacity = options->opacity_d = 100.0;
|
||||
options->paint_mode = options->paint_mode_d = NORMAL;
|
||||
paint_options_init ((PaintOptions *) options,
|
||||
BUCKET_FILL,
|
||||
bucket_options_reset);
|
||||
options->sample_merged = options->sample_merged_d = FALSE;
|
||||
options->threshold = options->threshold_d = 15.0;
|
||||
options->fill_mode = options->fill_mode_d = FG_BUCKET_FILL;
|
||||
|
||||
/* the main vbox */
|
||||
vbox = options->tool_options.main_vbox;
|
||||
|
||||
/* the opacity scale */
|
||||
table = gtk_table_new (2, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 6);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
||||
|
||||
label = gtk_label_new (_("Opacity:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 1.0);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
options->opacity_w =
|
||||
gtk_adjustment_new (options->opacity_d, 0.0, 100.0, 1.0, 1.0, 0.0);
|
||||
scale = gtk_hscale_new (GTK_ADJUSTMENT (options->opacity_w));
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), scale, 1, 2, 0, 1);
|
||||
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->opacity_w), "value_changed",
|
||||
(GtkSignalFunc) tool_options_double_adjustment_update,
|
||||
&options->opacity);
|
||||
gtk_widget_show (scale);
|
||||
|
||||
/* the paint mode menu */
|
||||
label = gtk_label_new (_("Mode:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
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.0, 0.5, 0.0, 0.0);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), abox, 1, 2, 1, 2);
|
||||
gtk_widget_show (abox);
|
||||
|
||||
options->paint_mode_w = gtk_option_menu_new ();
|
||||
gtk_container_add (GTK_CONTAINER (abox), options->paint_mode_w);
|
||||
gtk_widget_show (options->paint_mode_w);
|
||||
|
||||
menu = create_paint_mode_menu (bucket_fill_paint_mode_callback, NULL);
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (options->paint_mode_w), menu);
|
||||
|
||||
/* show the table */
|
||||
gtk_widget_show (table);
|
||||
|
||||
/* a separator after the paint mode options */
|
||||
separator = gtk_hseparator_new ();
|
||||
gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, FALSE, 0);
|
||||
gtk_widget_show (separator);
|
||||
vbox = ((ToolOptions *) options)->main_vbox;
|
||||
|
||||
/* the threshold scale */
|
||||
hbox = gtk_hbox_new (FALSE, 6);
|
||||
hbox = gtk_hbox_new (FALSE, 4);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
|
||||
label = gtk_label_new (_("Threshold:"));
|
||||
|
@ -335,8 +262,8 @@ bucket_fill_button_release (Tool *tool,
|
|||
&nreturn_vals,
|
||||
PDB_DRAWABLE, drawable_ID (gimage_active_drawable (gdisp->gimage)),
|
||||
PDB_INT32, (gint32) fill_mode,
|
||||
PDB_INT32, (gint32) bucket_options->paint_mode,
|
||||
PDB_FLOAT, (gdouble) bucket_options->opacity,
|
||||
PDB_INT32, (gint32) PAINT_OPTIONS_GET_PAINT_MODE (bucket_options),
|
||||
PDB_FLOAT, (gdouble) PAINT_OPTIONS_GET_OPACITY (bucket_options) * 100,
|
||||
PDB_FLOAT, (gdouble) bucket_options->threshold,
|
||||
PDB_INT32, (gint32) bucket_options->sample_merged,
|
||||
PDB_FLOAT, (gdouble) bucket_tool->target_x,
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
#ifndef __BUILDMENU_H__
|
||||
#define __BUILDMENU_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#define PULLDOWN 0
|
||||
#define POPUP 1
|
||||
#define OPTION 2
|
||||
|
|
31
app/clone.c
31
app/clone.c
|
@ -18,7 +18,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "appenv.h"
|
||||
#include "gimpbrushlist.h"
|
||||
#include "drawable.h"
|
||||
#include "errors.h"
|
||||
#include "gdisplay.h"
|
||||
|
@ -26,6 +25,7 @@
|
|||
#include "interface.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "paint_core.h"
|
||||
#include "paint_options.h"
|
||||
#include "patterns.h"
|
||||
#include "clone.h"
|
||||
#include "selection.h"
|
||||
|
@ -48,15 +48,15 @@ typedef enum
|
|||
typedef struct _CloneOptions CloneOptions;
|
||||
struct _CloneOptions
|
||||
{
|
||||
ToolOptions tool_options;
|
||||
PaintOptions paint_options;
|
||||
|
||||
CloneType type;
|
||||
CloneType type_d;
|
||||
GtkWidget *type_w[2]; /* 2 radio buttons */
|
||||
CloneType type;
|
||||
CloneType type_d;
|
||||
GtkWidget *type_w[2]; /* 2 radio buttons */
|
||||
|
||||
AlignType aligned;
|
||||
AlignType aligned_d;
|
||||
GtkWidget *aligned_w[3]; /* 3 radio buttons */
|
||||
AlignType aligned;
|
||||
AlignType aligned_d;
|
||||
GtkWidget *aligned_w[3]; /* 3 radio buttons */
|
||||
};
|
||||
|
||||
|
||||
|
@ -111,6 +111,8 @@ clone_options_reset (void)
|
|||
{
|
||||
CloneOptions *options = clone_options;
|
||||
|
||||
paint_options_reset ((PaintOptions *) options);
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->aligned_w[options->aligned_d]), TRUE);
|
||||
}
|
||||
|
@ -141,14 +143,14 @@ clone_options_new (void)
|
|||
|
||||
/* the new clone tool options structure */
|
||||
options = (CloneOptions *) g_malloc (sizeof (CloneOptions));
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
_("Clone Tool Options"),
|
||||
clone_options_reset);
|
||||
paint_options_init ((PaintOptions *) options,
|
||||
CLONE,
|
||||
clone_options_reset);
|
||||
options->type = options->type_d = IMAGE_CLONE;
|
||||
options->aligned = options->aligned_d = AlignNo;
|
||||
|
||||
/* the main vbox */
|
||||
vbox = options->tool_options.main_vbox;
|
||||
vbox = ((ToolOptions *) options)->main_vbox;
|
||||
|
||||
/* the radio frame and box */
|
||||
radio_frame = gtk_frame_new (_("Source"));
|
||||
|
@ -541,8 +543,9 @@ clone_motion (PaintCore *paint_core,
|
|||
|
||||
/* paste the newly painted canvas to the gimage which is being worked on */
|
||||
paint_core_paste_canvas (paint_core, drawable, OPAQUE_OPACITY,
|
||||
(int) (gimp_brush_get_opacity () * 255),
|
||||
gimp_brush_get_paint_mode (), SOFT, CONSTANT);
|
||||
(int) (PAINT_OPTIONS_GET_OPACITY (clone_options) * 255),
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (clone_options),
|
||||
SOFT, CONSTANT);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -145,7 +145,7 @@ color_picker_options_new (void)
|
|||
|
||||
/* the sample average options */
|
||||
table = gtk_table_new (2, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 6);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
||||
|
||||
options->sample_average_w =
|
||||
|
|
|
@ -18,13 +18,13 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "appenv.h"
|
||||
#include "gimpbrushlist.h"
|
||||
#include "drawable.h"
|
||||
#include "errors.h"
|
||||
#include "convolve.h"
|
||||
#include "gdisplay.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "paint_core.h"
|
||||
#include "paint_options.h"
|
||||
#include "selection.h"
|
||||
#include "tool_options_ui.h"
|
||||
#include "tools.h"
|
||||
|
@ -43,7 +43,7 @@
|
|||
typedef struct _ConvolveOptions ConvolveOptions;
|
||||
struct _ConvolveOptions
|
||||
{
|
||||
ToolOptions tool_options;
|
||||
PaintOptions paint_options;
|
||||
|
||||
ConvolveType type;
|
||||
ConvolveType type_d;
|
||||
|
@ -114,6 +114,8 @@ convolve_options_reset (void)
|
|||
{
|
||||
ConvolveOptions *options = convolve_options;
|
||||
|
||||
paint_options_reset ((PaintOptions *) options);
|
||||
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->pressure_w),
|
||||
options->pressure_d);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
|
||||
|
@ -143,17 +145,17 @@ convolve_options_new (void)
|
|||
|
||||
/* the new convolve tool options structure */
|
||||
options = (ConvolveOptions *) g_malloc (sizeof (ConvolveOptions));
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
_("Convolver Options"),
|
||||
convolve_options_reset);
|
||||
paint_options_init ((PaintOptions *) options,
|
||||
CONVOLVE,
|
||||
convolve_options_reset);
|
||||
options->type = options->type_d = BLUR_CONVOLVE;
|
||||
options->pressure = options->pressure_d = 50.0;
|
||||
|
||||
/* the main vbox */
|
||||
vbox = options->tool_options.main_vbox;
|
||||
vbox = ((ToolOptions *) options)->main_vbox;
|
||||
|
||||
/* the pressure scale */
|
||||
hbox = gtk_hbox_new (FALSE, 6);
|
||||
hbox = gtk_hbox_new (FALSE, 4);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
|
||||
label = gtk_label_new (_("Pressure:"));
|
||||
|
@ -346,7 +348,7 @@ convolve_motion (PaintCore *paint_core,
|
|||
|
||||
/* paste the newly painted canvas to the gimage which is being worked on */
|
||||
paint_core_replace_canvas (paint_core, drawable, OPAQUE_OPACITY,
|
||||
(int) (gimp_brush_get_opacity () * 255),
|
||||
(int) (PAINT_OPTIONS_GET_OPACITY (convolve_options) * 255),
|
||||
SOFT, INCREMENTAL);
|
||||
}
|
||||
|
||||
|
|
|
@ -137,6 +137,25 @@ gimp_brush_set_name (GimpBrush *brush, char *name)
|
|||
gtk_signal_emit(GTK_OBJECT(brush), gimp_brush_signals[RENAME]);
|
||||
}
|
||||
|
||||
int
|
||||
gimp_brush_get_spacing (GimpBrush *brush)
|
||||
{
|
||||
g_return_val_if_fail (brush != NULL, 0);
|
||||
g_return_val_if_fail (GIMP_IS_BRUSH (brush), 0);
|
||||
|
||||
return brush->spacing;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_brush_set_spacing (GimpBrush *brush,
|
||||
int spacing)
|
||||
{
|
||||
g_return_if_fail (brush != NULL);
|
||||
g_return_if_fail (GIMP_IS_BRUSH (brush));
|
||||
|
||||
brush->spacing = spacing;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_brush_load(GimpBrush *brush, char *filename)
|
||||
{
|
||||
|
|
|
@ -137,6 +137,25 @@ gimp_brush_set_name (GimpBrush *brush, char *name)
|
|||
gtk_signal_emit(GTK_OBJECT(brush), gimp_brush_signals[RENAME]);
|
||||
}
|
||||
|
||||
int
|
||||
gimp_brush_get_spacing (GimpBrush *brush)
|
||||
{
|
||||
g_return_val_if_fail (brush != NULL, 0);
|
||||
g_return_val_if_fail (GIMP_IS_BRUSH (brush), 0);
|
||||
|
||||
return brush->spacing;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_brush_set_spacing (GimpBrush *brush,
|
||||
int spacing)
|
||||
{
|
||||
g_return_if_fail (brush != NULL);
|
||||
g_return_if_fail (GIMP_IS_BRUSH (brush));
|
||||
|
||||
brush->spacing = spacing;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_brush_load(GimpBrush *brush, char *filename)
|
||||
{
|
||||
|
|
|
@ -49,11 +49,13 @@ typedef struct _GimpBrushClass GimpBrushClass;
|
|||
#define GIMP_BRUSH(obj) (GIMP_CHECK_CAST ((obj), GIMP_TYPE_BRUSH, GimpBrush))
|
||||
#define GIMP_IS_BRUSH(obj) (GIMP_CHECK_TYPE ((obj), GIMP_TYPE_BRUSH))
|
||||
|
||||
GimpBrush * gimp_brush_new (char *filename);
|
||||
void gimp_brush_load (GimpBrush *brush, char *filename);
|
||||
GtkType gimp_brush_get_type (void);
|
||||
TempBuf * gimp_brush_get_mask (GimpBrush *brush);
|
||||
char * gimp_brush_get_name (GimpBrush *brush);
|
||||
void gimp_brush_set_name (GimpBrush *brush, char *name);
|
||||
GimpBrush * gimp_brush_new (char *filename);
|
||||
void gimp_brush_load (GimpBrush *brush, char *filename);
|
||||
GtkType gimp_brush_get_type (void);
|
||||
TempBuf * gimp_brush_get_mask (GimpBrush *brush);
|
||||
char * gimp_brush_get_name (GimpBrush *brush);
|
||||
void gimp_brush_set_name (GimpBrush *brush, char *name);
|
||||
int gimp_brush_get_spacing (GimpBrush *brush);
|
||||
void gimp_brush_set_spacing (GimpBrush *brush, int spacing);
|
||||
|
||||
#endif /* __GIMPBRUSH_H__ */
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "gradient.h"
|
||||
#include "interface.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "paint_options.h"
|
||||
#include "palette.h"
|
||||
#include "selection.h"
|
||||
#include "tool_options_ui.h"
|
||||
|
@ -75,15 +76,7 @@ struct _BlendTool
|
|||
typedef struct _BlendOptions BlendOptions;
|
||||
struct _BlendOptions
|
||||
{
|
||||
ToolOptions tool_options;
|
||||
|
||||
double opacity;
|
||||
double opacity_d;
|
||||
GtkObject *opacity_w;
|
||||
|
||||
int paint_mode;
|
||||
int paint_mode_d;
|
||||
GtkWidget *paint_mode_w;
|
||||
PaintOptions paint_options;
|
||||
|
||||
double offset;
|
||||
double offset_d;
|
||||
|
@ -152,7 +145,6 @@ static PixelRegion distR =
|
|||
/* local function prototypes */
|
||||
static void gradient_type_callback (GtkWidget *, gpointer);
|
||||
static void blend_mode_callback (GtkWidget *, gpointer);
|
||||
static void paint_mode_callback (GtkWidget *, gpointer);
|
||||
static void repeat_type_callback (GtkWidget *, gpointer);
|
||||
|
||||
static void blend_button_press (Tool *, GdkEventButton *, gpointer);
|
||||
|
@ -203,13 +195,6 @@ static void calc_hsv_to_rgb(double *h, double *s, double *v);
|
|||
|
||||
/* functions */
|
||||
|
||||
static void
|
||||
paint_mode_callback (GtkWidget *w,
|
||||
gpointer client_data)
|
||||
{
|
||||
blend_options->paint_mode = (long) client_data;
|
||||
}
|
||||
|
||||
static void
|
||||
blend_mode_callback (GtkWidget *w,
|
||||
gpointer client_data)
|
||||
|
@ -238,10 +223,7 @@ blend_options_reset ()
|
|||
{
|
||||
BlendOptions *options = blend_options;
|
||||
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (blend_options->opacity_w),
|
||||
blend_options->opacity_d);
|
||||
options->paint_mode = options->paint_mode_d;
|
||||
gtk_option_menu_set_history (GTK_OPTION_MENU (options->paint_mode_w), 0);
|
||||
paint_options_reset ((PaintOptions *) options);
|
||||
|
||||
options->blend_mode = options->blend_mode_d;
|
||||
options->gradient_type = options->gradient_type_d;
|
||||
|
@ -272,7 +254,6 @@ blend_options_new ()
|
|||
GtkWidget *menu;
|
||||
GtkWidget *table;
|
||||
GtkWidget *scale;
|
||||
GtkWidget *separator;
|
||||
GtkWidget *frame;
|
||||
|
||||
static MenuItem blend_option_items[] =
|
||||
|
@ -326,11 +307,9 @@ blend_options_new ()
|
|||
|
||||
/* the new blend tool options structure */
|
||||
options = (BlendOptions *) g_malloc (sizeof (BlendOptions));
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
_("Blend Options"),
|
||||
blend_options_reset);
|
||||
options->opacity = options->opacity_d = 100.0;
|
||||
options->paint_mode = options->paint_mode_d = NORMAL;
|
||||
paint_options_init ((PaintOptions *) options,
|
||||
BLEND,
|
||||
blend_options_reset);
|
||||
options->offset = options->offset_d = 0.0;
|
||||
options->blend_mode = options->blend_mode_d = FG_BG_RGB_MODE;
|
||||
options->gradient_type = options->gradient_type_d = LINEAR;
|
||||
|
@ -340,62 +319,13 @@ blend_options_new ()
|
|||
options->threshold = options->threshold_d = 0.2;
|
||||
|
||||
/* the main vbox */
|
||||
vbox = options->tool_options.main_vbox;
|
||||
|
||||
/* the opacity scale */
|
||||
table = gtk_table_new (2, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 6);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0);
|
||||
|
||||
label = gtk_label_new (_("Opacity:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 1.0);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
options->opacity_w =
|
||||
gtk_adjustment_new (options->opacity_d, 0.0, 100.0, 1.0, 1.0, 0.0);
|
||||
gtk_signal_connect (GTK_OBJECT (options->opacity_w), "value_changed",
|
||||
(GtkSignalFunc) tool_options_double_adjustment_update,
|
||||
&options->opacity);
|
||||
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);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), scale, 1, 2, 0, 1);
|
||||
gtk_widget_show (scale);
|
||||
|
||||
/* the paint mode menu */
|
||||
label = gtk_label_new (_("Mode:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
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.0, 0.5, 0.0, 0.0);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), abox, 1, 2, 1, 2);
|
||||
gtk_widget_show (abox);
|
||||
|
||||
options->paint_mode_w = gtk_option_menu_new ();
|
||||
gtk_container_add (GTK_CONTAINER (abox), options->paint_mode_w);
|
||||
gtk_widget_show (options->paint_mode_w);
|
||||
|
||||
menu = create_paint_mode_menu (paint_mode_callback, NULL);
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (options->paint_mode_w), menu);
|
||||
|
||||
/* show the table */
|
||||
gtk_widget_show (table);
|
||||
|
||||
/* a separator after the paint mode options */
|
||||
separator = gtk_hseparator_new ();
|
||||
gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, FALSE, 0);
|
||||
gtk_widget_show (separator);
|
||||
vbox = ((ToolOptions *) options)->main_vbox;
|
||||
|
||||
/* the offset scale */
|
||||
table = gtk_table_new (4, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 6);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 1);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 3);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0);
|
||||
|
||||
label = gtk_label_new (_("Offset:"));
|
||||
|
@ -497,7 +427,7 @@ blend_options_new ()
|
|||
/* table for supersampling options */
|
||||
table = gtk_table_new (2, 2, FALSE);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (table), 2);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 6);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 1);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
||||
|
||||
|
@ -633,9 +563,9 @@ blend_button_release (Tool *tool,
|
|||
&nreturn_vals,
|
||||
PDB_DRAWABLE, drawable_ID (gimage_active_drawable (gimage)),
|
||||
PDB_INT32, (gint32) blend_options->blend_mode,
|
||||
PDB_INT32, (gint32) blend_options->paint_mode,
|
||||
PDB_INT32, (gint32) PAINT_OPTIONS_GET_PAINT_MODE (blend_options),
|
||||
PDB_INT32, (gint32) blend_options->gradient_type,
|
||||
PDB_FLOAT, (gdouble) blend_options->opacity,
|
||||
PDB_FLOAT, (gdouble) PAINT_OPTIONS_GET_OPACITY (blend_options) * 100,
|
||||
PDB_FLOAT, (gdouble) blend_options->offset,
|
||||
PDB_INT32, (gint32) blend_options->repeat,
|
||||
PDB_INT32, (gint32) blend_options->supersample,
|
||||
|
@ -661,9 +591,9 @@ blend_button_release (Tool *tool,
|
|||
blend (gimage,
|
||||
gimage_active_drawable (gimage),
|
||||
blend_options->blend_mode,
|
||||
blend_options->paint_mode,
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (blend_options),
|
||||
blend_options->gradient_type,
|
||||
blend_options->opacity,
|
||||
PAINT_OPTIONS_GET_OPACITY (blend_options) * 100,
|
||||
blend_options->offset,
|
||||
blend_options->repeat,
|
||||
blend_options->supersample,
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "appenv.h"
|
||||
#include "gimpbrushlist.h"
|
||||
#include "drawable.h"
|
||||
#include "errors.h"
|
||||
#include "floating_sel.h"
|
||||
|
@ -29,6 +28,7 @@
|
|||
#include "layer.h"
|
||||
#include "layers_dialog.h"
|
||||
#include "paint_core.h"
|
||||
#include "paint_options.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
@ -641,8 +641,8 @@ gimage_mask_stroke_paint_func (PaintCore *paint_core,
|
|||
|
||||
/* paste the newly painted canvas to the gimage which is being worked on */
|
||||
paint_core_paste_canvas (paint_core, drawable, OPAQUE_OPACITY,
|
||||
(int) (gimp_brush_get_opacity () * 255),
|
||||
gimp_brush_get_paint_mode (), SOFT, CONSTANT);
|
||||
(int) (paint_options_get_opacity () * 255),
|
||||
paint_options_get_paint_mode (), SOFT, CONSTANT);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -15,14 +15,26 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include "brush_select.h"
|
||||
#include "gimprc.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "paint_options.h"
|
||||
#include "selection_options.h"
|
||||
#include "tool_options_ui.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
#include "libgimp/gimpunitmenu.h"
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
/* ui helper functions */
|
||||
/* the global paint options */
|
||||
static double global_opacity = 1.0;
|
||||
static int global_paint_mode = 0;
|
||||
|
||||
/* a list of all PaintOptions */
|
||||
static GSList *paint_options_list = NULL;
|
||||
|
||||
|
||||
/* ui helper functions ******************************************************/
|
||||
|
||||
void
|
||||
tool_options_toggle_update (GtkWidget *widget,
|
||||
|
@ -77,6 +89,16 @@ tool_options_double_adjustment_update (GtkWidget *widget,
|
|||
*val = GTK_ADJUSTMENT (widget)->value;
|
||||
}
|
||||
|
||||
void
|
||||
tool_options_opacity_adjustment_update (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
double *val;
|
||||
|
||||
val = (double *) data;
|
||||
*val = GTK_ADJUSTMENT (widget)->value / 100;
|
||||
}
|
||||
|
||||
void
|
||||
tool_options_unitmenu_update (GtkWidget *widget,
|
||||
gpointer data)
|
||||
|
@ -101,8 +123,20 @@ tool_options_unitmenu_update (GtkWidget *widget,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
tool_options_paint_mode_update (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
PaintOptions *options;
|
||||
|
||||
/* tool options functions */
|
||||
options = (PaintOptions *) gtk_object_get_user_data (GTK_OBJECT (widget));
|
||||
|
||||
if (options)
|
||||
options->paint_mode = (long) data;
|
||||
}
|
||||
|
||||
|
||||
/* tool options functions ***************************************************/
|
||||
|
||||
void
|
||||
tool_options_init (ToolOptions *options,
|
||||
|
@ -131,7 +165,7 @@ tool_options_new (gchar *title)
|
|||
return options;
|
||||
}
|
||||
|
||||
/* selection tool options functions */
|
||||
/* selection tool options functions *****************************************/
|
||||
|
||||
void
|
||||
selection_options_init (SelectionOptions *options,
|
||||
|
@ -161,7 +195,7 @@ selection_options_init (SelectionOptions *options,
|
|||
_("Intelligent Scissors Options") :
|
||||
((tool_type == BY_COLOR_SELECT) ?
|
||||
_("By-Color Select Options") :
|
||||
_("Unknown Selection Type ???")))))))),
|
||||
_("ERROR: Unknown Selection Type")))))))),
|
||||
reset_func);
|
||||
|
||||
/* the main vbox */
|
||||
|
@ -188,7 +222,7 @@ selection_options_init (SelectionOptions *options,
|
|||
|
||||
/* the feather toggle button */
|
||||
table = gtk_table_new (2, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 6);
|
||||
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"));
|
||||
|
@ -314,7 +348,7 @@ selection_options_init (SelectionOptions *options,
|
|||
gtk_widget_show (alignment);
|
||||
|
||||
table = gtk_table_new (3, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 6);
|
||||
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);
|
||||
|
||||
|
@ -448,3 +482,280 @@ selection_options_reset (SelectionOptions *options)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* paint tool options functions *********************************************/
|
||||
|
||||
void
|
||||
paint_options_init (PaintOptions *options,
|
||||
ToolType tool_type,
|
||||
ToolOptionsResetFunc reset_func)
|
||||
{
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *abox;
|
||||
GtkWidget *table;
|
||||
GtkWidget *label;
|
||||
GtkWidget *scale;
|
||||
GtkWidget *menu;
|
||||
GtkWidget *separator;
|
||||
|
||||
/* initialize the tool options structure */
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
((tool_type == BUCKET_FILL) ?
|
||||
_("Bucket Fill Options") :
|
||||
((tool_type == BLEND) ?
|
||||
_("Blend Options") :
|
||||
((tool_type == PENCIL) ?
|
||||
_("Pencil Options") :
|
||||
((tool_type == PAINTBRUSH) ?
|
||||
_("Paintbrush Options") :
|
||||
((tool_type == ERASER) ?
|
||||
_("Erazer Options") :
|
||||
((tool_type == AIRBRUSH) ?
|
||||
_("Airbrush Options") :
|
||||
((tool_type == CLONE) ?
|
||||
_("Clone Tool Options") :
|
||||
((tool_type == CONVOLVE) ?
|
||||
_("Convolver Options") :
|
||||
((tool_type == INK) ?
|
||||
_("Ink Options") :
|
||||
_("ERROR: Unknown Paint Type")))))))))),
|
||||
reset_func);
|
||||
|
||||
/* initialize the paint options structure */
|
||||
options->opacity = options->opacity_d = 1.0;
|
||||
options->paint_mode = options->paint_mode_d = 0;
|
||||
|
||||
options->global = NULL;
|
||||
options->opacity_w = NULL;
|
||||
options->paint_mode_w = NULL;
|
||||
|
||||
/* 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 */
|
||||
label = gtk_label_new (_("Opacity:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 1.0);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
options->opacity_w =
|
||||
gtk_adjustment_new (options->opacity_d * 100, 0.0, 100.0, 1.0, 1.0, 0.0);
|
||||
gtk_signal_connect (GTK_OBJECT (options->opacity_w), "value_changed",
|
||||
(GtkSignalFunc) tool_options_opacity_adjustment_update,
|
||||
&options->opacity);
|
||||
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);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), scale, 1, 2, 0, 1);
|
||||
gtk_widget_show (scale);
|
||||
|
||||
/* the paint mode menu */
|
||||
switch (tool_type)
|
||||
{
|
||||
case BUCKET_FILL:
|
||||
case BLEND:
|
||||
case PENCIL:
|
||||
case PAINTBRUSH:
|
||||
case AIRBRUSH:
|
||||
case CLONE:
|
||||
case INK:
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 2);
|
||||
|
||||
label = gtk_label_new (_("Mode:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
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.0, 0.5, 0.0, 0.0);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), abox, 1, 2, 1, 2);
|
||||
gtk_widget_show (abox);
|
||||
|
||||
options->paint_mode_w = gtk_option_menu_new ();
|
||||
gtk_container_add (GTK_CONTAINER (abox), options->paint_mode_w);
|
||||
gtk_widget_show (options->paint_mode_w);
|
||||
|
||||
menu =
|
||||
paint_mode_menu_new (tool_options_paint_mode_update, (gpointer) options);
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (options->paint_mode_w), menu);
|
||||
break;
|
||||
case CONVOLVE:
|
||||
case ERASER:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* show the main table */
|
||||
gtk_widget_show (table);
|
||||
|
||||
/* a separator after the common paint options */
|
||||
if (tool_type != PENCIL)
|
||||
{
|
||||
separator = gtk_hseparator_new ();
|
||||
gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, FALSE, 0);
|
||||
gtk_widget_show (separator);
|
||||
}
|
||||
|
||||
if (! global_paint_options)
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
/* 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;
|
||||
GtkWidget *label;
|
||||
|
||||
options = (PaintOptions *) g_malloc (sizeof (PaintOptions));
|
||||
paint_options_init (options, tool_type, reset_func);
|
||||
|
||||
options->global = gtk_vbox_new (FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (options->tool_options.main_vbox),
|
||||
options->global, FALSE, FALSE, 0);
|
||||
|
||||
label = gtk_label_new (_("This tool has no options."));
|
||||
gtk_box_pack_start (GTK_BOX (options->global), label, FALSE, FALSE, 6);
|
||||
gtk_widget_show (label);
|
||||
|
||||
if (global_paint_options && options->global)
|
||||
gtk_widget_show (options->global);
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
void
|
||||
paint_options_reset (PaintOptions *options)
|
||||
{
|
||||
if (options->opacity_w)
|
||||
{
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->opacity_w),
|
||||
options->opacity_d * 100);
|
||||
}
|
||||
if (options->paint_mode_w)
|
||||
{
|
||||
options->paint_mode = options->paint_mode_d;
|
||||
gtk_option_menu_set_history (GTK_OPTION_MENU (options->paint_mode_w),
|
||||
options->paint_mode_d);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* 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);
|
||||
}
|
||||
|
||||
double
|
||||
paint_options_get_opacity (void)
|
||||
{
|
||||
return global_opacity;
|
||||
}
|
||||
|
||||
void
|
||||
paint_options_set_opacity (double opacity)
|
||||
{
|
||||
global_opacity = opacity;
|
||||
}
|
||||
|
||||
int
|
||||
paint_options_get_paint_mode (void)
|
||||
{
|
||||
return global_paint_mode;
|
||||
}
|
||||
|
||||
void
|
||||
paint_options_set_paint_mode (int paint_mode)
|
||||
{
|
||||
global_paint_mode = paint_mode;
|
||||
}
|
||||
|
||||
|
||||
/* create a paint mode menu *************************************************/
|
||||
|
||||
GtkWidget *
|
||||
paint_mode_menu_new (MenuItemCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWidget *menu;
|
||||
int i;
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "appenv.h"
|
||||
|
@ -26,14 +25,15 @@
|
|||
#include "interface.h"
|
||||
#include "layers_dialog.h"
|
||||
#include "layer_select.h"
|
||||
#include "paint_options.h"
|
||||
#include "session.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "libgimp/gimpchainbutton.h"
|
||||
#include "libgimp/gimpfileselection.h"
|
||||
#include "libgimp/gimpintl.h"
|
||||
#include "libgimp/gimppatheditor.h"
|
||||
#include "libgimp/gimpsizeentry.h"
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
/* preferences local functions */
|
||||
static void file_prefs_ok_callback (GtkWidget *, GtkWidget *);
|
||||
|
@ -44,7 +44,6 @@ static void file_prefs_toggle_callback (GtkWidget *, gpointer);
|
|||
static void file_prefs_preview_size_callback (GtkWidget *, gpointer);
|
||||
static void file_prefs_mem_size_unit_callback (GtkWidget *, gpointer);
|
||||
static void file_prefs_int_adjustment_callback (GtkAdjustment *, gpointer);
|
||||
/*static void file_prefs_float_adjustment_callback (GtkAdjustment *, gpointer);*/
|
||||
static void file_prefs_string_callback (GtkWidget *, gpointer);
|
||||
static void file_prefs_filename_callback (GtkWidget *, gpointer);
|
||||
static void file_prefs_path_callback (GtkWidget *, gpointer);
|
||||
|
@ -97,6 +96,7 @@ static float old_monitor_yres;
|
|||
static int old_using_xserver_resolution;
|
||||
static int old_num_processors;
|
||||
static char * old_image_title_format;
|
||||
static int old_global_paint_options;
|
||||
|
||||
/* variables which can't be changed on the fly */
|
||||
static int edit_stingy_memory_use;
|
||||
|
@ -498,6 +498,11 @@ file_prefs_save_callback (GtkWidget *widget,
|
|||
}
|
||||
if (file_prefs_strcmp (image_title_format, old_image_title_format))
|
||||
update = g_list_append (update, "image-title-format");
|
||||
if (global_paint_options != old_global_paint_options)
|
||||
{
|
||||
update = g_list_append (update, "global-paint-options");
|
||||
remove = g_list_append (remove, "no-global-paint-options");
|
||||
}
|
||||
|
||||
save_gimprc (&update, &remove);
|
||||
|
||||
|
@ -600,6 +605,8 @@ file_prefs_cancel_callback (GtkWidget *widget,
|
|||
file_prefs_strset (&edit_gradient_path, old_gradient_path);
|
||||
|
||||
file_prefs_strset (&image_title_format, old_image_title_format);
|
||||
|
||||
paint_options_set_global (old_global_paint_options);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -653,6 +660,8 @@ file_prefs_toggle_callback (GtkWidget *widget,
|
|||
gdisplays_expose_full ();
|
||||
gdisplays_flush ();
|
||||
}
|
||||
else if (data == &global_paint_options)
|
||||
paint_options_set_global (GTK_TOGGLE_BUTTON (widget)->active);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -692,18 +701,6 @@ file_prefs_int_adjustment_callback (GtkAdjustment *adj,
|
|||
*val = (int) adj->value;
|
||||
}
|
||||
|
||||
/* commented out because it's not used
|
||||
static void
|
||||
file_prefs_float_adjustment_callback (GtkAdjustment *adj,
|
||||
gpointer data)
|
||||
{
|
||||
float *val;
|
||||
|
||||
val = data;
|
||||
*val = (float) adj->value;
|
||||
}
|
||||
*/
|
||||
|
||||
static void
|
||||
file_prefs_string_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
|
@ -931,26 +928,32 @@ gimp_dialog_new (const gchar *title,
|
|||
gint allow_grow,
|
||||
gint auto_shrink,
|
||||
|
||||
/* this is an action_area button */
|
||||
gchar *label,
|
||||
GtkSignalFunc callback,
|
||||
gpointer data,
|
||||
gboolean default_action,
|
||||
gboolean connect_delete,
|
||||
/* specify action area buttons as va_list:
|
||||
* gchar *label,
|
||||
* GtkSignalFunc callback,
|
||||
* gpointer data,
|
||||
* gboolean default_action,
|
||||
* gboolean connect_delete,
|
||||
*/
|
||||
|
||||
/* more action_area buttons */
|
||||
...)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
GtkWidget *hbbox;
|
||||
GtkWidget *button;
|
||||
|
||||
/* action area variables */
|
||||
gchar *label;
|
||||
GtkSignalFunc callback;
|
||||
gpointer data;
|
||||
gboolean default_action;
|
||||
gboolean connect_delete;
|
||||
|
||||
va_list args;
|
||||
gboolean delete_connected = FALSE;
|
||||
|
||||
g_return_val_if_fail (title != NULL, NULL);
|
||||
g_return_val_if_fail (wmclass_name != NULL, NULL);
|
||||
g_return_val_if_fail (label != NULL, NULL);
|
||||
|
||||
dialog = gtk_dialog_new ();
|
||||
gtk_window_set_wmclass (GTK_WINDOW (dialog), wmclass_name, "Gimp");
|
||||
|
@ -971,9 +974,15 @@ gimp_dialog_new (const gchar *title,
|
|||
gtk_widget_show (hbbox);
|
||||
|
||||
/* the action_area buttons */
|
||||
va_start (args, connect_delete);
|
||||
va_start (args, auto_shrink);
|
||||
label = va_arg (args, gchar*);
|
||||
while (label)
|
||||
{
|
||||
callback = va_arg (args, GtkSignalFunc);
|
||||
data = va_arg (args, gpointer);
|
||||
default_action = va_arg (args, gboolean);
|
||||
connect_delete = va_arg (args, gboolean);
|
||||
|
||||
button = gtk_button_new_with_label (label);
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0);
|
||||
|
@ -1006,13 +1015,6 @@ gimp_dialog_new (const gchar *title,
|
|||
gtk_widget_show (button);
|
||||
|
||||
label = va_arg (args, gchar*);
|
||||
if (label)
|
||||
{
|
||||
callback = va_arg (args, GtkSignalFunc);
|
||||
data = va_arg (args, gpointer);
|
||||
default_action = va_arg (args, gboolean);
|
||||
connect_delete = va_arg (args, gboolean);
|
||||
}
|
||||
}
|
||||
va_end (args);
|
||||
|
||||
|
@ -1034,50 +1036,52 @@ gimp_dialog_new (const gchar *title,
|
|||
|
||||
GtkWidget*
|
||||
gimp_option_menu_new (GtkSignalFunc menu_item_callback,
|
||||
gpointer initial, /* set_data */
|
||||
gpointer initial, /* user_data */
|
||||
|
||||
/* this is a menu item */
|
||||
gchar *label,
|
||||
gpointer data,
|
||||
gpointer set_data,
|
||||
/* specify menu items as va_list:
|
||||
* gchar *label,
|
||||
* gpointer data,
|
||||
* gpointer user_data,
|
||||
*/
|
||||
|
||||
/* more menu items */
|
||||
...)
|
||||
{
|
||||
GtkWidget *menu;
|
||||
GtkWidget *menuitem;
|
||||
GtkWidget *optionmenu;
|
||||
|
||||
/* menu item variables */
|
||||
gchar *label;
|
||||
gpointer data;
|
||||
gpointer user_data;
|
||||
|
||||
va_list args;
|
||||
gint i;
|
||||
gint initial_index;
|
||||
|
||||
g_return_val_if_fail (label != NULL, NULL);
|
||||
|
||||
menu = gtk_menu_new ();
|
||||
|
||||
/* create the menu items */
|
||||
initial_index = 0;
|
||||
va_start (args, set_data);
|
||||
va_start (args, initial);
|
||||
label = va_arg (args, gchar*);
|
||||
for (i = 0; label; i++)
|
||||
{
|
||||
data = va_arg (args, gpointer);
|
||||
user_data = va_arg (args, gpointer);
|
||||
|
||||
menuitem = gtk_menu_item_new_with_label (label);
|
||||
gtk_menu_append (GTK_MENU (menu), menuitem);
|
||||
gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
|
||||
menu_item_callback, data);
|
||||
gtk_object_set_user_data (GTK_OBJECT (menuitem), set_data);
|
||||
gtk_object_set_user_data (GTK_OBJECT (menuitem), user_data);
|
||||
gtk_widget_show (menuitem);
|
||||
|
||||
/* remember the initial menu item */
|
||||
if (set_data == initial)
|
||||
if (user_data == initial)
|
||||
initial_index = i;
|
||||
|
||||
label = va_arg (args, gchar*);
|
||||
if (label)
|
||||
{
|
||||
data = va_arg (args, gpointer);
|
||||
set_data = va_arg (args, gpointer);
|
||||
}
|
||||
}
|
||||
va_end (args);
|
||||
|
||||
|
@ -1092,52 +1096,54 @@ gimp_option_menu_new (GtkSignalFunc menu_item_callback,
|
|||
|
||||
GtkWidget*
|
||||
gimp_radio_group_new (GtkSignalFunc radio_button_callback,
|
||||
gpointer initial, /* set_data */
|
||||
gpointer initial, /* user_data */
|
||||
|
||||
/* this is a radio button */
|
||||
gchar *label,
|
||||
gpointer data,
|
||||
gpointer set_data,
|
||||
/* specify radio buttons as va_list:
|
||||
* gchar *label,
|
||||
* gpointer data,
|
||||
* gpointer user_data,
|
||||
*/
|
||||
|
||||
/* more radio buttons */
|
||||
...)
|
||||
{
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *button;
|
||||
GSList *group;
|
||||
|
||||
va_list args;
|
||||
/* radio button variables */
|
||||
gchar *label;
|
||||
gpointer data;
|
||||
gpointer user_data;
|
||||
|
||||
g_return_val_if_fail (label != NULL, NULL);
|
||||
va_list args;
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 1);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
|
||||
group = NULL;
|
||||
|
||||
/* create the radio buttons */
|
||||
va_start (args, set_data);
|
||||
va_start (args, initial);
|
||||
label = va_arg (args, gchar*);
|
||||
while (label)
|
||||
{
|
||||
data = va_arg (args, gpointer);
|
||||
user_data = va_arg (args, gpointer);
|
||||
|
||||
button = gtk_radio_button_new_with_label (group, label);
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "toggled",
|
||||
(GtkSignalFunc) radio_button_callback,
|
||||
data);
|
||||
gtk_object_set_user_data (GTK_OBJECT (button), set_data);
|
||||
gtk_object_set_user_data (GTK_OBJECT (button), user_data);
|
||||
|
||||
/* press the initially active radio button */
|
||||
if (set_data == initial)
|
||||
if (user_data == initial)
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
||||
|
||||
gtk_widget_show (button);
|
||||
|
||||
label = va_arg (args, gchar*);
|
||||
if (label)
|
||||
{
|
||||
data = va_arg (args, gpointer);
|
||||
set_data = va_arg (args, gpointer);
|
||||
}
|
||||
}
|
||||
va_end (args);
|
||||
|
||||
|
@ -1302,6 +1308,7 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
GtkWidget *comboitem;
|
||||
GtkWidget *optionmenu;
|
||||
GtkWidget *table;
|
||||
GtkWidget *label;
|
||||
GSList *group;
|
||||
GtkObject *adjustment;
|
||||
|
||||
|
@ -1365,6 +1372,7 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
old_using_xserver_resolution = using_xserver_resolution;
|
||||
old_num_processors = num_processors;
|
||||
old_image_title_format = file_prefs_strdup (image_title_format);
|
||||
old_global_paint_options = global_paint_options;
|
||||
|
||||
file_prefs_strset (&old_temp_path, edit_temp_path);
|
||||
file_prefs_strset (&old_swap_path, edit_swap_path);
|
||||
|
@ -1847,6 +1855,42 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
&no_cursor_updating);
|
||||
gtk_widget_show (button);
|
||||
|
||||
/* Interface / Tool Options */
|
||||
vbox = file_prefs_notebook_append_page (GTK_NOTEBOOK (notebook),
|
||||
_("Tool Options Settings"),
|
||||
GTK_CTREE (ctree),
|
||||
_("Tool Options"),
|
||||
top_insert,
|
||||
&child_insert,
|
||||
page_index);
|
||||
gtk_widget_show (vbox);
|
||||
page_index++;
|
||||
|
||||
frame = gtk_frame_new (_("Paint Options"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
vbox2 = gtk_vbox_new (FALSE, 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox2), 2);
|
||||
gtk_container_add (GTK_CONTAINER (frame), vbox2);
|
||||
gtk_widget_show (vbox2);
|
||||
|
||||
button =
|
||||
gtk_check_button_new_with_label(_("Use Global Paint Options"));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
|
||||
global_paint_options);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "toggled",
|
||||
(GtkSignalFunc) file_prefs_toggle_callback,
|
||||
&global_paint_options);
|
||||
gtk_widget_show (button);
|
||||
|
||||
label =
|
||||
gtk_label_new (_("(Switching this off does not yet work consistently.)"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
/* Environment */
|
||||
vbox = file_prefs_notebook_append_page (GTK_NOTEBOOK (notebook),
|
||||
_("Environment Settings"),
|
||||
|
|
30
app/eraser.c
30
app/eraser.c
|
@ -17,12 +17,12 @@
|
|||
*/
|
||||
#include <stdlib.h>
|
||||
#include "appenv.h"
|
||||
#include "gimpbrushlist.h"
|
||||
#include "drawable.h"
|
||||
#include "errors.h"
|
||||
#include "gdisplay.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "paint_core.h"
|
||||
#include "paint_options.h"
|
||||
#include "palette.h"
|
||||
#include "eraser.h"
|
||||
#include "selection.h"
|
||||
|
@ -36,15 +36,15 @@
|
|||
typedef struct _EraserOptions EraserOptions;
|
||||
struct _EraserOptions
|
||||
{
|
||||
ToolOptions tool_options;
|
||||
PaintOptions paint_options;
|
||||
|
||||
gboolean hard;
|
||||
gboolean hard_d;
|
||||
GtkWidget *hard_w;
|
||||
gboolean hard;
|
||||
gboolean hard_d;
|
||||
GtkWidget *hard_w;
|
||||
|
||||
gboolean incremental;
|
||||
gboolean incremental_d;
|
||||
GtkWidget *incremental_w;
|
||||
gboolean incremental;
|
||||
gboolean incremental_d;
|
||||
GtkWidget *incremental_w;
|
||||
};
|
||||
|
||||
|
||||
|
@ -68,6 +68,8 @@ eraser_options_reset (void)
|
|||
{
|
||||
EraserOptions *options = eraser_options;
|
||||
|
||||
paint_options_reset ((PaintOptions *) options);
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->hard_w),
|
||||
options->hard_d);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->incremental_w),
|
||||
|
@ -83,14 +85,14 @@ eraser_options_new (void)
|
|||
|
||||
/* the new eraser tool options structure */
|
||||
options = (EraserOptions *) g_malloc (sizeof (EraserOptions));
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
_("Eraser Options"),
|
||||
eraser_options_reset);
|
||||
paint_options_init ((PaintOptions *) options,
|
||||
ERASER,
|
||||
eraser_options_reset);
|
||||
options->hard = options->hard_d = FALSE;
|
||||
options->incremental = options->incremental_d = FALSE;
|
||||
|
||||
/* the main vbox */
|
||||
vbox = options->tool_options.main_vbox;
|
||||
vbox = ((ToolOptions *) options)->main_vbox;
|
||||
|
||||
/* the hard toggle */
|
||||
options->hard_w = gtk_check_button_new_with_label (_("Hard edge"));
|
||||
|
@ -196,11 +198,11 @@ eraser_motion (PaintCore *paint_core,
|
|||
/* color the pixels */
|
||||
color_pixels (temp_buf_data (area), col,
|
||||
area->width * area->height, area->bytes);
|
||||
opacity = 255 * gimp_brush_get_opacity() * (paint_core->curpressure / 0.5);
|
||||
opacity = 255 * paint_options_get_opacity() * (paint_core->curpressure / 0.5);
|
||||
if(opacity > OPAQUE_OPACITY) opacity=OPAQUE_OPACITY;
|
||||
/* paste the newly painted canvas to the gimage which is being worked on */
|
||||
paint_core_paste_canvas (paint_core, drawable, opacity,
|
||||
(int) (gimp_brush_get_opacity () * 255),
|
||||
(int) (PAINT_OPTIONS_GET_OPACITY (eraser_options) * 255),
|
||||
ERASE_MODE, hard? HARD : SOFT, incremental ? INCREMENTAL : CONSTANT);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "appenv.h"
|
||||
#include "gimpbrushlist.h"
|
||||
#include "drawable.h"
|
||||
#include "errors.h"
|
||||
#include "floating_sel.h"
|
||||
|
@ -29,6 +28,7 @@
|
|||
#include "layer.h"
|
||||
#include "layers_dialog.h"
|
||||
#include "paint_core.h"
|
||||
#include "paint_options.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
@ -641,8 +641,8 @@ gimage_mask_stroke_paint_func (PaintCore *paint_core,
|
|||
|
||||
/* paste the newly painted canvas to the gimage which is being worked on */
|
||||
paint_core_paste_canvas (paint_core, drawable, OPAQUE_OPACITY,
|
||||
(int) (gimp_brush_get_opacity () * 255),
|
||||
gimp_brush_get_paint_mode (), SOFT, CONSTANT);
|
||||
(int) (paint_options_get_opacity () * 255),
|
||||
paint_options_get_paint_mode (), SOFT, CONSTANT);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -137,6 +137,25 @@ gimp_brush_set_name (GimpBrush *brush, char *name)
|
|||
gtk_signal_emit(GTK_OBJECT(brush), gimp_brush_signals[RENAME]);
|
||||
}
|
||||
|
||||
int
|
||||
gimp_brush_get_spacing (GimpBrush *brush)
|
||||
{
|
||||
g_return_val_if_fail (brush != NULL, 0);
|
||||
g_return_val_if_fail (GIMP_IS_BRUSH (brush), 0);
|
||||
|
||||
return brush->spacing;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_brush_set_spacing (GimpBrush *brush,
|
||||
int spacing)
|
||||
{
|
||||
g_return_if_fail (brush != NULL);
|
||||
g_return_if_fail (GIMP_IS_BRUSH (brush));
|
||||
|
||||
brush->spacing = spacing;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_brush_load(GimpBrush *brush, char *filename)
|
||||
{
|
||||
|
|
|
@ -49,11 +49,13 @@ typedef struct _GimpBrushClass GimpBrushClass;
|
|||
#define GIMP_BRUSH(obj) (GIMP_CHECK_CAST ((obj), GIMP_TYPE_BRUSH, GimpBrush))
|
||||
#define GIMP_IS_BRUSH(obj) (GIMP_CHECK_TYPE ((obj), GIMP_TYPE_BRUSH))
|
||||
|
||||
GimpBrush * gimp_brush_new (char *filename);
|
||||
void gimp_brush_load (GimpBrush *brush, char *filename);
|
||||
GtkType gimp_brush_get_type (void);
|
||||
TempBuf * gimp_brush_get_mask (GimpBrush *brush);
|
||||
char * gimp_brush_get_name (GimpBrush *brush);
|
||||
void gimp_brush_set_name (GimpBrush *brush, char *name);
|
||||
GimpBrush * gimp_brush_new (char *filename);
|
||||
void gimp_brush_load (GimpBrush *brush, char *filename);
|
||||
GtkType gimp_brush_get_type (void);
|
||||
TempBuf * gimp_brush_get_mask (GimpBrush *brush);
|
||||
char * gimp_brush_get_name (GimpBrush *brush);
|
||||
void gimp_brush_set_name (GimpBrush *brush, char *name);
|
||||
int gimp_brush_get_spacing (GimpBrush *brush);
|
||||
void gimp_brush_set_spacing (GimpBrush *brush, int spacing);
|
||||
|
||||
#endif /* __GIMPBRUSH_H__ */
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "gimpsignal.h"
|
||||
#include "menus.h"
|
||||
#include "paint_core.h"
|
||||
#include "paint_options.h"
|
||||
#include "gimplist.h"
|
||||
#include "gimpbrush.h"
|
||||
#include "gimplistP.h"
|
||||
|
@ -57,11 +58,7 @@
|
|||
GimpBrush *active_brush = NULL;
|
||||
GimpBrushList *brush_list = NULL;
|
||||
|
||||
double opacity = 1.0;
|
||||
int paint_mode = 0;
|
||||
|
||||
|
||||
BrushSelectP brush_select_dialog = NULL;
|
||||
BrushSelectP brush_select_dialog = NULL;
|
||||
|
||||
|
||||
/* static variables */
|
||||
|
@ -555,50 +552,6 @@ ProcRecord brushes_refresh_brush_proc =
|
|||
{ { brushes_refresh_brush_invoker } },
|
||||
};
|
||||
|
||||
/* access functions */
|
||||
double
|
||||
gimp_brush_get_opacity ()
|
||||
{
|
||||
return opacity;
|
||||
}
|
||||
|
||||
int
|
||||
gimp_brush_get_spacing ()
|
||||
{
|
||||
if (active_brush)
|
||||
return active_brush->spacing;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
gimp_brush_get_paint_mode ()
|
||||
{
|
||||
return paint_mode;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_brush_set_opacity (opac)
|
||||
double opac;
|
||||
{
|
||||
opacity = opac;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_brush_set_spacing (spac)
|
||||
int spac;
|
||||
{
|
||||
if (active_brush)
|
||||
active_brush->spacing = spac;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_brush_set_paint_mode (pm)
|
||||
int pm;
|
||||
{
|
||||
paint_mode = pm;
|
||||
}
|
||||
|
||||
/****************************/
|
||||
/* PDB Interface To Brushes */
|
||||
/****************************/
|
||||
|
@ -610,7 +563,7 @@ static Argument *
|
|||
brushes_get_opacity_invoker (Argument *args)
|
||||
{
|
||||
return_args = procedural_db_return_args (&brushes_get_opacity_proc, TRUE);
|
||||
return_args[1].value.pdb_float = gimp_brush_get_opacity () * 100.0;
|
||||
return_args[1].value.pdb_float = paint_options_get_opacity () * 100.0;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
@ -659,7 +612,7 @@ brushes_set_opacity_invoker (Argument *args)
|
|||
success = (opacity >= 0.0 && opacity <= 100.0);
|
||||
|
||||
if (success)
|
||||
gimp_brush_set_opacity (opacity / 100.0);
|
||||
paint_options_set_opacity (opacity / 100.0);
|
||||
|
||||
return procedural_db_return_args (&brushes_set_opacity_proc, success);
|
||||
}
|
||||
|
@ -703,7 +656,7 @@ static Argument *
|
|||
brushes_get_spacing_invoker (Argument *args)
|
||||
{
|
||||
return_args = procedural_db_return_args (&brushes_get_spacing_proc, TRUE);
|
||||
return_args[1].value.pdb_int = gimp_brush_get_spacing ();
|
||||
return_args[1].value.pdb_int = gimp_brush_get_spacing (get_active_brush ());
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
@ -752,7 +705,7 @@ brushes_set_spacing_invoker (Argument *args)
|
|||
success = (spacing >= 0 && spacing <= 1000);
|
||||
|
||||
if (success)
|
||||
gimp_brush_set_spacing (spacing);
|
||||
gimp_brush_set_spacing (get_active_brush (), spacing);
|
||||
|
||||
return procedural_db_return_args (&brushes_set_spacing_proc, success);
|
||||
}
|
||||
|
@ -796,7 +749,7 @@ static Argument *
|
|||
brushes_get_paint_mode_invoker (Argument *args)
|
||||
{
|
||||
return_args = procedural_db_return_args (&brushes_get_paint_mode_proc, TRUE);
|
||||
return_args[1].value.pdb_int = gimp_brush_get_paint_mode ();
|
||||
return_args[1].value.pdb_int = paint_options_get_paint_mode ();
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
@ -845,7 +798,7 @@ brushes_set_paint_mode_invoker (Argument *args)
|
|||
success = (paint_mode >= NORMAL_MODE && paint_mode <= VALUE_MODE);
|
||||
|
||||
if (success)
|
||||
gimp_brush_set_paint_mode (paint_mode);
|
||||
paint_options_set_paint_mode (paint_mode);
|
||||
|
||||
return procedural_db_return_args (&brushes_set_paint_mode_proc, success);
|
||||
}
|
||||
|
|
|
@ -55,16 +55,6 @@ GimpBrushP get_active_brush (void);
|
|||
/* TODO: {re}move this function */
|
||||
void create_brush_dialog (void);
|
||||
|
||||
/* access functions */
|
||||
/* TODO: move opacity and paint_mode into individual tools? */
|
||||
/* TODO: move spacing into gimpbrush */
|
||||
double gimp_brush_get_opacity (void);
|
||||
int gimp_brush_get_spacing (void);
|
||||
int gimp_brush_get_paint_mode (void);
|
||||
void gimp_brush_set_opacity (double);
|
||||
void gimp_brush_set_spacing (int);
|
||||
void gimp_brush_set_paint_mode (int);
|
||||
|
||||
/* Brush procedures */
|
||||
extern ProcRecord brushes_get_opacity_proc;
|
||||
extern ProcRecord brushes_set_opacity_proc;
|
||||
|
|
|
@ -148,6 +148,7 @@ float monitor_yres = 72.0;
|
|||
int using_xserver_resolution = FALSE;
|
||||
int num_processors = 1;
|
||||
char * image_title_format = NULL;
|
||||
int global_paint_options = TRUE;
|
||||
|
||||
static int get_next_token (void);
|
||||
static int peek_next_token (void);
|
||||
|
@ -279,6 +280,8 @@ static ParseFunc funcs[] =
|
|||
{ "num-processors", TT_INT, &num_processors, NULL },
|
||||
{ "image-title-format", TT_STRING, &image_title_format, NULL },
|
||||
{ "parasite", TT_XPARASITE, NULL, NULL },
|
||||
{ "global-paint-options", TT_BOOLEAN, &global_paint_options, NULL },
|
||||
{ "no-global-paint-options",TT_BOOLEAN, NULL, &global_paint_options }
|
||||
};
|
||||
static int nfuncs = sizeof (funcs) / sizeof (funcs[0]);
|
||||
|
||||
|
|
|
@ -73,6 +73,7 @@ extern float monitor_yres;
|
|||
extern int using_xserver_resolution;
|
||||
extern int num_processors;
|
||||
extern char * image_title_format;
|
||||
extern int global_paint_options;
|
||||
|
||||
|
||||
/* function prototypes */
|
||||
|
|
|
@ -27,11 +27,10 @@
|
|||
#include "brush_edit.h"
|
||||
#include "brush_select.h"
|
||||
#include "brush_select.h"
|
||||
#include "buildmenu.h"
|
||||
#include "colormaps.h"
|
||||
#include "disp_callbacks.h"
|
||||
#include "errors.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "paint_options.h"
|
||||
#include "session.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
@ -85,92 +84,60 @@ static gint brush_select_events (GtkWidget *, GdkEvent *, BrushSelectP)
|
|||
static gint brush_select_resize (GtkWidget *, GdkEvent *, BrushSelectP);
|
||||
|
||||
static gint brush_select_delete_callback (GtkWidget *, GdkEvent *, gpointer);
|
||||
static void preview_scroll_update (GtkAdjustment *, gpointer);
|
||||
static void opacity_scale_update (GtkAdjustment *, gpointer);
|
||||
static void spacing_scale_update (GtkAdjustment *, gpointer);
|
||||
static void preview_scroll_update (GtkAdjustment *, gpointer);
|
||||
static void opacity_scale_update (GtkAdjustment *, gpointer);
|
||||
static void spacing_scale_update (GtkAdjustment *, gpointer);
|
||||
/* static void paint_options_toggle_callback (GtkWidget *, gpointer); */
|
||||
|
||||
/* the option menu items -- the paint modes */
|
||||
static MenuItem option_items[] =
|
||||
{
|
||||
{ N_("Normal"), 0, 0, paint_mode_menu_callback, (gpointer) NORMAL_MODE, NULL, NULL },
|
||||
{ N_("Dissolve"), 0, 0, paint_mode_menu_callback, (gpointer) DISSOLVE_MODE, NULL, NULL },
|
||||
{ N_("Behind"), 0, 0, paint_mode_menu_callback, (gpointer) BEHIND_MODE, NULL, NULL },
|
||||
{ N_("Multiply (Burn)"), 0, 0, paint_mode_menu_callback, (gpointer) MULTIPLY_MODE, NULL, NULL },
|
||||
{ N_("Divide (Dodge)"), 0, 0, paint_mode_menu_callback, (gpointer) DIVIDE_MODE, NULL, NULL },
|
||||
{ N_("Screen"), 0, 0, paint_mode_menu_callback, (gpointer) SCREEN_MODE, NULL, NULL },
|
||||
{ N_("Overlay"), 0, 0, paint_mode_menu_callback, (gpointer) OVERLAY_MODE, NULL, NULL },
|
||||
{ N_("Difference"), 0, 0, paint_mode_menu_callback, (gpointer) DIFFERENCE_MODE, NULL, NULL },
|
||||
{ N_("Addition"), 0, 0, paint_mode_menu_callback, (gpointer) ADDITION_MODE, NULL, NULL },
|
||||
{ N_("Subtract"), 0, 0, paint_mode_menu_callback, (gpointer) SUBTRACT_MODE, NULL, NULL },
|
||||
{ N_("Darken Only"), 0, 0, paint_mode_menu_callback, (gpointer) DARKEN_ONLY_MODE, NULL, NULL },
|
||||
{ N_("Lighten Only"), 0, 0, paint_mode_menu_callback, (gpointer) LIGHTEN_ONLY_MODE, NULL, NULL },
|
||||
{ N_("Hue"), 0, 0, paint_mode_menu_callback, (gpointer) HUE_MODE, NULL, NULL },
|
||||
{ N_("Saturation"), 0, 0, paint_mode_menu_callback, (gpointer) SATURATION_MODE, NULL, NULL },
|
||||
{ N_("Color"), 0, 0, paint_mode_menu_callback, (gpointer) COLOR_MODE, NULL, NULL },
|
||||
{ N_("Value"), 0, 0, paint_mode_menu_callback, (gpointer) VALUE_MODE, NULL, NULL },
|
||||
{ NULL, 0, 0, NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/* the action area structure */
|
||||
static ActionAreaItem action_items[] =
|
||||
{
|
||||
{ N_("Refresh"), brush_select_refresh_callback, NULL, NULL },
|
||||
{ N_("Close"), brush_select_close_callback, NULL, NULL }
|
||||
};
|
||||
/* local variables */
|
||||
|
||||
/* Brush editor dialog (main brush dialog only) */
|
||||
static BrushEditGeneratedWindow *brush_edit_generated_dialog;
|
||||
|
||||
/* PDB interface data */
|
||||
static int success;
|
||||
/* PDB interface data */
|
||||
static int success;
|
||||
|
||||
static GSList *active_dialogs = NULL; /* List of active dialogs */
|
||||
/* List of active dialogs */
|
||||
static GSList *active_dialogs = NULL;
|
||||
|
||||
/* The main brush dialog */
|
||||
extern BrushSelectP brush_select_dialog;
|
||||
|
||||
|
||||
extern BrushSelectP brush_select_dialog; /* The main brush dialog */
|
||||
|
||||
|
||||
GtkWidget *
|
||||
create_paint_mode_menu (MenuItemCallback callback, gpointer udata)
|
||||
{
|
||||
GtkWidget *menu;
|
||||
int i;
|
||||
|
||||
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),udata);
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
|
||||
/* If title is null then it is the main brush dialog */
|
||||
|
||||
/* If title is null then it is the main brush dialog */
|
||||
BrushSelectP
|
||||
brush_select_new (gchar * title,
|
||||
gchar *init_name, /* These are the required initial vals*/
|
||||
gdouble init_opacity, /* If init_name == NULL then
|
||||
* use current brush
|
||||
*/
|
||||
gint init_spacing,
|
||||
gint init_mode)
|
||||
brush_select_new (gchar *title,
|
||||
/* These are the required initial vals
|
||||
* If init_name == NULL then use current brush
|
||||
*/
|
||||
gchar *init_name,
|
||||
gdouble init_opacity,
|
||||
gint init_spacing,
|
||||
gint init_mode)
|
||||
{
|
||||
BrushSelectP bsp;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *sbar;
|
||||
GtkWidget *label;
|
||||
GtkWidget *menu;
|
||||
GtkWidget *sep;
|
||||
GtkWidget *table;
|
||||
GtkWidget *abox;
|
||||
GtkWidget *util_box;
|
||||
GtkWidget *option_menu;
|
||||
GtkWidget *menu;
|
||||
GtkWidget *slider;
|
||||
GimpBrushP active = NULL;
|
||||
GtkWidget *button2;
|
||||
gint gotinitbrush = FALSE;
|
||||
|
||||
static ActionAreaItem action_items[] =
|
||||
{
|
||||
{ N_("Refresh"), brush_select_refresh_callback, NULL, NULL },
|
||||
{ N_("Close"), brush_select_close_callback, NULL, NULL }
|
||||
};
|
||||
|
||||
bsp = g_malloc (sizeof (_BrushSelect));
|
||||
bsp->redraw = TRUE;
|
||||
bsp->scroll_offset = 0;
|
||||
|
@ -188,7 +155,8 @@ brush_select_new (gchar * title,
|
|||
if(!title)
|
||||
{
|
||||
gtk_window_set_title (GTK_WINDOW (bsp->shell), _("Brush Selection"));
|
||||
session_set_window_geometry (bsp->shell, &brush_select_session_info, TRUE);
|
||||
session_set_window_geometry (bsp->shell, &brush_select_session_info,
|
||||
FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -199,27 +167,37 @@ brush_select_new (gchar * title,
|
|||
gotinitbrush = TRUE;
|
||||
}
|
||||
|
||||
gtk_window_set_policy(GTK_WINDOW(bsp->shell), FALSE, TRUE, FALSE);
|
||||
vbox = gtk_vbox_new (FALSE, 1);
|
||||
gtk_container_border_width (GTK_CONTAINER (vbox), 2);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (bsp->shell)->vbox), vbox, TRUE, TRUE, 0);
|
||||
gtk_window_set_policy(GTK_WINDOW(bsp->shell), FALSE, TRUE, TRUE);
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (bsp->shell)->vbox), vbox);
|
||||
|
||||
/* handle the wm close signal */
|
||||
gtk_signal_connect (GTK_OBJECT (bsp->shell), "delete_event",
|
||||
GTK_SIGNAL_FUNC (brush_select_delete_callback),
|
||||
bsp);
|
||||
|
||||
/* The horizontal box containing preview & scrollbar & options box */
|
||||
/* The horizontal box containing the brush list & options box */
|
||||
hbox = gtk_hbox_new (FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (vbox), hbox);
|
||||
|
||||
/* A place holder for paint mode switching */
|
||||
bsp->left_box = gtk_hbox_new (FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), bsp->left_box, TRUE, TRUE, 0);
|
||||
|
||||
/* The hbox for the brush list */
|
||||
bsp->brush_selection_box = gtk_hbox_new (FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (bsp->left_box), bsp->brush_selection_box);
|
||||
|
||||
bsp->frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (bsp->frame), GTK_SHADOW_IN);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), bsp->frame, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (bsp->brush_selection_box), bsp->frame,
|
||||
TRUE, TRUE, 0);
|
||||
bsp->sbar_data = GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, MAX_WIN_HEIGHT(bsp), 1, 1, MAX_WIN_HEIGHT(bsp)));
|
||||
sbar = gtk_vscrollbar_new (bsp->sbar_data);
|
||||
gtk_signal_connect (GTK_OBJECT (bsp->sbar_data), "value_changed",
|
||||
(GtkSignalFunc) preview_scroll_update, bsp);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), sbar, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (bsp->brush_selection_box), sbar, FALSE, FALSE, 0);
|
||||
|
||||
|
||||
/* Create the brush preview window and the underlying image */
|
||||
|
@ -246,101 +224,134 @@ brush_select_new (gchar * title,
|
|||
|
||||
gtk_widget_show (sbar);
|
||||
gtk_widget_show (bsp->frame);
|
||||
gtk_widget_show (bsp->brush_selection_box);
|
||||
gtk_widget_show (bsp->left_box);
|
||||
|
||||
/* options box */
|
||||
bsp->options_box = gtk_vbox_new (TRUE, 4);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), bsp->options_box, TRUE, TRUE, 0);
|
||||
bsp->options_box = gtk_vbox_new (FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), bsp->options_box, FALSE, FALSE, 0);
|
||||
|
||||
/* Create the active brush label */
|
||||
util_box = gtk_hbox_new (FALSE, 5);
|
||||
gtk_box_pack_start (GTK_BOX (bsp->options_box), util_box, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (bsp->options_box), util_box, FALSE, FALSE, 2);
|
||||
|
||||
bsp->brush_name = gtk_label_new (_("Active"));
|
||||
gtk_box_pack_start (GTK_BOX (util_box), bsp->brush_name, FALSE, FALSE, 2);
|
||||
bsp->brush_size = gtk_label_new ("(0x0)");
|
||||
bsp->brush_size = gtk_label_new ("(0 X 0)");
|
||||
gtk_box_pack_start (GTK_BOX (util_box), bsp->brush_size, FALSE, FALSE, 2);
|
||||
|
||||
gtk_widget_show (bsp->brush_name);
|
||||
gtk_widget_show (bsp->brush_size);
|
||||
gtk_widget_show (util_box);
|
||||
|
||||
/* Create the paint mode option menu */
|
||||
util_box = gtk_hbox_new (FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (bsp->options_box), util_box, FALSE, FALSE, 0);
|
||||
label = gtk_label_new (_("Mode:"));
|
||||
gtk_box_pack_start (GTK_BOX (util_box), label, FALSE, FALSE, 2);
|
||||
menu = create_paint_mode_menu (paint_mode_menu_callback,(gpointer)bsp);
|
||||
bsp->option_menu =
|
||||
option_menu = gtk_option_menu_new ();
|
||||
gtk_box_pack_start (GTK_BOX (util_box), option_menu, FALSE, FALSE, 2);
|
||||
/* A place holder for paint mode switching */
|
||||
bsp->right_box = gtk_vbox_new (FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (bsp->options_box), bsp->right_box, TRUE, TRUE, 0);
|
||||
|
||||
gtk_widget_show (label);
|
||||
gtk_widget_show (option_menu);
|
||||
gtk_widget_show (util_box);
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu);
|
||||
/* The vbox for the paint options */
|
||||
bsp->paint_options_box = gtk_vbox_new (FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (bsp->right_box), bsp->paint_options_box,
|
||||
FALSE, FALSE, 0);
|
||||
|
||||
/* a separator before the paint options */
|
||||
sep = gtk_hseparator_new ();
|
||||
gtk_box_pack_start (GTK_BOX (bsp->paint_options_box), sep, FALSE, FALSE, 0);
|
||||
gtk_widget_show (sep);
|
||||
|
||||
/* Create the frame and the table for the options */
|
||||
table = gtk_table_new (2, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
||||
gtk_box_pack_start (GTK_BOX (bsp->paint_options_box), table, FALSE, FALSE, 2);
|
||||
|
||||
/* Create the opacity scale widget */
|
||||
util_box = gtk_hbox_new (FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (bsp->options_box), util_box, FALSE, FALSE, 0);
|
||||
label = gtk_label_new (_("Opacity:"));
|
||||
gtk_box_pack_start (GTK_BOX (util_box), label, FALSE, FALSE, 2);
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 1.0);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
bsp->opacity_data =
|
||||
GTK_ADJUSTMENT (gtk_adjustment_new ((active)?(init_opacity*100.0):100.0, 0.0, 100.0, 1.0, 1.0, 0.0));
|
||||
GTK_ADJUSTMENT (gtk_adjustment_new ((active)?(init_opacity*100.0):100.0,
|
||||
0.0, 100.0, 1.0, 1.0, 0.0));
|
||||
slider = gtk_hscale_new (bsp->opacity_data);
|
||||
gtk_box_pack_start (GTK_BOX (util_box), slider, TRUE, TRUE, 0);
|
||||
gtk_scale_set_value_pos (GTK_SCALE (slider), GTK_POS_TOP);
|
||||
gtk_range_set_update_policy (GTK_RANGE (slider), GTK_UPDATE_DELAYED);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), slider, 1, 2, 0, 1);
|
||||
gtk_signal_connect (GTK_OBJECT (bsp->opacity_data), "value_changed",
|
||||
(GtkSignalFunc) opacity_scale_update, bsp);
|
||||
|
||||
gtk_widget_show (label);
|
||||
gtk_widget_show (slider);
|
||||
gtk_widget_show (util_box);
|
||||
|
||||
util_box = gtk_hbox_new (FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (bsp->options_box), util_box, FALSE, FALSE, 0);
|
||||
label = gtk_label_new (_("Spacing:"));
|
||||
gtk_box_pack_start (GTK_BOX (util_box), label, FALSE, FALSE, 2);
|
||||
bsp->spacing_data = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 1.0, 1000.0, 1.0, 1.0, 0.0));
|
||||
slider = gtk_hscale_new (bsp->spacing_data);
|
||||
gtk_box_pack_start (GTK_BOX (util_box), slider, TRUE, TRUE, 0);
|
||||
gtk_scale_set_value_pos (GTK_SCALE (slider), GTK_POS_TOP);
|
||||
gtk_range_set_update_policy (GTK_RANGE (slider), GTK_UPDATE_DELAYED);
|
||||
gtk_signal_connect (GTK_OBJECT (bsp->spacing_data), "value_changed",
|
||||
(GtkSignalFunc) spacing_scale_update, bsp);
|
||||
|
||||
/* Create the paint mode option menu */
|
||||
label = gtk_label_new (_("Mode:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
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);
|
||||
gtk_widget_show (slider);
|
||||
gtk_widget_show (util_box);
|
||||
|
||||
abox = gtk_alignment_new (0.0, 0.5, 0.0, 0.0);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), abox, 1, 2, 1, 2);
|
||||
gtk_widget_show (abox);
|
||||
|
||||
menu = paint_mode_menu_new (paint_mode_menu_callback, (gpointer) bsp);
|
||||
bsp->option_menu = option_menu = gtk_option_menu_new ();
|
||||
gtk_container_add (GTK_CONTAINER (abox), option_menu);
|
||||
gtk_widget_show (option_menu);
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu);
|
||||
|
||||
gtk_widget_show (table);
|
||||
gtk_widget_show (bsp->paint_options_box);
|
||||
gtk_widget_show (bsp->right_box);
|
||||
|
||||
/* Create the edit/new buttons */
|
||||
util_box = gtk_hbox_new (FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (bsp->options_box), util_box, FALSE, FALSE, 0);
|
||||
util_box = gtk_hbox_new (FALSE, 0);
|
||||
gtk_box_pack_end (GTK_BOX (bsp->options_box), util_box, FALSE, FALSE, 4);
|
||||
bsp->edit_button = gtk_button_new_with_label (_("Edit Brush"));
|
||||
gtk_signal_connect (GTK_OBJECT (bsp->edit_button), "clicked",
|
||||
(GtkSignalFunc) edit_brush_callback,
|
||||
NULL);
|
||||
|
||||
/* We can only edit in the main window! (for now)*/
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (util_box), bsp->edit_button, TRUE, TRUE, 5);
|
||||
|
||||
button2 = gtk_button_new_with_label (_("New Brush"));
|
||||
gtk_signal_connect (GTK_OBJECT (button2), "clicked",
|
||||
(GtkSignalFunc) new_brush_callback,
|
||||
NULL);
|
||||
gtk_box_pack_start (GTK_BOX (util_box), button2, TRUE, TRUE, 5);
|
||||
gtk_box_pack_start (GTK_BOX (util_box), button2, TRUE, TRUE, 6);
|
||||
|
||||
gtk_widget_show (bsp->edit_button);
|
||||
gtk_widget_show (button2);
|
||||
gtk_widget_show (util_box);
|
||||
|
||||
if(title)
|
||||
/* We can only edit in the main window! (for now) */
|
||||
if (title)
|
||||
{
|
||||
gtk_widget_set_sensitive(bsp->edit_button,FALSE);
|
||||
gtk_widget_set_sensitive(button2,FALSE);
|
||||
gtk_widget_set_sensitive (bsp->edit_button, FALSE);
|
||||
gtk_widget_set_sensitive (button2, FALSE);
|
||||
}
|
||||
|
||||
/* Create the spacing scale widget */
|
||||
table = gtk_table_new (1, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_box_pack_end (GTK_BOX (bsp->options_box), table, FALSE, FALSE, 2);
|
||||
|
||||
label = gtk_label_new (_("Spacing:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 1.0);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
bsp->spacing_data =
|
||||
GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 1.0, 1000.0, 1.0, 1.0, 0.0));
|
||||
slider = gtk_hscale_new (bsp->spacing_data);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), slider, 1, 2, 0, 1);
|
||||
gtk_scale_set_value_pos (GTK_SCALE (slider), GTK_POS_TOP);
|
||||
gtk_range_set_update_policy (GTK_RANGE (slider), GTK_UPDATE_DELAYED);
|
||||
gtk_signal_connect (GTK_OBJECT (bsp->spacing_data), "value_changed",
|
||||
(GtkSignalFunc) spacing_scale_update, bsp);
|
||||
gtk_widget_show (slider);
|
||||
|
||||
gtk_widget_show (table);
|
||||
|
||||
/* The action area */
|
||||
action_items[0].user_data = bsp;
|
||||
action_items[1].user_data = bsp;
|
||||
|
@ -361,11 +372,10 @@ brush_select_new (gchar * title,
|
|||
/* render the brushes into the newly created image structure */
|
||||
display_brushes (bsp);
|
||||
|
||||
/* add callbacks to keep the display area current */
|
||||
/* Only for main dialog */
|
||||
|
||||
if(!title)
|
||||
{
|
||||
/* add callbacks to keep the display area current */
|
||||
gimp_list_foreach(GIMP_LIST(brush_list), (GFunc)connect_signals_to_brush,
|
||||
bsp);
|
||||
gtk_signal_connect (GTK_OBJECT (brush_list), "add",
|
||||
|
@ -374,6 +384,36 @@ brush_select_new (gchar * title,
|
|||
gtk_signal_connect (GTK_OBJECT (brush_list), "remove",
|
||||
(GtkSignalFunc) brush_removed_callback,
|
||||
bsp);
|
||||
|
||||
/* if we are in per-toop paint options mode, hide the paint options */
|
||||
brush_select_show_paint_options (bsp, global_paint_options);
|
||||
|
||||
/* add a toggle button which switches from global to per-tool
|
||||
* paint options mode
|
||||
*
|
||||
* FIXME: a shortcut like this would be nice but must look different
|
||||
*/
|
||||
|
||||
/*
|
||||
abox = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (bsp->shell)->action_area),
|
||||
abox, FALSE, FALSE, 0);
|
||||
|
||||
button2 = gtk_check_button_new_with_label (_("Global Paint Options"));
|
||||
gtk_container_add (GTK_CONTAINER (abox), button2);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button2),
|
||||
global_paint_options);
|
||||
gtk_signal_connect (GTK_OBJECT (button2), "toggled",
|
||||
(GtkSignalFunc) paint_options_toggle_callback, bsp);
|
||||
|
||||
gtk_widget_show (button2);
|
||||
gtk_widget_show (abox);
|
||||
|
||||
sep = gtk_vseparator_new ();
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (bsp->shell)->action_area), sep,
|
||||
FALSE, FALSE, 0);
|
||||
gtk_widget_show (sep);
|
||||
*/
|
||||
}
|
||||
|
||||
/* update the active selection */
|
||||
|
@ -391,9 +431,9 @@ brush_select_new (gchar * title,
|
|||
bsp->redraw = FALSE;
|
||||
if(!gotinitbrush)
|
||||
{
|
||||
bsp->opacity_value = gimp_brush_get_opacity();
|
||||
bsp->spacing_value = gimp_brush_get_spacing();
|
||||
bsp->paint_mode = gimp_brush_get_paint_mode();
|
||||
bsp->opacity_value = paint_options_get_opacity ();
|
||||
bsp->spacing_value = gimp_brush_get_spacing (active);
|
||||
bsp->paint_mode = paint_options_get_paint_mode ();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -416,7 +456,6 @@ brush_select_new (gchar * title,
|
|||
gtk_widget_set_sensitive (bsp->edit_button, 0);
|
||||
}
|
||||
|
||||
|
||||
return bsp;
|
||||
}
|
||||
|
||||
|
@ -459,7 +498,7 @@ brush_select_free (BrushSelectP bsp)
|
|||
}
|
||||
|
||||
void
|
||||
brush_change_callbacks(BrushSelectP bsp, gint closing)
|
||||
brush_change_callbacks (BrushSelectP bsp, gint closing)
|
||||
{
|
||||
gchar * name;
|
||||
ProcRecord *prec = NULL;
|
||||
|
@ -503,6 +542,43 @@ brush_change_callbacks(BrushSelectP bsp, gint closing)
|
|||
busy = 0;
|
||||
}
|
||||
|
||||
void
|
||||
brush_select_show_paint_options (BrushSelectP bsp,
|
||||
gboolean show)
|
||||
{
|
||||
show = show ? TRUE : FALSE;
|
||||
|
||||
if ((bsp == NULL) && ((bsp = brush_select_dialog) == NULL))
|
||||
return;
|
||||
|
||||
if (show)
|
||||
{
|
||||
if (! GTK_WIDGET_VISIBLE (bsp->paint_options_box))
|
||||
gtk_widget_show (bsp->paint_options_box);
|
||||
if (bsp->brush_selection_box->parent != bsp->left_box)
|
||||
gtk_widget_reparent (bsp->brush_selection_box, bsp->left_box);
|
||||
gtk_box_set_child_packing (GTK_BOX (bsp->options_box->parent),
|
||||
bsp->options_box,
|
||||
FALSE, FALSE, 0, GTK_PACK_START);
|
||||
gtk_box_set_child_packing (GTK_BOX (bsp->left_box->parent),
|
||||
bsp->left_box, TRUE, TRUE, 0, GTK_PACK_START);
|
||||
gtk_box_set_spacing (GTK_BOX (bsp->left_box->parent), 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GTK_WIDGET_VISIBLE (bsp->paint_options_box))
|
||||
gtk_widget_hide (bsp->paint_options_box);
|
||||
if (bsp->brush_selection_box->parent != bsp->right_box)
|
||||
gtk_widget_reparent (bsp->brush_selection_box, bsp->right_box);
|
||||
gtk_box_set_child_packing (GTK_BOX (bsp->options_box->parent),
|
||||
bsp->options_box,
|
||||
TRUE, TRUE, 0, GTK_PACK_START);
|
||||
gtk_box_set_child_packing (GTK_BOX (bsp->left_box->parent),
|
||||
bsp->left_box, FALSE, FALSE, 0, GTK_PACK_START);
|
||||
gtk_box_set_spacing (GTK_BOX (bsp->left_box->parent), 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
brush_select_brush_changed(BrushSelectP bsp, GimpBrushP brush)
|
||||
{
|
||||
|
@ -866,7 +942,7 @@ brush_select_resize (GtkWidget *widget,
|
|||
|
||||
/* update the display */
|
||||
if (bsp->redraw)
|
||||
gtk_widget_draw (bsp->preview, NULL);
|
||||
gtk_widget_draw (bsp->preview, NULL);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -894,7 +970,7 @@ update_active_brush_field (BrushSelectP bsp)
|
|||
|
||||
/* Set brush spacing */
|
||||
if(bsp == brush_select_dialog)
|
||||
bsp->spacing_data->value = gimp_brush_get_spacing ();
|
||||
bsp->spacing_data->value = gimp_brush_get_spacing (brush);
|
||||
else
|
||||
bsp->spacing_data->value = bsp->spacing_value = brush->spacing;
|
||||
|
||||
|
@ -1141,7 +1217,7 @@ paint_mode_menu_callback (GtkWidget *w,
|
|||
BrushSelectP bsp = (BrushSelectP)gtk_object_get_user_data(GTK_OBJECT(w));
|
||||
|
||||
if(bsp == brush_select_dialog)
|
||||
gimp_brush_set_paint_mode ((int) client_data);
|
||||
paint_options_set_paint_mode ((int) client_data);
|
||||
else
|
||||
{
|
||||
bsp->paint_mode = (int) client_data;
|
||||
|
@ -1157,7 +1233,7 @@ opacity_scale_update (GtkAdjustment *adjustment,
|
|||
BrushSelectP bsp = (BrushSelectP)data;
|
||||
|
||||
if(bsp == brush_select_dialog)
|
||||
gimp_brush_set_opacity (adjustment->value / 100.0);
|
||||
paint_options_set_opacity (adjustment->value / 100.0);
|
||||
else
|
||||
{
|
||||
bsp->opacity_value = (adjustment->value / 100.0);
|
||||
|
@ -1173,7 +1249,7 @@ spacing_scale_update (GtkAdjustment *adjustment,
|
|||
BrushSelectP bsp = (BrushSelectP)data;
|
||||
|
||||
if(bsp == brush_select_dialog)
|
||||
gimp_brush_set_spacing ((int) adjustment->value);
|
||||
gimp_brush_set_spacing (get_active_brush(), (int) adjustment->value);
|
||||
else
|
||||
{
|
||||
if(bsp->spacing_value != adjustment->value)
|
||||
|
@ -1184,6 +1260,15 @@ spacing_scale_update (GtkAdjustment *adjustment,
|
|||
}
|
||||
}
|
||||
|
||||
/* not used
|
||||
static void
|
||||
paint_options_toggle_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
paint_options_set_global (GTK_TOGGLE_BUTTON (widget)->active);
|
||||
}
|
||||
*/
|
||||
|
||||
/* Close active dialogs that no longer have PDB registered for them */
|
||||
|
||||
void
|
||||
|
|
|
@ -18,60 +18,81 @@
|
|||
#ifndef __BRUSH_SELECT_H__
|
||||
#define __BRUSH_SELECT_H__
|
||||
|
||||
#include "procedural_db.h"
|
||||
#include "buildmenu.h"
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "gimpbrush.h"
|
||||
#include "procedural_db.h"
|
||||
|
||||
typedef struct _BrushSelect _BrushSelect, *BrushSelectP;
|
||||
|
||||
struct _BrushSelect {
|
||||
GtkWidget *shell;
|
||||
|
||||
/* Place holders which enable global<->per-tool paint options switching */
|
||||
GtkWidget *left_box;
|
||||
GtkWidget *right_box;
|
||||
GtkWidget *brush_selection_box;
|
||||
GtkWidget *paint_options_box;
|
||||
|
||||
GtkWidget *frame;
|
||||
GtkWidget *preview;
|
||||
GtkWidget *brush_name;
|
||||
GtkWidget *brush_size;
|
||||
GtkWidget *options_box;
|
||||
|
||||
GtkAdjustment *opacity_data;
|
||||
GtkAdjustment *spacing_data;
|
||||
GtkAdjustment *sbar_data;
|
||||
GtkWidget *edit_button;
|
||||
GtkWidget *option_menu;
|
||||
int width, height;
|
||||
int cell_width, cell_height;
|
||||
int scroll_offset;
|
||||
int redraw;
|
||||
/* Brush preview */
|
||||
|
||||
/* Brush preview */
|
||||
GtkWidget *brush_popup;
|
||||
GtkWidget *brush_preview;
|
||||
|
||||
/* Call back function name */
|
||||
gchar * callback_name;
|
||||
/* current brush */
|
||||
gchar *callback_name;
|
||||
|
||||
/* Current brush */
|
||||
GimpBrushP brush;
|
||||
/* Stuff for current selection */
|
||||
int old_row;
|
||||
int old_col;
|
||||
gint spacing_value;
|
||||
|
||||
/* Current paint options */
|
||||
gdouble opacity_value;
|
||||
gint spacing_value;
|
||||
gint paint_mode;
|
||||
/* To calc column pos. */
|
||||
gint paint_mode;
|
||||
|
||||
/* Some variables to keep the GUI consistent */
|
||||
int width, height;
|
||||
int cell_width, cell_height;
|
||||
int scroll_offset;
|
||||
int redraw;
|
||||
int old_row;
|
||||
int old_col;
|
||||
gint NUM_BRUSH_COLUMNS;
|
||||
gint NUM_BRUSH_ROWS;
|
||||
};
|
||||
|
||||
BrushSelectP brush_select_new (gchar *,
|
||||
gchar *, /* These are the required initial vals*/
|
||||
gdouble, /* If init_name == NULL then
|
||||
* use current brush
|
||||
*/
|
||||
gint,
|
||||
gint);
|
||||
void brush_select_select (BrushSelectP, int);
|
||||
void brush_select_free (BrushSelectP);
|
||||
void brush_change_callbacks (BrushSelectP,gint);
|
||||
void brushes_check_dialogs(void);
|
||||
BrushSelectP brush_select_new (gchar *title,
|
||||
/* These are the required initial vals
|
||||
* If init_name == NULL then use current brush
|
||||
*/
|
||||
gchar *init_name,
|
||||
gdouble init_opacity,
|
||||
gint init_spacing,
|
||||
gint init_mode);
|
||||
|
||||
/* An interface to other dialogs which need to create a paint mode menu */
|
||||
GtkWidget * create_paint_mode_menu (MenuItemCallback, gpointer);
|
||||
void brush_select_free (BrushSelectP bsp);
|
||||
|
||||
void brush_select_select (BrushSelectP bsp,
|
||||
int index);
|
||||
|
||||
void brush_change_callbacks (BrushSelectP bsp,
|
||||
gint closing);
|
||||
void brushes_check_dialogs (void);
|
||||
|
||||
/* show/hide paint options (main brush dialog if bsp == NULL) */
|
||||
void brush_select_show_paint_options (BrushSelectP bsp,
|
||||
gboolean show);
|
||||
|
||||
/* PDB entry */
|
||||
extern ProcRecord brushes_popup_proc;
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "appenv.h"
|
||||
|
@ -26,14 +25,15 @@
|
|||
#include "interface.h"
|
||||
#include "layers_dialog.h"
|
||||
#include "layer_select.h"
|
||||
#include "paint_options.h"
|
||||
#include "session.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "libgimp/gimpchainbutton.h"
|
||||
#include "libgimp/gimpfileselection.h"
|
||||
#include "libgimp/gimpintl.h"
|
||||
#include "libgimp/gimppatheditor.h"
|
||||
#include "libgimp/gimpsizeentry.h"
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
/* preferences local functions */
|
||||
static void file_prefs_ok_callback (GtkWidget *, GtkWidget *);
|
||||
|
@ -44,7 +44,6 @@ static void file_prefs_toggle_callback (GtkWidget *, gpointer);
|
|||
static void file_prefs_preview_size_callback (GtkWidget *, gpointer);
|
||||
static void file_prefs_mem_size_unit_callback (GtkWidget *, gpointer);
|
||||
static void file_prefs_int_adjustment_callback (GtkAdjustment *, gpointer);
|
||||
/*static void file_prefs_float_adjustment_callback (GtkAdjustment *, gpointer);*/
|
||||
static void file_prefs_string_callback (GtkWidget *, gpointer);
|
||||
static void file_prefs_filename_callback (GtkWidget *, gpointer);
|
||||
static void file_prefs_path_callback (GtkWidget *, gpointer);
|
||||
|
@ -97,6 +96,7 @@ static float old_monitor_yres;
|
|||
static int old_using_xserver_resolution;
|
||||
static int old_num_processors;
|
||||
static char * old_image_title_format;
|
||||
static int old_global_paint_options;
|
||||
|
||||
/* variables which can't be changed on the fly */
|
||||
static int edit_stingy_memory_use;
|
||||
|
@ -498,6 +498,11 @@ file_prefs_save_callback (GtkWidget *widget,
|
|||
}
|
||||
if (file_prefs_strcmp (image_title_format, old_image_title_format))
|
||||
update = g_list_append (update, "image-title-format");
|
||||
if (global_paint_options != old_global_paint_options)
|
||||
{
|
||||
update = g_list_append (update, "global-paint-options");
|
||||
remove = g_list_append (remove, "no-global-paint-options");
|
||||
}
|
||||
|
||||
save_gimprc (&update, &remove);
|
||||
|
||||
|
@ -600,6 +605,8 @@ file_prefs_cancel_callback (GtkWidget *widget,
|
|||
file_prefs_strset (&edit_gradient_path, old_gradient_path);
|
||||
|
||||
file_prefs_strset (&image_title_format, old_image_title_format);
|
||||
|
||||
paint_options_set_global (old_global_paint_options);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -653,6 +660,8 @@ file_prefs_toggle_callback (GtkWidget *widget,
|
|||
gdisplays_expose_full ();
|
||||
gdisplays_flush ();
|
||||
}
|
||||
else if (data == &global_paint_options)
|
||||
paint_options_set_global (GTK_TOGGLE_BUTTON (widget)->active);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -692,18 +701,6 @@ file_prefs_int_adjustment_callback (GtkAdjustment *adj,
|
|||
*val = (int) adj->value;
|
||||
}
|
||||
|
||||
/* commented out because it's not used
|
||||
static void
|
||||
file_prefs_float_adjustment_callback (GtkAdjustment *adj,
|
||||
gpointer data)
|
||||
{
|
||||
float *val;
|
||||
|
||||
val = data;
|
||||
*val = (float) adj->value;
|
||||
}
|
||||
*/
|
||||
|
||||
static void
|
||||
file_prefs_string_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
|
@ -931,26 +928,32 @@ gimp_dialog_new (const gchar *title,
|
|||
gint allow_grow,
|
||||
gint auto_shrink,
|
||||
|
||||
/* this is an action_area button */
|
||||
gchar *label,
|
||||
GtkSignalFunc callback,
|
||||
gpointer data,
|
||||
gboolean default_action,
|
||||
gboolean connect_delete,
|
||||
/* specify action area buttons as va_list:
|
||||
* gchar *label,
|
||||
* GtkSignalFunc callback,
|
||||
* gpointer data,
|
||||
* gboolean default_action,
|
||||
* gboolean connect_delete,
|
||||
*/
|
||||
|
||||
/* more action_area buttons */
|
||||
...)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
GtkWidget *hbbox;
|
||||
GtkWidget *button;
|
||||
|
||||
/* action area variables */
|
||||
gchar *label;
|
||||
GtkSignalFunc callback;
|
||||
gpointer data;
|
||||
gboolean default_action;
|
||||
gboolean connect_delete;
|
||||
|
||||
va_list args;
|
||||
gboolean delete_connected = FALSE;
|
||||
|
||||
g_return_val_if_fail (title != NULL, NULL);
|
||||
g_return_val_if_fail (wmclass_name != NULL, NULL);
|
||||
g_return_val_if_fail (label != NULL, NULL);
|
||||
|
||||
dialog = gtk_dialog_new ();
|
||||
gtk_window_set_wmclass (GTK_WINDOW (dialog), wmclass_name, "Gimp");
|
||||
|
@ -971,9 +974,15 @@ gimp_dialog_new (const gchar *title,
|
|||
gtk_widget_show (hbbox);
|
||||
|
||||
/* the action_area buttons */
|
||||
va_start (args, connect_delete);
|
||||
va_start (args, auto_shrink);
|
||||
label = va_arg (args, gchar*);
|
||||
while (label)
|
||||
{
|
||||
callback = va_arg (args, GtkSignalFunc);
|
||||
data = va_arg (args, gpointer);
|
||||
default_action = va_arg (args, gboolean);
|
||||
connect_delete = va_arg (args, gboolean);
|
||||
|
||||
button = gtk_button_new_with_label (label);
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0);
|
||||
|
@ -1006,13 +1015,6 @@ gimp_dialog_new (const gchar *title,
|
|||
gtk_widget_show (button);
|
||||
|
||||
label = va_arg (args, gchar*);
|
||||
if (label)
|
||||
{
|
||||
callback = va_arg (args, GtkSignalFunc);
|
||||
data = va_arg (args, gpointer);
|
||||
default_action = va_arg (args, gboolean);
|
||||
connect_delete = va_arg (args, gboolean);
|
||||
}
|
||||
}
|
||||
va_end (args);
|
||||
|
||||
|
@ -1034,50 +1036,52 @@ gimp_dialog_new (const gchar *title,
|
|||
|
||||
GtkWidget*
|
||||
gimp_option_menu_new (GtkSignalFunc menu_item_callback,
|
||||
gpointer initial, /* set_data */
|
||||
gpointer initial, /* user_data */
|
||||
|
||||
/* this is a menu item */
|
||||
gchar *label,
|
||||
gpointer data,
|
||||
gpointer set_data,
|
||||
/* specify menu items as va_list:
|
||||
* gchar *label,
|
||||
* gpointer data,
|
||||
* gpointer user_data,
|
||||
*/
|
||||
|
||||
/* more menu items */
|
||||
...)
|
||||
{
|
||||
GtkWidget *menu;
|
||||
GtkWidget *menuitem;
|
||||
GtkWidget *optionmenu;
|
||||
|
||||
/* menu item variables */
|
||||
gchar *label;
|
||||
gpointer data;
|
||||
gpointer user_data;
|
||||
|
||||
va_list args;
|
||||
gint i;
|
||||
gint initial_index;
|
||||
|
||||
g_return_val_if_fail (label != NULL, NULL);
|
||||
|
||||
menu = gtk_menu_new ();
|
||||
|
||||
/* create the menu items */
|
||||
initial_index = 0;
|
||||
va_start (args, set_data);
|
||||
va_start (args, initial);
|
||||
label = va_arg (args, gchar*);
|
||||
for (i = 0; label; i++)
|
||||
{
|
||||
data = va_arg (args, gpointer);
|
||||
user_data = va_arg (args, gpointer);
|
||||
|
||||
menuitem = gtk_menu_item_new_with_label (label);
|
||||
gtk_menu_append (GTK_MENU (menu), menuitem);
|
||||
gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
|
||||
menu_item_callback, data);
|
||||
gtk_object_set_user_data (GTK_OBJECT (menuitem), set_data);
|
||||
gtk_object_set_user_data (GTK_OBJECT (menuitem), user_data);
|
||||
gtk_widget_show (menuitem);
|
||||
|
||||
/* remember the initial menu item */
|
||||
if (set_data == initial)
|
||||
if (user_data == initial)
|
||||
initial_index = i;
|
||||
|
||||
label = va_arg (args, gchar*);
|
||||
if (label)
|
||||
{
|
||||
data = va_arg (args, gpointer);
|
||||
set_data = va_arg (args, gpointer);
|
||||
}
|
||||
}
|
||||
va_end (args);
|
||||
|
||||
|
@ -1092,52 +1096,54 @@ gimp_option_menu_new (GtkSignalFunc menu_item_callback,
|
|||
|
||||
GtkWidget*
|
||||
gimp_radio_group_new (GtkSignalFunc radio_button_callback,
|
||||
gpointer initial, /* set_data */
|
||||
gpointer initial, /* user_data */
|
||||
|
||||
/* this is a radio button */
|
||||
gchar *label,
|
||||
gpointer data,
|
||||
gpointer set_data,
|
||||
/* specify radio buttons as va_list:
|
||||
* gchar *label,
|
||||
* gpointer data,
|
||||
* gpointer user_data,
|
||||
*/
|
||||
|
||||
/* more radio buttons */
|
||||
...)
|
||||
{
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *button;
|
||||
GSList *group;
|
||||
|
||||
va_list args;
|
||||
/* radio button variables */
|
||||
gchar *label;
|
||||
gpointer data;
|
||||
gpointer user_data;
|
||||
|
||||
g_return_val_if_fail (label != NULL, NULL);
|
||||
va_list args;
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 1);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
|
||||
group = NULL;
|
||||
|
||||
/* create the radio buttons */
|
||||
va_start (args, set_data);
|
||||
va_start (args, initial);
|
||||
label = va_arg (args, gchar*);
|
||||
while (label)
|
||||
{
|
||||
data = va_arg (args, gpointer);
|
||||
user_data = va_arg (args, gpointer);
|
||||
|
||||
button = gtk_radio_button_new_with_label (group, label);
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "toggled",
|
||||
(GtkSignalFunc) radio_button_callback,
|
||||
data);
|
||||
gtk_object_set_user_data (GTK_OBJECT (button), set_data);
|
||||
gtk_object_set_user_data (GTK_OBJECT (button), user_data);
|
||||
|
||||
/* press the initially active radio button */
|
||||
if (set_data == initial)
|
||||
if (user_data == initial)
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
||||
|
||||
gtk_widget_show (button);
|
||||
|
||||
label = va_arg (args, gchar*);
|
||||
if (label)
|
||||
{
|
||||
data = va_arg (args, gpointer);
|
||||
set_data = va_arg (args, gpointer);
|
||||
}
|
||||
}
|
||||
va_end (args);
|
||||
|
||||
|
@ -1302,6 +1308,7 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
GtkWidget *comboitem;
|
||||
GtkWidget *optionmenu;
|
||||
GtkWidget *table;
|
||||
GtkWidget *label;
|
||||
GSList *group;
|
||||
GtkObject *adjustment;
|
||||
|
||||
|
@ -1365,6 +1372,7 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
old_using_xserver_resolution = using_xserver_resolution;
|
||||
old_num_processors = num_processors;
|
||||
old_image_title_format = file_prefs_strdup (image_title_format);
|
||||
old_global_paint_options = global_paint_options;
|
||||
|
||||
file_prefs_strset (&old_temp_path, edit_temp_path);
|
||||
file_prefs_strset (&old_swap_path, edit_swap_path);
|
||||
|
@ -1847,6 +1855,42 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
&no_cursor_updating);
|
||||
gtk_widget_show (button);
|
||||
|
||||
/* Interface / Tool Options */
|
||||
vbox = file_prefs_notebook_append_page (GTK_NOTEBOOK (notebook),
|
||||
_("Tool Options Settings"),
|
||||
GTK_CTREE (ctree),
|
||||
_("Tool Options"),
|
||||
top_insert,
|
||||
&child_insert,
|
||||
page_index);
|
||||
gtk_widget_show (vbox);
|
||||
page_index++;
|
||||
|
||||
frame = gtk_frame_new (_("Paint Options"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
vbox2 = gtk_vbox_new (FALSE, 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox2), 2);
|
||||
gtk_container_add (GTK_CONTAINER (frame), vbox2);
|
||||
gtk_widget_show (vbox2);
|
||||
|
||||
button =
|
||||
gtk_check_button_new_with_label(_("Use Global Paint Options"));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
|
||||
global_paint_options);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "toggled",
|
||||
(GtkSignalFunc) file_prefs_toggle_callback,
|
||||
&global_paint_options);
|
||||
gtk_widget_show (button);
|
||||
|
||||
label =
|
||||
gtk_label_new (_("(Switching this off does not yet work consistently.)"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
/* Environment */
|
||||
vbox = file_prefs_notebook_append_page (GTK_NOTEBOOK (notebook),
|
||||
_("Environment Settings"),
|
||||
|
|
73
app/ink.c
73
app/ink.c
|
@ -22,9 +22,9 @@
|
|||
#include "drawable.h"
|
||||
#include "draw_core.h"
|
||||
#include "gimage_mask.h"
|
||||
#include "gimpbrushlist.h"
|
||||
#include "gimprc.h"
|
||||
#include "ink.h"
|
||||
#include "paint_options.h"
|
||||
#include "tool_options_ui.h"
|
||||
#include "tools.h"
|
||||
#include "undo.h"
|
||||
|
@ -80,37 +80,37 @@ struct _BrushWidget
|
|||
typedef struct _InkOptions InkOptions;
|
||||
struct _InkOptions
|
||||
{
|
||||
ToolOptions tool_options;
|
||||
PaintOptions paint_options;
|
||||
|
||||
double size;
|
||||
double size_d;
|
||||
GtkObject *size_w;
|
||||
double size;
|
||||
double size_d;
|
||||
GtkObject *size_w;
|
||||
|
||||
double sensitivity;
|
||||
double sensitivity_d;
|
||||
GtkObject *sensitivity_w;
|
||||
double sensitivity;
|
||||
double sensitivity_d;
|
||||
GtkObject *sensitivity_w;
|
||||
|
||||
double vel_sensitivity;
|
||||
double vel_sensitivity_d;
|
||||
GtkObject *vel_sensitivity_w;
|
||||
double vel_sensitivity;
|
||||
double vel_sensitivity_d;
|
||||
GtkObject *vel_sensitivity_w;
|
||||
|
||||
double tilt_sensitivity;
|
||||
double tilt_sensitivity_d;
|
||||
GtkObject *tilt_sensitivity_w;
|
||||
double tilt_sensitivity;
|
||||
double tilt_sensitivity_d;
|
||||
GtkObject *tilt_sensitivity_w;
|
||||
|
||||
double tilt_angle;
|
||||
double tilt_angle_d;
|
||||
GtkObject *tilt_angle_w;
|
||||
double tilt_angle;
|
||||
double tilt_angle_d;
|
||||
GtkObject *tilt_angle_w;
|
||||
|
||||
BlobFunc function;
|
||||
BlobFunc function_d;
|
||||
GtkWidget *function_w[3]; /* 3 radio buttons */
|
||||
BlobFunc function;
|
||||
BlobFunc function_d;
|
||||
GtkWidget *function_w[3]; /* 3 radio buttons */
|
||||
|
||||
double aspect;
|
||||
double aspect_d;
|
||||
double angle;
|
||||
double angle_d;
|
||||
BrushWidget *brush_w;
|
||||
double aspect;
|
||||
double aspect_d;
|
||||
double angle;
|
||||
double angle_d;
|
||||
BrushWidget *brush_w;
|
||||
};
|
||||
|
||||
|
||||
|
@ -226,6 +226,8 @@ ink_options_reset (void)
|
|||
{
|
||||
InkOptions *options = ink_options;
|
||||
|
||||
paint_options_reset ((PaintOptions *) options);
|
||||
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->size_w),
|
||||
options->size_d);
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->sensitivity_w),
|
||||
|
@ -265,9 +267,9 @@ ink_options_new (void)
|
|||
|
||||
/* the new ink tool options structure */
|
||||
options = (InkOptions *) g_malloc (sizeof (InkOptions));
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
_("Ink Options"),
|
||||
ink_options_reset);
|
||||
paint_options_init ((PaintOptions *) options,
|
||||
INK,
|
||||
ink_options_reset);
|
||||
options->size = options->size_d = 4.4;
|
||||
options->sensitivity = options->sensitivity_d = 1.0;
|
||||
options->vel_sensitivity = options->vel_sensitivity_d = 0.8;
|
||||
|
@ -278,13 +280,14 @@ ink_options_new (void)
|
|||
options->angle = options->angle_d = 0.0;
|
||||
|
||||
/* the main table */
|
||||
table = gtk_table_new (8, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 6);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 1);
|
||||
table = gtk_table_new (9, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 2);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 1, 2);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 3, 2);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 5, 6);
|
||||
gtk_box_pack_start (GTK_BOX (options->tool_options.main_vbox), table,
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 5, 2);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 7, 4);
|
||||
gtk_box_pack_start (GTK_BOX (((ToolOptions *) options)->main_vbox), table,
|
||||
FALSE, FALSE, 0);
|
||||
|
||||
/* size slider */
|
||||
|
@ -1413,8 +1416,8 @@ ink_paste (InkTool *ink_tool,
|
|||
/* apply the paint area to the gimage */
|
||||
gimage_apply_image (gimage, drawable, &srcPR,
|
||||
FALSE,
|
||||
(int) (gimp_brush_get_opacity () * 255),
|
||||
gimp_brush_get_paint_mode(),
|
||||
(int) (PAINT_OPTIONS_GET_OPACITY (ink_options) * 255),
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (ink_options),
|
||||
undo_tiles, /* specify an alternative src1 */
|
||||
canvas_buf->x, canvas_buf->y);
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "gdisplay.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "paint_core.h"
|
||||
#include "paint_options.h"
|
||||
#include "palette.h"
|
||||
#include "airbrush.h"
|
||||
#include "selection.h"
|
||||
|
@ -50,7 +51,7 @@ struct _AirbrushTimeout
|
|||
typedef struct _AirbrushOptions AirbrushOptions;
|
||||
struct _AirbrushOptions
|
||||
{
|
||||
ToolOptions tool_options;
|
||||
PaintOptions paint_options;
|
||||
|
||||
double rate;
|
||||
double rate_d;
|
||||
|
@ -85,6 +86,8 @@ airbrush_options_reset (void)
|
|||
{
|
||||
AirbrushOptions *options = airbrush_options;
|
||||
|
||||
paint_options_reset ((PaintOptions *) options);
|
||||
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->rate_w),
|
||||
options->rate_d);
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->pressure_w),
|
||||
|
@ -103,18 +106,18 @@ airbrush_options_new (void)
|
|||
|
||||
/* the new airbrush tool options structure */
|
||||
options = (AirbrushOptions *) g_malloc (sizeof (AirbrushOptions));
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
_("Airbrush Options"),
|
||||
airbrush_options_reset);
|
||||
paint_options_init ((PaintOptions *) options,
|
||||
AIRBRUSH,
|
||||
airbrush_options_reset);
|
||||
options->rate = options->rate_d = 80.0;
|
||||
options->pressure = options->pressure_d = 10.0;
|
||||
|
||||
/* the main vbox */
|
||||
vbox = options->tool_options.main_vbox;
|
||||
vbox = ((ToolOptions *) options)->main_vbox;
|
||||
|
||||
/* the rate scale */
|
||||
table = gtk_table_new (2, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 6);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 1);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
||||
|
||||
|
@ -296,8 +299,8 @@ airbrush_motion (PaintCore *paint_core,
|
|||
/* paste the newly painted area to the image */
|
||||
paint_core_paste_canvas (paint_core, drawable,
|
||||
opacity,
|
||||
(int) (gimp_brush_get_opacity () * 255),
|
||||
gimp_brush_get_paint_mode (),
|
||||
(int) (PAINT_OPTIONS_GET_OPACITY (airbrush_options) * 255),
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (airbrush_options),
|
||||
SOFT, CONSTANT);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "appenv.h"
|
||||
#include "gimpbrushlist.h"
|
||||
#include "drawable.h"
|
||||
#include "errors.h"
|
||||
#include "gdisplay.h"
|
||||
|
@ -26,6 +25,7 @@
|
|||
#include "interface.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "paint_core.h"
|
||||
#include "paint_options.h"
|
||||
#include "patterns.h"
|
||||
#include "clone.h"
|
||||
#include "selection.h"
|
||||
|
@ -48,15 +48,15 @@ typedef enum
|
|||
typedef struct _CloneOptions CloneOptions;
|
||||
struct _CloneOptions
|
||||
{
|
||||
ToolOptions tool_options;
|
||||
PaintOptions paint_options;
|
||||
|
||||
CloneType type;
|
||||
CloneType type_d;
|
||||
GtkWidget *type_w[2]; /* 2 radio buttons */
|
||||
CloneType type;
|
||||
CloneType type_d;
|
||||
GtkWidget *type_w[2]; /* 2 radio buttons */
|
||||
|
||||
AlignType aligned;
|
||||
AlignType aligned_d;
|
||||
GtkWidget *aligned_w[3]; /* 3 radio buttons */
|
||||
AlignType aligned;
|
||||
AlignType aligned_d;
|
||||
GtkWidget *aligned_w[3]; /* 3 radio buttons */
|
||||
};
|
||||
|
||||
|
||||
|
@ -111,6 +111,8 @@ clone_options_reset (void)
|
|||
{
|
||||
CloneOptions *options = clone_options;
|
||||
|
||||
paint_options_reset ((PaintOptions *) options);
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->aligned_w[options->aligned_d]), TRUE);
|
||||
}
|
||||
|
@ -141,14 +143,14 @@ clone_options_new (void)
|
|||
|
||||
/* the new clone tool options structure */
|
||||
options = (CloneOptions *) g_malloc (sizeof (CloneOptions));
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
_("Clone Tool Options"),
|
||||
clone_options_reset);
|
||||
paint_options_init ((PaintOptions *) options,
|
||||
CLONE,
|
||||
clone_options_reset);
|
||||
options->type = options->type_d = IMAGE_CLONE;
|
||||
options->aligned = options->aligned_d = AlignNo;
|
||||
|
||||
/* the main vbox */
|
||||
vbox = options->tool_options.main_vbox;
|
||||
vbox = ((ToolOptions *) options)->main_vbox;
|
||||
|
||||
/* the radio frame and box */
|
||||
radio_frame = gtk_frame_new (_("Source"));
|
||||
|
@ -541,8 +543,9 @@ clone_motion (PaintCore *paint_core,
|
|||
|
||||
/* paste the newly painted canvas to the gimage which is being worked on */
|
||||
paint_core_paste_canvas (paint_core, drawable, OPAQUE_OPACITY,
|
||||
(int) (gimp_brush_get_opacity () * 255),
|
||||
gimp_brush_get_paint_mode (), SOFT, CONSTANT);
|
||||
(int) (PAINT_OPTIONS_GET_OPACITY (clone_options) * 255),
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (clone_options),
|
||||
SOFT, CONSTANT);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -18,13 +18,13 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "appenv.h"
|
||||
#include "gimpbrushlist.h"
|
||||
#include "drawable.h"
|
||||
#include "errors.h"
|
||||
#include "convolve.h"
|
||||
#include "gdisplay.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "paint_core.h"
|
||||
#include "paint_options.h"
|
||||
#include "selection.h"
|
||||
#include "tool_options_ui.h"
|
||||
#include "tools.h"
|
||||
|
@ -43,7 +43,7 @@
|
|||
typedef struct _ConvolveOptions ConvolveOptions;
|
||||
struct _ConvolveOptions
|
||||
{
|
||||
ToolOptions tool_options;
|
||||
PaintOptions paint_options;
|
||||
|
||||
ConvolveType type;
|
||||
ConvolveType type_d;
|
||||
|
@ -114,6 +114,8 @@ convolve_options_reset (void)
|
|||
{
|
||||
ConvolveOptions *options = convolve_options;
|
||||
|
||||
paint_options_reset ((PaintOptions *) options);
|
||||
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->pressure_w),
|
||||
options->pressure_d);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
|
||||
|
@ -143,17 +145,17 @@ convolve_options_new (void)
|
|||
|
||||
/* the new convolve tool options structure */
|
||||
options = (ConvolveOptions *) g_malloc (sizeof (ConvolveOptions));
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
_("Convolver Options"),
|
||||
convolve_options_reset);
|
||||
paint_options_init ((PaintOptions *) options,
|
||||
CONVOLVE,
|
||||
convolve_options_reset);
|
||||
options->type = options->type_d = BLUR_CONVOLVE;
|
||||
options->pressure = options->pressure_d = 50.0;
|
||||
|
||||
/* the main vbox */
|
||||
vbox = options->tool_options.main_vbox;
|
||||
vbox = ((ToolOptions *) options)->main_vbox;
|
||||
|
||||
/* the pressure scale */
|
||||
hbox = gtk_hbox_new (FALSE, 6);
|
||||
hbox = gtk_hbox_new (FALSE, 4);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
|
||||
label = gtk_label_new (_("Pressure:"));
|
||||
|
@ -346,7 +348,7 @@ convolve_motion (PaintCore *paint_core,
|
|||
|
||||
/* paste the newly painted canvas to the gimage which is being worked on */
|
||||
paint_core_replace_canvas (paint_core, drawable, OPAQUE_OPACITY,
|
||||
(int) (gimp_brush_get_opacity () * 255),
|
||||
(int) (PAINT_OPTIONS_GET_OPACITY (convolve_options) * 255),
|
||||
SOFT, INCREMENTAL);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,12 +17,12 @@
|
|||
*/
|
||||
#include <stdlib.h>
|
||||
#include "appenv.h"
|
||||
#include "gimpbrushlist.h"
|
||||
#include "drawable.h"
|
||||
#include "errors.h"
|
||||
#include "gdisplay.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "paint_core.h"
|
||||
#include "paint_options.h"
|
||||
#include "palette.h"
|
||||
#include "eraser.h"
|
||||
#include "selection.h"
|
||||
|
@ -36,15 +36,15 @@
|
|||
typedef struct _EraserOptions EraserOptions;
|
||||
struct _EraserOptions
|
||||
{
|
||||
ToolOptions tool_options;
|
||||
PaintOptions paint_options;
|
||||
|
||||
gboolean hard;
|
||||
gboolean hard_d;
|
||||
GtkWidget *hard_w;
|
||||
gboolean hard;
|
||||
gboolean hard_d;
|
||||
GtkWidget *hard_w;
|
||||
|
||||
gboolean incremental;
|
||||
gboolean incremental_d;
|
||||
GtkWidget *incremental_w;
|
||||
gboolean incremental;
|
||||
gboolean incremental_d;
|
||||
GtkWidget *incremental_w;
|
||||
};
|
||||
|
||||
|
||||
|
@ -68,6 +68,8 @@ eraser_options_reset (void)
|
|||
{
|
||||
EraserOptions *options = eraser_options;
|
||||
|
||||
paint_options_reset ((PaintOptions *) options);
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->hard_w),
|
||||
options->hard_d);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->incremental_w),
|
||||
|
@ -83,14 +85,14 @@ eraser_options_new (void)
|
|||
|
||||
/* the new eraser tool options structure */
|
||||
options = (EraserOptions *) g_malloc (sizeof (EraserOptions));
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
_("Eraser Options"),
|
||||
eraser_options_reset);
|
||||
paint_options_init ((PaintOptions *) options,
|
||||
ERASER,
|
||||
eraser_options_reset);
|
||||
options->hard = options->hard_d = FALSE;
|
||||
options->incremental = options->incremental_d = FALSE;
|
||||
|
||||
/* the main vbox */
|
||||
vbox = options->tool_options.main_vbox;
|
||||
vbox = ((ToolOptions *) options)->main_vbox;
|
||||
|
||||
/* the hard toggle */
|
||||
options->hard_w = gtk_check_button_new_with_label (_("Hard edge"));
|
||||
|
@ -196,11 +198,11 @@ eraser_motion (PaintCore *paint_core,
|
|||
/* color the pixels */
|
||||
color_pixels (temp_buf_data (area), col,
|
||||
area->width * area->height, area->bytes);
|
||||
opacity = 255 * gimp_brush_get_opacity() * (paint_core->curpressure / 0.5);
|
||||
opacity = 255 * paint_options_get_opacity() * (paint_core->curpressure / 0.5);
|
||||
if(opacity > OPAQUE_OPACITY) opacity=OPAQUE_OPACITY;
|
||||
/* paste the newly painted canvas to the gimage which is being worked on */
|
||||
paint_core_paste_canvas (paint_core, drawable, opacity,
|
||||
(int) (gimp_brush_get_opacity () * 255),
|
||||
(int) (PAINT_OPTIONS_GET_OPACITY (eraser_options) * 255),
|
||||
ERASE_MODE, hard? HARD : SOFT, incremental ? INCREMENTAL : CONSTANT);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,9 +22,9 @@
|
|||
#include "drawable.h"
|
||||
#include "draw_core.h"
|
||||
#include "gimage_mask.h"
|
||||
#include "gimpbrushlist.h"
|
||||
#include "gimprc.h"
|
||||
#include "ink.h"
|
||||
#include "paint_options.h"
|
||||
#include "tool_options_ui.h"
|
||||
#include "tools.h"
|
||||
#include "undo.h"
|
||||
|
@ -80,37 +80,37 @@ struct _BrushWidget
|
|||
typedef struct _InkOptions InkOptions;
|
||||
struct _InkOptions
|
||||
{
|
||||
ToolOptions tool_options;
|
||||
PaintOptions paint_options;
|
||||
|
||||
double size;
|
||||
double size_d;
|
||||
GtkObject *size_w;
|
||||
double size;
|
||||
double size_d;
|
||||
GtkObject *size_w;
|
||||
|
||||
double sensitivity;
|
||||
double sensitivity_d;
|
||||
GtkObject *sensitivity_w;
|
||||
double sensitivity;
|
||||
double sensitivity_d;
|
||||
GtkObject *sensitivity_w;
|
||||
|
||||
double vel_sensitivity;
|
||||
double vel_sensitivity_d;
|
||||
GtkObject *vel_sensitivity_w;
|
||||
double vel_sensitivity;
|
||||
double vel_sensitivity_d;
|
||||
GtkObject *vel_sensitivity_w;
|
||||
|
||||
double tilt_sensitivity;
|
||||
double tilt_sensitivity_d;
|
||||
GtkObject *tilt_sensitivity_w;
|
||||
double tilt_sensitivity;
|
||||
double tilt_sensitivity_d;
|
||||
GtkObject *tilt_sensitivity_w;
|
||||
|
||||
double tilt_angle;
|
||||
double tilt_angle_d;
|
||||
GtkObject *tilt_angle_w;
|
||||
double tilt_angle;
|
||||
double tilt_angle_d;
|
||||
GtkObject *tilt_angle_w;
|
||||
|
||||
BlobFunc function;
|
||||
BlobFunc function_d;
|
||||
GtkWidget *function_w[3]; /* 3 radio buttons */
|
||||
BlobFunc function;
|
||||
BlobFunc function_d;
|
||||
GtkWidget *function_w[3]; /* 3 radio buttons */
|
||||
|
||||
double aspect;
|
||||
double aspect_d;
|
||||
double angle;
|
||||
double angle_d;
|
||||
BrushWidget *brush_w;
|
||||
double aspect;
|
||||
double aspect_d;
|
||||
double angle;
|
||||
double angle_d;
|
||||
BrushWidget *brush_w;
|
||||
};
|
||||
|
||||
|
||||
|
@ -226,6 +226,8 @@ ink_options_reset (void)
|
|||
{
|
||||
InkOptions *options = ink_options;
|
||||
|
||||
paint_options_reset ((PaintOptions *) options);
|
||||
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->size_w),
|
||||
options->size_d);
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->sensitivity_w),
|
||||
|
@ -265,9 +267,9 @@ ink_options_new (void)
|
|||
|
||||
/* the new ink tool options structure */
|
||||
options = (InkOptions *) g_malloc (sizeof (InkOptions));
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
_("Ink Options"),
|
||||
ink_options_reset);
|
||||
paint_options_init ((PaintOptions *) options,
|
||||
INK,
|
||||
ink_options_reset);
|
||||
options->size = options->size_d = 4.4;
|
||||
options->sensitivity = options->sensitivity_d = 1.0;
|
||||
options->vel_sensitivity = options->vel_sensitivity_d = 0.8;
|
||||
|
@ -278,13 +280,14 @@ ink_options_new (void)
|
|||
options->angle = options->angle_d = 0.0;
|
||||
|
||||
/* the main table */
|
||||
table = gtk_table_new (8, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 6);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 1);
|
||||
table = gtk_table_new (9, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 2);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 1, 2);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 3, 2);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 5, 6);
|
||||
gtk_box_pack_start (GTK_BOX (options->tool_options.main_vbox), table,
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 5, 2);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 7, 4);
|
||||
gtk_box_pack_start (GTK_BOX (((ToolOptions *) options)->main_vbox), table,
|
||||
FALSE, FALSE, 0);
|
||||
|
||||
/* size slider */
|
||||
|
@ -1413,8 +1416,8 @@ ink_paste (InkTool *ink_tool,
|
|||
/* apply the paint area to the gimage */
|
||||
gimage_apply_image (gimage, drawable, &srcPR,
|
||||
FALSE,
|
||||
(int) (gimp_brush_get_opacity () * 255),
|
||||
gimp_brush_get_paint_mode(),
|
||||
(int) (PAINT_OPTIONS_GET_OPACITY (ink_options) * 255),
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (ink_options),
|
||||
undo_tiles, /* specify an alternative src1 */
|
||||
canvas_buf->x, canvas_buf->y);
|
||||
|
||||
|
|
|
@ -17,14 +17,14 @@
|
|||
*/
|
||||
#include <stdlib.h>
|
||||
#include "appenv.h"
|
||||
#include "gimpbrushlist.h"
|
||||
#include "drawable.h"
|
||||
#include "errors.h"
|
||||
#include "gdisplay.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "paint_core.h"
|
||||
#include "palette.h"
|
||||
#include "paint_options.h"
|
||||
#include "paintbrush.h"
|
||||
#include "palette.h"
|
||||
#include "pencil.h"
|
||||
#include "selection.h"
|
||||
#include "tools.h"
|
||||
|
@ -33,7 +33,7 @@
|
|||
|
||||
|
||||
/* the pencil tool options */
|
||||
static ToolOptions * pencil_options = NULL;
|
||||
static PaintOptions * pencil_options = NULL;
|
||||
|
||||
|
||||
/* forward function declarations */
|
||||
|
@ -66,6 +66,12 @@ pencil_paint_func (PaintCore *paint_core,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
pencil_options_reset (void)
|
||||
{
|
||||
paint_options_reset (pencil_options);
|
||||
}
|
||||
|
||||
Tool *
|
||||
tools_new_pencil (void)
|
||||
{
|
||||
|
@ -75,8 +81,8 @@ tools_new_pencil (void)
|
|||
/* The tool options */
|
||||
if (!pencil_options)
|
||||
{
|
||||
pencil_options = tool_options_new (_("Pencil Options"));
|
||||
tools_register (PENCIL, pencil_options);
|
||||
pencil_options = paint_options_new (PENCIL, pencil_options_reset);
|
||||
tools_register (PENCIL, (ToolOptions *) pencil_options);
|
||||
}
|
||||
|
||||
tool = paint_core_new (PENCIL);
|
||||
|
@ -119,8 +125,8 @@ pencil_motion (PaintCore *paint_core,
|
|||
|
||||
/* paste the newly painted canvas to the gimage which is being worked on */
|
||||
paint_core_paste_canvas (paint_core, drawable, OPAQUE_OPACITY,
|
||||
(int) (gimp_brush_get_opacity () * 255),
|
||||
gimp_brush_get_paint_mode (), HARD, CONSTANT);
|
||||
(int) (PAINT_OPTIONS_GET_OPACITY (pencil_options) * 255),
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (pencil_options), HARD, CONSTANT);
|
||||
}
|
||||
|
||||
static void *
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "appenv.h"
|
||||
#include "gimpbrushlist.h"
|
||||
#include "drawable.h"
|
||||
#include "errors.h"
|
||||
#include "gdisplay.h"
|
||||
|
@ -26,6 +25,7 @@
|
|||
#include "interface.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "paint_core.h"
|
||||
#include "paint_options.h"
|
||||
#include "patterns.h"
|
||||
#include "clone.h"
|
||||
#include "selection.h"
|
||||
|
@ -48,15 +48,15 @@ typedef enum
|
|||
typedef struct _CloneOptions CloneOptions;
|
||||
struct _CloneOptions
|
||||
{
|
||||
ToolOptions tool_options;
|
||||
PaintOptions paint_options;
|
||||
|
||||
CloneType type;
|
||||
CloneType type_d;
|
||||
GtkWidget *type_w[2]; /* 2 radio buttons */
|
||||
CloneType type;
|
||||
CloneType type_d;
|
||||
GtkWidget *type_w[2]; /* 2 radio buttons */
|
||||
|
||||
AlignType aligned;
|
||||
AlignType aligned_d;
|
||||
GtkWidget *aligned_w[3]; /* 3 radio buttons */
|
||||
AlignType aligned;
|
||||
AlignType aligned_d;
|
||||
GtkWidget *aligned_w[3]; /* 3 radio buttons */
|
||||
};
|
||||
|
||||
|
||||
|
@ -111,6 +111,8 @@ clone_options_reset (void)
|
|||
{
|
||||
CloneOptions *options = clone_options;
|
||||
|
||||
paint_options_reset ((PaintOptions *) options);
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->aligned_w[options->aligned_d]), TRUE);
|
||||
}
|
||||
|
@ -141,14 +143,14 @@ clone_options_new (void)
|
|||
|
||||
/* the new clone tool options structure */
|
||||
options = (CloneOptions *) g_malloc (sizeof (CloneOptions));
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
_("Clone Tool Options"),
|
||||
clone_options_reset);
|
||||
paint_options_init ((PaintOptions *) options,
|
||||
CLONE,
|
||||
clone_options_reset);
|
||||
options->type = options->type_d = IMAGE_CLONE;
|
||||
options->aligned = options->aligned_d = AlignNo;
|
||||
|
||||
/* the main vbox */
|
||||
vbox = options->tool_options.main_vbox;
|
||||
vbox = ((ToolOptions *) options)->main_vbox;
|
||||
|
||||
/* the radio frame and box */
|
||||
radio_frame = gtk_frame_new (_("Source"));
|
||||
|
@ -541,8 +543,9 @@ clone_motion (PaintCore *paint_core,
|
|||
|
||||
/* paste the newly painted canvas to the gimage which is being worked on */
|
||||
paint_core_paste_canvas (paint_core, drawable, OPAQUE_OPACITY,
|
||||
(int) (gimp_brush_get_opacity () * 255),
|
||||
gimp_brush_get_paint_mode (), SOFT, CONSTANT);
|
||||
(int) (PAINT_OPTIONS_GET_OPACITY (clone_options) * 255),
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (clone_options),
|
||||
SOFT, CONSTANT);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -433,10 +433,10 @@ paint_core_init (paint_core, drawable, x, y)
|
|||
GTK_SIGNAL_FUNC(paint_core_invalidate_cache),
|
||||
NULL);
|
||||
|
||||
paint_core->spacing = (double) gimp_brush_get_spacing () / 100.0;
|
||||
paint_core->spacing = (double) gimp_brush_get_spacing (brush) / 100.0;
|
||||
/* paint_core->spacing =
|
||||
(double) MAXIMUM (brush->mask->width, brush->mask->height) *
|
||||
((double) gimp_brush_get_spacing () / 100.0);
|
||||
((double) gimp_brush_get_spacing (brush) / 100.0);
|
||||
if (paint_core->spacing < 1.0)
|
||||
paint_core->spacing = 1.0; */
|
||||
paint_core->brush = brush;
|
||||
|
|
|
@ -0,0 +1,101 @@
|
|||
/* 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.
|
||||
*/
|
||||
#ifndef __PAINT_OPTIONS_H__
|
||||
#define __PAINT_OPTIONS_H__
|
||||
|
||||
#include "buildmenu.h"
|
||||
#include "gimprc.h"
|
||||
#include "tools.h"
|
||||
#include "tool_options.h"
|
||||
|
||||
|
||||
/* these macros return the global or tool-specific values, according
|
||||
* to the current mode
|
||||
*/
|
||||
|
||||
#define PAINT_OPTIONS_GET_OPACITY(options) \
|
||||
(global_paint_options ? \
|
||||
paint_options_get_opacity () : \
|
||||
((PaintOptions *)(options))->opacity)
|
||||
|
||||
#define PAINT_OPTIONS_GET_PAINT_MODE(options) \
|
||||
(global_paint_options ? \
|
||||
paint_options_get_paint_mode () : \
|
||||
((PaintOptions *)(options))->paint_mode)
|
||||
|
||||
|
||||
/* the paint options structures
|
||||
*/
|
||||
typedef struct _PaintOptions PaintOptions;
|
||||
struct _PaintOptions
|
||||
{
|
||||
ToolOptions tool_options;
|
||||
|
||||
/* vbox for the common paint options */
|
||||
GtkWidget *paint_vbox;
|
||||
|
||||
/* a widget to be shown if we are in global mode */
|
||||
GtkWidget *global;
|
||||
|
||||
/* options used by all paint tools */
|
||||
double opacity;
|
||||
double opacity_d;
|
||||
GtkObject *opacity_w;
|
||||
|
||||
int paint_mode;
|
||||
int paint_mode_d;
|
||||
GtkWidget *paint_mode_w;
|
||||
};
|
||||
|
||||
|
||||
/* paint tool options functions
|
||||
*/
|
||||
PaintOptions *paint_options_new (ToolType tool_type,
|
||||
ToolOptionsResetFunc reset_func);
|
||||
|
||||
void paint_options_reset (PaintOptions *options);
|
||||
|
||||
/* to be used by "derived" paint options only
|
||||
*/
|
||||
void paint_options_init (PaintOptions *options,
|
||||
ToolType tool_type,
|
||||
ToolOptionsResetFunc reset_func);
|
||||
|
||||
|
||||
/* functions for the global paint options
|
||||
*/
|
||||
|
||||
/* switch between global and per-tool paint options
|
||||
*/
|
||||
void paint_options_set_global (gboolean global);
|
||||
|
||||
/* global paint options access functions
|
||||
*/
|
||||
double paint_options_get_opacity (void);
|
||||
void paint_options_set_opacity (double opacity);
|
||||
|
||||
int paint_options_get_paint_mode (void);
|
||||
void paint_options_set_paint_mode (int paint_mode);
|
||||
|
||||
|
||||
/* a utility function which returns a paint mode menu
|
||||
*/
|
||||
GtkWidget *paint_mode_menu_new (MenuItemCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
#endif /* __PAINT_OPTIONS_H__ */
|
|
@ -19,7 +19,6 @@
|
|||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include "appenv.h"
|
||||
#include "gimpbrushlist.h"
|
||||
#include "drawable.h"
|
||||
#include "errors.h"
|
||||
#include "gdisplay.h"
|
||||
|
@ -27,6 +26,7 @@
|
|||
#include "paint_funcs.h"
|
||||
#include "paint_core.h"
|
||||
#include "palette.h"
|
||||
#include "paint_options.h"
|
||||
#include "paintbrush.h"
|
||||
#include "selection.h"
|
||||
#include "tool_options_ui.h"
|
||||
|
@ -39,34 +39,34 @@
|
|||
|
||||
/* the paintbrush structures */
|
||||
|
||||
typedef struct _PaintOptions PaintOptions;
|
||||
struct _PaintOptions
|
||||
typedef struct _PaintbrushOptions PaintbrushOptions;
|
||||
struct _PaintbrushOptions
|
||||
{
|
||||
ToolOptions tool_options;
|
||||
PaintOptions paint_options;
|
||||
|
||||
double fade_out;
|
||||
double fade_out_d;
|
||||
GtkObject *fade_out_w;
|
||||
double fade_out;
|
||||
double fade_out_d;
|
||||
GtkObject *fade_out_w;
|
||||
|
||||
int use_gradient;
|
||||
int use_gradient_d;
|
||||
GtkWidget *use_gradient_w;
|
||||
int use_gradient;
|
||||
int use_gradient_d;
|
||||
GtkWidget *use_gradient_w;
|
||||
|
||||
double gradient_length;
|
||||
double gradient_length_d;
|
||||
GtkObject *gradient_length_w;
|
||||
double gradient_length;
|
||||
double gradient_length_d;
|
||||
GtkObject *gradient_length_w;
|
||||
|
||||
int gradient_type;
|
||||
int gradient_type_d;
|
||||
GtkWidget *gradient_type_w[4]; /* 4 radio buttons */
|
||||
int gradient_type;
|
||||
int gradient_type_d;
|
||||
GtkWidget *gradient_type_w[4]; /* 4 radio buttons */
|
||||
|
||||
gboolean incremental;
|
||||
gboolean incremental_d;
|
||||
GtkWidget *incremental_w;
|
||||
gboolean incremental;
|
||||
gboolean incremental_d;
|
||||
GtkWidget *incremental_w;
|
||||
};
|
||||
|
||||
/* the paint brush tool options */
|
||||
static PaintOptions *paintbrush_options = NULL;
|
||||
static PaintbrushOptions *paintbrush_options = NULL;
|
||||
|
||||
/* local variables */
|
||||
static double non_gui_fade_out;
|
||||
|
@ -85,7 +85,7 @@ static void
|
|||
paintbrush_gradient_toggle_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
PaintOptions *options = paintbrush_options;
|
||||
PaintbrushOptions *options = paintbrush_options;
|
||||
|
||||
static int incremental_save = FALSE;
|
||||
|
||||
|
@ -116,7 +116,9 @@ paintbrush_gradient_type_callback (GtkWidget *widget,
|
|||
static void
|
||||
paintbrush_options_reset (void)
|
||||
{
|
||||
PaintOptions *options = paintbrush_options;
|
||||
PaintbrushOptions *options = paintbrush_options;
|
||||
|
||||
paint_options_reset ((PaintOptions *) options);
|
||||
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->fade_out_w),
|
||||
options->fade_out_d);
|
||||
|
@ -130,10 +132,10 @@ paintbrush_options_reset (void)
|
|||
options->incremental_d);
|
||||
}
|
||||
|
||||
static PaintOptions *
|
||||
static PaintbrushOptions *
|
||||
paintbrush_options_new (void)
|
||||
{
|
||||
PaintOptions *options;
|
||||
PaintbrushOptions *options;
|
||||
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *abox;
|
||||
|
@ -155,10 +157,10 @@ paintbrush_options_new (void)
|
|||
};
|
||||
|
||||
/* the new paint tool options structure */
|
||||
options = (PaintOptions *) g_malloc (sizeof (PaintOptions));
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
_("Paintbrush Options"),
|
||||
paintbrush_options_reset);
|
||||
options = (PaintbrushOptions *) g_malloc (sizeof (PaintbrushOptions));
|
||||
paint_options_init ((PaintOptions *) options,
|
||||
PAINTBRUSH,
|
||||
paintbrush_options_reset);
|
||||
options->fade_out = options->fade_out_d = 0.0;
|
||||
options->incremental = options->incremental_d = FALSE;
|
||||
options->use_gradient = options->use_gradient_d = FALSE;
|
||||
|
@ -166,11 +168,11 @@ paintbrush_options_new (void)
|
|||
options->gradient_type = options->gradient_type_d = LOOP_TRIANGLE;
|
||||
|
||||
/* the main vbox */
|
||||
vbox = options->tool_options.main_vbox;
|
||||
vbox = ((ToolOptions *) options)->main_vbox;
|
||||
|
||||
/* the fade-out scale */
|
||||
table = gtk_table_new (4, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 6);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 2);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 2, 3);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
||||
|
@ -437,8 +439,9 @@ paintbrush_motion (PaintCore *paint_core,
|
|||
|
||||
/* paste the newly painted canvas to the gimage which is being worked on */
|
||||
paint_core_paste_canvas (paint_core, drawable, temp_blend,
|
||||
(int) (gimp_brush_get_opacity () * 255),
|
||||
gimp_brush_get_paint_mode (), PRESSURE,
|
||||
(int) (PAINT_OPTIONS_GET_OPACITY (paintbrush_options) * 255),
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (paintbrush_options),
|
||||
PRESSURE,
|
||||
incremental ? INCREMENTAL : CONSTANT);
|
||||
}
|
||||
}
|
||||
|
|
20
app/pencil.c
20
app/pencil.c
|
@ -17,14 +17,14 @@
|
|||
*/
|
||||
#include <stdlib.h>
|
||||
#include "appenv.h"
|
||||
#include "gimpbrushlist.h"
|
||||
#include "drawable.h"
|
||||
#include "errors.h"
|
||||
#include "gdisplay.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "paint_core.h"
|
||||
#include "palette.h"
|
||||
#include "paint_options.h"
|
||||
#include "paintbrush.h"
|
||||
#include "palette.h"
|
||||
#include "pencil.h"
|
||||
#include "selection.h"
|
||||
#include "tools.h"
|
||||
|
@ -33,7 +33,7 @@
|
|||
|
||||
|
||||
/* the pencil tool options */
|
||||
static ToolOptions * pencil_options = NULL;
|
||||
static PaintOptions * pencil_options = NULL;
|
||||
|
||||
|
||||
/* forward function declarations */
|
||||
|
@ -66,6 +66,12 @@ pencil_paint_func (PaintCore *paint_core,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
pencil_options_reset (void)
|
||||
{
|
||||
paint_options_reset (pencil_options);
|
||||
}
|
||||
|
||||
Tool *
|
||||
tools_new_pencil (void)
|
||||
{
|
||||
|
@ -75,8 +81,8 @@ tools_new_pencil (void)
|
|||
/* The tool options */
|
||||
if (!pencil_options)
|
||||
{
|
||||
pencil_options = tool_options_new (_("Pencil Options"));
|
||||
tools_register (PENCIL, pencil_options);
|
||||
pencil_options = paint_options_new (PENCIL, pencil_options_reset);
|
||||
tools_register (PENCIL, (ToolOptions *) pencil_options);
|
||||
}
|
||||
|
||||
tool = paint_core_new (PENCIL);
|
||||
|
@ -119,8 +125,8 @@ pencil_motion (PaintCore *paint_core,
|
|||
|
||||
/* paste the newly painted canvas to the gimage which is being worked on */
|
||||
paint_core_paste_canvas (paint_core, drawable, OPAQUE_OPACITY,
|
||||
(int) (gimp_brush_get_opacity () * 255),
|
||||
gimp_brush_get_paint_mode (), HARD, CONSTANT);
|
||||
(int) (PAINT_OPTIONS_GET_OPACITY (pencil_options) * 255),
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (pencil_options), HARD, CONSTANT);
|
||||
}
|
||||
|
||||
static void *
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "appenv.h"
|
||||
|
@ -26,14 +25,15 @@
|
|||
#include "interface.h"
|
||||
#include "layers_dialog.h"
|
||||
#include "layer_select.h"
|
||||
#include "paint_options.h"
|
||||
#include "session.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "libgimp/gimpchainbutton.h"
|
||||
#include "libgimp/gimpfileselection.h"
|
||||
#include "libgimp/gimpintl.h"
|
||||
#include "libgimp/gimppatheditor.h"
|
||||
#include "libgimp/gimpsizeentry.h"
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
/* preferences local functions */
|
||||
static void file_prefs_ok_callback (GtkWidget *, GtkWidget *);
|
||||
|
@ -44,7 +44,6 @@ static void file_prefs_toggle_callback (GtkWidget *, gpointer);
|
|||
static void file_prefs_preview_size_callback (GtkWidget *, gpointer);
|
||||
static void file_prefs_mem_size_unit_callback (GtkWidget *, gpointer);
|
||||
static void file_prefs_int_adjustment_callback (GtkAdjustment *, gpointer);
|
||||
/*static void file_prefs_float_adjustment_callback (GtkAdjustment *, gpointer);*/
|
||||
static void file_prefs_string_callback (GtkWidget *, gpointer);
|
||||
static void file_prefs_filename_callback (GtkWidget *, gpointer);
|
||||
static void file_prefs_path_callback (GtkWidget *, gpointer);
|
||||
|
@ -97,6 +96,7 @@ static float old_monitor_yres;
|
|||
static int old_using_xserver_resolution;
|
||||
static int old_num_processors;
|
||||
static char * old_image_title_format;
|
||||
static int old_global_paint_options;
|
||||
|
||||
/* variables which can't be changed on the fly */
|
||||
static int edit_stingy_memory_use;
|
||||
|
@ -498,6 +498,11 @@ file_prefs_save_callback (GtkWidget *widget,
|
|||
}
|
||||
if (file_prefs_strcmp (image_title_format, old_image_title_format))
|
||||
update = g_list_append (update, "image-title-format");
|
||||
if (global_paint_options != old_global_paint_options)
|
||||
{
|
||||
update = g_list_append (update, "global-paint-options");
|
||||
remove = g_list_append (remove, "no-global-paint-options");
|
||||
}
|
||||
|
||||
save_gimprc (&update, &remove);
|
||||
|
||||
|
@ -600,6 +605,8 @@ file_prefs_cancel_callback (GtkWidget *widget,
|
|||
file_prefs_strset (&edit_gradient_path, old_gradient_path);
|
||||
|
||||
file_prefs_strset (&image_title_format, old_image_title_format);
|
||||
|
||||
paint_options_set_global (old_global_paint_options);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -653,6 +660,8 @@ file_prefs_toggle_callback (GtkWidget *widget,
|
|||
gdisplays_expose_full ();
|
||||
gdisplays_flush ();
|
||||
}
|
||||
else if (data == &global_paint_options)
|
||||
paint_options_set_global (GTK_TOGGLE_BUTTON (widget)->active);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -692,18 +701,6 @@ file_prefs_int_adjustment_callback (GtkAdjustment *adj,
|
|||
*val = (int) adj->value;
|
||||
}
|
||||
|
||||
/* commented out because it's not used
|
||||
static void
|
||||
file_prefs_float_adjustment_callback (GtkAdjustment *adj,
|
||||
gpointer data)
|
||||
{
|
||||
float *val;
|
||||
|
||||
val = data;
|
||||
*val = (float) adj->value;
|
||||
}
|
||||
*/
|
||||
|
||||
static void
|
||||
file_prefs_string_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
|
@ -931,26 +928,32 @@ gimp_dialog_new (const gchar *title,
|
|||
gint allow_grow,
|
||||
gint auto_shrink,
|
||||
|
||||
/* this is an action_area button */
|
||||
gchar *label,
|
||||
GtkSignalFunc callback,
|
||||
gpointer data,
|
||||
gboolean default_action,
|
||||
gboolean connect_delete,
|
||||
/* specify action area buttons as va_list:
|
||||
* gchar *label,
|
||||
* GtkSignalFunc callback,
|
||||
* gpointer data,
|
||||
* gboolean default_action,
|
||||
* gboolean connect_delete,
|
||||
*/
|
||||
|
||||
/* more action_area buttons */
|
||||
...)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
GtkWidget *hbbox;
|
||||
GtkWidget *button;
|
||||
|
||||
/* action area variables */
|
||||
gchar *label;
|
||||
GtkSignalFunc callback;
|
||||
gpointer data;
|
||||
gboolean default_action;
|
||||
gboolean connect_delete;
|
||||
|
||||
va_list args;
|
||||
gboolean delete_connected = FALSE;
|
||||
|
||||
g_return_val_if_fail (title != NULL, NULL);
|
||||
g_return_val_if_fail (wmclass_name != NULL, NULL);
|
||||
g_return_val_if_fail (label != NULL, NULL);
|
||||
|
||||
dialog = gtk_dialog_new ();
|
||||
gtk_window_set_wmclass (GTK_WINDOW (dialog), wmclass_name, "Gimp");
|
||||
|
@ -971,9 +974,15 @@ gimp_dialog_new (const gchar *title,
|
|||
gtk_widget_show (hbbox);
|
||||
|
||||
/* the action_area buttons */
|
||||
va_start (args, connect_delete);
|
||||
va_start (args, auto_shrink);
|
||||
label = va_arg (args, gchar*);
|
||||
while (label)
|
||||
{
|
||||
callback = va_arg (args, GtkSignalFunc);
|
||||
data = va_arg (args, gpointer);
|
||||
default_action = va_arg (args, gboolean);
|
||||
connect_delete = va_arg (args, gboolean);
|
||||
|
||||
button = gtk_button_new_with_label (label);
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0);
|
||||
|
@ -1006,13 +1015,6 @@ gimp_dialog_new (const gchar *title,
|
|||
gtk_widget_show (button);
|
||||
|
||||
label = va_arg (args, gchar*);
|
||||
if (label)
|
||||
{
|
||||
callback = va_arg (args, GtkSignalFunc);
|
||||
data = va_arg (args, gpointer);
|
||||
default_action = va_arg (args, gboolean);
|
||||
connect_delete = va_arg (args, gboolean);
|
||||
}
|
||||
}
|
||||
va_end (args);
|
||||
|
||||
|
@ -1034,50 +1036,52 @@ gimp_dialog_new (const gchar *title,
|
|||
|
||||
GtkWidget*
|
||||
gimp_option_menu_new (GtkSignalFunc menu_item_callback,
|
||||
gpointer initial, /* set_data */
|
||||
gpointer initial, /* user_data */
|
||||
|
||||
/* this is a menu item */
|
||||
gchar *label,
|
||||
gpointer data,
|
||||
gpointer set_data,
|
||||
/* specify menu items as va_list:
|
||||
* gchar *label,
|
||||
* gpointer data,
|
||||
* gpointer user_data,
|
||||
*/
|
||||
|
||||
/* more menu items */
|
||||
...)
|
||||
{
|
||||
GtkWidget *menu;
|
||||
GtkWidget *menuitem;
|
||||
GtkWidget *optionmenu;
|
||||
|
||||
/* menu item variables */
|
||||
gchar *label;
|
||||
gpointer data;
|
||||
gpointer user_data;
|
||||
|
||||
va_list args;
|
||||
gint i;
|
||||
gint initial_index;
|
||||
|
||||
g_return_val_if_fail (label != NULL, NULL);
|
||||
|
||||
menu = gtk_menu_new ();
|
||||
|
||||
/* create the menu items */
|
||||
initial_index = 0;
|
||||
va_start (args, set_data);
|
||||
va_start (args, initial);
|
||||
label = va_arg (args, gchar*);
|
||||
for (i = 0; label; i++)
|
||||
{
|
||||
data = va_arg (args, gpointer);
|
||||
user_data = va_arg (args, gpointer);
|
||||
|
||||
menuitem = gtk_menu_item_new_with_label (label);
|
||||
gtk_menu_append (GTK_MENU (menu), menuitem);
|
||||
gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
|
||||
menu_item_callback, data);
|
||||
gtk_object_set_user_data (GTK_OBJECT (menuitem), set_data);
|
||||
gtk_object_set_user_data (GTK_OBJECT (menuitem), user_data);
|
||||
gtk_widget_show (menuitem);
|
||||
|
||||
/* remember the initial menu item */
|
||||
if (set_data == initial)
|
||||
if (user_data == initial)
|
||||
initial_index = i;
|
||||
|
||||
label = va_arg (args, gchar*);
|
||||
if (label)
|
||||
{
|
||||
data = va_arg (args, gpointer);
|
||||
set_data = va_arg (args, gpointer);
|
||||
}
|
||||
}
|
||||
va_end (args);
|
||||
|
||||
|
@ -1092,52 +1096,54 @@ gimp_option_menu_new (GtkSignalFunc menu_item_callback,
|
|||
|
||||
GtkWidget*
|
||||
gimp_radio_group_new (GtkSignalFunc radio_button_callback,
|
||||
gpointer initial, /* set_data */
|
||||
gpointer initial, /* user_data */
|
||||
|
||||
/* this is a radio button */
|
||||
gchar *label,
|
||||
gpointer data,
|
||||
gpointer set_data,
|
||||
/* specify radio buttons as va_list:
|
||||
* gchar *label,
|
||||
* gpointer data,
|
||||
* gpointer user_data,
|
||||
*/
|
||||
|
||||
/* more radio buttons */
|
||||
...)
|
||||
{
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *button;
|
||||
GSList *group;
|
||||
|
||||
va_list args;
|
||||
/* radio button variables */
|
||||
gchar *label;
|
||||
gpointer data;
|
||||
gpointer user_data;
|
||||
|
||||
g_return_val_if_fail (label != NULL, NULL);
|
||||
va_list args;
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 1);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
|
||||
group = NULL;
|
||||
|
||||
/* create the radio buttons */
|
||||
va_start (args, set_data);
|
||||
va_start (args, initial);
|
||||
label = va_arg (args, gchar*);
|
||||
while (label)
|
||||
{
|
||||
data = va_arg (args, gpointer);
|
||||
user_data = va_arg (args, gpointer);
|
||||
|
||||
button = gtk_radio_button_new_with_label (group, label);
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "toggled",
|
||||
(GtkSignalFunc) radio_button_callback,
|
||||
data);
|
||||
gtk_object_set_user_data (GTK_OBJECT (button), set_data);
|
||||
gtk_object_set_user_data (GTK_OBJECT (button), user_data);
|
||||
|
||||
/* press the initially active radio button */
|
||||
if (set_data == initial)
|
||||
if (user_data == initial)
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
||||
|
||||
gtk_widget_show (button);
|
||||
|
||||
label = va_arg (args, gchar*);
|
||||
if (label)
|
||||
{
|
||||
data = va_arg (args, gpointer);
|
||||
set_data = va_arg (args, gpointer);
|
||||
}
|
||||
}
|
||||
va_end (args);
|
||||
|
||||
|
@ -1302,6 +1308,7 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
GtkWidget *comboitem;
|
||||
GtkWidget *optionmenu;
|
||||
GtkWidget *table;
|
||||
GtkWidget *label;
|
||||
GSList *group;
|
||||
GtkObject *adjustment;
|
||||
|
||||
|
@ -1365,6 +1372,7 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
old_using_xserver_resolution = using_xserver_resolution;
|
||||
old_num_processors = num_processors;
|
||||
old_image_title_format = file_prefs_strdup (image_title_format);
|
||||
old_global_paint_options = global_paint_options;
|
||||
|
||||
file_prefs_strset (&old_temp_path, edit_temp_path);
|
||||
file_prefs_strset (&old_swap_path, edit_swap_path);
|
||||
|
@ -1847,6 +1855,42 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
&no_cursor_updating);
|
||||
gtk_widget_show (button);
|
||||
|
||||
/* Interface / Tool Options */
|
||||
vbox = file_prefs_notebook_append_page (GTK_NOTEBOOK (notebook),
|
||||
_("Tool Options Settings"),
|
||||
GTK_CTREE (ctree),
|
||||
_("Tool Options"),
|
||||
top_insert,
|
||||
&child_insert,
|
||||
page_index);
|
||||
gtk_widget_show (vbox);
|
||||
page_index++;
|
||||
|
||||
frame = gtk_frame_new (_("Paint Options"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
vbox2 = gtk_vbox_new (FALSE, 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox2), 2);
|
||||
gtk_container_add (GTK_CONTAINER (frame), vbox2);
|
||||
gtk_widget_show (vbox2);
|
||||
|
||||
button =
|
||||
gtk_check_button_new_with_label(_("Use Global Paint Options"));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
|
||||
global_paint_options);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "toggled",
|
||||
(GtkSignalFunc) file_prefs_toggle_callback,
|
||||
&global_paint_options);
|
||||
gtk_widget_show (button);
|
||||
|
||||
label =
|
||||
gtk_label_new (_("(Switching this off does not yet work consistently.)"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
/* Environment */
|
||||
vbox = file_prefs_notebook_append_page (GTK_NOTEBOOK (notebook),
|
||||
_("Environment Settings"),
|
||||
|
|
|
@ -164,7 +164,7 @@ text_options_new (void)
|
|||
gtk_widget_show (options->antialias_w);
|
||||
|
||||
/* the border spinbutton */
|
||||
hbox = gtk_hbox_new (FALSE, 6);
|
||||
hbox = gtk_hbox_new (FALSE, 4);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
|
||||
label = gtk_label_new (_("Border:"));
|
||||
|
|
|
@ -15,14 +15,26 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include "brush_select.h"
|
||||
#include "gimprc.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "paint_options.h"
|
||||
#include "selection_options.h"
|
||||
#include "tool_options_ui.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
#include "libgimp/gimpunitmenu.h"
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
/* ui helper functions */
|
||||
/* the global paint options */
|
||||
static double global_opacity = 1.0;
|
||||
static int global_paint_mode = 0;
|
||||
|
||||
/* a list of all PaintOptions */
|
||||
static GSList *paint_options_list = NULL;
|
||||
|
||||
|
||||
/* ui helper functions ******************************************************/
|
||||
|
||||
void
|
||||
tool_options_toggle_update (GtkWidget *widget,
|
||||
|
@ -77,6 +89,16 @@ tool_options_double_adjustment_update (GtkWidget *widget,
|
|||
*val = GTK_ADJUSTMENT (widget)->value;
|
||||
}
|
||||
|
||||
void
|
||||
tool_options_opacity_adjustment_update (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
double *val;
|
||||
|
||||
val = (double *) data;
|
||||
*val = GTK_ADJUSTMENT (widget)->value / 100;
|
||||
}
|
||||
|
||||
void
|
||||
tool_options_unitmenu_update (GtkWidget *widget,
|
||||
gpointer data)
|
||||
|
@ -101,8 +123,20 @@ tool_options_unitmenu_update (GtkWidget *widget,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
tool_options_paint_mode_update (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
PaintOptions *options;
|
||||
|
||||
/* tool options functions */
|
||||
options = (PaintOptions *) gtk_object_get_user_data (GTK_OBJECT (widget));
|
||||
|
||||
if (options)
|
||||
options->paint_mode = (long) data;
|
||||
}
|
||||
|
||||
|
||||
/* tool options functions ***************************************************/
|
||||
|
||||
void
|
||||
tool_options_init (ToolOptions *options,
|
||||
|
@ -131,7 +165,7 @@ tool_options_new (gchar *title)
|
|||
return options;
|
||||
}
|
||||
|
||||
/* selection tool options functions */
|
||||
/* selection tool options functions *****************************************/
|
||||
|
||||
void
|
||||
selection_options_init (SelectionOptions *options,
|
||||
|
@ -161,7 +195,7 @@ selection_options_init (SelectionOptions *options,
|
|||
_("Intelligent Scissors Options") :
|
||||
((tool_type == BY_COLOR_SELECT) ?
|
||||
_("By-Color Select Options") :
|
||||
_("Unknown Selection Type ???")))))))),
|
||||
_("ERROR: Unknown Selection Type")))))))),
|
||||
reset_func);
|
||||
|
||||
/* the main vbox */
|
||||
|
@ -188,7 +222,7 @@ selection_options_init (SelectionOptions *options,
|
|||
|
||||
/* the feather toggle button */
|
||||
table = gtk_table_new (2, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 6);
|
||||
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"));
|
||||
|
@ -314,7 +348,7 @@ selection_options_init (SelectionOptions *options,
|
|||
gtk_widget_show (alignment);
|
||||
|
||||
table = gtk_table_new (3, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 6);
|
||||
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);
|
||||
|
||||
|
@ -448,3 +482,280 @@ selection_options_reset (SelectionOptions *options)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* paint tool options functions *********************************************/
|
||||
|
||||
void
|
||||
paint_options_init (PaintOptions *options,
|
||||
ToolType tool_type,
|
||||
ToolOptionsResetFunc reset_func)
|
||||
{
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *abox;
|
||||
GtkWidget *table;
|
||||
GtkWidget *label;
|
||||
GtkWidget *scale;
|
||||
GtkWidget *menu;
|
||||
GtkWidget *separator;
|
||||
|
||||
/* initialize the tool options structure */
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
((tool_type == BUCKET_FILL) ?
|
||||
_("Bucket Fill Options") :
|
||||
((tool_type == BLEND) ?
|
||||
_("Blend Options") :
|
||||
((tool_type == PENCIL) ?
|
||||
_("Pencil Options") :
|
||||
((tool_type == PAINTBRUSH) ?
|
||||
_("Paintbrush Options") :
|
||||
((tool_type == ERASER) ?
|
||||
_("Erazer Options") :
|
||||
((tool_type == AIRBRUSH) ?
|
||||
_("Airbrush Options") :
|
||||
((tool_type == CLONE) ?
|
||||
_("Clone Tool Options") :
|
||||
((tool_type == CONVOLVE) ?
|
||||
_("Convolver Options") :
|
||||
((tool_type == INK) ?
|
||||
_("Ink Options") :
|
||||
_("ERROR: Unknown Paint Type")))))))))),
|
||||
reset_func);
|
||||
|
||||
/* initialize the paint options structure */
|
||||
options->opacity = options->opacity_d = 1.0;
|
||||
options->paint_mode = options->paint_mode_d = 0;
|
||||
|
||||
options->global = NULL;
|
||||
options->opacity_w = NULL;
|
||||
options->paint_mode_w = NULL;
|
||||
|
||||
/* 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 */
|
||||
label = gtk_label_new (_("Opacity:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 1.0);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
options->opacity_w =
|
||||
gtk_adjustment_new (options->opacity_d * 100, 0.0, 100.0, 1.0, 1.0, 0.0);
|
||||
gtk_signal_connect (GTK_OBJECT (options->opacity_w), "value_changed",
|
||||
(GtkSignalFunc) tool_options_opacity_adjustment_update,
|
||||
&options->opacity);
|
||||
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);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), scale, 1, 2, 0, 1);
|
||||
gtk_widget_show (scale);
|
||||
|
||||
/* the paint mode menu */
|
||||
switch (tool_type)
|
||||
{
|
||||
case BUCKET_FILL:
|
||||
case BLEND:
|
||||
case PENCIL:
|
||||
case PAINTBRUSH:
|
||||
case AIRBRUSH:
|
||||
case CLONE:
|
||||
case INK:
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 2);
|
||||
|
||||
label = gtk_label_new (_("Mode:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
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.0, 0.5, 0.0, 0.0);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), abox, 1, 2, 1, 2);
|
||||
gtk_widget_show (abox);
|
||||
|
||||
options->paint_mode_w = gtk_option_menu_new ();
|
||||
gtk_container_add (GTK_CONTAINER (abox), options->paint_mode_w);
|
||||
gtk_widget_show (options->paint_mode_w);
|
||||
|
||||
menu =
|
||||
paint_mode_menu_new (tool_options_paint_mode_update, (gpointer) options);
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (options->paint_mode_w), menu);
|
||||
break;
|
||||
case CONVOLVE:
|
||||
case ERASER:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* show the main table */
|
||||
gtk_widget_show (table);
|
||||
|
||||
/* a separator after the common paint options */
|
||||
if (tool_type != PENCIL)
|
||||
{
|
||||
separator = gtk_hseparator_new ();
|
||||
gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, FALSE, 0);
|
||||
gtk_widget_show (separator);
|
||||
}
|
||||
|
||||
if (! global_paint_options)
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
/* 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;
|
||||
GtkWidget *label;
|
||||
|
||||
options = (PaintOptions *) g_malloc (sizeof (PaintOptions));
|
||||
paint_options_init (options, tool_type, reset_func);
|
||||
|
||||
options->global = gtk_vbox_new (FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (options->tool_options.main_vbox),
|
||||
options->global, FALSE, FALSE, 0);
|
||||
|
||||
label = gtk_label_new (_("This tool has no options."));
|
||||
gtk_box_pack_start (GTK_BOX (options->global), label, FALSE, FALSE, 6);
|
||||
gtk_widget_show (label);
|
||||
|
||||
if (global_paint_options && options->global)
|
||||
gtk_widget_show (options->global);
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
void
|
||||
paint_options_reset (PaintOptions *options)
|
||||
{
|
||||
if (options->opacity_w)
|
||||
{
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->opacity_w),
|
||||
options->opacity_d * 100);
|
||||
}
|
||||
if (options->paint_mode_w)
|
||||
{
|
||||
options->paint_mode = options->paint_mode_d;
|
||||
gtk_option_menu_set_history (GTK_OPTION_MENU (options->paint_mode_w),
|
||||
options->paint_mode_d);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* 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);
|
||||
}
|
||||
|
||||
double
|
||||
paint_options_get_opacity (void)
|
||||
{
|
||||
return global_opacity;
|
||||
}
|
||||
|
||||
void
|
||||
paint_options_set_opacity (double opacity)
|
||||
{
|
||||
global_opacity = opacity;
|
||||
}
|
||||
|
||||
int
|
||||
paint_options_get_paint_mode (void)
|
||||
{
|
||||
return global_paint_mode;
|
||||
}
|
||||
|
||||
void
|
||||
paint_options_set_paint_mode (int paint_mode)
|
||||
{
|
||||
global_paint_mode = paint_mode;
|
||||
}
|
||||
|
||||
|
||||
/* create a paint mode menu *************************************************/
|
||||
|
||||
GtkWidget *
|
||||
paint_mode_menu_new (MenuItemCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWidget *menu;
|
||||
int i;
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -722,7 +722,7 @@ void
|
|||
tools_options_dialog_new ()
|
||||
{
|
||||
GtkWidget *frame;
|
||||
GtkWidget *frame2;
|
||||
/* GtkWidget *frame2; */
|
||||
GtkWidget *vbox;
|
||||
|
||||
ActionAreaItem action_items[2] =
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "gdisplay.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "paint_core.h"
|
||||
#include "paint_options.h"
|
||||
#include "palette.h"
|
||||
#include "airbrush.h"
|
||||
#include "selection.h"
|
||||
|
@ -50,7 +51,7 @@ struct _AirbrushTimeout
|
|||
typedef struct _AirbrushOptions AirbrushOptions;
|
||||
struct _AirbrushOptions
|
||||
{
|
||||
ToolOptions tool_options;
|
||||
PaintOptions paint_options;
|
||||
|
||||
double rate;
|
||||
double rate_d;
|
||||
|
@ -85,6 +86,8 @@ airbrush_options_reset (void)
|
|||
{
|
||||
AirbrushOptions *options = airbrush_options;
|
||||
|
||||
paint_options_reset ((PaintOptions *) options);
|
||||
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->rate_w),
|
||||
options->rate_d);
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->pressure_w),
|
||||
|
@ -103,18 +106,18 @@ airbrush_options_new (void)
|
|||
|
||||
/* the new airbrush tool options structure */
|
||||
options = (AirbrushOptions *) g_malloc (sizeof (AirbrushOptions));
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
_("Airbrush Options"),
|
||||
airbrush_options_reset);
|
||||
paint_options_init ((PaintOptions *) options,
|
||||
AIRBRUSH,
|
||||
airbrush_options_reset);
|
||||
options->rate = options->rate_d = 80.0;
|
||||
options->pressure = options->pressure_d = 10.0;
|
||||
|
||||
/* the main vbox */
|
||||
vbox = options->tool_options.main_vbox;
|
||||
vbox = ((ToolOptions *) options)->main_vbox;
|
||||
|
||||
/* the rate scale */
|
||||
table = gtk_table_new (2, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 6);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 1);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
||||
|
||||
|
@ -296,8 +299,8 @@ airbrush_motion (PaintCore *paint_core,
|
|||
/* paste the newly painted area to the image */
|
||||
paint_core_paste_canvas (paint_core, drawable,
|
||||
opacity,
|
||||
(int) (gimp_brush_get_opacity () * 255),
|
||||
gimp_brush_get_paint_mode (),
|
||||
(int) (PAINT_OPTIONS_GET_OPACITY (airbrush_options) * 255),
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (airbrush_options),
|
||||
SOFT, CONSTANT);
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "gradient.h"
|
||||
#include "interface.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "paint_options.h"
|
||||
#include "palette.h"
|
||||
#include "selection.h"
|
||||
#include "tool_options_ui.h"
|
||||
|
@ -75,15 +76,7 @@ struct _BlendTool
|
|||
typedef struct _BlendOptions BlendOptions;
|
||||
struct _BlendOptions
|
||||
{
|
||||
ToolOptions tool_options;
|
||||
|
||||
double opacity;
|
||||
double opacity_d;
|
||||
GtkObject *opacity_w;
|
||||
|
||||
int paint_mode;
|
||||
int paint_mode_d;
|
||||
GtkWidget *paint_mode_w;
|
||||
PaintOptions paint_options;
|
||||
|
||||
double offset;
|
||||
double offset_d;
|
||||
|
@ -152,7 +145,6 @@ static PixelRegion distR =
|
|||
/* local function prototypes */
|
||||
static void gradient_type_callback (GtkWidget *, gpointer);
|
||||
static void blend_mode_callback (GtkWidget *, gpointer);
|
||||
static void paint_mode_callback (GtkWidget *, gpointer);
|
||||
static void repeat_type_callback (GtkWidget *, gpointer);
|
||||
|
||||
static void blend_button_press (Tool *, GdkEventButton *, gpointer);
|
||||
|
@ -203,13 +195,6 @@ static void calc_hsv_to_rgb(double *h, double *s, double *v);
|
|||
|
||||
/* functions */
|
||||
|
||||
static void
|
||||
paint_mode_callback (GtkWidget *w,
|
||||
gpointer client_data)
|
||||
{
|
||||
blend_options->paint_mode = (long) client_data;
|
||||
}
|
||||
|
||||
static void
|
||||
blend_mode_callback (GtkWidget *w,
|
||||
gpointer client_data)
|
||||
|
@ -238,10 +223,7 @@ blend_options_reset ()
|
|||
{
|
||||
BlendOptions *options = blend_options;
|
||||
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (blend_options->opacity_w),
|
||||
blend_options->opacity_d);
|
||||
options->paint_mode = options->paint_mode_d;
|
||||
gtk_option_menu_set_history (GTK_OPTION_MENU (options->paint_mode_w), 0);
|
||||
paint_options_reset ((PaintOptions *) options);
|
||||
|
||||
options->blend_mode = options->blend_mode_d;
|
||||
options->gradient_type = options->gradient_type_d;
|
||||
|
@ -272,7 +254,6 @@ blend_options_new ()
|
|||
GtkWidget *menu;
|
||||
GtkWidget *table;
|
||||
GtkWidget *scale;
|
||||
GtkWidget *separator;
|
||||
GtkWidget *frame;
|
||||
|
||||
static MenuItem blend_option_items[] =
|
||||
|
@ -326,11 +307,9 @@ blend_options_new ()
|
|||
|
||||
/* the new blend tool options structure */
|
||||
options = (BlendOptions *) g_malloc (sizeof (BlendOptions));
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
_("Blend Options"),
|
||||
blend_options_reset);
|
||||
options->opacity = options->opacity_d = 100.0;
|
||||
options->paint_mode = options->paint_mode_d = NORMAL;
|
||||
paint_options_init ((PaintOptions *) options,
|
||||
BLEND,
|
||||
blend_options_reset);
|
||||
options->offset = options->offset_d = 0.0;
|
||||
options->blend_mode = options->blend_mode_d = FG_BG_RGB_MODE;
|
||||
options->gradient_type = options->gradient_type_d = LINEAR;
|
||||
|
@ -340,62 +319,13 @@ blend_options_new ()
|
|||
options->threshold = options->threshold_d = 0.2;
|
||||
|
||||
/* the main vbox */
|
||||
vbox = options->tool_options.main_vbox;
|
||||
|
||||
/* the opacity scale */
|
||||
table = gtk_table_new (2, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 6);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0);
|
||||
|
||||
label = gtk_label_new (_("Opacity:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 1.0);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
options->opacity_w =
|
||||
gtk_adjustment_new (options->opacity_d, 0.0, 100.0, 1.0, 1.0, 0.0);
|
||||
gtk_signal_connect (GTK_OBJECT (options->opacity_w), "value_changed",
|
||||
(GtkSignalFunc) tool_options_double_adjustment_update,
|
||||
&options->opacity);
|
||||
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);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), scale, 1, 2, 0, 1);
|
||||
gtk_widget_show (scale);
|
||||
|
||||
/* the paint mode menu */
|
||||
label = gtk_label_new (_("Mode:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
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.0, 0.5, 0.0, 0.0);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), abox, 1, 2, 1, 2);
|
||||
gtk_widget_show (abox);
|
||||
|
||||
options->paint_mode_w = gtk_option_menu_new ();
|
||||
gtk_container_add (GTK_CONTAINER (abox), options->paint_mode_w);
|
||||
gtk_widget_show (options->paint_mode_w);
|
||||
|
||||
menu = create_paint_mode_menu (paint_mode_callback, NULL);
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (options->paint_mode_w), menu);
|
||||
|
||||
/* show the table */
|
||||
gtk_widget_show (table);
|
||||
|
||||
/* a separator after the paint mode options */
|
||||
separator = gtk_hseparator_new ();
|
||||
gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, FALSE, 0);
|
||||
gtk_widget_show (separator);
|
||||
vbox = ((ToolOptions *) options)->main_vbox;
|
||||
|
||||
/* the offset scale */
|
||||
table = gtk_table_new (4, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 6);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 1);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 3);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0);
|
||||
|
||||
label = gtk_label_new (_("Offset:"));
|
||||
|
@ -497,7 +427,7 @@ blend_options_new ()
|
|||
/* table for supersampling options */
|
||||
table = gtk_table_new (2, 2, FALSE);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (table), 2);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 6);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 1);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
||||
|
||||
|
@ -633,9 +563,9 @@ blend_button_release (Tool *tool,
|
|||
&nreturn_vals,
|
||||
PDB_DRAWABLE, drawable_ID (gimage_active_drawable (gimage)),
|
||||
PDB_INT32, (gint32) blend_options->blend_mode,
|
||||
PDB_INT32, (gint32) blend_options->paint_mode,
|
||||
PDB_INT32, (gint32) PAINT_OPTIONS_GET_PAINT_MODE (blend_options),
|
||||
PDB_INT32, (gint32) blend_options->gradient_type,
|
||||
PDB_FLOAT, (gdouble) blend_options->opacity,
|
||||
PDB_FLOAT, (gdouble) PAINT_OPTIONS_GET_OPACITY (blend_options) * 100,
|
||||
PDB_FLOAT, (gdouble) blend_options->offset,
|
||||
PDB_INT32, (gint32) blend_options->repeat,
|
||||
PDB_INT32, (gint32) blend_options->supersample,
|
||||
|
@ -661,9 +591,9 @@ blend_button_release (Tool *tool,
|
|||
blend (gimage,
|
||||
gimage_active_drawable (gimage),
|
||||
blend_options->blend_mode,
|
||||
blend_options->paint_mode,
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (blend_options),
|
||||
blend_options->gradient_type,
|
||||
blend_options->opacity,
|
||||
PAINT_OPTIONS_GET_OPACITY (blend_options) * 100,
|
||||
blend_options->offset,
|
||||
blend_options->repeat,
|
||||
blend_options->supersample,
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "gimage_mask.h"
|
||||
#include "interface.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "paint_options.h"
|
||||
#include "palette.h"
|
||||
#include "patterns.h"
|
||||
#include "selection.h"
|
||||
|
@ -47,15 +48,7 @@ struct _BucketTool
|
|||
typedef struct _BucketOptions BucketOptions;
|
||||
struct _BucketOptions
|
||||
{
|
||||
ToolOptions tool_options;
|
||||
|
||||
double opacity;
|
||||
double opacity_d;
|
||||
GtkObject *opacity_w;
|
||||
|
||||
int paint_mode;
|
||||
int paint_mode_d;
|
||||
GtkWidget *paint_mode_w;
|
||||
PaintOptions paint_options;
|
||||
|
||||
double threshold;
|
||||
double threshold_d;
|
||||
|
@ -100,23 +93,12 @@ bucket_fill_mode_callback (GtkWidget *widget,
|
|||
bucket_options->fill_mode = (BucketFillMode) client_data;
|
||||
}
|
||||
|
||||
static void
|
||||
bucket_fill_paint_mode_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
bucket_options->paint_mode = (long) client_data;
|
||||
}
|
||||
|
||||
static void
|
||||
bucket_options_reset (void)
|
||||
{
|
||||
BucketOptions *options = bucket_options;
|
||||
|
||||
options->paint_mode = options->paint_mode_d;
|
||||
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->opacity_w),
|
||||
options->opacity_d);
|
||||
gtk_option_menu_set_history (GTK_OPTION_MENU (options->paint_mode_w), 0);
|
||||
paint_options_reset ((PaintOptions *) options);
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->sample_merged_w),
|
||||
options->sample_merged_d);
|
||||
|
@ -134,17 +116,13 @@ bucket_options_new (void)
|
|||
BucketOptions *options;
|
||||
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *table;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *abox;
|
||||
GtkWidget *label;
|
||||
GtkWidget *scale;
|
||||
GtkWidget *menu;
|
||||
GSList *group = NULL;
|
||||
GtkWidget *radio_frame;
|
||||
GtkWidget *radio_box;
|
||||
GtkWidget *radio_button;
|
||||
GtkWidget *separator;
|
||||
|
||||
int i;
|
||||
char *button_names[2] =
|
||||
|
@ -155,69 +133,18 @@ bucket_options_new (void)
|
|||
|
||||
/* the new bucket fill tool options structure */
|
||||
options = (BucketOptions *) g_malloc (sizeof (BucketOptions));
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
_("Bucket Fill Options"),
|
||||
bucket_options_reset);
|
||||
options->opacity = options->opacity_d = 100.0;
|
||||
options->paint_mode = options->paint_mode_d = NORMAL;
|
||||
paint_options_init ((PaintOptions *) options,
|
||||
BUCKET_FILL,
|
||||
bucket_options_reset);
|
||||
options->sample_merged = options->sample_merged_d = FALSE;
|
||||
options->threshold = options->threshold_d = 15.0;
|
||||
options->fill_mode = options->fill_mode_d = FG_BUCKET_FILL;
|
||||
|
||||
/* the main vbox */
|
||||
vbox = options->tool_options.main_vbox;
|
||||
|
||||
/* the opacity scale */
|
||||
table = gtk_table_new (2, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 6);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
||||
|
||||
label = gtk_label_new (_("Opacity:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 1.0);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
options->opacity_w =
|
||||
gtk_adjustment_new (options->opacity_d, 0.0, 100.0, 1.0, 1.0, 0.0);
|
||||
scale = gtk_hscale_new (GTK_ADJUSTMENT (options->opacity_w));
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), scale, 1, 2, 0, 1);
|
||||
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->opacity_w), "value_changed",
|
||||
(GtkSignalFunc) tool_options_double_adjustment_update,
|
||||
&options->opacity);
|
||||
gtk_widget_show (scale);
|
||||
|
||||
/* the paint mode menu */
|
||||
label = gtk_label_new (_("Mode:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
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.0, 0.5, 0.0, 0.0);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), abox, 1, 2, 1, 2);
|
||||
gtk_widget_show (abox);
|
||||
|
||||
options->paint_mode_w = gtk_option_menu_new ();
|
||||
gtk_container_add (GTK_CONTAINER (abox), options->paint_mode_w);
|
||||
gtk_widget_show (options->paint_mode_w);
|
||||
|
||||
menu = create_paint_mode_menu (bucket_fill_paint_mode_callback, NULL);
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (options->paint_mode_w), menu);
|
||||
|
||||
/* show the table */
|
||||
gtk_widget_show (table);
|
||||
|
||||
/* a separator after the paint mode options */
|
||||
separator = gtk_hseparator_new ();
|
||||
gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, FALSE, 0);
|
||||
gtk_widget_show (separator);
|
||||
vbox = ((ToolOptions *) options)->main_vbox;
|
||||
|
||||
/* the threshold scale */
|
||||
hbox = gtk_hbox_new (FALSE, 6);
|
||||
hbox = gtk_hbox_new (FALSE, 4);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
|
||||
label = gtk_label_new (_("Threshold:"));
|
||||
|
@ -335,8 +262,8 @@ bucket_fill_button_release (Tool *tool,
|
|||
&nreturn_vals,
|
||||
PDB_DRAWABLE, drawable_ID (gimage_active_drawable (gdisp->gimage)),
|
||||
PDB_INT32, (gint32) fill_mode,
|
||||
PDB_INT32, (gint32) bucket_options->paint_mode,
|
||||
PDB_FLOAT, (gdouble) bucket_options->opacity,
|
||||
PDB_INT32, (gint32) PAINT_OPTIONS_GET_PAINT_MODE (bucket_options),
|
||||
PDB_FLOAT, (gdouble) PAINT_OPTIONS_GET_OPACITY (bucket_options) * 100,
|
||||
PDB_FLOAT, (gdouble) bucket_options->threshold,
|
||||
PDB_INT32, (gint32) bucket_options->sample_merged,
|
||||
PDB_FLOAT, (gdouble) bucket_tool->target_x,
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "appenv.h"
|
||||
#include "gimpbrushlist.h"
|
||||
#include "drawable.h"
|
||||
#include "errors.h"
|
||||
#include "gdisplay.h"
|
||||
|
@ -26,6 +25,7 @@
|
|||
#include "interface.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "paint_core.h"
|
||||
#include "paint_options.h"
|
||||
#include "patterns.h"
|
||||
#include "clone.h"
|
||||
#include "selection.h"
|
||||
|
@ -48,15 +48,15 @@ typedef enum
|
|||
typedef struct _CloneOptions CloneOptions;
|
||||
struct _CloneOptions
|
||||
{
|
||||
ToolOptions tool_options;
|
||||
PaintOptions paint_options;
|
||||
|
||||
CloneType type;
|
||||
CloneType type_d;
|
||||
GtkWidget *type_w[2]; /* 2 radio buttons */
|
||||
CloneType type;
|
||||
CloneType type_d;
|
||||
GtkWidget *type_w[2]; /* 2 radio buttons */
|
||||
|
||||
AlignType aligned;
|
||||
AlignType aligned_d;
|
||||
GtkWidget *aligned_w[3]; /* 3 radio buttons */
|
||||
AlignType aligned;
|
||||
AlignType aligned_d;
|
||||
GtkWidget *aligned_w[3]; /* 3 radio buttons */
|
||||
};
|
||||
|
||||
|
||||
|
@ -111,6 +111,8 @@ clone_options_reset (void)
|
|||
{
|
||||
CloneOptions *options = clone_options;
|
||||
|
||||
paint_options_reset ((PaintOptions *) options);
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->aligned_w[options->aligned_d]), TRUE);
|
||||
}
|
||||
|
@ -141,14 +143,14 @@ clone_options_new (void)
|
|||
|
||||
/* the new clone tool options structure */
|
||||
options = (CloneOptions *) g_malloc (sizeof (CloneOptions));
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
_("Clone Tool Options"),
|
||||
clone_options_reset);
|
||||
paint_options_init ((PaintOptions *) options,
|
||||
CLONE,
|
||||
clone_options_reset);
|
||||
options->type = options->type_d = IMAGE_CLONE;
|
||||
options->aligned = options->aligned_d = AlignNo;
|
||||
|
||||
/* the main vbox */
|
||||
vbox = options->tool_options.main_vbox;
|
||||
vbox = ((ToolOptions *) options)->main_vbox;
|
||||
|
||||
/* the radio frame and box */
|
||||
radio_frame = gtk_frame_new (_("Source"));
|
||||
|
@ -541,8 +543,9 @@ clone_motion (PaintCore *paint_core,
|
|||
|
||||
/* paste the newly painted canvas to the gimage which is being worked on */
|
||||
paint_core_paste_canvas (paint_core, drawable, OPAQUE_OPACITY,
|
||||
(int) (gimp_brush_get_opacity () * 255),
|
||||
gimp_brush_get_paint_mode (), SOFT, CONSTANT);
|
||||
(int) (PAINT_OPTIONS_GET_OPACITY (clone_options) * 255),
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (clone_options),
|
||||
SOFT, CONSTANT);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -145,7 +145,7 @@ color_picker_options_new (void)
|
|||
|
||||
/* the sample average options */
|
||||
table = gtk_table_new (2, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 6);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
||||
|
||||
options->sample_average_w =
|
||||
|
|
|
@ -18,13 +18,13 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "appenv.h"
|
||||
#include "gimpbrushlist.h"
|
||||
#include "drawable.h"
|
||||
#include "errors.h"
|
||||
#include "convolve.h"
|
||||
#include "gdisplay.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "paint_core.h"
|
||||
#include "paint_options.h"
|
||||
#include "selection.h"
|
||||
#include "tool_options_ui.h"
|
||||
#include "tools.h"
|
||||
|
@ -43,7 +43,7 @@
|
|||
typedef struct _ConvolveOptions ConvolveOptions;
|
||||
struct _ConvolveOptions
|
||||
{
|
||||
ToolOptions tool_options;
|
||||
PaintOptions paint_options;
|
||||
|
||||
ConvolveType type;
|
||||
ConvolveType type_d;
|
||||
|
@ -114,6 +114,8 @@ convolve_options_reset (void)
|
|||
{
|
||||
ConvolveOptions *options = convolve_options;
|
||||
|
||||
paint_options_reset ((PaintOptions *) options);
|
||||
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->pressure_w),
|
||||
options->pressure_d);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
|
||||
|
@ -143,17 +145,17 @@ convolve_options_new (void)
|
|||
|
||||
/* the new convolve tool options structure */
|
||||
options = (ConvolveOptions *) g_malloc (sizeof (ConvolveOptions));
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
_("Convolver Options"),
|
||||
convolve_options_reset);
|
||||
paint_options_init ((PaintOptions *) options,
|
||||
CONVOLVE,
|
||||
convolve_options_reset);
|
||||
options->type = options->type_d = BLUR_CONVOLVE;
|
||||
options->pressure = options->pressure_d = 50.0;
|
||||
|
||||
/* the main vbox */
|
||||
vbox = options->tool_options.main_vbox;
|
||||
vbox = ((ToolOptions *) options)->main_vbox;
|
||||
|
||||
/* the pressure scale */
|
||||
hbox = gtk_hbox_new (FALSE, 6);
|
||||
hbox = gtk_hbox_new (FALSE, 4);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
|
||||
label = gtk_label_new (_("Pressure:"));
|
||||
|
@ -346,7 +348,7 @@ convolve_motion (PaintCore *paint_core,
|
|||
|
||||
/* paste the newly painted canvas to the gimage which is being worked on */
|
||||
paint_core_replace_canvas (paint_core, drawable, OPAQUE_OPACITY,
|
||||
(int) (gimp_brush_get_opacity () * 255),
|
||||
(int) (PAINT_OPTIONS_GET_OPACITY (convolve_options) * 255),
|
||||
SOFT, INCREMENTAL);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,12 +17,12 @@
|
|||
*/
|
||||
#include <stdlib.h>
|
||||
#include "appenv.h"
|
||||
#include "gimpbrushlist.h"
|
||||
#include "drawable.h"
|
||||
#include "errors.h"
|
||||
#include "gdisplay.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "paint_core.h"
|
||||
#include "paint_options.h"
|
||||
#include "palette.h"
|
||||
#include "eraser.h"
|
||||
#include "selection.h"
|
||||
|
@ -36,15 +36,15 @@
|
|||
typedef struct _EraserOptions EraserOptions;
|
||||
struct _EraserOptions
|
||||
{
|
||||
ToolOptions tool_options;
|
||||
PaintOptions paint_options;
|
||||
|
||||
gboolean hard;
|
||||
gboolean hard_d;
|
||||
GtkWidget *hard_w;
|
||||
gboolean hard;
|
||||
gboolean hard_d;
|
||||
GtkWidget *hard_w;
|
||||
|
||||
gboolean incremental;
|
||||
gboolean incremental_d;
|
||||
GtkWidget *incremental_w;
|
||||
gboolean incremental;
|
||||
gboolean incremental_d;
|
||||
GtkWidget *incremental_w;
|
||||
};
|
||||
|
||||
|
||||
|
@ -68,6 +68,8 @@ eraser_options_reset (void)
|
|||
{
|
||||
EraserOptions *options = eraser_options;
|
||||
|
||||
paint_options_reset ((PaintOptions *) options);
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->hard_w),
|
||||
options->hard_d);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->incremental_w),
|
||||
|
@ -83,14 +85,14 @@ eraser_options_new (void)
|
|||
|
||||
/* the new eraser tool options structure */
|
||||
options = (EraserOptions *) g_malloc (sizeof (EraserOptions));
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
_("Eraser Options"),
|
||||
eraser_options_reset);
|
||||
paint_options_init ((PaintOptions *) options,
|
||||
ERASER,
|
||||
eraser_options_reset);
|
||||
options->hard = options->hard_d = FALSE;
|
||||
options->incremental = options->incremental_d = FALSE;
|
||||
|
||||
/* the main vbox */
|
||||
vbox = options->tool_options.main_vbox;
|
||||
vbox = ((ToolOptions *) options)->main_vbox;
|
||||
|
||||
/* the hard toggle */
|
||||
options->hard_w = gtk_check_button_new_with_label (_("Hard edge"));
|
||||
|
@ -196,11 +198,11 @@ eraser_motion (PaintCore *paint_core,
|
|||
/* color the pixels */
|
||||
color_pixels (temp_buf_data (area), col,
|
||||
area->width * area->height, area->bytes);
|
||||
opacity = 255 * gimp_brush_get_opacity() * (paint_core->curpressure / 0.5);
|
||||
opacity = 255 * paint_options_get_opacity() * (paint_core->curpressure / 0.5);
|
||||
if(opacity > OPAQUE_OPACITY) opacity=OPAQUE_OPACITY;
|
||||
/* paste the newly painted canvas to the gimage which is being worked on */
|
||||
paint_core_paste_canvas (paint_core, drawable, opacity,
|
||||
(int) (gimp_brush_get_opacity () * 255),
|
||||
(int) (PAINT_OPTIONS_GET_OPACITY (eraser_options) * 255),
|
||||
ERASE_MODE, hard? HARD : SOFT, incremental ? INCREMENTAL : CONSTANT);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "gdisplay.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "paint_core.h"
|
||||
#include "paint_options.h"
|
||||
#include "palette.h"
|
||||
#include "airbrush.h"
|
||||
#include "selection.h"
|
||||
|
@ -50,7 +51,7 @@ struct _AirbrushTimeout
|
|||
typedef struct _AirbrushOptions AirbrushOptions;
|
||||
struct _AirbrushOptions
|
||||
{
|
||||
ToolOptions tool_options;
|
||||
PaintOptions paint_options;
|
||||
|
||||
double rate;
|
||||
double rate_d;
|
||||
|
@ -85,6 +86,8 @@ airbrush_options_reset (void)
|
|||
{
|
||||
AirbrushOptions *options = airbrush_options;
|
||||
|
||||
paint_options_reset ((PaintOptions *) options);
|
||||
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->rate_w),
|
||||
options->rate_d);
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->pressure_w),
|
||||
|
@ -103,18 +106,18 @@ airbrush_options_new (void)
|
|||
|
||||
/* the new airbrush tool options structure */
|
||||
options = (AirbrushOptions *) g_malloc (sizeof (AirbrushOptions));
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
_("Airbrush Options"),
|
||||
airbrush_options_reset);
|
||||
paint_options_init ((PaintOptions *) options,
|
||||
AIRBRUSH,
|
||||
airbrush_options_reset);
|
||||
options->rate = options->rate_d = 80.0;
|
||||
options->pressure = options->pressure_d = 10.0;
|
||||
|
||||
/* the main vbox */
|
||||
vbox = options->tool_options.main_vbox;
|
||||
vbox = ((ToolOptions *) options)->main_vbox;
|
||||
|
||||
/* the rate scale */
|
||||
table = gtk_table_new (2, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 6);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 1);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
||||
|
||||
|
@ -296,8 +299,8 @@ airbrush_motion (PaintCore *paint_core,
|
|||
/* paste the newly painted area to the image */
|
||||
paint_core_paste_canvas (paint_core, drawable,
|
||||
opacity,
|
||||
(int) (gimp_brush_get_opacity () * 255),
|
||||
gimp_brush_get_paint_mode (),
|
||||
(int) (PAINT_OPTIONS_GET_OPACITY (airbrush_options) * 255),
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (airbrush_options),
|
||||
SOFT, CONSTANT);
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "gradient.h"
|
||||
#include "interface.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "paint_options.h"
|
||||
#include "palette.h"
|
||||
#include "selection.h"
|
||||
#include "tool_options_ui.h"
|
||||
|
@ -75,15 +76,7 @@ struct _BlendTool
|
|||
typedef struct _BlendOptions BlendOptions;
|
||||
struct _BlendOptions
|
||||
{
|
||||
ToolOptions tool_options;
|
||||
|
||||
double opacity;
|
||||
double opacity_d;
|
||||
GtkObject *opacity_w;
|
||||
|
||||
int paint_mode;
|
||||
int paint_mode_d;
|
||||
GtkWidget *paint_mode_w;
|
||||
PaintOptions paint_options;
|
||||
|
||||
double offset;
|
||||
double offset_d;
|
||||
|
@ -152,7 +145,6 @@ static PixelRegion distR =
|
|||
/* local function prototypes */
|
||||
static void gradient_type_callback (GtkWidget *, gpointer);
|
||||
static void blend_mode_callback (GtkWidget *, gpointer);
|
||||
static void paint_mode_callback (GtkWidget *, gpointer);
|
||||
static void repeat_type_callback (GtkWidget *, gpointer);
|
||||
|
||||
static void blend_button_press (Tool *, GdkEventButton *, gpointer);
|
||||
|
@ -203,13 +195,6 @@ static void calc_hsv_to_rgb(double *h, double *s, double *v);
|
|||
|
||||
/* functions */
|
||||
|
||||
static void
|
||||
paint_mode_callback (GtkWidget *w,
|
||||
gpointer client_data)
|
||||
{
|
||||
blend_options->paint_mode = (long) client_data;
|
||||
}
|
||||
|
||||
static void
|
||||
blend_mode_callback (GtkWidget *w,
|
||||
gpointer client_data)
|
||||
|
@ -238,10 +223,7 @@ blend_options_reset ()
|
|||
{
|
||||
BlendOptions *options = blend_options;
|
||||
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (blend_options->opacity_w),
|
||||
blend_options->opacity_d);
|
||||
options->paint_mode = options->paint_mode_d;
|
||||
gtk_option_menu_set_history (GTK_OPTION_MENU (options->paint_mode_w), 0);
|
||||
paint_options_reset ((PaintOptions *) options);
|
||||
|
||||
options->blend_mode = options->blend_mode_d;
|
||||
options->gradient_type = options->gradient_type_d;
|
||||
|
@ -272,7 +254,6 @@ blend_options_new ()
|
|||
GtkWidget *menu;
|
||||
GtkWidget *table;
|
||||
GtkWidget *scale;
|
||||
GtkWidget *separator;
|
||||
GtkWidget *frame;
|
||||
|
||||
static MenuItem blend_option_items[] =
|
||||
|
@ -326,11 +307,9 @@ blend_options_new ()
|
|||
|
||||
/* the new blend tool options structure */
|
||||
options = (BlendOptions *) g_malloc (sizeof (BlendOptions));
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
_("Blend Options"),
|
||||
blend_options_reset);
|
||||
options->opacity = options->opacity_d = 100.0;
|
||||
options->paint_mode = options->paint_mode_d = NORMAL;
|
||||
paint_options_init ((PaintOptions *) options,
|
||||
BLEND,
|
||||
blend_options_reset);
|
||||
options->offset = options->offset_d = 0.0;
|
||||
options->blend_mode = options->blend_mode_d = FG_BG_RGB_MODE;
|
||||
options->gradient_type = options->gradient_type_d = LINEAR;
|
||||
|
@ -340,62 +319,13 @@ blend_options_new ()
|
|||
options->threshold = options->threshold_d = 0.2;
|
||||
|
||||
/* the main vbox */
|
||||
vbox = options->tool_options.main_vbox;
|
||||
|
||||
/* the opacity scale */
|
||||
table = gtk_table_new (2, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 6);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0);
|
||||
|
||||
label = gtk_label_new (_("Opacity:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 1.0);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
options->opacity_w =
|
||||
gtk_adjustment_new (options->opacity_d, 0.0, 100.0, 1.0, 1.0, 0.0);
|
||||
gtk_signal_connect (GTK_OBJECT (options->opacity_w), "value_changed",
|
||||
(GtkSignalFunc) tool_options_double_adjustment_update,
|
||||
&options->opacity);
|
||||
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);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), scale, 1, 2, 0, 1);
|
||||
gtk_widget_show (scale);
|
||||
|
||||
/* the paint mode menu */
|
||||
label = gtk_label_new (_("Mode:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
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.0, 0.5, 0.0, 0.0);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), abox, 1, 2, 1, 2);
|
||||
gtk_widget_show (abox);
|
||||
|
||||
options->paint_mode_w = gtk_option_menu_new ();
|
||||
gtk_container_add (GTK_CONTAINER (abox), options->paint_mode_w);
|
||||
gtk_widget_show (options->paint_mode_w);
|
||||
|
||||
menu = create_paint_mode_menu (paint_mode_callback, NULL);
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (options->paint_mode_w), menu);
|
||||
|
||||
/* show the table */
|
||||
gtk_widget_show (table);
|
||||
|
||||
/* a separator after the paint mode options */
|
||||
separator = gtk_hseparator_new ();
|
||||
gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, FALSE, 0);
|
||||
gtk_widget_show (separator);
|
||||
vbox = ((ToolOptions *) options)->main_vbox;
|
||||
|
||||
/* the offset scale */
|
||||
table = gtk_table_new (4, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 6);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 1);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 3);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0);
|
||||
|
||||
label = gtk_label_new (_("Offset:"));
|
||||
|
@ -497,7 +427,7 @@ blend_options_new ()
|
|||
/* table for supersampling options */
|
||||
table = gtk_table_new (2, 2, FALSE);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (table), 2);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 6);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 1);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
||||
|
||||
|
@ -633,9 +563,9 @@ blend_button_release (Tool *tool,
|
|||
&nreturn_vals,
|
||||
PDB_DRAWABLE, drawable_ID (gimage_active_drawable (gimage)),
|
||||
PDB_INT32, (gint32) blend_options->blend_mode,
|
||||
PDB_INT32, (gint32) blend_options->paint_mode,
|
||||
PDB_INT32, (gint32) PAINT_OPTIONS_GET_PAINT_MODE (blend_options),
|
||||
PDB_INT32, (gint32) blend_options->gradient_type,
|
||||
PDB_FLOAT, (gdouble) blend_options->opacity,
|
||||
PDB_FLOAT, (gdouble) PAINT_OPTIONS_GET_OPACITY (blend_options) * 100,
|
||||
PDB_FLOAT, (gdouble) blend_options->offset,
|
||||
PDB_INT32, (gint32) blend_options->repeat,
|
||||
PDB_INT32, (gint32) blend_options->supersample,
|
||||
|
@ -661,9 +591,9 @@ blend_button_release (Tool *tool,
|
|||
blend (gimage,
|
||||
gimage_active_drawable (gimage),
|
||||
blend_options->blend_mode,
|
||||
blend_options->paint_mode,
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (blend_options),
|
||||
blend_options->gradient_type,
|
||||
blend_options->opacity,
|
||||
PAINT_OPTIONS_GET_OPACITY (blend_options) * 100,
|
||||
blend_options->offset,
|
||||
blend_options->repeat,
|
||||
blend_options->supersample,
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "gimage_mask.h"
|
||||
#include "interface.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "paint_options.h"
|
||||
#include "palette.h"
|
||||
#include "patterns.h"
|
||||
#include "selection.h"
|
||||
|
@ -47,15 +48,7 @@ struct _BucketTool
|
|||
typedef struct _BucketOptions BucketOptions;
|
||||
struct _BucketOptions
|
||||
{
|
||||
ToolOptions tool_options;
|
||||
|
||||
double opacity;
|
||||
double opacity_d;
|
||||
GtkObject *opacity_w;
|
||||
|
||||
int paint_mode;
|
||||
int paint_mode_d;
|
||||
GtkWidget *paint_mode_w;
|
||||
PaintOptions paint_options;
|
||||
|
||||
double threshold;
|
||||
double threshold_d;
|
||||
|
@ -100,23 +93,12 @@ bucket_fill_mode_callback (GtkWidget *widget,
|
|||
bucket_options->fill_mode = (BucketFillMode) client_data;
|
||||
}
|
||||
|
||||
static void
|
||||
bucket_fill_paint_mode_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
bucket_options->paint_mode = (long) client_data;
|
||||
}
|
||||
|
||||
static void
|
||||
bucket_options_reset (void)
|
||||
{
|
||||
BucketOptions *options = bucket_options;
|
||||
|
||||
options->paint_mode = options->paint_mode_d;
|
||||
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->opacity_w),
|
||||
options->opacity_d);
|
||||
gtk_option_menu_set_history (GTK_OPTION_MENU (options->paint_mode_w), 0);
|
||||
paint_options_reset ((PaintOptions *) options);
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->sample_merged_w),
|
||||
options->sample_merged_d);
|
||||
|
@ -134,17 +116,13 @@ bucket_options_new (void)
|
|||
BucketOptions *options;
|
||||
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *table;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *abox;
|
||||
GtkWidget *label;
|
||||
GtkWidget *scale;
|
||||
GtkWidget *menu;
|
||||
GSList *group = NULL;
|
||||
GtkWidget *radio_frame;
|
||||
GtkWidget *radio_box;
|
||||
GtkWidget *radio_button;
|
||||
GtkWidget *separator;
|
||||
|
||||
int i;
|
||||
char *button_names[2] =
|
||||
|
@ -155,69 +133,18 @@ bucket_options_new (void)
|
|||
|
||||
/* the new bucket fill tool options structure */
|
||||
options = (BucketOptions *) g_malloc (sizeof (BucketOptions));
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
_("Bucket Fill Options"),
|
||||
bucket_options_reset);
|
||||
options->opacity = options->opacity_d = 100.0;
|
||||
options->paint_mode = options->paint_mode_d = NORMAL;
|
||||
paint_options_init ((PaintOptions *) options,
|
||||
BUCKET_FILL,
|
||||
bucket_options_reset);
|
||||
options->sample_merged = options->sample_merged_d = FALSE;
|
||||
options->threshold = options->threshold_d = 15.0;
|
||||
options->fill_mode = options->fill_mode_d = FG_BUCKET_FILL;
|
||||
|
||||
/* the main vbox */
|
||||
vbox = options->tool_options.main_vbox;
|
||||
|
||||
/* the opacity scale */
|
||||
table = gtk_table_new (2, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 6);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
||||
|
||||
label = gtk_label_new (_("Opacity:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 1.0);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
options->opacity_w =
|
||||
gtk_adjustment_new (options->opacity_d, 0.0, 100.0, 1.0, 1.0, 0.0);
|
||||
scale = gtk_hscale_new (GTK_ADJUSTMENT (options->opacity_w));
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), scale, 1, 2, 0, 1);
|
||||
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->opacity_w), "value_changed",
|
||||
(GtkSignalFunc) tool_options_double_adjustment_update,
|
||||
&options->opacity);
|
||||
gtk_widget_show (scale);
|
||||
|
||||
/* the paint mode menu */
|
||||
label = gtk_label_new (_("Mode:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
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.0, 0.5, 0.0, 0.0);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), abox, 1, 2, 1, 2);
|
||||
gtk_widget_show (abox);
|
||||
|
||||
options->paint_mode_w = gtk_option_menu_new ();
|
||||
gtk_container_add (GTK_CONTAINER (abox), options->paint_mode_w);
|
||||
gtk_widget_show (options->paint_mode_w);
|
||||
|
||||
menu = create_paint_mode_menu (bucket_fill_paint_mode_callback, NULL);
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (options->paint_mode_w), menu);
|
||||
|
||||
/* show the table */
|
||||
gtk_widget_show (table);
|
||||
|
||||
/* a separator after the paint mode options */
|
||||
separator = gtk_hseparator_new ();
|
||||
gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, FALSE, 0);
|
||||
gtk_widget_show (separator);
|
||||
vbox = ((ToolOptions *) options)->main_vbox;
|
||||
|
||||
/* the threshold scale */
|
||||
hbox = gtk_hbox_new (FALSE, 6);
|
||||
hbox = gtk_hbox_new (FALSE, 4);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
|
||||
label = gtk_label_new (_("Threshold:"));
|
||||
|
@ -335,8 +262,8 @@ bucket_fill_button_release (Tool *tool,
|
|||
&nreturn_vals,
|
||||
PDB_DRAWABLE, drawable_ID (gimage_active_drawable (gdisp->gimage)),
|
||||
PDB_INT32, (gint32) fill_mode,
|
||||
PDB_INT32, (gint32) bucket_options->paint_mode,
|
||||
PDB_FLOAT, (gdouble) bucket_options->opacity,
|
||||
PDB_INT32, (gint32) PAINT_OPTIONS_GET_PAINT_MODE (bucket_options),
|
||||
PDB_FLOAT, (gdouble) PAINT_OPTIONS_GET_OPACITY (bucket_options) * 100,
|
||||
PDB_FLOAT, (gdouble) bucket_options->threshold,
|
||||
PDB_INT32, (gint32) bucket_options->sample_merged,
|
||||
PDB_FLOAT, (gdouble) bucket_tool->target_x,
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "appenv.h"
|
||||
#include "gimpbrushlist.h"
|
||||
#include "drawable.h"
|
||||
#include "errors.h"
|
||||
#include "gdisplay.h"
|
||||
|
@ -26,6 +25,7 @@
|
|||
#include "interface.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "paint_core.h"
|
||||
#include "paint_options.h"
|
||||
#include "patterns.h"
|
||||
#include "clone.h"
|
||||
#include "selection.h"
|
||||
|
@ -48,15 +48,15 @@ typedef enum
|
|||
typedef struct _CloneOptions CloneOptions;
|
||||
struct _CloneOptions
|
||||
{
|
||||
ToolOptions tool_options;
|
||||
PaintOptions paint_options;
|
||||
|
||||
CloneType type;
|
||||
CloneType type_d;
|
||||
GtkWidget *type_w[2]; /* 2 radio buttons */
|
||||
CloneType type;
|
||||
CloneType type_d;
|
||||
GtkWidget *type_w[2]; /* 2 radio buttons */
|
||||
|
||||
AlignType aligned;
|
||||
AlignType aligned_d;
|
||||
GtkWidget *aligned_w[3]; /* 3 radio buttons */
|
||||
AlignType aligned;
|
||||
AlignType aligned_d;
|
||||
GtkWidget *aligned_w[3]; /* 3 radio buttons */
|
||||
};
|
||||
|
||||
|
||||
|
@ -111,6 +111,8 @@ clone_options_reset (void)
|
|||
{
|
||||
CloneOptions *options = clone_options;
|
||||
|
||||
paint_options_reset ((PaintOptions *) options);
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->aligned_w[options->aligned_d]), TRUE);
|
||||
}
|
||||
|
@ -141,14 +143,14 @@ clone_options_new (void)
|
|||
|
||||
/* the new clone tool options structure */
|
||||
options = (CloneOptions *) g_malloc (sizeof (CloneOptions));
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
_("Clone Tool Options"),
|
||||
clone_options_reset);
|
||||
paint_options_init ((PaintOptions *) options,
|
||||
CLONE,
|
||||
clone_options_reset);
|
||||
options->type = options->type_d = IMAGE_CLONE;
|
||||
options->aligned = options->aligned_d = AlignNo;
|
||||
|
||||
/* the main vbox */
|
||||
vbox = options->tool_options.main_vbox;
|
||||
vbox = ((ToolOptions *) options)->main_vbox;
|
||||
|
||||
/* the radio frame and box */
|
||||
radio_frame = gtk_frame_new (_("Source"));
|
||||
|
@ -541,8 +543,9 @@ clone_motion (PaintCore *paint_core,
|
|||
|
||||
/* paste the newly painted canvas to the gimage which is being worked on */
|
||||
paint_core_paste_canvas (paint_core, drawable, OPAQUE_OPACITY,
|
||||
(int) (gimp_brush_get_opacity () * 255),
|
||||
gimp_brush_get_paint_mode (), SOFT, CONSTANT);
|
||||
(int) (PAINT_OPTIONS_GET_OPACITY (clone_options) * 255),
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (clone_options),
|
||||
SOFT, CONSTANT);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -18,13 +18,13 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "appenv.h"
|
||||
#include "gimpbrushlist.h"
|
||||
#include "drawable.h"
|
||||
#include "errors.h"
|
||||
#include "convolve.h"
|
||||
#include "gdisplay.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "paint_core.h"
|
||||
#include "paint_options.h"
|
||||
#include "selection.h"
|
||||
#include "tool_options_ui.h"
|
||||
#include "tools.h"
|
||||
|
@ -43,7 +43,7 @@
|
|||
typedef struct _ConvolveOptions ConvolveOptions;
|
||||
struct _ConvolveOptions
|
||||
{
|
||||
ToolOptions tool_options;
|
||||
PaintOptions paint_options;
|
||||
|
||||
ConvolveType type;
|
||||
ConvolveType type_d;
|
||||
|
@ -114,6 +114,8 @@ convolve_options_reset (void)
|
|||
{
|
||||
ConvolveOptions *options = convolve_options;
|
||||
|
||||
paint_options_reset ((PaintOptions *) options);
|
||||
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->pressure_w),
|
||||
options->pressure_d);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
|
||||
|
@ -143,17 +145,17 @@ convolve_options_new (void)
|
|||
|
||||
/* the new convolve tool options structure */
|
||||
options = (ConvolveOptions *) g_malloc (sizeof (ConvolveOptions));
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
_("Convolver Options"),
|
||||
convolve_options_reset);
|
||||
paint_options_init ((PaintOptions *) options,
|
||||
CONVOLVE,
|
||||
convolve_options_reset);
|
||||
options->type = options->type_d = BLUR_CONVOLVE;
|
||||
options->pressure = options->pressure_d = 50.0;
|
||||
|
||||
/* the main vbox */
|
||||
vbox = options->tool_options.main_vbox;
|
||||
vbox = ((ToolOptions *) options)->main_vbox;
|
||||
|
||||
/* the pressure scale */
|
||||
hbox = gtk_hbox_new (FALSE, 6);
|
||||
hbox = gtk_hbox_new (FALSE, 4);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
|
||||
label = gtk_label_new (_("Pressure:"));
|
||||
|
@ -346,7 +348,7 @@ convolve_motion (PaintCore *paint_core,
|
|||
|
||||
/* paste the newly painted canvas to the gimage which is being worked on */
|
||||
paint_core_replace_canvas (paint_core, drawable, OPAQUE_OPACITY,
|
||||
(int) (gimp_brush_get_opacity () * 255),
|
||||
(int) (PAINT_OPTIONS_GET_OPACITY (convolve_options) * 255),
|
||||
SOFT, INCREMENTAL);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,12 +17,12 @@
|
|||
*/
|
||||
#include <stdlib.h>
|
||||
#include "appenv.h"
|
||||
#include "gimpbrushlist.h"
|
||||
#include "drawable.h"
|
||||
#include "errors.h"
|
||||
#include "gdisplay.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "paint_core.h"
|
||||
#include "paint_options.h"
|
||||
#include "palette.h"
|
||||
#include "eraser.h"
|
||||
#include "selection.h"
|
||||
|
@ -36,15 +36,15 @@
|
|||
typedef struct _EraserOptions EraserOptions;
|
||||
struct _EraserOptions
|
||||
{
|
||||
ToolOptions tool_options;
|
||||
PaintOptions paint_options;
|
||||
|
||||
gboolean hard;
|
||||
gboolean hard_d;
|
||||
GtkWidget *hard_w;
|
||||
gboolean hard;
|
||||
gboolean hard_d;
|
||||
GtkWidget *hard_w;
|
||||
|
||||
gboolean incremental;
|
||||
gboolean incremental_d;
|
||||
GtkWidget *incremental_w;
|
||||
gboolean incremental;
|
||||
gboolean incremental_d;
|
||||
GtkWidget *incremental_w;
|
||||
};
|
||||
|
||||
|
||||
|
@ -68,6 +68,8 @@ eraser_options_reset (void)
|
|||
{
|
||||
EraserOptions *options = eraser_options;
|
||||
|
||||
paint_options_reset ((PaintOptions *) options);
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->hard_w),
|
||||
options->hard_d);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->incremental_w),
|
||||
|
@ -83,14 +85,14 @@ eraser_options_new (void)
|
|||
|
||||
/* the new eraser tool options structure */
|
||||
options = (EraserOptions *) g_malloc (sizeof (EraserOptions));
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
_("Eraser Options"),
|
||||
eraser_options_reset);
|
||||
paint_options_init ((PaintOptions *) options,
|
||||
ERASER,
|
||||
eraser_options_reset);
|
||||
options->hard = options->hard_d = FALSE;
|
||||
options->incremental = options->incremental_d = FALSE;
|
||||
|
||||
/* the main vbox */
|
||||
vbox = options->tool_options.main_vbox;
|
||||
vbox = ((ToolOptions *) options)->main_vbox;
|
||||
|
||||
/* the hard toggle */
|
||||
options->hard_w = gtk_check_button_new_with_label (_("Hard edge"));
|
||||
|
@ -196,11 +198,11 @@ eraser_motion (PaintCore *paint_core,
|
|||
/* color the pixels */
|
||||
color_pixels (temp_buf_data (area), col,
|
||||
area->width * area->height, area->bytes);
|
||||
opacity = 255 * gimp_brush_get_opacity() * (paint_core->curpressure / 0.5);
|
||||
opacity = 255 * paint_options_get_opacity() * (paint_core->curpressure / 0.5);
|
||||
if(opacity > OPAQUE_OPACITY) opacity=OPAQUE_OPACITY;
|
||||
/* paste the newly painted canvas to the gimage which is being worked on */
|
||||
paint_core_paste_canvas (paint_core, drawable, opacity,
|
||||
(int) (gimp_brush_get_opacity () * 255),
|
||||
(int) (PAINT_OPTIONS_GET_OPACITY (eraser_options) * 255),
|
||||
ERASE_MODE, hard? HARD : SOFT, incremental ? INCREMENTAL : CONSTANT);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,9 +22,9 @@
|
|||
#include "drawable.h"
|
||||
#include "draw_core.h"
|
||||
#include "gimage_mask.h"
|
||||
#include "gimpbrushlist.h"
|
||||
#include "gimprc.h"
|
||||
#include "ink.h"
|
||||
#include "paint_options.h"
|
||||
#include "tool_options_ui.h"
|
||||
#include "tools.h"
|
||||
#include "undo.h"
|
||||
|
@ -80,37 +80,37 @@ struct _BrushWidget
|
|||
typedef struct _InkOptions InkOptions;
|
||||
struct _InkOptions
|
||||
{
|
||||
ToolOptions tool_options;
|
||||
PaintOptions paint_options;
|
||||
|
||||
double size;
|
||||
double size_d;
|
||||
GtkObject *size_w;
|
||||
double size;
|
||||
double size_d;
|
||||
GtkObject *size_w;
|
||||
|
||||
double sensitivity;
|
||||
double sensitivity_d;
|
||||
GtkObject *sensitivity_w;
|
||||
double sensitivity;
|
||||
double sensitivity_d;
|
||||
GtkObject *sensitivity_w;
|
||||
|
||||
double vel_sensitivity;
|
||||
double vel_sensitivity_d;
|
||||
GtkObject *vel_sensitivity_w;
|
||||
double vel_sensitivity;
|
||||
double vel_sensitivity_d;
|
||||
GtkObject *vel_sensitivity_w;
|
||||
|
||||
double tilt_sensitivity;
|
||||
double tilt_sensitivity_d;
|
||||
GtkObject *tilt_sensitivity_w;
|
||||
double tilt_sensitivity;
|
||||
double tilt_sensitivity_d;
|
||||
GtkObject *tilt_sensitivity_w;
|
||||
|
||||
double tilt_angle;
|
||||
double tilt_angle_d;
|
||||
GtkObject *tilt_angle_w;
|
||||
double tilt_angle;
|
||||
double tilt_angle_d;
|
||||
GtkObject *tilt_angle_w;
|
||||
|
||||
BlobFunc function;
|
||||
BlobFunc function_d;
|
||||
GtkWidget *function_w[3]; /* 3 radio buttons */
|
||||
BlobFunc function;
|
||||
BlobFunc function_d;
|
||||
GtkWidget *function_w[3]; /* 3 radio buttons */
|
||||
|
||||
double aspect;
|
||||
double aspect_d;
|
||||
double angle;
|
||||
double angle_d;
|
||||
BrushWidget *brush_w;
|
||||
double aspect;
|
||||
double aspect_d;
|
||||
double angle;
|
||||
double angle_d;
|
||||
BrushWidget *brush_w;
|
||||
};
|
||||
|
||||
|
||||
|
@ -226,6 +226,8 @@ ink_options_reset (void)
|
|||
{
|
||||
InkOptions *options = ink_options;
|
||||
|
||||
paint_options_reset ((PaintOptions *) options);
|
||||
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->size_w),
|
||||
options->size_d);
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->sensitivity_w),
|
||||
|
@ -265,9 +267,9 @@ ink_options_new (void)
|
|||
|
||||
/* the new ink tool options structure */
|
||||
options = (InkOptions *) g_malloc (sizeof (InkOptions));
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
_("Ink Options"),
|
||||
ink_options_reset);
|
||||
paint_options_init ((PaintOptions *) options,
|
||||
INK,
|
||||
ink_options_reset);
|
||||
options->size = options->size_d = 4.4;
|
||||
options->sensitivity = options->sensitivity_d = 1.0;
|
||||
options->vel_sensitivity = options->vel_sensitivity_d = 0.8;
|
||||
|
@ -278,13 +280,14 @@ ink_options_new (void)
|
|||
options->angle = options->angle_d = 0.0;
|
||||
|
||||
/* the main table */
|
||||
table = gtk_table_new (8, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 6);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 1);
|
||||
table = gtk_table_new (9, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 2);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 1, 2);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 3, 2);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 5, 6);
|
||||
gtk_box_pack_start (GTK_BOX (options->tool_options.main_vbox), table,
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 5, 2);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 7, 4);
|
||||
gtk_box_pack_start (GTK_BOX (((ToolOptions *) options)->main_vbox), table,
|
||||
FALSE, FALSE, 0);
|
||||
|
||||
/* size slider */
|
||||
|
@ -1413,8 +1416,8 @@ ink_paste (InkTool *ink_tool,
|
|||
/* apply the paint area to the gimage */
|
||||
gimage_apply_image (gimage, drawable, &srcPR,
|
||||
FALSE,
|
||||
(int) (gimp_brush_get_opacity () * 255),
|
||||
gimp_brush_get_paint_mode(),
|
||||
(int) (PAINT_OPTIONS_GET_OPACITY (ink_options) * 255),
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (ink_options),
|
||||
undo_tiles, /* specify an alternative src1 */
|
||||
canvas_buf->x, canvas_buf->y);
|
||||
|
||||
|
|
|
@ -0,0 +1,101 @@
|
|||
/* 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.
|
||||
*/
|
||||
#ifndef __PAINT_OPTIONS_H__
|
||||
#define __PAINT_OPTIONS_H__
|
||||
|
||||
#include "buildmenu.h"
|
||||
#include "gimprc.h"
|
||||
#include "tools.h"
|
||||
#include "tool_options.h"
|
||||
|
||||
|
||||
/* these macros return the global or tool-specific values, according
|
||||
* to the current mode
|
||||
*/
|
||||
|
||||
#define PAINT_OPTIONS_GET_OPACITY(options) \
|
||||
(global_paint_options ? \
|
||||
paint_options_get_opacity () : \
|
||||
((PaintOptions *)(options))->opacity)
|
||||
|
||||
#define PAINT_OPTIONS_GET_PAINT_MODE(options) \
|
||||
(global_paint_options ? \
|
||||
paint_options_get_paint_mode () : \
|
||||
((PaintOptions *)(options))->paint_mode)
|
||||
|
||||
|
||||
/* the paint options structures
|
||||
*/
|
||||
typedef struct _PaintOptions PaintOptions;
|
||||
struct _PaintOptions
|
||||
{
|
||||
ToolOptions tool_options;
|
||||
|
||||
/* vbox for the common paint options */
|
||||
GtkWidget *paint_vbox;
|
||||
|
||||
/* a widget to be shown if we are in global mode */
|
||||
GtkWidget *global;
|
||||
|
||||
/* options used by all paint tools */
|
||||
double opacity;
|
||||
double opacity_d;
|
||||
GtkObject *opacity_w;
|
||||
|
||||
int paint_mode;
|
||||
int paint_mode_d;
|
||||
GtkWidget *paint_mode_w;
|
||||
};
|
||||
|
||||
|
||||
/* paint tool options functions
|
||||
*/
|
||||
PaintOptions *paint_options_new (ToolType tool_type,
|
||||
ToolOptionsResetFunc reset_func);
|
||||
|
||||
void paint_options_reset (PaintOptions *options);
|
||||
|
||||
/* to be used by "derived" paint options only
|
||||
*/
|
||||
void paint_options_init (PaintOptions *options,
|
||||
ToolType tool_type,
|
||||
ToolOptionsResetFunc reset_func);
|
||||
|
||||
|
||||
/* functions for the global paint options
|
||||
*/
|
||||
|
||||
/* switch between global and per-tool paint options
|
||||
*/
|
||||
void paint_options_set_global (gboolean global);
|
||||
|
||||
/* global paint options access functions
|
||||
*/
|
||||
double paint_options_get_opacity (void);
|
||||
void paint_options_set_opacity (double opacity);
|
||||
|
||||
int paint_options_get_paint_mode (void);
|
||||
void paint_options_set_paint_mode (int paint_mode);
|
||||
|
||||
|
||||
/* a utility function which returns a paint mode menu
|
||||
*/
|
||||
GtkWidget *paint_mode_menu_new (MenuItemCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
#endif /* __PAINT_OPTIONS_H__ */
|
|
@ -17,14 +17,14 @@
|
|||
*/
|
||||
#include <stdlib.h>
|
||||
#include "appenv.h"
|
||||
#include "gimpbrushlist.h"
|
||||
#include "drawable.h"
|
||||
#include "errors.h"
|
||||
#include "gdisplay.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "paint_core.h"
|
||||
#include "palette.h"
|
||||
#include "paint_options.h"
|
||||
#include "paintbrush.h"
|
||||
#include "palette.h"
|
||||
#include "pencil.h"
|
||||
#include "selection.h"
|
||||
#include "tools.h"
|
||||
|
@ -33,7 +33,7 @@
|
|||
|
||||
|
||||
/* the pencil tool options */
|
||||
static ToolOptions * pencil_options = NULL;
|
||||
static PaintOptions * pencil_options = NULL;
|
||||
|
||||
|
||||
/* forward function declarations */
|
||||
|
@ -66,6 +66,12 @@ pencil_paint_func (PaintCore *paint_core,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
pencil_options_reset (void)
|
||||
{
|
||||
paint_options_reset (pencil_options);
|
||||
}
|
||||
|
||||
Tool *
|
||||
tools_new_pencil (void)
|
||||
{
|
||||
|
@ -75,8 +81,8 @@ tools_new_pencil (void)
|
|||
/* The tool options */
|
||||
if (!pencil_options)
|
||||
{
|
||||
pencil_options = tool_options_new (_("Pencil Options"));
|
||||
tools_register (PENCIL, pencil_options);
|
||||
pencil_options = paint_options_new (PENCIL, pencil_options_reset);
|
||||
tools_register (PENCIL, (ToolOptions *) pencil_options);
|
||||
}
|
||||
|
||||
tool = paint_core_new (PENCIL);
|
||||
|
@ -119,8 +125,8 @@ pencil_motion (PaintCore *paint_core,
|
|||
|
||||
/* paste the newly painted canvas to the gimage which is being worked on */
|
||||
paint_core_paste_canvas (paint_core, drawable, OPAQUE_OPACITY,
|
||||
(int) (gimp_brush_get_opacity () * 255),
|
||||
gimp_brush_get_paint_mode (), HARD, CONSTANT);
|
||||
(int) (PAINT_OPTIONS_GET_OPACITY (pencil_options) * 255),
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (pencil_options), HARD, CONSTANT);
|
||||
}
|
||||
|
||||
static void *
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "appenv.h"
|
||||
#include "gimpbrushlist.h"
|
||||
#include "drawable.h"
|
||||
#include "errors.h"
|
||||
#include "gdisplay.h"
|
||||
|
@ -26,6 +25,7 @@
|
|||
#include "interface.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "paint_core.h"
|
||||
#include "paint_options.h"
|
||||
#include "patterns.h"
|
||||
#include "clone.h"
|
||||
#include "selection.h"
|
||||
|
@ -48,15 +48,15 @@ typedef enum
|
|||
typedef struct _CloneOptions CloneOptions;
|
||||
struct _CloneOptions
|
||||
{
|
||||
ToolOptions tool_options;
|
||||
PaintOptions paint_options;
|
||||
|
||||
CloneType type;
|
||||
CloneType type_d;
|
||||
GtkWidget *type_w[2]; /* 2 radio buttons */
|
||||
CloneType type;
|
||||
CloneType type_d;
|
||||
GtkWidget *type_w[2]; /* 2 radio buttons */
|
||||
|
||||
AlignType aligned;
|
||||
AlignType aligned_d;
|
||||
GtkWidget *aligned_w[3]; /* 3 radio buttons */
|
||||
AlignType aligned;
|
||||
AlignType aligned_d;
|
||||
GtkWidget *aligned_w[3]; /* 3 radio buttons */
|
||||
};
|
||||
|
||||
|
||||
|
@ -111,6 +111,8 @@ clone_options_reset (void)
|
|||
{
|
||||
CloneOptions *options = clone_options;
|
||||
|
||||
paint_options_reset ((PaintOptions *) options);
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->aligned_w[options->aligned_d]), TRUE);
|
||||
}
|
||||
|
@ -141,14 +143,14 @@ clone_options_new (void)
|
|||
|
||||
/* the new clone tool options structure */
|
||||
options = (CloneOptions *) g_malloc (sizeof (CloneOptions));
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
_("Clone Tool Options"),
|
||||
clone_options_reset);
|
||||
paint_options_init ((PaintOptions *) options,
|
||||
CLONE,
|
||||
clone_options_reset);
|
||||
options->type = options->type_d = IMAGE_CLONE;
|
||||
options->aligned = options->aligned_d = AlignNo;
|
||||
|
||||
/* the main vbox */
|
||||
vbox = options->tool_options.main_vbox;
|
||||
vbox = ((ToolOptions *) options)->main_vbox;
|
||||
|
||||
/* the radio frame and box */
|
||||
radio_frame = gtk_frame_new (_("Source"));
|
||||
|
@ -541,8 +543,9 @@ clone_motion (PaintCore *paint_core,
|
|||
|
||||
/* paste the newly painted canvas to the gimage which is being worked on */
|
||||
paint_core_paste_canvas (paint_core, drawable, OPAQUE_OPACITY,
|
||||
(int) (gimp_brush_get_opacity () * 255),
|
||||
gimp_brush_get_paint_mode (), SOFT, CONSTANT);
|
||||
(int) (PAINT_OPTIONS_GET_OPACITY (clone_options) * 255),
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (clone_options),
|
||||
SOFT, CONSTANT);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -164,7 +164,7 @@ text_options_new (void)
|
|||
gtk_widget_show (options->antialias_w);
|
||||
|
||||
/* the border spinbutton */
|
||||
hbox = gtk_hbox_new (FALSE, 6);
|
||||
hbox = gtk_hbox_new (FALSE, 4);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
|
||||
label = gtk_label_new (_("Border:"));
|
||||
|
|
|
@ -22,9 +22,9 @@
|
|||
#include "drawable.h"
|
||||
#include "draw_core.h"
|
||||
#include "gimage_mask.h"
|
||||
#include "gimpbrushlist.h"
|
||||
#include "gimprc.h"
|
||||
#include "ink.h"
|
||||
#include "paint_options.h"
|
||||
#include "tool_options_ui.h"
|
||||
#include "tools.h"
|
||||
#include "undo.h"
|
||||
|
@ -80,37 +80,37 @@ struct _BrushWidget
|
|||
typedef struct _InkOptions InkOptions;
|
||||
struct _InkOptions
|
||||
{
|
||||
ToolOptions tool_options;
|
||||
PaintOptions paint_options;
|
||||
|
||||
double size;
|
||||
double size_d;
|
||||
GtkObject *size_w;
|
||||
double size;
|
||||
double size_d;
|
||||
GtkObject *size_w;
|
||||
|
||||
double sensitivity;
|
||||
double sensitivity_d;
|
||||
GtkObject *sensitivity_w;
|
||||
double sensitivity;
|
||||
double sensitivity_d;
|
||||
GtkObject *sensitivity_w;
|
||||
|
||||
double vel_sensitivity;
|
||||
double vel_sensitivity_d;
|
||||
GtkObject *vel_sensitivity_w;
|
||||
double vel_sensitivity;
|
||||
double vel_sensitivity_d;
|
||||
GtkObject *vel_sensitivity_w;
|
||||
|
||||
double tilt_sensitivity;
|
||||
double tilt_sensitivity_d;
|
||||
GtkObject *tilt_sensitivity_w;
|
||||
double tilt_sensitivity;
|
||||
double tilt_sensitivity_d;
|
||||
GtkObject *tilt_sensitivity_w;
|
||||
|
||||
double tilt_angle;
|
||||
double tilt_angle_d;
|
||||
GtkObject *tilt_angle_w;
|
||||
double tilt_angle;
|
||||
double tilt_angle_d;
|
||||
GtkObject *tilt_angle_w;
|
||||
|
||||
BlobFunc function;
|
||||
BlobFunc function_d;
|
||||
GtkWidget *function_w[3]; /* 3 radio buttons */
|
||||
BlobFunc function;
|
||||
BlobFunc function_d;
|
||||
GtkWidget *function_w[3]; /* 3 radio buttons */
|
||||
|
||||
double aspect;
|
||||
double aspect_d;
|
||||
double angle;
|
||||
double angle_d;
|
||||
BrushWidget *brush_w;
|
||||
double aspect;
|
||||
double aspect_d;
|
||||
double angle;
|
||||
double angle_d;
|
||||
BrushWidget *brush_w;
|
||||
};
|
||||
|
||||
|
||||
|
@ -226,6 +226,8 @@ ink_options_reset (void)
|
|||
{
|
||||
InkOptions *options = ink_options;
|
||||
|
||||
paint_options_reset ((PaintOptions *) options);
|
||||
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->size_w),
|
||||
options->size_d);
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->sensitivity_w),
|
||||
|
@ -265,9 +267,9 @@ ink_options_new (void)
|
|||
|
||||
/* the new ink tool options structure */
|
||||
options = (InkOptions *) g_malloc (sizeof (InkOptions));
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
_("Ink Options"),
|
||||
ink_options_reset);
|
||||
paint_options_init ((PaintOptions *) options,
|
||||
INK,
|
||||
ink_options_reset);
|
||||
options->size = options->size_d = 4.4;
|
||||
options->sensitivity = options->sensitivity_d = 1.0;
|
||||
options->vel_sensitivity = options->vel_sensitivity_d = 0.8;
|
||||
|
@ -278,13 +280,14 @@ ink_options_new (void)
|
|||
options->angle = options->angle_d = 0.0;
|
||||
|
||||
/* the main table */
|
||||
table = gtk_table_new (8, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 6);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 1);
|
||||
table = gtk_table_new (9, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 2);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 1, 2);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 3, 2);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 5, 6);
|
||||
gtk_box_pack_start (GTK_BOX (options->tool_options.main_vbox), table,
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 5, 2);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 7, 4);
|
||||
gtk_box_pack_start (GTK_BOX (((ToolOptions *) options)->main_vbox), table,
|
||||
FALSE, FALSE, 0);
|
||||
|
||||
/* size slider */
|
||||
|
@ -1413,8 +1416,8 @@ ink_paste (InkTool *ink_tool,
|
|||
/* apply the paint area to the gimage */
|
||||
gimage_apply_image (gimage, drawable, &srcPR,
|
||||
FALSE,
|
||||
(int) (gimp_brush_get_opacity () * 255),
|
||||
gimp_brush_get_paint_mode(),
|
||||
(int) (PAINT_OPTIONS_GET_OPACITY (ink_options) * 255),
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (ink_options),
|
||||
undo_tiles, /* specify an alternative src1 */
|
||||
canvas_buf->x, canvas_buf->y);
|
||||
|
||||
|
|
|
@ -433,10 +433,10 @@ paint_core_init (paint_core, drawable, x, y)
|
|||
GTK_SIGNAL_FUNC(paint_core_invalidate_cache),
|
||||
NULL);
|
||||
|
||||
paint_core->spacing = (double) gimp_brush_get_spacing () / 100.0;
|
||||
paint_core->spacing = (double) gimp_brush_get_spacing (brush) / 100.0;
|
||||
/* paint_core->spacing =
|
||||
(double) MAXIMUM (brush->mask->width, brush->mask->height) *
|
||||
((double) gimp_brush_get_spacing () / 100.0);
|
||||
((double) gimp_brush_get_spacing (brush) / 100.0);
|
||||
if (paint_core->spacing < 1.0)
|
||||
paint_core->spacing = 1.0; */
|
||||
paint_core->brush = brush;
|
||||
|
|
|
@ -0,0 +1,101 @@
|
|||
/* 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.
|
||||
*/
|
||||
#ifndef __PAINT_OPTIONS_H__
|
||||
#define __PAINT_OPTIONS_H__
|
||||
|
||||
#include "buildmenu.h"
|
||||
#include "gimprc.h"
|
||||
#include "tools.h"
|
||||
#include "tool_options.h"
|
||||
|
||||
|
||||
/* these macros return the global or tool-specific values, according
|
||||
* to the current mode
|
||||
*/
|
||||
|
||||
#define PAINT_OPTIONS_GET_OPACITY(options) \
|
||||
(global_paint_options ? \
|
||||
paint_options_get_opacity () : \
|
||||
((PaintOptions *)(options))->opacity)
|
||||
|
||||
#define PAINT_OPTIONS_GET_PAINT_MODE(options) \
|
||||
(global_paint_options ? \
|
||||
paint_options_get_paint_mode () : \
|
||||
((PaintOptions *)(options))->paint_mode)
|
||||
|
||||
|
||||
/* the paint options structures
|
||||
*/
|
||||
typedef struct _PaintOptions PaintOptions;
|
||||
struct _PaintOptions
|
||||
{
|
||||
ToolOptions tool_options;
|
||||
|
||||
/* vbox for the common paint options */
|
||||
GtkWidget *paint_vbox;
|
||||
|
||||
/* a widget to be shown if we are in global mode */
|
||||
GtkWidget *global;
|
||||
|
||||
/* options used by all paint tools */
|
||||
double opacity;
|
||||
double opacity_d;
|
||||
GtkObject *opacity_w;
|
||||
|
||||
int paint_mode;
|
||||
int paint_mode_d;
|
||||
GtkWidget *paint_mode_w;
|
||||
};
|
||||
|
||||
|
||||
/* paint tool options functions
|
||||
*/
|
||||
PaintOptions *paint_options_new (ToolType tool_type,
|
||||
ToolOptionsResetFunc reset_func);
|
||||
|
||||
void paint_options_reset (PaintOptions *options);
|
||||
|
||||
/* to be used by "derived" paint options only
|
||||
*/
|
||||
void paint_options_init (PaintOptions *options,
|
||||
ToolType tool_type,
|
||||
ToolOptionsResetFunc reset_func);
|
||||
|
||||
|
||||
/* functions for the global paint options
|
||||
*/
|
||||
|
||||
/* switch between global and per-tool paint options
|
||||
*/
|
||||
void paint_options_set_global (gboolean global);
|
||||
|
||||
/* global paint options access functions
|
||||
*/
|
||||
double paint_options_get_opacity (void);
|
||||
void paint_options_set_opacity (double opacity);
|
||||
|
||||
int paint_options_get_paint_mode (void);
|
||||
void paint_options_set_paint_mode (int paint_mode);
|
||||
|
||||
|
||||
/* a utility function which returns a paint mode menu
|
||||
*/
|
||||
GtkWidget *paint_mode_menu_new (MenuItemCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
#endif /* __PAINT_OPTIONS_H__ */
|
|
@ -19,7 +19,6 @@
|
|||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include "appenv.h"
|
||||
#include "gimpbrushlist.h"
|
||||
#include "drawable.h"
|
||||
#include "errors.h"
|
||||
#include "gdisplay.h"
|
||||
|
@ -27,6 +26,7 @@
|
|||
#include "paint_funcs.h"
|
||||
#include "paint_core.h"
|
||||
#include "palette.h"
|
||||
#include "paint_options.h"
|
||||
#include "paintbrush.h"
|
||||
#include "selection.h"
|
||||
#include "tool_options_ui.h"
|
||||
|
@ -39,34 +39,34 @@
|
|||
|
||||
/* the paintbrush structures */
|
||||
|
||||
typedef struct _PaintOptions PaintOptions;
|
||||
struct _PaintOptions
|
||||
typedef struct _PaintbrushOptions PaintbrushOptions;
|
||||
struct _PaintbrushOptions
|
||||
{
|
||||
ToolOptions tool_options;
|
||||
PaintOptions paint_options;
|
||||
|
||||
double fade_out;
|
||||
double fade_out_d;
|
||||
GtkObject *fade_out_w;
|
||||
double fade_out;
|
||||
double fade_out_d;
|
||||
GtkObject *fade_out_w;
|
||||
|
||||
int use_gradient;
|
||||
int use_gradient_d;
|
||||
GtkWidget *use_gradient_w;
|
||||
int use_gradient;
|
||||
int use_gradient_d;
|
||||
GtkWidget *use_gradient_w;
|
||||
|
||||
double gradient_length;
|
||||
double gradient_length_d;
|
||||
GtkObject *gradient_length_w;
|
||||
double gradient_length;
|
||||
double gradient_length_d;
|
||||
GtkObject *gradient_length_w;
|
||||
|
||||
int gradient_type;
|
||||
int gradient_type_d;
|
||||
GtkWidget *gradient_type_w[4]; /* 4 radio buttons */
|
||||
int gradient_type;
|
||||
int gradient_type_d;
|
||||
GtkWidget *gradient_type_w[4]; /* 4 radio buttons */
|
||||
|
||||
gboolean incremental;
|
||||
gboolean incremental_d;
|
||||
GtkWidget *incremental_w;
|
||||
gboolean incremental;
|
||||
gboolean incremental_d;
|
||||
GtkWidget *incremental_w;
|
||||
};
|
||||
|
||||
/* the paint brush tool options */
|
||||
static PaintOptions *paintbrush_options = NULL;
|
||||
static PaintbrushOptions *paintbrush_options = NULL;
|
||||
|
||||
/* local variables */
|
||||
static double non_gui_fade_out;
|
||||
|
@ -85,7 +85,7 @@ static void
|
|||
paintbrush_gradient_toggle_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
PaintOptions *options = paintbrush_options;
|
||||
PaintbrushOptions *options = paintbrush_options;
|
||||
|
||||
static int incremental_save = FALSE;
|
||||
|
||||
|
@ -116,7 +116,9 @@ paintbrush_gradient_type_callback (GtkWidget *widget,
|
|||
static void
|
||||
paintbrush_options_reset (void)
|
||||
{
|
||||
PaintOptions *options = paintbrush_options;
|
||||
PaintbrushOptions *options = paintbrush_options;
|
||||
|
||||
paint_options_reset ((PaintOptions *) options);
|
||||
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->fade_out_w),
|
||||
options->fade_out_d);
|
||||
|
@ -130,10 +132,10 @@ paintbrush_options_reset (void)
|
|||
options->incremental_d);
|
||||
}
|
||||
|
||||
static PaintOptions *
|
||||
static PaintbrushOptions *
|
||||
paintbrush_options_new (void)
|
||||
{
|
||||
PaintOptions *options;
|
||||
PaintbrushOptions *options;
|
||||
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *abox;
|
||||
|
@ -155,10 +157,10 @@ paintbrush_options_new (void)
|
|||
};
|
||||
|
||||
/* the new paint tool options structure */
|
||||
options = (PaintOptions *) g_malloc (sizeof (PaintOptions));
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
_("Paintbrush Options"),
|
||||
paintbrush_options_reset);
|
||||
options = (PaintbrushOptions *) g_malloc (sizeof (PaintbrushOptions));
|
||||
paint_options_init ((PaintOptions *) options,
|
||||
PAINTBRUSH,
|
||||
paintbrush_options_reset);
|
||||
options->fade_out = options->fade_out_d = 0.0;
|
||||
options->incremental = options->incremental_d = FALSE;
|
||||
options->use_gradient = options->use_gradient_d = FALSE;
|
||||
|
@ -166,11 +168,11 @@ paintbrush_options_new (void)
|
|||
options->gradient_type = options->gradient_type_d = LOOP_TRIANGLE;
|
||||
|
||||
/* the main vbox */
|
||||
vbox = options->tool_options.main_vbox;
|
||||
vbox = ((ToolOptions *) options)->main_vbox;
|
||||
|
||||
/* the fade-out scale */
|
||||
table = gtk_table_new (4, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 6);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 2);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 2, 3);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
||||
|
@ -437,8 +439,9 @@ paintbrush_motion (PaintCore *paint_core,
|
|||
|
||||
/* paste the newly painted canvas to the gimage which is being worked on */
|
||||
paint_core_paste_canvas (paint_core, drawable, temp_blend,
|
||||
(int) (gimp_brush_get_opacity () * 255),
|
||||
gimp_brush_get_paint_mode (), PRESSURE,
|
||||
(int) (PAINT_OPTIONS_GET_OPACITY (paintbrush_options) * 255),
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (paintbrush_options),
|
||||
PRESSURE,
|
||||
incremental ? INCREMENTAL : CONSTANT);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,14 +17,14 @@
|
|||
*/
|
||||
#include <stdlib.h>
|
||||
#include "appenv.h"
|
||||
#include "gimpbrushlist.h"
|
||||
#include "drawable.h"
|
||||
#include "errors.h"
|
||||
#include "gdisplay.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "paint_core.h"
|
||||
#include "palette.h"
|
||||
#include "paint_options.h"
|
||||
#include "paintbrush.h"
|
||||
#include "palette.h"
|
||||
#include "pencil.h"
|
||||
#include "selection.h"
|
||||
#include "tools.h"
|
||||
|
@ -33,7 +33,7 @@
|
|||
|
||||
|
||||
/* the pencil tool options */
|
||||
static ToolOptions * pencil_options = NULL;
|
||||
static PaintOptions * pencil_options = NULL;
|
||||
|
||||
|
||||
/* forward function declarations */
|
||||
|
@ -66,6 +66,12 @@ pencil_paint_func (PaintCore *paint_core,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
pencil_options_reset (void)
|
||||
{
|
||||
paint_options_reset (pencil_options);
|
||||
}
|
||||
|
||||
Tool *
|
||||
tools_new_pencil (void)
|
||||
{
|
||||
|
@ -75,8 +81,8 @@ tools_new_pencil (void)
|
|||
/* The tool options */
|
||||
if (!pencil_options)
|
||||
{
|
||||
pencil_options = tool_options_new (_("Pencil Options"));
|
||||
tools_register (PENCIL, pencil_options);
|
||||
pencil_options = paint_options_new (PENCIL, pencil_options_reset);
|
||||
tools_register (PENCIL, (ToolOptions *) pencil_options);
|
||||
}
|
||||
|
||||
tool = paint_core_new (PENCIL);
|
||||
|
@ -119,8 +125,8 @@ pencil_motion (PaintCore *paint_core,
|
|||
|
||||
/* paste the newly painted canvas to the gimage which is being worked on */
|
||||
paint_core_paste_canvas (paint_core, drawable, OPAQUE_OPACITY,
|
||||
(int) (gimp_brush_get_opacity () * 255),
|
||||
gimp_brush_get_paint_mode (), HARD, CONSTANT);
|
||||
(int) (PAINT_OPTIONS_GET_OPACITY (pencil_options) * 255),
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (pencil_options), HARD, CONSTANT);
|
||||
}
|
||||
|
||||
static void *
|
||||
|
|
|
@ -164,7 +164,7 @@ text_options_new (void)
|
|||
gtk_widget_show (options->antialias_w);
|
||||
|
||||
/* the border spinbutton */
|
||||
hbox = gtk_hbox_new (FALSE, 6);
|
||||
hbox = gtk_hbox_new (FALSE, 4);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
|
||||
label = gtk_label_new (_("Border:"));
|
||||
|
|
|
@ -15,14 +15,26 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include "brush_select.h"
|
||||
#include "gimprc.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "paint_options.h"
|
||||
#include "selection_options.h"
|
||||
#include "tool_options_ui.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
#include "libgimp/gimpunitmenu.h"
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
/* ui helper functions */
|
||||
/* the global paint options */
|
||||
static double global_opacity = 1.0;
|
||||
static int global_paint_mode = 0;
|
||||
|
||||
/* a list of all PaintOptions */
|
||||
static GSList *paint_options_list = NULL;
|
||||
|
||||
|
||||
/* ui helper functions ******************************************************/
|
||||
|
||||
void
|
||||
tool_options_toggle_update (GtkWidget *widget,
|
||||
|
@ -77,6 +89,16 @@ tool_options_double_adjustment_update (GtkWidget *widget,
|
|||
*val = GTK_ADJUSTMENT (widget)->value;
|
||||
}
|
||||
|
||||
void
|
||||
tool_options_opacity_adjustment_update (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
double *val;
|
||||
|
||||
val = (double *) data;
|
||||
*val = GTK_ADJUSTMENT (widget)->value / 100;
|
||||
}
|
||||
|
||||
void
|
||||
tool_options_unitmenu_update (GtkWidget *widget,
|
||||
gpointer data)
|
||||
|
@ -101,8 +123,20 @@ tool_options_unitmenu_update (GtkWidget *widget,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
tool_options_paint_mode_update (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
PaintOptions *options;
|
||||
|
||||
/* tool options functions */
|
||||
options = (PaintOptions *) gtk_object_get_user_data (GTK_OBJECT (widget));
|
||||
|
||||
if (options)
|
||||
options->paint_mode = (long) data;
|
||||
}
|
||||
|
||||
|
||||
/* tool options functions ***************************************************/
|
||||
|
||||
void
|
||||
tool_options_init (ToolOptions *options,
|
||||
|
@ -131,7 +165,7 @@ tool_options_new (gchar *title)
|
|||
return options;
|
||||
}
|
||||
|
||||
/* selection tool options functions */
|
||||
/* selection tool options functions *****************************************/
|
||||
|
||||
void
|
||||
selection_options_init (SelectionOptions *options,
|
||||
|
@ -161,7 +195,7 @@ selection_options_init (SelectionOptions *options,
|
|||
_("Intelligent Scissors Options") :
|
||||
((tool_type == BY_COLOR_SELECT) ?
|
||||
_("By-Color Select Options") :
|
||||
_("Unknown Selection Type ???")))))))),
|
||||
_("ERROR: Unknown Selection Type")))))))),
|
||||
reset_func);
|
||||
|
||||
/* the main vbox */
|
||||
|
@ -188,7 +222,7 @@ selection_options_init (SelectionOptions *options,
|
|||
|
||||
/* the feather toggle button */
|
||||
table = gtk_table_new (2, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 6);
|
||||
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"));
|
||||
|
@ -314,7 +348,7 @@ selection_options_init (SelectionOptions *options,
|
|||
gtk_widget_show (alignment);
|
||||
|
||||
table = gtk_table_new (3, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 6);
|
||||
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);
|
||||
|
||||
|
@ -448,3 +482,280 @@ selection_options_reset (SelectionOptions *options)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* paint tool options functions *********************************************/
|
||||
|
||||
void
|
||||
paint_options_init (PaintOptions *options,
|
||||
ToolType tool_type,
|
||||
ToolOptionsResetFunc reset_func)
|
||||
{
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *abox;
|
||||
GtkWidget *table;
|
||||
GtkWidget *label;
|
||||
GtkWidget *scale;
|
||||
GtkWidget *menu;
|
||||
GtkWidget *separator;
|
||||
|
||||
/* initialize the tool options structure */
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
((tool_type == BUCKET_FILL) ?
|
||||
_("Bucket Fill Options") :
|
||||
((tool_type == BLEND) ?
|
||||
_("Blend Options") :
|
||||
((tool_type == PENCIL) ?
|
||||
_("Pencil Options") :
|
||||
((tool_type == PAINTBRUSH) ?
|
||||
_("Paintbrush Options") :
|
||||
((tool_type == ERASER) ?
|
||||
_("Erazer Options") :
|
||||
((tool_type == AIRBRUSH) ?
|
||||
_("Airbrush Options") :
|
||||
((tool_type == CLONE) ?
|
||||
_("Clone Tool Options") :
|
||||
((tool_type == CONVOLVE) ?
|
||||
_("Convolver Options") :
|
||||
((tool_type == INK) ?
|
||||
_("Ink Options") :
|
||||
_("ERROR: Unknown Paint Type")))))))))),
|
||||
reset_func);
|
||||
|
||||
/* initialize the paint options structure */
|
||||
options->opacity = options->opacity_d = 1.0;
|
||||
options->paint_mode = options->paint_mode_d = 0;
|
||||
|
||||
options->global = NULL;
|
||||
options->opacity_w = NULL;
|
||||
options->paint_mode_w = NULL;
|
||||
|
||||
/* 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 */
|
||||
label = gtk_label_new (_("Opacity:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 1.0);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
options->opacity_w =
|
||||
gtk_adjustment_new (options->opacity_d * 100, 0.0, 100.0, 1.0, 1.0, 0.0);
|
||||
gtk_signal_connect (GTK_OBJECT (options->opacity_w), "value_changed",
|
||||
(GtkSignalFunc) tool_options_opacity_adjustment_update,
|
||||
&options->opacity);
|
||||
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);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), scale, 1, 2, 0, 1);
|
||||
gtk_widget_show (scale);
|
||||
|
||||
/* the paint mode menu */
|
||||
switch (tool_type)
|
||||
{
|
||||
case BUCKET_FILL:
|
||||
case BLEND:
|
||||
case PENCIL:
|
||||
case PAINTBRUSH:
|
||||
case AIRBRUSH:
|
||||
case CLONE:
|
||||
case INK:
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 2);
|
||||
|
||||
label = gtk_label_new (_("Mode:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
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.0, 0.5, 0.0, 0.0);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), abox, 1, 2, 1, 2);
|
||||
gtk_widget_show (abox);
|
||||
|
||||
options->paint_mode_w = gtk_option_menu_new ();
|
||||
gtk_container_add (GTK_CONTAINER (abox), options->paint_mode_w);
|
||||
gtk_widget_show (options->paint_mode_w);
|
||||
|
||||
menu =
|
||||
paint_mode_menu_new (tool_options_paint_mode_update, (gpointer) options);
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (options->paint_mode_w), menu);
|
||||
break;
|
||||
case CONVOLVE:
|
||||
case ERASER:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* show the main table */
|
||||
gtk_widget_show (table);
|
||||
|
||||
/* a separator after the common paint options */
|
||||
if (tool_type != PENCIL)
|
||||
{
|
||||
separator = gtk_hseparator_new ();
|
||||
gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, FALSE, 0);
|
||||
gtk_widget_show (separator);
|
||||
}
|
||||
|
||||
if (! global_paint_options)
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
/* 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;
|
||||
GtkWidget *label;
|
||||
|
||||
options = (PaintOptions *) g_malloc (sizeof (PaintOptions));
|
||||
paint_options_init (options, tool_type, reset_func);
|
||||
|
||||
options->global = gtk_vbox_new (FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (options->tool_options.main_vbox),
|
||||
options->global, FALSE, FALSE, 0);
|
||||
|
||||
label = gtk_label_new (_("This tool has no options."));
|
||||
gtk_box_pack_start (GTK_BOX (options->global), label, FALSE, FALSE, 6);
|
||||
gtk_widget_show (label);
|
||||
|
||||
if (global_paint_options && options->global)
|
||||
gtk_widget_show (options->global);
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
void
|
||||
paint_options_reset (PaintOptions *options)
|
||||
{
|
||||
if (options->opacity_w)
|
||||
{
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->opacity_w),
|
||||
options->opacity_d * 100);
|
||||
}
|
||||
if (options->paint_mode_w)
|
||||
{
|
||||
options->paint_mode = options->paint_mode_d;
|
||||
gtk_option_menu_set_history (GTK_OPTION_MENU (options->paint_mode_w),
|
||||
options->paint_mode_d);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* 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);
|
||||
}
|
||||
|
||||
double
|
||||
paint_options_get_opacity (void)
|
||||
{
|
||||
return global_opacity;
|
||||
}
|
||||
|
||||
void
|
||||
paint_options_set_opacity (double opacity)
|
||||
{
|
||||
global_opacity = opacity;
|
||||
}
|
||||
|
||||
int
|
||||
paint_options_get_paint_mode (void)
|
||||
{
|
||||
return global_paint_mode;
|
||||
}
|
||||
|
||||
void
|
||||
paint_options_set_paint_mode (int paint_mode)
|
||||
{
|
||||
global_paint_mode = paint_mode;
|
||||
}
|
||||
|
||||
|
||||
/* create a paint mode menu *************************************************/
|
||||
|
||||
GtkWidget *
|
||||
paint_mode_menu_new (MenuItemCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWidget *menu;
|
||||
int i;
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -722,7 +722,7 @@ void
|
|||
tools_options_dialog_new ()
|
||||
{
|
||||
GtkWidget *frame;
|
||||
GtkWidget *frame2;
|
||||
/* GtkWidget *frame2; */
|
||||
GtkWidget *vbox;
|
||||
|
||||
ActionAreaItem action_items[2] =
|
||||
|
|
Loading…
Reference in New Issue