Commit 18d9161e authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

Get rid of the "current_context" which was in fact just a bunch of global

2004-04-15  Michael Natterer  <mitch@gimp.org>

	Get rid of the "current_context" which was in fact just a bunch of
	global variables. Instead, pass the needed context all the way
	from the GUI and the PDB to the core. This is a prerequisite for
	macro recording and generally helps separating the various
	subsystems from each other. Work in progress...

	* app/core/gimp.[ch]: removed member "current_context" and
	gimp_[get|set]_current_context().

	* app/core/gimp-edit.[ch]
	* app/core/gimpdrawable-blend.[ch]
	* app/core/gimpdrawable-bucket-fill.[ch]
	* app/core/gimpdrawable-offset.[ch]
	* app/core/gimpdrawable-transform.[ch]
	* app/core/gimpimage-crop.[ch]
	* app/core/gimpimage-flip.[ch]
	* app/core/gimpimage-merge.[ch]
	* app/core/gimpimage-resize.[ch]
	* app/core/gimpimage-rotate.[ch]
	* app/core/gimpimage.[ch]
	* app/core/gimpimagefile.[ch]
	* app/core/gimpitem-linked.[ch]
	* app/core/gimpitem.[ch]
	* app/core/gimplayer.[ch]
	* app/core/gimpselection.[ch]
	* app/core/gimptemplate.[ch]
	* app/file/file-open.[ch]
	* app/file/file-save.[ch]
	* app/pdb/procedural_db.[ch]
	* app/text/gimptext-compat.[ch]
	* app/text/gimptextlayer-transform.[ch]
	* app/gui/brush-select.[ch]
	* app/gui/font-select.[ch]
	* app/gui/gradient-select.[ch]
	* app/gui/palette-select.[ch]
	* app/gui/pattern-select.[ch]: added tons of "GimpContext *context"
	parameters and use the passed context instead of
	gimp_get_current_context().

	* app/app_procs.c
	* app/batch.c
	* app/core/gimpchannel.c
	* app/core/gimpdrawable.c
	* app/paint/gimperaser.c
	* app/paint/gimppaintbrush.c
	* app/plug-in/plug-in-message.c
	* app/plug-in/plug-ins.c
	* app/text/gimptextlayer.c
	* app/tools/gimpblendtool.c
	* app/tools/gimpbucketfilltool.c
	* app/tools/gimpcroptool.c
	* app/tools/gimpeditselectiontool.c
	* app/tools/gimpfliptool.c
	* app/tools/gimpinktool.c
	* app/tools/gimptransformtool.c
	* app/vectors/gimpvectors.c
	* app/gui/convert-dialog.c
	* app/gui/drawable-commands.c
	* app/gui/edit-commands.c
	* app/gui/file-commands.c
	* app/gui/file-new-dialog.c
	* app/gui/file-open-dialog.c
	* app/gui/file-save-dialog.c
	* app/gui/image-commands.c
	* app/gui/layers-commands.c
	* app/gui/offset-dialog.c
	* app/gui/select-commands.c
	* app/gui/vectors-commands.c
	* app/widgets/gimpdnd.c
	* app/widgets/gimpdocumentview.c
	* app/widgets/gimphelp.c
	* app/widgets/gimpthumbbox.c: pass gimp_get_user_context() or
	GIMP_CONTEXT(tool_options) or whatever is the right context
	to the changed core functions.

	* tools/pdbgen/app.pl: pass "GimpContext *context" to all
	generated PDB invokers.

	* tools/pdbgen/pdb/brush_select.pdb
	* tools/pdbgen/pdb/brushes.pdb
	* tools/pdbgen/pdb/drawable.pdb
	* tools/pdbgen/pdb/edit.pdb
	* tools/pdbgen/pdb/font_select.pdb
	* tools/pdbgen/pdb/gradient_select.pdb
	* tools/pdbgen/pdb/gradients.pdb
	* tools/pdbgen/pdb/image.pdb
	* tools/pdbgen/pdb/layer.pdb
	* tools/pdbgen/pdb/paint_tools.pdb
	* tools/pdbgen/pdb/palette.pdb
	* tools/pdbgen/pdb/palette_select.pdb
	* tools/pdbgen/pdb/palettes.pdb
	* tools/pdbgen/pdb/paths.pdb
	* tools/pdbgen/pdb/pattern_select.pdb
	* tools/pdbgen/pdb/patterns.pdb
	* tools/pdbgen/pdb/selection.pdb
	* tools/pdbgen/pdb/text_tool.pdb
	* tools/pdbgen/pdb/transform_tools.pdb: pass the new context
	parameter to the changed core functions.

	* app/pdb/*_cmds.c: regenerated.
parent ab5ffbb5
2004-04-15 Michael Natterer <mitch@gimp.org>
Get rid of the "current_context" which was in fact just a bunch of
global variables. Instead, pass the needed context all the way
from the GUI and the PDB to the core. This is a prerequisite for
macro recording and generally helps separating the various
subsystems from each other. Work in progress...
* app/core/gimp.[ch]: removed member "current_context" and
gimp_[get|set]_current_context().
* app/core/gimp-edit.[ch]
* app/core/gimpdrawable-blend.[ch]
* app/core/gimpdrawable-bucket-fill.[ch]
* app/core/gimpdrawable-offset.[ch]
* app/core/gimpdrawable-transform.[ch]
* app/core/gimpimage-crop.[ch]
* app/core/gimpimage-flip.[ch]
* app/core/gimpimage-merge.[ch]
* app/core/gimpimage-resize.[ch]
* app/core/gimpimage-rotate.[ch]
* app/core/gimpimage.[ch]
* app/core/gimpimagefile.[ch]
* app/core/gimpitem-linked.[ch]
* app/core/gimpitem.[ch]
* app/core/gimplayer.[ch]
* app/core/gimpselection.[ch]
* app/core/gimptemplate.[ch]
* app/file/file-open.[ch]
* app/file/file-save.[ch]
* app/pdb/procedural_db.[ch]
* app/text/gimptext-compat.[ch]
* app/text/gimptextlayer-transform.[ch]
* app/gui/brush-select.[ch]
* app/gui/font-select.[ch]
* app/gui/gradient-select.[ch]
* app/gui/palette-select.[ch]
* app/gui/pattern-select.[ch]: added tons of "GimpContext *context"
parameters and use the passed context instead of
gimp_get_current_context().
* app/app_procs.c
* app/batch.c
* app/core/gimpchannel.c
* app/core/gimpdrawable.c
* app/paint/gimperaser.c
* app/paint/gimppaintbrush.c
* app/plug-in/plug-in-message.c
* app/plug-in/plug-ins.c
* app/text/gimptextlayer.c
* app/tools/gimpblendtool.c
* app/tools/gimpbucketfilltool.c
* app/tools/gimpcroptool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpfliptool.c
* app/tools/gimpinktool.c
* app/tools/gimptransformtool.c
* app/vectors/gimpvectors.c
* app/gui/convert-dialog.c
* app/gui/drawable-commands.c
* app/gui/edit-commands.c
* app/gui/file-commands.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.c
* app/gui/file-save-dialog.c
* app/gui/image-commands.c
* app/gui/layers-commands.c
* app/gui/offset-dialog.c
* app/gui/select-commands.c
* app/gui/vectors-commands.c
* app/widgets/gimpdnd.c
* app/widgets/gimpdocumentview.c
* app/widgets/gimphelp.c
* app/widgets/gimpthumbbox.c: pass gimp_get_user_context() or
GIMP_CONTEXT(tool_options) or whatever is the right context
to the changed core functions.
* tools/pdbgen/app.pl: pass "GimpContext *context" to all
generated PDB invokers.
* tools/pdbgen/pdb/brush_select.pdb
* tools/pdbgen/pdb/brushes.pdb
* tools/pdbgen/pdb/drawable.pdb
* tools/pdbgen/pdb/edit.pdb
* tools/pdbgen/pdb/font_select.pdb
* tools/pdbgen/pdb/gradient_select.pdb
* tools/pdbgen/pdb/gradients.pdb
* tools/pdbgen/pdb/image.pdb
* tools/pdbgen/pdb/layer.pdb
* tools/pdbgen/pdb/paint_tools.pdb
* tools/pdbgen/pdb/palette.pdb
* tools/pdbgen/pdb/palette_select.pdb
* tools/pdbgen/pdb/palettes.pdb
* tools/pdbgen/pdb/paths.pdb
* tools/pdbgen/pdb/pattern_select.pdb
* tools/pdbgen/pdb/patterns.pdb
* tools/pdbgen/pdb/selection.pdb
* tools/pdbgen/pdb/text_tool.pdb
* tools/pdbgen/pdb/transform_tools.pdb: pass the new context
parameter to the changed core functions.
* app/pdb/*_cmds.c: regenerated.
2004-04-14 Raphaël Quinet <quinet@gamers.org>
* plug-ins/script-fu/scripts/copy-visible.scm: New version of the
......
......@@ -133,6 +133,7 @@ drawable_flip_cmd_callback (GtkWidget *widget,
GimpImage *gimage;
GimpDrawable *active_drawable;
GimpItem *item;
GimpContext *context;
gint off_x, off_y;
gdouble axis = 0.0;
return_if_no_drawable (gimage, active_drawable, data);
......@@ -155,15 +156,18 @@ drawable_flip_cmd_callback (GtkWidget *widget,
break;
}
context = gimp_get_user_context (gimage->gimp);
if (gimp_item_get_linked (item))
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_TRANSFORM,
_("Flip Layer"));
gimp_item_flip (item, (GimpOrientationType) action, axis, FALSE);
gimp_item_flip (item, context, (GimpOrientationType) action, axis, FALSE);
if (gimp_item_get_linked (item))
{
gimp_item_linked_flip (item, (GimpOrientationType) action, axis, FALSE);
gimp_item_linked_flip (item, context, (GimpOrientationType) action, axis,
FALSE);
gimp_image_undo_group_end (gimage);
}
......@@ -178,6 +182,7 @@ drawable_rotate_cmd_callback (GtkWidget *widget,
GimpImage *gimage;
GimpDrawable *active_drawable;
GimpItem *item;
GimpContext *context;
gint off_x, off_y;
gdouble center_x, center_y;
return_if_no_drawable (gimage, active_drawable, data);
......@@ -189,15 +194,18 @@ drawable_rotate_cmd_callback (GtkWidget *widget,
center_x = ((gdouble) off_x + (gdouble) gimp_item_width (item) / 2.0);
center_y = ((gdouble) off_y + (gdouble) gimp_item_height (item) / 2.0);
context = gimp_get_user_context (gimage->gimp);
if (gimp_item_get_linked (item))
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_TRANSFORM,
_("Rotate Layer"));
gimp_item_rotate (item, (GimpRotationType) action, center_x, center_y, FALSE);
gimp_item_rotate (item, context, (GimpRotationType) action,
center_x, center_y, FALSE);
if (gimp_item_get_linked (item))
{
gimp_item_linked_rotate (item, (GimpRotationType) action,
gimp_item_linked_rotate (item, context, (GimpRotationType) action,
center_x, center_y, FALSE);
gimp_image_undo_group_end (gimage);
}
......@@ -210,8 +218,8 @@ drawable_offset_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpDrawable *active_drawable;
return_if_no_drawable (gimage, active_drawable, data);
GimpDrawable *drawable;
return_if_no_drawable (gimage, drawable, data);
offset_dialog_create (active_drawable, widget);
offset_dialog_create (drawable, widget);
}
......@@ -124,7 +124,7 @@ edit_cut_cmd_callback (GtkWidget *widget,
GimpDrawable *drawable;
return_if_no_drawable (gimage, drawable, data);
if (gimp_edit_cut (gimage, drawable))
if (gimp_edit_cut (gimage, drawable, gimp_get_user_context (gimage->gimp)))
gimp_image_flush (gimage);
}
......@@ -136,7 +136,7 @@ edit_copy_cmd_callback (GtkWidget *widget,
GimpDrawable *drawable;
return_if_no_drawable (gimage, drawable, data);
if (gimp_edit_copy (gimage, drawable))
if (gimp_edit_copy (gimage, drawable, gimp_get_user_context (gimage->gimp)))
gimp_image_flush (gimage);
}
......@@ -240,7 +240,7 @@ edit_clear_cmd_callback (GtkWidget *widget,
GimpDrawable *drawable;
return_if_no_drawable (gimage, drawable, data);
gimp_edit_clear (gimage, drawable);
gimp_edit_clear (gimage, drawable, gimp_get_user_context (gimage->gimp));
gimp_image_flush (gimage);
}
......@@ -256,7 +256,8 @@ edit_fill_cmd_callback (GtkWidget *widget,
fill_type = (GimpFillType) action;
gimp_edit_fill (gimage, drawable, fill_type);
gimp_edit_fill (gimage, drawable, gimp_get_user_context (gimage->gimp),
fill_type);
gimp_image_flush (gimage);
}
......@@ -317,7 +318,8 @@ cut_named_buffer_callback (GtkWidget *widget,
return;
}
cut_buffer = gimp_edit_cut (gimage, active_drawable);
cut_buffer = gimp_edit_cut (gimage, active_drawable,
gimp_get_user_context (gimage->gimp));
if (cut_buffer)
{
......@@ -353,7 +355,8 @@ copy_named_buffer_callback (GtkWidget *widget,
return;
}
copy_buffer = gimp_edit_copy (gimage, active_drawable);
copy_buffer = gimp_edit_copy (gimage, active_drawable,
gimp_get_user_context (gimage->gimp));
if (copy_buffer)
{
......
......@@ -175,7 +175,8 @@ file_last_opened_cmd_callback (GtkWidget *widget,
GimpPDBStatusType status;
GError *error = NULL;
gimage = file_open_with_display (gimp, GIMP_OBJECT (imagefile)->name,
gimage = file_open_with_display (gimp, gimp_get_user_context (gimp),
GIMP_OBJECT (imagefile)->name,
&status, &error);
if (! gimage && status != GIMP_PDB_CANCEL)
......@@ -221,7 +222,9 @@ file_save_cmd_callback (GtkWidget *widget,
GimpPDBStatusType status;
GError *error = NULL;
status = file_save (gdisp->gimage, GIMP_RUN_WITH_LAST_VALS, &error);
status = file_save (gdisp->gimage,
gimp_get_user_context (gdisp->gimage->gimp),
GIMP_RUN_WITH_LAST_VALS, &error);
if (status != GIMP_PDB_SUCCESS &&
status != GIMP_PDB_CANCEL)
......@@ -422,7 +425,8 @@ file_revert_confirm_callback (GtkWidget *widget,
uri = gimp_object_get_name (GIMP_OBJECT (old_gimage));
new_gimage = file_open_image (gimp, uri, uri, NULL,
new_gimage = file_open_image (gimp, gimp_get_user_context (gimp),
uri, uri, NULL,
GIMP_RUN_INTERACTIVE,
&status, &error);
......
......@@ -228,7 +228,8 @@ image_flip_cmd_callback (GtkWidget *widget,
progress = gimp_progress_start (gdisp, _("Flipping..."), TRUE, NULL, NULL);
gimp_image_flip (gdisp->gimage, (GimpOrientationType) action,
gimp_image_flip (gdisp->gimage, gimp_get_user_context (gdisp->gimage->gimp),
(GimpOrientationType) action,
gimp_progress_update_and_flush, progress);
gimp_progress_end (progress);
......@@ -247,7 +248,8 @@ image_rotate_cmd_callback (GtkWidget *widget,
progress = gimp_progress_start (gdisp, _("Rotating..."), TRUE, NULL, NULL);
gimp_image_rotate (gdisp->gimage, (GimpRotationType) action,
gimp_image_rotate (gdisp->gimage, gimp_get_user_context (gdisp->gimage->gimp),
(GimpRotationType) action,
gimp_progress_update_and_flush, progress);
gimp_progress_end (progress);
......@@ -270,7 +272,8 @@ image_crop_cmd_callback (GtkWidget *widget,
return;
}
gimp_image_crop (gdisp->gimage, x1, y1, x2, y2, FALSE, TRUE);
gimp_image_crop (gdisp->gimage, gimp_get_user_context (gdisp->gimage->gimp),
x1, y1, x2, y2, FALSE, TRUE);
gimp_image_flush (gdisp->gimage);
}
......@@ -306,7 +309,7 @@ image_flatten_image_cmd_callback (GtkWidget *widget,
GimpImage *gimage;
return_if_no_image (gimage, data);
gimp_image_flatten (gimage);
gimp_image_flatten (gimage, gimp_get_user_context (gimage->gimp));
gimp_image_flush (gimage);
}
......@@ -366,7 +369,9 @@ image_layers_merge_query_response (GtkWidget *widget,
if (response_id == GTK_RESPONSE_OK)
{
if (options->merge_visible)
gimp_image_merge_visible_layers (gimage, options->merge_type);
gimp_image_merge_visible_layers (gimage,
gimp_get_user_context (gimage->gimp),
options->merge_type);
gimp_image_flush (gimage);
}
......@@ -471,6 +476,7 @@ image_resize_callback (GtkWidget *widget,
TRUE, NULL, NULL);
gimp_image_resize (image_resize->gimage,
gimp_get_user_context (image_resize->gimage->gimp),
image_resize->resize->width,
image_resize->resize->height,
image_resize->resize->offset_x,
......
......@@ -290,7 +290,9 @@ layers_merge_down_cmd_callback (GtkWidget *widget,
GimpLayer *active_layer;
return_if_no_layer (gimage, active_layer, data);
gimp_image_merge_down (gimage, active_layer, GIMP_EXPAND_AS_NECESSARY);
gimp_image_merge_down (gimage, active_layer,
gimp_get_user_context (gimage->gimp),
GIMP_EXPAND_AS_NECESSARY);
gimp_image_flush (gimage);
}
......@@ -341,7 +343,8 @@ layers_resize_to_image_cmd_callback (GtkWidget *widget,
GimpLayer *active_layer;
return_if_no_layer (gimage, active_layer, data);
gimp_layer_resize_to_image (active_layer);
gimp_layer_resize_to_image (active_layer,
gimp_get_user_context (gimage->gimp));
gimp_image_flush (gimage);
}
......@@ -382,7 +385,9 @@ layers_crop_cmd_callback (GtkWidget *widget,
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_ITEM_RESIZE,
_("Crop Layer"));
gimp_item_resize (GIMP_ITEM (active_layer), x2 - x1, y2 - y1, off_x, off_y);
gimp_item_resize (GIMP_ITEM (active_layer),
gimp_get_user_context (gimage->gimp),
x2 - x1, y2 - y1, off_x, off_y);
gimp_image_undo_group_end (gimage);
......@@ -510,7 +515,7 @@ layers_flatten_image_cmd_callback (GtkWidget *widget,
GimpImage *gimage;
return_if_no_image (gimage, data);
gimp_image_flatten (gimage);
gimp_image_flatten (gimage, gimp_get_user_context (gimage->gimp));
gimp_image_flush (gimage);
}
......@@ -566,7 +571,7 @@ layers_text_tool (GimpLayer *layer,
if (GIMP_IS_TOOL_INFO (tool_info))
{
gimp_context_set_tool (gimp_get_current_context (gimage->gimp),
gimp_context_set_tool (gimp_get_user_context (gimage->gimp),
tool_info);
active_tool = tool_manager_get_active (gimage->gimp);
......@@ -1250,6 +1255,7 @@ resize_layer_query_ok_callback (GtkWidget *widget,
gtk_widget_set_sensitive (options->resize->resize_shell, FALSE);
gimp_item_resize (GIMP_ITEM (layer),
gimp_get_user_context (gimage->gimp),
options->resize->width,
options->resize->height,
options->resize->offset_x,
......
......@@ -162,6 +162,7 @@ select_float_cmd_callback (GtkWidget *widget,
gimp_selection_float (gimp_image_get_mask (gimage),
gimp_image_active_drawable (gimage),
gimp_get_user_context (gimage->gimp),
TRUE, 0, 0);
gimp_image_flush (gimage);
}
......
......@@ -366,7 +366,7 @@ vectors_vectors_tool (GimpVectors *vectors)
if (GIMP_IS_TOOL_INFO (tool_info))
{
gimp_context_set_tool (gimp_get_current_context (gimage->gimp),
gimp_context_set_tool (gimp_get_user_context (gimage->gimp),
tool_info);
active_tool = tool_manager_get_active (gimage->gimp);
......
......@@ -271,7 +271,9 @@ app_run (const gchar *full_prog_name,
GimpImage *gimage;
GimpPDBStatusType status;
gimage = file_open_with_display (gimp, uri,
gimage = file_open_with_display (gimp,
gimp_get_user_context (gimp),
uri,
&status, &error);
if (! gimage && status != GIMP_PDB_CANCEL)
......
......@@ -132,7 +132,8 @@ batch_run_cmd (Gimp *gimp,
args[0].value.pdb_int = GIMP_RUN_NONINTERACTIVE;
args[1].value.pdb_pointer = (gpointer) cmd;
vals = procedural_db_execute (gimp, "plug_in_script_fu_eval", args);
vals = procedural_db_execute (gimp, gimp_get_user_context (gimp),
"plug_in_script_fu_eval", args);
switch (vals[0].value.pdb_int)
{
......@@ -183,7 +184,8 @@ batch_perl_server (Gimp *gimp,
args[1].value.pdb_int = flags;
args[2].value.pdb_int = extra;
vals = procedural_db_execute (gimp, "extension_perl_server", args);
vals = procedural_db_execute (gimp, gimp_get_user_context (gimp),
"extension_perl_server", args);
switch (vals[0].value.pdb_int)
{
......
......@@ -52,6 +52,7 @@
static const GimpBuffer * gimp_edit_extract (GimpImage *gimage,
GimpDrawable *drawable,
GimpContext *context,
gboolean cut_pixels);
static gboolean gimp_edit_fill_internal (GimpImage *gimage,
GimpDrawable *drawable,
......@@ -64,22 +65,26 @@ static gboolean gimp_edit_fill_internal (GimpImage *gimage,
const GimpBuffer *
gimp_edit_cut (GimpImage *gimage,
GimpDrawable *drawable)
GimpDrawable *drawable,
GimpContext *context)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
return gimp_edit_extract (gimage, drawable, TRUE);
return gimp_edit_extract (gimage, drawable, context, TRUE);
}
const GimpBuffer *
gimp_edit_copy (GimpImage *gimage,
GimpDrawable *drawable)
GimpDrawable *drawable,
GimpContext *context)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
return gimp_edit_extract (gimage, drawable, FALSE);
return gimp_edit_extract (gimage, drawable, context, FALSE);
}
GimpLayer *
......@@ -245,13 +250,14 @@ gimp_edit_paste_as_new (Gimp *gimp,
gboolean
gimp_edit_clear (GimpImage *gimage,
GimpDrawable *drawable)
GimpDrawable *drawable,
GimpContext *context)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), FALSE);
return gimp_edit_fill_internal (gimage, drawable,
gimp_get_current_context (gimage->gimp),
return gimp_edit_fill_internal (gimage, drawable, context,
GIMP_TRANSPARENT_FILL,
_("Clear"));
}
......@@ -259,12 +265,14 @@ gimp_edit_clear (GimpImage *gimage,
gboolean
gimp_edit_fill (GimpImage *gimage,
GimpDrawable *drawable,
GimpContext *context,
GimpFillType fill_type)
{
const gchar *undo_desc;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), FALSE);
switch (fill_type)
{
......@@ -298,8 +306,7 @@ gimp_edit_fill (GimpImage *gimage,
break;
}
return gimp_edit_fill_internal (gimage, drawable,
gimp_get_current_context (gimage->gimp),
return gimp_edit_fill_internal (gimage, drawable, context,
fill_type, undo_desc);
}
......@@ -309,6 +316,7 @@ gimp_edit_fill (GimpImage *gimage,
const GimpBuffer *
gimp_edit_extract (GimpImage *gimage,
GimpDrawable *drawable,
GimpContext *context,
gboolean cut_pixels)
{
TileManager *tiles;
......@@ -322,7 +330,7 @@ gimp_edit_extract (GimpImage *gimage,
/* Cut/copy the mask portion from the gimage */
tiles = gimp_selection_extract (gimp_image_get_mask (gimage),
drawable, cut_pixels, FALSE, TRUE);
drawable, context, cut_pixels, FALSE, TRUE);
if (cut_pixels)
gimp_image_undo_group_end (gimage);
......@@ -377,12 +385,12 @@ gimp_edit_fill_internal (GimpImage *gimage,
switch (fill_type)
{
case GIMP_FOREGROUND_FILL:
gimp_image_get_foreground (gimage, drawable, col);
gimp_image_get_foreground (gimage, drawable, context, col);
break;
case GIMP_BACKGROUND_FILL:
case GIMP_TRANSPARENT_FILL:
gimp_image_get_background (gimage, drawable, col);
gimp_image_get_background (gimage, drawable, context, col);
break;
case GIMP_WHITE_FILL:
......
......@@ -21,9 +21,11 @@
const GimpBuffer * gimp_edit_cut (GimpImage *gimage,
GimpDrawable *drawable);
GimpDrawable *drawable,
GimpContext *context);
const GimpBuffer * gimp_edit_copy (GimpImage *gimage,
GimpDrawable *drawable);
GimpDrawable *drawable,
GimpContext *context);
GimpLayer * gimp_edit_paste (GimpImage *gimage,
GimpDrawable *drawable,
GimpBuffer *paste,
......@@ -36,9 +38,11 @@ GimpImage * gimp_edit_paste_as_new (Gimp *gimp,
GimpImage *gimage,
GimpBuffer *paste);
gboolean gimp_edit_clear (GimpImage *gimage,
GimpDrawable *drawable);
GimpDrawable *drawable,
GimpContext *context);
gboolean gimp_edit_fill (GimpImage *gimage,
GimpDrawable *drawable,
GimpContext *context,
GimpFillType fill_type);
......
......@@ -102,6 +102,7 @@ static void sample_linear (PixelSurround *surround,
TileManager *
gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
GimpContext *context,
TileManager *orig_tiles,
const GimpMatrix3 *matrix,
GimpTransformDirection direction,
......@@ -144,6 +145,7 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
guchar bg_color[MAX_CHANNELS];
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
g_return_val_if_fail (orig_tiles != NULL, NULL);
g_return_val_if_fail (matrix != NULL, NULL);
......@@ -161,7 +163,7 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
interpolation_type = GIMP_INTERPOLATION_NONE;
/* Get the background color */
gimp_image_get_background (gimage, drawable, bg_color);
gimp_image_get_background (gimage, drawable, context, bg_color);
switch (GIMP_IMAGE_TYPE_BASE_TYPE (gimp_drawable_type (drawable)))
{
......@@ -455,6 +457,7 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
TileManager *
gimp_drawable_transform_tiles_flip (GimpDrawable *drawable,
GimpContext *context,
TileManager *orig_tiles,
GimpOrientationType flip_type,
gdouble axis,
......@@ -471,6 +474,7 @@ gimp_drawable_transform_tiles_flip (GimpDrawable *drawable,
gint i;
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
g_return_val_if_fail (orig_tiles != NULL, NULL);
gimage = gimp_item_get_image (GIMP_ITEM (drawable));
......@@ -513,7 +517,7 @@ gimp_drawable_transform_tiles_flip (GimpDrawable *drawable,
tile_manager_set_offsets (new_tiles, orig_x, orig_y);
gimp_image_get_background (gimage, drawable, bg_color);
gimp_image_get_background (gimage, drawable, context, bg_color);
/* "Outside" a channel is transparency, not the bg color */
if (GIMP_IS_CHANNEL (drawable))
......@@ -614,6 +618,7 @@ gimp_drawable_transform_rotate_point (gint x,
TileManager *
gimp_drawable_transform_tiles_rotate (GimpDrawable *drawable,
GimpContext *context,
TileManager *orig_tiles,
GimpRotationType rotate_type,
gdouble center_x,
......@@ -632,6 +637,7 @@ gimp_drawable_transform_tiles_rotate (GimpDrawable *drawable,
gint i, j, k;
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
g_return_val_if_fail (orig_tiles != NULL, NULL);
gimage = gimp_item_get_image (GIMP_ITEM (drawable));
......@@ -689,7 +695,7 @@ gimp_drawable_transform_tiles_rotate (GimpDrawable *drawable,
tile_manager_set_offsets (new_tiles, orig_x, orig_y);
gimp_image_get_background (gimage, drawable, bg_color);
gimp_image_get_background (gimage, drawable, context, bg_color);
/* "Outside" a channel is transparency, not the bg color */
if (GIMP_IS_CHANNEL (drawable))
......@@ -832,6 +838,7 @@ gimp_drawable_transform_tiles_rotate (GimpDrawable *drawable,
gboolean
gimp_drawable_transform_affine (GimpDrawable *drawable,
GimpContext *context,
const GimpMatrix3 *matrix,
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
......@@ -845,6 +852,7 @@ gimp_drawable_transform_affine (GimpDrawable *drawable,
gboolean success = FALSE;
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), FALSE);
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), FALSE);
g_return_val_if_fail (matrix != NULL, FALSE);
......@@ -855,7 +863,7 @@ gimp_drawable_transform_affine (GimpDrawable *drawable,
GIMP_UNDO_GROUP_TRANSFORM, _("Transform"));
/* Cut/Copy from the specified drawable */
orig_tiles = gimp_drawable_transform_cut (drawable, &new_layer);
orig_tiles = gimp_drawable_transform_cut (drawable, context, &new_layer);
if (orig_tiles)
{
......@@ -866,7 +874,7 @@ gimp_drawable_transform_affine (GimpDrawable *drawable,
clip_result = TRUE;
/* transform the buffer */
new_tiles = gimp_drawable_transform_tiles_affine (drawable,
new_tiles = gimp_drawable_transform_tiles_affine (drawable, context,
orig_tiles,
matrix,
GIMP_TRANSFORM_FORWARD,
......@@ -895,6 +903,7 @@ gimp_drawable_transform_affine (GimpDrawable *drawable,
gboolean
gimp_drawable_transform_flip (GimpDrawable *drawable,
GimpContext *context,
GimpOrientationType flip_type)
{
GimpImage *gimage;
......@@ -903,6 +912,7 @@ gimp_drawable_transform_flip (GimpDrawable *drawable,
gboolean success = FALSE;
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
<