Commit 748d432f authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

removed gimp_image_owns_item() again.

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

	* app/core/gimpimage.[ch]: removed gimp_image_owns_item() again.

	* app/core/gimpitem.[ch]: instead, added new virtual function
	GimpItem::is_attached().

	* app/core/gimpchannel.c
	* app/core/gimplayer.c
	* app/core/gimplayermask.c
	* app/core/gimpselection.c
	* app/vectors/gimpvectors.c: implement it.

	* app/core/gimp-edit.c
	* app/core/gimpdrawable-transform.c
	* app/core/gimplayer-floating-sel.c
	* app/text/gimptext-compat.c
	* tools/pdbgen/pdb/edit.pdb
	* tools/pdbgen/pdb/floating_sel.pdb
	* tools/pdbgen/pdb/selection.pdb
	* tools/pdbgen/pdb/text_tool.pdb
	* tools/pdbgen/pdb/transform_tools.pdb_ changed accordingly.

	* app/pdb/edit_cmds.c
	* app/pdb/floating_sel_cmds.c
	* app/pdb/selection_cmds.c
	* app/pdb/text_tool_cmds.c
	* app/pdb/transform_tools_cmds.c: regenerated.
parent dc3ac419
2004-01-26 Michael Natterer <mitch@gimp.org>
* app/core/gimpimage.[ch]: removed gimp_image_owns_item() again.
* app/core/gimpitem.[ch]: instead, added new virtual function
GimpItem::is_attached().
* app/core/gimpchannel.c
* app/core/gimplayer.c
* app/core/gimplayermask.c
* app/core/gimpselection.c
* app/vectors/gimpvectors.c: implement it.
* app/core/gimp-edit.c
* app/core/gimpdrawable-transform.c
* app/core/gimplayer-floating-sel.c
* app/text/gimptext-compat.c
* tools/pdbgen/pdb/edit.pdb
* tools/pdbgen/pdb/floating_sel.pdb
* tools/pdbgen/pdb/selection.pdb
* tools/pdbgen/pdb/text_tool.pdb
* tools/pdbgen/pdb/transform_tools.pdb_ changed accordingly.
* app/pdb/edit_cmds.c
* app/pdb/floating_sel_cmds.c
* app/pdb/selection_cmds.c
* app/pdb/text_tool_cmds.c
* app/pdb/transform_tools_cmds.c: regenerated.
2004-01-26 Michael Natterer <mitch@gimp.org>
* plug-ins/script-fu/scripts/unsharp-mask.scm: add the layer to
......@@ -100,8 +100,7 @@ gimp_edit_paste (GimpImage *gimage,
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
g_return_val_if_fail (drawable == NULL || GIMP_IS_DRAWABLE (drawable), NULL);
g_return_val_if_fail (drawable == NULL ||
gimp_image_owns_item (gimage,
GIMP_ITEM (drawable)), NULL);
gimp_item_is_attached (GIMP_ITEM (drawable)), NULL);
g_return_val_if_fail (GIMP_IS_BUFFER (paste), NULL);
/* Make a new layer: if drawable == NULL,
......
......@@ -814,13 +814,11 @@ 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_item_is_attached (GIMP_ITEM (drawable)), FALSE);
g_return_val_if_fail (matrix != NULL, FALSE);
gimage = gimp_item_get_image (GIMP_ITEM (drawable));
g_return_val_if_fail (gimp_image_owns_item (gimage, GIMP_ITEM (drawable)),
FALSE);
/* Start a transform undo group */
gimp_image_undo_group_start (gimage,
GIMP_UNDO_GROUP_TRANSFORM, _("Transform"));
......@@ -872,12 +870,10 @@ gimp_drawable_transform_flip (GimpDrawable *drawable,
gboolean success = FALSE;
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), FALSE);
gimage = gimp_item_get_image (GIMP_ITEM (drawable));
g_return_val_if_fail (gimp_image_owns_item (gimage, GIMP_ITEM (drawable)),
FALSE);
/* Start a transform undo group */
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_TRANSFORM, _("Flip"));
......@@ -940,12 +936,10 @@ gimp_drawable_transform_rotate (GimpDrawable *drawable,
gboolean success = FALSE;
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), FALSE);
gimage = gimp_item_get_image (GIMP_ITEM (drawable));
g_return_val_if_fail (gimp_image_owns_item (gimage, GIMP_ITEM (drawable)),
FALSE);
/* Start a transform undo group */
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_TRANSFORM, _("Rotate"));
......@@ -1041,13 +1035,11 @@ gimp_drawable_transform_paste (GimpDrawable *drawable,
GimpLayer *floating_layer;
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), FALSE);
g_return_val_if_fail (tiles != NULL, FALSE);
gimage = gimp_item_get_image (GIMP_ITEM (drawable));
g_return_val_if_fail (gimp_image_owns_item (gimage, GIMP_ITEM (drawable)),
FALSE);
if (new_layer)
{
layer =
......
......@@ -41,6 +41,7 @@
#include "gimp.h"
#include "gimp-utils.h"
#include "gimpcontainer.h"
#include "gimpimage.h"
#include "gimpimage-projection.h"
#include "gimpimage-undo.h"
......@@ -63,6 +64,7 @@ static void gimp_channel_finalize (GObject *object);
static gint64 gimp_channel_get_memsize (GimpObject *object,
gint64 *gui_size);
static gboolean gimp_channel_is_attached (GimpItem *item);
static GimpItem * gimp_channel_duplicate (GimpItem *item,
GType new_type,
gboolean add_alpha);
......@@ -227,6 +229,7 @@ gimp_channel_class_init (GimpChannelClass *klass)
viewable_class->default_stock_id = "gimp-channel";
item_class->is_attached = gimp_channel_is_attached;
item_class->duplicate = gimp_channel_duplicate;
item_class->translate = gimp_channel_translate;
item_class->scale = gimp_channel_scale;
......@@ -320,6 +323,13 @@ gimp_channel_get_memsize (GimpObject *object,
return GIMP_OBJECT_CLASS (parent_class)->get_memsize (object, gui_size);
}
static gboolean
gimp_channel_is_attached (GimpItem *item)
{
return (GIMP_IS_IMAGE (item->gimage) &&
gimp_container_have (item->gimage->channels, GIMP_OBJECT (item)));
}
static GimpItem *
gimp_channel_duplicate (GimpItem *item,
GType new_type,
......
......@@ -814,13 +814,11 @@ 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_item_is_attached (GIMP_ITEM (drawable)), FALSE);
g_return_val_if_fail (matrix != NULL, FALSE);
gimage = gimp_item_get_image (GIMP_ITEM (drawable));
g_return_val_if_fail (gimp_image_owns_item (gimage, GIMP_ITEM (drawable)),
FALSE);
/* Start a transform undo group */
gimp_image_undo_group_start (gimage,
GIMP_UNDO_GROUP_TRANSFORM, _("Transform"));
......@@ -872,12 +870,10 @@ gimp_drawable_transform_flip (GimpDrawable *drawable,
gboolean success = FALSE;
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), FALSE);
gimage = gimp_item_get_image (GIMP_ITEM (drawable));
g_return_val_if_fail (gimp_image_owns_item (gimage, GIMP_ITEM (drawable)),
FALSE);
/* Start a transform undo group */
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_TRANSFORM, _("Flip"));
......@@ -940,12 +936,10 @@ gimp_drawable_transform_rotate (GimpDrawable *drawable,
gboolean success = FALSE;
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), FALSE);
gimage = gimp_item_get_image (GIMP_ITEM (drawable));
g_return_val_if_fail (gimp_image_owns_item (gimage, GIMP_ITEM (drawable)),
FALSE);
/* Start a transform undo group */
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_TRANSFORM, _("Rotate"));
......@@ -1041,13 +1035,11 @@ gimp_drawable_transform_paste (GimpDrawable *drawable,
GimpLayer *floating_layer;
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), FALSE);
g_return_val_if_fail (tiles != NULL, FALSE);
gimage = gimp_item_get_image (GIMP_ITEM (drawable));
g_return_val_if_fail (gimp_image_owns_item (gimage, GIMP_ITEM (drawable)),
FALSE);
if (new_layer)
{
layer =
......
......@@ -2093,43 +2093,6 @@ gimp_image_get_vectors (const GimpImage *gimage)
return gimage->vectors;
}
gboolean
gimp_image_owns_item (const GimpImage *gimage,
const GimpItem *item)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
g_return_val_if_fail (GIMP_IS_ITEM (item), FALSE);
if (GIMP_IS_VECTORS (item))
{
return gimp_container_have (gimage->vectors, GIMP_OBJECT (item));
}
else if (GIMP_IS_LAYER_MASK (item))
{
GimpLayerMask *mask = GIMP_LAYER_MASK (item);
GimpLayer *layer = gimp_layer_mask_get_layer (mask);
if (gimp_layer_get_mask (layer) == mask)
return gimp_image_owns_item (gimage, GIMP_ITEM (layer));
return FALSE;
}
else if (GIMP_IS_SELECTION (item))
{
return GIMP_CHANNEL (item) == gimp_image_get_mask (gimage);
}
else if (GIMP_IS_CHANNEL (item))
{
return gimp_container_have (gimage->channels, GIMP_OBJECT (item));
}
else if (GIMP_IS_LAYER (item))
{
return gimp_container_have (gimage->layers, GIMP_OBJECT (item));
}
return FALSE;
}
GimpDrawable *
gimp_image_active_drawable (const GimpImage *gimage)
{
......
......@@ -379,9 +379,6 @@ GimpContainer * gimp_image_get_layers (const GimpImage *gimage);
GimpContainer * gimp_image_get_channels (const GimpImage *gimage);
GimpContainer * gimp_image_get_vectors (const GimpImage *gimage);
gboolean gimp_image_owns_item (const GimpImage *gimage,
const GimpItem *item);
GimpDrawable * gimp_image_active_drawable (const GimpImage *gimage);
GimpLayer * gimp_image_get_active_layer (const GimpImage *gimage);
GimpChannel * gimp_image_get_active_channel (const GimpImage *gimage);
......
......@@ -182,6 +182,7 @@ gimp_item_class_init (GimpItemClass *klass)
klass->visibility_changed = NULL;
klass->linked_changed = NULL;
klass->is_attached = NULL;
klass->duplicate = gimp_item_real_duplicate;
klass->convert = gimp_item_real_convert;
klass->rename = gimp_item_real_rename;
......@@ -190,7 +191,7 @@ gimp_item_class_init (GimpItemClass *klass)
klass->resize = gimp_item_real_resize;
klass->flip = NULL;
klass->rotate = NULL;
klass->transform = NULL;
klass->transform = NULL;
klass->stroke = NULL;
}
......@@ -444,6 +445,14 @@ gimp_item_configure (GimpItem *item,
gimp_object_set_name (GIMP_OBJECT (item), name ? name : _("Unnamed"));
}
gboolean
gimp_item_is_attached (GimpItem *item)
{
g_return_val_if_fail (GIMP_IS_ITEM (item), FALSE);
return GIMP_ITEM_GET_CLASS (item)->is_attached (item);
}
GimpItem *
gimp_item_duplicate (GimpItem *item,
GType new_type,
......
......@@ -63,51 +63,52 @@ struct _GimpItemClass
void (* linked_changed) (GimpItem *item);
/* virtual functions */
GimpItem * (* duplicate) (GimpItem *item,
GType new_type,
gboolean add_alpha);
GimpItem * (* convert) (GimpItem *item,
GimpImage *dest_image,
GType new_type,
gboolean add_alpha);
void (* rename) (GimpItem *item,
const gchar *new_name,
const gchar *undo_desc);
void (* translate) (GimpItem *item,
gint offset_x,
gint offset_y,
gboolean push_undo);
void (* scale) (GimpItem *item,
gint new_width,
gint new_height,
gint new_offset_x,
gint new_offset_y,
GimpInterpolationType interpolation_type);
void (* resize) (GimpItem *item,
gint new_width,
gint new_height,
gint offset_x,
gint offset_y);
void (* flip) (GimpItem *item,
GimpOrientationType flip_type,
gdouble axis,
gboolean clip_result);
void (* rotate) (GimpItem *item,
GimpRotationType rotate_type,
gdouble center_x,
gdouble center_y,
gboolean clip_result);
void (* transform) (GimpItem *item,
const GimpMatrix3 *matrix,
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gboolean clip_result,
GimpProgressFunc progress_callback,
gpointer progress_data);
gboolean (* stroke) (GimpItem *item,
GimpDrawable *drawable,
GimpObject *stroke_desc,
gboolean use_default_values);
gboolean (* is_attached) (GimpItem *item);
GimpItem * (* duplicate) (GimpItem *item,
GType new_type,
gboolean add_alpha);
GimpItem * (* convert) (GimpItem *item,
GimpImage *dest_image,
GType new_type,
gboolean add_alpha);
void (* rename) (GimpItem *item,
const gchar *new_name,
const gchar *undo_desc);
void (* translate) (GimpItem *item,
gint offset_x,
gint offset_y,
gboolean push_undo);
void (* scale) (GimpItem *item,
gint new_width,
gint new_height,
gint new_offset_x,
gint new_offset_y,
GimpInterpolationType interpolation_type);
void (* resize) (GimpItem *item,
gint new_width,
gint new_height,
gint offset_x,
gint offset_y);
void (* flip) (GimpItem *item,
GimpOrientationType flip_type,
gdouble axis,
gboolean clip_result);
void (* rotate) (GimpItem *item,
GimpRotationType rotate_type,
gdouble center_x,
gdouble center_y,
gboolean clip_result);
void (* transform) (GimpItem *item,
const GimpMatrix3 *matrix,
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gboolean clip_result,
GimpProgressFunc progress_callback,
gpointer progress_data);
gboolean (* stroke) (GimpItem *item,
GimpDrawable *drawable,
GimpObject *stroke_desc,
gboolean use_default_values);
const gchar *default_name;
const gchar *rename_desc;
......@@ -121,6 +122,8 @@ void gimp_item_sink (GimpItem *item);
void gimp_item_removed (GimpItem *item);
gboolean gimp_item_is_attached (GimpItem *item);
void gimp_item_configure (GimpItem *item,
GimpImage *gimage,
gint offset_x,
......@@ -160,7 +163,7 @@ void gimp_item_scale (GimpItem *item,
gint new_offset_y,
GimpInterpolationType interpolation);
gboolean gimp_item_scale_by_factors (GimpItem *item,
gdouble w_factor,
gdouble w_factor,
gdouble h_factor,
GimpInterpolationType interpolation);
void gimp_item_scale_by_origin (GimpItem *item,
......
......@@ -49,14 +49,13 @@ floating_sel_attach (GimpLayer *layer,
g_return_if_fail (GIMP_IS_LAYER (layer));
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
g_return_if_fail (drawable != GIMP_DRAWABLE (layer));
g_return_if_fail (gimp_item_get_image (GIMP_ITEM (layer)) ==
gimp_item_get_image (GIMP_ITEM (drawable)));
gimage = gimp_item_get_image (GIMP_ITEM (drawable));
g_return_if_fail (gimp_image_owns_item (gimage, GIMP_ITEM (drawable)));
/* If there is already a floating selection, anchor it */
if (gimage->floating_sel)
{
......
......@@ -70,6 +70,7 @@ static gint64 gimp_layer_get_memsize (GimpObject *object,
static void gimp_layer_invalidate_preview (GimpViewable *viewable);
static gboolean gimp_layer_is_attached (GimpItem *item);
static GimpItem * gimp_layer_duplicate (GimpItem *item,
GType new_type,
gboolean add_alpha);
......@@ -224,6 +225,7 @@ gimp_layer_class_init (GimpLayerClass *klass)
viewable_class->default_stock_id = "gimp-layer";
viewable_class->invalidate_preview = gimp_layer_invalidate_preview;
item_class->is_attached = gimp_layer_is_attached;
item_class->duplicate = gimp_layer_duplicate;
item_class->convert = gimp_layer_convert;
item_class->rename = gimp_layer_rename;
......@@ -353,6 +355,13 @@ gimp_layer_get_active_components (const GimpDrawable *drawable,
active[gimp_drawable_bytes (drawable) - 1] = FALSE;
}
static gboolean
gimp_layer_is_attached (GimpItem *item)
{
return (GIMP_IS_IMAGE (item->gimage) &&
gimp_container_have (item->gimage->layers, GIMP_OBJECT (item)));
}
static GimpItem *
gimp_layer_duplicate (GimpItem *item,
GType new_type,
......
......@@ -27,6 +27,7 @@
#include "core-types.h"
#include "gimpimage.h"
#include "gimplayer.h"
#include "gimplayermask.h"
#include "gimpmarshal.h"
......@@ -43,12 +44,13 @@ enum
};
static void gimp_layer_mask_class_init (GimpLayerMaskClass *klass);
static void gimp_layer_mask_init (GimpLayerMask *layer_mask);
static void gimp_layer_mask_class_init (GimpLayerMaskClass *klass);
static void gimp_layer_mask_init (GimpLayerMask *layer_mask);
static GimpItem * gimp_layer_mask_duplicate (GimpItem *item,
GType new_type,
gboolean add_alpha);
static gboolean gimp_layer_mask_is_attached (GimpItem *item);
static GimpItem * gimp_layer_mask_duplicate (GimpItem *item,
GType new_type,
gboolean add_alpha);
static guint layer_mask_signals[LAST_SIGNAL] = { 0 };
......@@ -120,7 +122,8 @@ gimp_layer_mask_class_init (GimpLayerMaskClass *klass)
gimp_marshal_VOID__VOID,
G_TYPE_NONE, 0);
item_class->duplicate = gimp_layer_mask_duplicate;
item_class->is_attached = gimp_layer_mask_is_attached;
item_class->duplicate = gimp_layer_mask_duplicate;
}
static void
......@@ -132,6 +135,18 @@ gimp_layer_mask_init (GimpLayerMask *layer_mask)
layer_mask->show_mask = FALSE;
}
static gboolean
gimp_layer_mask_is_attached (GimpItem *item)
{
GimpLayerMask *mask = GIMP_LAYER_MASK (item);
GimpLayer *layer = gimp_layer_mask_get_layer (mask);
return (GIMP_IS_IMAGE (item->gimage) &&
GIMP_IS_LAYER (layer) &&
gimp_layer_get_mask (layer) == mask &&
gimp_item_is_attached (GIMP_ITEM (layer)));
}
static GimpItem *
gimp_layer_mask_duplicate (GimpItem *item,
GType new_type,
......
......@@ -44,6 +44,7 @@
static void gimp_selection_class_init (GimpSelectionClass *klass);
static void gimp_selection_init (GimpSelection *selection);
static gboolean gimp_selection_is_attached (GimpItem *item);
static void gimp_selection_translate (GimpItem *item,
gint offset_x,
gint offset_y,
......@@ -172,6 +173,7 @@ gimp_selection_class_init (GimpSelectionClass *klass)
viewable_class->default_stock_id = "gimp-selection";
item_class->is_attached = gimp_selection_is_attached;
item_class->translate = gimp_selection_translate;
item_class->scale = gimp_selection_scale;
item_class->resize = gimp_selection_resize;
......@@ -211,6 +213,13 @@ gimp_selection_init (GimpSelection *selection)
selection->stroking = FALSE;
}
static gboolean
gimp_selection_is_attached (GimpItem *item)
{
return (GIMP_IS_IMAGE (item->gimage) &&
gimp_image_get_mask (item->gimage) == GIMP_CHANNEL (item));
}
static void
gimp_selection_translate (GimpItem *item,
gint offset_x,
......@@ -805,12 +814,10 @@ gimp_selection_float (GimpChannel *selection,
g_return_val_if_fail (GIMP_IS_SELECTION (selection), NULL);
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), NULL);
gimage = gimp_item_get_image (GIMP_ITEM (selection));
g_return_val_if_fail (gimp_image_owns_item (gimage, GIMP_ITEM (drawable)),
NULL);
/* Make sure there is a region to float... */
non_empty = gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
if (! non_empty || (x2 - x1) == 0 || (y2 - y1) == 0)
......
......@@ -171,13 +171,12 @@ edit_paste_invoker (Gimp *gimp,
if (success)
{
GimpImage *gimage = gimp_item_get_image (GIMP_ITEM (drawable));
success = gimp_image_owns_item (gimage, GIMP_ITEM (drawable));
success = gimp_item_is_attached (GIMP_ITEM (drawable));
if (success)
{
layer = gimp_edit_paste (gimage, drawable, gimp->global_buffer,
layer = gimp_edit_paste (gimp_item_get_image (GIMP_ITEM (drawable)),
drawable, gimp->global_buffer,
paste_into, -1, -1, -1, -1);
if (! layer)
success = FALSE;
......
......@@ -29,7 +29,6 @@
#include "procedural_db.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "core/gimplayer-floating-sel.h"
#include "core/gimplayer.h"
......@@ -210,12 +209,10 @@ floating_sel_attach_invoker (Gimp *gimp,
if (success)
{
GimpImage *gimage = gimp_item_get_image (GIMP_ITEM (drawable));
success = gimp_item_is_attached (GIMP_ITEM (drawable));
if (gimp_image_owns_item (gimage, GIMP_ITEM (drawable)))
if (success)
floating_sel_attach (layer, drawable);
else
success = FALSE;
}
return procedural_db_return_args (&floating_sel_attach_proc, success);
......
......@@ -369,12 +369,12 @@ selection_float_invoker (Gimp *gimp,
if (success)
{
GimpImage *gimage = gimp_item_get_image (GIMP_ITEM (drawable));
success = gimp_image_owns_item (gimage, GIMP_ITEM (drawable));
success = gimp_item_is_attached (GIMP_ITEM (drawable));
if (success)
{
GimpImage *gimage = gimp_item_get_image (GIMP_ITEM (drawable));
layer = gimp_selection_float (gimp_image_get_mask (gimage),
drawable, TRUE, offx, offy);
if (! layer)
......
......@@ -20,8 +20,6 @@
#include "config.h"
#include <stdio.h>
#include <string.h>
#include <glib-object.h>
......@@ -103,7 +101,7 @@ text_fontname_invoker (Gimp *gimp,
if (success)
{
if (drawable && ! gimp_image_owns_item (gimage, GIMP_ITEM (drawable)))
if (drawable && ! gimp_item_is_attached (GIMP_ITEM (drawable)))
success = FALSE;
if (success)
......@@ -413,7 +411,7 @@ text_invoker (Gimp *gimp,
if (success)
{
if (drawable && ! gimp_image_owns_item (gimage, GIMP_ITEM (drawable)))
if (drawable && ! gimp_item_is_attached (GIMP_ITEM (drawable)))
success = FALSE;
if (success)
......
......@@ -74,9 +74,7 @@ flip_invoker (Gimp *gimp,
if (success)
{
GimpImage *gimage = gimp_item_get_image (GIMP_ITEM (drawable));
success = gimp_image_owns_item (gimage, GIMP_ITEM (drawable));
success = gimp_item_is_attached (GIMP_ITEM (drawable));
if (success)
success = gimp_drawable_transform_flip (drawable, flip_type);
......@@ -163,9 +161,7 @@ perspective_invoker (Gimp *gimp,
if (success)
{
GimpImage *gimage = gimp_item_get_image (GIMP_ITEM (drawable));
success = gimp_image_owns_item (gimage, GIMP_ITEM (drawable));
success = gimp_item_is_attached (GIMP_ITEM (drawable));
if (success)
{
......@@ -303,9 +299,7 @@ rotate_invoker (Gimp *gimp,
if (success)
{
GimpImage *gimage = gimp_item_get_image (GIMP_ITEM (drawable));
success = gimp_image_owns_item (gimage, GIMP_ITEM (drawable));
success = gimp_item_is_attached (GIMP_ITEM (drawable));
if (success)
{
......@@ -408,9 +402,7 @@ scale_invoker (Gimp *gimp,
if (success)
{
GimpImage *gimage = gimp_item_get_image (GIMP_ITEM (drawable));
success = (gimp_image_owns_item (gimage, GIMP_ITEM (drawable)) &&
success = (gimp_item_is_attached (GIMP_ITEM (drawable)) &&
trans_info[X0] < trans_info[X1] &&
trans_info[Y0] < trans_info[X1]);
......@@ -532,9 +524,7 @@ shear_invoker (Gimp *gimp,
if (success)
{
GimpImage *gimage = gimp_item_get_image (GIMP_ITEM (drawable));
success = gimp_image_owns_item (gimage, GIMP_ITEM (drawable));
success = gimp_item_is_attached (GIMP_ITEM (drawable));
if (success)
{
......@@ -656,9 +646,7 @@ transform_2d_invoker (Gimp *gimp,
if (success)
{
GimpImage *gimage = gimp_item_get_image (GIMP_ITEM (drawable));
success = gimp_image_owns_item (gimage, GIMP_ITEM (drawable));
success = gimp_item_is_attached (GIMP_ITEM (drawable));
if (success)
{
......
......@@ -65,8 +65,7 @@ text_render (GimpImage *gimage,
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
g_return_val_if_fail (drawable == NULL || GIMP_IS_DRAWABLE (drawable), FALSE);
g_return_val_if_fail (drawable == NULL ||
gimp_image_owns_item (gimage,
GIMP_ITEM (drawable)), FALSE);
gimp_item_is_attached (GIMP_ITEM (drawable)), FALSE);
g_return_val_if_fail (fontname != NULL, FALSE);
g_return_val_if_fail (text != NULL, FALSE);
......
......@@ -28,6 +28,7 @@
#include "vectors-types.h"
#include "core/gimp.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimpdrawable-stroke.h"
#include "core/gimp-transform-utils.h"
......@@ -64,6 +65,7 @@ static void gimp_vectors_finalize (GObject *object);
static gint64 gimp_vectors_get_memsize (GimpObject *object,
gint64 *gui_size);
static gboolean gimp_vectors_is_attached (GimpItem *item);
static GimpItem * gimp_vectors_duplicate (GimpItem *item,
GType new_type,
gboolean add_alpha);
......@@ -212,6 +214,7 @@ gimp_vectors_class_init (GimpVectorsClass *klass)
viewable_class->get_new_preview = gimp_vectors_get_new_preview;
viewable_class->default_stock_id = "gimp-path";
item_class->is_attached = gimp_vectors_is_attached;
item_class->duplicate = gimp_vectors_duplicate;
item_class->convert = gimp_vectors_convert;
item_class->translate = gimp_vectors_translate;
......@@ -286,6 +289,12 @@ gimp_vectors_get_memsize (GimpObject *object,
gui_size);
}
static gboolean
gimp_vectors_is_attached (GimpItem *item)
{
return (GIMP_IS_IMAGE (item->gimage) &&
gimp_container_have (item->gimage->vectors, GIMP_OBJECT (item)));
}