Commit f504187d authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

app/channel.[ch] app/gimpdrawable.[ch] moved the "removed" signal from

2001-01-14  Michael Natterer  <mitch@gimp.org>

	* app/channel.[ch]
	* app/gimpdrawable.[ch]
	* app/layer.[ch]: moved the "removed" signal from GimpChannel and
	GimpLayer to GimpDrawable.

	* app/gimpimage.[ch]: changed accordingly.
parent 83757a67
2001-01-14 Michael Natterer <mitch@gimp.org>
* app/channel.[ch]
* app/gimpdrawable.[ch]
* app/layer.[ch]: moved the "removed" signal from GimpChannel and
GimpLayer to GimpDrawable.
* app/gimpimage.[ch]: changed accordingly.
2001-01-14 Michael Natterer <mitch@gimp.org>
* app/docindex.c
......
......@@ -50,12 +50,6 @@
#include "libgimp/gimpintl.h"
enum
{
REMOVED,
LAST_SIGNAL
};
static void gimp_channel_class_init (GimpChannelClass *klass);
static void gimp_channel_init (GimpChannel *channel);
static void gimp_channel_destroy (GtkObject *object);
......@@ -64,10 +58,10 @@ static TempBuf * channel_preview_private (Channel *channel,
gint width,
gint height);
static guint channel_signals[LAST_SIGNAL] = { 0 };
static GimpDrawableClass *parent_class = NULL;
GtkType
gimp_channel_get_type (void)
{
......@@ -102,20 +96,7 @@ gimp_channel_class_init (GimpChannelClass *klass)
parent_class = gtk_type_class (GIMP_TYPE_DRAWABLE);
channel_signals[REMOVED] =
gtk_signal_new ("removed",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpChannelClass,
removed),
gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);
gtk_object_class_add_signals (object_class, channel_signals, LAST_SIGNAL);
object_class->destroy = gimp_channel_destroy;
klass->removed = NULL;
}
static void
......@@ -318,20 +299,6 @@ gimp_channel_destroy (GtkObject *object)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
/* The removed signal is sent out when the channel is no longer
* associcated with an image. It's needed because channels aren't
* destroyed immediately, but kept around for undo purposes. Connect
* to the removed signal to update bits of UI that are tied to a
* particular layer. */
void
channel_removed (Channel *channel)
{
g_return_if_fail (channel != NULL);
g_return_if_fail (GIMP_IS_CHANNEL (channel));
gtk_signal_emit (GTK_OBJECT (channel), channel_signals[REMOVED]);
}
void
channel_scale (Channel *channel,
gint new_width,
......
......@@ -63,8 +63,6 @@ struct _GimpChannel
struct _GimpChannelClass
{
GimpDrawableClass parent_class;
void (* removed) (GimpChannel *channel);
};
......
......@@ -50,12 +50,6 @@
#include "libgimp/gimpintl.h"
enum
{
REMOVED,
LAST_SIGNAL
};
static void gimp_channel_class_init (GimpChannelClass *klass);
static void gimp_channel_init (GimpChannel *channel);
static void gimp_channel_destroy (GtkObject *object);
......@@ -64,10 +58,10 @@ static TempBuf * channel_preview_private (Channel *channel,
gint width,
gint height);
static guint channel_signals[LAST_SIGNAL] = { 0 };
static GimpDrawableClass *parent_class = NULL;
GtkType
gimp_channel_get_type (void)
{
......@@ -102,20 +96,7 @@ gimp_channel_class_init (GimpChannelClass *klass)
parent_class = gtk_type_class (GIMP_TYPE_DRAWABLE);
channel_signals[REMOVED] =
gtk_signal_new ("removed",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpChannelClass,
removed),
gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);
gtk_object_class_add_signals (object_class, channel_signals, LAST_SIGNAL);
object_class->destroy = gimp_channel_destroy;
klass->removed = NULL;
}
static void
......@@ -318,20 +299,6 @@ gimp_channel_destroy (GtkObject *object)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
/* The removed signal is sent out when the channel is no longer
* associcated with an image. It's needed because channels aren't
* destroyed immediately, but kept around for undo purposes. Connect
* to the removed signal to update bits of UI that are tied to a
* particular layer. */
void
channel_removed (Channel *channel)
{
g_return_if_fail (channel != NULL);
g_return_if_fail (GIMP_IS_CHANNEL (channel));
gtk_signal_emit (GTK_OBJECT (channel), channel_signals[REMOVED]);
}
void
channel_scale (Channel *channel,
gint new_width,
......
......@@ -63,8 +63,6 @@ struct _GimpChannel
struct _GimpChannelClass
{
GimpDrawableClass parent_class;
void (* removed) (GimpChannel *channel);
};
......
......@@ -50,12 +50,6 @@
#include "libgimp/gimpintl.h"
enum
{
REMOVED,
LAST_SIGNAL
};
static void gimp_channel_class_init (GimpChannelClass *klass);
static void gimp_channel_init (GimpChannel *channel);
static void gimp_channel_destroy (GtkObject *object);
......@@ -64,10 +58,10 @@ static TempBuf * channel_preview_private (Channel *channel,
gint width,
gint height);
static guint channel_signals[LAST_SIGNAL] = { 0 };
static GimpDrawableClass *parent_class = NULL;
GtkType
gimp_channel_get_type (void)
{
......@@ -102,20 +96,7 @@ gimp_channel_class_init (GimpChannelClass *klass)
parent_class = gtk_type_class (GIMP_TYPE_DRAWABLE);
channel_signals[REMOVED] =
gtk_signal_new ("removed",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpChannelClass,
removed),
gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);
gtk_object_class_add_signals (object_class, channel_signals, LAST_SIGNAL);
object_class->destroy = gimp_channel_destroy;
klass->removed = NULL;
}
static void
......@@ -318,20 +299,6 @@ gimp_channel_destroy (GtkObject *object)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
/* The removed signal is sent out when the channel is no longer
* associcated with an image. It's needed because channels aren't
* destroyed immediately, but kept around for undo purposes. Connect
* to the removed signal to update bits of UI that are tied to a
* particular layer. */
void
channel_removed (Channel *channel)
{
g_return_if_fail (channel != NULL);
g_return_if_fail (GIMP_IS_CHANNEL (channel));
gtk_signal_emit (GTK_OBJECT (channel), channel_signals[REMOVED]);
}
void
channel_scale (Channel *channel,
gint new_width,
......
......@@ -63,8 +63,6 @@ struct _GimpChannel
struct _GimpChannelClass
{
GimpDrawableClass parent_class;
void (* removed) (GimpChannel *channel);
};
......
......@@ -48,6 +48,7 @@
enum
{
REMOVED,
INVALIDATE_PREVIEW,
LAST_SIGNAL
};
......@@ -99,6 +100,15 @@ gimp_drawable_class_init (GimpDrawableClass *klass)
parent_class = gtk_type_class (GIMP_TYPE_OBJECT);
gimp_drawable_signals[REMOVED] =
gtk_signal_new ("removed",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpDrawableClass,
removed),
gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);
gimp_drawable_signals[INVALIDATE_PREVIEW] =
gtk_signal_new ("invalidate_preview",
GTK_RUN_FIRST,
......@@ -376,6 +386,19 @@ gimp_drawable_invalidate_preview (GimpDrawable *drawable,
}
}
/* The removed signal is sent out when the layer is no longer
* associcated with an image. It's needed because layers aren't
* destroyed immediately, but kept around for undo purposes. Connect
* to the removed signal to update bits of UI that are tied to a
* particular layer. */
void
gimp_drawable_removed (GimpDrawable *drawable)
{
g_return_if_fail (drawable != NULL);
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
gtk_signal_emit (GTK_OBJECT (drawable), gimp_drawable_signals[REMOVED]);
}
GimpImage *
gimp_drawable_gimage (const GimpDrawable *drawable)
......
......@@ -59,6 +59,7 @@ struct _GimpDrawableClass
{
GimpObjectClass parent_class;
void (* removed) (GimpDrawable *drawable);
void (* invalidate_preview) (GimpDrawable *drawable);
};
......@@ -83,6 +84,8 @@ gboolean gimp_drawable_mask_bounds (GimpDrawable *drawable,
void gimp_drawable_invalidate_preview (GimpDrawable *drawable,
gboolean emit_signal);
void gimp_drawable_removed (GimpDrawable *drawable);
gboolean gimp_drawable_has_alpha (const GimpDrawable *drawable);
GimpImageType gimp_drawable_type (const GimpDrawable *drawable);
GimpImageType gimp_drawable_type_with_alpha (const GimpDrawable *drawable);
......
......@@ -3024,8 +3024,9 @@ gimp_image_merge_layers (GimpImage *gimage,
(g_slist_length (gimage->layers) - position + 1));
}
/* set the name after the original layers have been removed so we don't
end up with #2 appended to the name */
/* set the name after the original layers have been removed so we
* don't end up with #2 appended to the name
*/
gimp_object_set_name (GIMP_OBJECT (merge_layer), name);
g_free (name);
......@@ -3169,7 +3170,7 @@ gimp_image_remove_layer (GimpImage *gimage,
}
/* Send out REMOVED signal from layer */
layer_removed (layer, gimage);
gimp_drawable_removed (GIMP_DRAWABLE (layer));
/* Push the layer undo--It is important it goes here since layer might
* be immediately destroyed if the undo push fails
......@@ -3524,7 +3525,7 @@ gimp_image_remove_channel (GimpImage *gimage,
drawable_height (GIMP_DRAWABLE(channel)));
/* Send out REMOVED signal from channel */
channel_removed (channel);
gimp_drawable_removed (GIMP_DRAWABLE (channel));
/* Important to push the undo here in case the push fails */
undo_push_channel (gimage, CHANNEL_REMOVE_UNDO, cu);
......
......@@ -119,7 +119,7 @@ struct _GimpImage
struct _GimpImageClass
{
GimpObjectClass parent_class;
GimpObjectClass parent_class;
void (* clean) (GimpImage *gimage);
void (* dirty) (GimpImage *gimage);
......
......@@ -3024,8 +3024,9 @@ gimp_image_merge_layers (GimpImage *gimage,
(g_slist_length (gimage->layers) - position + 1));
}
/* set the name after the original layers have been removed so we don't
end up with #2 appended to the name */
/* set the name after the original layers have been removed so we
* don't end up with #2 appended to the name
*/
gimp_object_set_name (GIMP_OBJECT (merge_layer), name);
g_free (name);
......@@ -3169,7 +3170,7 @@ gimp_image_remove_layer (GimpImage *gimage,
}
/* Send out REMOVED signal from layer */
layer_removed (layer, gimage);
gimp_drawable_removed (GIMP_DRAWABLE (layer));
/* Push the layer undo--It is important it goes here since layer might
* be immediately destroyed if the undo push fails
......@@ -3524,7 +3525,7 @@ gimp_image_remove_channel (GimpImage *gimage,
drawable_height (GIMP_DRAWABLE(channel)));
/* Send out REMOVED signal from channel */
channel_removed (channel);
gimp_drawable_removed (GIMP_DRAWABLE (channel));
/* Important to push the undo here in case the push fails */
undo_push_channel (gimage, CHANNEL_REMOVE_UNDO, cu);
......
......@@ -119,7 +119,7 @@ struct _GimpImage
struct _GimpImageClass
{
GimpObjectClass parent_class;
GimpObjectClass parent_class;
void (* clean) (GimpImage *gimage);
void (* dirty) (GimpImage *gimage);
......
......@@ -3024,8 +3024,9 @@ gimp_image_merge_layers (GimpImage *gimage,
(g_slist_length (gimage->layers) - position + 1));
}
/* set the name after the original layers have been removed so we don't
end up with #2 appended to the name */
/* set the name after the original layers have been removed so we
* don't end up with #2 appended to the name
*/
gimp_object_set_name (GIMP_OBJECT (merge_layer), name);
g_free (name);
......@@ -3169,7 +3170,7 @@ gimp_image_remove_layer (GimpImage *gimage,
}
/* Send out REMOVED signal from layer */
layer_removed (layer, gimage);
gimp_drawable_removed (GIMP_DRAWABLE (layer));
/* Push the layer undo--It is important it goes here since layer might
* be immediately destroyed if the undo push fails
......@@ -3524,7 +3525,7 @@ gimp_image_remove_channel (GimpImage *gimage,
drawable_height (GIMP_DRAWABLE(channel)));
/* Send out REMOVED signal from channel */
channel_removed (channel);
gimp_drawable_removed (GIMP_DRAWABLE (channel));
/* Important to push the undo here in case the push fails */
undo_push_channel (gimage, CHANNEL_REMOVE_UNDO, cu);
......
......@@ -119,7 +119,7 @@ struct _GimpImage
struct _GimpImageClass
{
GimpObjectClass parent_class;
GimpObjectClass parent_class;
void (* clean) (GimpImage *gimage);
void (* dirty) (GimpImage *gimage);
......
......@@ -3024,8 +3024,9 @@ gimp_image_merge_layers (GimpImage *gimage,
(g_slist_length (gimage->layers) - position + 1));
}
/* set the name after the original layers have been removed so we don't
end up with #2 appended to the name */
/* set the name after the original layers have been removed so we
* don't end up with #2 appended to the name
*/
gimp_object_set_name (GIMP_OBJECT (merge_layer), name);
g_free (name);
......@@ -3169,7 +3170,7 @@ gimp_image_remove_layer (GimpImage *gimage,
}
/* Send out REMOVED signal from layer */
layer_removed (layer, gimage);
gimp_drawable_removed (GIMP_DRAWABLE (layer));
/* Push the layer undo--It is important it goes here since layer might
* be immediately destroyed if the undo push fails
......@@ -3524,7 +3525,7 @@ gimp_image_remove_channel (GimpImage *gimage,
drawable_height (GIMP_DRAWABLE(channel)));
/* Send out REMOVED signal from channel */
channel_removed (channel);
gimp_drawable_removed (GIMP_DRAWABLE (channel));
/* Important to push the undo here in case the push fails */
undo_push_channel (gimage, CHANNEL_REMOVE_UNDO, cu);
......
......@@ -119,7 +119,7 @@ struct _GimpImage
struct _GimpImageClass
{
GimpObjectClass parent_class;
GimpObjectClass parent_class;
void (* clean) (GimpImage *gimage);
void (* dirty) (GimpImage *gimage);
......
......@@ -3024,8 +3024,9 @@ gimp_image_merge_layers (GimpImage *gimage,
(g_slist_length (gimage->layers) - position + 1));
}
/* set the name after the original layers have been removed so we don't
end up with #2 appended to the name */
/* set the name after the original layers have been removed so we
* don't end up with #2 appended to the name
*/
gimp_object_set_name (GIMP_OBJECT (merge_layer), name);
g_free (name);
......@@ -3169,7 +3170,7 @@ gimp_image_remove_layer (GimpImage *gimage,
}
/* Send out REMOVED signal from layer */
layer_removed (layer, gimage);
gimp_drawable_removed (GIMP_DRAWABLE (layer));
/* Push the layer undo--It is important it goes here since layer might
* be immediately destroyed if the undo push fails
......@@ -3524,7 +3525,7 @@ gimp_image_remove_channel (GimpImage *gimage,
drawable_height (GIMP_DRAWABLE(channel)));
/* Send out REMOVED signal from channel */
channel_removed (channel);
gimp_drawable_removed (GIMP_DRAWABLE (channel));
/* Important to push the undo here in case the push fails */
undo_push_channel (gimage, CHANNEL_REMOVE_UNDO, cu);
......
......@@ -119,7 +119,7 @@ struct _GimpImage
struct _GimpImageClass
{
GimpObjectClass parent_class;
GimpObjectClass parent_class;
void (* clean) (GimpImage *gimage);
void (* dirty) (GimpImage *gimage);
......
......@@ -3024,8 +3024,9 @@ gimp_image_merge_layers (GimpImage *gimage,
(g_slist_length (gimage->layers) - position + 1));
}
/* set the name after the original layers have been removed so we don't
end up with #2 appended to the name */
/* set the name after the original layers have been removed so we
* don't end up with #2 appended to the name
*/
gimp_object_set_name (GIMP_OBJECT (merge_layer), name);
g_free (name);
......@@ -3169,7 +3170,7 @@ gimp_image_remove_layer (GimpImage *gimage,
}
/* Send out REMOVED signal from layer */
layer_removed (layer, gimage);
gimp_drawable_removed (GIMP_DRAWABLE (layer));
/* Push the layer undo--It is important it goes here since layer might
* be immediately destroyed if the undo push fails
......@@ -3524,7 +3525,7 @@ gimp_image_remove_channel (GimpImage *gimage,
drawable_height (GIMP_DRAWABLE(channel)));
/* Send out REMOVED signal from channel */
channel_removed (channel);
gimp_drawable_removed (GIMP_DRAWABLE (channel));
/* Important to push the undo here in case the push fails */
undo_push_channel (gimage, CHANNEL_REMOVE_UNDO, cu);
......
......@@ -119,7 +119,7 @@ struct _GimpImage
struct _GimpImageClass
{
GimpObjectClass parent_class;
GimpObjectClass parent_class;
void (* clean) (GimpImage *gimage);
void (* dirty) (GimpImage *gimage);
......
......@@ -49,12 +49,6 @@
#include "libgimp/gimpintl.h"
enum
{
REMOVED,
LAST_SIGNAL
};
static void gimp_layer_class_init (GimpLayerClass *klass);
static void gimp_layer_init (GimpLayer *layer);
static void gimp_layer_destroy (GtkObject *object);
......@@ -72,12 +66,6 @@ static TempBuf * layer_mask_preview_private (Layer *layer,
gint height);
static guint layer_signals[LAST_SIGNAL] = { 0 };
/*
static guint layer_mask_signals[LAST_SIGNAL] = { 0 };
*/
static GimpDrawableClass *layer_parent_class = NULL;
static GimpChannelClass *layer_mask_parent_class = NULL;
......@@ -118,22 +106,9 @@ gimp_layer_class_init (GimpLayerClass *klass)
layer_parent_class = gtk_type_class (GIMP_TYPE_DRAWABLE);
layer_signals[REMOVED] =
gtk_signal_new ("removed",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpLayerClass,
removed),
gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);
gtk_object_class_add_signals (object_class, layer_signals, LAST_SIGNAL);
object_class->destroy = gimp_layer_destroy;
drawable_class->invalidate_preview = layer_invalidate_preview;
klass->removed = NULL;
}
static void
......@@ -622,21 +597,6 @@ gimp_layer_destroy (GtkObject *object)
(*GTK_OBJECT_CLASS (layer_parent_class)->destroy) (object);
}
/* The removed signal is sent out when the layer is no longer
* associcated with an image. It's needed because layers aren't
* destroyed immediately, but kept around for undo purposes. Connect
* to the removed signal to update bits of UI that are tied to a
* particular layer. */
void
layer_removed (Layer *layer,
gpointer data)
{
g_return_if_fail (layer != NULL);
g_return_if_fail (GIMP_IS_LAYER (layer));
gtk_signal_emit (GTK_OBJECT (layer), layer_signals[REMOVED]);
}
void
layer_apply_mask (Layer *layer,
MaskApplyMode mode)
......
......@@ -71,8 +71,6 @@ struct _GimpLayer
struct _GimpLayerClass
{
GimpDrawableClass parent_class;
void (* removed) (GimpLayer *layer);
};
struct _GimpLayerMask
......@@ -141,8 +139,6 @@ LayerMask * layer_add_mask (Layer *layer,
LayerMask *mask);
Layer * layer_get_ID (gint ID);
void layer_delete (Layer *layer);
void layer_removed (Layer *layer,
gpointer data);
void layer_apply_mask (Layer *layer,
MaskApplyMode mode);
void layer_translate (Layer *layer,
......
......@@ -3024,8 +3024,9 @@ gimp_image_merge_layers (GimpImage *gimage,
(g_slist_length (gimage->layers) - position + 1));
}
/* set the name after the original layers have been removed so we don't
end up with #2 appended to the name */
/* set the name after the original layers have been removed so we
* don't end up with #2 appended to the name
*/
gimp_object_set_name (GIMP_OBJECT (merge_layer), name);
g_free (name);
......@@ -3169,7 +3170,7 @@ gimp_image_remove_layer (GimpImage *gimage,
}
/* Send out REMOVED signal from layer */
layer_removed (layer, gimage);
gimp_drawable_removed (GIMP_DRAWABLE (layer));
/* Push the layer undo--It is important it goes here since layer might
* be immediately destroyed if the undo push fails
......@@ -3524,7 +3525,7 @@ gimp_image_remove_channel (GimpImage *gimage,
drawable_height (GIMP_DRAWABLE(channel)));
/* Send out REMOVED signal from channel */
channel_removed (channel);
gimp_drawable_removed (GIMP_DRAWABLE (channel));
/* Important to push the undo here in case the push fails */
undo_push_channel (gimage, CHANNEL_REMOVE_UNDO, cu);
......
......@@ -119,7 +119,7 @@ struct _GimpImage
struct _GimpImageClass
{
GimpObjectClass parent_class;
GimpObjectClass parent_class;
void (* clean) (GimpImage *gimage);
void (* dirty) (GimpImage *gimage);
......
......@@ -50,12 +50,6 @@
#include "libgimp/gimpintl.h"
enum
{
REMOVED,
LAST_SIGNAL
};
static void gimp_channel_class_init (GimpChannelClass *klass);
static void gimp_channel_init (GimpChannel *channel);
static void gimp_channel_destroy (GtkObject *object);
......@@ -64,10 +58,10 @@ static TempBuf * channel_preview_private (Channel *channel,
gint width,
gint height);
static guint channel_signals[LAST_SIGNAL] = { 0 };
static GimpDrawableClass *parent_class = NULL;
GtkType
gimp_channel_get_type (void)
{
......@@ -102,20 +96,7 @@ gimp_channel_class_init (GimpChannelClass *klass)
parent_class = gtk_type_class (GIMP_TYPE_DRAWABLE);
channel_signals[REMOVED] =
gtk_signal_new ("removed",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpChannelClass,
removed),
gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);
gtk_object_class_add_signals (object_class, channel_signals, LAST_SIGNAL);
object_class->destroy = gimp_channel_destroy;
klass->removed = NULL;
}
static void
......@@ -318,20 +299,6 @@ gimp_channel_destroy (GtkObject *object)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
/* The removed signal is sent out when the channel is no longer
* associcated with an image. It's needed because channels aren't
* destroyed immediately, but kept around for undo purposes. Connect
* to the removed signal to update bits of UI that are tied to a
* particular layer. */
void
channel_removed (Channel *channel)
{
g_return_if_fail (channel != NULL);
g_return_if_fail (GIMP_IS_CHANNEL (channel));
gtk_signal_emit (GTK_OBJECT (channel), channel_signals[REMOVED]);
}
void
channel_scale (Channel *channel,
gint new_width,
......
......@@ -63,8 +63,6 @@ struct _GimpChannel
struct _GimpChannelClass
{
GimpDrawableClass parent_class;
void (* removed) (GimpChannel *channel);
};
......
......@@ -48,6 +48,7 @@
enum
{
REMOVED,
INVALIDATE_PREVIEW,
LAST_SIGNAL