app/paint/gimpairbrush.c app/paint/gimpclone.c app/paint/gimpconvolve.c

2003-02-05  Michael Natterer  <mitch@gimp.org>

	* app/paint/gimpairbrush.c
	* app/paint/gimpclone.c
	* app/paint/gimpconvolve.c
	* app/paint/gimpdodgeburn.c
	* app/paint/gimperaser.c
	* app/paint/gimppaintbrush.c
	* app/paint/gimppencil.c
	* app/paint/gimpsmudge.c
	* app/tools/gimpblendoptions.c
	* app/tools/gimpblendtool.c
	* app/tools/gimpbucketfilltool.c
	* app/tools/gimpcolorpickertool.c
	* app/tools/gimpinktool.c
	* app/tools/gimppainttool.c
	* app/tools/paint_options.c: use GIMP_CONTEXT(tool_options)
	instead of gimp_get_current_context(). Cleanup.
This commit is contained in:
Michael Natterer 2003-02-05 16:59:04 +00:00 committed by Michael Natterer
parent af7db2a186
commit f8c7174bcb
20 changed files with 92 additions and 100 deletions

View File

@ -1,3 +1,22 @@
2003-02-05 Michael Natterer <mitch@gimp.org>
* app/paint/gimpairbrush.c
* app/paint/gimpclone.c
* app/paint/gimpconvolve.c
* app/paint/gimpdodgeburn.c
* app/paint/gimperaser.c
* app/paint/gimppaintbrush.c
* app/paint/gimppencil.c
* app/paint/gimpsmudge.c
* app/tools/gimpblendoptions.c
* app/tools/gimpblendtool.c
* app/tools/gimpbucketfilltool.c
* app/tools/gimpcolorpickertool.c
* app/tools/gimpinktool.c
* app/tools/gimppainttool.c
* app/tools/paint_options.c: use GIMP_CONTEXT(tool_options)
instead of gimp_get_current_context(). Cleanup.
2003-02-05 Michael Natterer <mitch@gimp.org>
* app/display/gimpdisplayshell-dnd.c: should have gone with my

View File

