Commit 0af39061 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

Fixed bug #78732 (don't paste off screen):

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

	Fixed bug #78732 (don't paste off screen):

	* app/display/gimpdisplayshell-transform.[ch]: added new function
	gimp_display_shell_untransform_viewport() which returns the
	visible rectangle of the image in image coordinates.

	* app/core/gimp-edit.[ch] (gimp_edit_paste): added viewport
	parameters and changed positioning of the pasted layer as follows:

	- if there is a selection, center on the selection (just as before).
	- if there is no viewport, center on the active drawable.
	- if the viewport intersects with the active drawable, center
	  on the intersection.
	- if the viewport does *not* intersect with the active drawable,
	  center on the active drawable (off-screen, but better than pasting
	  something that will be invisible due to floating selection clipping).
	- if there is no active drawable, center on the viewport.
	- if there is no active drawable and no viewport, center on the image.

	* app/widgets/gimpbufferview.c (gimp_buffer_view_paste_clicked)
	(gimp_buffer_view_paste_into_clicked)
	* app/display/gimpdisplayshell-dnd.c (gimp_display_shell_drop_buffer)
	* app/gui/edit-commands.c (edit_paste_cmd_callback)
	(edit_paste_into_cmd_callback): ask the shell for the viewport
	and pass it to gimp_edit_paste().

	* app/display/gimpdisplayshell-dnd.c
	(gimp_display_shell_drop_drawable): center the created layer on
	the viewport.

	* app/tools/gimpmovetool.c (gimp_move_tool_button_release): use
	gimp_display_shell_untransform_viewport() (its code was taken from
	here).

	* tools/pdbgen/pdb/edit.pdb: pass "no viewport" to gimp_edit_paste().

	* app/pdb/edit_cmds.c: regenerated.
