Commit 4d2cc645 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

app/paint/gimpairbrush.[ch] app/paint/gimpclone.[ch]

2002-11-27  Michael Natterer  <mitch@gimp.org>

	* app/paint/gimpairbrush.[ch]
	* app/paint/gimpclone.[ch]
	* app/paint/gimpconvolve.[ch]
	* app/paint/gimpdodgeburn.[ch]
	* app/paint/gimperaser.[ch]
	* app/paint/gimppaintoptions.[ch]
	* app/paint/gimpsmudge.[ch]: it's hard to paint without a context
	to get color, brush etc. from. Added "context" parameters to
	all paint options constructors.

	* tools/pdbgen/pdb/paint_tools.pdb: pass gimp_get_current_context()
	to the constructors. Fixes bug #99557.

	* app/pdb/paint_tools_cmds.c: regenerated.

	* app/tools/gimpairbrushtool.c
	* app/tools/gimpblendtool.c
	* app/tools/gimpbucketfilltool.c
	* app/tools/gimpclonetool.c
	* app/tools/gimpconvolvetool.c
	* app/tools/gimpdodgeburntool.c
	* app/tools/gimperasertool.c
	* app/tools/gimpinktool.c
	* app/tools/gimpsmudgetool.c: changed accordingly.

	* app/tools/paint_options.c: ditto. Don't set
	paint_options->context here because we also need it in the
	no-interface case above.
