mirror of https://github.com/GNOME/gimp.git
app/airbrush.c app/blend.c app/bucket_fill.c app/clone.c app/convolve.c
1999-07-06 Michael Natterer <mitschel@cs.tu-berlin.de> * app/airbrush.c * app/blend.c * app/bucket_fill.c * app/clone.c * app/convolve.c * app/dodgeburn.c * app/eraser.c * app/ink.c * app/paintbrush.c * app/pencil.c * app/smudge.c: get opacity/paint mode from the current context (currently always the user context). * app/gimage_mask.c: the "stroke" command uses the paintbrush's settings if the current context is the user context and we are in per-tool paint options mode. * app/context_manager.[ch] * app/paint_options.h * app/preferences_dialog.c * app/tool_options.c * app/tools.c: moved the global/per-tool paint options switching to the context manager. The tool options themselves only contain the widgets for them now. This should fix the segfaults happening in per-tool mode. Removed the disclaimer from the prefs. dlg. as it seems to work now. The impl. in the context manager however is still a hack. * app/brush_select.c * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb: same as above. * app/lc_dialog.c: minimal code reduction. No functionality changed.
This commit is contained in:
parent
ac28d6b929
commit
1058f41dab
36
ChangeLog
36
ChangeLog
|
@ -1,3 +1,39 @@
|
|||
1999-07-06 Michael Natterer <mitschel@cs.tu-berlin.de>
|
||||
|
||||
* app/airbrush.c
|
||||
* app/blend.c
|
||||
* app/bucket_fill.c
|
||||
* app/clone.c
|
||||
* app/convolve.c
|
||||
* app/dodgeburn.c
|
||||
* app/eraser.c
|
||||
* app/ink.c
|
||||
* app/paintbrush.c
|
||||
* app/pencil.c
|
||||
* app/smudge.c: get opacity/paint mode from the current context
|
||||
(currently always the user context).
|
||||
|
||||
* app/gimage_mask.c: the "stroke" command uses the paintbrush's
|
||||
settings if the current context is the user context and we are in
|
||||
per-tool paint options mode.
|
||||
|
||||
* app/context_manager.[ch]
|
||||
* app/paint_options.h
|
||||
* app/preferences_dialog.c
|
||||
* app/tool_options.c
|
||||
* app/tools.c: moved the global/per-tool paint options switching
|
||||
to the context manager. The tool options themselves only contain
|
||||
the widgets for them now. This should fix the segfaults happening
|
||||
in per-tool mode.
|
||||
Removed the disclaimer from the prefs. dlg. as it seems to work
|
||||
now. The impl. in the context manager however is still a hack.
|
||||
|
||||
* app/brush_select.c
|
||||
* app/brushes_cmds.c
|
||||
* tools/pdbgen/pdb/brushes.pdb: same as above.
|
||||
|
||||
* app/lc_dialog.c: minimal code reduction. No functionality changed.
|
||||
|
||||
Mon Jul 5 22:51:37 BST 1999 Austin Donnelly <austin@gimp.org>
|
||||
|
||||
* TODO: Removed zoom indicator in titlebar, since we already have
|
||||
|
|
|
@ -266,9 +266,9 @@ airbrush_time_out (gpointer client_data)
|
|||
|
||||
|
||||
static void
|
||||
airbrush_motion (PaintCore *paint_core,
|
||||
airbrush_motion (PaintCore *paint_core,
|
||||
GimpDrawable *drawable,
|
||||
double pressure)
|
||||
double pressure)
|
||||
{
|
||||
gint opacity;
|
||||
GImage *gimage;
|
||||
|
@ -300,16 +300,16 @@ airbrush_motion (PaintCore *paint_core,
|
|||
/* paste the newly painted area to the image */
|
||||
paint_core_paste_canvas (paint_core, drawable,
|
||||
opacity,
|
||||
(int) (PAINT_OPTIONS_GET_OPACITY (airbrush_options) * 255),
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (airbrush_options),
|
||||
(gint) (gimp_context_get_opacity (NULL) * 255),
|
||||
gimp_context_get_paint_mode (NULL),
|
||||
SOFT, CONSTANT);
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
airbrush_non_gui_paint_func (PaintCore *paint_core,
|
||||
airbrush_non_gui_paint_func (PaintCore *paint_core,
|
||||
GimpDrawable *drawable,
|
||||
int state)
|
||||
int state)
|
||||
{
|
||||
airbrush_motion (paint_core, drawable, non_gui_pressure);
|
||||
|
||||
|
|
39
app/blend.c
39
app/blend.c
|
@ -562,23 +562,24 @@ blend_button_release (Tool *tool,
|
|||
/* we can't do callbacks easily with the PDB, so this UI/backend
|
||||
* separation (though good) is ignored for the moment */
|
||||
#ifdef BLEND_UI_CALLS_VIA_PDB
|
||||
return_vals = procedural_db_run_proc ("gimp_blend",
|
||||
&nreturn_vals,
|
||||
PDB_DRAWABLE, drawable_ID (gimage_active_drawable (gimage)),
|
||||
PDB_INT32, (gint32) blend_options->blend_mode,
|
||||
PDB_INT32, (gint32) PAINT_OPTIONS_GET_PAINT_MODE (blend_options),
|
||||
PDB_INT32, (gint32) blend_options->gradient_type,
|
||||
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,
|
||||
PDB_INT32, (gint32) blend_options->max_depth,
|
||||
PDB_FLOAT, (gdouble) blend_options->threshold,
|
||||
PDB_FLOAT, (gdouble) blend_tool->startx,
|
||||
PDB_FLOAT, (gdouble) blend_tool->starty,
|
||||
PDB_FLOAT, (gdouble) blend_tool->endx,
|
||||
PDB_FLOAT, (gdouble) blend_tool->endy,
|
||||
PDB_END);
|
||||
return_vals =
|
||||
procedural_db_run_proc ("gimp_blend",
|
||||
&nreturn_vals,
|
||||
PDB_DRAWABLE, drawable_ID (gimage_active_drawable (gimage)),
|
||||
PDB_INT32, (gint32) blend_options->blend_mode,
|
||||
PDB_INT32, (gint32) gimp_context_get_paint_mode (NULL),
|
||||
PDB_INT32, (gint32) blend_options->gradient_type,
|
||||
PDB_FLOAT, (gdouble) gimp_context_get_opacity (NULL) * 100,
|
||||
PDB_FLOAT, (gdouble) blend_options->offset,
|
||||
PDB_INT32, (gint32) blend_options->repeat,
|
||||
PDB_INT32, (gint32) blend_options->supersample,
|
||||
PDB_INT32, (gint32) blend_options->max_depth,
|
||||
PDB_FLOAT, (gdouble) blend_options->threshold,
|
||||
PDB_FLOAT, (gdouble) blend_tool->startx,
|
||||
PDB_FLOAT, (gdouble) blend_tool->starty,
|
||||
PDB_FLOAT, (gdouble) blend_tool->endx,
|
||||
PDB_FLOAT, (gdouble) blend_tool->endy,
|
||||
PDB_END);
|
||||
|
||||
if (return_vals && return_vals[0].value.pdb_int == PDB_SUCCESS)
|
||||
gdisplays_flush ();
|
||||
|
@ -594,9 +595,9 @@ blend_button_release (Tool *tool,
|
|||
blend (gimage,
|
||||
gimage_active_drawable (gimage),
|
||||
blend_options->blend_mode,
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (blend_options),
|
||||
gimp_context_get_paint_mode (NULL),
|
||||
blend_options->gradient_type,
|
||||
PAINT_OPTIONS_GET_OPACITY (blend_options) * 100,
|
||||
gimp_context_get_opacity (NULL) * 100,
|
||||
blend_options->offset,
|
||||
blend_options->repeat,
|
||||
blend_options->supersample,
|
||||
|
|
|
@ -19,8 +19,10 @@
|
|||
#include "appenv.h"
|
||||
#include "actionarea.h"
|
||||
#include "gimpbrushlist.h"
|
||||
#include "gimpcontext.h"
|
||||
#include "gimplist.h"
|
||||
#include "gimpbrushgenerated.h"
|
||||
#include "gimprc.h"
|
||||
#include "brush_edit.h"
|
||||
#include "brush_select.h"
|
||||
#include "colormaps.h"
|
||||
|
@ -161,6 +163,7 @@ brush_select_new (gchar *title,
|
|||
else
|
||||
{
|
||||
gtk_window_set_title (GTK_WINDOW (bsp->shell), title);
|
||||
|
||||
if (init_name && strlen (init_name))
|
||||
active = gimp_brush_list_get_brush (brush_list, init_name);
|
||||
if (active)
|
||||
|
@ -415,14 +418,16 @@ brush_select_new (gchar *title,
|
|||
bsp->redraw = FALSE;
|
||||
if (!gotinitbrush)
|
||||
{
|
||||
bsp->opacity_value = paint_options_get_opacity ();
|
||||
GimpContext *context = gimp_context_get_user ();
|
||||
|
||||
bsp->opacity_value = gimp_context_get_opacity (context);
|
||||
bsp->paint_mode = gimp_context_get_paint_mode (context);
|
||||
bsp->spacing_value = gimp_brush_get_spacing (active);
|
||||
bsp->paint_mode = paint_options_get_paint_mode ();
|
||||
}
|
||||
else
|
||||
{
|
||||
bsp->opacity_value = init_opacity;
|
||||
bsp->paint_mode = init_mode;
|
||||
bsp->paint_mode = init_mode;
|
||||
}
|
||||
brush_select_select (bsp, gimp_brush_list_get_brush_index (brush_list,
|
||||
active));
|
||||
|
@ -1309,7 +1314,10 @@ paint_mode_menu_callback (GtkWidget *w,
|
|||
BrushSelectP bsp = (BrushSelectP) gtk_object_get_user_data (GTK_OBJECT (w));
|
||||
|
||||
if (bsp == brush_select_dialog)
|
||||
paint_options_set_paint_mode ((int) client_data);
|
||||
{
|
||||
gimp_context_set_paint_mode (gimp_context_get_user (),
|
||||
(int) client_data);
|
||||
}
|
||||
else
|
||||
{
|
||||
bsp->paint_mode = (int) client_data;
|
||||
|
@ -1324,8 +1332,11 @@ opacity_scale_update (GtkAdjustment *adjustment,
|
|||
{
|
||||
BrushSelectP bsp = (BrushSelectP) data;
|
||||
|
||||
if(bsp == brush_select_dialog)
|
||||
paint_options_set_opacity (adjustment->value / 100.0);
|
||||
if (bsp == brush_select_dialog)
|
||||
{
|
||||
gimp_context_set_opacity (gimp_context_get_user (),
|
||||
adjustment->value / 100.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
bsp->opacity_value = (adjustment->value / 100.0);
|
||||
|
|
|
@ -24,9 +24,9 @@
|
|||
|
||||
#include "gimpbrush.h"
|
||||
#include "gimpbrushlistP.h"
|
||||
#include "gimpcontext.h"
|
||||
#include "gimplist.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "paint_options.h"
|
||||
|
||||
static ProcRecord brushes_refresh_proc;
|
||||
static ProcRecord brushes_get_brush_proc;
|
||||
|
@ -204,7 +204,7 @@ brushes_get_opacity_invoker (Argument *args)
|
|||
Argument *return_args;
|
||||
|
||||
return_args = procedural_db_return_args (&brushes_get_opacity_proc, TRUE);
|
||||
return_args[1].value.pdb_float = paint_options_get_opacity () * 100.0;
|
||||
return_args[1].value.pdb_float = gimp_context_get_opacity (NULL) * 100.0;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
@ -245,7 +245,7 @@ brushes_set_opacity_invoker (Argument *args)
|
|||
success = FALSE;
|
||||
|
||||
if (success)
|
||||
paint_options_set_opacity (opacity / 100.0);
|
||||
gimp_context_set_opacity (NULL, opacity / 100.0);
|
||||
|
||||
return procedural_db_return_args (&brushes_set_opacity_proc, success);
|
||||
}
|
||||
|
@ -358,7 +358,7 @@ brushes_get_paint_mode_invoker (Argument *args)
|
|||
Argument *return_args;
|
||||
|
||||
return_args = procedural_db_return_args (&brushes_get_paint_mode_proc, TRUE);
|
||||
return_args[1].value.pdb_int = paint_options_get_paint_mode ();
|
||||
return_args[1].value.pdb_int = gimp_context_get_paint_mode (NULL);
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
@ -399,7 +399,7 @@ brushes_set_paint_mode_invoker (Argument *args)
|
|||
success = FALSE;
|
||||
|
||||
if (success)
|
||||
paint_options_set_paint_mode (paint_mode);
|
||||
gimp_context_set_paint_mode (NULL, paint_mode);
|
||||
|
||||
return procedural_db_return_args (&brushes_set_paint_mode_proc, success);
|
||||
}
|
||||
|
|
|
@ -174,6 +174,7 @@ bucket_options_new (void)
|
|||
return options;
|
||||
}
|
||||
|
||||
/* bucket fill action functions */
|
||||
|
||||
static void
|
||||
bucket_fill_button_press (Tool *tool,
|
||||
|
@ -203,7 +204,6 @@ bucket_fill_button_press (Tool *tool,
|
|||
tool->state = ACTIVE;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
bucket_fill_button_release (Tool *tool,
|
||||
GdkEventButton *bevent,
|
||||
|
@ -223,17 +223,18 @@ bucket_fill_button_release (Tool *tool,
|
|||
/* if the 3rd button isn't pressed, fill the selected region */
|
||||
if (! (bevent->state & GDK_BUTTON3_MASK))
|
||||
{
|
||||
return_vals = procedural_db_run_proc ("gimp_bucket_fill",
|
||||
&nreturn_vals,
|
||||
PDB_DRAWABLE, drawable_ID (gimage_active_drawable (gdisp->gimage)),
|
||||
PDB_INT32, (gint32) bucket_options->fill_mode,
|
||||
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,
|
||||
PDB_FLOAT, (gdouble) bucket_tool->target_y,
|
||||
PDB_END);
|
||||
return_vals =
|
||||
procedural_db_run_proc ("gimp_bucket_fill",
|
||||
&nreturn_vals,
|
||||
PDB_DRAWABLE, drawable_ID (gimage_active_drawable (gdisp->gimage)),
|
||||
PDB_INT32, (gint32) bucket_options->fill_mode,
|
||||
PDB_INT32, (gint32) gimp_context_get_paint_mode (NULL),
|
||||
PDB_FLOAT, (gdouble) gimp_context_get_opacity (NULL) * 100,
|
||||
PDB_FLOAT, (gdouble) bucket_options->threshold,
|
||||
PDB_INT32, (gint32) bucket_options->sample_merged,
|
||||
PDB_FLOAT, (gdouble) bucket_tool->target_x,
|
||||
PDB_FLOAT, (gdouble) bucket_tool->target_y,
|
||||
PDB_END);
|
||||
|
||||
if (return_vals && return_vals[0].value.pdb_int == PDB_SUCCESS)
|
||||
gdisplays_flush ();
|
||||
|
|
|
@ -589,8 +589,8 @@ 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) (PAINT_OPTIONS_GET_OPACITY (clone_options) * 255),
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (clone_options),
|
||||
(int) (gimp_context_get_opacity (NULL) * 255),
|
||||
gimp_context_get_paint_mode (NULL),
|
||||
SOFT, CONSTANT);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,8 +20,12 @@
|
|||
|
||||
#include "appenv.h"
|
||||
#include "gdisplay.h"
|
||||
#include "gimprc.h"
|
||||
#include "tools.h"
|
||||
|
||||
static GimpContext * global_user_context;
|
||||
|
||||
|
||||
static void
|
||||
context_manager_display_changed (GimpContext *context,
|
||||
GDisplay *display,
|
||||
|
@ -48,12 +52,10 @@ context_manager_init (void)
|
|||
GimpContext *context;
|
||||
gint i;
|
||||
|
||||
/* Implicitly create the standard context
|
||||
*/
|
||||
/* Implicitly create the standard context */
|
||||
context = gimp_context_get_standard ();
|
||||
|
||||
/* To be loaded from disk later
|
||||
*/
|
||||
/* TODO: load from disk */
|
||||
context = gimp_context_new ("Default", NULL, NULL);
|
||||
gimp_context_set_default (context);
|
||||
|
||||
|
@ -64,10 +66,19 @@ context_manager_init (void)
|
|||
gimp_context_set_user (context);
|
||||
gimp_context_set_current (context);
|
||||
|
||||
global_user_context = gimp_context_new ("Don't use :)", NULL, context);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (context), "display_changed",
|
||||
GTK_SIGNAL_FUNC (context_manager_display_changed),
|
||||
NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (image_context), "remove",
|
||||
GTK_SIGNAL_FUNC (context_manager_image_removed),
|
||||
context);
|
||||
|
||||
/* Initialize the tools' contexts */
|
||||
for (i = 0; i < num_tools; i++)
|
||||
{
|
||||
switch (tool_info->tool_id)
|
||||
switch (tool_info[i].tool_id)
|
||||
{
|
||||
case BUCKET_FILL:
|
||||
case BLEND:
|
||||
|
@ -81,7 +92,7 @@ context_manager_init (void)
|
|||
case DODGEBURN:
|
||||
case SMUDGE:
|
||||
tool_info[i].tool_context =
|
||||
gimp_context_new (tool_info[i].private_tip, NULL, NULL);
|
||||
gimp_context_new (tool_info[i].private_tip, NULL, context);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -89,13 +100,6 @@ context_manager_init (void)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (context), "display_changed",
|
||||
GTK_SIGNAL_FUNC (context_manager_display_changed),
|
||||
NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (image_context), "remove",
|
||||
GTK_SIGNAL_FUNC (context_manager_image_removed),
|
||||
context);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -116,8 +120,77 @@ context_manager_free (void)
|
|||
gimp_context_set_user (NULL);
|
||||
gimp_context_set_current (NULL);
|
||||
|
||||
/* Save to disk before destroying later
|
||||
*/
|
||||
/* TODO: Save to disk before destroying */
|
||||
gtk_object_unref (GTK_OBJECT (gimp_context_get_default ()));
|
||||
gimp_context_set_default (NULL);
|
||||
}
|
||||
|
||||
void
|
||||
context_manager_set_global_paint_options (gboolean global)
|
||||
{
|
||||
GimpContext* context;
|
||||
|
||||
paint_options_set_global (global);
|
||||
|
||||
if (global)
|
||||
{
|
||||
if (active_tool &&
|
||||
(context = tool_info[active_tool->type].tool_context))
|
||||
{
|
||||
gimp_context_define_opacity (context, TRUE);
|
||||
gimp_context_define_paint_mode (context, TRUE);
|
||||
}
|
||||
|
||||
gimp_context_set_opacity (gimp_context_get_user (),
|
||||
gimp_context_get_opacity (global_user_context));
|
||||
gimp_context_set_paint_mode (gimp_context_get_user (),
|
||||
gimp_context_get_paint_mode (global_user_context));
|
||||
|
||||
gimp_context_define_opacity (global_user_context, FALSE);
|
||||
gimp_context_define_paint_mode (global_user_context, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_context_define_opacity (global_user_context, TRUE);
|
||||
gimp_context_define_paint_mode (global_user_context, TRUE);
|
||||
|
||||
if (active_tool &&
|
||||
(context = tool_info[active_tool->type].tool_context))
|
||||
{
|
||||
gimp_context_set_opacity (gimp_context_get_user (),
|
||||
gimp_context_get_opacity (context));
|
||||
gimp_context_set_paint_mode (gimp_context_get_user (),
|
||||
gimp_context_get_paint_mode (context));
|
||||
|
||||
gimp_context_define_opacity (context, FALSE);
|
||||
gimp_context_define_paint_mode (context, FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
context_manager_set_tool (ToolType tool_type)
|
||||
{
|
||||
GimpContext* context;
|
||||
|
||||
if (! global_paint_options)
|
||||
{
|
||||
if (active_tool &&
|
||||
(context = tool_info[active_tool->type].tool_context))
|
||||
{
|
||||
gimp_context_define_opacity (context, TRUE);
|
||||
gimp_context_define_paint_mode (context, TRUE);
|
||||
}
|
||||
|
||||
if ((context = tool_info[tool_type].tool_context))
|
||||
{
|
||||
gimp_context_set_opacity (gimp_context_get_user (),
|
||||
gimp_context_get_opacity (context));
|
||||
gimp_context_set_paint_mode (gimp_context_get_user (),
|
||||
gimp_context_get_paint_mode (context));
|
||||
|
||||
gimp_context_define_opacity (context, FALSE);
|
||||
gimp_context_define_paint_mode (context, FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,8 +19,12 @@
|
|||
#define __CONTEXT_MANAGER_H__
|
||||
|
||||
#include "gimpcontext.h"
|
||||
#include "toolsF.h"
|
||||
|
||||
void context_manager_init (void);
|
||||
void context_manager_free (void);
|
||||
|
||||
void context_manager_set_global_paint_options (gboolean global);
|
||||
void context_manager_set_tool (ToolType tool_type);
|
||||
|
||||
#endif /* __CONTEXT_MANAGER_H__ */
|
||||
|
|
|
@ -348,8 +348,8 @@ 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) (PAINT_OPTIONS_GET_OPACITY (convolve_options) * 255),
|
||||
SOFT, INCREMENTAL);
|
||||
(int) (gimp_context_get_opacity (NULL) * 255),
|
||||
SOFT, INCREMENTAL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -562,23 +562,24 @@ blend_button_release (Tool *tool,
|
|||
/* we can't do callbacks easily with the PDB, so this UI/backend
|
||||
* separation (though good) is ignored for the moment */
|
||||
#ifdef BLEND_UI_CALLS_VIA_PDB
|
||||
return_vals = procedural_db_run_proc ("gimp_blend",
|
||||
&nreturn_vals,
|
||||
PDB_DRAWABLE, drawable_ID (gimage_active_drawable (gimage)),
|
||||
PDB_INT32, (gint32) blend_options->blend_mode,
|
||||
PDB_INT32, (gint32) PAINT_OPTIONS_GET_PAINT_MODE (blend_options),
|
||||
PDB_INT32, (gint32) blend_options->gradient_type,
|
||||
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,
|
||||
PDB_INT32, (gint32) blend_options->max_depth,
|
||||
PDB_FLOAT, (gdouble) blend_options->threshold,
|
||||
PDB_FLOAT, (gdouble) blend_tool->startx,
|
||||
PDB_FLOAT, (gdouble) blend_tool->starty,
|
||||
PDB_FLOAT, (gdouble) blend_tool->endx,
|
||||
PDB_FLOAT, (gdouble) blend_tool->endy,
|
||||
PDB_END);
|
||||
return_vals =
|
||||
procedural_db_run_proc ("gimp_blend",
|
||||
&nreturn_vals,
|
||||
PDB_DRAWABLE, drawable_ID (gimage_active_drawable (gimage)),
|
||||
PDB_INT32, (gint32) blend_options->blend_mode,
|
||||
PDB_INT32, (gint32) gimp_context_get_paint_mode (NULL),
|
||||
PDB_INT32, (gint32) blend_options->gradient_type,
|
||||
PDB_FLOAT, (gdouble) gimp_context_get_opacity (NULL) * 100,
|
||||
PDB_FLOAT, (gdouble) blend_options->offset,
|
||||
PDB_INT32, (gint32) blend_options->repeat,
|
||||
PDB_INT32, (gint32) blend_options->supersample,
|
||||
PDB_INT32, (gint32) blend_options->max_depth,
|
||||
PDB_FLOAT, (gdouble) blend_options->threshold,
|
||||
PDB_FLOAT, (gdouble) blend_tool->startx,
|
||||
PDB_FLOAT, (gdouble) blend_tool->starty,
|
||||
PDB_FLOAT, (gdouble) blend_tool->endx,
|
||||
PDB_FLOAT, (gdouble) blend_tool->endy,
|
||||
PDB_END);
|
||||
|
||||
if (return_vals && return_vals[0].value.pdb_int == PDB_SUCCESS)
|
||||
gdisplays_flush ();
|
||||
|
@ -594,9 +595,9 @@ blend_button_release (Tool *tool,
|
|||
blend (gimage,
|
||||
gimage_active_drawable (gimage),
|
||||
blend_options->blend_mode,
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (blend_options),
|
||||
gimp_context_get_paint_mode (NULL),
|
||||
blend_options->gradient_type,
|
||||
PAINT_OPTIONS_GET_OPACITY (blend_options) * 100,
|
||||
gimp_context_get_opacity (NULL) * 100,
|
||||
blend_options->offset,
|
||||
blend_options->repeat,
|
||||
blend_options->supersample,
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "floating_sel.h"
|
||||
#include "gdisplay.h"
|
||||
#include "gimage_mask.h"
|
||||
#include "gimprc.h"
|
||||
#include "interface.h"
|
||||
#include "layer.h"
|
||||
#include "paint_core.h"
|
||||
|
@ -618,8 +619,9 @@ gimage_mask_stroke_paint_func (PaintCore *paint_core,
|
|||
GimpDrawable *drawable,
|
||||
int state)
|
||||
{
|
||||
GImage *gimage;
|
||||
TempBuf * area;
|
||||
GImage *gimage;
|
||||
TempBuf *area;
|
||||
GimpContext *context;
|
||||
unsigned char col[MAX_CHANNELS];
|
||||
|
||||
if (! (gimage = drawable_gimage (drawable)))
|
||||
|
@ -638,10 +640,17 @@ gimage_mask_stroke_paint_func (PaintCore *paint_core,
|
|||
color_pixels (temp_buf_data (area), col,
|
||||
area->width * area->height, area->bytes);
|
||||
|
||||
if (gimp_context_get_current () == gimp_context_get_user () &&
|
||||
! global_paint_options)
|
||||
context = tool_info[PAINTBRUSH].tool_context;
|
||||
else
|
||||
context = gimp_context_get_current ();
|
||||
|
||||
/* paste the newly painted canvas to the gimage which is being worked on */
|
||||
paint_core_paste_canvas (paint_core, drawable, OPAQUE_OPACITY,
|
||||
(int) (paint_options_get_opacity () * 255),
|
||||
paint_options_get_paint_mode (), SOFT, CONSTANT);
|
||||
(int) (gimp_context_get_opacity (context) * 255),
|
||||
gimp_context_get_paint_mode (context),
|
||||
SOFT, CONSTANT);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -27,10 +27,6 @@
|
|||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
/* 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;
|
||||
|
||||
|
@ -94,10 +90,20 @@ void
|
|||
tool_options_opacity_adjustment_update (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
double *val;
|
||||
gimp_context_set_opacity (GIMP_CONTEXT (data),
|
||||
GTK_ADJUSTMENT (widget)->value / 100);
|
||||
}
|
||||
|
||||
val = (double *) data;
|
||||
*val = GTK_ADJUSTMENT (widget)->value / 100;
|
||||
static void
|
||||
tool_options_paint_mode_update (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GimpContext *context;
|
||||
|
||||
context = (GimpContext *) gtk_object_get_user_data (GTK_OBJECT (widget));
|
||||
|
||||
gimp_context_set_paint_mode (GIMP_CONTEXT (context),
|
||||
(long) data);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -124,18 +130,6 @@ tool_options_unitmenu_update (GtkWidget *widget,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
tool_options_paint_mode_update (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
PaintOptions *options;
|
||||
|
||||
options = (PaintOptions *) gtk_object_get_user_data (GTK_OBJECT (widget));
|
||||
|
||||
if (options)
|
||||
options->paint_mode = (long) data;
|
||||
}
|
||||
|
||||
static void
|
||||
tool_options_radio_buttons_update (GtkWidget *widget,
|
||||
gpointer data)
|
||||
|
@ -206,7 +200,7 @@ tool_options_new (gchar *title)
|
|||
|
||||
GtkWidget *label;
|
||||
|
||||
options = (ToolOptions *) g_malloc (sizeof (ToolOptions));
|
||||
options = g_new (ToolOptions, 1);
|
||||
tool_options_init (options, title, NULL);
|
||||
|
||||
label = gtk_label_new (_("This tool has no options."));
|
||||
|
@ -233,20 +227,20 @@ selection_options_init (SelectionOptions *options,
|
|||
/* initialize the tool options structure */
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
((tool_type == RECT_SELECT) ?
|
||||
N_("Rectangular Select Options") :
|
||||
_("Rectangular Select Options") :
|
||||
((tool_type == ELLIPSE_SELECT) ?
|
||||
N_("Elliptical Selection Options") :
|
||||
_("Elliptical Selection Options") :
|
||||
((tool_type == FREE_SELECT) ?
|
||||
N_("Free-hand Selection Options") :
|
||||
_("Free-hand Selection Options") :
|
||||
((tool_type == FUZZY_SELECT) ?
|
||||
N_("Fuzzy Selection Options") :
|
||||
_("Fuzzy Selection Options") :
|
||||
((tool_type == BEZIER_SELECT) ?
|
||||
N_("Bezier Selection Options") :
|
||||
_("Bezier Selection Options") :
|
||||
((tool_type == ISCISSORS) ?
|
||||
N_("Intelligent Scissors Options") :
|
||||
_("Intelligent Scissors Options") :
|
||||
((tool_type == BY_COLOR_SELECT) ?
|
||||
N_("By-Color Select Options") :
|
||||
N_("ERROR: Unknown Selection Type")))))))),
|
||||
_("By-Color Select Options") :
|
||||
_("ERROR: Unknown Selection Type")))))))),
|
||||
reset_func);
|
||||
|
||||
/* the main vbox */
|
||||
|
@ -480,7 +474,7 @@ selection_options_new (ToolType tool_type,
|
|||
{
|
||||
SelectionOptions *options;
|
||||
|
||||
options = (SelectionOptions *) g_malloc (sizeof (SelectionOptions));
|
||||
options = g_new (SelectionOptions, 1);
|
||||
selection_options_init (options, tool_type, reset_func);
|
||||
|
||||
return options;
|
||||
|
@ -550,37 +544,36 @@ paint_options_init (PaintOptions *options,
|
|||
GtkWidget *menu;
|
||||
GtkWidget *separator;
|
||||
|
||||
GimpContext *tool_context = tool_info[tool_type].tool_context;
|
||||
|
||||
/* initialize the tool options structure */
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
((tool_type == BUCKET_FILL) ?
|
||||
N_("Bucket Fill Options") :
|
||||
_("Bucket Fill Options") :
|
||||
((tool_type == BLEND) ?
|
||||
N_("Blend Options") :
|
||||
_("Blend Options") :
|
||||
((tool_type == PENCIL) ?
|
||||
N_("Pencil Options") :
|
||||
_("Pencil Options") :
|
||||
((tool_type == PAINTBRUSH) ?
|
||||
N_("Paintbrush Options") :
|
||||
_("Paintbrush Options") :
|
||||
((tool_type == ERASER) ?
|
||||
N_("Erazer Options") :
|
||||
_("Erazer Options") :
|
||||
((tool_type == AIRBRUSH) ?
|
||||
N_("Airbrush Options") :
|
||||
_("Airbrush Options") :
|
||||
((tool_type == CLONE) ?
|
||||
N_("Clone Tool Options") :
|
||||
_("Clone Tool Options") :
|
||||
((tool_type == CONVOLVE) ?
|
||||
N_("Convolver Options") :
|
||||
_("Convolver Options") :
|
||||
((tool_type == INK) ?
|
||||
N_("Ink Options") :
|
||||
((tool_type == DODGEBURN) ?
|
||||
N_("Dodge or Burn Options") :
|
||||
((tool_type == SMUDGE) ?
|
||||
N_("Smudge Options") :
|
||||
N_("ERROR: Unknown Paint Type")))))))))))),
|
||||
_("Ink Options") :
|
||||
((tool_type == DODGEBURN) ?
|
||||
_("Dodge or Burn Options") :
|
||||
((tool_type == SMUDGE) ?
|
||||
_("Smudge 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;
|
||||
|
@ -604,10 +597,11 @@ paint_options_init (PaintOptions *options,
|
|||
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_adjustment_new (gimp_context_get_opacity (tool_context) * 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);
|
||||
tool_context);
|
||||
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);
|
||||
|
@ -640,12 +634,20 @@ paint_options_init (PaintOptions *options,
|
|||
gtk_container_add (GTK_CONTAINER (abox), options->paint_mode_w);
|
||||
gtk_widget_show (options->paint_mode_w);
|
||||
|
||||
/* eek */
|
||||
gtk_object_set_data (GTK_OBJECT (options->paint_mode_w), "tool_context",
|
||||
tool_info[tool_type].tool_context);
|
||||
|
||||
menu =
|
||||
paint_mode_menu_new (tool_options_paint_mode_update, (gpointer) options);
|
||||
paint_mode_menu_new (tool_options_paint_mode_update, tool_context);
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (options->paint_mode_w), menu);
|
||||
gtk_option_menu_set_history (GTK_OPTION_MENU (options->paint_mode_w),
|
||||
gimp_context_get_paint_mode (tool_context));
|
||||
break;
|
||||
case CONVOLVE:
|
||||
case ERASER:
|
||||
case DODGEBURN:
|
||||
case SMUDGE:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -676,7 +678,7 @@ paint_options_new (ToolType tool_type,
|
|||
PaintOptions *options;
|
||||
GtkWidget *label;
|
||||
|
||||
options = (PaintOptions *) g_malloc (sizeof (PaintOptions));
|
||||
options = g_new (PaintOptions, 1);
|
||||
paint_options_init (options, tool_type, reset_func);
|
||||
|
||||
options->global = gtk_vbox_new (FALSE, 2);
|
||||
|
@ -696,16 +698,25 @@ paint_options_new (ToolType tool_type,
|
|||
void
|
||||
paint_options_reset (PaintOptions *options)
|
||||
{
|
||||
GimpContext *default_context;
|
||||
|
||||
default_context = gimp_context_get_default ();
|
||||
|
||||
if (options->opacity_w)
|
||||
{
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->opacity_w),
|
||||
options->opacity_d * 100);
|
||||
gimp_context_get_opacity (default_context) * 100);
|
||||
}
|
||||
if (options->paint_mode_w)
|
||||
{
|
||||
options->paint_mode = options->paint_mode_d;
|
||||
GimpContext *context;
|
||||
|
||||
context = (GimpContext *) gtk_object_get_data (GTK_OBJECT (options->paint_mode_w), "tool_context");
|
||||
|
||||
gimp_context_set_paint_mode (GIMP_CONTEXT (context),
|
||||
gimp_context_get_paint_mode (default_context));
|
||||
gtk_option_menu_set_history (GTK_OPTION_MENU (options->paint_mode_w),
|
||||
options->paint_mode_d);
|
||||
gimp_context_get_paint_mode (default_context));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -749,30 +760,6 @@ paint_options_set_global (gboolean global)
|
|||
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 *************************************************/
|
||||
|
||||
|
|
|
@ -19,13 +19,13 @@
|
|||
|
||||
#include "appenv.h"
|
||||
#include "colormaps.h"
|
||||
#include "context_manager.h"
|
||||
#include "gdisplay_ops.h"
|
||||
#include "gimprc.h"
|
||||
#include "image_render.h"
|
||||
#include "interface.h"
|
||||
#include "lc_dialog.h"
|
||||
#include "layer_select.h"
|
||||
#include "paint_options.h"
|
||||
#include "session.h"
|
||||
|
||||
#include "config.h"
|
||||
|
@ -611,7 +611,7 @@ file_prefs_cancel_callback (GtkWidget *widget,
|
|||
|
||||
file_prefs_strset (&image_title_format, old_image_title_format);
|
||||
|
||||
paint_options_set_global (old_global_paint_options);
|
||||
context_manager_set_global_paint_options (old_global_paint_options);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -666,7 +666,7 @@ file_prefs_toggle_callback (GtkWidget *widget,
|
|||
gdisplays_flush ();
|
||||
}
|
||||
else if (data == &global_paint_options)
|
||||
paint_options_set_global (GTK_TOGGLE_BUTTON (widget)->active);
|
||||
context_manager_set_global_paint_options (GTK_TOGGLE_BUTTON (widget)->active);
|
||||
else if (data == &show_indicators)
|
||||
show_indicators = GTK_TOGGLE_BUTTON (widget)->active;
|
||||
else if (data == &thumbnail_mode)
|
||||
|
@ -1964,12 +1964,6 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
&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);
|
||||
|
||||
/* Indicators */
|
||||
vbox2 = gtk_vbox_new (FALSE, 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox2), 2);
|
||||
|
|
|
@ -371,7 +371,7 @@ dodgeburn_motion (PaintCore *paint_core,
|
|||
temp_data = g_malloc (tempPR.h * tempPR.rowstride);
|
||||
tempPR.data = temp_data;
|
||||
|
||||
brush_opacity = PAINT_OPTIONS_GET_OPACITY (dodgeburn_options);
|
||||
brush_opacity = gimp_context_get_opacity (NULL);
|
||||
exposure = (dodgeburn_options->exposure)/100.0;
|
||||
|
||||
/* DodgeBurn the region */
|
||||
|
|
|
@ -198,12 +198,14 @@ eraser_motion (PaintCore *paint_core,
|
|||
/* color the pixels */
|
||||
color_pixels (temp_buf_data (area), col,
|
||||
area->width * area->height, area->bytes);
|
||||
opacity = 255 * paint_options_get_opacity() * (paint_core->curpressure / 0.5);
|
||||
opacity = 255 * gimp_context_get_opacity (NULL) * (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) (PAINT_OPTIONS_GET_OPACITY (eraser_options) * 255),
|
||||
ERASE_MODE, hard? HARD : SOFT, incremental ? INCREMENTAL : CONSTANT);
|
||||
(int) (gimp_context_get_opacity (NULL) * 255),
|
||||
ERASE_MODE,
|
||||
hard ? HARD : SOFT,
|
||||
incremental ? INCREMENTAL : CONSTANT);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "floating_sel.h"
|
||||
#include "gdisplay.h"
|
||||
#include "gimage_mask.h"
|
||||
#include "gimprc.h"
|
||||
#include "interface.h"
|
||||
#include "layer.h"
|
||||
#include "paint_core.h"
|
||||
|
@ -618,8 +619,9 @@ gimage_mask_stroke_paint_func (PaintCore *paint_core,
|
|||
GimpDrawable *drawable,
|
||||
int state)
|
||||
{
|
||||
GImage *gimage;
|
||||
TempBuf * area;
|
||||
GImage *gimage;
|
||||
TempBuf *area;
|
||||
GimpContext *context;
|
||||
unsigned char col[MAX_CHANNELS];
|
||||
|
||||
if (! (gimage = drawable_gimage (drawable)))
|
||||
|
@ -638,10 +640,17 @@ gimage_mask_stroke_paint_func (PaintCore *paint_core,
|
|||
color_pixels (temp_buf_data (area), col,
|
||||
area->width * area->height, area->bytes);
|
||||
|
||||
if (gimp_context_get_current () == gimp_context_get_user () &&
|
||||
! global_paint_options)
|
||||
context = tool_info[PAINTBRUSH].tool_context;
|
||||
else
|
||||
context = gimp_context_get_current ();
|
||||
|
||||
/* paste the newly painted canvas to the gimage which is being worked on */
|
||||
paint_core_paste_canvas (paint_core, drawable, OPAQUE_OPACITY,
|
||||
(int) (paint_options_get_opacity () * 255),
|
||||
paint_options_get_paint_mode (), SOFT, CONSTANT);
|
||||
(int) (gimp_context_get_opacity (context) * 255),
|
||||
gimp_context_get_paint_mode (context),
|
||||
SOFT, CONSTANT);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -19,8 +19,10 @@
|
|||
#include "appenv.h"
|
||||
#include "actionarea.h"
|
||||
#include "gimpbrushlist.h"
|
||||
#include "gimpcontext.h"
|
||||
#include "gimplist.h"
|
||||
#include "gimpbrushgenerated.h"
|
||||
#include "gimprc.h"
|
||||
#include "brush_edit.h"
|
||||
#include "brush_select.h"
|
||||
#include "colormaps.h"
|
||||
|
@ -161,6 +163,7 @@ brush_select_new (gchar *title,
|
|||
else
|
||||
{
|
||||
gtk_window_set_title (GTK_WINDOW (bsp->shell), title);
|
||||
|
||||
if (init_name && strlen (init_name))
|
||||
active = gimp_brush_list_get_brush (brush_list, init_name);
|
||||
if (active)
|
||||
|
@ -415,14 +418,16 @@ brush_select_new (gchar *title,
|
|||
bsp->redraw = FALSE;
|
||||
if (!gotinitbrush)
|
||||
{
|
||||
bsp->opacity_value = paint_options_get_opacity ();
|
||||
GimpContext *context = gimp_context_get_user ();
|
||||
|
||||
bsp->opacity_value = gimp_context_get_opacity (context);
|
||||
bsp->paint_mode = gimp_context_get_paint_mode (context);
|
||||
bsp->spacing_value = gimp_brush_get_spacing (active);
|
||||
bsp->paint_mode = paint_options_get_paint_mode ();
|
||||
}
|
||||
else
|
||||
{
|
||||
bsp->opacity_value = init_opacity;
|
||||
bsp->paint_mode = init_mode;
|
||||
bsp->paint_mode = init_mode;
|
||||
}
|
||||
brush_select_select (bsp, gimp_brush_list_get_brush_index (brush_list,
|
||||
active));
|
||||
|
@ -1309,7 +1314,10 @@ paint_mode_menu_callback (GtkWidget *w,
|
|||
BrushSelectP bsp = (BrushSelectP) gtk_object_get_user_data (GTK_OBJECT (w));
|
||||
|
||||
if (bsp == brush_select_dialog)
|
||||
paint_options_set_paint_mode ((int) client_data);
|
||||
{
|
||||
gimp_context_set_paint_mode (gimp_context_get_user (),
|
||||
(int) client_data);
|
||||
}
|
||||
else
|
||||
{
|
||||
bsp->paint_mode = (int) client_data;
|
||||
|
@ -1324,8 +1332,11 @@ opacity_scale_update (GtkAdjustment *adjustment,
|
|||
{
|
||||
BrushSelectP bsp = (BrushSelectP) data;
|
||||
|
||||
if(bsp == brush_select_dialog)
|
||||
paint_options_set_opacity (adjustment->value / 100.0);
|
||||
if (bsp == brush_select_dialog)
|
||||
{
|
||||
gimp_context_set_opacity (gimp_context_get_user (),
|
||||
adjustment->value / 100.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
bsp->opacity_value = (adjustment->value / 100.0);
|
||||
|
|
|
@ -19,13 +19,13 @@
|
|||
|
||||
#include "appenv.h"
|
||||
#include "colormaps.h"
|
||||
#include "context_manager.h"
|
||||
#include "gdisplay_ops.h"
|
||||
#include "gimprc.h"
|
||||
#include "image_render.h"
|
||||
#include "interface.h"
|
||||
#include "lc_dialog.h"
|
||||
#include "layer_select.h"
|
||||
#include "paint_options.h"
|
||||
#include "session.h"
|
||||
|
||||
#include "config.h"
|
||||
|
@ -611,7 +611,7 @@ file_prefs_cancel_callback (GtkWidget *widget,
|
|||
|
||||
file_prefs_strset (&image_title_format, old_image_title_format);
|
||||
|
||||
paint_options_set_global (old_global_paint_options);
|
||||
context_manager_set_global_paint_options (old_global_paint_options);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -666,7 +666,7 @@ file_prefs_toggle_callback (GtkWidget *widget,
|
|||
gdisplays_flush ();
|
||||
}
|
||||
else if (data == &global_paint_options)
|
||||
paint_options_set_global (GTK_TOGGLE_BUTTON (widget)->active);
|
||||
context_manager_set_global_paint_options (GTK_TOGGLE_BUTTON (widget)->active);
|
||||
else if (data == &show_indicators)
|
||||
show_indicators = GTK_TOGGLE_BUTTON (widget)->active;
|
||||
else if (data == &thumbnail_mode)
|
||||
|
@ -1964,12 +1964,6 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
&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);
|
||||
|
||||
/* Indicators */
|
||||
vbox2 = gtk_vbox_new (FALSE, 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox2), 2);
|
||||
|
|
|
@ -1414,8 +1414,8 @@ ink_paste (InkTool *ink_tool,
|
|||
/* apply the paint area to the gimage */
|
||||
gimage_apply_image (gimage, drawable, &srcPR,
|
||||
FALSE,
|
||||
(int) (PAINT_OPTIONS_GET_OPACITY (ink_options) * 255),
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (ink_options),
|
||||
(int) (gimp_context_get_opacity (NULL) * 255),
|
||||
gimp_context_get_paint_mode (NULL),
|
||||
undo_tiles, /* specify an alternative src1 */
|
||||
canvas_buf->x, canvas_buf->y);
|
||||
|
||||
|
|
|
@ -93,14 +93,9 @@ lc_dialog_create (GimpImage* gimage)
|
|||
}
|
||||
|
||||
if (gimage)
|
||||
{
|
||||
lc_dialog_update (gimage);
|
||||
lc_dialog_update_image_list ();
|
||||
}
|
||||
else
|
||||
{
|
||||
lc_dialog_update_image_list ();
|
||||
}
|
||||
lc_dialog_update (gimage);
|
||||
|
||||
lc_dialog_update_image_list ();
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -158,7 +153,7 @@ lc_dialog_create (GimpImage* gimage)
|
|||
(GtkSignalFunc) lc_dialog_auto_callback,
|
||||
auto_button);
|
||||
gtk_widget_show (auto_button);
|
||||
/* State will be set, when the sub-dialogs exists (see below) */
|
||||
/* State will be set when the sub-dialogs exists (see below) */
|
||||
|
||||
gtk_widget_show (util_box);
|
||||
|
||||
|
|
|
@ -266,9 +266,9 @@ airbrush_time_out (gpointer client_data)
|
|||
|
||||
|
||||
static void
|
||||
airbrush_motion (PaintCore *paint_core,
|
||||
airbrush_motion (PaintCore *paint_core,
|
||||
GimpDrawable *drawable,
|
||||
double pressure)
|
||||
double pressure)
|
||||
{
|
||||
gint opacity;
|
||||
GImage *gimage;
|
||||
|
@ -300,16 +300,16 @@ airbrush_motion (PaintCore *paint_core,
|
|||
/* paste the newly painted area to the image */
|
||||
paint_core_paste_canvas (paint_core, drawable,
|
||||
opacity,
|
||||
(int) (PAINT_OPTIONS_GET_OPACITY (airbrush_options) * 255),
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (airbrush_options),
|
||||
(gint) (gimp_context_get_opacity (NULL) * 255),
|
||||
gimp_context_get_paint_mode (NULL),
|
||||
SOFT, CONSTANT);
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
airbrush_non_gui_paint_func (PaintCore *paint_core,
|
||||
airbrush_non_gui_paint_func (PaintCore *paint_core,
|
||||
GimpDrawable *drawable,
|
||||
int state)
|
||||
int state)
|
||||
{
|
||||
airbrush_motion (paint_core, drawable, non_gui_pressure);
|
||||
|
||||
|
|
|
@ -589,8 +589,8 @@ 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) (PAINT_OPTIONS_GET_OPACITY (clone_options) * 255),
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (clone_options),
|
||||
(int) (gimp_context_get_opacity (NULL) * 255),
|
||||
gimp_context_get_paint_mode (NULL),
|
||||
SOFT, CONSTANT);
|
||||
}
|
||||
|
||||
|
|
|
@ -348,8 +348,8 @@ 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) (PAINT_OPTIONS_GET_OPACITY (convolve_options) * 255),
|
||||
SOFT, INCREMENTAL);
|
||||
(int) (gimp_context_get_opacity (NULL) * 255),
|
||||
SOFT, INCREMENTAL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -371,7 +371,7 @@ dodgeburn_motion (PaintCore *paint_core,
|
|||
temp_data = g_malloc (tempPR.h * tempPR.rowstride);
|
||||
tempPR.data = temp_data;
|
||||
|
||||
brush_opacity = PAINT_OPTIONS_GET_OPACITY (dodgeburn_options);
|
||||
brush_opacity = gimp_context_get_opacity (NULL);
|
||||
exposure = (dodgeburn_options->exposure)/100.0;
|
||||
|
||||
/* DodgeBurn the region */
|
||||
|
|
|
@ -198,12 +198,14 @@ eraser_motion (PaintCore *paint_core,
|
|||
/* color the pixels */
|
||||
color_pixels (temp_buf_data (area), col,
|
||||
area->width * area->height, area->bytes);
|
||||
opacity = 255 * paint_options_get_opacity() * (paint_core->curpressure / 0.5);
|
||||
opacity = 255 * gimp_context_get_opacity (NULL) * (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) (PAINT_OPTIONS_GET_OPACITY (eraser_options) * 255),
|
||||
ERASE_MODE, hard? HARD : SOFT, incremental ? INCREMENTAL : CONSTANT);
|
||||
(int) (gimp_context_get_opacity (NULL) * 255),
|
||||
ERASE_MODE,
|
||||
hard ? HARD : SOFT,
|
||||
incremental ? INCREMENTAL : CONSTANT);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1414,8 +1414,8 @@ ink_paste (InkTool *ink_tool,
|
|||
/* apply the paint area to the gimage */
|
||||
gimage_apply_image (gimage, drawable, &srcPR,
|
||||
FALSE,
|
||||
(int) (PAINT_OPTIONS_GET_OPACITY (ink_options) * 255),
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (ink_options),
|
||||
(int) (gimp_context_get_opacity (NULL) * 255),
|
||||
gimp_context_get_paint_mode (NULL),
|
||||
undo_tiles, /* specify an alternative src1 */
|
||||
canvas_buf->x, canvas_buf->y);
|
||||
|
||||
|
|
|
@ -126,8 +126,9 @@ 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) (PAINT_OPTIONS_GET_OPACITY (pencil_options) * 255),
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (pencil_options), HARD, CONSTANT);
|
||||
(int) (gimp_context_get_opacity (NULL) * 255),
|
||||
gimp_context_get_paint_mode (NULL),
|
||||
HARD, CONSTANT);
|
||||
}
|
||||
|
||||
static void *
|
||||
|
@ -149,7 +150,7 @@ pencil_non_gui (GimpDrawable *drawable,
|
|||
int i;
|
||||
|
||||
if (paint_core_init (&non_gui_paint_core, drawable,
|
||||
stroke_array[0], stroke_array[1]))
|
||||
stroke_array[0], stroke_array[1]))
|
||||
{
|
||||
/* Set the paint core's paint func */
|
||||
non_gui_paint_core.paint_func = pencil_non_gui_paint_func;
|
||||
|
|
|
@ -283,8 +283,8 @@ tools_free_smudge (Tool *tool)
|
|||
}
|
||||
|
||||
static void
|
||||
smudge_motion (PaintCore *paint_core,
|
||||
GimpDrawable *drawable)
|
||||
smudge_motion (PaintCore *paint_core,
|
||||
GimpDrawable *drawable)
|
||||
{
|
||||
GImage *gimage;
|
||||
TempBuf * area;
|
||||
|
@ -313,7 +313,7 @@ smudge_motion (PaintCore *paint_core,
|
|||
pixel_region_init (&srcPR, drawable_data (drawable),
|
||||
area->x, area->y, area->width, area->height, FALSE);
|
||||
|
||||
brush_opacity = PAINT_OPTIONS_GET_OPACITY (smudge_options);
|
||||
brush_opacity = gimp_context_get_opacity (NULL);
|
||||
pressure = (smudge_options->pressure)/100.0;
|
||||
|
||||
/* The tempPR will be the built up buffer (for smudge) */
|
||||
|
|
|
@ -589,8 +589,8 @@ 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) (PAINT_OPTIONS_GET_OPACITY (clone_options) * 255),
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (clone_options),
|
||||
(int) (gimp_context_get_opacity (NULL) * 255),
|
||||
gimp_context_get_paint_mode (NULL),
|
||||
SOFT, CONSTANT);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,28 +19,11 @@
|
|||
#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
|
||||
*/
|
||||
/* the paint options structures */
|
||||
typedef struct _PaintOptions PaintOptions;
|
||||
struct _PaintOptions
|
||||
{
|
||||
|
@ -53,48 +36,31 @@ struct _PaintOptions
|
|||
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
|
||||
*/
|
||||
/* 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
|
||||
*/
|
||||
/* 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
|
||||
*/
|
||||
/* functions for the global paint options */
|
||||
|
||||
/* switch between global and per-tool 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
|
||||
*/
|
||||
/* a utility function which returns a paint mode menu */
|
||||
GtkWidget *paint_mode_menu_new (MenuItemCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
|
|
|
@ -433,9 +433,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) (PAINT_OPTIONS_GET_OPACITY (paintbrush_options) * 255),
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (paintbrush_options),
|
||||
PRESSURE,
|
||||
(int) (gimp_context_get_opacity (NULL) * 255),
|
||||
gimp_context_get_paint_mode (NULL),
|
||||
PRESSURE,
|
||||
incremental ? INCREMENTAL : CONSTANT);
|
||||
}
|
||||
}
|
||||
|
@ -446,7 +446,9 @@ paintbrush_non_gui_paint_func (PaintCore *paint_core,
|
|||
GimpDrawable *drawable,
|
||||
int state)
|
||||
{
|
||||
paintbrush_motion (paint_core, drawable, non_gui_fade_out,non_gui_gradient_length, non_gui_incremental, non_gui_gradient_type);
|
||||
paintbrush_motion (paint_core, drawable, non_gui_fade_out,
|
||||
non_gui_gradient_length, non_gui_incremental,
|
||||
non_gui_gradient_type);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -126,8 +126,9 @@ 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) (PAINT_OPTIONS_GET_OPACITY (pencil_options) * 255),
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (pencil_options), HARD, CONSTANT);
|
||||
(int) (gimp_context_get_opacity (NULL) * 255),
|
||||
gimp_context_get_paint_mode (NULL),
|
||||
HARD, CONSTANT);
|
||||
}
|
||||
|
||||
static void *
|
||||
|
@ -149,7 +150,7 @@ pencil_non_gui (GimpDrawable *drawable,
|
|||
int i;
|
||||
|
||||
if (paint_core_init (&non_gui_paint_core, drawable,
|
||||
stroke_array[0], stroke_array[1]))
|
||||
stroke_array[0], stroke_array[1]))
|
||||
{
|
||||
/* Set the paint core's paint func */
|
||||
non_gui_paint_core.paint_func = pencil_non_gui_paint_func;
|
||||
|
|
|
@ -19,13 +19,13 @@
|
|||
|
||||
#include "appenv.h"
|
||||
#include "colormaps.h"
|
||||
#include "context_manager.h"
|
||||
#include "gdisplay_ops.h"
|
||||
#include "gimprc.h"
|
||||
#include "image_render.h"
|
||||
#include "interface.h"
|
||||
#include "lc_dialog.h"
|
||||
#include "layer_select.h"
|
||||
#include "paint_options.h"
|
||||
#include "session.h"
|
||||
|
||||
#include "config.h"
|
||||
|
@ -611,7 +611,7 @@ file_prefs_cancel_callback (GtkWidget *widget,
|
|||
|
||||
file_prefs_strset (&image_title_format, old_image_title_format);
|
||||
|
||||
paint_options_set_global (old_global_paint_options);
|
||||
context_manager_set_global_paint_options (old_global_paint_options);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -666,7 +666,7 @@ file_prefs_toggle_callback (GtkWidget *widget,
|
|||
gdisplays_flush ();
|
||||
}
|
||||
else if (data == &global_paint_options)
|
||||
paint_options_set_global (GTK_TOGGLE_BUTTON (widget)->active);
|
||||
context_manager_set_global_paint_options (GTK_TOGGLE_BUTTON (widget)->active);
|
||||
else if (data == &show_indicators)
|
||||
show_indicators = GTK_TOGGLE_BUTTON (widget)->active;
|
||||
else if (data == &thumbnail_mode)
|
||||
|
@ -1964,12 +1964,6 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
&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);
|
||||
|
||||
/* Indicators */
|
||||
vbox2 = gtk_vbox_new (FALSE, 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox2), 2);
|
||||
|
|
|
@ -283,8 +283,8 @@ tools_free_smudge (Tool *tool)
|
|||
}
|
||||
|
||||
static void
|
||||
smudge_motion (PaintCore *paint_core,
|
||||
GimpDrawable *drawable)
|
||||
smudge_motion (PaintCore *paint_core,
|
||||
GimpDrawable *drawable)
|
||||
{
|
||||
GImage *gimage;
|
||||
TempBuf * area;
|
||||
|
@ -313,7 +313,7 @@ smudge_motion (PaintCore *paint_core,
|
|||
pixel_region_init (&srcPR, drawable_data (drawable),
|
||||
area->x, area->y, area->width, area->height, FALSE);
|
||||
|
||||
brush_opacity = PAINT_OPTIONS_GET_OPACITY (smudge_options);
|
||||
brush_opacity = gimp_context_get_opacity (NULL);
|
||||
pressure = (smudge_options->pressure)/100.0;
|
||||
|
||||
/* The tempPR will be the built up buffer (for smudge) */
|
||||
|
|
|
@ -27,10 +27,6 @@
|
|||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
/* 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;
|
||||
|
||||
|
@ -94,10 +90,20 @@ void
|
|||
tool_options_opacity_adjustment_update (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
double *val;
|
||||
gimp_context_set_opacity (GIMP_CONTEXT (data),
|
||||
GTK_ADJUSTMENT (widget)->value / 100);
|
||||
}
|
||||
|
||||
val = (double *) data;
|
||||
*val = GTK_ADJUSTMENT (widget)->value / 100;
|
||||
static void
|
||||
tool_options_paint_mode_update (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GimpContext *context;
|
||||
|
||||
context = (GimpContext *) gtk_object_get_user_data (GTK_OBJECT (widget));
|
||||
|
||||
gimp_context_set_paint_mode (GIMP_CONTEXT (context),
|
||||
(long) data);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -124,18 +130,6 @@ tool_options_unitmenu_update (GtkWidget *widget,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
tool_options_paint_mode_update (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
PaintOptions *options;
|
||||
|
||||
options = (PaintOptions *) gtk_object_get_user_data (GTK_OBJECT (widget));
|
||||
|
||||
if (options)
|
||||
options->paint_mode = (long) data;
|
||||
}
|
||||
|
||||
static void
|
||||
tool_options_radio_buttons_update (GtkWidget *widget,
|
||||
gpointer data)
|
||||
|
@ -206,7 +200,7 @@ tool_options_new (gchar *title)
|
|||
|
||||
GtkWidget *label;
|
||||
|
||||
options = (ToolOptions *) g_malloc (sizeof (ToolOptions));
|
||||
options = g_new (ToolOptions, 1);
|
||||
tool_options_init (options, title, NULL);
|
||||
|
||||
label = gtk_label_new (_("This tool has no options."));
|
||||
|
@ -233,20 +227,20 @@ selection_options_init (SelectionOptions *options,
|
|||
/* initialize the tool options structure */
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
((tool_type == RECT_SELECT) ?
|
||||
N_("Rectangular Select Options") :
|
||||
_("Rectangular Select Options") :
|
||||
((tool_type == ELLIPSE_SELECT) ?
|
||||
N_("Elliptical Selection Options") :
|
||||
_("Elliptical Selection Options") :
|
||||
((tool_type == FREE_SELECT) ?
|
||||
N_("Free-hand Selection Options") :
|
||||
_("Free-hand Selection Options") :
|
||||
((tool_type == FUZZY_SELECT) ?
|
||||
N_("Fuzzy Selection Options") :
|
||||
_("Fuzzy Selection Options") :
|
||||
((tool_type == BEZIER_SELECT) ?
|
||||
N_("Bezier Selection Options") :
|
||||
_("Bezier Selection Options") :
|
||||
((tool_type == ISCISSORS) ?
|
||||
N_("Intelligent Scissors Options") :
|
||||
_("Intelligent Scissors Options") :
|
||||
((tool_type == BY_COLOR_SELECT) ?
|
||||
N_("By-Color Select Options") :
|
||||
N_("ERROR: Unknown Selection Type")))))))),
|
||||
_("By-Color Select Options") :
|
||||
_("ERROR: Unknown Selection Type")))))))),
|
||||
reset_func);
|
||||
|
||||
/* the main vbox */
|
||||
|
@ -480,7 +474,7 @@ selection_options_new (ToolType tool_type,
|
|||
{
|
||||
SelectionOptions *options;
|
||||
|
||||
options = (SelectionOptions *) g_malloc (sizeof (SelectionOptions));
|
||||
options = g_new (SelectionOptions, 1);
|
||||
selection_options_init (options, tool_type, reset_func);
|
||||
|
||||
return options;
|
||||
|
@ -550,37 +544,36 @@ paint_options_init (PaintOptions *options,
|
|||
GtkWidget *menu;
|
||||
GtkWidget *separator;
|
||||
|
||||
GimpContext *tool_context = tool_info[tool_type].tool_context;
|
||||
|
||||
/* initialize the tool options structure */
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
((tool_type == BUCKET_FILL) ?
|
||||
N_("Bucket Fill Options") :
|
||||
_("Bucket Fill Options") :
|
||||
((tool_type == BLEND) ?
|
||||
N_("Blend Options") :
|
||||
_("Blend Options") :
|
||||
((tool_type == PENCIL) ?
|
||||
N_("Pencil Options") :
|
||||
_("Pencil Options") :
|
||||
((tool_type == PAINTBRUSH) ?
|
||||
N_("Paintbrush Options") :
|
||||
_("Paintbrush Options") :
|
||||
((tool_type == ERASER) ?
|
||||
N_("Erazer Options") :
|
||||
_("Erazer Options") :
|
||||
((tool_type == AIRBRUSH) ?
|
||||
N_("Airbrush Options") :
|
||||
_("Airbrush Options") :
|
||||
((tool_type == CLONE) ?
|
||||
N_("Clone Tool Options") :
|
||||
_("Clone Tool Options") :
|
||||
((tool_type == CONVOLVE) ?
|
||||
N_("Convolver Options") :
|
||||
_("Convolver Options") :
|
||||
((tool_type == INK) ?
|
||||
N_("Ink Options") :
|
||||
((tool_type == DODGEBURN) ?
|
||||
N_("Dodge or Burn Options") :
|
||||
((tool_type == SMUDGE) ?
|
||||
N_("Smudge Options") :
|
||||
N_("ERROR: Unknown Paint Type")))))))))))),
|
||||
_("Ink Options") :
|
||||
((tool_type == DODGEBURN) ?
|
||||
_("Dodge or Burn Options") :
|
||||
((tool_type == SMUDGE) ?
|
||||
_("Smudge 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;
|
||||
|
@ -604,10 +597,11 @@ paint_options_init (PaintOptions *options,
|
|||
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_adjustment_new (gimp_context_get_opacity (tool_context) * 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);
|
||||
tool_context);
|
||||
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);
|
||||
|
@ -640,12 +634,20 @@ paint_options_init (PaintOptions *options,
|
|||
gtk_container_add (GTK_CONTAINER (abox), options->paint_mode_w);
|
||||
gtk_widget_show (options->paint_mode_w);
|
||||
|
||||
/* eek */
|
||||
gtk_object_set_data (GTK_OBJECT (options->paint_mode_w), "tool_context",
|
||||
tool_info[tool_type].tool_context);
|
||||
|
||||
menu =
|
||||
paint_mode_menu_new (tool_options_paint_mode_update, (gpointer) options);
|
||||
paint_mode_menu_new (tool_options_paint_mode_update, tool_context);
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (options->paint_mode_w), menu);
|
||||
gtk_option_menu_set_history (GTK_OPTION_MENU (options->paint_mode_w),
|
||||
gimp_context_get_paint_mode (tool_context));
|
||||
break;
|
||||
case CONVOLVE:
|
||||
case ERASER:
|
||||
case DODGEBURN:
|
||||
case SMUDGE:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -676,7 +678,7 @@ paint_options_new (ToolType tool_type,
|
|||
PaintOptions *options;
|
||||
GtkWidget *label;
|
||||
|
||||
options = (PaintOptions *) g_malloc (sizeof (PaintOptions));
|
||||
options = g_new (PaintOptions, 1);
|
||||
paint_options_init (options, tool_type, reset_func);
|
||||
|
||||
options->global = gtk_vbox_new (FALSE, 2);
|
||||
|
@ -696,16 +698,25 @@ paint_options_new (ToolType tool_type,
|
|||
void
|
||||
paint_options_reset (PaintOptions *options)
|
||||
{
|
||||
GimpContext *default_context;
|
||||
|
||||
default_context = gimp_context_get_default ();
|
||||
|
||||
if (options->opacity_w)
|
||||
{
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->opacity_w),
|
||||
options->opacity_d * 100);
|
||||
gimp_context_get_opacity (default_context) * 100);
|
||||
}
|
||||
if (options->paint_mode_w)
|
||||
{
|
||||
options->paint_mode = options->paint_mode_d;
|
||||
GimpContext *context;
|
||||
|
||||
context = (GimpContext *) gtk_object_get_data (GTK_OBJECT (options->paint_mode_w), "tool_context");
|
||||
|
||||
gimp_context_set_paint_mode (GIMP_CONTEXT (context),
|
||||
gimp_context_get_paint_mode (default_context));
|
||||
gtk_option_menu_set_history (GTK_OPTION_MENU (options->paint_mode_w),
|
||||
options->paint_mode_d);
|
||||
gimp_context_get_paint_mode (default_context));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -749,30 +760,6 @@ paint_options_set_global (gboolean global)
|
|||
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 *************************************************/
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "clone.h"
|
||||
#include "color_balance.h"
|
||||
#include "color_picker.h"
|
||||
#include "context_manager.h"
|
||||
#include "convolve.h"
|
||||
#include "crop.h"
|
||||
#include "curves.h"
|
||||
|
@ -647,6 +648,9 @@ active_tool_free (void)
|
|||
void
|
||||
tools_select (ToolType type)
|
||||
{
|
||||
/* Care for switching to the tool's private context */
|
||||
context_manager_set_tool (type);
|
||||
|
||||
if (active_tool)
|
||||
active_tool_free ();
|
||||
|
||||
|
|
|
@ -266,9 +266,9 @@ airbrush_time_out (gpointer client_data)
|
|||
|
||||
|
||||
static void
|
||||
airbrush_motion (PaintCore *paint_core,
|
||||
airbrush_motion (PaintCore *paint_core,
|
||||
GimpDrawable *drawable,
|
||||
double pressure)
|
||||
double pressure)
|
||||
{
|
||||
gint opacity;
|
||||
GImage *gimage;
|
||||
|
@ -300,16 +300,16 @@ airbrush_motion (PaintCore *paint_core,
|
|||
/* paste the newly painted area to the image */
|
||||
paint_core_paste_canvas (paint_core, drawable,
|
||||
opacity,
|
||||
(int) (PAINT_OPTIONS_GET_OPACITY (airbrush_options) * 255),
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (airbrush_options),
|
||||
(gint) (gimp_context_get_opacity (NULL) * 255),
|
||||
gimp_context_get_paint_mode (NULL),
|
||||
SOFT, CONSTANT);
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
airbrush_non_gui_paint_func (PaintCore *paint_core,
|
||||
airbrush_non_gui_paint_func (PaintCore *paint_core,
|
||||
GimpDrawable *drawable,
|
||||
int state)
|
||||
int state)
|
||||
{
|
||||
airbrush_motion (paint_core, drawable, non_gui_pressure);
|
||||
|
||||
|
|
|
@ -562,23 +562,24 @@ blend_button_release (Tool *tool,
|
|||
/* we can't do callbacks easily with the PDB, so this UI/backend
|
||||
* separation (though good) is ignored for the moment */
|
||||
#ifdef BLEND_UI_CALLS_VIA_PDB
|
||||
return_vals = procedural_db_run_proc ("gimp_blend",
|
||||
&nreturn_vals,
|
||||
PDB_DRAWABLE, drawable_ID (gimage_active_drawable (gimage)),
|
||||
PDB_INT32, (gint32) blend_options->blend_mode,
|
||||
PDB_INT32, (gint32) PAINT_OPTIONS_GET_PAINT_MODE (blend_options),
|
||||
PDB_INT32, (gint32) blend_options->gradient_type,
|
||||
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,
|
||||
PDB_INT32, (gint32) blend_options->max_depth,
|
||||
PDB_FLOAT, (gdouble) blend_options->threshold,
|
||||
PDB_FLOAT, (gdouble) blend_tool->startx,
|
||||
PDB_FLOAT, (gdouble) blend_tool->starty,
|
||||
PDB_FLOAT, (gdouble) blend_tool->endx,
|
||||
PDB_FLOAT, (gdouble) blend_tool->endy,
|
||||
PDB_END);
|
||||
return_vals =
|
||||
procedural_db_run_proc ("gimp_blend",
|
||||
&nreturn_vals,
|
||||
PDB_DRAWABLE, drawable_ID (gimage_active_drawable (gimage)),
|
||||
PDB_INT32, (gint32) blend_options->blend_mode,
|
||||
PDB_INT32, (gint32) gimp_context_get_paint_mode (NULL),
|
||||
PDB_INT32, (gint32) blend_options->gradient_type,
|
||||
PDB_FLOAT, (gdouble) gimp_context_get_opacity (NULL) * 100,
|
||||
PDB_FLOAT, (gdouble) blend_options->offset,
|
||||
PDB_INT32, (gint32) blend_options->repeat,
|
||||
PDB_INT32, (gint32) blend_options->supersample,
|
||||
PDB_INT32, (gint32) blend_options->max_depth,
|
||||
PDB_FLOAT, (gdouble) blend_options->threshold,
|
||||
PDB_FLOAT, (gdouble) blend_tool->startx,
|
||||
PDB_FLOAT, (gdouble) blend_tool->starty,
|
||||
PDB_FLOAT, (gdouble) blend_tool->endx,
|
||||
PDB_FLOAT, (gdouble) blend_tool->endy,
|
||||
PDB_END);
|
||||
|
||||
if (return_vals && return_vals[0].value.pdb_int == PDB_SUCCESS)
|
||||
gdisplays_flush ();
|
||||
|
@ -594,9 +595,9 @@ blend_button_release (Tool *tool,
|
|||
blend (gimage,
|
||||
gimage_active_drawable (gimage),
|
||||
blend_options->blend_mode,
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (blend_options),
|
||||
gimp_context_get_paint_mode (NULL),
|
||||
blend_options->gradient_type,
|
||||
PAINT_OPTIONS_GET_OPACITY (blend_options) * 100,
|
||||
gimp_context_get_opacity (NULL) * 100,
|
||||
blend_options->offset,
|
||||
blend_options->repeat,
|
||||
blend_options->supersample,
|
||||
|
|
|
@ -174,6 +174,7 @@ bucket_options_new (void)
|
|||
return options;
|
||||
}
|
||||
|
||||
/* bucket fill action functions */
|
||||
|
||||
static void
|
||||
bucket_fill_button_press (Tool *tool,
|
||||
|
@ -203,7 +204,6 @@ bucket_fill_button_press (Tool *tool,
|
|||
tool->state = ACTIVE;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
bucket_fill_button_release (Tool *tool,
|
||||
GdkEventButton *bevent,
|
||||
|
@ -223,17 +223,18 @@ bucket_fill_button_release (Tool *tool,
|
|||
/* if the 3rd button isn't pressed, fill the selected region */
|
||||
if (! (bevent->state & GDK_BUTTON3_MASK))
|
||||
{
|
||||
return_vals = procedural_db_run_proc ("gimp_bucket_fill",
|
||||
&nreturn_vals,
|
||||
PDB_DRAWABLE, drawable_ID (gimage_active_drawable (gdisp->gimage)),
|
||||
PDB_INT32, (gint32) bucket_options->fill_mode,
|
||||
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,
|
||||
PDB_FLOAT, (gdouble) bucket_tool->target_y,
|
||||
PDB_END);
|
||||
return_vals =
|
||||
procedural_db_run_proc ("gimp_bucket_fill",
|
||||
&nreturn_vals,
|
||||
PDB_DRAWABLE, drawable_ID (gimage_active_drawable (gdisp->gimage)),
|
||||
PDB_INT32, (gint32) bucket_options->fill_mode,
|
||||
PDB_INT32, (gint32) gimp_context_get_paint_mode (NULL),
|
||||
PDB_FLOAT, (gdouble) gimp_context_get_opacity (NULL) * 100,
|
||||
PDB_FLOAT, (gdouble) bucket_options->threshold,
|
||||
PDB_INT32, (gint32) bucket_options->sample_merged,
|
||||
PDB_FLOAT, (gdouble) bucket_tool->target_x,
|
||||
PDB_FLOAT, (gdouble) bucket_tool->target_y,
|
||||
PDB_END);
|
||||
|
||||
if (return_vals && return_vals[0].value.pdb_int == PDB_SUCCESS)
|
||||
gdisplays_flush ();
|
||||
|
|
|
@ -589,8 +589,8 @@ 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) (PAINT_OPTIONS_GET_OPACITY (clone_options) * 255),
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (clone_options),
|
||||
(int) (gimp_context_get_opacity (NULL) * 255),
|
||||
gimp_context_get_paint_mode (NULL),
|
||||
SOFT, CONSTANT);
|
||||
}
|
||||
|
||||
|
|
|
@ -348,8 +348,8 @@ 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) (PAINT_OPTIONS_GET_OPACITY (convolve_options) * 255),
|
||||
SOFT, INCREMENTAL);
|
||||
(int) (gimp_context_get_opacity (NULL) * 255),
|
||||
SOFT, INCREMENTAL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -371,7 +371,7 @@ dodgeburn_motion (PaintCore *paint_core,
|
|||
temp_data = g_malloc (tempPR.h * tempPR.rowstride);
|
||||
tempPR.data = temp_data;
|
||||
|
||||
brush_opacity = PAINT_OPTIONS_GET_OPACITY (dodgeburn_options);
|
||||
brush_opacity = gimp_context_get_opacity (NULL);
|
||||
exposure = (dodgeburn_options->exposure)/100.0;
|
||||
|
||||
/* DodgeBurn the region */
|
||||
|
|
|
@ -198,12 +198,14 @@ eraser_motion (PaintCore *paint_core,
|
|||
/* color the pixels */
|
||||
color_pixels (temp_buf_data (area), col,
|
||||
area->width * area->height, area->bytes);
|
||||
opacity = 255 * paint_options_get_opacity() * (paint_core->curpressure / 0.5);
|
||||
opacity = 255 * gimp_context_get_opacity (NULL) * (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) (PAINT_OPTIONS_GET_OPACITY (eraser_options) * 255),
|
||||
ERASE_MODE, hard? HARD : SOFT, incremental ? INCREMENTAL : CONSTANT);
|
||||
(int) (gimp_context_get_opacity (NULL) * 255),
|
||||
ERASE_MODE,
|
||||
hard ? HARD : SOFT,
|
||||
incremental ? INCREMENTAL : CONSTANT);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -266,9 +266,9 @@ airbrush_time_out (gpointer client_data)
|
|||
|
||||
|
||||
static void
|
||||
airbrush_motion (PaintCore *paint_core,
|
||||
airbrush_motion (PaintCore *paint_core,
|
||||
GimpDrawable *drawable,
|
||||
double pressure)
|
||||
double pressure)
|
||||
{
|
||||
gint opacity;
|
||||
GImage *gimage;
|
||||
|
@ -300,16 +300,16 @@ airbrush_motion (PaintCore *paint_core,
|
|||
/* paste the newly painted area to the image */
|
||||
paint_core_paste_canvas (paint_core, drawable,
|
||||
opacity,
|
||||
(int) (PAINT_OPTIONS_GET_OPACITY (airbrush_options) * 255),
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (airbrush_options),
|
||||
(gint) (gimp_context_get_opacity (NULL) * 255),
|
||||
gimp_context_get_paint_mode (NULL),
|
||||
SOFT, CONSTANT);
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
airbrush_non_gui_paint_func (PaintCore *paint_core,
|
||||
airbrush_non_gui_paint_func (PaintCore *paint_core,
|
||||
GimpDrawable *drawable,
|
||||
int state)
|
||||
int state)
|
||||
{
|
||||
airbrush_motion (paint_core, drawable, non_gui_pressure);
|
||||
|
||||
|
|
|
@ -562,23 +562,24 @@ blend_button_release (Tool *tool,
|
|||
/* we can't do callbacks easily with the PDB, so this UI/backend
|
||||
* separation (though good) is ignored for the moment */
|
||||
#ifdef BLEND_UI_CALLS_VIA_PDB
|
||||
return_vals = procedural_db_run_proc ("gimp_blend",
|
||||
&nreturn_vals,
|
||||
PDB_DRAWABLE, drawable_ID (gimage_active_drawable (gimage)),
|
||||
PDB_INT32, (gint32) blend_options->blend_mode,
|
||||
PDB_INT32, (gint32) PAINT_OPTIONS_GET_PAINT_MODE (blend_options),
|
||||
PDB_INT32, (gint32) blend_options->gradient_type,
|
||||
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,
|
||||
PDB_INT32, (gint32) blend_options->max_depth,
|
||||
PDB_FLOAT, (gdouble) blend_options->threshold,
|
||||
PDB_FLOAT, (gdouble) blend_tool->startx,
|
||||
PDB_FLOAT, (gdouble) blend_tool->starty,
|
||||
PDB_FLOAT, (gdouble) blend_tool->endx,
|
||||
PDB_FLOAT, (gdouble) blend_tool->endy,
|
||||
PDB_END);
|
||||
return_vals =
|
||||
procedural_db_run_proc ("gimp_blend",
|
||||
&nreturn_vals,
|
||||
PDB_DRAWABLE, drawable_ID (gimage_active_drawable (gimage)),
|
||||
PDB_INT32, (gint32) blend_options->blend_mode,
|
||||
PDB_INT32, (gint32) gimp_context_get_paint_mode (NULL),
|
||||
PDB_INT32, (gint32) blend_options->gradient_type,
|
||||
PDB_FLOAT, (gdouble) gimp_context_get_opacity (NULL) * 100,
|
||||
PDB_FLOAT, (gdouble) blend_options->offset,
|
||||
PDB_INT32, (gint32) blend_options->repeat,
|
||||
PDB_INT32, (gint32) blend_options->supersample,
|
||||
PDB_INT32, (gint32) blend_options->max_depth,
|
||||
PDB_FLOAT, (gdouble) blend_options->threshold,
|
||||
PDB_FLOAT, (gdouble) blend_tool->startx,
|
||||
PDB_FLOAT, (gdouble) blend_tool->starty,
|
||||
PDB_FLOAT, (gdouble) blend_tool->endx,
|
||||
PDB_FLOAT, (gdouble) blend_tool->endy,
|
||||
PDB_END);
|
||||
|
||||
if (return_vals && return_vals[0].value.pdb_int == PDB_SUCCESS)
|
||||
gdisplays_flush ();
|
||||
|
@ -594,9 +595,9 @@ blend_button_release (Tool *tool,
|
|||
blend (gimage,
|
||||
gimage_active_drawable (gimage),
|
||||
blend_options->blend_mode,
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (blend_options),
|
||||
gimp_context_get_paint_mode (NULL),
|
||||
blend_options->gradient_type,
|
||||
PAINT_OPTIONS_GET_OPACITY (blend_options) * 100,
|
||||
gimp_context_get_opacity (NULL) * 100,
|
||||
blend_options->offset,
|
||||
blend_options->repeat,
|
||||
blend_options->supersample,
|
||||
|
|
|
@ -174,6 +174,7 @@ bucket_options_new (void)
|
|||
return options;
|
||||
}
|
||||
|
||||
/* bucket fill action functions */
|
||||
|
||||
static void
|
||||
bucket_fill_button_press (Tool *tool,
|
||||
|
@ -203,7 +204,6 @@ bucket_fill_button_press (Tool *tool,
|
|||
tool->state = ACTIVE;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
bucket_fill_button_release (Tool *tool,
|
||||
GdkEventButton *bevent,
|
||||
|
@ -223,17 +223,18 @@ bucket_fill_button_release (Tool *tool,
|
|||
/* if the 3rd button isn't pressed, fill the selected region */
|
||||
if (! (bevent->state & GDK_BUTTON3_MASK))
|
||||
{
|
||||
return_vals = procedural_db_run_proc ("gimp_bucket_fill",
|
||||
&nreturn_vals,
|
||||
PDB_DRAWABLE, drawable_ID (gimage_active_drawable (gdisp->gimage)),
|
||||
PDB_INT32, (gint32) bucket_options->fill_mode,
|
||||
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,
|
||||
PDB_FLOAT, (gdouble) bucket_tool->target_y,
|
||||
PDB_END);
|
||||
return_vals =
|
||||
procedural_db_run_proc ("gimp_bucket_fill",
|
||||
&nreturn_vals,
|
||||
PDB_DRAWABLE, drawable_ID (gimage_active_drawable (gdisp->gimage)),
|
||||
PDB_INT32, (gint32) bucket_options->fill_mode,
|
||||
PDB_INT32, (gint32) gimp_context_get_paint_mode (NULL),
|
||||
PDB_FLOAT, (gdouble) gimp_context_get_opacity (NULL) * 100,
|
||||
PDB_FLOAT, (gdouble) bucket_options->threshold,
|
||||
PDB_INT32, (gint32) bucket_options->sample_merged,
|
||||
PDB_FLOAT, (gdouble) bucket_tool->target_x,
|
||||
PDB_FLOAT, (gdouble) bucket_tool->target_y,
|
||||
PDB_END);
|
||||
|
||||
if (return_vals && return_vals[0].value.pdb_int == PDB_SUCCESS)
|
||||
gdisplays_flush ();
|
||||
|
|
|
@ -589,8 +589,8 @@ 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) (PAINT_OPTIONS_GET_OPACITY (clone_options) * 255),
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (clone_options),
|
||||
(int) (gimp_context_get_opacity (NULL) * 255),
|
||||
gimp_context_get_paint_mode (NULL),
|
||||
SOFT, CONSTANT);
|
||||
}
|
||||
|
||||
|
|
|
@ -348,8 +348,8 @@ 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) (PAINT_OPTIONS_GET_OPACITY (convolve_options) * 255),
|
||||
SOFT, INCREMENTAL);
|
||||
(int) (gimp_context_get_opacity (NULL) * 255),
|
||||
SOFT, INCREMENTAL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -371,7 +371,7 @@ dodgeburn_motion (PaintCore *paint_core,
|
|||
temp_data = g_malloc (tempPR.h * tempPR.rowstride);
|
||||
tempPR.data = temp_data;
|
||||
|
||||
brush_opacity = PAINT_OPTIONS_GET_OPACITY (dodgeburn_options);
|
||||
brush_opacity = gimp_context_get_opacity (NULL);
|
||||
exposure = (dodgeburn_options->exposure)/100.0;
|
||||
|
||||
/* DodgeBurn the region */
|
||||
|
|
|
@ -198,12 +198,14 @@ eraser_motion (PaintCore *paint_core,
|
|||
/* color the pixels */
|
||||
color_pixels (temp_buf_data (area), col,
|
||||
area->width * area->height, area->bytes);
|
||||
opacity = 255 * paint_options_get_opacity() * (paint_core->curpressure / 0.5);
|
||||
opacity = 255 * gimp_context_get_opacity (NULL) * (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) (PAINT_OPTIONS_GET_OPACITY (eraser_options) * 255),
|
||||
ERASE_MODE, hard? HARD : SOFT, incremental ? INCREMENTAL : CONSTANT);
|
||||
(int) (gimp_context_get_opacity (NULL) * 255),
|
||||
ERASE_MODE,
|
||||
hard ? HARD : SOFT,
|
||||
incremental ? INCREMENTAL : CONSTANT);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1414,8 +1414,8 @@ ink_paste (InkTool *ink_tool,
|
|||
/* apply the paint area to the gimage */
|
||||
gimage_apply_image (gimage, drawable, &srcPR,
|
||||
FALSE,
|
||||
(int) (PAINT_OPTIONS_GET_OPACITY (ink_options) * 255),
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (ink_options),
|
||||
(int) (gimp_context_get_opacity (NULL) * 255),
|
||||
gimp_context_get_paint_mode (NULL),
|
||||
undo_tiles, /* specify an alternative src1 */
|
||||
canvas_buf->x, canvas_buf->y);
|
||||
|
||||
|
|
|
@ -19,28 +19,11 @@
|
|||
#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
|
||||
*/
|
||||
/* the paint options structures */
|
||||
typedef struct _PaintOptions PaintOptions;
|
||||
struct _PaintOptions
|
||||
{
|
||||
|
@ -53,48 +36,31 @@ struct _PaintOptions
|
|||
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
|
||||
*/
|
||||
/* 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
|
||||
*/
|
||||
/* 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
|
||||
*/
|
||||
/* functions for the global paint options */
|
||||
|
||||
/* switch between global and per-tool 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
|
||||
*/
|
||||
/* a utility function which returns a paint mode menu */
|
||||
GtkWidget *paint_mode_menu_new (MenuItemCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
|
|
|
@ -126,8 +126,9 @@ 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) (PAINT_OPTIONS_GET_OPACITY (pencil_options) * 255),
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (pencil_options), HARD, CONSTANT);
|
||||
(int) (gimp_context_get_opacity (NULL) * 255),
|
||||
gimp_context_get_paint_mode (NULL),
|
||||
HARD, CONSTANT);
|
||||
}
|
||||
|
||||
static void *
|
||||
|
@ -149,7 +150,7 @@ pencil_non_gui (GimpDrawable *drawable,
|
|||
int i;
|
||||
|
||||
if (paint_core_init (&non_gui_paint_core, drawable,
|
||||
stroke_array[0], stroke_array[1]))
|
||||
stroke_array[0], stroke_array[1]))
|
||||
{
|
||||
/* Set the paint core's paint func */
|
||||
non_gui_paint_core.paint_func = pencil_non_gui_paint_func;
|
||||
|
|
|
@ -283,8 +283,8 @@ tools_free_smudge (Tool *tool)
|
|||
}
|
||||
|
||||
static void
|
||||
smudge_motion (PaintCore *paint_core,
|
||||
GimpDrawable *drawable)
|
||||
smudge_motion (PaintCore *paint_core,
|
||||
GimpDrawable *drawable)
|
||||
{
|
||||
GImage *gimage;
|
||||
TempBuf * area;
|
||||
|
@ -313,7 +313,7 @@ smudge_motion (PaintCore *paint_core,
|
|||
pixel_region_init (&srcPR, drawable_data (drawable),
|
||||
area->x, area->y, area->width, area->height, FALSE);
|
||||
|
||||
brush_opacity = PAINT_OPTIONS_GET_OPACITY (smudge_options);
|
||||
brush_opacity = gimp_context_get_opacity (NULL);
|
||||
pressure = (smudge_options->pressure)/100.0;
|
||||
|
||||
/* The tempPR will be the built up buffer (for smudge) */
|
||||
|
|
|
@ -589,8 +589,8 @@ 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) (PAINT_OPTIONS_GET_OPACITY (clone_options) * 255),
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (clone_options),
|
||||
(int) (gimp_context_get_opacity (NULL) * 255),
|
||||
gimp_context_get_paint_mode (NULL),
|
||||
SOFT, CONSTANT);
|
||||
}
|
||||
|
||||
|
|
|
@ -1414,8 +1414,8 @@ ink_paste (InkTool *ink_tool,
|
|||
/* apply the paint area to the gimage */
|
||||
gimage_apply_image (gimage, drawable, &srcPR,
|
||||
FALSE,
|
||||
(int) (PAINT_OPTIONS_GET_OPACITY (ink_options) * 255),
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (ink_options),
|
||||
(int) (gimp_context_get_opacity (NULL) * 255),
|
||||
gimp_context_get_paint_mode (NULL),
|
||||
undo_tiles, /* specify an alternative src1 */
|
||||
canvas_buf->x, canvas_buf->y);
|
||||
|
||||
|
|
|
@ -19,28 +19,11 @@
|
|||
#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
|
||||
*/
|
||||
/* the paint options structures */
|
||||
typedef struct _PaintOptions PaintOptions;
|
||||
struct _PaintOptions
|
||||
{
|
||||
|
@ -53,48 +36,31 @@ struct _PaintOptions
|
|||
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
|
||||
*/
|
||||
/* 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
|
||||
*/
|
||||
/* 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
|
||||
*/
|
||||
/* functions for the global paint options */
|
||||
|
||||
/* switch between global and per-tool 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
|
||||
*/
|
||||
/* a utility function which returns a paint mode menu */
|
||||
GtkWidget *paint_mode_menu_new (MenuItemCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
|
|
|
@ -433,9 +433,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) (PAINT_OPTIONS_GET_OPACITY (paintbrush_options) * 255),
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (paintbrush_options),
|
||||
PRESSURE,
|
||||
(int) (gimp_context_get_opacity (NULL) * 255),
|
||||
gimp_context_get_paint_mode (NULL),
|
||||
PRESSURE,
|
||||
incremental ? INCREMENTAL : CONSTANT);
|
||||
}
|
||||
}
|
||||
|
@ -446,7 +446,9 @@ paintbrush_non_gui_paint_func (PaintCore *paint_core,
|
|||
GimpDrawable *drawable,
|
||||
int state)
|
||||
{
|
||||
paintbrush_motion (paint_core, drawable, non_gui_fade_out,non_gui_gradient_length, non_gui_incremental, non_gui_gradient_type);
|
||||
paintbrush_motion (paint_core, drawable, non_gui_fade_out,
|
||||
non_gui_gradient_length, non_gui_incremental,
|
||||
non_gui_gradient_type);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -126,8 +126,9 @@ 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) (PAINT_OPTIONS_GET_OPACITY (pencil_options) * 255),
|
||||
PAINT_OPTIONS_GET_PAINT_MODE (pencil_options), HARD, CONSTANT);
|
||||
(int) (gimp_context_get_opacity (NULL) * 255),
|
||||
gimp_context_get_paint_mode (NULL),
|
||||
HARD, CONSTANT);
|
||||
}
|
||||
|
||||
static void *
|
||||
|
@ -149,7 +150,7 @@ pencil_non_gui (GimpDrawable *drawable,
|
|||
int i;
|
||||
|
||||
if (paint_core_init (&non_gui_paint_core, drawable,
|
||||
stroke_array[0], stroke_array[1]))
|
||||
stroke_array[0], stroke_array[1]))
|
||||
{
|
||||
/* Set the paint core's paint func */
|
||||
non_gui_paint_core.paint_func = pencil_non_gui_paint_func;
|
||||
|
|
|
@ -283,8 +283,8 @@ tools_free_smudge (Tool *tool)
|
|||
}
|
||||
|
||||
static void
|
||||
smudge_motion (PaintCore *paint_core,
|
||||
GimpDrawable *drawable)
|
||||
smudge_motion (PaintCore *paint_core,
|
||||
GimpDrawable *drawable)
|
||||
{
|
||||
GImage *gimage;
|
||||
TempBuf * area;
|
||||
|
@ -313,7 +313,7 @@ smudge_motion (PaintCore *paint_core,
|
|||
pixel_region_init (&srcPR, drawable_data (drawable),
|
||||
area->x, area->y, area->width, area->height, FALSE);
|
||||
|
||||
brush_opacity = PAINT_OPTIONS_GET_OPACITY (smudge_options);
|
||||
brush_opacity = gimp_context_get_opacity (NULL);
|
||||
pressure = (smudge_options->pressure)/100.0;
|
||||
|
||||
/* The tempPR will be the built up buffer (for smudge) */
|
||||
|
|
|
@ -27,10 +27,6 @@
|
|||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
/* 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;
|
||||
|
||||
|
@ -94,10 +90,20 @@ void
|
|||
tool_options_opacity_adjustment_update (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
double *val;
|
||||
gimp_context_set_opacity (GIMP_CONTEXT (data),
|
||||
GTK_ADJUSTMENT (widget)->value / 100);
|
||||
}
|
||||
|
||||
val = (double *) data;
|
||||
*val = GTK_ADJUSTMENT (widget)->value / 100;
|
||||
static void
|
||||
tool_options_paint_mode_update (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GimpContext *context;
|
||||
|
||||
context = (GimpContext *) gtk_object_get_user_data (GTK_OBJECT (widget));
|
||||
|
||||
gimp_context_set_paint_mode (GIMP_CONTEXT (context),
|
||||
(long) data);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -124,18 +130,6 @@ tool_options_unitmenu_update (GtkWidget *widget,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
tool_options_paint_mode_update (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
PaintOptions *options;
|
||||
|
||||
options = (PaintOptions *) gtk_object_get_user_data (GTK_OBJECT (widget));
|
||||
|
||||
if (options)
|
||||
options->paint_mode = (long) data;
|
||||
}
|
||||
|
||||
static void
|
||||
tool_options_radio_buttons_update (GtkWidget *widget,
|
||||
gpointer data)
|
||||
|
@ -206,7 +200,7 @@ tool_options_new (gchar *title)
|
|||
|
||||
GtkWidget *label;
|
||||
|
||||
options = (ToolOptions *) g_malloc (sizeof (ToolOptions));
|
||||
options = g_new (ToolOptions, 1);
|
||||
tool_options_init (options, title, NULL);
|
||||
|
||||
label = gtk_label_new (_("This tool has no options."));
|
||||
|
@ -233,20 +227,20 @@ selection_options_init (SelectionOptions *options,
|
|||
/* initialize the tool options structure */
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
((tool_type == RECT_SELECT) ?
|
||||
N_("Rectangular Select Options") :
|
||||
_("Rectangular Select Options") :
|
||||
((tool_type == ELLIPSE_SELECT) ?
|
||||
N_("Elliptical Selection Options") :
|
||||
_("Elliptical Selection Options") :
|
||||
((tool_type == FREE_SELECT) ?
|
||||
N_("Free-hand Selection Options") :
|
||||
_("Free-hand Selection Options") :
|
||||
((tool_type == FUZZY_SELECT) ?
|
||||
N_("Fuzzy Selection Options") :
|
||||
_("Fuzzy Selection Options") :
|
||||
((tool_type == BEZIER_SELECT) ?
|
||||
N_("Bezier Selection Options") :
|
||||
_("Bezier Selection Options") :
|
||||
((tool_type == ISCISSORS) ?
|
||||
N_("Intelligent Scissors Options") :
|
||||
_("Intelligent Scissors Options") :
|
||||
((tool_type == BY_COLOR_SELECT) ?
|
||||
N_("By-Color Select Options") :
|
||||
N_("ERROR: Unknown Selection Type")))))))),
|
||||
_("By-Color Select Options") :
|
||||
_("ERROR: Unknown Selection Type")))))))),
|
||||
reset_func);
|
||||
|
||||
/* the main vbox */
|
||||
|
@ -480,7 +474,7 @@ selection_options_new (ToolType tool_type,
|
|||
{
|
||||
SelectionOptions *options;
|
||||
|
||||
options = (SelectionOptions *) g_malloc (sizeof (SelectionOptions));
|
||||
options = g_new (SelectionOptions, 1);
|
||||
selection_options_init (options, tool_type, reset_func);
|
||||
|
||||
return options;
|
||||
|
@ -550,37 +544,36 @@ paint_options_init (PaintOptions *options,
|
|||
GtkWidget *menu;
|
||||
GtkWidget *separator;
|
||||
|
||||
GimpContext *tool_context = tool_info[tool_type].tool_context;
|
||||
|
||||
/* initialize the tool options structure */
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
((tool_type == BUCKET_FILL) ?
|
||||
N_("Bucket Fill Options") :
|
||||
_("Bucket Fill Options") :
|
||||
((tool_type == BLEND) ?
|
||||
N_("Blend Options") :
|
||||
_("Blend Options") :
|
||||
((tool_type == PENCIL) ?
|
||||
N_("Pencil Options") :
|
||||
_("Pencil Options") :
|
||||
((tool_type == PAINTBRUSH) ?
|
||||
N_("Paintbrush Options") :
|
||||
_("Paintbrush Options") :
|
||||
((tool_type == ERASER) ?
|
||||
N_("Erazer Options") :
|
||||
_("Erazer Options") :
|
||||
((tool_type == AIRBRUSH) ?
|
||||
N_("Airbrush Options") :
|
||||
_("Airbrush Options") :
|
||||
((tool_type == CLONE) ?
|
||||
N_("Clone Tool Options") :
|
||||
_("Clone Tool Options") :
|
||||
((tool_type == CONVOLVE) ?
|
||||
N_("Convolver Options") :
|
||||
_("Convolver Options") :
|
||||
((tool_type == INK) ?
|
||||
N_("Ink Options") :
|
||||
((tool_type == DODGEBURN) ?
|
||||
N_("Dodge or Burn Options") :
|
||||
((tool_type == SMUDGE) ?
|
||||
N_("Smudge Options") :
|
||||
N_("ERROR: Unknown Paint Type")))))))))))),
|
||||
_("Ink Options") :
|
||||
((tool_type == DODGEBURN) ?
|
||||
_("Dodge or Burn Options") :
|
||||
((tool_type == SMUDGE) ?
|
||||
_("Smudge 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;
|
||||
|
@ -604,10 +597,11 @@ paint_options_init (PaintOptions *options,
|
|||
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_adjustment_new (gimp_context_get_opacity (tool_context) * 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);
|
||||
tool_context);
|
||||
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);
|
||||
|
@ -640,12 +634,20 @@ paint_options_init (PaintOptions *options,
|
|||
gtk_container_add (GTK_CONTAINER (abox), options->paint_mode_w);
|
||||
gtk_widget_show (options->paint_mode_w);
|
||||
|
||||
/* eek */
|
||||
gtk_object_set_data (GTK_OBJECT (options->paint_mode_w), "tool_context",
|
||||
tool_info[tool_type].tool_context);
|
||||
|
||||
menu =
|
||||
paint_mode_menu_new (tool_options_paint_mode_update, (gpointer) options);
|
||||
paint_mode_menu_new (tool_options_paint_mode_update, tool_context);
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (options->paint_mode_w), menu);
|
||||
gtk_option_menu_set_history (GTK_OPTION_MENU (options->paint_mode_w),
|
||||
gimp_context_get_paint_mode (tool_context));
|
||||
break;
|
||||
case CONVOLVE:
|
||||
case ERASER:
|
||||
case DODGEBURN:
|
||||
case SMUDGE:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -676,7 +678,7 @@ paint_options_new (ToolType tool_type,
|
|||
PaintOptions *options;
|
||||
GtkWidget *label;
|
||||
|
||||
options = (PaintOptions *) g_malloc (sizeof (PaintOptions));
|
||||
options = g_new (PaintOptions, 1);
|
||||
paint_options_init (options, tool_type, reset_func);
|
||||
|
||||
options->global = gtk_vbox_new (FALSE, 2);
|
||||
|
@ -696,16 +698,25 @@ paint_options_new (ToolType tool_type,
|
|||
void
|
||||
paint_options_reset (PaintOptions *options)
|
||||
{
|
||||
GimpContext *default_context;
|
||||
|
||||
default_context = gimp_context_get_default ();
|
||||
|
||||
if (options->opacity_w)
|
||||
{
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->opacity_w),
|
||||
options->opacity_d * 100);
|
||||
gimp_context_get_opacity (default_context) * 100);
|
||||
}
|
||||
if (options->paint_mode_w)
|
||||
{
|
||||
options->paint_mode = options->paint_mode_d;
|
||||
GimpContext *context;
|
||||
|
||||
context = (GimpContext *) gtk_object_get_data (GTK_OBJECT (options->paint_mode_w), "tool_context");
|
||||
|
||||
gimp_context_set_paint_mode (GIMP_CONTEXT (context),
|
||||
gimp_context_get_paint_mode (default_context));
|
||||
gtk_option_menu_set_history (GTK_OPTION_MENU (options->paint_mode_w),
|
||||
options->paint_mode_d);
|
||||
gimp_context_get_paint_mode (default_context));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -749,30 +760,6 @@ paint_options_set_global (gboolean global)
|
|||
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 *************************************************/
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "clone.h"
|
||||
#include "color_balance.h"
|
||||
#include "color_picker.h"
|
||||
#include "context_manager.h"
|
||||
#include "convolve.h"
|
||||
#include "crop.h"
|
||||
#include "curves.h"
|
||||
|
@ -647,6 +648,9 @@ active_tool_free (void)
|
|||
void
|
||||
tools_select (ToolType type)
|
||||
{
|
||||
/* Care for switching to the tool's private context */
|
||||
context_manager_set_tool (type);
|
||||
|
||||
if (active_tool)
|
||||
active_tool_free ();
|
||||
|
||||
|
|
|
@ -156,7 +156,7 @@ HELP
|
|||
&std_pdb_misc;
|
||||
|
||||
@outargs = ( &opacity_arg );
|
||||
$outargs[0]->{alias} = 'paint_options_get_opacity () * 100.0';
|
||||
$outargs[0]->{alias} = 'gimp_context_get_opacity (NULL) * 100.0';
|
||||
$outargs[0]->{no_declare} = 1;
|
||||
}
|
||||
|
||||
|
@ -173,7 +173,7 @@ HELP
|
|||
|
||||
@inargs = ( &opacity_arg );
|
||||
|
||||
%invoke = ( code => 'paint_options_set_opacity (opacity / 100.0);' );
|
||||
%invoke = ( code => 'gimp_context_set_opacity (NULL, opacity / 100.0);' );
|
||||
}
|
||||
|
||||
sub brushes_get_spacing {
|
||||
|
@ -224,7 +224,7 @@ HELP
|
|||
&std_pdb_misc;
|
||||
|
||||
@outargs = ( &paint_mode_arg );
|
||||
$outargs[0]->{alias} = 'paint_options_get_paint_mode ()';
|
||||
$outargs[0]->{alias} = 'gimp_context_get_paint_mode (NULL)';
|
||||
$outargs[0]->{no_declare} = 1;
|
||||
}
|
||||
|
||||
|
@ -241,7 +241,7 @@ HELP
|
|||
|
||||
@inargs = ( &paint_mode_arg );
|
||||
|
||||
%invoke = ( code => 'paint_options_set_paint_mode (paint_mode);' );
|
||||
%invoke = ( code => 'gimp_context_set_paint_mode (NULL, paint_mode);' );
|
||||
}
|
||||
|
||||
sub brushes_list {
|
||||
|
@ -354,7 +354,7 @@ CODE
|
|||
);
|
||||
}
|
||||
|
||||
@headers = qw("gimplist.h" "gimpbrush.h" "gimpbrushlistP.h" "paint_options.h");
|
||||
@headers = qw("gimplist.h" "gimpbrush.h" "gimpbrushlistP.h" "gimpcontext.h");
|
||||
|
||||
@procs = qw(brushes_refresh brushes_get_brush brushes_set_brush
|
||||
brushes_get_opacity brushes_set_opacity brushes_get_spacing
|
||||
|
|
Loading…
Reference in New Issue