@ -30,7 +30,6 @@
#include "core/gimp.h"
#include "core/gimpbrush.h"
#include "core/gimpcontext.h"
#include "core/gimpdrawable.h"
#include "core/gimpgradient.h"
#include "core/gimpimage.h"
@ -221,7 +220,7 @@ gimp_airbrush_motion (GimpPaintCore *paint_core,
if (! (gimage = gimp_item_get_image (GIMP_ITEM (drawable))))
return;
context = gimp_get_current_context (gimage->gimp);
context = GIMP_CONTEXT (paint_options);
paint_appl_mode = (paint_options->incremental ?
GIMP_PAINT_INCREMENTAL : GIMP_PAINT_CONSTANT);
@ -296,7 +295,7 @@ gimp_airbrush_timeout (gpointer client_data)
gimp_image_flush (gimp_item_get_image (GIMP_ITEM (airbrush_timeout.drawable)));
rate = ((GimpAirbrushOptions *) airbrush_timeout.paint_options)->rate;
rate = GIMP_AIRBRUSH_OPTIONS (airbrush_timeout.paint_options)->rate;
/* restart the timer */
if (rate != 0.0)

View File

@ -32,7 +32,6 @@
#include "core/gimp.h"
#include "core/gimpbrush.h"
#include "core/gimpcontext.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "core/gimppattern.h"
@ -167,11 +166,9 @@ gimp_clone_paint (GimpPaintCore *paint_core,
GimpCloneOptions *options;
GimpContext *context;
clone = GIMP_CLONE (paint_core);
options = (GimpCloneOptions *) paint_options;
context = gimp_get_current_context (GIMP_ITEM (drawable)->gimage->gimp);
clone = GIMP_CLONE (paint_core);
options = GIMP_CLONE_OPTIONS (paint_options);
context = GIMP_CONTEXT (paint_options);
switch (paint_state)
{
@ -292,9 +289,9 @@ gimp_clone_motion (GimpPaintCore *paint_core,
gint offset_x;
gint offset_y;
clone = GIMP_CLONE (paint_core);
options = (GimpCloneOptions *) paint_options;
clone = GIMP_CLONE (paint_core);
options = GIMP_CLONE_OPTIONS (paint_options);
context = GIMP_CONTEXT (paint_options);
pressure_options = paint_options->pressure_options;
@ -319,8 +316,6 @@ gimp_clone_motion (GimpPaintCore *paint_core,
if (! (gimage = gimp_item_get_image (GIMP_ITEM (drawable))))
return;
context = gimp_get_current_context (gimage->gimp);
if (pressure_options->size)
scale = paint_core->cur_coords.pressure;
else

View File

@ -29,7 +29,6 @@
#include "core/gimp.h"
#include "core/gimpbrush.h"
#include "core/gimpcontext.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
@ -187,6 +186,7 @@ gimp_convolve_motion (GimpPaintCore *paint_core,
{
GimpConvolveOptions *options;
GimpPressureOptions *pressure_options;
GimpContext *context;
TempBuf *area;
guchar *temp_data;
PixelRegion srcPR;
@ -196,9 +196,9 @@ gimp_convolve_motion (GimpPaintCore *paint_core,
ConvolveClipType area_vclip = CONVOLVE_NOT_CLIPPED;
gint marginx = 0;
gint marginy = 0;
GimpContext *context;
options = (GimpConvolveOptions *) paint_options;
options = GIMP_CONVOLVE_OPTIONS (paint_options);
context = GIMP_CONTEXT (paint_options);
pressure_options = paint_options->pressure_options;
@ -404,9 +404,6 @@ gimp_convolve_motion (GimpPaintCore *paint_core,
g_free(fillcolor);
}
context =
gimp_get_current_context (gimp_item_get_image (GIMP_ITEM (drawable))->gimp);
/* paste the newly painted canvas to the gimage which is being worked on */
gimp_paint_core_replace_canvas (paint_core, drawable,
GIMP_OPACITY_OPAQUE,

View File

@ -32,7 +32,6 @@
#include "core/gimp.h"
#include "core/gimpdrawable.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "gimpdodgeburn.h"
@ -200,6 +199,7 @@ gimp_dodge_burn_motion (GimpPaintCore *paint_core,
{
GimpDodgeBurn *dodgeburn;
GimpDodgeBurnOptions *options;
GimpContext *context;
GimpPressureOptions *pressure_options;
GimpImage *gimage;
TempBuf *area;
@ -211,6 +211,7 @@ gimp_dodge_burn_motion (GimpPaintCore *paint_core,
dodgeburn = GIMP_DODGE_BURN (paint_core);
options = GIMP_DODGE_BURN_OPTIONS (paint_options);
context = GIMP_CONTEXT (paint_options);
pressure_options = paint_options->pressure_options;
@ -287,7 +288,7 @@ gimp_dodge_burn_motion (GimpPaintCore *paint_core,
else
copy_region (&tempPR, &destPR);
opacity = gimp_context_get_opacity (gimp_get_current_context (gimage->gimp));
opacity = gimp_context_get_opacity (context);
if (pressure_options->opacity)
opacity = opacity * 2.0 * paint_core->cur_coords.pressure;

View File

@ -29,7 +29,6 @@
#include "paint-funcs/paint-funcs.h"
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
@ -134,8 +133,8 @@ gimp_eraser_motion (GimpPaintCore *paint_core,
{
GimpEraserOptions *options;
GimpPressureOptions *pressure_options;
GimpImage *gimage;
GimpContext *context;
GimpImage *gimage;
gdouble opacity;
TempBuf *area;
guchar col[MAX_CHANNELS];
@ -146,14 +145,13 @@ gimp_eraser_motion (GimpPaintCore *paint_core,
if (! (gimage = gimp_item_get_image (GIMP_ITEM (drawable))))
return;
options = (GimpEraserOptions *) paint_options;
options = GIMP_ERASER_OPTIONS (paint_options);
context = GIMP_CONTEXT (paint_options);
pressure_options = paint_options->pressure_options;
gimp_image_get_background (gimage, drawable, col);
context = gimp_get_current_context (gimage->gimp);
paint_appl_mode = (paint_options->incremental ?
GIMP_PAINT_INCREMENTAL : GIMP_PAINT_CONSTANT);

View File

@ -35,7 +35,6 @@
#include "paint-funcs/paint-funcs.h"
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
@ -947,7 +946,7 @@ ink_paste (GimpInkTool *ink_tool,
if (! (gimage = gimp_item_get_image (GIMP_ITEM (drawable))))
return;
context = gimp_get_current_context (gimage->gimp);
context = GIMP_CONTEXT (GIMP_TOOL (ink_tool)->tool_info->tool_options);
/* Get the the buffer */
ink_set_paint_area (ink_tool, drawable, blob);

View File

@ -32,7 +32,6 @@
#include "core/gimp.h"
#include "core/gimpbrush.h"
#include "core/gimpcontext.h"
#include "core/gimpdrawable.h"
#include "core/gimpgradient.h"
#include "core/gimpimage.h"
@ -137,8 +136,8 @@ gimp_paintbrush_motion (GimpPaintCore *paint_core,
{
GimpPressureOptions *pressure_options;
GimpGradientOptions *gradient_options;
GimpImage *gimage;
GimpContext *context;
GimpImage *gimage;
TempBuf *area;
gdouble gradient_length;
guchar local_blend = OPAQUE_OPACITY;
@ -150,11 +149,11 @@ gimp_paintbrush_motion (GimpPaintCore *paint_core,
if (! (gimage = gimp_item_get_image (GIMP_ITEM (drawable))))
return;
context = GIMP_CONTEXT (paint_options);
pressure_options = paint_options->pressure_options;
gradient_options = paint_options->gradient_options;
context = gimp_get_current_context (gimage->gimp);
paint_appl_mode = (paint_options->incremental ?
GIMP_PAINT_INCREMENTAL : GIMP_PAINT_CONSTANT);

View File

@ -30,7 +30,6 @@
#include "core/gimp.h"
#include "core/gimpbrush.h"
#include "core/gimpcontext.h"
#include "core/gimpdrawable.h"
#include "core/gimpgradient.h"
#include "core/gimpimage.h"
@ -135,20 +134,20 @@ gimp_pencil_motion (GimpPaintCore *paint_core,
GimpPaintOptions *paint_options)
{
GimpPressureOptions *pressure_options;
GimpImage *gimage;
GimpContext *context;
GimpImage *gimage;
TempBuf *area;
guchar col[MAX_CHANNELS];
gdouble opacity;
gdouble scale;
GimpPaintApplicationMode paint_appl_mode;
context = GIMP_CONTEXT (paint_options);
pressure_options = paint_options->pressure_options;
gimage = gimp_item_get_image (GIMP_ITEM (drawable));
context = gimp_get_current_context (gimage->gimp);
paint_appl_mode = (paint_options->incremental ?
GIMP_PAINT_INCREMENTAL : GIMP_PAINT_CONSTANT);

View File

@ -31,7 +31,6 @@
#include "core/gimp.h"
#include "core/gimpbrush.h"
#include "core/gimpcontext.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
@ -278,24 +277,22 @@ gimp_smudge_motion (GimpPaintCore *paint_core,
GimpSmudge *smudge;
GimpSmudgeOptions *options;
GimpPressureOptions *pressure_options;
GimpImage *gimage;
GimpContext *context;
GimpImage *gimage;
TempBuf *area;
PixelRegion srcPR, destPR, tempPR;
gdouble rate;
gdouble opacity;
gint x, y, w, h;
smudge = GIMP_SMUDGE (paint_core);
options = (GimpSmudgeOptions *) paint_options;
smudge = GIMP_SMUDGE (paint_core);
options = GIMP_SMUDGE_OPTIONS (paint_options);
context = GIMP_CONTEXT (paint_options);
pressure_options = paint_options->pressure_options;
gimage = gimp_item_get_image (GIMP_ITEM (drawable));
context = gimp_get_current_context (gimage->gimp);
/* If the image type is indexed, don't smudge */
if (gimp_drawable_is_indexed (drawable))
return;

View File

@ -32,7 +32,6 @@
#include "core/gimp.h"
#include "core/gimpbrush.h"
#include "core/gimpcontext.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "core/gimppattern.h"
@ -167,11 +166,9 @@ gimp_clone_paint (GimpPaintCore *paint_core,
GimpCloneOptions *options;
GimpContext *context;
clone = GIMP_CLONE (paint_core);
options = (GimpCloneOptions *) paint_options;
context = gimp_get_current_context (GIMP_ITEM (drawable)->gimage->gimp);
clone = GIMP_CLONE (paint_core);
options = GIMP_CLONE_OPTIONS (paint_options);
context = GIMP_CONTEXT (paint_options);
switch (paint_state)
{
@ -292,9 +289,9 @@ gimp_clone_motion (GimpPaintCore *paint_core,
gint offset_x;
gint offset_y;
clone = GIMP_CLONE (paint_core);
options = (GimpCloneOptions *) paint_options;
clone = GIMP_CLONE (paint_core);
options = GIMP_CLONE_OPTIONS (paint_options);
context = GIMP_CONTEXT (paint_options);
pressure_options = paint_options->pressure_options;
@ -319,8 +316,6 @@ gimp_clone_motion (GimpPaintCore *paint_core,
if (! (gimage = gimp_item_get_image (GIMP_ITEM (drawable))))
return;
context = gimp_get_current_context (gimage->gimp);
if (pressure_options->size)
scale = paint_core->cur_coords.pressure;
else

View File

@ -333,8 +333,9 @@ blend_options_drop_tool (GtkWidget *widget,
GimpToolOptions *tool_options;
GimpContext *context;
tool_options = (GimpToolOptions *) data;
tool_options = GIMP_TOOL_OPTIONS (data);
/* use the user context to switch tools */
context = gimp_get_user_context (tool_options->tool_info->gimp);
gimp_context_set_tool (context, GIMP_TOOL_INFO (viewable));

View File

@ -28,7 +28,6 @@
#include "tools-types.h"
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimpdrawable.h"
#include "core/gimpdrawable-blend.h"
#include "core/gimpgradient.h"
@ -220,11 +219,13 @@ gimp_blend_tool_button_release (GimpTool *tool,
{
GimpBlendTool *blend_tool;
GimpBlendOptions *options;
GimpContext *context;
GimpImage *gimage;
GimpProgress *progress;
blend_tool = GIMP_BLEND_TOOL (tool);
options = GIMP_BLEND_OPTIONS (tool->tool_info->tool_options);
context = GIMP_CONTEXT (options);
gimage = gdisp->gimage;
@ -244,9 +245,9 @@ gimp_blend_tool_button_release (GimpTool *tool,
gimp_drawable_blend (gimp_image_active_drawable (gimage),
GIMP_CUSTOM_MODE,
gimp_context_get_paint_mode (gimp_get_current_context (gimage->gimp)),
gimp_context_get_paint_mode (context),
options->gradient_type,
gimp_context_get_opacity (gimp_get_current_context (gimage->gimp)),
gimp_context_get_opacity (context),
options->offset,
options->repeat,
options->supersample,

View File

@ -29,7 +29,6 @@
#include "tools-types.h"
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "core/gimpimage-pick-color.h"

View File

@ -190,17 +190,15 @@ gimp_bucket_fill_tool_button_release (GimpTool *tool,
{
GimpBucketFillTool *bucket_tool;
GimpBucketFillOptions *options;
GimpContext *context;
bucket_tool = GIMP_BUCKET_FILL_TOOL (tool);
options = GIMP_BUCKET_FILL_OPTIONS (tool->tool_info->tool_options);
context = GIMP_CONTEXT (options);
/* if the 3rd button isn't pressed, fill the selected region */
if (! (state & GDK_BUTTON3_MASK))
{
GimpContext *context;
context = gimp_get_current_context (gdisp->gimage->gimp);
gimp_drawable_bucket_fill (gimp_image_active_drawable (gdisp->gimage),
options->fill_mode,
gimp_context_get_paint_mode (context),

View File

@ -31,7 +31,6 @@
#include "gui/gui-types.h"
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "core/gimpimage-pick-color.h"

View File

@ -35,7 +35,6 @@
#include "paint-funcs/paint-funcs.h"
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
@ -947,7 +946,7 @@ ink_paste (GimpInkTool *ink_tool,
if (! (gimage = gimp_item_get_image (GIMP_ITEM (drawable))))
return;
context = gimp_get_current_context (gimage->gimp);
context = GIMP_CONTEXT (GIMP_TOOL (ink_tool)->tool_info->tool_options);
/* Get the the buffer */
ink_set_paint_area (ink_tool, drawable, blob);

View File

@ -26,7 +26,6 @@
#include "tools-types.h"
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimptoolinfo.h"
#include "paint/gimppaintoptions.h"
@ -87,11 +86,13 @@ void
gimp_paint_options_gui (GimpToolOptions *tool_options)
{
GimpPaintOptions *options;
GimpContext *context;
GtkWidget *vbox;
GtkWidget *table;
GtkWidget *mode_label;
options = GIMP_PAINT_OPTIONS (tool_options);
context = GIMP_CONTEXT (tool_options);
tool_options->reset_func = gimp_paint_options_reset;
@ -108,7 +109,7 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
options->opacity_w =
gimp_scale_entry_new (GTK_TABLE (table), 0, 0,
_("Opacity:"), -1, -1,
gimp_context_get_opacity (GIMP_CONTEXT (options)) * 100,
gimp_context_get_opacity (context) * 100,
0.0, 100.0, 1.0, 10.0, 1,
TRUE, 0.0, 0.0,
NULL, NULL);
@ -126,7 +127,7 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
gimp_paint_mode_menu_new (G_CALLBACK (paint_options_paint_mode_update),
options,
TRUE,
gimp_context_get_paint_mode (GIMP_CONTEXT (options)));
gimp_context_get_paint_mode (context));
mode_label = gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
_("Mode:"), 1.0, 0.5,
options->paint_mode_w, 2, TRUE);
@ -153,7 +154,7 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
GtkWidget *button;
GtkWidget *preview;
brush = gimp_context_get_brush (GIMP_CONTEXT (options));
brush = gimp_context_get_brush (context);
button = gtk_button_new ();
preview = gimp_preview_new_full (GIMP_VIEWABLE (brush),
@ -239,27 +240,25 @@ void
gimp_paint_options_reset (GimpToolOptions *tool_options)
{
GimpPaintOptions *options;
GimpContext *context;
GimpContext *default_context;
options = GIMP_PAINT_OPTIONS (tool_options);
context = GIMP_CONTEXT (tool_options);
default_context = gimp_get_default_context (tool_options->tool_info->gimp);
if (options->opacity_w)
{
gimp_context_set_opacity (GIMP_CONTEXT (options),
gimp_context_get_opacity (default_context));
}
gimp_context_set_opacity (context,
gimp_context_get_opacity (default_context));
if (options->paint_mode_w)
{
gimp_context_set_paint_mode (GIMP_CONTEXT (options),
gimp_context_get_paint_mode (default_context));
}
gimp_context_set_paint_mode (context,
gimp_context_get_paint_mode (default_context));
if (options->incremental_w)
{
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->incremental_w),
options->incremental_d);
}
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->incremental_w),
options->incremental_d);
pressure_options_reset (options->pressure_options);
gradient_options_reset (options->gradient_options);

View File

@ -29,7 +29,6 @@
#include "tools-types.h"
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "core/gimpimage-pick-color.h"

View File

@ -26,7 +26,6 @@
#include "tools-types.h"
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimptoolinfo.h"
#include "paint/gimppaintoptions.h"
@ -87,11 +86,13 @@ void
gimp_paint_options_gui (GimpToolOptions *tool_options)
{
GimpPaintOptions *options;
GimpContext *context;
GtkWidget *vbox;
GtkWidget *table;
GtkWidget *mode_label;
options = GIMP_PAINT_OPTIONS (tool_options);
context = GIMP_CONTEXT (tool_options);
tool_options->reset_func = gimp_paint_options_reset;
@ -108,7 +109,7 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
options->opacity_w =
gimp_scale_entry_new (GTK_TABLE (table), 0, 0,
_("Opacity:"), -1, -1,
gimp_context_get_opacity (GIMP_CONTEXT (options)) * 100,
gimp_context_get_opacity (context) * 100,
0.0, 100.0, 1.0, 10.0, 1,
TRUE, 0.0, 0.0,
NULL, NULL);
@ -126,7 +127,7 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
gimp_paint_mode_menu_new (G_CALLBACK (paint_options_paint_mode_update),
options,
TRUE,
gimp_context_get_paint_mode (GIMP_CONTEXT (options)));
gimp_context_get_paint_mode (context));
mode_label = gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
_("Mode:"), 1.0, 0.5,
options->paint_mode_w, 2, TRUE);
@ -153,7 +154,7 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
GtkWidget *button;
GtkWidget *preview;
brush = gimp_context_get_brush (GIMP_CONTEXT (options));
brush = gimp_context_get_brush (context);
button = gtk_button_new ();
preview = gimp_preview_new_full (GIMP_VIEWABLE (brush),
@ -239,27 +240,25 @@ void
gimp_paint_options_reset (GimpToolOptions *tool_options)
{
GimpPaintOptions *options;
GimpContext *context;
GimpContext *default_context;
options = GIMP_PAINT_OPTIONS (tool_options);
context = GIMP_CONTEXT (tool_options);
default_context = gimp_get_default_context (tool_options->tool_info->gimp);
if (options->opacity_w)
{
gimp_context_set_opacity (GIMP_CONTEXT (options),
gimp_context_get_opacity (default_context));
}
gimp_context_set_opacity (context,
gimp_context_get_opacity (default_context));
if (options->paint_mode_w)
{
gimp_context_set_paint_mode (GIMP_CONTEXT (options),
gimp_context_get_paint_mode (default_context));
}
gimp_context_set_paint_mode (context,
gimp_context_get_paint_mode (default_context));
if (options->incremental_w)
{
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->incremental_w),
options->incremental_d);
}
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->incremental_w),
options->incremental_d);
pressure_options_reset (options->pressure_options);
gradient_options_reset (options->gradient_options);