parent a1fd8fb4
2004-01-15 Michael Natterer <mitch@gimp.org>
Fixed bug #78732 (don't paste off screen):
* app/display/gimpdisplayshell-transform.[ch]: added new function
gimp_display_shell_untransform_viewport() which returns the
visible rectangle of the image in image coordinates.
* app/core/gimp-edit.[ch] (gimp_edit_paste): added viewport
parameters and changed positioning of the pasted layer as follows:
- if there is a selection, center on the selection (just as before).
- if there is no viewport, center on the active drawable.
- if the viewport intersects with the active drawable, center
on the intersection.
- if the viewport does *not* intersect with the active drawable,
center on the active drawable (off-screen, but better than pasting
something that will be invisible due to floating selection clipping).
- if there is no active drawable, center on the viewport.
- if there is no active drawable and no viewport, center on the image.
* app/widgets/gimpbufferview.c (gimp_buffer_view_paste_clicked)
(gimp_buffer_view_paste_into_clicked)
* app/display/gimpdisplayshell-dnd.c (gimp_display_shell_drop_buffer)
* app/gui/edit-commands.c (edit_paste_cmd_callback)
(edit_paste_into_cmd_callback): ask the shell for the viewport
and pass it to gimp_edit_paste().
* app/display/gimpdisplayshell-dnd.c
(gimp_display_shell_drop_drawable): center the created layer on
the viewport.
* app/tools/gimpmovetool.c (gimp_move_tool_button_release): use
gimp_display_shell_untransform_viewport() (its code was taken from
here).
* tools/pdbgen/pdb/edit.pdb: pass "no viewport" to gimp_edit_paste().
* app/pdb/edit_cmds.c: regenerated.
2004-01-15 Dave Neary <bolsh@gimp.org>
* NEWS: Now that we're in pre-release mode, list all the bugs fixed
......@@ -37,6 +37,8 @@
#include "core/gimptoolinfo.h"
#include "display/gimpdisplay.h"
#include "display/gimpdisplayshell.h"
#include "display/gimpdisplayshell-transform.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpdialogfactory.h"
......@@ -139,10 +141,17 @@ edit_paste_cmd_callback (GtkWidget *widget,
if (gdisp->gimage->gimp->global_buffer)
{
GimpDisplayShell *shell;
gint x, y, width, height;
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
gimp_display_shell_untransform_viewport (shell, &x, &y, &width, &height);
if (gimp_edit_paste (gdisp->gimage,
gimp_image_active_drawable (gdisp->gimage),
gimp_image_active_drawable (gdisp->gimage),
gdisp->gimage->gimp->global_buffer,
FALSE))
FALSE, x, y, width, height))
{
gimp_image_flush (gdisp->gimage);
}
......@@ -158,10 +167,17 @@ edit_paste_into_cmd_callback (GtkWidget *widget,
if (gdisp->gimage->gimp->global_buffer)
{
GimpDisplayShell *shell;
gint x, y, width, height;
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
gimp_display_shell_untransform_viewport (shell, &x, &y, &width, &height);
if (gimp_edit_paste (gdisp->gimage,
gimp_image_active_drawable (gdisp->gimage),
gimp_image_active_drawable (gdisp->gimage),
gdisp->gimage->gimp->global_buffer,
TRUE))
TRUE, x, y, width, height))
{
gimp_image_flush (gdisp->gimage);
}
......
......@@ -33,6 +33,7 @@
#include "gimp.h"
#include "gimp-edit.h"
#include "gimp-utils.h"
#include "gimpbuffer.h"
#include "gimpchannel.h"
#include "gimpcontext.h"
......@@ -85,12 +86,16 @@ GimpLayer *
gimp_edit_paste (GimpImage *gimage,
GimpDrawable *drawable,
GimpBuffer *paste,
gboolean paste_into)
gboolean paste_into,
gint viewport_x,
gint viewport_y,
gint viewport_width,
gint viewport_height)
{
GimpLayer *layer;
GimpImageType type;
gint x1, y1, x2, y2;
gint cx, cy;
gint center_x;
gint center_y;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
g_return_val_if_fail (drawable == NULL || GIMP_IS_DRAWABLE (drawable), NULL);
......@@ -118,22 +123,55 @@ gimp_edit_paste (GimpImage *gimage,
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_EDIT_PASTE,
_("Paste"));
/* Set the offsets to the center of the image */
if (drawable)
{
gimp_item_offsets (GIMP_ITEM (drawable), &cx, &cy);
gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
cx += (x1 + x2) >> 1;
cy += (y1 + y2) >> 1;
/* if pasting to a drawable */
gint off_x, off_y;
gint x1, y1, x2, y2;
gint paste_x, paste_y;
gint paste_width, paste_height;
gboolean have_mask;
gimp_item_offsets (GIMP_ITEM (drawable), &off_x, &off_y);
have_mask = gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
if (! have_mask &&
viewport_width > 0 &&
viewport_height > 0 &&
gimp_rectangle_intersect (viewport_x, viewport_y,
viewport_width, viewport_height,
off_x, off_y,
x2 - x1, y2 - y1,
&paste_x, &paste_y,
&paste_width, &paste_height))
{
center_x = paste_x + paste_width / 2;
center_y = paste_y + paste_height / 2;
}
else
{
center_x = off_x + (x1 + x2) / 2;
center_y = off_y + (y1 + y2) / 2;
}
}
else if (viewport_width > 0 && viewport_height > 0)
{
/* if we got a viewport set the offsets to the center of the viewport */
center_x = viewport_x + viewport_width / 2;
center_y = viewport_y + viewport_height / 2;
}
else
{
cx = gimage->width >> 1;
cy = gimage->height >> 1;
/* otherwise the offsets to the center of the image */
center_x = gimage->width / 2;
center_y = gimage->height / 2;
}
GIMP_ITEM (layer)->offset_x = cx - (GIMP_ITEM (layer)->width >> 1);
GIMP_ITEM (layer)->offset_y = cy - (GIMP_ITEM (layer)->height >> 1);
GIMP_ITEM (layer)->offset_x = center_x - (GIMP_ITEM (layer)->width / 2);
GIMP_ITEM (layer)->offset_y = center_y - (GIMP_ITEM (layer)->height / 2);
/* If there is a selection mask clear it--
* this might not always be desired, but in general,
......
......@@ -27,7 +27,11 @@ const GimpBuffer * gimp_edit_copy (GimpImage *gimage,
GimpLayer * gimp_edit_paste (GimpImage *gimage,
GimpDrawable *drawable,
GimpBuffer *paste,
gboolean paste_into);
gboolean paste_into,
gint viewport_x,
gint viewport_y,
gint viewport_width,
gint viewport_height);
GimpImage * gimp_edit_paste_as_new (Gimp *gimp,
GimpImage *gimage,
GimpBuffer *paste);
......
......@@ -41,6 +41,7 @@
#include "gimpdisplay.h"
#include "gimpdisplayshell.h"
#include "gimpdisplayshell-dnd.h"
#include "gimpdisplayshell-transform.h"
#include "gimp-intl.h"
......@@ -50,13 +51,12 @@ gimp_display_shell_drop_drawable (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
GimpDisplay *gdisp;
GType new_type;
GimpItem *new_item;
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (data);
GimpImage *gimage = shell->gdisp->gimage;
GType new_type;
GimpItem *new_item;
gdisp = GIMP_DISPLAY_SHELL (data)->gdisp;
if (gdisp->gimage->gimp->busy)
if (gimage->gimp->busy)
return;
if (GIMP_IS_LAYER (viewable))
......@@ -64,34 +64,36 @@ gimp_display_shell_drop_drawable (GtkWidget *widget,
else
new_type = GIMP_TYPE_LAYER;
new_item = gimp_item_convert (GIMP_ITEM (viewable), gdisp->gimage,
new_type, TRUE);
new_item = gimp_item_convert (GIMP_ITEM (viewable), gimage, new_type, TRUE);
if (new_item)
{
GimpLayer *new_layer;
gint x, y, width, height;
gint off_x, off_y;
new_layer = GIMP_LAYER (new_item);
gimp_image_undo_group_start (gdisp->gimage, GIMP_UNDO_GROUP_EDIT_PASTE,
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_EDIT_PASTE,
_("Drop New Layer"));
gimp_display_shell_untransform_viewport (shell, &x, &y, &width, &height);
gimp_item_offsets (new_item, &off_x, &off_y);
off_x = (gdisp->gimage->width - gimp_item_width (new_item)) / 2 - off_x;
off_y = (gdisp->gimage->height - gimp_item_height (new_item)) / 2 - off_y;
off_x = x + (width - gimp_item_width (new_item)) / 2 - off_x;
off_y = y + (height - gimp_item_height (new_item)) / 2 - off_y;
gimp_item_translate (new_item, off_x, off_y, FALSE);
gimp_image_add_layer (gdisp->gimage, new_layer, -1);
gimp_image_add_layer (gimage, new_layer, -1);
gimp_image_undo_group_end (gdisp->gimage);
gimp_image_undo_group_end (gimage);
gimp_image_flush (gdisp->gimage);
gimp_image_flush (gimage);
gimp_context_set_display (gimp_get_user_context (gdisp->gimage->gimp),
gdisp);
gimp_context_set_display (gimp_get_user_context (gimage->gimp),
shell->gdisp);
}
}
......@@ -206,17 +208,11 @@ gimp_display_shell_drop_pattern (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
GimpDisplay *gdisp;
gdisp = GIMP_DISPLAY_SHELL (data)->gdisp;
GimpDisplay *gdisp = GIMP_DISPLAY_SHELL (data)->gdisp;
if (GIMP_IS_PATTERN (viewable))
{
gimp_display_shell_bucket_fill (gdisp->gimage,
GIMP_PATTERN_BUCKET_FILL,
NULL,
GIMP_PATTERN (viewable));
}
gimp_display_shell_bucket_fill (gdisp->gimage, GIMP_PATTERN_BUCKET_FILL,
NULL, GIMP_PATTERN (viewable));
}
void
......@@ -224,14 +220,10 @@ gimp_display_shell_drop_color (GtkWidget *widget,
const GimpRGB *color,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplay *gdisp = GIMP_DISPLAY_SHELL (data)->gdisp;
gdisp = GIMP_DISPLAY_SHELL (data)->gdisp;
gimp_display_shell_bucket_fill (gdisp->gimage,
GIMP_FG_BUCKET_FILL,
color,
NULL);
gimp_display_shell_bucket_fill (gdisp->gimage, GIMP_FG_BUCKET_FILL,
color, NULL);
}
void
......@@ -239,22 +231,26 @@ gimp_display_shell_drop_buffer (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
GimpBuffer *buffer;
GimpDisplay *gdisp;
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (data);
GimpImage *gimage = shell->gdisp->gimage;
GimpBuffer *buffer;
gint x, y, width, height;
gdisp = GIMP_DISPLAY_SHELL (data)->gdisp;
if (gdisp->gimage->gimp->busy)
if (gimage->gimp->busy)
return;
buffer = GIMP_BUFFER (viewable);
gimp_display_shell_untransform_viewport (shell, &x, &y, &width, &height);
/* FIXME: popup a menu for selecting "Paste Into" */
gimp_edit_paste (gdisp->gimage,
gimp_image_active_drawable (gdisp->gimage),
buffer,
FALSE);
gimp_edit_paste (gimage, gimp_image_active_drawable (gimage),
buffer, FALSE,
x, y, width, height);
gimp_image_flush (gimage);
gimp_image_flush (gdisp->gimage);
gimp_context_set_display (gimp_get_user_context (gimage->gimp),
shell->gdisp);
}
......@@ -214,3 +214,34 @@ gimp_display_shell_untransform_xy_f (GimpDisplayShell *shell,
*nx = (x + shell->offset_x) / scalex - offset_x;
*ny = (y + shell->offset_y) / scaley - offset_y;
}
void
gimp_display_shell_untransform_viewport (GimpDisplayShell *shell,
gint *x,
gint *y,
gint *width,
gint *height)
{
gint x1, y1, x2, y2;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
gimp_display_shell_untransform_xy (shell,
0, 0,
&x1, &y1,
FALSE, FALSE);
gimp_display_shell_untransform_xy (shell,
shell->disp_width, shell->disp_height,
&x2, &y2,
FALSE, FALSE);
if (x1 < 0) x1 = 0;
if (y1 < 0) y1 = 0;
if (x2 > shell->gdisp->gimage->width) x2 = shell->gdisp->gimage->width;
if (y2 > shell->gdisp->gimage->height) y2 = shell->gdisp->gimage->height;
if (x) *x = x1;
if (y) *y = y1;
if (width) *width = x2 - x1;
if (height) *height = y2 - y1;
}
......@@ -20,39 +20,45 @@
#define __GIMP_DISPLAY_SHELL_TRANSFORM_H__
void gimp_display_shell_transform_coords (GimpDisplayShell *shell,
GimpCoords *image_coords,
GimpCoords *display_coords);
void gimp_display_shell_untransform_coords (GimpDisplayShell *shell,
GimpCoords *display_coords,
GimpCoords *image_coords);
void gimp_display_shell_transform_xy (GimpDisplayShell *shell,
gint x,
gint y,
gint *nx,
gint *ny,
gboolean use_offsets);
void gimp_display_shell_untransform_xy (GimpDisplayShell *shell,
gint x,
gint y,
gint *nx,
gint *ny,
gboolean round,
gboolean use_offsets);
void gimp_display_shell_transform_xy_f (GimpDisplayShell *shell,
gdouble x,
gdouble y,
gdouble *nx,
gdouble *ny,
gboolean use_offsets);
void gimp_display_shell_untransform_xy_f (GimpDisplayShell *shell,
gdouble x,
gdouble y,
gdouble *nx,
gdouble *ny,
gboolean use_offsets);
void gimp_display_shell_transform_coords (GimpDisplayShell *shell,
GimpCoords *image_coords,
GimpCoords *display_coords);
void gimp_display_shell_untransform_coords (GimpDisplayShell *shell,
GimpCoords *display_coords,
GimpCoords *image_coords);
void gimp_display_shell_transform_xy (GimpDisplayShell *shell,
gint x,
gint y,
gint *nx,
gint *ny,
gboolean use_offsets);
void gimp_display_shell_untransform_xy (GimpDisplayShell *shell,
gint x,
gint y,
gint *nx,
gint *ny,
gboolean round,
gboolean use_offsets);
void gimp_display_shell_transform_xy_f (GimpDisplayShell *shell,
gdouble x,
gdouble y,
gdouble *nx,
gdouble *ny,
gboolean use_offsets);
void gimp_display_shell_untransform_xy_f (GimpDisplayShell *shell,
gdouble x,
gdouble y,
gdouble *nx,
gdouble *ny,
gboolean use_offsets);
void gimp_display_shell_untransform_viewport (GimpDisplayShell *shell,
gint *x,
gint *y,
gint *width,
gint *height);
#endif /* __GIMP_DISPLAY_SHELL_TRANSFORM_H__ */
......@@ -37,6 +37,8 @@
#include "core/gimptoolinfo.h"
#include "display/gimpdisplay.h"
#include "display/gimpdisplayshell.h"
#include "display/gimpdisplayshell-transform.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpdialogfactory.h"
......@@ -139,10 +141,17 @@ edit_paste_cmd_callback (GtkWidget *widget,
if (gdisp->gimage->gimp->global_buffer)
{
GimpDisplayShell *shell;
gint x, y, width, height;
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
gimp_display_shell_untransform_viewport (shell, &x, &y, &width, &height);
if (gimp_edit_paste (gdisp->gimage,
gimp_image_active_drawable (gdisp->gimage),
gimp_image_active_drawable (gdisp->gimage),
gdisp->gimage->gimp->global_buffer,
FALSE))
FALSE, x, y, width, height))
{
gimp_image_flush (gdisp->gimage);
}
......@@ -158,10 +167,17 @@ edit_paste_into_cmd_callback (GtkWidget *widget,
if (gdisp->gimage->gimp->global_buffer)
{
GimpDisplayShell *shell;
gint x, y, width, height;
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
gimp_display_shell_untransform_viewport (shell, &x, &y, &width, &height);
if (gimp_edit_paste (gdisp->gimage,
gimp_image_active_drawable (gdisp->gimage),
gimp_image_active_drawable (gdisp->gimage),
gdisp->gimage->gimp->global_buffer,
TRUE))
TRUE, x, y, width, height))
{
gimp_image_flush (gdisp->gimage);
}
......
......@@ -173,7 +173,7 @@ edit_paste_invoker (Gimp *gimp,
if (success)
{
gimage = gimp_item_get_image (GIMP_ITEM (drawable));
layer = gimp_edit_paste (gimage, drawable, gimp->global_buffer, paste_into);
layer = gimp_edit_paste (gimage, drawable, gimp->global_buffer, paste_into, -1, -1, -1, -1);
success = layer != NULL;
}
......
......@@ -346,8 +346,7 @@ gimp_move_tool_button_release (GimpTool *tool,
if (move->moving_guide)
{
gboolean delete_guide = FALSE;
gint x1, y1;
gint x2, y2;
gint x, y, width, height;
gimp_tool_control_set_scroll_lock (tool->control, FALSE);
gimp_draw_tool_stop (GIMP_DRAW_TOOL (tool));
......@@ -363,29 +362,19 @@ gimp_move_tool_button_release (GimpTool *tool,
return;
}
gimp_display_shell_untransform_xy (shell,
0, 0,
&x1, &y1,
FALSE, FALSE);
gimp_display_shell_untransform_xy (shell,
shell->disp_width, shell->disp_height,
&x2, &y2,
FALSE, FALSE);
if (x1 < 0) x1 = 0;
if (y1 < 0) y1 = 0;
if (x2 > gdisp->gimage->width) x2 = gdisp->gimage->width;
if (y2 > gdisp->gimage->height) y2 = gdisp->gimage->height;
gimp_display_shell_untransform_viewport (shell, &x, &y, &width, &height);
switch (move->guide_orientation)
{
case GIMP_ORIENTATION_HORIZONTAL:
if ((move->guide_position < y1) || (move->guide_position > y2))
if ((move->guide_position < y) ||
(move->guide_position > (y + height)))
delete_guide = TRUE;
break;
case GIMP_ORIENTATION_VERTICAL:
if ((move->guide_position < x1) || (move->guide_position > x2))
if ((move->guide_position < x) ||
(move->guide_position > (x + width)))
delete_guide = TRUE;
break;
......
......@@ -27,12 +27,21 @@
#include "widgets-types.h"
#ifdef __GNUC__
#warning FIXME #include "display/display-types.h"
#endif
#include "display/display-types.h"
#include "core/gimp-edit.h"
#include "core/gimpbuffer.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "display/gimpdisplay.h"
#include "display/gimpdisplayshell.h"
#include "display/gimpdisplayshell-transform.h"
#include "gimpcontainerview.h"
#include "gimpbufferview.h"
#include "gimpdnd.h"
......@@ -195,26 +204,39 @@ static void
gimp_buffer_view_paste_clicked (GtkWidget *widget,
GimpBufferView *view)
{
GimpContainerEditor *editor;
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (view);
GimpBuffer *buffer;
editor = GIMP_CONTAINER_EDITOR (view);
buffer = gimp_context_get_buffer (editor->view->context);
if (buffer && gimp_container_have (editor->view->container,
GIMP_OBJECT (buffer)))
{
GimpImage *gimage;
GimpDisplay *gdisp = gimp_context_get_display (editor->view->context);
GimpImage *gimage = NULL;
gint x = -1;
gint y = -1;
gint width = -1;
gint height = -1;;
if (gdisp)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (gdisp->shell);
gimp_display_shell_untransform_viewport (shell,
&x, &y, &width, &height);
gimage = gimp_context_get_image (editor->view->context);
gimage = gdisp->gimage;
}
else
{
gimage = gimp_context_get_image (editor->view->context);
}
if (gimage)
{
gimp_edit_paste (gimage,
gimp_image_active_drawable (gimage),
buffer,
FALSE);
{
gimp_edit_paste (gimage, gimp_image_active_drawable (gimage),
buffer, FALSE, x, y, width, height);
gimp_image_flush (gimage);
}
......@@ -225,26 +247,39 @@ static void
gimp_buffer_view_paste_into_clicked (GtkWidget *widget,
GimpBufferView *view)
{
GimpContainerEditor *editor;
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (view);
GimpBuffer *buffer;
editor = GIMP_CONTAINER_EDITOR (view);
buffer = gimp_context_get_buffer (editor->view->context);
if (buffer && gimp_container_have (editor->view->container,
GIMP_OBJECT (buffer)))
{
GimpImage *gimage;
GimpDisplay *gdisp = gimp_context_get_display (editor->view->context);
GimpImage *gimage = NULL;
gint x = -1;
gint y = -1;
gint width = -1;
gint height = -1;;
if (gdisp)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (gdisp->shell);
gimp_display_shell_untransform_viewport (shell,
&x, &y, &width, &height);
gimage = gimp_context_get_image (editor->view->context);
gimage = gdisp->gimage;
}
else
{
gimage = gimp_context_get_image (editor->view->context);
}
if (gimage)
{
gimp_edit_paste (gimage,
gimp_image_active_drawable (gimage),
buffer,
TRUE);
{
gimp_edit_paste (gimage, gimp_image_active_drawable (gimage),
buffer, TRUE, x, y, width, height);
gimp_image_flush (gimage);
}
......@@ -255,24 +290,18 @@ static void
gimp_buffer_view_paste_as_new_clicked (GtkWidget *widget,
GimpBufferView *view)
{
GimpContainerEditor *editor;
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (view);
GimpBuffer *buffer;
editor = GIMP_CONTAINER_EDITOR (view);
buffer = gimp_context_get_buffer (editor->view->context);
if (buffer && gimp_container_have (editor->view->container,
GIMP_OBJECT (buffer)))
{
GimpImage *gimage;
gimage = gimp_context_get_image (editor->view->context);
GimpImage *gimage = gimp_context_get_image (editor->view->context);
if (gimage)
{
gimp_edit_paste_as_new (gimage->gimp, gimage, buffer);
}
gimp_edit_paste_as_new (gimage->gimp, gimage, buffer);
}
}
......@@ -280,11 +309,9 @@ static void
gimp_buffer_view_delete_clicked (GtkWidget *widget,
GimpBufferView *view)
{
GimpContainerEditor *editor;
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (view);
GimpBuffer *buffer;
editor = GIMP_CONTAINER_EDITOR (view);
buffer = gimp_context_get_buffer (editor->view->context);
if (buffer && gimp_container_have (editor->view->container,
......@@ -311,9 +338,8 @@ gimp_buffer_view_select_item (GimpContainerEditor *editor,