changed the GimpNewDrawableFunc typedef to take an additional

2001-12-17  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpdrawablelistview.[ch]: changed
	the GimpNewDrawableFunc typedef to take an additional
	"GimpDrawable *template" paramater, added the "Drop to New"
	feature again by passing the dropped drawable to
	view->new_drawable_func().

	* app/gui/channels-commands.[ch]: channels_new_channel_query:
	* app/gui/layers-commands.[ch]: layers_new_layer_query:

	Added the "template" parameter because they are used as the
	views' new_drawable_func(), create layers/channels with
	the template's properties if a template is passed.
This commit is contained in:
Michael Natterer
2001-12-17 13:41:23 +00:00
committed by Michael Natterer
parent 9901ec4846
commit d15b07b486
17 changed files with 181 additions and 88 deletions

View File

@ -175,7 +175,7 @@ layers_new_cmd_callback (GtkWidget *widget,
GimpImage *gimage;
return_if_no_image (gimage);
layers_new_layer_query (gimage);
layers_new_layer_query (gimage, NULL);
}
void
@ -562,7 +562,8 @@ new_layer_query_ok_callback (GtkWidget *widget,
}
void
layers_new_layer_query (GimpImage *gimage)
layers_new_layer_query (GimpImage *gimage,
GimpLayer *template)
{
NewLayerOptions *options;
GimpLayer *floating_sel;
@ -574,6 +575,7 @@ layers_new_layer_query (GimpImage *gimage)
GtkWidget *frame;
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (! template || GIMP_IS_LAYER (template));
/* If there is a floating selection, the new command transforms
* the current fs into a new layer
@ -586,6 +588,36 @@ layers_new_layer_query (GimpImage *gimage)
return;
}
if (template)
{
GimpLayer *new_layer;
gint width, height;
gint off_x, off_y;
width = gimp_drawable_width (GIMP_DRAWABLE (template));
height = gimp_drawable_height (GIMP_DRAWABLE (template));
gimp_drawable_offsets (GIMP_DRAWABLE (template), &off_x, &off_y);
undo_push_group_start (gimage, EDIT_PASTE_UNDO);
new_layer = gimp_layer_new (gimage, width, height,
gimp_image_base_type_with_alpha (gimage),
_("Empty Layer Copy"),
template->opacity,
template->mode);
gimp_drawable_fill_by_type (GIMP_DRAWABLE (new_layer),
gimp_get_user_context (gimage->gimp),
TRANSPARENT_FILL);
gimp_layer_translate (new_layer, off_x, off_y);
gimp_image_add_layer (gimage, new_layer, -1);
undo_push_group_end (gimage);
gdisplays_flush ();
return;
}
options = g_new0 (NewLayerOptions, 1);
options->fill_type = fill_type;