parent 401c35f7
2002-11-27 Michael Natterer <mitch@gimp.org>
* app/paint/gimpairbrush.[ch]
* app/paint/gimpclone.[ch]
* app/paint/gimpconvolve.[ch]
* app/paint/gimpdodgeburn.[ch]
* app/paint/gimperaser.[ch]
* app/paint/gimppaintoptions.[ch]
* app/paint/gimpsmudge.[ch]: it's hard to paint without a context
to get color, brush etc. from. Added "context" parameters to
all paint options constructors.
* tools/pdbgen/pdb/paint_tools.pdb: pass gimp_get_current_context()
to the constructors. Fixes bug #99557.
* app/pdb/paint_tools_cmds.c: regenerated.
* app/tools/gimpairbrushtool.c
* app/tools/gimpblendtool.c
* app/tools/gimpbucketfilltool.c
* app/tools/gimpclonetool.c
* app/tools/gimpconvolvetool.c
* app/tools/gimpdodgeburntool.c
* app/tools/gimperasertool.c
* app/tools/gimpinktool.c
* app/tools/gimpsmudgetool.c: changed accordingly.
* app/tools/paint_options.c: ditto. Don't set
paint_options->context here because we also need it in the
no-interface case above.
2002-11-27 Maurits Rijk <lpeek.mrijk@consunet.nl>
* plug-ins/common/AlienMap.c
......@@ -35,7 +66,7 @@
calling user_install_dialog_create().
* app/gui/preferences-dialog.c: ditto. Added the static
prefs_dialog pointer again to our local help func finds the
prefs_dialog pointer again so our local help func finds the
current notebook page.
2002-11-26 Jakub Steiner <jimmac@ximian.com>
......
......@@ -327,13 +327,15 @@ gimp_airbrush_timeout (gpointer client_data)
/* paint options stuff */
GimpAirbrushOptions *
gimp_airbrush_options_new (void)
gimp_airbrush_options_new (GimpContext *context)
{
GimpAirbrushOptions *options;
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
options = g_new0 (GimpAirbrushOptions, 1);
gimp_paint_options_init ((GimpPaintOptions *) options);
gimp_paint_options_init ((GimpPaintOptions *) options, context);
options->rate = options->rate_d = AIRBRUSH_DEFAULT_RATE;
options->pressure = options->pressure_d = AIRBRUSH_DEFAULT_PRESSURE;
......
......@@ -68,7 +68,7 @@ void gimp_airbrush_register (Gimp *gimp,
GType gimp_airbrush_get_type (void) G_GNUC_CONST;
GimpAirbrushOptions * gimp_airbrush_options_new (void);
GimpAirbrushOptions * gimp_airbrush_options_new (GimpContext *context);
#endif /* __GIMP_AIRBRUSH_H__ */
......@@ -570,13 +570,15 @@ gimp_clone_set_src_drawable (GimpClone *clone,
#define CLONE_DEFAULT_ALIGNED GIMP_CLONE_ALIGN_NO
GimpCloneOptions *
gimp_clone_options_new (void)
gimp_clone_options_new (GimpContext *context)
{
GimpCloneOptions *options;
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
options = g_new0 (GimpCloneOptions, 1);
gimp_paint_options_init ((GimpPaintOptions *) options);
gimp_paint_options_init ((GimpPaintOptions *) options, context);
options->type = options->type_d = CLONE_DEFAULT_TYPE;
options->aligned = options->aligned_d = CLONE_DEFAULT_ALIGNED;
......
......@@ -89,7 +89,7 @@ void gimp_clone_register (Gimp *gimp,
GType gimp_clone_get_type (void) G_GNUC_CONST;
GimpCloneOptions * gimp_clone_options_new (void);
GimpCloneOptions * gimp_clone_options_new (GimpContext *context);
#endif /* __GIMP_CLONE_H__ */
......@@ -497,13 +497,15 @@ gimp_convolve_sum_matrix (gint *matrix,
#define DEFAULT_CONVOLVE_TYPE GIMP_BLUR_CONVOLVE
GimpConvolveOptions *
gimp_convolve_options_new (void)
gimp_convolve_options_new (GimpContext *context)
{
GimpConvolveOptions *options;
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
options = g_new0 (GimpConvolveOptions, 1);
gimp_paint_options_init ((GimpPaintOptions *) options);
gimp_paint_options_init ((GimpPaintOptions *) options, context);
options->type = options->type_d = DEFAULT_CONVOLVE_TYPE;
options->rate = options->rate_d = DEFAULT_CONVOLVE_RATE;
......
......@@ -68,7 +68,7 @@ void gimp_convolve_register (Gimp *gimp,
GType gimp_convolve_get_type (void) G_GNUC_CONST;
GimpConvolveOptions * gimp_convolve_options_new (void);
GimpConvolveOptions * gimp_convolve_options_new (GimpContext *context);
#endif /* __GIMP_CONVOLVE_H__ */
......@@ -422,13 +422,15 @@ gimp_dodgeburn_shadows_lut_func (gpointer user_data,
#define DODGEBURN_DEFAULT_MODE GIMP_MIDTONES
GimpDodgeBurnOptions *
gimp_dodgeburn_options_new (void)
gimp_dodgeburn_options_new (GimpContext *context)
{
GimpDodgeBurnOptions *options;
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
options = g_new0 (GimpDodgeBurnOptions, 1);
gimp_paint_options_init ((GimpPaintOptions *) options);
gimp_paint_options_init ((GimpPaintOptions *) options, context);
options->type = options->type_d = DODGEBURN_DEFAULT_TYPE;
options->exposure = options->exposure_d = DODGEBURN_DEFAULT_EXPOSURE;
......
......@@ -73,7 +73,7 @@ void gimp_dodgeburn_register (Gimp *gimp,
GType gimp_dodgeburn_get_type (void) G_GNUC_CONST;
GimpDodgeBurnOptions * gimp_dodgeburn_options_new (void);
GimpDodgeBurnOptions * gimp_dodgeburn_options_new (GimpContext *context);
#endif /* __GIMP_DODGEBURN_H__ */
......@@ -204,13 +204,15 @@ gimp_eraser_motion (GimpPaintCore *paint_core,
#define ERASER_DEFAULT_ANTI_ERASE FALSE
GimpEraserOptions *
gimp_eraser_options_new (void)
gimp_eraser_options_new (GimpContext *context)
{
GimpEraserOptions *options;
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
options = g_new0 (GimpEraserOptions, 1);
gimp_paint_options_init ((GimpPaintOptions *) options);
gimp_paint_options_init ((GimpPaintOptions *) options, context);
options->hard = options->hard_d = ERASER_DEFAULT_HARD;
options->anti_erase = options->anti_erase_d = ERASER_DEFAULT_ANTI_ERASE;
......
......@@ -68,7 +68,7 @@ void gimp_eraser_register (Gimp *gimp,
GType gimp_eraser_get_type (void) G_GNUC_CONST;
GimpEraserOptions * gimp_eraser_options_new (void);
GimpEraserOptions * gimp_eraser_options_new (GimpContext *context);
#endif /* __GIMP_ERASER_H__ */
......@@ -1387,7 +1387,7 @@ ink_options_new (GimpToolInfo *tool_info)
options = g_new0 (InkOptions, 1);
gimp_paint_options_init ((GimpPaintOptions *) options);
gimp_paint_options_init ((GimpPaintOptions *) options, tool_info->context);
paint_options_init ((GimpPaintOptions *) options, tool_info);
......
......@@ -22,6 +22,8 @@
#include "paint-types.h"
#include "core/gimpcontext.h"
#include "gimppaintoptions.h"
......@@ -49,25 +51,29 @@ static GimpGradientOptions * gimp_gradient_options_new (void);
/* public functions */
GimpPaintOptions *
gimp_paint_options_new (void)
gimp_paint_options_new (GimpContext *context)
{
GimpPaintOptions *options;
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
options = g_new0 (GimpPaintOptions, 1);
gimp_paint_options_init (options);
gimp_paint_options_init (options, context);
return options;
}
void
gimp_paint_options_init (GimpPaintOptions *options)
gimp_paint_options_init (GimpPaintOptions *options,
GimpContext *context)
{
g_return_if_fail (options != NULL);
g_return_if_fail (options != NULL);
g_return_if_fail (GIMP_IS_CONTEXT (context));
options->opacity_w = NULL;
options->paint_mode_w = NULL;
options->context = NULL;
options->context = context;
options->incremental_w = NULL;
options->incremental = options->incremental_d = DEFAULT_INCREMENTAL;
......
......@@ -118,9 +118,10 @@ struct _GimpPaintOptions
/* paint tool options functions */
GimpPaintOptions * gimp_paint_options_new (void);
GimpPaintOptions * gimp_paint_options_new (GimpContext *context);
void gimp_paint_options_init (GimpPaintOptions *options);
void gimp_paint_options_init (GimpPaintOptions *options,
GimpContext *context);
#endif /* __GIMP_PAINT_OPTIONS_H__ */
......@@ -426,13 +426,15 @@ gimp_smudge_allocate_accum_buffer (GimpSmudge *smudge,
#define SMUDGE_DEFAULT_RATE 50.0
GimpSmudgeOptions *
gimp_smudge_options_new (void)
gimp_smudge_options_new (GimpContext *context)
{
GimpSmudgeOptions *options;
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
options = g_new0 (GimpSmudgeOptions, 1);
gimp_paint_options_init ((GimpPaintOptions *) options);
gimp_paint_options_init ((GimpPaintOptions *) options, context);
options->rate = options->rate_d = SMUDGE_DEFAULT_RATE;
......
......@@ -70,7 +70,7 @@ void gimp_smudge_register (Gimp *gimp,
GType gimp_smudge_get_type (void) G_GNUC_CONST;
GimpSmudgeOptions * gimp_smudge_options_new (void);
GimpSmudgeOptions * gimp_smudge_options_new (GimpContext *context);
#endif /* __GIMP_SMUDGE_H__ */
......@@ -570,13 +570,15 @@ gimp_clone_set_src_drawable (GimpClone *clone,
#define CLONE_DEFAULT_ALIGNED GIMP_CLONE_ALIGN_NO
GimpCloneOptions *
gimp_clone_options_new (void)
gimp_clone_options_new (GimpContext *context)
{
GimpCloneOptions *options;
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
options = g_new0 (GimpCloneOptions, 1);
gimp_paint_options_init ((GimpPaintOptions *) options);
gimp_paint_options_init ((GimpPaintOptions *) options, context);
options->type = options->type_d = CLONE_DEFAULT_TYPE;
options->aligned = options->aligned_d = CLONE_DEFAULT_ALIGNED;
......
......@@ -89,7 +89,7 @@ void gimp_clone_register (Gimp *gimp,
GType gimp_clone_get_type (void) G_GNUC_CONST;
GimpCloneOptions * gimp_clone_options_new (void);
GimpCloneOptions * gimp_clone_options_new (GimpContext *context);
#endif /* __GIMP_CLONE_H__ */
......@@ -29,6 +29,7 @@
#include "procedural_db.h"
#include "base/base-enums.h"
#include "core/gimp.h"
#include "core/gimpdrawable.h"
#include "paint/gimpairbrush.h"
#include "paint/gimpclone.h"
......@@ -145,7 +146,7 @@ airbrush_invoker (Gimp *gimp,
if (success)
{
options = gimp_airbrush_options_new ();
options = gimp_airbrush_options_new (gimp_get_current_context (gimp));
options->pressure = pressure;
......@@ -223,7 +224,7 @@ airbrush_default_invoker (Gimp *gimp,
if (success)
{
options = gimp_airbrush_options_new ();
options = gimp_airbrush_options_new (gimp_get_current_context (gimp));
success = paint_tools_stroke (gimp,
GIMP_TYPE_AIRBRUSH,
......@@ -310,7 +311,7 @@ clone_invoker (Gimp *gimp,
if (success)
{
options = gimp_clone_options_new ();
options = gimp_clone_options_new (gimp_get_current_context (gimp));
options->type = clone_type;
......@@ -411,7 +412,7 @@ clone_default_invoker (Gimp *gimp,
if (success)
{
options = gimp_clone_options_new ();
options = gimp_clone_options_new (gimp_get_current_context (gimp));
success = paint_tools_stroke (gimp,
GIMP_TYPE_CLONE,
......@@ -492,7 +493,7 @@ convolve_invoker (Gimp *gimp,
if (success)
{
options = gimp_convolve_options_new ();
options = gimp_convolve_options_new (gimp_get_current_context (gimp));
options->type = convolve_type;
options->rate = pressure;
......@@ -576,7 +577,7 @@ convolve_default_invoker (Gimp *gimp,
if (success)
{
options = gimp_convolve_options_new ();
options = gimp_convolve_options_new (gimp_get_current_context (gimp));
success = paint_tools_stroke (gimp,
GIMP_TYPE_CONVOLVE,
......@@ -662,7 +663,7 @@ dodgeburn_invoker (Gimp *gimp,
if (success)
{
options = gimp_dodgeburn_options_new ();
options = gimp_dodgeburn_options_new (gimp_get_current_context (gimp));
options->exposure = exposure;
options->type = dodgeburn_type;
......@@ -752,7 +753,7 @@ dodgeburn_default_invoker (Gimp *gimp,
if (success)
{
options = gimp_dodgeburn_options_new ();
options = gimp_dodgeburn_options_new (gimp_get_current_context (gimp));
success = paint_tools_stroke (gimp,
GIMP_TYPE_DODGEBURN,
......@@ -833,7 +834,7 @@ eraser_invoker (Gimp *gimp,
if (success)
{
options = gimp_eraser_options_new ();
options = gimp_eraser_options_new (gimp_get_current_context (gimp));
options->paint_options.incremental = method;
......@@ -918,7 +919,7 @@ eraser_default_invoker (Gimp *gimp,
if (success)
{
options = gimp_eraser_options_new ();
options = gimp_eraser_options_new (gimp_get_current_context (gimp));
success = paint_tools_stroke (gimp,
GIMP_TYPE_ERASER,
......@@ -1004,7 +1005,7 @@ paintbrush_invoker (Gimp *gimp,
if (success)
{
options = gimp_paint_options_new ();
options = gimp_paint_options_new (gimp_get_current_context (gimp));
options->incremental = method;
......@@ -1095,7 +1096,7 @@ paintbrush_default_invoker (Gimp *gimp,
if (success)
{
options = gimp_paint_options_new ();
options = gimp_paint_options_new (gimp_get_current_context (gimp));
success = paint_tools_stroke (gimp,
GIMP_TYPE_PAINTBRUSH,
......@@ -1166,7 +1167,7 @@ pencil_invoker (Gimp *gimp,
if (success)
{
options = gimp_paint_options_new ();
options = gimp_paint_options_new (gimp_get_current_context (gimp));
success = paint_tools_stroke (gimp,
GIMP_TYPE_PENCIL,
......@@ -1242,7 +1243,7 @@ smudge_invoker (Gimp *gimp,
if (success)
{
options = gimp_smudge_options_new ();
options = gimp_smudge_options_new (gimp_get_current_context (gimp));
options->rate = pressure;
......@@ -1320,7 +1321,7 @@ smudge_default_invoker (Gimp *gimp,
if (success)
{
options = gimp_smudge_options_new ();
options = gimp_smudge_options_new (gimp_get_current_context (gimp));
success = paint_tools_stroke (gimp,
GIMP_TYPE_SMUDGE,
......
......@@ -131,7 +131,7 @@ airbrush_options_new (GimpToolInfo *tool_info)
GtkWidget *vbox;
GtkWidget *table;
options = gimp_airbrush_options_new ();
options = gimp_airbrush_options_new (tool_info->context);
paint_options_init ((GimpPaintOptions *) options, tool_info);
......
......@@ -444,7 +444,7 @@ blend_options_new (GimpToolInfo *tool_info)
/* the new blend tool options structure */
options = g_new0 (BlendOptions, 1);
gimp_paint_options_init ((GimpPaintOptions *) options);
gimp_paint_options_init ((GimpPaintOptions *) options, tool_info->context);
paint_options_init ((GimpPaintOptions *) options, tool_info);
......
......@@ -339,7 +339,7 @@ bucket_options_new (GimpToolInfo *tool_info)
options = g_new0 (BucketOptions, 1);
gimp_paint_options_init ((GimpPaintOptions *) options);
gimp_paint_options_init ((GimpPaintOptions *) options, tool_info->context);
paint_options_init ((GimpPaintOptions *) options, tool_info);
......
......@@ -368,7 +368,7 @@ clone_options_new (GimpToolInfo *tool_info)
GtkWidget *vbox;
GtkWidget *frame;
options = gimp_clone_options_new ();
options = gimp_clone_options_new (tool_info->context);
paint_options_init ((GimpPaintOptions *) options, tool_info);
......
......@@ -211,7 +211,7 @@ convolve_options_new (GimpToolInfo *tool_info)
GtkWidget *table;
GtkWidget *frame;
options = gimp_convolve_options_new ();
options = gimp_convolve_options_new (tool_info->context);
paint_options_init ((GimpPaintOptions *) options, tool_info);
......
......@@ -189,7 +189,7 @@ gimp_dodgeburn_tool_options_new (GimpToolInfo *tool_info)
GtkWidget *table;
GtkWidget *frame;
options = gimp_dodgeburn_options_new ();
options = gimp_dodgeburn_options_new (tool_info->context);
paint_options_init ((GimpPaintOptions *) options, tool_info);
......
......@@ -173,7 +173,7 @@ gimp_eraser_tool_options_new (GimpToolInfo *tool_info)
GimpEraserOptions *options;
GtkWidget *vbox;
options = gimp_eraser_options_new ();
options = gimp_eraser_options_new (tool_info->context);
paint_options_init ((GimpPaintOptions *) options, tool_info);
......
......@@ -1387,7 +1387,7 @@ ink_options_new (GimpToolInfo *tool_info)
options = g_new0 (InkOptions, 1);
gimp_paint_options_init ((GimpPaintOptions *) options);
gimp_paint_options_init ((GimpPaintOptions *) options, tool_info->context);
paint_options_init ((GimpPaintOptions *) options, tool_info);
......
......@@ -88,7 +88,7 @@ paint_options_new (GimpToolInfo *tool_info)
{
GimpPaintOptions *options;
options = gimp_paint_options_new ();
options = gimp_paint_options_new (tool_info->context);
paint_options_init (options, tool_info);
......@@ -108,8 +108,6 @@ paint_options_init (GimpPaintOptions *options,
((GimpToolOptions *) options)->reset_func = paint_options_reset;
options->context = tool_info->context;
/* the main vbox */
vbox = options->tool_options.main_vbox;
......
......@@ -125,7 +125,7 @@ smudge_options_new (GimpToolInfo *tool_info)
GtkWidget *vbox;
GtkWidget *table;
options = gimp_smudge_options_new ();
options = gimp_smudge_options_new (tool_info->context);
paint_options_init ((GimpPaintOptions *) options, tool_info);
......
......@@ -368,7 +368,7 @@ clone_options_new (GimpToolInfo *tool_info)
GtkWidget *vbox;
GtkWidget *frame;
options = gimp_clone_options_new ();
options = gimp_clone_options_new (tool_info->context);
paint_options_init ((GimpPaintOptions *) options, tool_info);
......
......@@ -88,7 +88,7 @@ paint_options_new (GimpToolInfo *tool_info)
{
GimpPaintOptions *options;
options = gimp_paint_options_new ();
options = gimp_paint_options_new (tool_info->context);
paint_options_init (options, tool_info);
......@@ -108,8 +108,6 @@ paint_options_init (GimpPaintOptions *options,
((GimpToolOptions *) options)->reset_func = paint_options_reset;
options->context = tool_info->context;
/* the main vbox */
vbox = options->tool_options.main_vbox;
......
......@@ -72,7 +72,7 @@ HELP
vars => [ "GimpAirbrushOptions *options" ],
code => <<'CODE'
{
options = gimp_airbrush_options_new ();
options = gimp_airbrush_options_new (gimp_get_current_context (gimp));
options->pressure = pressure;
......@@ -111,7 +111,7 @@ HELP
vars => [ "GimpAirbrushOptions *options" ],
code => <<'CODE'
{
options = gimp_airbrush_options_new ();
options = gimp_airbrush_options_new (gimp_get_current_context (gimp));
success = paint_tools_stroke (gimp,
GIMP_TYPE_AIRBRUSH,
......@@ -162,7 +162,7 @@ HELP
vars => [ "GimpCloneOptions *options" ],
code => <<'CODE'
{
options = gimp_clone_options_new ();
options = gimp_clone_options_new (gimp_get_current_context (gimp));
options->type = clone_type;
......@@ -210,7 +210,7 @@ HELP
vars => [ "GimpCloneOptions *options" ],
code => <<'CODE'
{
options = gimp_clone_options_new ();
options = gimp_clone_options_new (gimp_get_current_context (gimp));
success = paint_tools_stroke (gimp,
GIMP_TYPE_CLONE,
......@@ -247,7 +247,7 @@ HELP
vars => [ "GimpConvolveOptions *options" ],
code => <<'CODE'
{
options = gimp_convolve_options_new ();
options = gimp_convolve_options_new (gimp_get_current_context (gimp));
success = paint_tools_stroke (gimp,